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 |
|---|---|---|---|---|---|---|---|---|---|---|
google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.newClass | public static Matcher newClass() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isNew();
}
};
} | java | public static Matcher newClass() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isNew();
}
};
} | [
"public",
"static",
"Matcher",
"newClass",
"(",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"return",
"node",
".",
"isNew",
"(",
")"... | Returns a Matcher that matches constructing new objects. This will match
the NEW node of the JS Compiler AST. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"constructing",
"new",
"objects",
".",
"This",
"will",
"match",
"the",
"NEW",
"node",
"of",
"the",
"JS",
"Compiler",
"AST",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L129-L135 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/core/ArtifactHandler.java | ArtifactHandler.updateDownLoadUrl | public void updateDownLoadUrl(final String gavc, final String downLoadUrl) {
final DbArtifact artifact = getArtifact(gavc);
repositoryHandler.updateDownloadUrl(artifact, downLoadUrl);
} | java | public void updateDownLoadUrl(final String gavc, final String downLoadUrl) {
final DbArtifact artifact = getArtifact(gavc);
repositoryHandler.updateDownloadUrl(artifact, downLoadUrl);
} | [
"public",
"void",
"updateDownLoadUrl",
"(",
"final",
"String",
"gavc",
",",
"final",
"String",
"downLoadUrl",
")",
"{",
"final",
"DbArtifact",
"artifact",
"=",
"getArtifact",
"(",
"gavc",
")",
";",
"repositoryHandler",
".",
"updateDownloadUrl",
"(",
"artifact",
... | Update artifact download url of an artifact
@param gavc String
@param downLoadUrl String | [
"Update",
"artifact",
"download",
"url",
"of",
"an",
"artifact"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ArtifactHandler.java#L212-L215 |
aws/aws-sdk-java | aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java | SimpleDBUtils.encodeZeroPadding | public static String encodeZeroPadding(int number, int maxNumDigits) {
String integerString = Integer.toString(number);
int numZeroes = maxNumDigits - integerString.length();
StringBuffer strBuffer = new StringBuffer(numZeroes + integerString.length());
for (int i = 0; i < numZeroes; i++) {
strBuffer.insert(i, '0');
}
strBuffer.append(integerString);
return strBuffer.toString();
} | java | public static String encodeZeroPadding(int number, int maxNumDigits) {
String integerString = Integer.toString(number);
int numZeroes = maxNumDigits - integerString.length();
StringBuffer strBuffer = new StringBuffer(numZeroes + integerString.length());
for (int i = 0; i < numZeroes; i++) {
strBuffer.insert(i, '0');
}
strBuffer.append(integerString);
return strBuffer.toString();
} | [
"public",
"static",
"String",
"encodeZeroPadding",
"(",
"int",
"number",
",",
"int",
"maxNumDigits",
")",
"{",
"String",
"integerString",
"=",
"Integer",
".",
"toString",
"(",
"number",
")",
";",
"int",
"numZeroes",
"=",
"maxNumDigits",
"-",
"integerString",
"... | Encodes positive integer value into a string by zero-padding number up to the specified
number of digits.
@param number
positive integer to be encoded
@param maxNumDigits
maximum number of digits in the largest value in the data set
@return string representation of the zero-padded integer | [
"Encodes",
"positive",
"integer",
"value",
"into",
"a",
"string",
"by",
"zero",
"-",
"padding",
"number",
"up",
"to",
"the",
"specified",
"number",
"of",
"digits",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java#L43-L52 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java | OrientationHistogramSift.computeHistogram | void computeHistogram(int c_x, int c_y, double sigma) {
int r = (int)Math.ceil(sigma * sigmaEnlarge);
// specify the area being sampled
bound.x0 = c_x - r;
bound.y0 = c_y - r;
bound.x1 = c_x + r + 1;
bound.y1 = c_y + r + 1;
ImageGray rawDX = derivX.getImage();
ImageGray rawDY = derivY.getImage();
// make sure it is contained in the image bounds
BoofMiscOps.boundRectangleInside(rawDX,bound);
// clear the histogram
Arrays.fill(histogramMag,0);
Arrays.fill(histogramX,0);
Arrays.fill(histogramY,0);
// construct the histogram
for( int y = bound.y0; y < bound.y1; y++ ) {
// iterate through the raw array for speed
int indexDX = rawDX.startIndex + y*rawDX.stride + bound.x0;
int indexDY = rawDY.startIndex + y*rawDY.stride + bound.x0;
for( int x = bound.x0; x < bound.x1; x++ ) {
float dx = derivX.getF(indexDX++);
float dy = derivY.getF(indexDY++);
// edge intensity and angle
double magnitude = Math.sqrt(dx*dx + dy*dy);
double theta = UtilAngle.domain2PI(Math.atan2(dy,dx));
// weight from gaussian
double weight = computeWeight( x-c_x, y-c_y , sigma );
// histogram index
int h = (int)(theta / histAngleBin) % histogramMag.length;
// update the histogram
histogramMag[h] += magnitude*weight;
histogramX[h] += dx*weight;
histogramY[h] += dy*weight;
}
}
} | java | void computeHistogram(int c_x, int c_y, double sigma) {
int r = (int)Math.ceil(sigma * sigmaEnlarge);
// specify the area being sampled
bound.x0 = c_x - r;
bound.y0 = c_y - r;
bound.x1 = c_x + r + 1;
bound.y1 = c_y + r + 1;
ImageGray rawDX = derivX.getImage();
ImageGray rawDY = derivY.getImage();
// make sure it is contained in the image bounds
BoofMiscOps.boundRectangleInside(rawDX,bound);
// clear the histogram
Arrays.fill(histogramMag,0);
Arrays.fill(histogramX,0);
Arrays.fill(histogramY,0);
// construct the histogram
for( int y = bound.y0; y < bound.y1; y++ ) {
// iterate through the raw array for speed
int indexDX = rawDX.startIndex + y*rawDX.stride + bound.x0;
int indexDY = rawDY.startIndex + y*rawDY.stride + bound.x0;
for( int x = bound.x0; x < bound.x1; x++ ) {
float dx = derivX.getF(indexDX++);
float dy = derivY.getF(indexDY++);
// edge intensity and angle
double magnitude = Math.sqrt(dx*dx + dy*dy);
double theta = UtilAngle.domain2PI(Math.atan2(dy,dx));
// weight from gaussian
double weight = computeWeight( x-c_x, y-c_y , sigma );
// histogram index
int h = (int)(theta / histAngleBin) % histogramMag.length;
// update the histogram
histogramMag[h] += magnitude*weight;
histogramX[h] += dx*weight;
histogramY[h] += dy*weight;
}
}
} | [
"void",
"computeHistogram",
"(",
"int",
"c_x",
",",
"int",
"c_y",
",",
"double",
"sigma",
")",
"{",
"int",
"r",
"=",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"sigma",
"*",
"sigmaEnlarge",
")",
";",
"// specify the area being sampled",
"bound",
".",
"x0... | Constructs the histogram around the specified point.
@param c_x Center x-axis
@param c_y Center y-axis
@param sigma Scale of feature, adjusted for local octave | [
"Constructs",
"the",
"histogram",
"around",
"the",
"specified",
"point",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L155-L201 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/user/Group.java | Group.getWithJAASKey | public static Group getWithJAASKey(final JAASSystem _jaasSystem,
final String _jaasKey)
throws EFapsException
{
long groupId = 0;
Connection con = null;
try {
con = Context.getConnection();
PreparedStatement stmt = null;
try {
stmt = con.prepareStatement(Group.SQL_JAASKEY);
stmt.setObject(1, _jaasKey);
stmt.setObject(2, _jaasSystem.getId());
final ResultSet rs = stmt.executeQuery();
if (rs.next()) {
groupId = rs.getLong(1);
}
rs.close();
} catch (final SQLException e) {
Group.LOG.error("search for group for JAAS system '" + _jaasSystem.getName() + "' "
+ "with key '" + _jaasKey + "' is not possible", e);
throw new EFapsException(Group.class, "getWithJAASKey.SQLException", e,
_jaasSystem.getName(), _jaasKey);
} finally {
try {
stmt.close();
con.commit();
} catch (final SQLException e) {
Group.LOG.error("Statement could not be closed", e);
}
}
} finally {
try {
if (con != null && !con.isClosed()) {
con.close();
}
} catch (final SQLException e) {
throw new CacheReloadException("Cannot read a type for an attribute.", e);
}
}
return Group.get(groupId);
} | java | public static Group getWithJAASKey(final JAASSystem _jaasSystem,
final String _jaasKey)
throws EFapsException
{
long groupId = 0;
Connection con = null;
try {
con = Context.getConnection();
PreparedStatement stmt = null;
try {
stmt = con.prepareStatement(Group.SQL_JAASKEY);
stmt.setObject(1, _jaasKey);
stmt.setObject(2, _jaasSystem.getId());
final ResultSet rs = stmt.executeQuery();
if (rs.next()) {
groupId = rs.getLong(1);
}
rs.close();
} catch (final SQLException e) {
Group.LOG.error("search for group for JAAS system '" + _jaasSystem.getName() + "' "
+ "with key '" + _jaasKey + "' is not possible", e);
throw new EFapsException(Group.class, "getWithJAASKey.SQLException", e,
_jaasSystem.getName(), _jaasKey);
} finally {
try {
stmt.close();
con.commit();
} catch (final SQLException e) {
Group.LOG.error("Statement could not be closed", e);
}
}
} finally {
try {
if (con != null && !con.isClosed()) {
con.close();
}
} catch (final SQLException e) {
throw new CacheReloadException("Cannot read a type for an attribute.", e);
}
}
return Group.get(groupId);
} | [
"public",
"static",
"Group",
"getWithJAASKey",
"(",
"final",
"JAASSystem",
"_jaasSystem",
",",
"final",
"String",
"_jaasKey",
")",
"throws",
"EFapsException",
"{",
"long",
"groupId",
"=",
"0",
";",
"Connection",
"con",
"=",
"null",
";",
"try",
"{",
"con",
"=... | Returns for given parameter <i>_jaasKey</i> the instance of class
{@link Group}. The parameter <i>_jaasKey</i> is the name of the group
used in the given JAAS system for the group.
@param _jaasSystem JAAS system for which the JAAS key is named
@param _jaasKey key in the foreign JAAS system for which the group
is searched
@return instance of class {@link Group}, or <code>null</code> if group
is not found
@throws EFapsException if group with JAAS key could not be fetched from
eFaps
@see #get(long) | [
"Returns",
"for",
"given",
"parameter",
"<i",
">",
"_jaasKey<",
"/",
"i",
">",
"the",
"instance",
"of",
"class",
"{",
"@link",
"Group",
"}",
".",
"The",
"parameter",
"<i",
">",
"_jaasKey<",
"/",
"i",
">",
"is",
"the",
"name",
"of",
"the",
"group",
"u... | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/user/Group.java#L284-L326 |
valfirst/jbehave-junit-runner | src/main/java/com/github/valfirst/jbehave/junit/monitoring/JUnitScenarioReporter.java | JUnitScenarioReporter.scenarioNotAllowed | @Override
public void scenarioNotAllowed(Scenario scenario, String filter) {
TestState testState = this.testState.get();
notifier.fireTestIgnored(testState.currentStep);
notifier.fireTestIgnored(testState.currentScenario);
} | java | @Override
public void scenarioNotAllowed(Scenario scenario, String filter) {
TestState testState = this.testState.get();
notifier.fireTestIgnored(testState.currentStep);
notifier.fireTestIgnored(testState.currentScenario);
} | [
"@",
"Override",
"public",
"void",
"scenarioNotAllowed",
"(",
"Scenario",
"scenario",
",",
"String",
"filter",
")",
"{",
"TestState",
"testState",
"=",
"this",
".",
"testState",
".",
"get",
"(",
")",
";",
"notifier",
".",
"fireTestIgnored",
"(",
"testState",
... | Notify the IDE that the current step and scenario is not being executed.
Reason is a JBehave meta tag is filtering out this scenario.
@param scenario Scenario
@param filter Filter | [
"Notify",
"the",
"IDE",
"that",
"the",
"current",
"step",
"and",
"scenario",
"is",
"not",
"being",
"executed",
".",
"Reason",
"is",
"a",
"JBehave",
"meta",
"tag",
"is",
"filtering",
"out",
"this",
"scenario",
"."
] | train | https://github.com/valfirst/jbehave-junit-runner/blob/01500b5e8448a9c36fcb9269aaea8690ac028939/src/main/java/com/github/valfirst/jbehave/junit/monitoring/JUnitScenarioReporter.java#L349-L354 |
groovy/groovy-core | src/main/groovy/util/FactoryBuilderSupport.java | FactoryBuilderSupport.postInstantiate | protected void postInstantiate(Object name, Map attributes, Object node) {
for (Closure postInstantiateDelegate : getProxyBuilder().getPostInstantiateDelegates()) {
(postInstantiateDelegate).call(new Object[]{this, attributes, node});
}
} | java | protected void postInstantiate(Object name, Map attributes, Object node) {
for (Closure postInstantiateDelegate : getProxyBuilder().getPostInstantiateDelegates()) {
(postInstantiateDelegate).call(new Object[]{this, attributes, node});
}
} | [
"protected",
"void",
"postInstantiate",
"(",
"Object",
"name",
",",
"Map",
"attributes",
",",
"Object",
"node",
")",
"{",
"for",
"(",
"Closure",
"postInstantiateDelegate",
":",
"getProxyBuilder",
"(",
")",
".",
"getPostInstantiateDelegates",
"(",
")",
")",
"{",
... | A hook after the factory creates the node and before attributes are set.<br>
It will call any registered postInstantiateDelegates, if you override
this method be sure to call this impl somewhere in your code.
@param name the name of the node
@param attributes the attributes for the node
@param node the object created by the node factory | [
"A",
"hook",
"after",
"the",
"factory",
"creates",
"the",
"node",
"and",
"before",
"attributes",
"are",
"set",
".",
"<br",
">",
"It",
"will",
"call",
"any",
"registered",
"postInstantiateDelegates",
"if",
"you",
"override",
"this",
"method",
"be",
"sure",
"t... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/util/FactoryBuilderSupport.java#L1022-L1026 |
querydsl/querydsl | querydsl-codegen/src/main/java/com/querydsl/codegen/ClassPathUtils.java | ClassPathUtils.scanPackage | public static Set<Class<?>> scanPackage(ClassLoader classLoader, Package pkg) throws IOException {
return scanPackage(classLoader, pkg.getName());
} | java | public static Set<Class<?>> scanPackage(ClassLoader classLoader, Package pkg) throws IOException {
return scanPackage(classLoader, pkg.getName());
} | [
"public",
"static",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"scanPackage",
"(",
"ClassLoader",
"classLoader",
",",
"Package",
"pkg",
")",
"throws",
"IOException",
"{",
"return",
"scanPackage",
"(",
"classLoader",
",",
"pkg",
".",
"getName",
"(",
")",
")",... | Return the classes from the given package and subpackages using the supplied classloader
@param classLoader classloader to be used
@param pkg package to scan
@return set of found classes
@throws IOException | [
"Return",
"the",
"classes",
"from",
"the",
"given",
"package",
"and",
"subpackages",
"using",
"the",
"supplied",
"classloader"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-codegen/src/main/java/com/querydsl/codegen/ClassPathUtils.java#L40-L42 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java | AVAKeyword.getOID | static ObjectIdentifier getOID(String keyword, int standard)
throws IOException {
return getOID
(keyword, standard, Collections.<String, String>emptyMap());
} | java | static ObjectIdentifier getOID(String keyword, int standard)
throws IOException {
return getOID
(keyword, standard, Collections.<String, String>emptyMap());
} | [
"static",
"ObjectIdentifier",
"getOID",
"(",
"String",
"keyword",
",",
"int",
"standard",
")",
"throws",
"IOException",
"{",
"return",
"getOID",
"(",
"keyword",
",",
"standard",
",",
"Collections",
".",
"<",
"String",
",",
"String",
">",
"emptyMap",
"(",
")"... | Get an object identifier representing the specified keyword (or
string encoded object identifier) in the given standard.
@throws IOException If the keyword is not valid in the specified standard | [
"Get",
"an",
"object",
"identifier",
"representing",
"the",
"specified",
"keyword",
"(",
"or",
"string",
"encoded",
"object",
"identifier",
")",
"in",
"the",
"given",
"standard",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java#L1231-L1235 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java | Sftp.put | public Sftp put(String srcFilePath, String destPath, Mode mode) {
try {
channel.put(srcFilePath, destPath, mode.ordinal());
} catch (SftpException e) {
throw new JschRuntimeException(e);
}
return this;
} | java | public Sftp put(String srcFilePath, String destPath, Mode mode) {
try {
channel.put(srcFilePath, destPath, mode.ordinal());
} catch (SftpException e) {
throw new JschRuntimeException(e);
}
return this;
} | [
"public",
"Sftp",
"put",
"(",
"String",
"srcFilePath",
",",
"String",
"destPath",
",",
"Mode",
"mode",
")",
"{",
"try",
"{",
"channel",
".",
"put",
"(",
"srcFilePath",
",",
"destPath",
",",
"mode",
".",
"ordinal",
"(",
")",
")",
";",
"}",
"catch",
"(... | 将本地文件上传到目标服务器,目标文件名为destPath,若destPath为目录,则目标文件名将与srcFilePath文件名相同。
@param srcFilePath 本地文件路径
@param destPath 目标路径,
@param mode {@link Mode} 模式
@return this | [
"将本地文件上传到目标服务器,目标文件名为destPath,若destPath为目录,则目标文件名将与srcFilePath文件名相同。"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java#L375-L382 |
JodaOrg/joda-money | src/main/java/org/joda/money/BigMoney.java | BigMoney.plusRetainScale | public BigMoney plusRetainScale(BigDecimal amountToAdd, RoundingMode roundingMode) {
MoneyUtils.checkNotNull(amountToAdd, "Amount must not be null");
if (amountToAdd.compareTo(BigDecimal.ZERO) == 0) {
return this;
}
BigDecimal newAmount = amount.add(amountToAdd);
newAmount = newAmount.setScale(getScale(), roundingMode);
return BigMoney.of(currency, newAmount);
} | java | public BigMoney plusRetainScale(BigDecimal amountToAdd, RoundingMode roundingMode) {
MoneyUtils.checkNotNull(amountToAdd, "Amount must not be null");
if (amountToAdd.compareTo(BigDecimal.ZERO) == 0) {
return this;
}
BigDecimal newAmount = amount.add(amountToAdd);
newAmount = newAmount.setScale(getScale(), roundingMode);
return BigMoney.of(currency, newAmount);
} | [
"public",
"BigMoney",
"plusRetainScale",
"(",
"BigDecimal",
"amountToAdd",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"MoneyUtils",
".",
"checkNotNull",
"(",
"amountToAdd",
",",
"\"Amount must not be null\"",
")",
";",
"if",
"(",
"amountToAdd",
".",
"compareTo",
... | Returns a copy of this monetary value with the amount added retaining
the scale by rounding the result.
<p>
The scale of the result will be the same as the scale of this instance.
For example,'USD 25.95' plus '3.021' gives 'USD 28.97' with most rounding modes.
<p>
This instance is immutable and unaffected by this method.
@param amountToAdd the monetary value to add, not null
@param roundingMode the rounding mode to use to adjust the scale, not null
@return the new instance with the input amount added, never null | [
"Returns",
"a",
"copy",
"of",
"this",
"monetary",
"value",
"with",
"the",
"amount",
"added",
"retaining",
"the",
"scale",
"by",
"rounding",
"the",
"result",
".",
"<p",
">",
"The",
"scale",
"of",
"the",
"result",
"will",
"be",
"the",
"same",
"as",
"the",
... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/BigMoney.java#L985-L993 |
Crab2died/Excel4J | src/main/java/com/github/crab2died/ExcelUtils.java | ExcelUtils.readExcel2List | public List<List<String>> readExcel2List(String excelPath, int offsetLine)
throws IOException, InvalidFormatException {
try (Workbook workbook = WorkbookFactory.create(new FileInputStream(new File(excelPath)))) {
return readExcel2ObjectsHandler(workbook, offsetLine, Integer.MAX_VALUE, 0);
}
} | java | public List<List<String>> readExcel2List(String excelPath, int offsetLine)
throws IOException, InvalidFormatException {
try (Workbook workbook = WorkbookFactory.create(new FileInputStream(new File(excelPath)))) {
return readExcel2ObjectsHandler(workbook, offsetLine, Integer.MAX_VALUE, 0);
}
} | [
"public",
"List",
"<",
"List",
"<",
"String",
">",
">",
"readExcel2List",
"(",
"String",
"excelPath",
",",
"int",
"offsetLine",
")",
"throws",
"IOException",
",",
"InvalidFormatException",
"{",
"try",
"(",
"Workbook",
"workbook",
"=",
"WorkbookFactory",
".",
"... | 读取Excel表格数据,返回{@code List[List[String]]}类型的数据集合
@param excelPath 待读取Excel的路径
@param offsetLine Excel表头行(默认是0)
@return 返回{@code List<List<String>>}类型的数据集合
@throws IOException 异常
@throws InvalidFormatException 异常
@author Crab2Died | [
"读取Excel表格数据",
"返回",
"{",
"@code",
"List",
"[",
"List",
"[",
"String",
"]]",
"}",
"类型的数据集合"
] | train | https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L357-L363 |
OpenTSDB/opentsdb | src/graph/Plot.java | Plot.setParams | public void setParams(final Map<String, String> params) {
// check "format y" and "format y2"
String[] y_format_keys = {"format y", "format y2"};
for(String k : y_format_keys){
if(params.containsKey(k)){
params.put(k, URLDecoder.decode(params.get(k)));
}
}
this.params = params;
} | java | public void setParams(final Map<String, String> params) {
// check "format y" and "format y2"
String[] y_format_keys = {"format y", "format y2"};
for(String k : y_format_keys){
if(params.containsKey(k)){
params.put(k, URLDecoder.decode(params.get(k)));
}
}
this.params = params;
} | [
"public",
"void",
"setParams",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"// check \"format y\" and \"format y2\"",
"String",
"[",
"]",
"y_format_keys",
"=",
"{",
"\"format y\"",
",",
"\"format y2\"",
"}",
";",
"for",
"(",
"St... | Sets the global parameters for this plot.
@param params Each entry is a Gnuplot setting that will be written as-is
in the Gnuplot script file: {@code set KEY VALUE}.
When the value is {@code null} the script will instead contain
{@code unset KEY}.
<p>
Special parameters with a special meaning (since OpenTSDB 1.1):
<ul>
<li>{@code bgcolor}: Either {@code transparent} or an RGB color in
hexadecimal (with a leading 'x' as in {@code x01AB23}).</li>
<li>{@code fgcolor}: An RGB color in hexadecimal ({@code x42BEE7}).</li>
</ul> | [
"Sets",
"the",
"global",
"parameters",
"for",
"this",
"plot",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/graph/Plot.java#L137-L146 |
bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/cardinality/CardinalityLeafSpec.java | CardinalityLeafSpec.applyCardinality | @Override
public boolean applyCardinality( String inputKey, Object input, WalkedPath walkedPath, Object parentContainer ) {
MatchedElement thisLevel = getMatch( inputKey, walkedPath );
if ( thisLevel == null ) {
return false;
}
performCardinalityAdjustment( inputKey, input, walkedPath, (Map) parentContainer, thisLevel );
return true;
} | java | @Override
public boolean applyCardinality( String inputKey, Object input, WalkedPath walkedPath, Object parentContainer ) {
MatchedElement thisLevel = getMatch( inputKey, walkedPath );
if ( thisLevel == null ) {
return false;
}
performCardinalityAdjustment( inputKey, input, walkedPath, (Map) parentContainer, thisLevel );
return true;
} | [
"@",
"Override",
"public",
"boolean",
"applyCardinality",
"(",
"String",
"inputKey",
",",
"Object",
"input",
",",
"WalkedPath",
"walkedPath",
",",
"Object",
"parentContainer",
")",
"{",
"MatchedElement",
"thisLevel",
"=",
"getMatch",
"(",
"inputKey",
",",
"walkedP... | If this CardinalitySpec matches the inputkey, then do the work of modifying the data and return true.
@return true if this this spec "handles" the inputkey such that no sibling specs need to see it | [
"If",
"this",
"CardinalitySpec",
"matches",
"the",
"inputkey",
"then",
"do",
"the",
"work",
"of",
"modifying",
"the",
"data",
"and",
"return",
"true",
"."
] | train | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/cardinality/CardinalityLeafSpec.java#L59-L68 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.getDomainSummaryStatistics | public GetDomainSummaryStatisticsResponse getDomainSummaryStatistics(GetDomainSummaryStatisticsRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getStartTime(), "startTime should NOT be empty.");
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request,
STATISTICS, LIVE_DOMAIN, "summary");
internalRequest.addParameter("startTime", request.getStartTime());
if (request.getEndTime() != null) {
internalRequest.addParameter("endTime", request.getEndTime());
}
return invokeHttpClient(internalRequest, GetDomainSummaryStatisticsResponse.class);
} | java | public GetDomainSummaryStatisticsResponse getDomainSummaryStatistics(GetDomainSummaryStatisticsRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getStartTime(), "startTime should NOT be empty.");
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request,
STATISTICS, LIVE_DOMAIN, "summary");
internalRequest.addParameter("startTime", request.getStartTime());
if (request.getEndTime() != null) {
internalRequest.addParameter("endTime", request.getEndTime());
}
return invokeHttpClient(internalRequest, GetDomainSummaryStatisticsResponse.class);
} | [
"public",
"GetDomainSummaryStatisticsResponse",
"getDomainSummaryStatistics",
"(",
"GetDomainSummaryStatisticsRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",... | get all domains' summary statistics in the live stream service.
@param request The request object containing all options for getting all domains' summary statistics
@return the response | [
"get",
"all",
"domains",
"summary",
"statistics",
"in",
"the",
"live",
"stream",
"service",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1820-L1831 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java | MultiUserChat.banUser | public void banUser(Jid jid, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jid, MUCAffiliation.outcast, reason);
} | java | public void banUser(Jid jid, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException {
changeAffiliationByAdmin(jid, MUCAffiliation.outcast, reason);
} | [
"public",
"void",
"banUser",
"(",
"Jid",
"jid",
",",
"String",
"reason",
")",
"throws",
"XMPPErrorException",
",",
"NoResponseException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"changeAffiliationByAdmin",
"(",
"jid",
",",
"MUCAffiliation",
"."... | Bans a user from the room. An admin or owner of the room can ban users from a room. This
means that the banned user will no longer be able to join the room unless the ban has been
removed. If the banned user was present in the room then he/she will be removed from the
room and notified that he/she was banned along with the reason (if provided) and the bare
XMPP user ID of the user who initiated the ban.
@param jid the bare XMPP user ID of the user to ban (e.g. "user@host.org").
@param reason the optional reason why the user was banned.
@throws XMPPErrorException if an error occurs banning a user. In particular, a
405 error can occur if a moderator or a user with an affiliation of "owner" or "admin"
was tried to be banned (i.e. Not Allowed error).
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Bans",
"a",
"user",
"from",
"the",
"room",
".",
"An",
"admin",
"or",
"owner",
"of",
"the",
"room",
"can",
"ban",
"users",
"from",
"a",
"room",
".",
"This",
"means",
"that",
"the",
"banned",
"user",
"will",
"no",
"longer",
"be",
"able",
"to",
"join",... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java#L1335-L1337 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/CmsSitemapView.java | CmsSitemapView.displayNewModelPage | public void displayNewModelPage(CmsModelPageEntry modelPageData, boolean isModelGroup) {
CmsModelPageTreeItem treeItem = new CmsModelPageTreeItem(modelPageData, isModelGroup, false);
CmsSitemapHoverbar.installOn(
m_controller,
treeItem,
modelPageData.getStructureId(),
modelPageData.getSitePath(),
modelPageData.getSitePath() != null);
m_modelPageTreeItems.put(modelPageData.getStructureId(), treeItem);
if (isModelGroup) {
m_modelGroupRoot.addChild(treeItem);
} else {
m_modelPageRoot.addChild(treeItem);
}
} | java | public void displayNewModelPage(CmsModelPageEntry modelPageData, boolean isModelGroup) {
CmsModelPageTreeItem treeItem = new CmsModelPageTreeItem(modelPageData, isModelGroup, false);
CmsSitemapHoverbar.installOn(
m_controller,
treeItem,
modelPageData.getStructureId(),
modelPageData.getSitePath(),
modelPageData.getSitePath() != null);
m_modelPageTreeItems.put(modelPageData.getStructureId(), treeItem);
if (isModelGroup) {
m_modelGroupRoot.addChild(treeItem);
} else {
m_modelPageRoot.addChild(treeItem);
}
} | [
"public",
"void",
"displayNewModelPage",
"(",
"CmsModelPageEntry",
"modelPageData",
",",
"boolean",
"isModelGroup",
")",
"{",
"CmsModelPageTreeItem",
"treeItem",
"=",
"new",
"CmsModelPageTreeItem",
"(",
"modelPageData",
",",
"isModelGroup",
",",
"false",
")",
";",
"Cm... | Adds a new model page to the model page view.<p>
@param modelPageData the data for the new model page
@param isModelGroup in case of a model group page | [
"Adds",
"a",
"new",
"model",
"page",
"to",
"the",
"model",
"page",
"view",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsSitemapView.java#L661-L676 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/Validator.java | Validator.demapProperties | public static Map<String, String> demapProperties(
final Map<String, String> input,
final Map<String, String> mapping,
final boolean skip
)
{
if (null == mapping) {
return input;
}
final Map<String, String> rev = new HashMap<String, String>();
for (final Map.Entry<String, String> entry : mapping.entrySet()) {
rev.put(entry.getValue(), entry.getKey());
}
return performMapping(input, rev, skip);
} | java | public static Map<String, String> demapProperties(
final Map<String, String> input,
final Map<String, String> mapping,
final boolean skip
)
{
if (null == mapping) {
return input;
}
final Map<String, String> rev = new HashMap<String, String>();
for (final Map.Entry<String, String> entry : mapping.entrySet()) {
rev.put(entry.getValue(), entry.getKey());
}
return performMapping(input, rev, skip);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"demapProperties",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"input",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"mapping",
",",
"final",
"boolean",
"skip",
")",
"... | Reverses a set of properties mapped using the specified property mapping, or the same input
if the description has no mapping
@param input input map
@param mapping key value mapping
@param skip if true, ignore input entries when the key is not present in the mapping
@return mapped values | [
"Reverses",
"a",
"set",
"of",
"properties",
"mapped",
"using",
"the",
"specified",
"property",
"mapping",
"or",
"the",
"same",
"input",
"if",
"the",
"description",
"has",
"no",
"mapping"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/Validator.java#L290-L304 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java | OrientationHistogramSift.interpolateAngle | double interpolateAngle(int index0, int index1, int index2, double offset) {
double angle1 = Math.atan2(histogramY[index1],histogramX[index1]);
double deltaAngle;
if( offset < 0 ) {
double angle0 = Math.atan2(histogramY[index0],histogramX[index0]);
deltaAngle = UtilAngle.dist(angle0,angle1);
} else {
double angle2 = Math.atan2(histogramY[index2], histogramX[index2]);
deltaAngle = UtilAngle.dist(angle2,angle1);
}
return UtilAngle.bound(angle1 + deltaAngle*offset);
} | java | double interpolateAngle(int index0, int index1, int index2, double offset) {
double angle1 = Math.atan2(histogramY[index1],histogramX[index1]);
double deltaAngle;
if( offset < 0 ) {
double angle0 = Math.atan2(histogramY[index0],histogramX[index0]);
deltaAngle = UtilAngle.dist(angle0,angle1);
} else {
double angle2 = Math.atan2(histogramY[index2], histogramX[index2]);
deltaAngle = UtilAngle.dist(angle2,angle1);
}
return UtilAngle.bound(angle1 + deltaAngle*offset);
} | [
"double",
"interpolateAngle",
"(",
"int",
"index0",
",",
"int",
"index1",
",",
"int",
"index2",
",",
"double",
"offset",
")",
"{",
"double",
"angle1",
"=",
"Math",
".",
"atan2",
"(",
"histogramY",
"[",
"index1",
"]",
",",
"histogramX",
"[",
"index1",
"]"... | Given the interpolated index, compute the angle from the 3 indexes. The angle for each index
is computed from the weighted gradients.
@param offset Interpolated index offset relative to index0. range -1 to 1
@return Interpolated angle. | [
"Given",
"the",
"interpolated",
"index",
"compute",
"the",
"angle",
"from",
"the",
"3",
"indexes",
".",
"The",
"angle",
"for",
"each",
"index",
"is",
"computed",
"from",
"the",
"weighted",
"gradients",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L281-L293 |
aws/aws-sdk-java | aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CreateServiceActionRequest.java | CreateServiceActionRequest.withDefinition | public CreateServiceActionRequest withDefinition(java.util.Map<String, String> definition) {
setDefinition(definition);
return this;
} | java | public CreateServiceActionRequest withDefinition(java.util.Map<String, String> definition) {
setDefinition(definition);
return this;
} | [
"public",
"CreateServiceActionRequest",
"withDefinition",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"definition",
")",
"{",
"setDefinition",
"(",
"definition",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The self-service action definition. Can be one of the following:
</p>
<dl>
<dt>Name</dt>
<dd>
<p>
The name of the AWS Systems Manager Document. For example, <code>AWS-RestartEC2Instance</code>.
</p>
</dd>
<dt>Version</dt>
<dd>
<p>
The AWS Systems Manager automation document version. For example, <code>"Version": "1"</code>
</p>
</dd>
<dt>AssumeRole</dt>
<dd>
<p>
The Amazon Resource Name (ARN) of the role that performs the self-service actions on your behalf. For example,
<code>"AssumeRole": "arn:aws:iam::12345678910:role/ActionRole"</code>.
</p>
<p>
To reuse the provisioned product launch role, set to <code>"AssumeRole": "LAUNCH_ROLE"</code>.
</p>
</dd>
<dt>Parameters</dt>
<dd>
<p>
The list of parameters in JSON format.
</p>
<p>
For example: <code>[{\"Name\":\"InstanceId\",\"Type\":\"TARGET\"}]</code>.
</p>
</dd>
</dl>
@param definition
The self-service action definition. Can be one of the following:</p>
<dl>
<dt>Name</dt>
<dd>
<p>
The name of the AWS Systems Manager Document. For example, <code>AWS-RestartEC2Instance</code>.
</p>
</dd>
<dt>Version</dt>
<dd>
<p>
The AWS Systems Manager automation document version. For example, <code>"Version": "1"</code>
</p>
</dd>
<dt>AssumeRole</dt>
<dd>
<p>
The Amazon Resource Name (ARN) of the role that performs the self-service actions on your behalf. For
example, <code>"AssumeRole": "arn:aws:iam::12345678910:role/ActionRole"</code>.
</p>
<p>
To reuse the provisioned product launch role, set to <code>"AssumeRole": "LAUNCH_ROLE"</code>.
</p>
</dd>
<dt>Parameters</dt>
<dd>
<p>
The list of parameters in JSON format.
</p>
<p>
For example: <code>[{\"Name\":\"InstanceId\",\"Type\":\"TARGET\"}]</code>.
</p>
</dd>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"self",
"-",
"service",
"action",
"definition",
".",
"Can",
"be",
"one",
"of",
"the",
"following",
":",
"<",
"/",
"p",
">",
"<dl",
">",
"<dt",
">",
"Name<",
"/",
"dt",
">",
"<dd",
">",
"<p",
">",
"The",
"name",
"of",
"the",
"A... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CreateServiceActionRequest.java#L445-L448 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java | AvroUtils.copyProperties | private static void copyProperties(Schema oldSchema, Schema newSchema) {
Preconditions.checkNotNull(oldSchema);
Preconditions.checkNotNull(newSchema);
Map<String, JsonNode> props = oldSchema.getJsonProps();
copyProperties(props, newSchema);
} | java | private static void copyProperties(Schema oldSchema, Schema newSchema) {
Preconditions.checkNotNull(oldSchema);
Preconditions.checkNotNull(newSchema);
Map<String, JsonNode> props = oldSchema.getJsonProps();
copyProperties(props, newSchema);
} | [
"private",
"static",
"void",
"copyProperties",
"(",
"Schema",
"oldSchema",
",",
"Schema",
"newSchema",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"oldSchema",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"newSchema",
")",
";",
"Map",
"<",
"St... | *
Copy properties from old Avro Schema to new Avro Schema
@param oldSchema Old Avro Schema to copy properties from
@param newSchema New Avro Schema to copy properties to | [
"*",
"Copy",
"properties",
"from",
"old",
"Avro",
"Schema",
"to",
"new",
"Avro",
"Schema"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java#L780-L786 |
kite-sdk/kite | kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/impl/EntitySerDe.java | EntitySerDe.serializeOCCColumn | private void serializeOCCColumn(Object fieldValue, PutAction putAction) {
// OCC Version mapping, so serialize as a long to the version check
// column qualifier in the system column family.
Long currVersion = (Long) fieldValue;
VersionCheckAction versionCheckAction = new VersionCheckAction(currVersion);
putAction.getPut().add(Constants.SYS_COL_FAMILY,
Constants.VERSION_CHECK_COL_QUALIFIER, Bytes.toBytes(currVersion + 1));
putAction.setVersionCheckAction(versionCheckAction);
} | java | private void serializeOCCColumn(Object fieldValue, PutAction putAction) {
// OCC Version mapping, so serialize as a long to the version check
// column qualifier in the system column family.
Long currVersion = (Long) fieldValue;
VersionCheckAction versionCheckAction = new VersionCheckAction(currVersion);
putAction.getPut().add(Constants.SYS_COL_FAMILY,
Constants.VERSION_CHECK_COL_QUALIFIER, Bytes.toBytes(currVersion + 1));
putAction.setVersionCheckAction(versionCheckAction);
} | [
"private",
"void",
"serializeOCCColumn",
"(",
"Object",
"fieldValue",
",",
"PutAction",
"putAction",
")",
"{",
"// OCC Version mapping, so serialize as a long to the version check",
"// column qualifier in the system column family.",
"Long",
"currVersion",
"=",
"(",
"Long",
")",
... | Serialize the OCC column value, and update the putAction with the
serialized bytes.
@param fieldValue
The value to serialize
@param putAction
The PutAction to update. | [
"Serialize",
"the",
"OCC",
"column",
"value",
"and",
"update",
"the",
"putAction",
"with",
"the",
"serialized",
"bytes",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/impl/EntitySerDe.java#L278-L286 |
chocotan/datepicker4j | src/main/java/io/loli/datepicker/DatePicker.java | DatePicker.selectDay | void selectDay(int year, int month, int day) {
Calendar cal = Calendar.getInstance();
cal.set(year, month, day);
Date date = cal.getTime();
this.field.setText(simpleDateFormat.format(date));
if (popup != null) {
popup.hide();
popup = null;
}
} | java | void selectDay(int year, int month, int day) {
Calendar cal = Calendar.getInstance();
cal.set(year, month, day);
Date date = cal.getTime();
this.field.setText(simpleDateFormat.format(date));
if (popup != null) {
popup.hide();
popup = null;
}
} | [
"void",
"selectDay",
"(",
"int",
"year",
",",
"int",
"month",
",",
"int",
"day",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"set",
"(",
"year",
",",
"month",
",",
"day",
")",
";",
"Date",
"date",
... | Set date to text field
@param year
year to set
@param month
month to set
@param day
day to set | [
"Set",
"date",
"to",
"text",
"field"
] | train | https://github.com/chocotan/datepicker4j/blob/d65d7a6b29f9efe77aeec2024dc31a38a7852676/src/main/java/io/loli/datepicker/DatePicker.java#L109-L118 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformaction.java | transformaction.get | public static transformaction get(nitro_service service, String name) throws Exception{
transformaction obj = new transformaction();
obj.set_name(name);
transformaction response = (transformaction) obj.get_resource(service);
return response;
} | java | public static transformaction get(nitro_service service, String name) throws Exception{
transformaction obj = new transformaction();
obj.set_name(name);
transformaction response = (transformaction) obj.get_resource(service);
return response;
} | [
"public",
"static",
"transformaction",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"transformaction",
"obj",
"=",
"new",
"transformaction",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"tra... | Use this API to fetch transformaction resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"transformaction",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformaction.java#L499-L504 |
phax/ph-javacc-maven-plugin | src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java | JJDocMojo.createReportLink | private void createReportLink (final Sink sink, final File sourceDirectory, final File grammarFile, String linkPath)
{
sink.tableRow ();
sink.tableCell ();
if (linkPath.startsWith ("/"))
{
linkPath = linkPath.substring (1);
}
sink.link (linkPath);
String grammarFileRelativePath = sourceDirectory.toURI ().relativize (grammarFile.toURI ()).toString ();
if (grammarFileRelativePath.startsWith ("/"))
{
grammarFileRelativePath = grammarFileRelativePath.substring (1);
}
sink.text (grammarFileRelativePath);
sink.link_ ();
sink.tableCell_ ();
sink.tableRow_ ();
} | java | private void createReportLink (final Sink sink, final File sourceDirectory, final File grammarFile, String linkPath)
{
sink.tableRow ();
sink.tableCell ();
if (linkPath.startsWith ("/"))
{
linkPath = linkPath.substring (1);
}
sink.link (linkPath);
String grammarFileRelativePath = sourceDirectory.toURI ().relativize (grammarFile.toURI ()).toString ();
if (grammarFileRelativePath.startsWith ("/"))
{
grammarFileRelativePath = grammarFileRelativePath.substring (1);
}
sink.text (grammarFileRelativePath);
sink.link_ ();
sink.tableCell_ ();
sink.tableRow_ ();
} | [
"private",
"void",
"createReportLink",
"(",
"final",
"Sink",
"sink",
",",
"final",
"File",
"sourceDirectory",
",",
"final",
"File",
"grammarFile",
",",
"String",
"linkPath",
")",
"{",
"sink",
".",
"tableRow",
"(",
")",
";",
"sink",
".",
"tableCell",
"(",
"... | Create a table row containing a link to the JJDoc report for a grammar
file.
@param sink
The sink to write the report
@param sourceDirectory
The source directory of the grammar file.
@param grammarFile
The JavaCC grammar file.
@param linkPath
The path to the JJDoc output. | [
"Create",
"a",
"table",
"row",
"containing",
"a",
"link",
"to",
"the",
"JJDoc",
"report",
"for",
"a",
"grammar",
"file",
"."
] | train | https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/JJDocMojo.java#L455-L473 |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/util/GeoUtil.java | GeoUtil.getBitmapCoordinate | public static Point2D getBitmapCoordinate(double latitude, double longitude, int zoomLevel, TileFactoryInfo info)
{
double x = info.getMapCenterInPixelsAtZoom(zoomLevel).getX() + longitude
* info.getLongitudeDegreeWidthInPixels(zoomLevel);
double e = Math.sin(latitude * (Math.PI / 180.0));
if (e > 0.9999)
{
e = 0.9999;
}
if (e < -0.9999)
{
e = -0.9999;
}
double y = info.getMapCenterInPixelsAtZoom(zoomLevel).getY() + 0.5 * Math.log((1 + e) / (1 - e)) * -1
* (info.getLongitudeRadianWidthInPixels(zoomLevel));
return new Point2D.Double(x, y);
} | java | public static Point2D getBitmapCoordinate(double latitude, double longitude, int zoomLevel, TileFactoryInfo info)
{
double x = info.getMapCenterInPixelsAtZoom(zoomLevel).getX() + longitude
* info.getLongitudeDegreeWidthInPixels(zoomLevel);
double e = Math.sin(latitude * (Math.PI / 180.0));
if (e > 0.9999)
{
e = 0.9999;
}
if (e < -0.9999)
{
e = -0.9999;
}
double y = info.getMapCenterInPixelsAtZoom(zoomLevel).getY() + 0.5 * Math.log((1 + e) / (1 - e)) * -1
* (info.getLongitudeRadianWidthInPixels(zoomLevel));
return new Point2D.Double(x, y);
} | [
"public",
"static",
"Point2D",
"getBitmapCoordinate",
"(",
"double",
"latitude",
",",
"double",
"longitude",
",",
"int",
"zoomLevel",
",",
"TileFactoryInfo",
"info",
")",
"{",
"double",
"x",
"=",
"info",
".",
"getMapCenterInPixelsAtZoom",
"(",
"zoomLevel",
")",
... | Given a position (latitude/longitude pair) and a zoom level, return the appropriate point in <em>pixels</em>. The
zoom level is necessary because pixel coordinates are in terms of the zoom level
@param latitude the latitude
@param longitude the longitude
@param zoomLevel the zoom level to extract the pixel coordinate for
@param info the tile factory info
@return the coordinate | [
"Given",
"a",
"position",
"(",
"latitude",
"/",
"longitude",
"pair",
")",
"and",
"a",
"zoom",
"level",
"return",
"the",
"appropriate",
"point",
"in",
"<em",
">",
"pixels<",
"/",
"em",
">",
".",
"The",
"zoom",
"level",
"is",
"necessary",
"because",
"pixel... | train | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/util/GeoUtil.java#L98-L114 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/expressions/Expressions.java | Expressions.notLike | public static NotLike notLike(Expression<String> left, Expression<String> right, char wildCardCharacter) {
return new NotLike(left, right, wildCardCharacter);
} | java | public static NotLike notLike(Expression<String> left, Expression<String> right, char wildCardCharacter) {
return new NotLike(left, right, wildCardCharacter);
} | [
"public",
"static",
"NotLike",
"notLike",
"(",
"Expression",
"<",
"String",
">",
"left",
",",
"Expression",
"<",
"String",
">",
"right",
",",
"char",
"wildCardCharacter",
")",
"{",
"return",
"new",
"NotLike",
"(",
"left",
",",
"right",
",",
"wildCardCharacte... | Creates a NotLike expression from the given expressions.
@param left The left expression.
@param right The right expression.
@param wildCardCharacter The character to use as a wildcardCharacter
@return A NotLike expression. | [
"Creates",
"a",
"NotLike",
"expression",
"from",
"the",
"given",
"expressions",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L663-L665 |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/Links.java | Links.getLinkBy | public Optional<Link> getLinkBy(final String rel) {
final List<Link> links = getLinksBy(rel);
return links.isEmpty()
? Optional.empty()
: Optional.of(links.get(0));
} | java | public Optional<Link> getLinkBy(final String rel) {
final List<Link> links = getLinksBy(rel);
return links.isEmpty()
? Optional.empty()
: Optional.of(links.get(0));
} | [
"public",
"Optional",
"<",
"Link",
">",
"getLinkBy",
"(",
"final",
"String",
"rel",
")",
"{",
"final",
"List",
"<",
"Link",
">",
"links",
"=",
"getLinksBy",
"(",
"rel",
")",
";",
"return",
"links",
".",
"isEmpty",
"(",
")",
"?",
"Optional",
".",
"emp... | <p>
Returns the first (if any) link having the specified link-relation type.
</p>
<p>
If CURIs are used to shorten custom link-relation types, it is possible to either use expanded link-relation types,
or the CURI of the link-relation type. Using CURIs to retrieve links is not recommended, because it
requires that the name of the CURI is known by clients.
</p>
@param rel the link-relation type of the retrieved link.
@return optional link
@see <a href="https://tools.ietf.org/html/draft-kelly-json-hal-08#section-8.2">draft-kelly-json-hal-08#section-8.2</a>
@since 0.1.0 | [
"<p",
">",
"Returns",
"the",
"first",
"(",
"if",
"any",
")",
"link",
"having",
"the",
"specified",
"link",
"-",
"relation",
"type",
".",
"<",
"/",
"p",
">",
"<p",
">",
"If",
"CURIs",
"are",
"used",
"to",
"shorten",
"custom",
"link",
"-",
"relation",
... | train | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/Links.java#L177-L182 |
facebookarchive/hadoop-20 | src/contrib/benchmark/src/java/org/apache/hadoop/mapred/GenWriterThread.java | GenWriterThread.prepare | @Override
public GenThread[] prepare(JobConf conf, Text key, Text value)
throws IOException {
this.rtc = new GenWriterRunTimeConstants();
super.prepare(conf, key, value, rtc);
rtc.task_name = key.toString() + rtc.taskID;
rtc.roll_interval = conf.getLong(WRITER_ROLL_INTERVAL_KEY,
DEFAULT_ROLL_INTERVAL_SEC) * 1000;
rtc.sync_interval = conf.getLong(WRITER_SYNC_INTERVAL_KEY,
DEFAULT_SYNC_INTERVAL_SEC) * 1000;
rtc.max_time = conf.getLong(MAX_TIME_SEC_KEY, DEFAULT_MAX_TIME_SEC) * 1000;
rtc.data_rate = conf.getLong(WRITER_DATARATE_KEY, DEFAULT_DATA_RATE) * 1024;
rtc.input = value.toString();
LOG.info("data rate: " + rtc.data_rate);
GenWriterThread[] threads = new GenWriterThread[(int)rtc.nthreads];
for (int i=0; i<rtc.nthreads; i++) {
threads[i] = new GenWriterThread(conf,
new Path(new Path(rtc.input, rtc.task_name),
rtc.task_name + "_" + i), rtc.task_name, i, rtc);
}
return threads;
} | java | @Override
public GenThread[] prepare(JobConf conf, Text key, Text value)
throws IOException {
this.rtc = new GenWriterRunTimeConstants();
super.prepare(conf, key, value, rtc);
rtc.task_name = key.toString() + rtc.taskID;
rtc.roll_interval = conf.getLong(WRITER_ROLL_INTERVAL_KEY,
DEFAULT_ROLL_INTERVAL_SEC) * 1000;
rtc.sync_interval = conf.getLong(WRITER_SYNC_INTERVAL_KEY,
DEFAULT_SYNC_INTERVAL_SEC) * 1000;
rtc.max_time = conf.getLong(MAX_TIME_SEC_KEY, DEFAULT_MAX_TIME_SEC) * 1000;
rtc.data_rate = conf.getLong(WRITER_DATARATE_KEY, DEFAULT_DATA_RATE) * 1024;
rtc.input = value.toString();
LOG.info("data rate: " + rtc.data_rate);
GenWriterThread[] threads = new GenWriterThread[(int)rtc.nthreads];
for (int i=0; i<rtc.nthreads; i++) {
threads[i] = new GenWriterThread(conf,
new Path(new Path(rtc.input, rtc.task_name),
rtc.task_name + "_" + i), rtc.task_name, i, rtc);
}
return threads;
} | [
"@",
"Override",
"public",
"GenThread",
"[",
"]",
"prepare",
"(",
"JobConf",
"conf",
",",
"Text",
"key",
",",
"Text",
"value",
")",
"throws",
"IOException",
"{",
"this",
".",
"rtc",
"=",
"new",
"GenWriterRunTimeConstants",
"(",
")",
";",
"super",
".",
"p... | Create a number of threads to generate write traffics
@param conf
@param key name of the mapper
@param value location of data input
@return
@throws IOException | [
"Create",
"a",
"number",
"of",
"threads",
"to",
"generate",
"write",
"traffics"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/GenWriterThread.java#L298-L319 |
Netflix/spectator | spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcLogEntry.java | IpcLogEntry.addResponseHeader | public IpcLogEntry addResponseHeader(String name, String value) {
if (serverAsg == null && name.equalsIgnoreCase(NetflixHeader.ASG.headerName())) {
withServerAsg(value);
} else if (serverZone == null && name.equalsIgnoreCase(NetflixHeader.Zone.headerName())) {
withServerZone(value);
} else if (serverNode == null && name.equalsIgnoreCase(NetflixHeader.Node.headerName())) {
withServerNode(value);
} else if (endpoint == null && name.equalsIgnoreCase(NetflixHeader.Endpoint.headerName())) {
withEndpoint(value);
} else {
this.responseHeaders.add(new Header(name, value));
}
return this;
} | java | public IpcLogEntry addResponseHeader(String name, String value) {
if (serverAsg == null && name.equalsIgnoreCase(NetflixHeader.ASG.headerName())) {
withServerAsg(value);
} else if (serverZone == null && name.equalsIgnoreCase(NetflixHeader.Zone.headerName())) {
withServerZone(value);
} else if (serverNode == null && name.equalsIgnoreCase(NetflixHeader.Node.headerName())) {
withServerNode(value);
} else if (endpoint == null && name.equalsIgnoreCase(NetflixHeader.Endpoint.headerName())) {
withEndpoint(value);
} else {
this.responseHeaders.add(new Header(name, value));
}
return this;
} | [
"public",
"IpcLogEntry",
"addResponseHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"serverAsg",
"==",
"null",
"&&",
"name",
".",
"equalsIgnoreCase",
"(",
"NetflixHeader",
".",
"ASG",
".",
"headerName",
"(",
")",
")",
")",
"{"... | Add a response header value. For special headers in {@link NetflixHeader} it will
automatically fill in the more specific fields based on the header values. | [
"Add",
"a",
"response",
"header",
"value",
".",
"For",
"special",
"headers",
"in",
"{"
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcLogEntry.java#L522-L535 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/NotEquals.java | NotEquals.operate | public XObject operate(XObject left, XObject right)
throws javax.xml.transform.TransformerException
{
return (left.notEquals(right)) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
} | java | public XObject operate(XObject left, XObject right)
throws javax.xml.transform.TransformerException
{
return (left.notEquals(right)) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
} | [
"public",
"XObject",
"operate",
"(",
"XObject",
"left",
",",
"XObject",
"right",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"return",
"(",
"left",
".",
"notEquals",
"(",
"right",
")",
")",
"?",
"XBoolean",
".",
... | Apply the operation to two operands, and return the result.
@param left non-null reference to the evaluated left operand.
@param right non-null reference to the evaluated right operand.
@return non-null reference to the XObject that represents the result of the operation.
@throws javax.xml.transform.TransformerException | [
"Apply",
"the",
"operation",
"to",
"two",
"operands",
"and",
"return",
"the",
"result",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/NotEquals.java#L44-L48 |
hdecarne/java-default | src/main/java/de/carne/util/SystemProperties.java | SystemProperties.booleanValue | public static boolean booleanValue(String key, boolean defaultValue) {
String value = System.getProperty(key);
boolean booleanValue = defaultValue;
if (value != null) {
booleanValue = Boolean.parseBoolean(value);
}
return booleanValue;
} | java | public static boolean booleanValue(String key, boolean defaultValue) {
String value = System.getProperty(key);
boolean booleanValue = defaultValue;
if (value != null) {
booleanValue = Boolean.parseBoolean(value);
}
return booleanValue;
} | [
"public",
"static",
"boolean",
"booleanValue",
"(",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"System",
".",
"getProperty",
"(",
"key",
")",
";",
"boolean",
"booleanValue",
"=",
"defaultValue",
";",
"if",
"(",
"value"... | Gets a {@code boolean} system property value.
@param key the property key to retrieve.
@param defaultValue the default value to return in case the property is not defined.
@return the property value or the submitted default value if the property is not defined. | [
"Gets",
"a",
"{",
"@code",
"boolean",
"}",
"system",
"property",
"value",
"."
] | train | https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/SystemProperties.java#L85-L93 |
loadcoder/chart-extensions | src/main/java/com/loadcoder/load/jfreechartfixes/XYLineAndShapeRendererExtention.java | XYLineAndShapeRendererExtention.drawFirstPassShape | @Override
protected void drawFirstPassShape(Graphics2D g2, int pass, int series, int item, Shape shape) {
g2.setStroke(getItemStroke(series, item));
g2.setPaint(getLinePaint(series)); // this line is different from the original
g2.draw(shape);
} | java | @Override
protected void drawFirstPassShape(Graphics2D g2, int pass, int series, int item, Shape shape) {
g2.setStroke(getItemStroke(series, item));
g2.setPaint(getLinePaint(series)); // this line is different from the original
g2.draw(shape);
} | [
"@",
"Override",
"protected",
"void",
"drawFirstPassShape",
"(",
"Graphics2D",
"g2",
",",
"int",
"pass",
",",
"int",
"series",
",",
"int",
"item",
",",
"Shape",
"shape",
")",
"{",
"g2",
".",
"setStroke",
"(",
"getItemStroke",
"(",
"series",
",",
"item",
... | /*
Overriding this class since the color of the series needs to be set with getLinePaint
which makes it possible to set the color for the series in the series instance | [
"/",
"*",
"Overriding",
"this",
"class",
"since",
"the",
"color",
"of",
"the",
"series",
"needs",
"to",
"be",
"set",
"with",
"getLinePaint",
"which",
"makes",
"it",
"possible",
"to",
"set",
"the",
"color",
"for",
"the",
"series",
"in",
"the",
"series",
"... | train | https://github.com/loadcoder/chart-extensions/blob/ded73ad337d18072b3fd4b1b4e3b7a581567d76d/src/main/java/com/loadcoder/load/jfreechartfixes/XYLineAndShapeRendererExtention.java#L120-L125 |
JavaMoney/jsr354-api | src/main/java/javax/money/Monetary.java | Monetary.getRounding | public static MonetaryRounding getRounding(RoundingQuery roundingQuery) {
return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available."))
.getRounding(roundingQuery);
} | java | public static MonetaryRounding getRounding(RoundingQuery roundingQuery) {
return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available."))
.getRounding(roundingQuery);
} | [
"public",
"static",
"MonetaryRounding",
"getRounding",
"(",
"RoundingQuery",
"roundingQuery",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"monetaryRoundingsSingletonSpi",
"(",
")",
")",
".",
"orElseThrow",
"(",
"(",
")",
"->",
"new",
"MonetaryException",... | Access a {@link MonetaryRounding} using a possibly complex query.
@param roundingQuery The {@link javax.money.RoundingQuery} that may contains arbitrary parameters to be
evaluated.
@return the corresponding {@link javax.money.MonetaryRounding}, never {@code null}.
@throws IllegalArgumentException if no such rounding is registered using a
{@link javax.money.spi.RoundingProviderSpi} instance. | [
"Access",
"a",
"{",
"@link",
"MonetaryRounding",
"}",
"using",
"a",
"possibly",
"complex",
"query",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L186-L190 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java | SourceTreeManager.getSourceTree | public int getSourceTree(
String base, String urlString, SourceLocator locator, XPathContext xctxt)
throws TransformerException
{
// System.out.println("getSourceTree");
try
{
Source source = this.resolveURI(base, urlString, locator);
// System.out.println("getSourceTree - base: "+base+", urlString: "+urlString+", source: "+source.getSystemId());
return getSourceTree(source, locator, xctxt);
}
catch (IOException ioe)
{
throw new TransformerException(ioe.getMessage(), locator, ioe);
}
/* catch (TransformerException te)
{
throw new TransformerException(te.getMessage(), locator, te);
}*/
} | java | public int getSourceTree(
String base, String urlString, SourceLocator locator, XPathContext xctxt)
throws TransformerException
{
// System.out.println("getSourceTree");
try
{
Source source = this.resolveURI(base, urlString, locator);
// System.out.println("getSourceTree - base: "+base+", urlString: "+urlString+", source: "+source.getSystemId());
return getSourceTree(source, locator, xctxt);
}
catch (IOException ioe)
{
throw new TransformerException(ioe.getMessage(), locator, ioe);
}
/* catch (TransformerException te)
{
throw new TransformerException(te.getMessage(), locator, te);
}*/
} | [
"public",
"int",
"getSourceTree",
"(",
"String",
"base",
",",
"String",
"urlString",
",",
"SourceLocator",
"locator",
",",
"XPathContext",
"xctxt",
")",
"throws",
"TransformerException",
"{",
"// System.out.println(\"getSourceTree\");",
"try",
"{",
"Source",
"source",
... | Get the source tree from the a base URL and a URL string.
@param base The base URI to use if the urlString is relative.
@param urlString An absolute or relative URL string.
@param locator The location of the caller, for diagnostic purposes.
@return should be a non-null reference to the node identified by the
base and urlString.
@throws TransformerException If the URL can not resolve to a node. | [
"Get",
"the",
"source",
"tree",
"from",
"the",
"a",
"base",
"URL",
"and",
"a",
"URL",
"string",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java#L237-L259 |
mojohaus/flatten-maven-plugin | src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java | FlattenMojo.writeStringToFile | protected void writeStringToFile( String data, File file, String encoding )
throws MojoExecutionException
{
OutputStream outStream = null;
Writer writer = null;
try
{
outStream = new FileOutputStream( file );
writer = new OutputStreamWriter( outStream, encoding );
writer.write( data );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Failed to write to " + file, e );
}
finally
{
// resource-handling not perfectly solved but we do not want to require java 1.7
// and this is not a server application.
IOUtil.close( writer );
IOUtil.close( outStream );
}
} | java | protected void writeStringToFile( String data, File file, String encoding )
throws MojoExecutionException
{
OutputStream outStream = null;
Writer writer = null;
try
{
outStream = new FileOutputStream( file );
writer = new OutputStreamWriter( outStream, encoding );
writer.write( data );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Failed to write to " + file, e );
}
finally
{
// resource-handling not perfectly solved but we do not want to require java 1.7
// and this is not a server application.
IOUtil.close( writer );
IOUtil.close( outStream );
}
} | [
"protected",
"void",
"writeStringToFile",
"(",
"String",
"data",
",",
"File",
"file",
",",
"String",
"encoding",
")",
"throws",
"MojoExecutionException",
"{",
"OutputStream",
"outStream",
"=",
"null",
";",
"Writer",
"writer",
"=",
"null",
";",
"try",
"{",
"out... | Writes the given <code>data</code> to the given <code>file</code> using the specified <code>encoding</code>.
@param data is the {@link String} to write.
@param file is the {@link File} to write to.
@param encoding is the encoding to use for writing the file.
@throws MojoExecutionException if anything goes wrong. | [
"Writes",
"the",
"given",
"<code",
">",
"data<",
"/",
"code",
">",
"to",
"the",
"given",
"<code",
">",
"file<",
"/",
"code",
">",
"using",
"the",
"specified",
"<code",
">",
"encoding<",
"/",
"code",
">",
"."
] | train | https://github.com/mojohaus/flatten-maven-plugin/blob/df25d03a4d6c06c4de5cfd9f52dfbe72e823e403/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java#L433-L456 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java | DoublesSketch.downSample | public DoublesSketch downSample(final DoublesSketch srcSketch, final int smallerK,
final WritableMemory dstMem) {
return downSampleInternal(srcSketch, smallerK, dstMem);
} | java | public DoublesSketch downSample(final DoublesSketch srcSketch, final int smallerK,
final WritableMemory dstMem) {
return downSampleInternal(srcSketch, smallerK, dstMem);
} | [
"public",
"DoublesSketch",
"downSample",
"(",
"final",
"DoublesSketch",
"srcSketch",
",",
"final",
"int",
"smallerK",
",",
"final",
"WritableMemory",
"dstMem",
")",
"{",
"return",
"downSampleInternal",
"(",
"srcSketch",
",",
"smallerK",
",",
"dstMem",
")",
";",
... | From an source sketch, create a new sketch that must have a smaller value of K.
The original sketch is not modified.
@param srcSketch the sourcing sketch
@param smallerK the new sketch's value of K that must be smaller than this value of K.
It is required that this.getK() = smallerK * 2^(nonnegative integer).
@param dstMem the destination Memory. It must not overlap the Memory of this sketch.
If null, a heap sketch will be returned, otherwise it will be off-heap.
@return the new sketch. | [
"From",
"an",
"source",
"sketch",
"create",
"a",
"new",
"sketch",
"that",
"must",
"have",
"a",
"smaller",
"value",
"of",
"K",
".",
"The",
"original",
"sketch",
"is",
"not",
"modified",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java#L601-L604 |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/config/WampSession.java | WampSession.setAttribute | public void setAttribute(String name, Object value) {
this.webSocketSession.getAttributes().put(name, value);
} | java | public void setAttribute(String name, Object value) {
this.webSocketSession.getAttributes().put(name, value);
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"this",
".",
"webSocketSession",
".",
"getAttributes",
"(",
")",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Set the value with the given name replacing an existing value (if any).
@param name the name of the attribute
@param value the value for the attribute | [
"Set",
"the",
"value",
"with",
"the",
"given",
"name",
"replacing",
"an",
"existing",
"value",
"(",
"if",
"any",
")",
"."
] | train | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/config/WampSession.java#L76-L78 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/view/ApptentiveNestedScrollView.java | ApptentiveNestedScrollView.smoothScrollBy | public final void smoothScrollBy(int dx, int dy) {
if (getChildCount() == 0) {
// Nothing to do.
return;
}
long duration = AnimationUtils.currentAnimationTimeMillis() - mLastScroll;
if (duration > ANIMATED_SCROLL_GAP) {
final int height = getHeight() - getPaddingBottom() - getPaddingTop();
final int bottom = getChildAt(0).getHeight();
final int maxY = Math.max(0, bottom - height);
final int scrollY = getScrollY();
dy = Math.max(0, Math.min(scrollY + dy, maxY)) - scrollY;
mScroller.startScroll(getScrollX(), scrollY, 0, dy);
ViewCompat.postInvalidateOnAnimation(this);
} else {
if (!mScroller.isFinished()) {
mScroller.abortAnimation();
}
scrollBy(dx, dy);
}
mLastScroll = AnimationUtils.currentAnimationTimeMillis();
} | java | public final void smoothScrollBy(int dx, int dy) {
if (getChildCount() == 0) {
// Nothing to do.
return;
}
long duration = AnimationUtils.currentAnimationTimeMillis() - mLastScroll;
if (duration > ANIMATED_SCROLL_GAP) {
final int height = getHeight() - getPaddingBottom() - getPaddingTop();
final int bottom = getChildAt(0).getHeight();
final int maxY = Math.max(0, bottom - height);
final int scrollY = getScrollY();
dy = Math.max(0, Math.min(scrollY + dy, maxY)) - scrollY;
mScroller.startScroll(getScrollX(), scrollY, 0, dy);
ViewCompat.postInvalidateOnAnimation(this);
} else {
if (!mScroller.isFinished()) {
mScroller.abortAnimation();
}
scrollBy(dx, dy);
}
mLastScroll = AnimationUtils.currentAnimationTimeMillis();
} | [
"public",
"final",
"void",
"smoothScrollBy",
"(",
"int",
"dx",
",",
"int",
"dy",
")",
"{",
"if",
"(",
"getChildCount",
"(",
")",
"==",
"0",
")",
"{",
"// Nothing to do.",
"return",
";",
"}",
"long",
"duration",
"=",
"AnimationUtils",
".",
"currentAnimation... | Like {@link View#scrollBy}, but scroll smoothly instead of immediately.
@param dx the number of pixels to scroll by on the X axis
@param dy the number of pixels to scroll by on the Y axis | [
"Like",
"{",
"@link",
"View#scrollBy",
"}",
"but",
"scroll",
"smoothly",
"instead",
"of",
"immediately",
"."
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/view/ApptentiveNestedScrollView.java#L1303-L1325 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.retractMessage | public ResponseWrapper retractMessage(String username, long msgId)
throws APIConnectionException, APIRequestException {
return _messageClient.retractMessage(username, msgId);
} | java | public ResponseWrapper retractMessage(String username, long msgId)
throws APIConnectionException, APIRequestException {
return _messageClient.retractMessage(username, msgId);
} | [
"public",
"ResponseWrapper",
"retractMessage",
"(",
"String",
"username",
",",
"long",
"msgId",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_messageClient",
".",
"retractMessage",
"(",
"username",
",",
"msgId",
")",
";",
"}"
... | retract message
消息撤回
@param username 用户名
@param msgId message id
@return No Content, Error Code:
855001 out of retract message time, the effective time is within 3 minutes after sending message
855003 the retract message is not exist
855004 the message had been retracted
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"retract",
"message",
"消息撤回"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L551-L554 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AbstractBoottimeAddStepHandler.java | AbstractBoottimeAddStepHandler.performRuntime | @Override
protected final void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
if (context.isBooting()) {
performBoottime(context, operation, resource);
} else {
context.reloadRequired();
}
} | java | @Override
protected final void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
if (context.isBooting()) {
performBoottime(context, operation, resource);
} else {
context.reloadRequired();
}
} | [
"@",
"Override",
"protected",
"final",
"void",
"performRuntime",
"(",
"OperationContext",
"context",
",",
"ModelNode",
"operation",
",",
"Resource",
"resource",
")",
"throws",
"OperationFailedException",
"{",
"if",
"(",
"context",
".",
"isBooting",
"(",
")",
")",
... | If {@link OperationContext#isBooting()} returns {@code true}, invokes
{@link #performBoottime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)},
else invokes {@link OperationContext#reloadRequired()}.
{@inheritDoc} | [
"If",
"{",
"@link",
"OperationContext#isBooting",
"()",
"}",
"returns",
"{",
"@code",
"true",
"}",
"invokes",
"{",
"@link",
"#performBoottime",
"(",
"OperationContext",
"org",
".",
"jboss",
".",
"dmr",
".",
"ModelNode",
"org",
".",
"jboss",
".",
"as",
".",
... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractBoottimeAddStepHandler.java#L116-L123 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/model/TableDef.java | TableDef.addForeignkey | public void addForeignkey(String relationName, String remoteTable, List localColumns, List remoteColumns)
{
ForeignkeyDef foreignkeyDef = new ForeignkeyDef(relationName, remoteTable);
// the field arrays have the same length if we already checked the constraints
for (int idx = 0; idx < localColumns.size(); idx++)
{
foreignkeyDef.addColumnPair((String)localColumns.get(idx),
(String)remoteColumns.get(idx));
}
// we got to determine whether this foreignkey is already present
ForeignkeyDef def = null;
for (Iterator it = getForeignkeys(); it.hasNext();)
{
def = (ForeignkeyDef)it.next();
if (foreignkeyDef.equals(def))
{
return;
}
}
foreignkeyDef.setOwner(this);
_foreignkeys.add(foreignkeyDef);
} | java | public void addForeignkey(String relationName, String remoteTable, List localColumns, List remoteColumns)
{
ForeignkeyDef foreignkeyDef = new ForeignkeyDef(relationName, remoteTable);
// the field arrays have the same length if we already checked the constraints
for (int idx = 0; idx < localColumns.size(); idx++)
{
foreignkeyDef.addColumnPair((String)localColumns.get(idx),
(String)remoteColumns.get(idx));
}
// we got to determine whether this foreignkey is already present
ForeignkeyDef def = null;
for (Iterator it = getForeignkeys(); it.hasNext();)
{
def = (ForeignkeyDef)it.next();
if (foreignkeyDef.equals(def))
{
return;
}
}
foreignkeyDef.setOwner(this);
_foreignkeys.add(foreignkeyDef);
} | [
"public",
"void",
"addForeignkey",
"(",
"String",
"relationName",
",",
"String",
"remoteTable",
",",
"List",
"localColumns",
",",
"List",
"remoteColumns",
")",
"{",
"ForeignkeyDef",
"foreignkeyDef",
"=",
"new",
"ForeignkeyDef",
"(",
"relationName",
",",
"remoteTable... | Adds a foreignkey to this table.
@param relationName The name of the relation represented by the foreignkey
@param remoteTable The referenced table
@param localColumns The local columns
@param remoteColumns The remote columns | [
"Adds",
"a",
"foreignkey",
"to",
"this",
"table",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/TableDef.java#L129-L153 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java | TimeSeriesUtils.reshapeTimeSeriesMaskToVector | public static INDArray reshapeTimeSeriesMaskToVector(INDArray timeSeriesMask, LayerWorkspaceMgr workspaceMgr, ArrayType arrayType) {
if (timeSeriesMask.rank() != 2)
throw new IllegalArgumentException("Cannot reshape mask: rank is not 2");
if (timeSeriesMask.ordering() != 'f' || !Shape.hasDefaultStridesForShape(timeSeriesMask))
timeSeriesMask = workspaceMgr.dup(arrayType, timeSeriesMask, 'f');
return workspaceMgr.leverageTo(arrayType, timeSeriesMask.reshape('f', timeSeriesMask.length(), 1));
} | java | public static INDArray reshapeTimeSeriesMaskToVector(INDArray timeSeriesMask, LayerWorkspaceMgr workspaceMgr, ArrayType arrayType) {
if (timeSeriesMask.rank() != 2)
throw new IllegalArgumentException("Cannot reshape mask: rank is not 2");
if (timeSeriesMask.ordering() != 'f' || !Shape.hasDefaultStridesForShape(timeSeriesMask))
timeSeriesMask = workspaceMgr.dup(arrayType, timeSeriesMask, 'f');
return workspaceMgr.leverageTo(arrayType, timeSeriesMask.reshape('f', timeSeriesMask.length(), 1));
} | [
"public",
"static",
"INDArray",
"reshapeTimeSeriesMaskToVector",
"(",
"INDArray",
"timeSeriesMask",
",",
"LayerWorkspaceMgr",
"workspaceMgr",
",",
"ArrayType",
"arrayType",
")",
"{",
"if",
"(",
"timeSeriesMask",
".",
"rank",
"(",
")",
"!=",
"2",
")",
"throw",
"new... | Reshape time series mask arrays. This should match the assumptions (f order, etc) in RnnOutputLayer
@param timeSeriesMask Mask array to reshape to a column vector
@return Mask array as a column vector | [
"Reshape",
"time",
"series",
"mask",
"arrays",
".",
"This",
"should",
"match",
"the",
"assumptions",
"(",
"f",
"order",
"etc",
")",
"in",
"RnnOutputLayer"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java#L79-L87 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java | WebContainer.modified | @Modified
protected void modified(Map<String, Object> cfg) {
WebContainerConfiguration webconfig = new WebContainerConfiguration(DEFAULT_PORT);
webconfig.setDefaultVirtualHostName(DEFAULT_VHOST_NAME);
initialize(webconfig, cfg);
} | java | @Modified
protected void modified(Map<String, Object> cfg) {
WebContainerConfiguration webconfig = new WebContainerConfiguration(DEFAULT_PORT);
webconfig.setDefaultVirtualHostName(DEFAULT_VHOST_NAME);
initialize(webconfig, cfg);
} | [
"@",
"Modified",
"protected",
"void",
"modified",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"cfg",
")",
"{",
"WebContainerConfiguration",
"webconfig",
"=",
"new",
"WebContainerConfiguration",
"(",
"DEFAULT_PORT",
")",
";",
"webconfig",
".",
"setDefaultVirtual... | Called by DS when configuration is updated (post activation).
@param cfg | [
"Called",
"by",
"DS",
"when",
"configuration",
"is",
"updated",
"(",
"post",
"activation",
")",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java#L424-L429 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java | IteratorExtensions.elementsEqual | public static boolean elementsEqual(Iterator<?> iterator, Iterable<?> iterable) {
return Iterators.elementsEqual(iterator, iterable.iterator());
} | java | public static boolean elementsEqual(Iterator<?> iterator, Iterable<?> iterable) {
return Iterators.elementsEqual(iterator, iterable.iterator());
} | [
"public",
"static",
"boolean",
"elementsEqual",
"(",
"Iterator",
"<",
"?",
">",
"iterator",
",",
"Iterable",
"<",
"?",
">",
"iterable",
")",
"{",
"return",
"Iterators",
".",
"elementsEqual",
"(",
"iterator",
",",
"iterable",
".",
"iterator",
"(",
")",
")",... | Determines whether two iterators contain equal elements in the same order. More specifically, this method returns
{@code true} if {@code iterator} and {@code iterable} contain the same number of elements and every element of
{@code iterator} is equal to the corresponding element of {@code iterable}.
@param iterator
an iterator. May not be <code>null</code>.
@param iterable
an iterable. May not be <code>null</code>.
@return <code>true</code> if the two iterators contain equal elements in the same order. | [
"Determines",
"whether",
"two",
"iterators",
"contain",
"equal",
"elements",
"in",
"the",
"same",
"order",
".",
"More",
"specifically",
"this",
"method",
"returns",
"{",
"@code",
"true",
"}",
"if",
"{",
"@code",
"iterator",
"}",
"and",
"{",
"@code",
"iterabl... | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java#L577-L579 |
knowm/Datasets | datasets-hja-birdsong/src/main/java/com/musicg/wave/SpectrogramRender.java | SpectrogramRender.saveSpectrogram | public void saveSpectrogram(Spectrogram spectrogram, String filename) throws IOException {
BufferedImage bufferedImage = renderSpectrogram(spectrogram);
saveSpectrogram(bufferedImage, filename);
} | java | public void saveSpectrogram(Spectrogram spectrogram, String filename) throws IOException {
BufferedImage bufferedImage = renderSpectrogram(spectrogram);
saveSpectrogram(bufferedImage, filename);
} | [
"public",
"void",
"saveSpectrogram",
"(",
"Spectrogram",
"spectrogram",
",",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"BufferedImage",
"bufferedImage",
"=",
"renderSpectrogram",
"(",
"spectrogram",
")",
";",
"saveSpectrogram",
"(",
"bufferedImage",
","... | Render a spectrogram of a wave file
@param spectrogram spectrogram object
@param filename output file
@throws IOException
@see RGB graphic rendered | [
"Render",
"a",
"spectrogram",
"of",
"a",
"wave",
"file"
] | train | https://github.com/knowm/Datasets/blob/4ea16ccda1d4190a551accff78bbbe05c9c38c79/datasets-hja-birdsong/src/main/java/com/musicg/wave/SpectrogramRender.java#L67-L71 |
hal/core | gui/src/main/java/org/jboss/as/console/client/v3/dmr/AddressTemplate.java | AddressTemplate.replaceWildcards | public AddressTemplate replaceWildcards(String wildcard, String... wildcards) {
List<String> allWildcards = new ArrayList<>();
allWildcards.add(wildcard);
if (wildcards != null) {
allWildcards.addAll(Arrays.asList(wildcards));
}
LinkedList<Token> replacedTokens = new LinkedList<>();
Iterator<String> wi = allWildcards.iterator();
for (Token token : tokens) {
if (wi.hasNext() && token.hasKey() && "*".equals(token.getValue())) {
replacedTokens.add(new Token(token.getKey(), wi.next()));
} else {
replacedTokens.add(new Token(token.key, token.value));
}
}
return AddressTemplate.of(join(this.optional, replacedTokens));
} | java | public AddressTemplate replaceWildcards(String wildcard, String... wildcards) {
List<String> allWildcards = new ArrayList<>();
allWildcards.add(wildcard);
if (wildcards != null) {
allWildcards.addAll(Arrays.asList(wildcards));
}
LinkedList<Token> replacedTokens = new LinkedList<>();
Iterator<String> wi = allWildcards.iterator();
for (Token token : tokens) {
if (wi.hasNext() && token.hasKey() && "*".equals(token.getValue())) {
replacedTokens.add(new Token(token.getKey(), wi.next()));
} else {
replacedTokens.add(new Token(token.key, token.value));
}
}
return AddressTemplate.of(join(this.optional, replacedTokens));
} | [
"public",
"AddressTemplate",
"replaceWildcards",
"(",
"String",
"wildcard",
",",
"String",
"...",
"wildcards",
")",
"{",
"List",
"<",
"String",
">",
"allWildcards",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"allWildcards",
".",
"add",
"(",
"wildcard",
")... | Replaces one or more wildcards with the specified values starting from left to right and returns a new
address template.
<p/>
This method does <em>not</em> resolve the address template. The returned template is still unresolved.
@param wildcard the first wildcard (mandatory)
@param wildcards more wildcards (optional)
@return a new (still unresolved) address template with the wildcards replaced by the specified values. | [
"Replaces",
"one",
"or",
"more",
"wildcards",
"with",
"the",
"specified",
"values",
"starting",
"from",
"left",
"to",
"right",
"and",
"returns",
"a",
"new",
"address",
"template",
".",
"<p",
"/",
">",
"This",
"method",
"does",
"<em",
">",
"not<",
"/",
"e... | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/v3/dmr/AddressTemplate.java#L178-L195 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IntegerExtensions.java | IntegerExtensions.operator_tripleGreaterThan | @Pure
@Inline(value="($1 >>> $2)", constantExpression=true)
public static int operator_tripleGreaterThan(int a, int distance) {
return a >>> distance;
} | java | @Pure
@Inline(value="($1 >>> $2)", constantExpression=true)
public static int operator_tripleGreaterThan(int a, int distance) {
return a >>> distance;
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"($1 >>> $2)\"",
",",
"constantExpression",
"=",
"true",
")",
"public",
"static",
"int",
"operator_tripleGreaterThan",
"(",
"int",
"a",
",",
"int",
"distance",
")",
"{",
"return",
"a",
">>>",
"distance",
";",
... | The binary <code>unsigned right shift</code> operator. This is the equivalent to the java <code>>>></code> operator.
Shifts in zeros into as leftmost bits, thus always yielding a positive integer.
@param a
an integer.
@param distance
the number of times to shift.
@return <code>a>>>distance</code>
@since 2.3 | [
"The",
"binary",
"<code",
">",
"unsigned",
"right",
"shift<",
"/",
"code",
">",
"operator",
".",
"This",
"is",
"the",
"equivalent",
"to",
"the",
"java",
"<code",
">",
">",
";",
">",
";",
">",
";",
"<",
"/",
"code",
">",
"operator",
".",
"Shifts... | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IntegerExtensions.java#L224-L228 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java | EnumConstantBuilder.buildSignature | public void buildSignature(XMLNode node, Content enumConstantsTree) {
enumConstantsTree.addContent(writer.getSignature(
(FieldDoc) enumConstants.get(currentEnumConstantsIndex)));
} | java | public void buildSignature(XMLNode node, Content enumConstantsTree) {
enumConstantsTree.addContent(writer.getSignature(
(FieldDoc) enumConstants.get(currentEnumConstantsIndex)));
} | [
"public",
"void",
"buildSignature",
"(",
"XMLNode",
"node",
",",
"Content",
"enumConstantsTree",
")",
"{",
"enumConstantsTree",
".",
"addContent",
"(",
"writer",
".",
"getSignature",
"(",
"(",
"FieldDoc",
")",
"enumConstants",
".",
"get",
"(",
"currentEnumConstant... | Build the signature.
@param node the XML element that specifies which components to document
@param enumConstantsTree the content tree to which the documentation will be added | [
"Build",
"the",
"signature",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java#L179-L182 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.setDateReleased | public void setDateReleased(CmsResource resource, long dateReleased, boolean recursive) throws CmsException {
getResourceType(resource).setDateReleased(this, m_securityManager, resource, dateReleased, recursive);
} | java | public void setDateReleased(CmsResource resource, long dateReleased, boolean recursive) throws CmsException {
getResourceType(resource).setDateReleased(this, m_securityManager, resource, dateReleased, recursive);
} | [
"public",
"void",
"setDateReleased",
"(",
"CmsResource",
"resource",
",",
"long",
"dateReleased",
",",
"boolean",
"recursive",
")",
"throws",
"CmsException",
"{",
"getResourceType",
"(",
"resource",
")",
".",
"setDateReleased",
"(",
"this",
",",
"m_securityManager",... | Changes the "release" date of a resource.<p>
@param resource the resource to change
@param dateReleased the new release date of the changed resource
@param recursive if this operation is to be applied recursively to all resources in a folder
@throws CmsException if something goes wrong | [
"Changes",
"the",
"release",
"date",
"of",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3797-L3800 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/accumulators/AccumulatorHelper.java | AccumulatorHelper.mergeInto | public static void mergeInto(Map<String, Accumulator<?, ?>> target, Map<String, Accumulator<?, ?>> toMerge) {
for (Map.Entry<String, Accumulator<?, ?>> otherEntry : toMerge.entrySet()) {
Accumulator<?, ?> ownAccumulator = target.get(otherEntry.getKey());
if (ownAccumulator == null) {
// Take over counter from chained task
target.put(otherEntry.getKey(), otherEntry.getValue());
} else {
// Both should have the same type
AccumulatorHelper.compareAccumulatorTypes(otherEntry.getKey(),
ownAccumulator.getClass(), otherEntry.getValue().getClass());
// Merge counter from chained task into counter from stub
mergeSingle(ownAccumulator, otherEntry.getValue());
}
}
} | java | public static void mergeInto(Map<String, Accumulator<?, ?>> target, Map<String, Accumulator<?, ?>> toMerge) {
for (Map.Entry<String, Accumulator<?, ?>> otherEntry : toMerge.entrySet()) {
Accumulator<?, ?> ownAccumulator = target.get(otherEntry.getKey());
if (ownAccumulator == null) {
// Take over counter from chained task
target.put(otherEntry.getKey(), otherEntry.getValue());
} else {
// Both should have the same type
AccumulatorHelper.compareAccumulatorTypes(otherEntry.getKey(),
ownAccumulator.getClass(), otherEntry.getValue().getClass());
// Merge counter from chained task into counter from stub
mergeSingle(ownAccumulator, otherEntry.getValue());
}
}
} | [
"public",
"static",
"void",
"mergeInto",
"(",
"Map",
"<",
"String",
",",
"Accumulator",
"<",
"?",
",",
"?",
">",
">",
"target",
",",
"Map",
"<",
"String",
",",
"Accumulator",
"<",
"?",
",",
"?",
">",
">",
"toMerge",
")",
"{",
"for",
"(",
"Map",
"... | Merge two collections of accumulators. The second will be merged into the
first.
@param target
The collection of accumulators that will be updated
@param toMerge
The collection of accumulators that will be merged into the
other | [
"Merge",
"two",
"collections",
"of",
"accumulators",
".",
"The",
"second",
"will",
"be",
"merged",
"into",
"the",
"first",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/accumulators/AccumulatorHelper.java#L31-L45 |
apereo/cas | support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/SamlUtils.java | SamlUtils.buildSignatureValidationFilter | public static SignatureValidationFilter buildSignatureValidationFilter(final Resource signatureResourceLocation) throws Exception {
if (!ResourceUtils.doesResourceExist(signatureResourceLocation)) {
LOGGER.warn("Resource [{}] cannot be located", signatureResourceLocation);
return null;
}
val keyInfoProviderList = new ArrayList<KeyInfoProvider>();
keyInfoProviderList.add(new RSAKeyValueProvider());
keyInfoProviderList.add(new DSAKeyValueProvider());
keyInfoProviderList.add(new DEREncodedKeyValueProvider());
keyInfoProviderList.add(new InlineX509DataProvider());
LOGGER.debug("Attempting to resolve credentials from [{}]", signatureResourceLocation);
val credential = buildCredentialForMetadataSignatureValidation(signatureResourceLocation);
LOGGER.info("Successfully resolved credentials from [{}]", signatureResourceLocation);
LOGGER.debug("Configuring credential resolver for key signature trust engine @ [{}]", credential.getCredentialType().getSimpleName());
val resolver = new StaticCredentialResolver(credential);
val keyInfoResolver = new BasicProviderKeyInfoCredentialResolver(keyInfoProviderList);
val trustEngine = new ExplicitKeySignatureTrustEngine(resolver, keyInfoResolver);
LOGGER.debug("Adding signature validation filter based on the configured trust engine");
val signatureValidationFilter = new SignatureValidationFilter(trustEngine);
signatureValidationFilter.setDefaultCriteria(new SignatureValidationCriteriaSetFactoryBean().getObject());
LOGGER.debug("Added metadata SignatureValidationFilter with signature from [{}]", signatureResourceLocation);
return signatureValidationFilter;
} | java | public static SignatureValidationFilter buildSignatureValidationFilter(final Resource signatureResourceLocation) throws Exception {
if (!ResourceUtils.doesResourceExist(signatureResourceLocation)) {
LOGGER.warn("Resource [{}] cannot be located", signatureResourceLocation);
return null;
}
val keyInfoProviderList = new ArrayList<KeyInfoProvider>();
keyInfoProviderList.add(new RSAKeyValueProvider());
keyInfoProviderList.add(new DSAKeyValueProvider());
keyInfoProviderList.add(new DEREncodedKeyValueProvider());
keyInfoProviderList.add(new InlineX509DataProvider());
LOGGER.debug("Attempting to resolve credentials from [{}]", signatureResourceLocation);
val credential = buildCredentialForMetadataSignatureValidation(signatureResourceLocation);
LOGGER.info("Successfully resolved credentials from [{}]", signatureResourceLocation);
LOGGER.debug("Configuring credential resolver for key signature trust engine @ [{}]", credential.getCredentialType().getSimpleName());
val resolver = new StaticCredentialResolver(credential);
val keyInfoResolver = new BasicProviderKeyInfoCredentialResolver(keyInfoProviderList);
val trustEngine = new ExplicitKeySignatureTrustEngine(resolver, keyInfoResolver);
LOGGER.debug("Adding signature validation filter based on the configured trust engine");
val signatureValidationFilter = new SignatureValidationFilter(trustEngine);
signatureValidationFilter.setDefaultCriteria(new SignatureValidationCriteriaSetFactoryBean().getObject());
LOGGER.debug("Added metadata SignatureValidationFilter with signature from [{}]", signatureResourceLocation);
return signatureValidationFilter;
} | [
"public",
"static",
"SignatureValidationFilter",
"buildSignatureValidationFilter",
"(",
"final",
"Resource",
"signatureResourceLocation",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"ResourceUtils",
".",
"doesResourceExist",
"(",
"signatureResourceLocation",
")",
")",
... | Build signature validation filter if needed.
@param signatureResourceLocation the signature resource location
@return the metadata filter
@throws Exception the exception | [
"Build",
"signature",
"validation",
"filter",
"if",
"needed",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/SamlUtils.java#L189-L216 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java | LoggingConfigUtils.parseStringCollection | @SuppressWarnings("unchecked")
@FFDCIgnore(Exception.class)
public static Collection<String> parseStringCollection(String propertyKey, Object obj, Collection<String> defaultValue) {
if (obj != null) {
try {
if (obj instanceof Collection) {
return (Collection<String>) obj;
} else if (obj instanceof String) {
String commaList = (String) obj;
// split the string, consuming/removing whitespace
return Arrays.asList(commaList.split("\\s*,\\s*"));
} else if (obj instanceof String[]) {
return Arrays.asList((String[]) obj);
}
} catch (Exception e) {
throw new IllegalArgumentException("Collection of strings could not be parsed: key=" + propertyKey + ", value=" + obj, e);
}
// unknown type
throw new IllegalArgumentException("Collection of strings could not be parsed: key=" + propertyKey + ", value=" + obj);
}
return defaultValue;
} | java | @SuppressWarnings("unchecked")
@FFDCIgnore(Exception.class)
public static Collection<String> parseStringCollection(String propertyKey, Object obj, Collection<String> defaultValue) {
if (obj != null) {
try {
if (obj instanceof Collection) {
return (Collection<String>) obj;
} else if (obj instanceof String) {
String commaList = (String) obj;
// split the string, consuming/removing whitespace
return Arrays.asList(commaList.split("\\s*,\\s*"));
} else if (obj instanceof String[]) {
return Arrays.asList((String[]) obj);
}
} catch (Exception e) {
throw new IllegalArgumentException("Collection of strings could not be parsed: key=" + propertyKey + ", value=" + obj, e);
}
// unknown type
throw new IllegalArgumentException("Collection of strings could not be parsed: key=" + propertyKey + ", value=" + obj);
}
return defaultValue;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"FFDCIgnore",
"(",
"Exception",
".",
"class",
")",
"public",
"static",
"Collection",
"<",
"String",
">",
"parseStringCollection",
"(",
"String",
"propertyKey",
",",
"Object",
"obj",
",",
"Collection",
"<",... | Parse a string collection and returns
a collection of strings generated from either a comma-separated single
string value, or a string collection.
<p>
If an exception occurs converting the object parameter:
FFDC for the exception is suppressed: Callers should handle the thrown
IllegalArgumentException as appropriate.
@param propertyKey
The name of the configuration property.
@param obj
The object retrieved from the configuration property map/dictionary.
@param defaultValue
The default value that should be applied if the object is null.
@return Collection of strings parsed/retrieved from obj, or default value if obj is null
@throws IllegalArgumentException If value is not a String, String collection, or String array, or if an error
occurs while converting/casting the object to the return parameter type. | [
"Parse",
"a",
"string",
"collection",
"and",
"returns",
"a",
"collection",
"of",
"strings",
"generated",
"from",
"either",
"a",
"comma",
"-",
"separated",
"single",
"string",
"value",
"or",
"a",
"string",
"collection",
".",
"<p",
">",
"If",
"an",
"exception"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java#L226-L249 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_abbreviatedNumber_POST | public OvhAbbreviatedNumberGroup billingAccount_abbreviatedNumber_POST(String billingAccount, Long abbreviatedNumber, String destinationNumber, String name, String surname) throws IOException {
String qPath = "/telephony/{billingAccount}/abbreviatedNumber";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "abbreviatedNumber", abbreviatedNumber);
addBody(o, "destinationNumber", destinationNumber);
addBody(o, "name", name);
addBody(o, "surname", surname);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhAbbreviatedNumberGroup.class);
} | java | public OvhAbbreviatedNumberGroup billingAccount_abbreviatedNumber_POST(String billingAccount, Long abbreviatedNumber, String destinationNumber, String name, String surname) throws IOException {
String qPath = "/telephony/{billingAccount}/abbreviatedNumber";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "abbreviatedNumber", abbreviatedNumber);
addBody(o, "destinationNumber", destinationNumber);
addBody(o, "name", name);
addBody(o, "surname", surname);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhAbbreviatedNumberGroup.class);
} | [
"public",
"OvhAbbreviatedNumberGroup",
"billingAccount_abbreviatedNumber_POST",
"(",
"String",
"billingAccount",
",",
"Long",
"abbreviatedNumber",
",",
"String",
"destinationNumber",
",",
"String",
"name",
",",
"String",
"surname",
")",
"throws",
"IOException",
"{",
"Stri... | Create a new abbreviated number for the billing account
REST: POST /telephony/{billingAccount}/abbreviatedNumber
@param name [required]
@param surname [required]
@param abbreviatedNumber [required] The abbreviated number which must start with "7" and must have a length of 3 or 4 digits
@param destinationNumber [required] The destination of the abbreviated number
@param billingAccount [required] The name of your billingAccount | [
"Create",
"a",
"new",
"abbreviated",
"number",
"for",
"the",
"billing",
"account"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4602-L4612 |
signit-wesign/java-sdk | src/main/java/cn/signit/sdk/util/HmacSignatureBuilder.java | HmacSignatureBuilder.isHashEqualsWithHex | public boolean isHashEqualsWithHex(String expectedSignatureHex, BuilderMode builderMode) {
try {
final byte[] signature = build(builderMode);
return MessageDigest.isEqual(signature, DatatypeConverter.parseHexBinary(expectedSignatureHex));
} catch (Throwable e) {
System.err.println(e.getMessage());
return false;
}
} | java | public boolean isHashEqualsWithHex(String expectedSignatureHex, BuilderMode builderMode) {
try {
final byte[] signature = build(builderMode);
return MessageDigest.isEqual(signature, DatatypeConverter.parseHexBinary(expectedSignatureHex));
} catch (Throwable e) {
System.err.println(e.getMessage());
return false;
}
} | [
"public",
"boolean",
"isHashEqualsWithHex",
"(",
"String",
"expectedSignatureHex",
",",
"BuilderMode",
"builderMode",
")",
"{",
"try",
"{",
"final",
"byte",
"[",
"]",
"signature",
"=",
"build",
"(",
"builderMode",
")",
";",
"return",
"MessageDigest",
".",
"isEqu... | 判断期望摘要是否与已构建的摘要相等.
@param expectedSignatureHex
传入的期望摘要16进制编码表示的字符串
@param builderMode
采用的构建模式
@return <code>true</code> - 期望摘要与已构建的摘要相等; <code>false</code> -
期望摘要与已构建的摘要不相等
@author zhd
@since 1.0.0 | [
"判断期望摘要是否与已构建的摘要相等",
"."
] | train | https://github.com/signit-wesign/java-sdk/blob/6f3196c9d444818a953396fdaa8ffed9794d9530/src/main/java/cn/signit/sdk/util/HmacSignatureBuilder.java#L714-L722 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/DispatchRule.java | DispatchRule.newInstance | public static DispatchRule newInstance(String name, String dispatcher, String contentType, String encoding) {
return newInstance(name, dispatcher, contentType, encoding, null);
} | java | public static DispatchRule newInstance(String name, String dispatcher, String contentType, String encoding) {
return newInstance(name, dispatcher, contentType, encoding, null);
} | [
"public",
"static",
"DispatchRule",
"newInstance",
"(",
"String",
"name",
",",
"String",
"dispatcher",
",",
"String",
"contentType",
",",
"String",
"encoding",
")",
"{",
"return",
"newInstance",
"(",
"name",
",",
"dispatcher",
",",
"contentType",
",",
"encoding"... | Returns a new instance of DispatchRule.
@param name the dispatch name
@param dispatcher the id or class name of the view dispatcher bean
@param contentType the content type
@param encoding the character encoding
@return the dispatch rule | [
"Returns",
"a",
"new",
"instance",
"of",
"DispatchRule",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/DispatchRule.java#L243-L245 |
aws/aws-sdk-java | aws-java-sdk-iotjobsdataplane/src/main/java/com/amazonaws/services/iotjobsdataplane/model/JobExecution.java | JobExecution.withStatusDetails | public JobExecution withStatusDetails(java.util.Map<String, String> statusDetails) {
setStatusDetails(statusDetails);
return this;
} | java | public JobExecution withStatusDetails(java.util.Map<String, String> statusDetails) {
setStatusDetails(statusDetails);
return this;
} | [
"public",
"JobExecution",
"withStatusDetails",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"statusDetails",
")",
"{",
"setStatusDetails",
"(",
"statusDetails",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A collection of name/value pairs that describe the status of the job execution.
</p>
@param statusDetails
A collection of name/value pairs that describe the status of the job execution.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"collection",
"of",
"name",
"/",
"value",
"pairs",
"that",
"describe",
"the",
"status",
"of",
"the",
"job",
"execution",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iotjobsdataplane/src/main/java/com/amazonaws/services/iotjobsdataplane/model/JobExecution.java#L283-L286 |
spring-projects/spring-security-oauth | spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java | DefaultRedirectResolver.isEqual | private boolean isEqual(String str1, String str2) {
if (StringUtils.isEmpty(str1) && StringUtils.isEmpty(str2)) {
return true;
} else if (!StringUtils.isEmpty(str1)) {
return str1.equals(str2);
} else {
return false;
}
} | java | private boolean isEqual(String str1, String str2) {
if (StringUtils.isEmpty(str1) && StringUtils.isEmpty(str2)) {
return true;
} else if (!StringUtils.isEmpty(str1)) {
return str1.equals(str2);
} else {
return false;
}
} | [
"private",
"boolean",
"isEqual",
"(",
"String",
"str1",
",",
"String",
"str2",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"str1",
")",
"&&",
"StringUtils",
".",
"isEmpty",
"(",
"str2",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
... | Compares two strings but treats empty string or null equal
@param str1
@param str2
@return true if strings are equal, false otherwise | [
"Compares",
"two",
"strings",
"but",
"treats",
"empty",
"string",
"or",
"null",
"equal"
] | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java#L173-L181 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.listPackageResources | public static Collection<String> listPackageResources(String packageName, String fileNamesPattern)
{
String packagePath = Files.dot2urlpath(packageName);
Set<URL> packageURLs = new HashSet<>();
for(ClassLoader classLoader : new ClassLoader[]
{
Thread.currentThread().getContextClassLoader(), Classes.class.getClassLoader(), ClassLoader.getSystemClassLoader()
}) {
try {
packageURLs.addAll(Collections.list(classLoader.getResources(packagePath)));
}
catch(IOException e) {
log.error(e);
}
}
if(packageURLs.isEmpty()) {
throw new NoSuchBeingException("Package |%s| not found.", packageName);
}
Set<String> resources = new HashSet<>();
for(URL packageURL : packageURLs) {
resources.addAll(listPackageResources(packageURL, packagePath, fileNamesPattern));
}
return resources;
} | java | public static Collection<String> listPackageResources(String packageName, String fileNamesPattern)
{
String packagePath = Files.dot2urlpath(packageName);
Set<URL> packageURLs = new HashSet<>();
for(ClassLoader classLoader : new ClassLoader[]
{
Thread.currentThread().getContextClassLoader(), Classes.class.getClassLoader(), ClassLoader.getSystemClassLoader()
}) {
try {
packageURLs.addAll(Collections.list(classLoader.getResources(packagePath)));
}
catch(IOException e) {
log.error(e);
}
}
if(packageURLs.isEmpty()) {
throw new NoSuchBeingException("Package |%s| not found.", packageName);
}
Set<String> resources = new HashSet<>();
for(URL packageURL : packageURLs) {
resources.addAll(listPackageResources(packageURL, packagePath, fileNamesPattern));
}
return resources;
} | [
"public",
"static",
"Collection",
"<",
"String",
">",
"listPackageResources",
"(",
"String",
"packageName",
",",
"String",
"fileNamesPattern",
")",
"{",
"String",
"packagePath",
"=",
"Files",
".",
"dot2urlpath",
"(",
"packageName",
")",
";",
"Set",
"<",
"URL",
... | List package resources from local classes or from archives. List resource file names that respect a given pattern
from local stored package or from Java archive file. This utility method tries to locate the package with given
name using {@link ClassLoader#getResources(String)}. If returned URL starts with <code>jar:file</code>, that is,
has JAR protocol the package is contained into a Java archive file and is processed entry by entry. Otherwise
protocol should be <code>file</code> and package is located into local classes and is processed as file. If
protocol is neither <code>file</code> nor <code>jar:file</code> throws unsupported operation.
@param packageName qualified package name, possible empty for package root,
@param fileNamesPattern file names pattern as accepted by {@link FilteredStrings#FilteredStrings(String)}.
@return collection of resources from package matching requested pattern, possible empty.
@throws NoSuchBeingException if package is not found by current application class loader.
@throws UnsupportedOperationException if found package URL protocol is not <code>file</code> or
<code>jar:file</code>. | [
"List",
"package",
"resources",
"from",
"local",
"classes",
"or",
"from",
"archives",
".",
"List",
"resource",
"file",
"names",
"that",
"respect",
"a",
"given",
"pattern",
"from",
"local",
"stored",
"package",
"or",
"from",
"Java",
"archive",
"file",
".",
"T... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1179-L1204 |
jenkinsci/java-client-api | jenkins-client/src/main/java/com/offbytwo/jenkins/model/FolderJob.java | FolderJob.createFolder | public FolderJob createFolder(String folderName, Boolean crumbFlag) throws IOException {
// https://gist.github.com/stuart-warren/7786892 was slightly helpful
// here
//TODO: JDK9+: Map.of(...)
Map<String, String> params = new HashMap<>();
params.put("mode", "com.cloudbees.hudson.plugins.folder.Folder");
params.put("name", folderName);
params.put("from", "");
params.put("Submit", "OK");
client.post_form(this.getUrl() + "/createItem?", params, crumbFlag);
return this;
} | java | public FolderJob createFolder(String folderName, Boolean crumbFlag) throws IOException {
// https://gist.github.com/stuart-warren/7786892 was slightly helpful
// here
//TODO: JDK9+: Map.of(...)
Map<String, String> params = new HashMap<>();
params.put("mode", "com.cloudbees.hudson.plugins.folder.Folder");
params.put("name", folderName);
params.put("from", "");
params.put("Submit", "OK");
client.post_form(this.getUrl() + "/createItem?", params, crumbFlag);
return this;
} | [
"public",
"FolderJob",
"createFolder",
"(",
"String",
"folderName",
",",
"Boolean",
"crumbFlag",
")",
"throws",
"IOException",
"{",
"// https://gist.github.com/stuart-warren/7786892 was slightly helpful",
"// here",
"//TODO: JDK9+: Map.of(...)",
"Map",
"<",
"String",
",",
"St... | Create a folder on the server (as a subfolder of this folder)
@param folderName name of the folder to be created.
@param crumbFlag true/false.
@return
@throws IOException in case of an error. | [
"Create",
"a",
"folder",
"on",
"the",
"server",
"(",
"as",
"a",
"subfolder",
"of",
"this",
"folder",
")"
] | train | https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/model/FolderJob.java#L94-L105 |
hal/core | gui/src/main/java/org/jboss/as/console/client/widgets/forms/AddressBinding.java | AddressBinding.asResource | public ModelNode asResource(ModelNode baseAddress, String... args) {
assert getNumWildCards() ==args.length :
"Address arguments don't match number of wildcards: "+getNumWildCards()+" -> "+ Arrays.toString(args);
ModelNode model = new ModelNode();
model.get(ADDRESS).set(baseAddress);
int argsCounter = 0;
for(String[] tuple : address)
{
String parent = tuple[0];
String child = tuple[1];
if(parent.startsWith("{"))
{
parent = args[argsCounter];
argsCounter++;
}
if(child.startsWith("{"))
{
child = args[argsCounter];
argsCounter++;
}
model.get(ADDRESS).add(parent, child);
}
return model;
} | java | public ModelNode asResource(ModelNode baseAddress, String... args) {
assert getNumWildCards() ==args.length :
"Address arguments don't match number of wildcards: "+getNumWildCards()+" -> "+ Arrays.toString(args);
ModelNode model = new ModelNode();
model.get(ADDRESS).set(baseAddress);
int argsCounter = 0;
for(String[] tuple : address)
{
String parent = tuple[0];
String child = tuple[1];
if(parent.startsWith("{"))
{
parent = args[argsCounter];
argsCounter++;
}
if(child.startsWith("{"))
{
child = args[argsCounter];
argsCounter++;
}
model.get(ADDRESS).add(parent, child);
}
return model;
} | [
"public",
"ModelNode",
"asResource",
"(",
"ModelNode",
"baseAddress",
",",
"String",
"...",
"args",
")",
"{",
"assert",
"getNumWildCards",
"(",
")",
"==",
"args",
".",
"length",
":",
"\"Address arguments don't match number of wildcards: \"",
"+",
"getNumWildCards",
"(... | Turns this address into a ModelNode with an address property.<br/>
This method allows to specify a base address prefix (i.e server vs. domain addressing).
@param baseAddress
@param args parameters for address wildcards
@return a ModelNode with an address property | [
"Turns",
"this",
"address",
"into",
"a",
"ModelNode",
"with",
"an",
"address",
"property",
".",
"<br",
"/",
">",
"This",
"method",
"allows",
"to",
"specify",
"a",
"base",
"address",
"prefix",
"(",
"i",
".",
"e",
"server",
"vs",
".",
"domain",
"addressing... | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/widgets/forms/AddressBinding.java#L80-L110 |
tzaeschke/zoodb | src/org/zoodb/internal/server/DiskAccessOneFile.java | DiskAccessOneFile.defineIndex | @Override
public void defineIndex(ZooClassDef def, ZooFieldDef field, boolean isUnique) {
SchemaIndexEntry se = schemaIndex.getSchema(def);
LongLongIndex fieldInd = se.defineIndex(field, isUnique);
//fill index with existing objects
PagedPosIndex ind = se.getObjectIndexLatestSchemaVersion();
PagedPosIndex.ObjectPosIterator iter = ind.iteratorObjects();
DataDeSerializerNoClass dds = new DataDeSerializerNoClass(fileInAP);
if (field.isPrimitiveType()) {
while (iter.hasNext()) {
long pos = iter.nextPos();
dds.seekPos(pos);
//first read the key, then afterwards the field!
long key = dds.getAttrAsLong(def, field);
if (isUnique) {
if (!fieldInd.insertLongIfNotSet(key, dds.getLastOid())) {
throw DBLogger.newUser("Duplicate entry in unique index: " +
Util.oidToString(dds.getLastOid()) + " v=" + key);
}
} else {
fieldInd.insertLong(key, dds.getLastOid());
}
}
} else {
while (iter.hasNext()) {
long pos = iter.nextPos();
dds.seekPos(pos);
//first read the key, then afterwards the field!
long key = dds.getAttrAsLongObjectNotNull(def, field);
fieldInd.insertLong(key, dds.getLastOid());
//TODO handle null values:
//-ignore them?
//-use special value?
}
//DatabaseLogger.debugPrintln(0, "FIXME defineIndex()");
}
iter.close();
} | java | @Override
public void defineIndex(ZooClassDef def, ZooFieldDef field, boolean isUnique) {
SchemaIndexEntry se = schemaIndex.getSchema(def);
LongLongIndex fieldInd = se.defineIndex(field, isUnique);
//fill index with existing objects
PagedPosIndex ind = se.getObjectIndexLatestSchemaVersion();
PagedPosIndex.ObjectPosIterator iter = ind.iteratorObjects();
DataDeSerializerNoClass dds = new DataDeSerializerNoClass(fileInAP);
if (field.isPrimitiveType()) {
while (iter.hasNext()) {
long pos = iter.nextPos();
dds.seekPos(pos);
//first read the key, then afterwards the field!
long key = dds.getAttrAsLong(def, field);
if (isUnique) {
if (!fieldInd.insertLongIfNotSet(key, dds.getLastOid())) {
throw DBLogger.newUser("Duplicate entry in unique index: " +
Util.oidToString(dds.getLastOid()) + " v=" + key);
}
} else {
fieldInd.insertLong(key, dds.getLastOid());
}
}
} else {
while (iter.hasNext()) {
long pos = iter.nextPos();
dds.seekPos(pos);
//first read the key, then afterwards the field!
long key = dds.getAttrAsLongObjectNotNull(def, field);
fieldInd.insertLong(key, dds.getLastOid());
//TODO handle null values:
//-ignore them?
//-use special value?
}
//DatabaseLogger.debugPrintln(0, "FIXME defineIndex()");
}
iter.close();
} | [
"@",
"Override",
"public",
"void",
"defineIndex",
"(",
"ZooClassDef",
"def",
",",
"ZooFieldDef",
"field",
",",
"boolean",
"isUnique",
")",
"{",
"SchemaIndexEntry",
"se",
"=",
"schemaIndex",
".",
"getSchema",
"(",
"def",
")",
";",
"LongLongIndex",
"fieldInd",
"... | Defines an index and populates it. All objects are put into the cache. This is not
necessarily useful, but it is a one-off operation. Otherwise we would need a special
purpose implementation of the deserializer, which would have the need for a cache removed. | [
"Defines",
"an",
"index",
"and",
"populates",
"it",
".",
"All",
"objects",
"are",
"put",
"into",
"the",
"cache",
".",
"This",
"is",
"not",
"necessarily",
"useful",
"but",
"it",
"is",
"a",
"one",
"-",
"off",
"operation",
".",
"Otherwise",
"we",
"would",
... | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/DiskAccessOneFile.java#L609-L647 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/EvaluationUtils.java | EvaluationUtils.fBeta | public static double fBeta(double beta, long tp, long fp, long fn) {
double prec = tp / ((double) tp + fp);
double recall = tp / ((double) tp + fn);
return fBeta(beta, prec, recall);
} | java | public static double fBeta(double beta, long tp, long fp, long fn) {
double prec = tp / ((double) tp + fp);
double recall = tp / ((double) tp + fn);
return fBeta(beta, prec, recall);
} | [
"public",
"static",
"double",
"fBeta",
"(",
"double",
"beta",
",",
"long",
"tp",
",",
"long",
"fp",
",",
"long",
"fn",
")",
"{",
"double",
"prec",
"=",
"tp",
"/",
"(",
"(",
"double",
")",
"tp",
"+",
"fp",
")",
";",
"double",
"recall",
"=",
"tp",
... | Calculate the F beta value from counts
@param beta Beta of value to use
@param tp True positive count
@param fp False positive count
@param fn False negative count
@return F beta | [
"Calculate",
"the",
"F",
"beta",
"value",
"from",
"counts"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/EvaluationUtils.java#L109-L113 |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java | FedoraTypesUtils.isReferenceProperty | public static boolean isReferenceProperty(final Node node, final String propertyName) throws RepositoryException {
final Optional<PropertyDefinition> propertyDefinition = getDefinitionForPropertyName(node, propertyName);
return propertyDefinition.isPresent() &&
(propertyDefinition.get().getRequiredType() == REFERENCE
|| propertyDefinition.get().getRequiredType() == WEAKREFERENCE);
} | java | public static boolean isReferenceProperty(final Node node, final String propertyName) throws RepositoryException {
final Optional<PropertyDefinition> propertyDefinition = getDefinitionForPropertyName(node, propertyName);
return propertyDefinition.isPresent() &&
(propertyDefinition.get().getRequiredType() == REFERENCE
|| propertyDefinition.get().getRequiredType() == WEAKREFERENCE);
} | [
"public",
"static",
"boolean",
"isReferenceProperty",
"(",
"final",
"Node",
"node",
",",
"final",
"String",
"propertyName",
")",
"throws",
"RepositoryException",
"{",
"final",
"Optional",
"<",
"PropertyDefinition",
">",
"propertyDefinition",
"=",
"getDefinitionForProper... | Check if a property definition is a reference property
@param node the given node
@param propertyName the property name
@return whether a property definition is a reference property
@throws RepositoryException if repository exception occurred | [
"Check",
"if",
"a",
"property",
"definition",
"is",
"a",
"reference",
"property"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L325-L331 |
jmrozanec/cron-utils | src/main/java/com/cronutils/utils/Preconditions.java | Preconditions.checkNotNullNorEmpty | public static String checkNotNullNorEmpty(final String reference, final Object errorMessage) {
if (reference == null) {
throw new NullPointerException(String.valueOf(errorMessage));
}
if (reference.isEmpty()) {
throw new IllegalArgumentException(String.valueOf(errorMessage));
}
return reference;
} | java | public static String checkNotNullNorEmpty(final String reference, final Object errorMessage) {
if (reference == null) {
throw new NullPointerException(String.valueOf(errorMessage));
}
if (reference.isEmpty()) {
throw new IllegalArgumentException(String.valueOf(errorMessage));
}
return reference;
} | [
"public",
"static",
"String",
"checkNotNullNorEmpty",
"(",
"final",
"String",
"reference",
",",
"final",
"Object",
"errorMessage",
")",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"String",
".",
"valueOf",
... | Ensures that a string reference passed as a parameter to the calling method is not null.
nor empty.
@param reference a string reference
@param errorMessage the exception message to use if the check fails; will be converted to a
string using {@link String#valueOf(Object)}
@return the non-null reference that was validated
@throws NullPointerException if {@code reference} is null
@throws IllegalArgumentException if {@code reference} is empty | [
"Ensures",
"that",
"a",
"string",
"reference",
"passed",
"as",
"a",
"parameter",
"to",
"the",
"calling",
"method",
"is",
"not",
"null",
".",
"nor",
"empty",
"."
] | train | https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/utils/Preconditions.java#L201-L209 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java | UtilMath.getRoundedC | public static int getRoundedC(double value, int round)
{
Check.different(round, 0);
return (int) Math.ceil(value / round) * round;
} | java | public static int getRoundedC(double value, int round)
{
Check.different(round, 0);
return (int) Math.ceil(value / round) * round;
} | [
"public",
"static",
"int",
"getRoundedC",
"(",
"double",
"value",
",",
"int",
"round",
")",
"{",
"Check",
".",
"different",
"(",
"round",
",",
"0",
")",
";",
"return",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"value",
"/",
"round",
")",
"*",
"rou... | Get the rounded value with ceil.
@param value The value.
@param round The round factor (must not be equal to 0).
@return The rounded value.
@throws LionEngineException If invalid argument. | [
"Get",
"the",
"rounded",
"value",
"with",
"ceil",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java#L320-L325 |
looly/hutool | hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java | CaptchaUtil.createShearCaptcha | public static ShearCaptcha createShearCaptcha(int width, int height, int codeCount, int thickness) {
return new ShearCaptcha(width, height, codeCount, thickness);
} | java | public static ShearCaptcha createShearCaptcha(int width, int height, int codeCount, int thickness) {
return new ShearCaptcha(width, height, codeCount, thickness);
} | [
"public",
"static",
"ShearCaptcha",
"createShearCaptcha",
"(",
"int",
"width",
",",
"int",
"height",
",",
"int",
"codeCount",
",",
"int",
"thickness",
")",
"{",
"return",
"new",
"ShearCaptcha",
"(",
"width",
",",
"height",
",",
"codeCount",
",",
"thickness",
... | 创建扭曲干扰的验证码,默认5位验证码
@param width 图片宽
@param height 图片高
@param codeCount 字符个数
@param thickness 干扰线宽度
@return {@link ShearCaptcha}
@since 3.3.0 | [
"创建扭曲干扰的验证码,默认5位验证码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java#L83-L85 |
tzaeschke/zoodb | src/org/zoodb/internal/util/FormattedStringBuilder.java | FormattedStringBuilder.fillOrCut | public FormattedStringBuilder fillOrCut(int newLength, char c) {
if (newLength < 0) {
throw new IllegalArgumentException();
}
int lineStart = _delegate.lastIndexOf(NL);
if (lineStart == -1) {
lineStart = 0;
} else {
lineStart += NL.length();
}
int lineLen = _delegate.length() - lineStart;
if (newLength < lineLen) {
_delegate = new StringBuilder(_delegate.substring(0, lineStart + newLength));
return this;
}
return fill(newLength, c);
} | java | public FormattedStringBuilder fillOrCut(int newLength, char c) {
if (newLength < 0) {
throw new IllegalArgumentException();
}
int lineStart = _delegate.lastIndexOf(NL);
if (lineStart == -1) {
lineStart = 0;
} else {
lineStart += NL.length();
}
int lineLen = _delegate.length() - lineStart;
if (newLength < lineLen) {
_delegate = new StringBuilder(_delegate.substring(0, lineStart + newLength));
return this;
}
return fill(newLength, c);
} | [
"public",
"FormattedStringBuilder",
"fillOrCut",
"(",
"int",
"newLength",
",",
"char",
"c",
")",
"{",
"if",
"(",
"newLength",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"int",
"lineStart",
"=",
"_delegate",
".",
"la... | Attempts to append <tt>c</tt> until the line gets the length <tt>
newLength</tt>. If the line is already longer than <tt>newLength</tt>,
then the internal strings is cut to <tt>newLength</tt>.
@param newLength New length of the last line.
@param c Character to append.
@return The updated instance of FormattedStringBuilder. | [
"Attempts",
"to",
"append",
"<tt",
">",
"c<",
"/",
"tt",
">",
"until",
"the",
"line",
"gets",
"the",
"length",
"<tt",
">",
"newLength<",
"/",
"tt",
">",
".",
"If",
"the",
"line",
"is",
"already",
"longer",
"than",
"<tt",
">",
"newLength<",
"/",
"tt",... | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/FormattedStringBuilder.java#L220-L237 |
metafacture/metafacture-core | metafacture-formeta/src/main/java/org/metafacture/formeta/parser/FormetaParser.java | FormetaParser.getErrorSnippet | private static String getErrorSnippet(final String record, final int pos) {
final StringBuilder snippet = new StringBuilder();
final int start = pos - SNIPPET_SIZE / 2;
if (start < 0) {
snippet.append(record.substring(0, pos));
} else {
snippet.append(SNIPPET_ELLIPSIS);
snippet.append(record.substring(start, pos));
}
snippet.append(POS_MARKER_LEFT);
snippet.append(record.charAt(pos));
snippet.append(POS_MARKER_RIGHT);
if (pos + 1 < record.length()) {
final int end = pos + SNIPPET_SIZE / 2;
if (end > record.length()) {
snippet.append(record.substring(pos + 1));
} else {
snippet.append(record.substring(pos + 1, end));
snippet.append(SNIPPET_ELLIPSIS);
}
}
return snippet.toString();
} | java | private static String getErrorSnippet(final String record, final int pos) {
final StringBuilder snippet = new StringBuilder();
final int start = pos - SNIPPET_SIZE / 2;
if (start < 0) {
snippet.append(record.substring(0, pos));
} else {
snippet.append(SNIPPET_ELLIPSIS);
snippet.append(record.substring(start, pos));
}
snippet.append(POS_MARKER_LEFT);
snippet.append(record.charAt(pos));
snippet.append(POS_MARKER_RIGHT);
if (pos + 1 < record.length()) {
final int end = pos + SNIPPET_SIZE / 2;
if (end > record.length()) {
snippet.append(record.substring(pos + 1));
} else {
snippet.append(record.substring(pos + 1, end));
snippet.append(SNIPPET_ELLIPSIS);
}
}
return snippet.toString();
} | [
"private",
"static",
"String",
"getErrorSnippet",
"(",
"final",
"String",
"record",
",",
"final",
"int",
"pos",
")",
"{",
"final",
"StringBuilder",
"snippet",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"int",
"start",
"=",
"pos",
"-",
"SNIPPET_SIZE... | Extracts a text snippet from the record for showing the position at
which an error occurred. The exact position additionally highlighted
with {@link POS_MARKER_LEFT} and {@link POS_MARKER_RIGHT}.
@param record the record currently being parsed
@param pos the position at which the error occurred
@return a text snippet. | [
"Extracts",
"a",
"text",
"snippet",
"from",
"the",
"record",
"for",
"showing",
"the",
"position",
"at",
"which",
"an",
"error",
"occurred",
".",
"The",
"exact",
"position",
"additionally",
"highlighted",
"with",
"{",
"@link",
"POS_MARKER_LEFT",
"}",
"and",
"{"... | train | https://github.com/metafacture/metafacture-core/blob/cb43933ec8eb01a4ddce4019c14b2415cc441918/metafacture-formeta/src/main/java/org/metafacture/formeta/parser/FormetaParser.java#L85-L111 |
podio/podio-java | src/main/java/com/podio/org/OrgAPI.java | OrgAPI.getSpaceByURL | public Space getSpaceByURL(int orgId, String url) {
return getResourceFactory().getApiResource(
"/org/" + orgId + "/space/url/" + url).get(Space.class);
} | java | public Space getSpaceByURL(int orgId, String url) {
return getResourceFactory().getApiResource(
"/org/" + orgId + "/space/url/" + url).get(Space.class);
} | [
"public",
"Space",
"getSpaceByURL",
"(",
"int",
"orgId",
",",
"String",
"url",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/org/\"",
"+",
"orgId",
"+",
"\"/space/url/\"",
"+",
"url",
")",
".",
"get",
"(",
"Space",
"."... | Return the space with the given URL on the space. To get the space
related to http://company.podio.com/intranet, first lookup the
organization on "company" and then the space using this function using
the URL "intranet".
@param orgId
The id of the organization
@param url
The url fragment for the space
@return The matching space | [
"Return",
"the",
"space",
"with",
"the",
"given",
"URL",
"on",
"the",
"space",
".",
"To",
"get",
"the",
"space",
"related",
"to",
"http",
":",
"//",
"company",
".",
"podio",
".",
"com",
"/",
"intranet",
"first",
"lookup",
"the",
"organization",
"on",
"... | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/org/OrgAPI.java#L109-L112 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java | CacheProviderWrapper.updateStatisticsForVBC | @Override
public void updateStatisticsForVBC(com.ibm.websphere.cache.CacheEntry cacheEntry, boolean directive) {
// TODO needs to change if cache provider supports PMI and CacheStatisticsListener
final String methodName = "updateStatisticsForVBC()";
Object id = null;
if (cacheEntry != null) {
id = cacheEntry.getIdObject();
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id + " directive=" + directive);
}
} | java | @Override
public void updateStatisticsForVBC(com.ibm.websphere.cache.CacheEntry cacheEntry, boolean directive) {
// TODO needs to change if cache provider supports PMI and CacheStatisticsListener
final String methodName = "updateStatisticsForVBC()";
Object id = null;
if (cacheEntry != null) {
id = cacheEntry.getIdObject();
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id + " directive=" + directive);
}
} | [
"@",
"Override",
"public",
"void",
"updateStatisticsForVBC",
"(",
"com",
".",
"ibm",
".",
"websphere",
".",
"cache",
".",
"CacheEntry",
"cacheEntry",
",",
"boolean",
"directive",
")",
"{",
"// TODO needs to change if cache provider supports PMI and CacheStatisticsListener",... | This method needs to change if cache provider supports PMI and CacheStatisticsListener. | [
"This",
"method",
"needs",
"to",
"change",
"if",
"cache",
"provider",
"supports",
"PMI",
"and",
"CacheStatisticsListener",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L1497-L1508 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java | JavaScriptUtils.getUnencodedHtmlCookieString | public String getUnencodedHtmlCookieString(String name, String value, Map<String, String> cookieProperties) {
return createHtmlCookieString(name, value, cookieProperties, false);
} | java | public String getUnencodedHtmlCookieString(String name, String value, Map<String, String> cookieProperties) {
return createHtmlCookieString(name, value, cookieProperties, false);
} | [
"public",
"String",
"getUnencodedHtmlCookieString",
"(",
"String",
"name",
",",
"String",
"value",
",",
"Map",
"<",
"String",
",",
"String",
">",
"cookieProperties",
")",
"{",
"return",
"createHtmlCookieString",
"(",
"name",
",",
"value",
",",
"cookieProperties",
... | Creates and returns a JavaScript line for setting a cookie with the specified name, value, and cookie properties. Note: The
properties will be HTML-encoded but the name and value will not be. | [
"Creates",
"and",
"returns",
"a",
"JavaScript",
"line",
"for",
"setting",
"a",
"cookie",
"with",
"the",
"specified",
"name",
"value",
"and",
"cookie",
"properties",
".",
"Note",
":",
"The",
"properties",
"will",
"be",
"HTML",
"-",
"encoded",
"but",
"the",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java#L99-L101 |
fozziethebeat/S-Space | opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java | LatentRelationalAnalysis.initializeIndex | public static void initializeIndex(String indexDir, String dataDir) {
File indexDir_f = new File(indexDir);
File dataDir_f = new File(dataDir);
long start = new Date().getTime();
try {
int numIndexed = index(indexDir_f, dataDir_f);
long end = new Date().getTime();
System.err.println("Indexing " + numIndexed + " files took " + (end -start) + " milliseconds");
} catch (IOException e) {
System.err.println("Unable to index "+indexDir_f+": "+e.getMessage());
}
} | java | public static void initializeIndex(String indexDir, String dataDir) {
File indexDir_f = new File(indexDir);
File dataDir_f = new File(dataDir);
long start = new Date().getTime();
try {
int numIndexed = index(indexDir_f, dataDir_f);
long end = new Date().getTime();
System.err.println("Indexing " + numIndexed + " files took " + (end -start) + " milliseconds");
} catch (IOException e) {
System.err.println("Unable to index "+indexDir_f+": "+e.getMessage());
}
} | [
"public",
"static",
"void",
"initializeIndex",
"(",
"String",
"indexDir",
",",
"String",
"dataDir",
")",
"{",
"File",
"indexDir_f",
"=",
"new",
"File",
"(",
"indexDir",
")",
";",
"File",
"dataDir_f",
"=",
"new",
"File",
"(",
"dataDir",
")",
";",
"long",
... | Initializes an index given the index directory and data directory.
@param indexDir a {@code String} containing the directory where the index
will be stored
@param dataDir a {@code String} containing the directory where the data
is found | [
"Initializes",
"an",
"index",
"given",
"the",
"index",
"directory",
"and",
"data",
"directory",
"."
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java#L289-L302 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java | TupleGenerator.createPropertyProviders | private MultiValuedMap<String,VarBindingDef> createPropertyProviders( FunctionInputDef inputDef)
{
propertyProviders_ = MultiMapUtils.newListValuedHashMap();
for( VarDefIterator varDefs = new VarDefIterator( inputDef.getVarDefs()); varDefs.hasNext(); )
{
VarDef varDef = varDefs.next();
for( Iterator<VarValueDef> values = varDef.getValidValues(); values.hasNext(); )
{
VarValueDef value = values.next();
if( value.hasProperties())
{
VarBindingDef binding = new VarBindingDef( varDef, value);
for( Iterator<String> properties = value.getProperties().iterator(); properties.hasNext(); )
{
propertyProviders_.put( properties.next(), binding);
}
}
}
}
return propertyProviders_;
} | java | private MultiValuedMap<String,VarBindingDef> createPropertyProviders( FunctionInputDef inputDef)
{
propertyProviders_ = MultiMapUtils.newListValuedHashMap();
for( VarDefIterator varDefs = new VarDefIterator( inputDef.getVarDefs()); varDefs.hasNext(); )
{
VarDef varDef = varDefs.next();
for( Iterator<VarValueDef> values = varDef.getValidValues(); values.hasNext(); )
{
VarValueDef value = values.next();
if( value.hasProperties())
{
VarBindingDef binding = new VarBindingDef( varDef, value);
for( Iterator<String> properties = value.getProperties().iterator(); properties.hasNext(); )
{
propertyProviders_.put( properties.next(), binding);
}
}
}
}
return propertyProviders_;
} | [
"private",
"MultiValuedMap",
"<",
"String",
",",
"VarBindingDef",
">",
"createPropertyProviders",
"(",
"FunctionInputDef",
"inputDef",
")",
"{",
"propertyProviders_",
"=",
"MultiMapUtils",
".",
"newListValuedHashMap",
"(",
")",
";",
"for",
"(",
"VarDefIterator",
"varD... | Return a map that associates each value property with the set of bindings that provide it. | [
"Return",
"a",
"map",
"that",
"associates",
"each",
"value",
"property",
"with",
"the",
"set",
"of",
"bindings",
"that",
"provide",
"it",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java#L733-L754 |
kaichunlin/android-transition | core/src/main/java/com/kaichunlin/transition/AbstractTransitionBuilder.java | AbstractTransitionBuilder.transitInt | public T transitInt(int propertyId, int... vals) {
String property = getPropertyName(propertyId);
mHolders.put(propertyId, PropertyValuesHolder.ofInt(property, vals));
mShadowHolders.put(propertyId, ShadowValuesHolder.ofInt(property, vals));
return self();
} | java | public T transitInt(int propertyId, int... vals) {
String property = getPropertyName(propertyId);
mHolders.put(propertyId, PropertyValuesHolder.ofInt(property, vals));
mShadowHolders.put(propertyId, ShadowValuesHolder.ofInt(property, vals));
return self();
} | [
"public",
"T",
"transitInt",
"(",
"int",
"propertyId",
",",
"int",
"...",
"vals",
")",
"{",
"String",
"property",
"=",
"getPropertyName",
"(",
"propertyId",
")",
";",
"mHolders",
".",
"put",
"(",
"propertyId",
",",
"PropertyValuesHolder",
".",
"ofInt",
"(",
... | Transits a float property from the start value to the end value.
@param propertyId
@param vals
@return self | [
"Transits",
"a",
"float",
"property",
"from",
"the",
"start",
"value",
"to",
"the",
"end",
"value",
"."
] | train | https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/AbstractTransitionBuilder.java#L656-L661 |
protegeproject/jpaul | src/main/java/jpaul/DataStructs/DSUtil.java | DSUtil.mapColl | public static <E1,E2> Collection<E2> mapColl(Iterable<E1> coll, Map<E1,E2> map, Collection<E2> newColl) {
return mapColl(coll, map2fun(map), newColl);
} | java | public static <E1,E2> Collection<E2> mapColl(Iterable<E1> coll, Map<E1,E2> map, Collection<E2> newColl) {
return mapColl(coll, map2fun(map), newColl);
} | [
"public",
"static",
"<",
"E1",
",",
"E2",
">",
"Collection",
"<",
"E2",
">",
"mapColl",
"(",
"Iterable",
"<",
"E1",
">",
"coll",
",",
"Map",
"<",
"E1",
",",
"E2",
">",
"map",
",",
"Collection",
"<",
"E2",
">",
"newColl",
")",
"{",
"return",
"mapC... | Similar to teh other <code>mapColl</code> method, but the
function is given as a map. This map is expected to map all
elements from the entry collection <code>coll</code>.
@see #mapColl(Iterable, Function, Collection) | [
"Similar",
"to",
"teh",
"other",
"<code",
">",
"mapColl<",
"/",
"code",
">",
"method",
"but",
"the",
"function",
"is",
"given",
"as",
"a",
"map",
".",
"This",
"map",
"is",
"expected",
"to",
"map",
"all",
"elements",
"from",
"the",
"entry",
"collection",
... | train | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/DataStructs/DSUtil.java#L279-L281 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java | TypicalLoginAssist.createRememberMeKey | protected String createRememberMeKey(USER_ENTITY userEntity, USER_BEAN userBean) {
return String.valueOf(userBean.getUserId()); // as default (override if it needs)
} | java | protected String createRememberMeKey(USER_ENTITY userEntity, USER_BEAN userBean) {
return String.valueOf(userBean.getUserId()); // as default (override if it needs)
} | [
"protected",
"String",
"createRememberMeKey",
"(",
"USER_ENTITY",
"userEntity",
",",
"USER_BEAN",
"userBean",
")",
"{",
"return",
"String",
".",
"valueOf",
"(",
"userBean",
".",
"getUserId",
"(",
")",
")",
";",
"// as default (override if it needs)",
"}"
] | Create remember-me key for the user. <br>
You can change user key's structure by override. #change_user_key
@param userEntity The selected entity of login user. (NotNull)
@param userBean The user bean saved in session. (NotNull)
@return The string expression for remember-me key. (NotNull) | [
"Create",
"remember",
"-",
"me",
"key",
"for",
"the",
"user",
".",
"<br",
">",
"You",
"can",
"change",
"user",
"key",
"s",
"structure",
"by",
"override",
".",
"#change_user_key"
] | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java#L466-L468 |
actframework/actframework | src/main/java/act/util/ClassNode.java | ClassNode.visitTree | public ClassNode visitTree($.Visitor<ClassNode> visitor, final boolean publicOnly, final boolean noAbstract) {
return visitTree($.guardedVisitor(classNodeFilter(publicOnly, noAbstract), visitor));
} | java | public ClassNode visitTree($.Visitor<ClassNode> visitor, final boolean publicOnly, final boolean noAbstract) {
return visitTree($.guardedVisitor(classNodeFilter(publicOnly, noAbstract), visitor));
} | [
"public",
"ClassNode",
"visitTree",
"(",
"$",
".",
"Visitor",
"<",
"ClassNode",
">",
"visitor",
",",
"final",
"boolean",
"publicOnly",
",",
"final",
"boolean",
"noAbstract",
")",
"{",
"return",
"visitTree",
"(",
"$",
".",
"guardedVisitor",
"(",
"classNodeFilte... | Accept a visitor that visit all descendants of the class represetned by
this `ClassNode` including this `ClassNode` itself.
@param visitor the visitor
@param publicOnly specify if only public class shall be visited
@param noAbstract specify if abstract class can be visited
@return this `ClassNode` instance | [
"Accept",
"a",
"visitor",
"that",
"visit",
"all",
"descendants",
"of",
"the",
"class",
"represetned",
"by",
"this",
"ClassNode",
"including",
"this",
"ClassNode",
"itself",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/util/ClassNode.java#L218-L220 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsInner.java | ApplicationsInner.beginCreate | public ApplicationInner beginCreate(String resourceGroupName, String clusterName, String applicationName, ApplicationInner parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, applicationName, parameters).toBlocking().single().body();
} | java | public ApplicationInner beginCreate(String resourceGroupName, String clusterName, String applicationName, ApplicationInner parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, applicationName, parameters).toBlocking().single().body();
} | [
"public",
"ApplicationInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"applicationName",
",",
"ApplicationInner",
"parameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Creates applications for the HDInsight cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param applicationName The constant value for the application name.
@param parameters The application create request.
@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 ApplicationInner object if successful. | [
"Creates",
"applications",
"for",
"the",
"HDInsight",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsInner.java#L406-L408 |
kubernetes-client/java | kubernetes/src/main/java/io/kubernetes/client/ApiClient.java | ApiClient.executeAsync | public <T> void executeAsync(Call call, ApiCallback<T> callback) {
executeAsync(call, null, callback);
} | java | public <T> void executeAsync(Call call, ApiCallback<T> callback) {
executeAsync(call, null, callback);
} | [
"public",
"<",
"T",
">",
"void",
"executeAsync",
"(",
"Call",
"call",
",",
"ApiCallback",
"<",
"T",
">",
"callback",
")",
"{",
"executeAsync",
"(",
"call",
",",
"null",
",",
"callback",
")",
";",
"}"
] | {@link #executeAsync(Call, Type, ApiCallback)}
@param <T> Type
@param call An instance of the Call object
@param callback ApiCallback<T> | [
"{",
"@link",
"#executeAsync",
"(",
"Call",
"Type",
"ApiCallback",
")",
"}"
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/ApiClient.java#L816-L818 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java | FirewallRulesInner.listByAccountAsync | public Observable<Page<FirewallRuleInner>> listByAccountAsync(final String resourceGroupName, final String accountName) {
return listByAccountWithServiceResponseAsync(resourceGroupName, accountName)
.map(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Page<FirewallRuleInner>>() {
@Override
public Page<FirewallRuleInner> call(ServiceResponse<Page<FirewallRuleInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<FirewallRuleInner>> listByAccountAsync(final String resourceGroupName, final String accountName) {
return listByAccountWithServiceResponseAsync(resourceGroupName, accountName)
.map(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Page<FirewallRuleInner>>() {
@Override
public Page<FirewallRuleInner> call(ServiceResponse<Page<FirewallRuleInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"FirewallRuleInner",
">",
">",
"listByAccountAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
")",
"{",
"return",
"listByAccountWithServiceResponseAsync",
"(",
"resourceGroupName",
",",... | Lists the Data Lake Store firewall rules within the specified Data Lake Store account.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<FirewallRuleInner> object | [
"Lists",
"the",
"Data",
"Lake",
"Store",
"firewall",
"rules",
"within",
"the",
"specified",
"Data",
"Lake",
"Store",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java#L142-L150 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/Context.java | Context.isTMActive | public static boolean isTMActive()
throws EFapsException
{
try {
return Context.TRANSMANAG.getStatus() == Status.STATUS_ACTIVE;
} catch (final SystemException e) {
throw new EFapsException(Context.class, "isTMActive.SystemException", e);
}
} | java | public static boolean isTMActive()
throws EFapsException
{
try {
return Context.TRANSMANAG.getStatus() == Status.STATUS_ACTIVE;
} catch (final SystemException e) {
throw new EFapsException(Context.class, "isTMActive.SystemException", e);
}
} | [
"public",
"static",
"boolean",
"isTMActive",
"(",
")",
"throws",
"EFapsException",
"{",
"try",
"{",
"return",
"Context",
".",
"TRANSMANAG",
".",
"getStatus",
"(",
")",
"==",
"Status",
".",
"STATUS_ACTIVE",
";",
"}",
"catch",
"(",
"final",
"SystemException",
... | Is the status of transaction manager active?
@return <i>true</i> if transaction manager is active, otherwise
<i>false</i>
@throws EFapsException if the status of the transaction manager could not
be evaluated
@see #TRANSMANAG | [
"Is",
"the",
"status",
"of",
"transaction",
"manager",
"active?"
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/Context.java#L1129-L1137 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java | ClassFileVersion.of | public static ClassFileVersion of(Class<?> type, ClassFileLocator classFileLocator) throws IOException {
return of(TypeDescription.ForLoadedType.of(type), classFileLocator);
} | java | public static ClassFileVersion of(Class<?> type, ClassFileLocator classFileLocator) throws IOException {
return of(TypeDescription.ForLoadedType.of(type), classFileLocator);
} | [
"public",
"static",
"ClassFileVersion",
"of",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"ClassFileLocator",
"classFileLocator",
")",
"throws",
"IOException",
"{",
"return",
"of",
"(",
"TypeDescription",
".",
"ForLoadedType",
".",
"of",
"(",
"type",
")",
",",
... | Extracts a class' class version.
@param type The type for which to locate a class file version.
@param classFileLocator The class file locator to query for a class file.
@return The type's class file version.
@throws IOException If an error occurs while reading the class file. | [
"Extracts",
"a",
"class",
"class",
"version",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/ClassFileVersion.java#L285-L287 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGraphNodeFindInClone | public static int cuGraphNodeFindInClone(CUgraphNode phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph)
{
return checkResult(cuGraphNodeFindInCloneNative(phNode, hOriginalNode, hClonedGraph));
} | java | public static int cuGraphNodeFindInClone(CUgraphNode phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph)
{
return checkResult(cuGraphNodeFindInCloneNative(phNode, hOriginalNode, hClonedGraph));
} | [
"public",
"static",
"int",
"cuGraphNodeFindInClone",
"(",
"CUgraphNode",
"phNode",
",",
"CUgraphNode",
"hOriginalNode",
",",
"CUgraph",
"hClonedGraph",
")",
"{",
"return",
"checkResult",
"(",
"cuGraphNodeFindInCloneNative",
"(",
"phNode",
",",
"hOriginalNode",
",",
"h... | Finds a cloned version of a node.<br>
<br>
This function returns the node in \p hClonedGraph corresponding to \p hOriginalNode
in the original graph.<br>
<br>
\p hClonedGraph must have been cloned from \p hOriginalGraph via ::cuGraphClone.
\p hOriginalNode must have been in \p hOriginalGraph at the time of the call to
::cuGraphClone, and the corresponding cloned node in \p hClonedGraph must not have
been removed. The cloned node is then returned via \p phClonedNode.
@param phNode - Returns handle to the cloned node
@param hOriginalNode - Handle to the original node
@param hClonedGraph - Cloned graph to query
@return
CUDA_SUCCESS,
CUDA_ERROR_INVALID_VALUE,
@see
JCudaDriver#cuGraphClone | [
"Finds",
"a",
"cloned",
"version",
"of",
"a",
"node",
".",
"<br",
">",
"<br",
">",
"This",
"function",
"returns",
"the",
"node",
"in",
"\\",
"p",
"hClonedGraph",
"corresponding",
"to",
"\\",
"p",
"hOriginalNode",
"in",
"the",
"original",
"graph",
".",
"<... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12608-L12611 |
wcm-io/wcm-io-handler | richtext/src/main/java/io/wcm/handler/richtext/util/RichTextUtil.java | RichTextUtil.addParsedText | public static void addParsedText(@NotNull Element parent, @NotNull String text, boolean xhtmlEntities) throws JDOMException {
Element root = parseText(text, xhtmlEntities);
parent.addContent(root.cloneContent());
} | java | public static void addParsedText(@NotNull Element parent, @NotNull String text, boolean xhtmlEntities) throws JDOMException {
Element root = parseText(text, xhtmlEntities);
parent.addContent(root.cloneContent());
} | [
"public",
"static",
"void",
"addParsedText",
"(",
"@",
"NotNull",
"Element",
"parent",
",",
"@",
"NotNull",
"String",
"text",
",",
"boolean",
"xhtmlEntities",
")",
"throws",
"JDOMException",
"{",
"Element",
"root",
"=",
"parseText",
"(",
"text",
",",
"xhtmlEnt... | Parses XHTML text string, and adds to parsed content to the given parent element.
@param parent Parent element to add parsed content to
@param text XHTML text string (root element not needed)
@param xhtmlEntities If set to true, Resolving of XHtml entities in XHtml fragment is supported.
@throws JDOMException Is thrown if the text could not be parsed as XHTML | [
"Parses",
"XHTML",
"text",
"string",
"and",
"adds",
"to",
"parsed",
"content",
"to",
"the",
"given",
"parent",
"element",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/util/RichTextUtil.java#L119-L122 |
dmak/jaxb-xew-plugin | src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java | XmlElementWrapperPlugin.checkAnnotationReference | private void checkAnnotationReference(Map<String, Candidate> candidatesMap, JAnnotatable annotatable) {
for (JAnnotationUse annotation : annotatable.annotations()) {
JAnnotationValue annotationMember = getAnnotationMember(annotation, "value");
if (annotationMember instanceof JAnnotationArrayMember) {
checkAnnotationReference(candidatesMap, (JAnnotationArrayMember) annotationMember);
continue;
}
JExpression type = getAnnotationMemberExpression(annotation, "type");
if (type == null) {
// Can be the case for @XmlElement(name = "publication-reference", namespace = "http://mycompany.org/exchange")
// or any other annotation without "type"
continue;
}
Candidate candidate = candidatesMap.get(generableToString(type).replace(".class", ""));
if (candidate != null) {
logger.debug("Candidate " + candidate.getClassName()
+ " is used in XmlElements/XmlElementRef and hence won't be removed.");
candidate.unmarkForRemoval();
}
}
} | java | private void checkAnnotationReference(Map<String, Candidate> candidatesMap, JAnnotatable annotatable) {
for (JAnnotationUse annotation : annotatable.annotations()) {
JAnnotationValue annotationMember = getAnnotationMember(annotation, "value");
if (annotationMember instanceof JAnnotationArrayMember) {
checkAnnotationReference(candidatesMap, (JAnnotationArrayMember) annotationMember);
continue;
}
JExpression type = getAnnotationMemberExpression(annotation, "type");
if (type == null) {
// Can be the case for @XmlElement(name = "publication-reference", namespace = "http://mycompany.org/exchange")
// or any other annotation without "type"
continue;
}
Candidate candidate = candidatesMap.get(generableToString(type).replace(".class", ""));
if (candidate != null) {
logger.debug("Candidate " + candidate.getClassName()
+ " is used in XmlElements/XmlElementRef and hence won't be removed.");
candidate.unmarkForRemoval();
}
}
} | [
"private",
"void",
"checkAnnotationReference",
"(",
"Map",
"<",
"String",
",",
"Candidate",
">",
"candidatesMap",
",",
"JAnnotatable",
"annotatable",
")",
"{",
"for",
"(",
"JAnnotationUse",
"annotation",
":",
"annotatable",
".",
"annotations",
"(",
")",
")",
"{"... | For the given annotatable check that all annotations (and all annotations within annotations recursively) do not
refer any candidate for removal. | [
"For",
"the",
"given",
"annotatable",
"check",
"that",
"all",
"annotations",
"(",
"and",
"all",
"annotations",
"within",
"annotations",
"recursively",
")",
"do",
"not",
"refer",
"any",
"candidate",
"for",
"removal",
"."
] | train | https://github.com/dmak/jaxb-xew-plugin/blob/d564d6bf8e50c46b056cdb4b46d1d4bee4adfbe3/src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java#L968-L994 |
google/closure-compiler | src/com/google/javascript/jscomp/AstFactory.java | AstFactory.createConstructorCall | Node createConstructorCall(@Nullable JSType classType, Node callee, Node... args) {
Node result = NodeUtil.newCallNode(callee, args);
if (isAddingTypes()) {
checkNotNull(classType);
FunctionType constructorType = checkNotNull(classType.toMaybeFunctionType());
ObjectType instanceType = checkNotNull(constructorType.getInstanceType());
result.setJSType(instanceType);
}
return result;
} | java | Node createConstructorCall(@Nullable JSType classType, Node callee, Node... args) {
Node result = NodeUtil.newCallNode(callee, args);
if (isAddingTypes()) {
checkNotNull(classType);
FunctionType constructorType = checkNotNull(classType.toMaybeFunctionType());
ObjectType instanceType = checkNotNull(constructorType.getInstanceType());
result.setJSType(instanceType);
}
return result;
} | [
"Node",
"createConstructorCall",
"(",
"@",
"Nullable",
"JSType",
"classType",
",",
"Node",
"callee",
",",
"Node",
"...",
"args",
")",
"{",
"Node",
"result",
"=",
"NodeUtil",
".",
"newCallNode",
"(",
"callee",
",",
"args",
")",
";",
"if",
"(",
"isAddingType... | Create a call that returns an instance of the given class type.
<p>This method is intended for use in special cases, such as calling `super()` in a
constructor. | [
"Create",
"a",
"call",
"that",
"returns",
"an",
"instance",
"of",
"the",
"given",
"class",
"type",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L640-L649 |
janus-project/guava.janusproject.io | guava/src/com/google/common/io/CharStreams.java | CharStreams.copy | public static long copy(Readable from, Appendable to) throws IOException {
checkNotNull(from);
checkNotNull(to);
CharBuffer buf = CharBuffer.allocate(BUF_SIZE);
long total = 0;
while (from.read(buf) != -1) {
buf.flip();
to.append(buf);
total += buf.remaining();
buf.clear();
}
return total;
} | java | public static long copy(Readable from, Appendable to) throws IOException {
checkNotNull(from);
checkNotNull(to);
CharBuffer buf = CharBuffer.allocate(BUF_SIZE);
long total = 0;
while (from.read(buf) != -1) {
buf.flip();
to.append(buf);
total += buf.remaining();
buf.clear();
}
return total;
} | [
"public",
"static",
"long",
"copy",
"(",
"Readable",
"from",
",",
"Appendable",
"to",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"from",
")",
";",
"checkNotNull",
"(",
"to",
")",
";",
"CharBuffer",
"buf",
"=",
"CharBuffer",
".",
"allocate",
"(... | Copies all characters between the {@link Readable} and {@link Appendable}
objects. Does not close or flush either object.
@param from the object to read from
@param to the object to write to
@return the number of characters copied
@throws IOException if an I/O error occurs | [
"Copies",
"all",
"characters",
"between",
"the",
"{",
"@link",
"Readable",
"}",
"and",
"{",
"@link",
"Appendable",
"}",
"objects",
".",
"Does",
"not",
"close",
"or",
"flush",
"either",
"object",
"."
] | train | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/io/CharStreams.java#L63-L75 |
amzn/ion-java | src/com/amazon/ion/impl/IonReaderBinaryRawX.java | IonReaderBinaryRawX.readAll | public void readAll(byte[] buf, int offset, int len) throws IOException
{
int rem = len;
while (rem > 0)
{
int amount = read(buf, offset, rem);
if (amount <= 0)
{
throwUnexpectedEOFException();
}
rem -= amount;
offset += amount;
}
} | java | public void readAll(byte[] buf, int offset, int len) throws IOException
{
int rem = len;
while (rem > 0)
{
int amount = read(buf, offset, rem);
if (amount <= 0)
{
throwUnexpectedEOFException();
}
rem -= amount;
offset += amount;
}
} | [
"public",
"void",
"readAll",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"int",
"rem",
"=",
"len",
";",
"while",
"(",
"rem",
">",
"0",
")",
"{",
"int",
"amount",
"=",
"read",
"(",
"buf... | Uses {@link #read(byte[], int, int)} until the entire length is read.
This method will block until the request is satisfied.
@param buf The buffer to read to.
@param offset The offset of the buffer to read from.
@param len The length of the data to read. | [
"Uses",
"{",
"@link",
"#read",
"(",
"byte",
"[]",
"int",
"int",
")",
"}",
"until",
"the",
"entire",
"length",
"is",
"read",
".",
"This",
"method",
"will",
"block",
"until",
"the",
"request",
"is",
"satisfied",
"."
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderBinaryRawX.java#L807-L820 |
dropwizard/metrics | metrics-healthchecks/src/main/java/com/codahale/metrics/health/SharedHealthCheckRegistries.java | SharedHealthCheckRegistries.setDefault | public static HealthCheckRegistry setDefault(String name, HealthCheckRegistry healthCheckRegistry) {
if (defaultRegistryName.compareAndSet(null, name)) {
add(name, healthCheckRegistry);
return healthCheckRegistry;
}
throw new IllegalStateException("Default health check registry is already set.");
} | java | public static HealthCheckRegistry setDefault(String name, HealthCheckRegistry healthCheckRegistry) {
if (defaultRegistryName.compareAndSet(null, name)) {
add(name, healthCheckRegistry);
return healthCheckRegistry;
}
throw new IllegalStateException("Default health check registry is already set.");
} | [
"public",
"static",
"HealthCheckRegistry",
"setDefault",
"(",
"String",
"name",
",",
"HealthCheckRegistry",
"healthCheckRegistry",
")",
"{",
"if",
"(",
"defaultRegistryName",
".",
"compareAndSet",
"(",
"null",
",",
"name",
")",
")",
"{",
"add",
"(",
"name",
",",... | Sets the provided registry as the default one under the provided name
@param name the default registry name
@param healthCheckRegistry the default registry
@throws IllegalStateException if the default registry has already been set | [
"Sets",
"the",
"provided",
"registry",
"as",
"the",
"default",
"one",
"under",
"the",
"provided",
"name"
] | train | https://github.com/dropwizard/metrics/blob/3c6105a0b9b4416c59e16b6b841b123052d6f57d/metrics-healthchecks/src/main/java/com/codahale/metrics/health/SharedHealthCheckRegistries.java#L72-L78 |
ironjacamar/ironjacamar | common/src/main/java/org/ironjacamar/common/metadata/common/CommonIronJacamarParser.java | CommonIronJacamarParser.storeTimeout | protected void storeTimeout(Timeout t, XMLStreamWriter writer) throws Exception
{
writer.writeStartElement(CommonXML.ELEMENT_TIMEOUT);
if (t.getBlockingTimeoutMillis() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_BLOCKING_TIMEOUT_MILLIS);
writer.writeCharacters(t.getValue(CommonXML.ELEMENT_BLOCKING_TIMEOUT_MILLIS,
t.getBlockingTimeoutMillis().toString()));
writer.writeEndElement();
}
if (t.getIdleTimeoutMinutes() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_IDLE_TIMEOUT_MINUTES);
writer.writeCharacters(t.getValue(CommonXML.ELEMENT_IDLE_TIMEOUT_MINUTES,
t.getIdleTimeoutMinutes().toString()));
writer.writeEndElement();
}
if (t.getAllocationRetry() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_ALLOCATION_RETRY);
writer.writeCharacters(t.getValue(CommonXML.ELEMENT_ALLOCATION_RETRY,
t.getAllocationRetry().toString()));
writer.writeEndElement();
}
if (t.getAllocationRetryWaitMillis() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS);
writer.writeCharacters(t.getValue(CommonXML.ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS,
t.getAllocationRetryWaitMillis().toString()));
writer.writeEndElement();
}
if (t.getXaResourceTimeout() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_XA_RESOURCE_TIMEOUT);
writer.writeCharacters(t.getValue(CommonXML.ELEMENT_XA_RESOURCE_TIMEOUT,
t.getXaResourceTimeout().toString()));
writer.writeEndElement();
}
writer.writeEndElement();
} | java | protected void storeTimeout(Timeout t, XMLStreamWriter writer) throws Exception
{
writer.writeStartElement(CommonXML.ELEMENT_TIMEOUT);
if (t.getBlockingTimeoutMillis() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_BLOCKING_TIMEOUT_MILLIS);
writer.writeCharacters(t.getValue(CommonXML.ELEMENT_BLOCKING_TIMEOUT_MILLIS,
t.getBlockingTimeoutMillis().toString()));
writer.writeEndElement();
}
if (t.getIdleTimeoutMinutes() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_IDLE_TIMEOUT_MINUTES);
writer.writeCharacters(t.getValue(CommonXML.ELEMENT_IDLE_TIMEOUT_MINUTES,
t.getIdleTimeoutMinutes().toString()));
writer.writeEndElement();
}
if (t.getAllocationRetry() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_ALLOCATION_RETRY);
writer.writeCharacters(t.getValue(CommonXML.ELEMENT_ALLOCATION_RETRY,
t.getAllocationRetry().toString()));
writer.writeEndElement();
}
if (t.getAllocationRetryWaitMillis() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS);
writer.writeCharacters(t.getValue(CommonXML.ELEMENT_ALLOCATION_RETRY_WAIT_MILLIS,
t.getAllocationRetryWaitMillis().toString()));
writer.writeEndElement();
}
if (t.getXaResourceTimeout() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_XA_RESOURCE_TIMEOUT);
writer.writeCharacters(t.getValue(CommonXML.ELEMENT_XA_RESOURCE_TIMEOUT,
t.getXaResourceTimeout().toString()));
writer.writeEndElement();
}
writer.writeEndElement();
} | [
"protected",
"void",
"storeTimeout",
"(",
"Timeout",
"t",
",",
"XMLStreamWriter",
"writer",
")",
"throws",
"Exception",
"{",
"writer",
".",
"writeStartElement",
"(",
"CommonXML",
".",
"ELEMENT_TIMEOUT",
")",
";",
"if",
"(",
"t",
".",
"getBlockingTimeoutMillis",
... | Store timeout
@param t The timeout
@param writer The writer
@exception Exception Thrown if an error occurs | [
"Store",
"timeout"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/CommonIronJacamarParser.java#L1045-L1090 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java | FaceListsImpl.addFaceFromStreamWithServiceResponseAsync | public Observable<ServiceResponse<PersistedFace>> addFaceFromStreamWithServiceResponseAsync(String faceListId, byte[] image, AddFaceFromStreamOptionalParameter addFaceFromStreamOptionalParameter) {
if (this.client.azureRegion() == null) {
throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null.");
}
if (faceListId == null) {
throw new IllegalArgumentException("Parameter faceListId is required and cannot be null.");
}
if (image == null) {
throw new IllegalArgumentException("Parameter image is required and cannot be null.");
}
final String userData = addFaceFromStreamOptionalParameter != null ? addFaceFromStreamOptionalParameter.userData() : null;
final List<Integer> targetFace = addFaceFromStreamOptionalParameter != null ? addFaceFromStreamOptionalParameter.targetFace() : null;
return addFaceFromStreamWithServiceResponseAsync(faceListId, image, userData, targetFace);
} | java | public Observable<ServiceResponse<PersistedFace>> addFaceFromStreamWithServiceResponseAsync(String faceListId, byte[] image, AddFaceFromStreamOptionalParameter addFaceFromStreamOptionalParameter) {
if (this.client.azureRegion() == null) {
throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null.");
}
if (faceListId == null) {
throw new IllegalArgumentException("Parameter faceListId is required and cannot be null.");
}
if (image == null) {
throw new IllegalArgumentException("Parameter image is required and cannot be null.");
}
final String userData = addFaceFromStreamOptionalParameter != null ? addFaceFromStreamOptionalParameter.userData() : null;
final List<Integer> targetFace = addFaceFromStreamOptionalParameter != null ? addFaceFromStreamOptionalParameter.targetFace() : null;
return addFaceFromStreamWithServiceResponseAsync(faceListId, image, userData, targetFace);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"PersistedFace",
">",
">",
"addFaceFromStreamWithServiceResponseAsync",
"(",
"String",
"faceListId",
",",
"byte",
"[",
"]",
"image",
",",
"AddFaceFromStreamOptionalParameter",
"addFaceFromStreamOptionalParameter",
")",
"{... | Add a face to a face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire.
@param faceListId Id referencing a particular face list.
@param image An image stream.
@param addFaceFromStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PersistedFace object | [
"Add",
"a",
"face",
"to",
"a",
"face",
"list",
".",
"The",
"input",
"face",
"is",
"specified",
"as",
"an",
"image",
"with",
"a",
"targetFace",
"rectangle",
".",
"It",
"returns",
"a",
"persistedFaceId",
"representing",
"the",
"added",
"face",
"and",
"persis... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java#L978-L992 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/fingerprint/IntArrayFingerprint.java | IntArrayFingerprint.set | @Override
public void set(int index, boolean value) {
int i = Arrays.binarySearch(trueBits, index);
// bit at index is set to true and shall be set to false
if (i >= 0 && !value) {
int[] tmp = new int[trueBits.length - 1];
System.arraycopy(trueBits, 0, tmp, 0, i);
System.arraycopy(trueBits, i + 1, tmp, i, trueBits.length - i - 1);
trueBits = tmp;
}
// bit at index is set to false and shall be set to true
else if (i < 0 && value) {
int[] tmp = new int[trueBits.length + 1];
System.arraycopy(trueBits, 0, tmp, 0, trueBits.length);
tmp[tmp.length - 1] = index;
trueBits = tmp;
Arrays.sort(trueBits);
}
} | java | @Override
public void set(int index, boolean value) {
int i = Arrays.binarySearch(trueBits, index);
// bit at index is set to true and shall be set to false
if (i >= 0 && !value) {
int[] tmp = new int[trueBits.length - 1];
System.arraycopy(trueBits, 0, tmp, 0, i);
System.arraycopy(trueBits, i + 1, tmp, i, trueBits.length - i - 1);
trueBits = tmp;
}
// bit at index is set to false and shall be set to true
else if (i < 0 && value) {
int[] tmp = new int[trueBits.length + 1];
System.arraycopy(trueBits, 0, tmp, 0, trueBits.length);
tmp[tmp.length - 1] = index;
trueBits = tmp;
Arrays.sort(trueBits);
}
} | [
"@",
"Override",
"public",
"void",
"set",
"(",
"int",
"index",
",",
"boolean",
"value",
")",
"{",
"int",
"i",
"=",
"Arrays",
".",
"binarySearch",
"(",
"trueBits",
",",
"index",
")",
";",
"// bit at index is set to true and shall be set to false",
"if",
"(",
"i... | /*
This method is VERY INNEFICIENT when called multiple times. It is the
cost of keeping down the memory footprint. Avoid using it for building up
IntArrayFingerprints -- instead use the constructor taking a so called
raw fingerprint. | [
"/",
"*",
"This",
"method",
"is",
"VERY",
"INNEFICIENT",
"when",
"called",
"multiple",
"times",
".",
"It",
"is",
"the",
"cost",
"of",
"keeping",
"down",
"the",
"memory",
"footprint",
".",
"Avoid",
"using",
"it",
"for",
"building",
"up",
"IntArrayFingerprints... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/fingerprint/IntArrayFingerprint.java#L164-L182 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java | BNFHeadersImpl.setSpecialHeader | protected void setSpecialHeader(HeaderKeys key, byte[] value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setSpecialHeader(h,b[]): " + key.getName());
}
removeHdrInstances(findHeader(key), FILTER_NO);
HeaderElement elem = getElement(key);
elem.setByteArrayValue(value);
addHeader(elem, FILTER_NO);
} | java | protected void setSpecialHeader(HeaderKeys key, byte[] value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setSpecialHeader(h,b[]): " + key.getName());
}
removeHdrInstances(findHeader(key), FILTER_NO);
HeaderElement elem = getElement(key);
elem.setByteArrayValue(value);
addHeader(elem, FILTER_NO);
} | [
"protected",
"void",
"setSpecialHeader",
"(",
"HeaderKeys",
"key",
",",
"byte",
"[",
"]",
"value",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"("... | Set one of the special headers that does not require the headerkey
filterX methods to be called.
@param key
@param value | [
"Set",
"one",
"of",
"the",
"special",
"headers",
"that",
"does",
"not",
"require",
"the",
"headerkey",
"filterX",
"methods",
"to",
"be",
"called",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L2312-L2320 |
susom/database | src/main/java/com/github/susom/database/DatabaseProviderVertx.java | DatabaseProviderVertx.pooledBuilder | @CheckReturnValue
public static Builder pooledBuilder(Vertx vertx, Config config) {
return fromPool(vertx, DatabaseProvider.createPool(config));
} | java | @CheckReturnValue
public static Builder pooledBuilder(Vertx vertx, Config config) {
return fromPool(vertx, DatabaseProvider.createPool(config));
} | [
"@",
"CheckReturnValue",
"public",
"static",
"Builder",
"pooledBuilder",
"(",
"Vertx",
"vertx",
",",
"Config",
"config",
")",
"{",
"return",
"fromPool",
"(",
"vertx",
",",
"DatabaseProvider",
".",
"createPool",
"(",
"config",
")",
")",
";",
"}"
] | Configure the database from the following properties read from the provided configuration:
<br/>
<pre>
database.url=... Database connect string (required)
database.user=... Authenticate as this user (optional if provided in url)
database.password=... User password (optional if user and password provided in
url; prompted on standard input if user is provided and
password is not)
database.pool.size=... How many connections in the connection pool (default 10).
database.driver.class The driver to initialize with Class.forName(). This will
be guessed from the database.url if not provided.
database.flavor One of the enumerated values in {@link Flavor}. If this
is not provided the flavor will be guessed based on the
value for database.url, if possible.
</pre>
<p>The database flavor will be guessed based on the URL.</p>
<p>A database pool will be created using HikariCP.</p>
<p>Be sure to retain a copy of the builder so you can call close() later to
destroy the pool. You will most likely want to register a JVM shutdown hook
to make sure this happens. See VertxServer.java in the demo directory for
an example of how to do this.</p> | [
"Configure",
"the",
"database",
"from",
"the",
"following",
"properties",
"read",
"from",
"the",
"provided",
"configuration",
":",
"<br",
"/",
">",
"<pre",
">",
"database",
".",
"url",
"=",
"...",
"Database",
"connect",
"string",
"(",
"required",
")",
"datab... | train | https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/DatabaseProviderVertx.java#L101-L104 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamReader.java | XMLStreamReader.start | public static AsyncWork<XMLStreamReader, Exception> start(IO.Readable.Buffered io, int charactersBufferSize, int maxBuffers) {
AsyncWork<XMLStreamReader, Exception> result = new AsyncWork<>();
new Task.Cpu.FromRunnable("Start reading XML " + io.getSourceDescription(), io.getPriority(), () -> {
XMLStreamReader reader = new XMLStreamReader(io, charactersBufferSize, maxBuffers);
try {
Starter start = new Starter(io, reader.defaultEncoding, reader.charactersBuffersSize, reader.maxBuffers);
reader.stream = start.start();
reader.stream.canStartReading().listenAsync(
new Task.Cpu.FromRunnable("Start reading XML " + io.getSourceDescription(), io.getPriority(), () -> {
try {
reader.next();
result.unblockSuccess(reader);
} catch (Exception e) {
result.unblockError(e);
}
}), true);
} catch (Exception e) {
result.unblockError(e);
}
}).startOn(io.canStartReading(), true);
return result;
} | java | public static AsyncWork<XMLStreamReader, Exception> start(IO.Readable.Buffered io, int charactersBufferSize, int maxBuffers) {
AsyncWork<XMLStreamReader, Exception> result = new AsyncWork<>();
new Task.Cpu.FromRunnable("Start reading XML " + io.getSourceDescription(), io.getPriority(), () -> {
XMLStreamReader reader = new XMLStreamReader(io, charactersBufferSize, maxBuffers);
try {
Starter start = new Starter(io, reader.defaultEncoding, reader.charactersBuffersSize, reader.maxBuffers);
reader.stream = start.start();
reader.stream.canStartReading().listenAsync(
new Task.Cpu.FromRunnable("Start reading XML " + io.getSourceDescription(), io.getPriority(), () -> {
try {
reader.next();
result.unblockSuccess(reader);
} catch (Exception e) {
result.unblockError(e);
}
}), true);
} catch (Exception e) {
result.unblockError(e);
}
}).startOn(io.canStartReading(), true);
return result;
} | [
"public",
"static",
"AsyncWork",
"<",
"XMLStreamReader",
",",
"Exception",
">",
"start",
"(",
"IO",
".",
"Readable",
".",
"Buffered",
"io",
",",
"int",
"charactersBufferSize",
",",
"int",
"maxBuffers",
")",
"{",
"AsyncWork",
"<",
"XMLStreamReader",
",",
"Excep... | Utility method that initialize a XMLStreamReader, initialize it, and
return an AsyncWork which is unblocked when characters are available to be read. | [
"Utility",
"method",
"that",
"initialize",
"a",
"XMLStreamReader",
"initialize",
"it",
"and",
"return",
"an",
"AsyncWork",
"which",
"is",
"unblocked",
"when",
"characters",
"are",
"available",
"to",
"be",
"read",
"."
] | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamReader.java#L61-L82 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ApplicationSecurityGroupsInner.java | ApplicationSecurityGroupsInner.createOrUpdateAsync | public Observable<ApplicationSecurityGroupInner> createOrUpdateAsync(String resourceGroupName, String applicationSecurityGroupName, ApplicationSecurityGroupInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, applicationSecurityGroupName, parameters).map(new Func1<ServiceResponse<ApplicationSecurityGroupInner>, ApplicationSecurityGroupInner>() {
@Override
public ApplicationSecurityGroupInner call(ServiceResponse<ApplicationSecurityGroupInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationSecurityGroupInner> createOrUpdateAsync(String resourceGroupName, String applicationSecurityGroupName, ApplicationSecurityGroupInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, applicationSecurityGroupName, parameters).map(new Func1<ServiceResponse<ApplicationSecurityGroupInner>, ApplicationSecurityGroupInner>() {
@Override
public ApplicationSecurityGroupInner call(ServiceResponse<ApplicationSecurityGroupInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationSecurityGroupInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"applicationSecurityGroupName",
",",
"ApplicationSecurityGroupInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseA... | Creates or updates an application security group.
@param resourceGroupName The name of the resource group.
@param applicationSecurityGroupName The name of the application security group.
@param parameters Parameters supplied to the create or update ApplicationSecurityGroup operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"an",
"application",
"security",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ApplicationSecurityGroupsInner.java#L378-L385 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/webhook/WebhookBuilder.java | WebhookBuilder.setAvatar | public WebhookBuilder setAvatar(InputStream avatar, String fileType) {
delegate.setAvatar(avatar, fileType);
return this;
} | java | public WebhookBuilder setAvatar(InputStream avatar, String fileType) {
delegate.setAvatar(avatar, fileType);
return this;
} | [
"public",
"WebhookBuilder",
"setAvatar",
"(",
"InputStream",
"avatar",
",",
"String",
"fileType",
")",
"{",
"delegate",
".",
"setAvatar",
"(",
"avatar",
",",
"fileType",
")",
";",
"return",
"this",
";",
"}"
] | Sets the avatar.
@param avatar The avatar to set.
@param fileType The type of the avatar, e.g. "png" or "jpg".
@return The current instance in order to chain call methods. | [
"Sets",
"the",
"avatar",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/webhook/WebhookBuilder.java#L155-L158 |
aws/aws-sdk-java | aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/SearchProductsAsAdminRequest.java | SearchProductsAsAdminRequest.withFilters | public SearchProductsAsAdminRequest withFilters(java.util.Map<String, java.util.List<String>> filters) {
setFilters(filters);
return this;
} | java | public SearchProductsAsAdminRequest withFilters(java.util.Map<String, java.util.List<String>> filters) {
setFilters(filters);
return this;
} | [
"public",
"SearchProductsAsAdminRequest",
"withFilters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"filters",
")",
"{",
"setFilters",
"(",
"filters",
")",
";",
"return",
"this",
"... | <p>
The search filters. If no search filters are specified, the output includes all products to which the
administrator has access.
</p>
@param filters
The search filters. If no search filters are specified, the output includes all products to which the
administrator has access.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"search",
"filters",
".",
"If",
"no",
"search",
"filters",
"are",
"specified",
"the",
"output",
"includes",
"all",
"products",
"to",
"which",
"the",
"administrator",
"has",
"access",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/SearchProductsAsAdminRequest.java#L315-L318 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/MeterRegistry.java | MeterRegistry.gaugeCollectionSize | @Nullable
public <T extends Collection<?>> T gaugeCollectionSize(String name, Iterable<Tag> tags, T collection) {
return gauge(name, tags, collection, Collection::size);
} | java | @Nullable
public <T extends Collection<?>> T gaugeCollectionSize(String name, Iterable<Tag> tags, T collection) {
return gauge(name, tags, collection, Collection::size);
} | [
"@",
"Nullable",
"public",
"<",
"T",
"extends",
"Collection",
"<",
"?",
">",
">",
"T",
"gaugeCollectionSize",
"(",
"String",
"name",
",",
"Iterable",
"<",
"Tag",
">",
"tags",
",",
"T",
"collection",
")",
"{",
"return",
"gauge",
"(",
"name",
",",
"tags"... | Register a gauge that reports the size of the {@link Collection}. The registration
will keep a weak reference to the collection so it will not prevent garbage collection.
The collection implementation used should be thread safe. Note that calling
{@link Collection#size()} can be expensive for some collection implementations
and should be considered before registering.
@param name Name of the gauge being registered.
@param tags Sequence of dimensions for breaking down the name.
@param collection Thread-safe implementation of {@link Collection} used to access the value.
@param <T> The type of the state object from which the gauge value is extracted.
@return The number that was passed in so the registration can be done as part of an assignment
statement. | [
"Register",
"a",
"gauge",
"that",
"reports",
"the",
"size",
"of",
"the",
"{",
"@link",
"Collection",
"}",
".",
"The",
"registration",
"will",
"keep",
"a",
"weak",
"reference",
"to",
"the",
"collection",
"so",
"it",
"will",
"not",
"prevent",
"garbage",
"col... | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/MeterRegistry.java#L496-L499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.