repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Counters.java | Counters.addInPlace | public static <E> void addInPlace(Counter<E> target, Counter<E> arg) {
"""
Sets each value of target to be target[k]+arg[k] for all keys k in arg.
"""
for (Map.Entry<E, Double> entry : arg.entrySet()) {
double count = entry.getValue();
if (count != 0) {
target.incrementCount(entry.getKey(), count);
}
}
} | java | public static <E> void addInPlace(Counter<E> target, Counter<E> arg) {
for (Map.Entry<E, Double> entry : arg.entrySet()) {
double count = entry.getValue();
if (count != 0) {
target.incrementCount(entry.getKey(), count);
}
}
} | [
"public",
"static",
"<",
"E",
">",
"void",
"addInPlace",
"(",
"Counter",
"<",
"E",
">",
"target",
",",
"Counter",
"<",
"E",
">",
"arg",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"E",
",",
"Double",
">",
"entry",
":",
"arg",
".",
"entrySet",
"(",
")",
")",
"{",
"double",
"count",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"count",
"!=",
"0",
")",
"{",
"target",
".",
"incrementCount",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"count",
")",
";",
"}",
"}",
"}"
] | Sets each value of target to be target[k]+arg[k] for all keys k in arg. | [
"Sets",
"each",
"value",
"of",
"target",
"to",
"be",
"target",
"[",
"k",
"]",
"+",
"arg",
"[",
"k",
"]",
"for",
"all",
"keys",
"k",
"in",
"arg",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L321-L328 |
ArcBees/gwtquery | gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java | Ajax.loadLink | public static Promise loadLink(final String rel, final String url) {
"""
Load an external resource using the link tag element.
It is appended to the head of the document.
@param rel Specifies the relationship between the current document and the linked document.
@param url Specifies the location of the linked document
@return a Promise which will be resolved when the external resource has been loaded.
"""
GQuery link = $("link[rel='" + rel + "'][href^='" + url + "']");
if (link.isEmpty()) {
return new PromiseFunction() {
public void f(final Deferred dfd) {
GQuery link = $("<link rel='" + rel + "' href='" + url + "'/>");
link.on("load", new Function() {
public void f() {
// load event is fired before the imported stuff has actually
// being ready, we delay it to be sure it is ready.
new Timer() {
public void run() {
dfd.resolve();
}
}.schedule(100);
}
});
$(document.getHead()).append(link);
}
};
} else {
return Deferred().resolve().promise();
}
} | java | public static Promise loadLink(final String rel, final String url) {
GQuery link = $("link[rel='" + rel + "'][href^='" + url + "']");
if (link.isEmpty()) {
return new PromiseFunction() {
public void f(final Deferred dfd) {
GQuery link = $("<link rel='" + rel + "' href='" + url + "'/>");
link.on("load", new Function() {
public void f() {
// load event is fired before the imported stuff has actually
// being ready, we delay it to be sure it is ready.
new Timer() {
public void run() {
dfd.resolve();
}
}.schedule(100);
}
});
$(document.getHead()).append(link);
}
};
} else {
return Deferred().resolve().promise();
}
} | [
"public",
"static",
"Promise",
"loadLink",
"(",
"final",
"String",
"rel",
",",
"final",
"String",
"url",
")",
"{",
"GQuery",
"link",
"=",
"$",
"(",
"\"link[rel='\"",
"+",
"rel",
"+",
"\"'][href^='\"",
"+",
"url",
"+",
"\"']\"",
")",
";",
"if",
"(",
"link",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"new",
"PromiseFunction",
"(",
")",
"{",
"public",
"void",
"f",
"(",
"final",
"Deferred",
"dfd",
")",
"{",
"GQuery",
"link",
"=",
"$",
"(",
"\"<link rel='\"",
"+",
"rel",
"+",
"\"' href='\"",
"+",
"url",
"+",
"\"'/>\"",
")",
";",
"link",
".",
"on",
"(",
"\"load\"",
",",
"new",
"Function",
"(",
")",
"{",
"public",
"void",
"f",
"(",
")",
"{",
"// load event is fired before the imported stuff has actually",
"// being ready, we delay it to be sure it is ready.",
"new",
"Timer",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"dfd",
".",
"resolve",
"(",
")",
";",
"}",
"}",
".",
"schedule",
"(",
"100",
")",
";",
"}",
"}",
")",
";",
"$",
"(",
"document",
".",
"getHead",
"(",
")",
")",
".",
"append",
"(",
"link",
")",
";",
"}",
"}",
";",
"}",
"else",
"{",
"return",
"Deferred",
"(",
")",
".",
"resolve",
"(",
")",
".",
"promise",
"(",
")",
";",
"}",
"}"
] | Load an external resource using the link tag element.
It is appended to the head of the document.
@param rel Specifies the relationship between the current document and the linked document.
@param url Specifies the location of the linked document
@return a Promise which will be resolved when the external resource has been loaded. | [
"Load",
"an",
"external",
"resource",
"using",
"the",
"link",
"tag",
"element",
".",
"It",
"is",
"appended",
"to",
"the",
"head",
"of",
"the",
"document",
"."
] | train | https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java#L473-L496 |
cojen/Cojen | src/main/java/org/cojen/classfile/MethodInfo.java | MethodInfo.addInnerClass | public ClassFile addInnerClass(String innerClassName, String superClassName) {
"""
Add an inner class to this method.
@param innerClassName Optional short inner class name.
@param superClassName Full super class name.
"""
ClassFile inner;
if (innerClassName == null) {
inner = mParent.addInnerClass(null, null, superClassName);
} else {
String fullInnerClassName = mParent.getClassName() + '$' +
(++mAnonymousInnerClassCount) + innerClassName;
inner = mParent.addInnerClass(fullInnerClassName, innerClassName, superClassName);
}
if (mParent.getMajorVersion() >= 49) {
inner.addAttribute(new EnclosingMethodAttr
(mCp, mCp.addConstantClass(mParent.getClassName()),
mCp.addConstantNameAndType(mNameConstant, mDescriptorConstant)));
}
return inner;
} | java | public ClassFile addInnerClass(String innerClassName, String superClassName) {
ClassFile inner;
if (innerClassName == null) {
inner = mParent.addInnerClass(null, null, superClassName);
} else {
String fullInnerClassName = mParent.getClassName() + '$' +
(++mAnonymousInnerClassCount) + innerClassName;
inner = mParent.addInnerClass(fullInnerClassName, innerClassName, superClassName);
}
if (mParent.getMajorVersion() >= 49) {
inner.addAttribute(new EnclosingMethodAttr
(mCp, mCp.addConstantClass(mParent.getClassName()),
mCp.addConstantNameAndType(mNameConstant, mDescriptorConstant)));
}
return inner;
} | [
"public",
"ClassFile",
"addInnerClass",
"(",
"String",
"innerClassName",
",",
"String",
"superClassName",
")",
"{",
"ClassFile",
"inner",
";",
"if",
"(",
"innerClassName",
"==",
"null",
")",
"{",
"inner",
"=",
"mParent",
".",
"addInnerClass",
"(",
"null",
",",
"null",
",",
"superClassName",
")",
";",
"}",
"else",
"{",
"String",
"fullInnerClassName",
"=",
"mParent",
".",
"getClassName",
"(",
")",
"+",
"'",
"'",
"+",
"(",
"++",
"mAnonymousInnerClassCount",
")",
"+",
"innerClassName",
";",
"inner",
"=",
"mParent",
".",
"addInnerClass",
"(",
"fullInnerClassName",
",",
"innerClassName",
",",
"superClassName",
")",
";",
"}",
"if",
"(",
"mParent",
".",
"getMajorVersion",
"(",
")",
">=",
"49",
")",
"{",
"inner",
".",
"addAttribute",
"(",
"new",
"EnclosingMethodAttr",
"(",
"mCp",
",",
"mCp",
".",
"addConstantClass",
"(",
"mParent",
".",
"getClassName",
"(",
")",
")",
",",
"mCp",
".",
"addConstantNameAndType",
"(",
"mNameConstant",
",",
"mDescriptorConstant",
")",
")",
")",
";",
"}",
"return",
"inner",
";",
"}"
] | Add an inner class to this method.
@param innerClassName Optional short inner class name.
@param superClassName Full super class name. | [
"Add",
"an",
"inner",
"class",
"to",
"this",
"method",
"."
] | train | https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/MethodInfo.java#L341-L358 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/util/intern/duplex/DuplexExpression.java | DuplexExpression.ensureExistence | @SuppressWarnings("unchecked")
public org.w3c.dom.Node ensureExistence(final org.w3c.dom.Node contextNode) {
"""
Creates nodes until selecting such a path would return something.
@param contextNode
@return the node that this expression would select.
"""
final Document document = DOMHelper.getOwnerDocumentFor(contextNode);
final Map<String, String> namespaceMapping = new HashMap<String, String>(userDefinedMapping);
namespaceMapping.putAll(DOMHelper.getNamespaceMapping(document));
//node.dump("");
return ((List<org.w3c.dom.Node>) node.firstChildAccept(new BuildDocumentVisitor(variableResolver, namespaceMapping), contextNode)).get(0);
} | java | @SuppressWarnings("unchecked")
public org.w3c.dom.Node ensureExistence(final org.w3c.dom.Node contextNode) {
final Document document = DOMHelper.getOwnerDocumentFor(contextNode);
final Map<String, String> namespaceMapping = new HashMap<String, String>(userDefinedMapping);
namespaceMapping.putAll(DOMHelper.getNamespaceMapping(document));
//node.dump("");
return ((List<org.w3c.dom.Node>) node.firstChildAccept(new BuildDocumentVisitor(variableResolver, namespaceMapping), contextNode)).get(0);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"ensureExistence",
"(",
"final",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"contextNode",
")",
"{",
"final",
"Document",
"document",
"=",
"DOMHelper",
".",
"getOwnerDocumentFor",
"(",
"contextNode",
")",
";",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"namespaceMapping",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
"userDefinedMapping",
")",
";",
"namespaceMapping",
".",
"putAll",
"(",
"DOMHelper",
".",
"getNamespaceMapping",
"(",
"document",
")",
")",
";",
"//node.dump(\"\");",
"return",
"(",
"(",
"List",
"<",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
">",
")",
"node",
".",
"firstChildAccept",
"(",
"new",
"BuildDocumentVisitor",
"(",
"variableResolver",
",",
"namespaceMapping",
")",
",",
"contextNode",
")",
")",
".",
"get",
"(",
"0",
")",
";",
"}"
] | Creates nodes until selecting such a path would return something.
@param contextNode
@return the node that this expression would select. | [
"Creates",
"nodes",
"until",
"selecting",
"such",
"a",
"path",
"would",
"return",
"something",
"."
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/util/intern/duplex/DuplexExpression.java#L184-L191 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.illegalCodeContent | public static void illegalCodeContent(Exception e, String methodName, String className, String content) {
"""
Thrown when the explicit conversion method defined has a null pointer.<br>
Used in the generated code, in case of dynamic methods defined.
@param e byteCode library exception
@param methodName method name
@param className class name
@param content xml path file
"""
throw new IllegalCodeException(MSG.INSTANCE.message(nullPointerContent,methodName,className,content,e.getClass().getSimpleName(),""+e.getMessage()));
} | java | public static void illegalCodeContent(Exception e, String methodName, String className, String content){
throw new IllegalCodeException(MSG.INSTANCE.message(nullPointerContent,methodName,className,content,e.getClass().getSimpleName(),""+e.getMessage()));
} | [
"public",
"static",
"void",
"illegalCodeContent",
"(",
"Exception",
"e",
",",
"String",
"methodName",
",",
"String",
"className",
",",
"String",
"content",
")",
"{",
"throw",
"new",
"IllegalCodeException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"nullPointerContent",
",",
"methodName",
",",
"className",
",",
"content",
",",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
")",
";",
"}"
] | Thrown when the explicit conversion method defined has a null pointer.<br>
Used in the generated code, in case of dynamic methods defined.
@param e byteCode library exception
@param methodName method name
@param className class name
@param content xml path file | [
"Thrown",
"when",
"the",
"explicit",
"conversion",
"method",
"defined",
"has",
"a",
"null",
"pointer",
".",
"<br",
">",
"Used",
"in",
"the",
"generated",
"code",
"in",
"case",
"of",
"dynamic",
"methods",
"defined",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L168-L170 |
aerogear/aerogear-android-push | library/src/main/java/org/jboss/aerogear/android/unifiedpush/fcm/UnifiedPushConfig.java | UnifiedPushConfig.validateCategories | private static void validateCategories(String... categories) {
"""
Validates categories against Google's pattern.
@param categories a group of Strings each will be validated.
@throws IllegalArgumentException if a category fails to match [a-zA-Z0-9-_.~%]+
"""
for (String category : categories) {
if (!category.matches(FCM_TOPIC_PATTERN)) {
throw new IllegalArgumentException(String.format("%s does not match %s", category, FCM_TOPIC_PATTERN));
}
}
} | java | private static void validateCategories(String... categories) {
for (String category : categories) {
if (!category.matches(FCM_TOPIC_PATTERN)) {
throw new IllegalArgumentException(String.format("%s does not match %s", category, FCM_TOPIC_PATTERN));
}
}
} | [
"private",
"static",
"void",
"validateCategories",
"(",
"String",
"...",
"categories",
")",
"{",
"for",
"(",
"String",
"category",
":",
"categories",
")",
"{",
"if",
"(",
"!",
"category",
".",
"matches",
"(",
"FCM_TOPIC_PATTERN",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s does not match %s\"",
",",
"category",
",",
"FCM_TOPIC_PATTERN",
")",
")",
";",
"}",
"}",
"}"
] | Validates categories against Google's pattern.
@param categories a group of Strings each will be validated.
@throws IllegalArgumentException if a category fails to match [a-zA-Z0-9-_.~%]+ | [
"Validates",
"categories",
"against",
"Google",
"s",
"pattern",
"."
] | train | https://github.com/aerogear/aerogear-android-push/blob/f21f93393a9f4590e9a8d6d045ab9aabca3d211f/library/src/main/java/org/jboss/aerogear/android/unifiedpush/fcm/UnifiedPushConfig.java#L310-L317 |
drinkjava2/jDialects | core/src/main/java/com/github/drinkjava2/jdialects/GuessDialectUtils.java | GuessDialectUtils.guessDialect | public static Dialect guessDialect(Connection jdbcConnection) {
"""
Guess dialect based on given JDBC connection instance, Note: this method does
not close connection
@param jdbcConnection
The connection
@return dialect or null if can not guess out which dialect
"""
String databaseName;
String driverName;
int majorVersion;
int minorVersion;
try {
DatabaseMetaData meta = jdbcConnection.getMetaData();
driverName = meta.getDriverName();
databaseName = meta.getDatabaseProductName();
majorVersion = meta.getDatabaseMajorVersion();
minorVersion = meta.getDatabaseMinorVersion();
} catch (SQLException e) {
return (Dialect) DialectException.throwEX(e);
}
return guessDialect(driverName, databaseName, majorVersion, minorVersion);
} | java | public static Dialect guessDialect(Connection jdbcConnection) {
String databaseName;
String driverName;
int majorVersion;
int minorVersion;
try {
DatabaseMetaData meta = jdbcConnection.getMetaData();
driverName = meta.getDriverName();
databaseName = meta.getDatabaseProductName();
majorVersion = meta.getDatabaseMajorVersion();
minorVersion = meta.getDatabaseMinorVersion();
} catch (SQLException e) {
return (Dialect) DialectException.throwEX(e);
}
return guessDialect(driverName, databaseName, majorVersion, minorVersion);
} | [
"public",
"static",
"Dialect",
"guessDialect",
"(",
"Connection",
"jdbcConnection",
")",
"{",
"String",
"databaseName",
";",
"String",
"driverName",
";",
"int",
"majorVersion",
";",
"int",
"minorVersion",
";",
"try",
"{",
"DatabaseMetaData",
"meta",
"=",
"jdbcConnection",
".",
"getMetaData",
"(",
")",
";",
"driverName",
"=",
"meta",
".",
"getDriverName",
"(",
")",
";",
"databaseName",
"=",
"meta",
".",
"getDatabaseProductName",
"(",
")",
";",
"majorVersion",
"=",
"meta",
".",
"getDatabaseMajorVersion",
"(",
")",
";",
"minorVersion",
"=",
"meta",
".",
"getDatabaseMinorVersion",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"return",
"(",
"Dialect",
")",
"DialectException",
".",
"throwEX",
"(",
"e",
")",
";",
"}",
"return",
"guessDialect",
"(",
"driverName",
",",
"databaseName",
",",
"majorVersion",
",",
"minorVersion",
")",
";",
"}"
] | Guess dialect based on given JDBC connection instance, Note: this method does
not close connection
@param jdbcConnection
The connection
@return dialect or null if can not guess out which dialect | [
"Guess",
"dialect",
"based",
"on",
"given",
"JDBC",
"connection",
"instance",
"Note",
":",
"this",
"method",
"does",
"not",
"close",
"connection"
] | train | https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/GuessDialectUtils.java#L40-L55 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIInstitute.java | HBCIInstitute.updateBPD | void updateBPD(HashMap<String, String> result) {
"""
gets the BPD out of the result and store it in the
passport field
"""
log.debug("extracting BPD from results");
HashMap<String, String> newBPD = new HashMap<>();
result.keySet().forEach(key -> {
if (key.startsWith("BPD.")) {
newBPD.put(key.substring(("BPD.").length()), result.get(key));
}
});
if (newBPD.size() != 0) {
newBPD.put(BPD_KEY_HBCIVERSION, passport.getHBCIVersion());
newBPD.put(BPD_KEY_LASTUPDATE, String.valueOf(System.currentTimeMillis()));
passport.setBPD(newBPD);
log.info("installed new BPD with version " + passport.getBPDVersion());
passport.getCallback().status(HBCICallback.STATUS_INST_BPD_INIT_DONE, passport.getBPD());
}
} | java | void updateBPD(HashMap<String, String> result) {
log.debug("extracting BPD from results");
HashMap<String, String> newBPD = new HashMap<>();
result.keySet().forEach(key -> {
if (key.startsWith("BPD.")) {
newBPD.put(key.substring(("BPD.").length()), result.get(key));
}
});
if (newBPD.size() != 0) {
newBPD.put(BPD_KEY_HBCIVERSION, passport.getHBCIVersion());
newBPD.put(BPD_KEY_LASTUPDATE, String.valueOf(System.currentTimeMillis()));
passport.setBPD(newBPD);
log.info("installed new BPD with version " + passport.getBPDVersion());
passport.getCallback().status(HBCICallback.STATUS_INST_BPD_INIT_DONE, passport.getBPD());
}
} | [
"void",
"updateBPD",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"result",
")",
"{",
"log",
".",
"debug",
"(",
"\"extracting BPD from results\"",
")",
";",
"HashMap",
"<",
"String",
",",
"String",
">",
"newBPD",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"result",
".",
"keySet",
"(",
")",
".",
"forEach",
"(",
"key",
"->",
"{",
"if",
"(",
"key",
".",
"startsWith",
"(",
"\"BPD.\"",
")",
")",
"{",
"newBPD",
".",
"put",
"(",
"key",
".",
"substring",
"(",
"(",
"\"BPD.\"",
")",
".",
"length",
"(",
")",
")",
",",
"result",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"newBPD",
".",
"size",
"(",
")",
"!=",
"0",
")",
"{",
"newBPD",
".",
"put",
"(",
"BPD_KEY_HBCIVERSION",
",",
"passport",
".",
"getHBCIVersion",
"(",
")",
")",
";",
"newBPD",
".",
"put",
"(",
"BPD_KEY_LASTUPDATE",
",",
"String",
".",
"valueOf",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
")",
";",
"passport",
".",
"setBPD",
"(",
"newBPD",
")",
";",
"log",
".",
"info",
"(",
"\"installed new BPD with version \"",
"+",
"passport",
".",
"getBPDVersion",
"(",
")",
")",
";",
"passport",
".",
"getCallback",
"(",
")",
".",
"status",
"(",
"HBCICallback",
".",
"STATUS_INST_BPD_INIT_DONE",
",",
"passport",
".",
"getBPD",
"(",
")",
")",
";",
"}",
"}"
] | gets the BPD out of the result and store it in the
passport field | [
"gets",
"the",
"BPD",
"out",
"of",
"the",
"result",
"and",
"store",
"it",
"in",
"the",
"passport",
"field"
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIInstitute.java#L68-L85 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java | AttList.getIndex | public int getIndex(String uri, String localPart) {
"""
Look up the index of an attribute by Namespace name.
@param uri The Namespace URI, or the empty string if
the name has no Namespace URI.
@param localPart The attribute's local name.
@return The index of the attribute, or -1 if it does not
appear in the list.
"""
for(int i=m_attrs.getLength()-1;i>=0;--i)
{
Node a=m_attrs.item(i);
String u=a.getNamespaceURI();
if( (u==null ? uri==null : u.equals(uri))
&&
a.getLocalName().equals(localPart) )
return i;
}
return -1;
} | java | public int getIndex(String uri, String localPart)
{
for(int i=m_attrs.getLength()-1;i>=0;--i)
{
Node a=m_attrs.item(i);
String u=a.getNamespaceURI();
if( (u==null ? uri==null : u.equals(uri))
&&
a.getLocalName().equals(localPart) )
return i;
}
return -1;
} | [
"public",
"int",
"getIndex",
"(",
"String",
"uri",
",",
"String",
"localPart",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"m_attrs",
".",
"getLength",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"{",
"Node",
"a",
"=",
"m_attrs",
".",
"item",
"(",
"i",
")",
";",
"String",
"u",
"=",
"a",
".",
"getNamespaceURI",
"(",
")",
";",
"if",
"(",
"(",
"u",
"==",
"null",
"?",
"uri",
"==",
"null",
":",
"u",
".",
"equals",
"(",
"uri",
")",
")",
"&&",
"a",
".",
"getLocalName",
"(",
")",
".",
"equals",
"(",
"localPart",
")",
")",
"return",
"i",
";",
"}",
"return",
"-",
"1",
";",
"}"
] | Look up the index of an attribute by Namespace name.
@param uri The Namespace URI, or the empty string if
the name has no Namespace URI.
@param localPart The attribute's local name.
@return The index of the attribute, or -1 if it does not
appear in the list. | [
"Look",
"up",
"the",
"index",
"of",
"an",
"attribute",
"by",
"Namespace",
"name",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java#L232-L244 |
Alluxio/alluxio | core/base/src/main/java/alluxio/util/io/PathUtils.java | PathUtils.subtractPaths | public static String subtractPaths(String path, String prefix) throws InvalidPathException {
"""
Removes the prefix from the path, yielding a relative path from the second path to the first.
If the paths are the same, this method returns the empty string.
@param path the full path
@param prefix the prefix to remove
@return the path with the prefix removed
@throws InvalidPathException if either of the arguments are not valid paths
"""
String cleanedPath = cleanPath(path);
String cleanedPrefix = cleanPath(prefix);
if (cleanedPath.equals(cleanedPrefix)) {
return "";
}
if (!hasPrefix(cleanedPath, cleanedPrefix)) {
throw new RuntimeException(
String.format("Cannot subtract %s from %s because it is not a prefix", prefix, path));
}
// The only clean path which ends in '/' is the root.
int prefixLen = cleanedPrefix.length();
int charsToDrop = PathUtils.isRoot(cleanedPrefix) ? prefixLen : prefixLen + 1;
return cleanedPath.substring(charsToDrop, cleanedPath.length());
} | java | public static String subtractPaths(String path, String prefix) throws InvalidPathException {
String cleanedPath = cleanPath(path);
String cleanedPrefix = cleanPath(prefix);
if (cleanedPath.equals(cleanedPrefix)) {
return "";
}
if (!hasPrefix(cleanedPath, cleanedPrefix)) {
throw new RuntimeException(
String.format("Cannot subtract %s from %s because it is not a prefix", prefix, path));
}
// The only clean path which ends in '/' is the root.
int prefixLen = cleanedPrefix.length();
int charsToDrop = PathUtils.isRoot(cleanedPrefix) ? prefixLen : prefixLen + 1;
return cleanedPath.substring(charsToDrop, cleanedPath.length());
} | [
"public",
"static",
"String",
"subtractPaths",
"(",
"String",
"path",
",",
"String",
"prefix",
")",
"throws",
"InvalidPathException",
"{",
"String",
"cleanedPath",
"=",
"cleanPath",
"(",
"path",
")",
";",
"String",
"cleanedPrefix",
"=",
"cleanPath",
"(",
"prefix",
")",
";",
"if",
"(",
"cleanedPath",
".",
"equals",
"(",
"cleanedPrefix",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"if",
"(",
"!",
"hasPrefix",
"(",
"cleanedPath",
",",
"cleanedPrefix",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"String",
".",
"format",
"(",
"\"Cannot subtract %s from %s because it is not a prefix\"",
",",
"prefix",
",",
"path",
")",
")",
";",
"}",
"// The only clean path which ends in '/' is the root.",
"int",
"prefixLen",
"=",
"cleanedPrefix",
".",
"length",
"(",
")",
";",
"int",
"charsToDrop",
"=",
"PathUtils",
".",
"isRoot",
"(",
"cleanedPrefix",
")",
"?",
"prefixLen",
":",
"prefixLen",
"+",
"1",
";",
"return",
"cleanedPath",
".",
"substring",
"(",
"charsToDrop",
",",
"cleanedPath",
".",
"length",
"(",
")",
")",
";",
"}"
] | Removes the prefix from the path, yielding a relative path from the second path to the first.
If the paths are the same, this method returns the empty string.
@param path the full path
@param prefix the prefix to remove
@return the path with the prefix removed
@throws InvalidPathException if either of the arguments are not valid paths | [
"Removes",
"the",
"prefix",
"from",
"the",
"path",
"yielding",
"a",
"relative",
"path",
"from",
"the",
"second",
"path",
"to",
"the",
"first",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/io/PathUtils.java#L170-L184 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/client/LibertyServiceImpl.java | LibertyServiceImpl.configureCustomizeBinding | protected void configureCustomizeBinding(Client client, QName portName) {
"""
Add the LibertyCustomizeBindingOutInterceptor in the out interceptor chain.
@param client
@param portName
"""
//put all properties defined in ibm-ws-bnd.xml into the client request context
Map<String, Object> requestContext = client.getRequestContext();
if (null != requestContext && null != wsrInfo) {
PortComponentRefInfo portRefInfo = wsrInfo.getPortComponentRefInfo(portName);
Map<String, String> wsrProps = wsrInfo.getProperties();
Map<String, String> portProps = (null != portRefInfo) ? portRefInfo.getProperties() : null;
if (null != wsrProps) {
requestContext.putAll(wsrProps);
}
if (null != portProps) {
requestContext.putAll(portProps);
}
if (null != wsrProps && Boolean.valueOf(wsrProps.get(JaxWsConstants.ENABLE_lOGGINGINOUTINTERCEPTOR))) {
List<Interceptor<? extends Message>> inInterceptors = client.getInInterceptors();
inInterceptors.add(new LoggingInInterceptor());
List<Interceptor<? extends Message>> outInterceptors = client.getOutInterceptors();
outInterceptors.add(new LoggingOutInterceptor());
}
}
Set<ConfigProperties> configPropsSet = servicePropertiesMap.get(portName);
client.getOutInterceptors().add(new LibertyCustomizeBindingOutInterceptor(wsrInfo, securityConfigService, configPropsSet));
//need to add an interceptor to clean up HTTPTransportActivator.sorted & props via calling HTTPTransportActivator. deleted(String)
//Memory Leak fix for 130985
client.getOutInterceptors().add(new LibertyCustomizeBindingOutEndingInterceptor(wsrInfo));
} | java | protected void configureCustomizeBinding(Client client, QName portName) {
//put all properties defined in ibm-ws-bnd.xml into the client request context
Map<String, Object> requestContext = client.getRequestContext();
if (null != requestContext && null != wsrInfo) {
PortComponentRefInfo portRefInfo = wsrInfo.getPortComponentRefInfo(portName);
Map<String, String> wsrProps = wsrInfo.getProperties();
Map<String, String> portProps = (null != portRefInfo) ? portRefInfo.getProperties() : null;
if (null != wsrProps) {
requestContext.putAll(wsrProps);
}
if (null != portProps) {
requestContext.putAll(portProps);
}
if (null != wsrProps && Boolean.valueOf(wsrProps.get(JaxWsConstants.ENABLE_lOGGINGINOUTINTERCEPTOR))) {
List<Interceptor<? extends Message>> inInterceptors = client.getInInterceptors();
inInterceptors.add(new LoggingInInterceptor());
List<Interceptor<? extends Message>> outInterceptors = client.getOutInterceptors();
outInterceptors.add(new LoggingOutInterceptor());
}
}
Set<ConfigProperties> configPropsSet = servicePropertiesMap.get(portName);
client.getOutInterceptors().add(new LibertyCustomizeBindingOutInterceptor(wsrInfo, securityConfigService, configPropsSet));
//need to add an interceptor to clean up HTTPTransportActivator.sorted & props via calling HTTPTransportActivator. deleted(String)
//Memory Leak fix for 130985
client.getOutInterceptors().add(new LibertyCustomizeBindingOutEndingInterceptor(wsrInfo));
} | [
"protected",
"void",
"configureCustomizeBinding",
"(",
"Client",
"client",
",",
"QName",
"portName",
")",
"{",
"//put all properties defined in ibm-ws-bnd.xml into the client request context",
"Map",
"<",
"String",
",",
"Object",
">",
"requestContext",
"=",
"client",
".",
"getRequestContext",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"requestContext",
"&&",
"null",
"!=",
"wsrInfo",
")",
"{",
"PortComponentRefInfo",
"portRefInfo",
"=",
"wsrInfo",
".",
"getPortComponentRefInfo",
"(",
"portName",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"wsrProps",
"=",
"wsrInfo",
".",
"getProperties",
"(",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"portProps",
"=",
"(",
"null",
"!=",
"portRefInfo",
")",
"?",
"portRefInfo",
".",
"getProperties",
"(",
")",
":",
"null",
";",
"if",
"(",
"null",
"!=",
"wsrProps",
")",
"{",
"requestContext",
".",
"putAll",
"(",
"wsrProps",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"portProps",
")",
"{",
"requestContext",
".",
"putAll",
"(",
"portProps",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"wsrProps",
"&&",
"Boolean",
".",
"valueOf",
"(",
"wsrProps",
".",
"get",
"(",
"JaxWsConstants",
".",
"ENABLE_lOGGINGINOUTINTERCEPTOR",
")",
")",
")",
"{",
"List",
"<",
"Interceptor",
"<",
"?",
"extends",
"Message",
">",
">",
"inInterceptors",
"=",
"client",
".",
"getInInterceptors",
"(",
")",
";",
"inInterceptors",
".",
"add",
"(",
"new",
"LoggingInInterceptor",
"(",
")",
")",
";",
"List",
"<",
"Interceptor",
"<",
"?",
"extends",
"Message",
">",
">",
"outInterceptors",
"=",
"client",
".",
"getOutInterceptors",
"(",
")",
";",
"outInterceptors",
".",
"add",
"(",
"new",
"LoggingOutInterceptor",
"(",
")",
")",
";",
"}",
"}",
"Set",
"<",
"ConfigProperties",
">",
"configPropsSet",
"=",
"servicePropertiesMap",
".",
"get",
"(",
"portName",
")",
";",
"client",
".",
"getOutInterceptors",
"(",
")",
".",
"add",
"(",
"new",
"LibertyCustomizeBindingOutInterceptor",
"(",
"wsrInfo",
",",
"securityConfigService",
",",
"configPropsSet",
")",
")",
";",
"//need to add an interceptor to clean up HTTPTransportActivator.sorted & props via calling HTTPTransportActivator. deleted(String)",
"//Memory Leak fix for 130985",
"client",
".",
"getOutInterceptors",
"(",
")",
".",
"add",
"(",
"new",
"LibertyCustomizeBindingOutEndingInterceptor",
"(",
"wsrInfo",
")",
")",
";",
"}"
] | Add the LibertyCustomizeBindingOutInterceptor in the out interceptor chain.
@param client
@param portName | [
"Add",
"the",
"LibertyCustomizeBindingOutInterceptor",
"in",
"the",
"out",
"interceptor",
"chain",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/client/LibertyServiceImpl.java#L134-L165 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/util/CausticUtil.java | CausticUtil.fromHSB | public static Vector4f fromHSB(float hue, float saturation, float brightness) {
"""
Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the default RGB model. The <code>saturation</code> and <code>brightness</code> components
should be floating-point values between zero and one (numbers in the range [0, 1]). The <code>hue</code> component can be any floating-point number. Alpha will be 1.
@param hue The hue component of the color
@param saturation The saturation of the color
@param brightness The brightness of the color
@return The color as a 4 float vector
"""
float r = 0;
float g = 0;
float b = 0;
if (saturation == 0) {
r = g = b = brightness;
} else {
final float h = (hue - GenericMath.floor(hue)) * 6;
final float f = h - GenericMath.floor(h);
final float p = brightness * (1 - saturation);
final float q = brightness * (1 - saturation * f);
final float t = brightness * (1 - saturation * (1 - f));
switch ((int) h) {
case 0:
r = brightness;
g = t;
b = p;
break;
case 1:
r = q;
g = brightness;
b = p;
break;
case 2:
r = p;
g = brightness;
b = t;
break;
case 3:
r = p;
g = q;
b = brightness;
break;
case 4:
r = t;
g = p;
b = brightness;
break;
case 5:
r = brightness;
g = p;
b = q;
break;
}
}
return new Vector4f(r, g, b, 1);
} | java | public static Vector4f fromHSB(float hue, float saturation, float brightness) {
float r = 0;
float g = 0;
float b = 0;
if (saturation == 0) {
r = g = b = brightness;
} else {
final float h = (hue - GenericMath.floor(hue)) * 6;
final float f = h - GenericMath.floor(h);
final float p = brightness * (1 - saturation);
final float q = brightness * (1 - saturation * f);
final float t = brightness * (1 - saturation * (1 - f));
switch ((int) h) {
case 0:
r = brightness;
g = t;
b = p;
break;
case 1:
r = q;
g = brightness;
b = p;
break;
case 2:
r = p;
g = brightness;
b = t;
break;
case 3:
r = p;
g = q;
b = brightness;
break;
case 4:
r = t;
g = p;
b = brightness;
break;
case 5:
r = brightness;
g = p;
b = q;
break;
}
}
return new Vector4f(r, g, b, 1);
} | [
"public",
"static",
"Vector4f",
"fromHSB",
"(",
"float",
"hue",
",",
"float",
"saturation",
",",
"float",
"brightness",
")",
"{",
"float",
"r",
"=",
"0",
";",
"float",
"g",
"=",
"0",
";",
"float",
"b",
"=",
"0",
";",
"if",
"(",
"saturation",
"==",
"0",
")",
"{",
"r",
"=",
"g",
"=",
"b",
"=",
"brightness",
";",
"}",
"else",
"{",
"final",
"float",
"h",
"=",
"(",
"hue",
"-",
"GenericMath",
".",
"floor",
"(",
"hue",
")",
")",
"*",
"6",
";",
"final",
"float",
"f",
"=",
"h",
"-",
"GenericMath",
".",
"floor",
"(",
"h",
")",
";",
"final",
"float",
"p",
"=",
"brightness",
"*",
"(",
"1",
"-",
"saturation",
")",
";",
"final",
"float",
"q",
"=",
"brightness",
"*",
"(",
"1",
"-",
"saturation",
"*",
"f",
")",
";",
"final",
"float",
"t",
"=",
"brightness",
"*",
"(",
"1",
"-",
"saturation",
"*",
"(",
"1",
"-",
"f",
")",
")",
";",
"switch",
"(",
"(",
"int",
")",
"h",
")",
"{",
"case",
"0",
":",
"r",
"=",
"brightness",
";",
"g",
"=",
"t",
";",
"b",
"=",
"p",
";",
"break",
";",
"case",
"1",
":",
"r",
"=",
"q",
";",
"g",
"=",
"brightness",
";",
"b",
"=",
"p",
";",
"break",
";",
"case",
"2",
":",
"r",
"=",
"p",
";",
"g",
"=",
"brightness",
";",
"b",
"=",
"t",
";",
"break",
";",
"case",
"3",
":",
"r",
"=",
"p",
";",
"g",
"=",
"q",
";",
"b",
"=",
"brightness",
";",
"break",
";",
"case",
"4",
":",
"r",
"=",
"t",
";",
"g",
"=",
"p",
";",
"b",
"=",
"brightness",
";",
"break",
";",
"case",
"5",
":",
"r",
"=",
"brightness",
";",
"g",
"=",
"p",
";",
"b",
"=",
"q",
";",
"break",
";",
"}",
"}",
"return",
"new",
"Vector4f",
"(",
"r",
",",
"g",
",",
"b",
",",
"1",
")",
";",
"}"
] | Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the default RGB model. The <code>saturation</code> and <code>brightness</code> components
should be floating-point values between zero and one (numbers in the range [0, 1]). The <code>hue</code> component can be any floating-point number. Alpha will be 1.
@param hue The hue component of the color
@param saturation The saturation of the color
@param brightness The brightness of the color
@return The color as a 4 float vector | [
"Converts",
"the",
"components",
"of",
"a",
"color",
"as",
"specified",
"by",
"the",
"HSB",
"model",
"to",
"an",
"equivalent",
"set",
"of",
"values",
"for",
"the",
"default",
"RGB",
"model",
".",
"The",
"<code",
">",
"saturation<",
"/",
"code",
">",
"and",
"<code",
">",
"brightness<",
"/",
"code",
">",
"components",
"should",
"be",
"floating",
"-",
"point",
"values",
"between",
"zero",
"and",
"one",
"(",
"numbers",
"in",
"the",
"range",
"[",
"0",
"1",
"]",
")",
".",
"The",
"<code",
">",
"hue<",
"/",
"code",
">",
"component",
"can",
"be",
"any",
"floating",
"-",
"point",
"number",
".",
"Alpha",
"will",
"be",
"1",
"."
] | train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/CausticUtil.java#L303-L349 |
apache/incubator-atlas | common/src/main/java/org/apache/atlas/utils/ParamChecker.java | ParamChecker.notEmpty | public static String notEmpty(String value, String name, String info) {
"""
Check that a string is not null and not empty. If null or emtpy throws an IllegalArgumentException.
@param value value.
@param name parameter name for the exception message.
@param info additional information to be printed with the exception message
@return the given value.
"""
if (value == null) {
throw new IllegalArgumentException(name + " cannot be null" + (info == null ? "" : ", " + info));
}
return notEmptyIfNotNull(value, name, info);
} | java | public static String notEmpty(String value, String name, String info) {
if (value == null) {
throw new IllegalArgumentException(name + " cannot be null" + (info == null ? "" : ", " + info));
}
return notEmptyIfNotNull(value, name, info);
} | [
"public",
"static",
"String",
"notEmpty",
"(",
"String",
"value",
",",
"String",
"name",
",",
"String",
"info",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"name",
"+",
"\" cannot be null\"",
"+",
"(",
"info",
"==",
"null",
"?",
"\"\"",
":",
"\", \"",
"+",
"info",
")",
")",
";",
"}",
"return",
"notEmptyIfNotNull",
"(",
"value",
",",
"name",
",",
"info",
")",
";",
"}"
] | Check that a string is not null and not empty. If null or emtpy throws an IllegalArgumentException.
@param value value.
@param name parameter name for the exception message.
@param info additional information to be printed with the exception message
@return the given value. | [
"Check",
"that",
"a",
"string",
"is",
"not",
"null",
"and",
"not",
"empty",
".",
"If",
"null",
"or",
"emtpy",
"throws",
"an",
"IllegalArgumentException",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/common/src/main/java/org/apache/atlas/utils/ParamChecker.java#L134-L139 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDK.java | ActorSDK.startChatActivity | public void startChatActivity(Context context, Peer peer, boolean compose) {
"""
Method is used internally for starting default activity or activity added in delegate
@param context current context
"""
Bundle b = new Bundle();
b.putLong(Intents.EXTRA_CHAT_PEER, peer.getUnuqueId());
b.putBoolean(Intents.EXTRA_CHAT_COMPOSE, compose);
if (!startDelegateActivity(context, delegate.getChatIntent(peer, compose), b, new int[]{Intent.FLAG_ACTIVITY_SINGLE_TOP})) {
startActivity(context, b, ChatActivity.class);
}
} | java | public void startChatActivity(Context context, Peer peer, boolean compose) {
Bundle b = new Bundle();
b.putLong(Intents.EXTRA_CHAT_PEER, peer.getUnuqueId());
b.putBoolean(Intents.EXTRA_CHAT_COMPOSE, compose);
if (!startDelegateActivity(context, delegate.getChatIntent(peer, compose), b, new int[]{Intent.FLAG_ACTIVITY_SINGLE_TOP})) {
startActivity(context, b, ChatActivity.class);
}
} | [
"public",
"void",
"startChatActivity",
"(",
"Context",
"context",
",",
"Peer",
"peer",
",",
"boolean",
"compose",
")",
"{",
"Bundle",
"b",
"=",
"new",
"Bundle",
"(",
")",
";",
"b",
".",
"putLong",
"(",
"Intents",
".",
"EXTRA_CHAT_PEER",
",",
"peer",
".",
"getUnuqueId",
"(",
")",
")",
";",
"b",
".",
"putBoolean",
"(",
"Intents",
".",
"EXTRA_CHAT_COMPOSE",
",",
"compose",
")",
";",
"if",
"(",
"!",
"startDelegateActivity",
"(",
"context",
",",
"delegate",
".",
"getChatIntent",
"(",
"peer",
",",
"compose",
")",
",",
"b",
",",
"new",
"int",
"[",
"]",
"{",
"Intent",
".",
"FLAG_ACTIVITY_SINGLE_TOP",
"}",
")",
")",
"{",
"startActivity",
"(",
"context",
",",
"b",
",",
"ChatActivity",
".",
"class",
")",
";",
"}",
"}"
] | Method is used internally for starting default activity or activity added in delegate
@param context current context | [
"Method",
"is",
"used",
"internally",
"for",
"starting",
"default",
"activity",
"or",
"activity",
"added",
"in",
"delegate"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDK.java#L989-L996 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ApplicationsImpl.java | ApplicationsImpl.getAsync | public Observable<ApplicationSummary> getAsync(String applicationId, ApplicationGetOptions applicationGetOptions) {
"""
Gets information about the specified application.
This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API.
@param applicationId The ID of the application.
@param applicationGetOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationSummary object
"""
return getWithServiceResponseAsync(applicationId, applicationGetOptions).map(new Func1<ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders>, ApplicationSummary>() {
@Override
public ApplicationSummary call(ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders> response) {
return response.body();
}
});
} | java | public Observable<ApplicationSummary> getAsync(String applicationId, ApplicationGetOptions applicationGetOptions) {
return getWithServiceResponseAsync(applicationId, applicationGetOptions).map(new Func1<ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders>, ApplicationSummary>() {
@Override
public ApplicationSummary call(ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationSummary",
">",
"getAsync",
"(",
"String",
"applicationId",
",",
"ApplicationGetOptions",
"applicationGetOptions",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"applicationId",
",",
"applicationGetOptions",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponseWithHeaders",
"<",
"ApplicationSummary",
",",
"ApplicationGetHeaders",
">",
",",
"ApplicationSummary",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ApplicationSummary",
"call",
"(",
"ServiceResponseWithHeaders",
"<",
"ApplicationSummary",
",",
"ApplicationGetHeaders",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets information about the specified application.
This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API.
@param applicationId The ID of the application.
@param applicationGetOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationSummary object | [
"Gets",
"information",
"about",
"the",
"specified",
"application",
".",
"This",
"operation",
"returns",
"only",
"applications",
"and",
"versions",
"that",
"are",
"available",
"for",
"use",
"on",
"compute",
"nodes",
";",
"that",
"is",
"that",
"can",
"be",
"used",
"in",
"an",
"application",
"package",
"reference",
".",
"For",
"administrator",
"information",
"about",
"applications",
"and",
"versions",
"that",
"are",
"not",
"yet",
"available",
"to",
"compute",
"nodes",
"use",
"the",
"Azure",
"portal",
"or",
"the",
"Azure",
"Resource",
"Manager",
"API",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ApplicationsImpl.java#L487-L494 |
openengsb/openengsb | components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java | InstantiateOperation.tryInitiatingObject | private Object tryInitiatingObject(String targetType, String initMethodName, List<Object> fieldObjects)
throws TransformationOperationException {
"""
Try to perform the actual initiating of the target class object. Returns the target class object or throws a
TransformationOperationException if something went wrong.
"""
Class<?> targetClass = loadClassByName(targetType);
try {
if (initMethodName == null) {
return initiateByConstructor(targetClass, fieldObjects);
} else {
return initiateByMethodName(targetClass, initMethodName, fieldObjects);
}
} catch (Exception e) {
String message = "Unable to create the desired object. The instantiate operation will be ignored.";
message = String.format(message, targetType);
getLogger().error(message);
throw new TransformationOperationException(message, e);
}
} | java | private Object tryInitiatingObject(String targetType, String initMethodName, List<Object> fieldObjects)
throws TransformationOperationException {
Class<?> targetClass = loadClassByName(targetType);
try {
if (initMethodName == null) {
return initiateByConstructor(targetClass, fieldObjects);
} else {
return initiateByMethodName(targetClass, initMethodName, fieldObjects);
}
} catch (Exception e) {
String message = "Unable to create the desired object. The instantiate operation will be ignored.";
message = String.format(message, targetType);
getLogger().error(message);
throw new TransformationOperationException(message, e);
}
} | [
"private",
"Object",
"tryInitiatingObject",
"(",
"String",
"targetType",
",",
"String",
"initMethodName",
",",
"List",
"<",
"Object",
">",
"fieldObjects",
")",
"throws",
"TransformationOperationException",
"{",
"Class",
"<",
"?",
">",
"targetClass",
"=",
"loadClassByName",
"(",
"targetType",
")",
";",
"try",
"{",
"if",
"(",
"initMethodName",
"==",
"null",
")",
"{",
"return",
"initiateByConstructor",
"(",
"targetClass",
",",
"fieldObjects",
")",
";",
"}",
"else",
"{",
"return",
"initiateByMethodName",
"(",
"targetClass",
",",
"initMethodName",
",",
"fieldObjects",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"message",
"=",
"\"Unable to create the desired object. The instantiate operation will be ignored.\"",
";",
"message",
"=",
"String",
".",
"format",
"(",
"message",
",",
"targetType",
")",
";",
"getLogger",
"(",
")",
".",
"error",
"(",
"message",
")",
";",
"throw",
"new",
"TransformationOperationException",
"(",
"message",
",",
"e",
")",
";",
"}",
"}"
] | Try to perform the actual initiating of the target class object. Returns the target class object or throws a
TransformationOperationException if something went wrong. | [
"Try",
"to",
"perform",
"the",
"actual",
"initiating",
"of",
"the",
"target",
"class",
"object",
".",
"Returns",
"the",
"target",
"class",
"object",
"or",
"throws",
"a",
"TransformationOperationException",
"if",
"something",
"went",
"wrong",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java#L82-L97 |
facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java | PlatformBitmapFactory.createBitmap | public CloseableReference<Bitmap> createBitmap(
int width,
int height,
Bitmap.Config bitmapConfig,
@Nullable Object callerContext) {
"""
Creates a bitmap of the specified width and height.
@param width the width of the bitmap
@param height the height of the bitmap
@param bitmapConfig the Bitmap.Config used to create the Bitmap
@param callerContext the Tag to track who create the Bitmap
@return a reference to the bitmap
@throws TooManyBitmapsException if the pool is full
@throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated
"""
return createBitmapInternal(width, height, bitmapConfig);
} | java | public CloseableReference<Bitmap> createBitmap(
int width,
int height,
Bitmap.Config bitmapConfig,
@Nullable Object callerContext) {
return createBitmapInternal(width, height, bitmapConfig);
} | [
"public",
"CloseableReference",
"<",
"Bitmap",
">",
"createBitmap",
"(",
"int",
"width",
",",
"int",
"height",
",",
"Bitmap",
".",
"Config",
"bitmapConfig",
",",
"@",
"Nullable",
"Object",
"callerContext",
")",
"{",
"return",
"createBitmapInternal",
"(",
"width",
",",
"height",
",",
"bitmapConfig",
")",
";",
"}"
] | Creates a bitmap of the specified width and height.
@param width the width of the bitmap
@param height the height of the bitmap
@param bitmapConfig the Bitmap.Config used to create the Bitmap
@param callerContext the Tag to track who create the Bitmap
@return a reference to the bitmap
@throws TooManyBitmapsException if the pool is full
@throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated | [
"Creates",
"a",
"bitmap",
"of",
"the",
"specified",
"width",
"and",
"height",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java#L69-L75 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java | AccessPoint.handleReplayRedirect | protected void handleReplayRedirect(WaybackRequest wbRequest,
HttpServletResponse httpResponse,
CaptureSearchResults captureResults, CaptureSearchResult closest)
throws BetterRequestException {
"""
if capture {@code closest} is of timestamp different from the one requested,
redirect to exact Archival-URL for {@code closest}.
Memento Timegate request is always redirected regardless of timestamp.
Needs better method name.
@param wbRequest
@param httpResponse
@param captureResults
@param closest
@throws BetterRequestException
"""
if (wbRequest.getReplayTimestamp().startsWith(closest.getCaptureTimestamp()) && !wbRequest.isMementoTimegate()) {
// Matching
return;
}
captureResults.setClosest(closest);
//TODO: better detection of non-redirect proxy mode?
// For now, checking if the betterURI does not contain the timestamp, then we're not doing a redirect
String datespec = ArchivalUrl.getDateSpec(wbRequest, closest.getCaptureTimestamp());
String betterURI = getUriConverter().makeReplayURI(datespec, closest.getOriginalUrl());
// if spare-redirect-for-embeds is on, render embedded resource in-place with Content-Location header pointing
// exact replay URL (it is disabled for timegate requests)
// XXX set Content-Location header somewhere else.
if (fixedEmbeds && !wbRequest.isMementoTimegate() && isWaybackReferer(wbRequest, this.getReplayPrefix())) {
httpResponse.setHeader("Content-Location", betterURI);
return;
}
boolean isNonRedirectProxy = !betterURI.contains(closest.getCaptureTimestamp());
if (!isNonRedirectProxy) {
throw new BetterReplayRequestException(closest, captureResults);
}
} | java | protected void handleReplayRedirect(WaybackRequest wbRequest,
HttpServletResponse httpResponse,
CaptureSearchResults captureResults, CaptureSearchResult closest)
throws BetterRequestException {
if (wbRequest.getReplayTimestamp().startsWith(closest.getCaptureTimestamp()) && !wbRequest.isMementoTimegate()) {
// Matching
return;
}
captureResults.setClosest(closest);
//TODO: better detection of non-redirect proxy mode?
// For now, checking if the betterURI does not contain the timestamp, then we're not doing a redirect
String datespec = ArchivalUrl.getDateSpec(wbRequest, closest.getCaptureTimestamp());
String betterURI = getUriConverter().makeReplayURI(datespec, closest.getOriginalUrl());
// if spare-redirect-for-embeds is on, render embedded resource in-place with Content-Location header pointing
// exact replay URL (it is disabled for timegate requests)
// XXX set Content-Location header somewhere else.
if (fixedEmbeds && !wbRequest.isMementoTimegate() && isWaybackReferer(wbRequest, this.getReplayPrefix())) {
httpResponse.setHeader("Content-Location", betterURI);
return;
}
boolean isNonRedirectProxy = !betterURI.contains(closest.getCaptureTimestamp());
if (!isNonRedirectProxy) {
throw new BetterReplayRequestException(closest, captureResults);
}
} | [
"protected",
"void",
"handleReplayRedirect",
"(",
"WaybackRequest",
"wbRequest",
",",
"HttpServletResponse",
"httpResponse",
",",
"CaptureSearchResults",
"captureResults",
",",
"CaptureSearchResult",
"closest",
")",
"throws",
"BetterRequestException",
"{",
"if",
"(",
"wbRequest",
".",
"getReplayTimestamp",
"(",
")",
".",
"startsWith",
"(",
"closest",
".",
"getCaptureTimestamp",
"(",
")",
")",
"&&",
"!",
"wbRequest",
".",
"isMementoTimegate",
"(",
")",
")",
"{",
"// Matching",
"return",
";",
"}",
"captureResults",
".",
"setClosest",
"(",
"closest",
")",
";",
"//TODO: better detection of non-redirect proxy mode?",
"// For now, checking if the betterURI does not contain the timestamp, then we're not doing a redirect",
"String",
"datespec",
"=",
"ArchivalUrl",
".",
"getDateSpec",
"(",
"wbRequest",
",",
"closest",
".",
"getCaptureTimestamp",
"(",
")",
")",
";",
"String",
"betterURI",
"=",
"getUriConverter",
"(",
")",
".",
"makeReplayURI",
"(",
"datespec",
",",
"closest",
".",
"getOriginalUrl",
"(",
")",
")",
";",
"// if spare-redirect-for-embeds is on, render embedded resource in-place with Content-Location header pointing",
"// exact replay URL (it is disabled for timegate requests)",
"// XXX set Content-Location header somewhere else.",
"if",
"(",
"fixedEmbeds",
"&&",
"!",
"wbRequest",
".",
"isMementoTimegate",
"(",
")",
"&&",
"isWaybackReferer",
"(",
"wbRequest",
",",
"this",
".",
"getReplayPrefix",
"(",
")",
")",
")",
"{",
"httpResponse",
".",
"setHeader",
"(",
"\"Content-Location\"",
",",
"betterURI",
")",
";",
"return",
";",
"}",
"boolean",
"isNonRedirectProxy",
"=",
"!",
"betterURI",
".",
"contains",
"(",
"closest",
".",
"getCaptureTimestamp",
"(",
")",
")",
";",
"if",
"(",
"!",
"isNonRedirectProxy",
")",
"{",
"throw",
"new",
"BetterReplayRequestException",
"(",
"closest",
",",
"captureResults",
")",
";",
"}",
"}"
] | if capture {@code closest} is of timestamp different from the one requested,
redirect to exact Archival-URL for {@code closest}.
Memento Timegate request is always redirected regardless of timestamp.
Needs better method name.
@param wbRequest
@param httpResponse
@param captureResults
@param closest
@throws BetterRequestException | [
"if",
"capture",
"{"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java#L689-L718 |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceUtil.java | DataSourceUtil.getDataSource | static DataSource getDataSource(Object rawDataSource, PageContext pc)
throws JspException {
"""
If dataSource is a String first do JNDI lookup.
If lookup fails parse String like it was a set of JDBC parameters
Otherwise check to see if dataSource is a DataSource object and use as
is
"""
DataSource dataSource = null;
if (rawDataSource == null) {
rawDataSource = Config.find(pc, Config.SQL_DATA_SOURCE);
}
if (rawDataSource == null) {
return null;
}
/*
* If the 'dataSource' attribute's value resolves to a String
* after rtexpr/EL evaluation, use the string as JNDI path to
* a DataSource
*/
if (rawDataSource instanceof String) {
try {
Context ctx = new InitialContext();
// relative to standard JNDI root for J2EE app
Context envCtx = (Context) ctx.lookup("java:comp/env");
dataSource = (DataSource) envCtx.lookup((String) rawDataSource);
} catch (NamingException ex) {
dataSource = getDataSource((String) rawDataSource);
}
} else if (rawDataSource instanceof DataSource) {
dataSource = (DataSource) rawDataSource;
} else {
throw new JspException(
Resources.getMessage("SQL_DATASOURCE_INVALID_TYPE"));
}
return dataSource;
} | java | static DataSource getDataSource(Object rawDataSource, PageContext pc)
throws JspException {
DataSource dataSource = null;
if (rawDataSource == null) {
rawDataSource = Config.find(pc, Config.SQL_DATA_SOURCE);
}
if (rawDataSource == null) {
return null;
}
/*
* If the 'dataSource' attribute's value resolves to a String
* after rtexpr/EL evaluation, use the string as JNDI path to
* a DataSource
*/
if (rawDataSource instanceof String) {
try {
Context ctx = new InitialContext();
// relative to standard JNDI root for J2EE app
Context envCtx = (Context) ctx.lookup("java:comp/env");
dataSource = (DataSource) envCtx.lookup((String) rawDataSource);
} catch (NamingException ex) {
dataSource = getDataSource((String) rawDataSource);
}
} else if (rawDataSource instanceof DataSource) {
dataSource = (DataSource) rawDataSource;
} else {
throw new JspException(
Resources.getMessage("SQL_DATASOURCE_INVALID_TYPE"));
}
return dataSource;
} | [
"static",
"DataSource",
"getDataSource",
"(",
"Object",
"rawDataSource",
",",
"PageContext",
"pc",
")",
"throws",
"JspException",
"{",
"DataSource",
"dataSource",
"=",
"null",
";",
"if",
"(",
"rawDataSource",
"==",
"null",
")",
"{",
"rawDataSource",
"=",
"Config",
".",
"find",
"(",
"pc",
",",
"Config",
".",
"SQL_DATA_SOURCE",
")",
";",
"}",
"if",
"(",
"rawDataSource",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"/*\n\t * If the 'dataSource' attribute's value resolves to a String\n\t * after rtexpr/EL evaluation, use the string as JNDI path to\n\t * a DataSource\n\t */",
"if",
"(",
"rawDataSource",
"instanceof",
"String",
")",
"{",
"try",
"{",
"Context",
"ctx",
"=",
"new",
"InitialContext",
"(",
")",
";",
"// relative to standard JNDI root for J2EE app",
"Context",
"envCtx",
"=",
"(",
"Context",
")",
"ctx",
".",
"lookup",
"(",
"\"java:comp/env\"",
")",
";",
"dataSource",
"=",
"(",
"DataSource",
")",
"envCtx",
".",
"lookup",
"(",
"(",
"String",
")",
"rawDataSource",
")",
";",
"}",
"catch",
"(",
"NamingException",
"ex",
")",
"{",
"dataSource",
"=",
"getDataSource",
"(",
"(",
"String",
")",
"rawDataSource",
")",
";",
"}",
"}",
"else",
"if",
"(",
"rawDataSource",
"instanceof",
"DataSource",
")",
"{",
"dataSource",
"=",
"(",
"DataSource",
")",
"rawDataSource",
";",
"}",
"else",
"{",
"throw",
"new",
"JspException",
"(",
"Resources",
".",
"getMessage",
"(",
"\"SQL_DATASOURCE_INVALID_TYPE\"",
")",
")",
";",
"}",
"return",
"dataSource",
";",
"}"
] | If dataSource is a String first do JNDI lookup.
If lookup fails parse String like it was a set of JDBC parameters
Otherwise check to see if dataSource is a DataSource object and use as
is | [
"If",
"dataSource",
"is",
"a",
"String",
"first",
"do",
"JNDI",
"lookup",
".",
"If",
"lookup",
"fails",
"parse",
"String",
"like",
"it",
"was",
"a",
"set",
"of",
"JDBC",
"parameters",
"Otherwise",
"check",
"to",
"see",
"if",
"dataSource",
"is",
"a",
"DataSource",
"object",
"and",
"use",
"as",
"is"
] | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceUtil.java#L50-L84 |
apache/groovy | src/main/groovy/groovy/ui/GroovyMain.java | GroovyMain.processFile | private void processFile(Script s, File file) throws IOException {
"""
Process a single input file.
@param s the script to execute.
@param file the input file.
"""
if (!file.exists())
throw new FileNotFoundException(file.getName());
if (!editFiles) {
try(BufferedReader reader = new BufferedReader(new FileReader(file))) {
PrintWriter writer = new PrintWriter(System.out);
processReader(s, reader, writer);
writer.flush();
}
} else {
File backup;
if (backupExtension == null) {
backup = File.createTempFile("groovy_", ".tmp");
backup.deleteOnExit();
} else {
backup = new File(file.getPath() + backupExtension);
}
backup.delete();
if (!file.renameTo(backup))
throw new IOException("unable to rename " + file + " to " + backup);
try(BufferedReader reader = new BufferedReader(new FileReader(backup));
PrintWriter writer = new PrintWriter(new FileWriter(file))) {
processReader(s, reader, writer);
}
}
} | java | private void processFile(Script s, File file) throws IOException {
if (!file.exists())
throw new FileNotFoundException(file.getName());
if (!editFiles) {
try(BufferedReader reader = new BufferedReader(new FileReader(file))) {
PrintWriter writer = new PrintWriter(System.out);
processReader(s, reader, writer);
writer.flush();
}
} else {
File backup;
if (backupExtension == null) {
backup = File.createTempFile("groovy_", ".tmp");
backup.deleteOnExit();
} else {
backup = new File(file.getPath() + backupExtension);
}
backup.delete();
if (!file.renameTo(backup))
throw new IOException("unable to rename " + file + " to " + backup);
try(BufferedReader reader = new BufferedReader(new FileReader(backup));
PrintWriter writer = new PrintWriter(new FileWriter(file))) {
processReader(s, reader, writer);
}
}
} | [
"private",
"void",
"processFile",
"(",
"Script",
"s",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"throw",
"new",
"FileNotFoundException",
"(",
"file",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"!",
"editFiles",
")",
"{",
"try",
"(",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"file",
")",
")",
")",
"{",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter",
"(",
"System",
".",
"out",
")",
";",
"processReader",
"(",
"s",
",",
"reader",
",",
"writer",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"}",
"}",
"else",
"{",
"File",
"backup",
";",
"if",
"(",
"backupExtension",
"==",
"null",
")",
"{",
"backup",
"=",
"File",
".",
"createTempFile",
"(",
"\"groovy_\"",
",",
"\".tmp\"",
")",
";",
"backup",
".",
"deleteOnExit",
"(",
")",
";",
"}",
"else",
"{",
"backup",
"=",
"new",
"File",
"(",
"file",
".",
"getPath",
"(",
")",
"+",
"backupExtension",
")",
";",
"}",
"backup",
".",
"delete",
"(",
")",
";",
"if",
"(",
"!",
"file",
".",
"renameTo",
"(",
"backup",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"unable to rename \"",
"+",
"file",
"+",
"\" to \"",
"+",
"backup",
")",
";",
"try",
"(",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"backup",
")",
")",
";",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter",
"(",
"new",
"FileWriter",
"(",
"file",
")",
")",
")",
"{",
"processReader",
"(",
"s",
",",
"reader",
",",
"writer",
")",
";",
"}",
"}",
"}"
] | Process a single input file.
@param s the script to execute.
@param file the input file. | [
"Process",
"a",
"single",
"input",
"file",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/ui/GroovyMain.java#L511-L540 |
rhuss/jolokia | agent/osgi/src/main/java/org/jolokia/osgi/security/DelegatingRestrictor.java | DelegatingRestrictor.checkRestrictorService | private boolean checkRestrictorService(RestrictorCheck pCheck, Object ... args) {
"""
Actual check which delegate to one or more restrictor services if available.
@param pCheck a function object for performing the actual check
@param args arguments passed through to the check
@return true if all checks return true
"""
try {
ServiceReference[] serviceRefs = bundleContext.getServiceReferences(Restrictor.class.getName(),null);
if (serviceRefs != null) {
boolean ret = true;
boolean found = false;
for (ServiceReference serviceRef : serviceRefs) {
Restrictor restrictor = (Restrictor) bundleContext.getService(serviceRef);
if (restrictor != null) {
ret = ret && pCheck.check(restrictor,args);
found = true;
}
}
return found && ret;
} else {
return false;
}
} catch (InvalidSyntaxException e) {
// Will not happen, since we dont use a filter here
throw new IllegalArgumentException("Impossible exception (we don't use a filter for fetching the services)",e);
}
} | java | private boolean checkRestrictorService(RestrictorCheck pCheck, Object ... args) {
try {
ServiceReference[] serviceRefs = bundleContext.getServiceReferences(Restrictor.class.getName(),null);
if (serviceRefs != null) {
boolean ret = true;
boolean found = false;
for (ServiceReference serviceRef : serviceRefs) {
Restrictor restrictor = (Restrictor) bundleContext.getService(serviceRef);
if (restrictor != null) {
ret = ret && pCheck.check(restrictor,args);
found = true;
}
}
return found && ret;
} else {
return false;
}
} catch (InvalidSyntaxException e) {
// Will not happen, since we dont use a filter here
throw new IllegalArgumentException("Impossible exception (we don't use a filter for fetching the services)",e);
}
} | [
"private",
"boolean",
"checkRestrictorService",
"(",
"RestrictorCheck",
"pCheck",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"ServiceReference",
"[",
"]",
"serviceRefs",
"=",
"bundleContext",
".",
"getServiceReferences",
"(",
"Restrictor",
".",
"class",
".",
"getName",
"(",
")",
",",
"null",
")",
";",
"if",
"(",
"serviceRefs",
"!=",
"null",
")",
"{",
"boolean",
"ret",
"=",
"true",
";",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"ServiceReference",
"serviceRef",
":",
"serviceRefs",
")",
"{",
"Restrictor",
"restrictor",
"=",
"(",
"Restrictor",
")",
"bundleContext",
".",
"getService",
"(",
"serviceRef",
")",
";",
"if",
"(",
"restrictor",
"!=",
"null",
")",
"{",
"ret",
"=",
"ret",
"&&",
"pCheck",
".",
"check",
"(",
"restrictor",
",",
"args",
")",
";",
"found",
"=",
"true",
";",
"}",
"}",
"return",
"found",
"&&",
"ret",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"catch",
"(",
"InvalidSyntaxException",
"e",
")",
"{",
"// Will not happen, since we dont use a filter here",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Impossible exception (we don't use a filter for fetching the services)\"",
",",
"e",
")",
";",
"}",
"}"
] | Actual check which delegate to one or more restrictor services if available.
@param pCheck a function object for performing the actual check
@param args arguments passed through to the check
@return true if all checks return true | [
"Actual",
"check",
"which",
"delegate",
"to",
"one",
"or",
"more",
"restrictor",
"services",
"if",
"available",
"."
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/osgi/src/main/java/org/jolokia/osgi/security/DelegatingRestrictor.java#L52-L73 |
codeborne/mobileid | src/com/codeborne/security/mobileid/MobileIDAuthenticator.java | MobileIDAuthenticator.startLogin | public MobileIDSession startLogin(String personalCode, String countryCode) {
"""
Initiates the login session. Note: returned session already contains user's info, but the authenticity is not yet verified.
@param personalCode user's personal code
@param countryCode two letter country code, eg EE
@throws AuthenticationException is authentication unsuccessful
@return MobileIDSession instance containing CHALLENGE ID that should be shown to the user
"""
return startLogin(personalCode, countryCode, null);
} | java | public MobileIDSession startLogin(String personalCode, String countryCode) {
return startLogin(personalCode, countryCode, null);
} | [
"public",
"MobileIDSession",
"startLogin",
"(",
"String",
"personalCode",
",",
"String",
"countryCode",
")",
"{",
"return",
"startLogin",
"(",
"personalCode",
",",
"countryCode",
",",
"null",
")",
";",
"}"
] | Initiates the login session. Note: returned session already contains user's info, but the authenticity is not yet verified.
@param personalCode user's personal code
@param countryCode two letter country code, eg EE
@throws AuthenticationException is authentication unsuccessful
@return MobileIDSession instance containing CHALLENGE ID that should be shown to the user | [
"Initiates",
"the",
"login",
"session",
".",
"Note",
":",
"returned",
"session",
"already",
"contains",
"user",
"s",
"info",
"but",
"the",
"authenticity",
"is",
"not",
"yet",
"verified",
"."
] | train | https://github.com/codeborne/mobileid/blob/27447009922f7a1f80c956c2ee5e9ff7a17d7bfc/src/com/codeborne/security/mobileid/MobileIDAuthenticator.java#L102-L104 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java | OAuthFlowImpl.obtainNewToken | public Token obtainNewToken(AuthorizationResult authorizationResult) throws OAuthTokenException, JSONSerializerException, HttpClientException,
URISyntaxException, InvalidRequestException {
"""
Obtain a new token using AuthorizationResult.
Exceptions:
- IllegalArgumentException : if authorizationResult is null
- InvalidTokenRequestException : if the token request is invalid (note that this won't really happen in current implementation)
- InvalidOAuthClientException : if the client information is invalid
- InvalidOAuthGrantException : if the authorization code or refresh token is invalid or expired, the
redirect_uri does not match, or the hash value does not match the client secret and/or code
- UnsupportedOAuthGrantTypeException : if the grant type is invalid (note that this won't really happen in
current implementation)
- OAuthTokenException : if any other error occurred during the operation
@param authorizationResult the authorization result
@return the token
@throws NoSuchAlgorithmException the no such algorithm exception
@throws UnsupportedEncodingException the unsupported encoding exception
@throws OAuthTokenException the o auth token exception
@throws JSONSerializerException the JSON serializer exception
@throws HttpClientException the http client exception
@throws URISyntaxException the URI syntax exception
@throws InvalidRequestException the invalid request exception
"""
if(authorizationResult == null){
throw new IllegalArgumentException();
}
// Prepare the hash
String doHash = clientSecret + "|" + authorizationResult.getCode();
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Your JVM does not support SHA-256, which is required for OAuth with Smartsheet.", e);
}
byte[] digest;
try {
digest = md.digest(doHash.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
//String hash = javax.xml.bind.DatatypeConverter.printHexBinary(digest);
String hash = org.apache.commons.codec.binary.Hex.encodeHexString(digest);
// create a Map of the parameters
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("grant_type", "authorization_code");
params.put("client_id", clientId);
params.put("code", authorizationResult.getCode());
params.put("redirect_uri",redirectURL);
params.put("hash", hash);
// Generate the URL and then get the token
return requestToken(QueryUtil.generateUrl(tokenURL, params));
} | java | public Token obtainNewToken(AuthorizationResult authorizationResult) throws OAuthTokenException, JSONSerializerException, HttpClientException,
URISyntaxException, InvalidRequestException {
if(authorizationResult == null){
throw new IllegalArgumentException();
}
// Prepare the hash
String doHash = clientSecret + "|" + authorizationResult.getCode();
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Your JVM does not support SHA-256, which is required for OAuth with Smartsheet.", e);
}
byte[] digest;
try {
digest = md.digest(doHash.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
//String hash = javax.xml.bind.DatatypeConverter.printHexBinary(digest);
String hash = org.apache.commons.codec.binary.Hex.encodeHexString(digest);
// create a Map of the parameters
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("grant_type", "authorization_code");
params.put("client_id", clientId);
params.put("code", authorizationResult.getCode());
params.put("redirect_uri",redirectURL);
params.put("hash", hash);
// Generate the URL and then get the token
return requestToken(QueryUtil.generateUrl(tokenURL, params));
} | [
"public",
"Token",
"obtainNewToken",
"(",
"AuthorizationResult",
"authorizationResult",
")",
"throws",
"OAuthTokenException",
",",
"JSONSerializerException",
",",
"HttpClientException",
",",
"URISyntaxException",
",",
"InvalidRequestException",
"{",
"if",
"(",
"authorizationResult",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"// Prepare the hash",
"String",
"doHash",
"=",
"clientSecret",
"+",
"\"|\"",
"+",
"authorizationResult",
".",
"getCode",
"(",
")",
";",
"MessageDigest",
"md",
";",
"try",
"{",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"SHA-256\"",
")",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Your JVM does not support SHA-256, which is required for OAuth with Smartsheet.\"",
",",
"e",
")",
";",
"}",
"byte",
"[",
"]",
"digest",
";",
"try",
"{",
"digest",
"=",
"md",
".",
"digest",
"(",
"doHash",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"//String hash = javax.xml.bind.DatatypeConverter.printHexBinary(digest);",
"String",
"hash",
"=",
"org",
".",
"apache",
".",
"commons",
".",
"codec",
".",
"binary",
".",
"Hex",
".",
"encodeHexString",
"(",
"digest",
")",
";",
"// create a Map of the parameters",
"HashMap",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"grant_type\"",
",",
"\"authorization_code\"",
")",
";",
"params",
".",
"put",
"(",
"\"client_id\"",
",",
"clientId",
")",
";",
"params",
".",
"put",
"(",
"\"code\"",
",",
"authorizationResult",
".",
"getCode",
"(",
")",
")",
";",
"params",
".",
"put",
"(",
"\"redirect_uri\"",
",",
"redirectURL",
")",
";",
"params",
".",
"put",
"(",
"\"hash\"",
",",
"hash",
")",
";",
"// Generate the URL and then get the token",
"return",
"requestToken",
"(",
"QueryUtil",
".",
"generateUrl",
"(",
"tokenURL",
",",
"params",
")",
")",
";",
"}"
] | Obtain a new token using AuthorizationResult.
Exceptions:
- IllegalArgumentException : if authorizationResult is null
- InvalidTokenRequestException : if the token request is invalid (note that this won't really happen in current implementation)
- InvalidOAuthClientException : if the client information is invalid
- InvalidOAuthGrantException : if the authorization code or refresh token is invalid or expired, the
redirect_uri does not match, or the hash value does not match the client secret and/or code
- UnsupportedOAuthGrantTypeException : if the grant type is invalid (note that this won't really happen in
current implementation)
- OAuthTokenException : if any other error occurred during the operation
@param authorizationResult the authorization result
@return the token
@throws NoSuchAlgorithmException the no such algorithm exception
@throws UnsupportedEncodingException the unsupported encoding exception
@throws OAuthTokenException the o auth token exception
@throws JSONSerializerException the JSON serializer exception
@throws HttpClientException the http client exception
@throws URISyntaxException the URI syntax exception
@throws InvalidRequestException the invalid request exception | [
"Obtain",
"a",
"new",
"token",
"using",
"AuthorizationResult",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java#L243-L278 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java | CPDefinitionPersistenceImpl.removeByLtD_S | @Override
public void removeByLtD_S(Date displayDate, int status) {
"""
Removes all the cp definitions where displayDate < ? and status = ? from the database.
@param displayDate the display date
@param status the status
"""
for (CPDefinition cpDefinition : findByLtD_S(displayDate, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition);
}
} | java | @Override
public void removeByLtD_S(Date displayDate, int status) {
for (CPDefinition cpDefinition : findByLtD_S(displayDate, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition);
}
} | [
"@",
"Override",
"public",
"void",
"removeByLtD_S",
"(",
"Date",
"displayDate",
",",
"int",
"status",
")",
"{",
"for",
"(",
"CPDefinition",
"cpDefinition",
":",
"findByLtD_S",
"(",
"displayDate",
",",
"status",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
")",
"{",
"remove",
"(",
"cpDefinition",
")",
";",
"}",
"}"
] | Removes all the cp definitions where displayDate < ? and status = ? from the database.
@param displayDate the display date
@param status the status | [
"Removes",
"all",
"the",
"cp",
"definitions",
"where",
"displayDate",
"<",
";",
"?",
";",
"and",
"status",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L5099-L5105 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/socks/ProxyServer.java | ProxyServer.start | public void start(int port,int backlog,InetAddress localIP) {
"""
Create a server with the specified port, listen backlog, and local
IP address to bind to. The localIP argument can be used on a multi-homed
host for a ServerSocket that will only accept connect requests to one of
its addresses. If localIP is null, it will default accepting connections
on any/all local addresses. The port must be between 0 and 65535,
inclusive. <br>
This methods blocks.
"""
try{
ss = new ServerSocket(port,backlog,localIP);
log("Starting SOCKS Proxy on:"+ss.getInetAddress().getHostAddress()+":"
+ss.getLocalPort());
while(true){
Socket s = ss.accept();
log("Accepted from:"+s.getInetAddress().getHostName()+":"
+s.getPort());
ProxyServer ps = new ProxyServer(auth,s, agent);
(new Thread(ps)).start();
}
}catch(IOException ioe){
ioe.printStackTrace();
}finally{
}
} | java | public void start(int port,int backlog,InetAddress localIP){
try{
ss = new ServerSocket(port,backlog,localIP);
log("Starting SOCKS Proxy on:"+ss.getInetAddress().getHostAddress()+":"
+ss.getLocalPort());
while(true){
Socket s = ss.accept();
log("Accepted from:"+s.getInetAddress().getHostName()+":"
+s.getPort());
ProxyServer ps = new ProxyServer(auth,s, agent);
(new Thread(ps)).start();
}
}catch(IOException ioe){
ioe.printStackTrace();
}finally{
}
} | [
"public",
"void",
"start",
"(",
"int",
"port",
",",
"int",
"backlog",
",",
"InetAddress",
"localIP",
")",
"{",
"try",
"{",
"ss",
"=",
"new",
"ServerSocket",
"(",
"port",
",",
"backlog",
",",
"localIP",
")",
";",
"log",
"(",
"\"Starting SOCKS Proxy on:\"",
"+",
"ss",
".",
"getInetAddress",
"(",
")",
".",
"getHostAddress",
"(",
")",
"+",
"\":\"",
"+",
"ss",
".",
"getLocalPort",
"(",
")",
")",
";",
"while",
"(",
"true",
")",
"{",
"Socket",
"s",
"=",
"ss",
".",
"accept",
"(",
")",
";",
"log",
"(",
"\"Accepted from:\"",
"+",
"s",
".",
"getInetAddress",
"(",
")",
".",
"getHostName",
"(",
")",
"+",
"\":\"",
"+",
"s",
".",
"getPort",
"(",
")",
")",
";",
"ProxyServer",
"ps",
"=",
"new",
"ProxyServer",
"(",
"auth",
",",
"s",
",",
"agent",
")",
";",
"(",
"new",
"Thread",
"(",
"ps",
")",
")",
".",
"start",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"ioe",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"}",
"}"
] | Create a server with the specified port, listen backlog, and local
IP address to bind to. The localIP argument can be used on a multi-homed
host for a ServerSocket that will only accept connect requests to one of
its addresses. If localIP is null, it will default accepting connections
on any/all local addresses. The port must be between 0 and 65535,
inclusive. <br>
This methods blocks. | [
"Create",
"a",
"server",
"with",
"the",
"specified",
"port",
"listen",
"backlog",
"and",
"local",
"IP",
"address",
"to",
"bind",
"to",
".",
"The",
"localIP",
"argument",
"can",
"be",
"used",
"on",
"a",
"multi",
"-",
"homed",
"host",
"for",
"a",
"ServerSocket",
"that",
"will",
"only",
"accept",
"connect",
"requests",
"to",
"one",
"of",
"its",
"addresses",
".",
"If",
"localIP",
"is",
"null",
"it",
"will",
"default",
"accepting",
"connections",
"on",
"any",
"/",
"all",
"local",
"addresses",
".",
"The",
"port",
"must",
"be",
"between",
"0",
"and",
"65535",
"inclusive",
".",
"<br",
">",
"This",
"methods",
"blocks",
"."
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/ProxyServer.java#L208-L224 |
lemire/JavaFastPFOR | src/main/java/me/lemire/integercompression/Util.java | Util.maxdiffbits | public static int maxdiffbits(int initoffset, int[] i, int pos, int length) {
"""
Compute the maximum of the integer logarithms (ceil(log(x+1)) of a the
successive differences (deltas) of a range of value
@param initoffset
initial vallue for the computation of the deltas
@param i
source array
@param pos
starting position
@param length
number of integers to consider
@return integer logarithm
"""
int mask = 0;
mask |= (i[pos] - initoffset);
for (int k = pos + 1; k < pos + length; ++k) {
mask |= i[k] - i[k - 1];
}
return bits(mask);
} | java | public static int maxdiffbits(int initoffset, int[] i, int pos, int length) {
int mask = 0;
mask |= (i[pos] - initoffset);
for (int k = pos + 1; k < pos + length; ++k) {
mask |= i[k] - i[k - 1];
}
return bits(mask);
} | [
"public",
"static",
"int",
"maxdiffbits",
"(",
"int",
"initoffset",
",",
"int",
"[",
"]",
"i",
",",
"int",
"pos",
",",
"int",
"length",
")",
"{",
"int",
"mask",
"=",
"0",
";",
"mask",
"|=",
"(",
"i",
"[",
"pos",
"]",
"-",
"initoffset",
")",
";",
"for",
"(",
"int",
"k",
"=",
"pos",
"+",
"1",
";",
"k",
"<",
"pos",
"+",
"length",
";",
"++",
"k",
")",
"{",
"mask",
"|=",
"i",
"[",
"k",
"]",
"-",
"i",
"[",
"k",
"-",
"1",
"]",
";",
"}",
"return",
"bits",
"(",
"mask",
")",
";",
"}"
] | Compute the maximum of the integer logarithms (ceil(log(x+1)) of a the
successive differences (deltas) of a range of value
@param initoffset
initial vallue for the computation of the deltas
@param i
source array
@param pos
starting position
@param length
number of integers to consider
@return integer logarithm | [
"Compute",
"the",
"maximum",
"of",
"the",
"integer",
"logarithms",
"(",
"ceil",
"(",
"log",
"(",
"x",
"+",
"1",
"))",
"of",
"a",
"the",
"successive",
"differences",
"(",
"deltas",
")",
"of",
"a",
"range",
"of",
"value"
] | train | https://github.com/lemire/JavaFastPFOR/blob/ffeea61ab2fdb3854da7b0a557f8d22d674477f4/src/main/java/me/lemire/integercompression/Util.java#L93-L100 |
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.addCompileStaticAnnotation | public static AnnotatedNode addCompileStaticAnnotation(AnnotatedNode annotatedNode, boolean skip) {
"""
Adds @CompileStatic annotation to method
@param annotatedNode
@param skip
@return The annotated method
"""
if(annotatedNode != null) {
AnnotationNode an = new AnnotationNode(COMPILESTATIC_CLASS_NODE);
if(skip) {
an.addMember("value", new PropertyExpression(new ClassExpression(TYPECHECKINGMODE_CLASS_NODE), "SKIP"));
}
annotatedNode.addAnnotation(an);
if(!skip) {
annotatedNode.getDeclaringClass().addTransform(StaticCompileTransformation.class, an);
}
}
return annotatedNode;
} | java | public static AnnotatedNode addCompileStaticAnnotation(AnnotatedNode annotatedNode, boolean skip) {
if(annotatedNode != null) {
AnnotationNode an = new AnnotationNode(COMPILESTATIC_CLASS_NODE);
if(skip) {
an.addMember("value", new PropertyExpression(new ClassExpression(TYPECHECKINGMODE_CLASS_NODE), "SKIP"));
}
annotatedNode.addAnnotation(an);
if(!skip) {
annotatedNode.getDeclaringClass().addTransform(StaticCompileTransformation.class, an);
}
}
return annotatedNode;
} | [
"public",
"static",
"AnnotatedNode",
"addCompileStaticAnnotation",
"(",
"AnnotatedNode",
"annotatedNode",
",",
"boolean",
"skip",
")",
"{",
"if",
"(",
"annotatedNode",
"!=",
"null",
")",
"{",
"AnnotationNode",
"an",
"=",
"new",
"AnnotationNode",
"(",
"COMPILESTATIC_CLASS_NODE",
")",
";",
"if",
"(",
"skip",
")",
"{",
"an",
".",
"addMember",
"(",
"\"value\"",
",",
"new",
"PropertyExpression",
"(",
"new",
"ClassExpression",
"(",
"TYPECHECKINGMODE_CLASS_NODE",
")",
",",
"\"SKIP\"",
")",
")",
";",
"}",
"annotatedNode",
".",
"addAnnotation",
"(",
"an",
")",
";",
"if",
"(",
"!",
"skip",
")",
"{",
"annotatedNode",
".",
"getDeclaringClass",
"(",
")",
".",
"addTransform",
"(",
"StaticCompileTransformation",
".",
"class",
",",
"an",
")",
";",
"}",
"}",
"return",
"annotatedNode",
";",
"}"
] | Adds @CompileStatic annotation to method
@param annotatedNode
@param skip
@return The annotated method | [
"Adds",
"@CompileStatic",
"annotation",
"to",
"method"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L1178-L1190 |
revelytix/spark | spark-http-client/src/main/java/spark/protocol/parser/XMLResultsParser.java | XMLResultsParser.parseResults | public static Result parseResults(Command cmd, InputStream input, ResultType type) throws SparqlException {
"""
Parses an XMLResults object based on the contents of the given stream.
@param cmd The command that originated the request.
@param stream The input stream containing raw XML.
@param query The query used to generate the stream.
@return A new XMLResults object. Either variable bindings, or a boolean result.
@throws SparqlException If the data stream was not valid.
"""
try {
return createResults(cmd, input, type);
} catch (Throwable t) {
logger.debug("Error parsing results from stream, cleaning up.");
try {
input.close();
} catch (IOException e) {
logger.warn("Error closing input stream from failed protocol response", e);
}
throw SparqlException.convert("Error parsing SPARQL protocol results from stream", t);
}
} | java | public static Result parseResults(Command cmd, InputStream input, ResultType type) throws SparqlException {
try {
return createResults(cmd, input, type);
} catch (Throwable t) {
logger.debug("Error parsing results from stream, cleaning up.");
try {
input.close();
} catch (IOException e) {
logger.warn("Error closing input stream from failed protocol response", e);
}
throw SparqlException.convert("Error parsing SPARQL protocol results from stream", t);
}
} | [
"public",
"static",
"Result",
"parseResults",
"(",
"Command",
"cmd",
",",
"InputStream",
"input",
",",
"ResultType",
"type",
")",
"throws",
"SparqlException",
"{",
"try",
"{",
"return",
"createResults",
"(",
"cmd",
",",
"input",
",",
"type",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Error parsing results from stream, cleaning up.\"",
")",
";",
"try",
"{",
"input",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Error closing input stream from failed protocol response\"",
",",
"e",
")",
";",
"}",
"throw",
"SparqlException",
".",
"convert",
"(",
"\"Error parsing SPARQL protocol results from stream\"",
",",
"t",
")",
";",
"}",
"}"
] | Parses an XMLResults object based on the contents of the given stream.
@param cmd The command that originated the request.
@param stream The input stream containing raw XML.
@param query The query used to generate the stream.
@return A new XMLResults object. Either variable bindings, or a boolean result.
@throws SparqlException If the data stream was not valid. | [
"Parses",
"an",
"XMLResults",
"object",
"based",
"on",
"the",
"contents",
"of",
"the",
"given",
"stream",
"."
] | train | https://github.com/revelytix/spark/blob/d777d40c962bc66fdc04b7c3a66d20b777ff6fb4/spark-http-client/src/main/java/spark/protocol/parser/XMLResultsParser.java#L93-L105 |
Indoqa/logspace | logspace-agent-controller/src/main/java/io/logspace/agent/scheduling/AgentScheduler.java | AgentScheduler.loadQuartzProperties | private Properties loadQuartzProperties() {
"""
The properties file will be loaded and the keys will be prepended with the QUARTZ_PREFIX. <br/>
If a value contains the literal PACKAGE_PLACEHOLDER the literal will be replaced with the QUARTZ_PREFIX.
@return The modified quartz properties with aligned packagenames in keys and values.
"""
InputStream resourceStream = AgentScheduler.class.getResourceAsStream("/logspace-quartz.properties");
try {
Properties properties = new Properties();
properties.load(resourceStream);
List<Object> keys = new ArrayList<Object>(properties.keySet());
for (Object eachKey : keys) {
String key = eachKey.toString();
properties.put(QUARTZ_PREFIX + key, this.replacePackagePlaceholderIfNecessary(properties.get(key)));
properties.remove(key);
}
return properties;
} catch (Exception e) {
throw new AgentControllerInitializationException("Error loading logspace-quartz.properties.", e);
} finally {
try {
resourceStream.close();
} catch (IOException e) {
// do nothing
}
}
} | java | private Properties loadQuartzProperties() {
InputStream resourceStream = AgentScheduler.class.getResourceAsStream("/logspace-quartz.properties");
try {
Properties properties = new Properties();
properties.load(resourceStream);
List<Object> keys = new ArrayList<Object>(properties.keySet());
for (Object eachKey : keys) {
String key = eachKey.toString();
properties.put(QUARTZ_PREFIX + key, this.replacePackagePlaceholderIfNecessary(properties.get(key)));
properties.remove(key);
}
return properties;
} catch (Exception e) {
throw new AgentControllerInitializationException("Error loading logspace-quartz.properties.", e);
} finally {
try {
resourceStream.close();
} catch (IOException e) {
// do nothing
}
}
} | [
"private",
"Properties",
"loadQuartzProperties",
"(",
")",
"{",
"InputStream",
"resourceStream",
"=",
"AgentScheduler",
".",
"class",
".",
"getResourceAsStream",
"(",
"\"/logspace-quartz.properties\"",
")",
";",
"try",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"load",
"(",
"resourceStream",
")",
";",
"List",
"<",
"Object",
">",
"keys",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
"properties",
".",
"keySet",
"(",
")",
")",
";",
"for",
"(",
"Object",
"eachKey",
":",
"keys",
")",
"{",
"String",
"key",
"=",
"eachKey",
".",
"toString",
"(",
")",
";",
"properties",
".",
"put",
"(",
"QUARTZ_PREFIX",
"+",
"key",
",",
"this",
".",
"replacePackagePlaceholderIfNecessary",
"(",
"properties",
".",
"get",
"(",
"key",
")",
")",
")",
";",
"properties",
".",
"remove",
"(",
"key",
")",
";",
"}",
"return",
"properties",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"AgentControllerInitializationException",
"(",
"\"Error loading logspace-quartz.properties.\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"resourceStream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// do nothing",
"}",
"}",
"}"
] | The properties file will be loaded and the keys will be prepended with the QUARTZ_PREFIX. <br/>
If a value contains the literal PACKAGE_PLACEHOLDER the literal will be replaced with the QUARTZ_PREFIX.
@return The modified quartz properties with aligned packagenames in keys and values. | [
"The",
"properties",
"file",
"will",
"be",
"loaded",
"and",
"the",
"keys",
"will",
"be",
"prepended",
"with",
"the",
"QUARTZ_PREFIX",
".",
"<br",
"/",
">",
"If",
"a",
"value",
"contains",
"the",
"literal",
"PACKAGE_PLACEHOLDER",
"the",
"literal",
"will",
"be",
"replaced",
"with",
"the",
"QUARTZ_PREFIX",
"."
] | train | https://github.com/Indoqa/logspace/blob/781a3f1da0580542d7dd726cac8eafecb090663d/logspace-agent-controller/src/main/java/io/logspace/agent/scheduling/AgentScheduler.java#L175-L200 |
likethecolor/Alchemy-API | src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java | AbstractParser.getString | protected String getString(final int index, final JSONArray jsonArray) {
"""
Check to make sure the JSONObject has the specified key and if so return
the value as a string. If no key is found "" is returned.
@param index index of the field to fetch from the json array
@param jsonArray array from which to fetch the value
@return string value corresponding to the index or null if index not found
"""
String value = null;
if(jsonArray != null && index > -1 && jsonArray.length() > index) {
try {
Object o = jsonArray.get(index);
if(o != null) {
value = o.toString();
}
}
catch(JSONException e) {
LOGGER.error("Could not get String from JSONObject for index: " + index, e);
}
}
return value;
} | java | protected String getString(final int index, final JSONArray jsonArray) {
String value = null;
if(jsonArray != null && index > -1 && jsonArray.length() > index) {
try {
Object o = jsonArray.get(index);
if(o != null) {
value = o.toString();
}
}
catch(JSONException e) {
LOGGER.error("Could not get String from JSONObject for index: " + index, e);
}
}
return value;
} | [
"protected",
"String",
"getString",
"(",
"final",
"int",
"index",
",",
"final",
"JSONArray",
"jsonArray",
")",
"{",
"String",
"value",
"=",
"null",
";",
"if",
"(",
"jsonArray",
"!=",
"null",
"&&",
"index",
">",
"-",
"1",
"&&",
"jsonArray",
".",
"length",
"(",
")",
">",
"index",
")",
"{",
"try",
"{",
"Object",
"o",
"=",
"jsonArray",
".",
"get",
"(",
"index",
")",
";",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"value",
"=",
"o",
".",
"toString",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Could not get String from JSONObject for index: \"",
"+",
"index",
",",
"e",
")",
";",
"}",
"}",
"return",
"value",
";",
"}"
] | Check to make sure the JSONObject has the specified key and if so return
the value as a string. If no key is found "" is returned.
@param index index of the field to fetch from the json array
@param jsonArray array from which to fetch the value
@return string value corresponding to the index or null if index not found | [
"Check",
"to",
"make",
"sure",
"the",
"JSONObject",
"has",
"the",
"specified",
"key",
"and",
"if",
"so",
"return",
"the",
"value",
"as",
"a",
"string",
".",
"If",
"no",
"key",
"is",
"found",
"is",
"returned",
"."
] | train | https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java#L230-L244 |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexFuture.java | VortexFuture.threwException | @Private
@Override
public void threwException(final int pTaskletId, final Exception exception) {
"""
Called by VortexMaster to let the user know that the Tasklet threw an exception.
"""
assert taskletId == pTaskletId;
this.userException = exception;
if (callbackHandler != null) {
executor.execute(new Runnable() {
@Override
public void run() {
callbackHandler.onFailure(exception);
}
});
}
this.countDownLatch.countDown();
} | java | @Private
@Override
public void threwException(final int pTaskletId, final Exception exception) {
assert taskletId == pTaskletId;
this.userException = exception;
if (callbackHandler != null) {
executor.execute(new Runnable() {
@Override
public void run() {
callbackHandler.onFailure(exception);
}
});
}
this.countDownLatch.countDown();
} | [
"@",
"Private",
"@",
"Override",
"public",
"void",
"threwException",
"(",
"final",
"int",
"pTaskletId",
",",
"final",
"Exception",
"exception",
")",
"{",
"assert",
"taskletId",
"==",
"pTaskletId",
";",
"this",
".",
"userException",
"=",
"exception",
";",
"if",
"(",
"callbackHandler",
"!=",
"null",
")",
"{",
"executor",
".",
"execute",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"callbackHandler",
".",
"onFailure",
"(",
"exception",
")",
";",
"}",
"}",
")",
";",
"}",
"this",
".",
"countDownLatch",
".",
"countDown",
"(",
")",
";",
"}"
] | Called by VortexMaster to let the user know that the Tasklet threw an exception. | [
"Called",
"by",
"VortexMaster",
"to",
"let",
"the",
"user",
"know",
"that",
"the",
"Tasklet",
"threw",
"an",
"exception",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexFuture.java#L210-L225 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.setFieldValue | public static void setFieldValue(Object object, String fieldName, Object value) {
"""
Set instance or class field value. Try to set field value throwing exception if field not found. If
<code>object</code> argument is a class, named field should be static; otherwise exception is thrown.
<p>
This setter tries to adapt <code>value</code> to field type: if <code>value</code> is a string and field type is
not, delegates {@link Converter#asObject(String, Class)}. Anyway, if <code>value</code> is not a string it should
be assignable to field type otherwise bug error is thrown.
@param object instance or class to set field value to,
@param fieldName field name,
@param value field value.
@throws IllegalArgumentException if <code>object</code> or <code>fieldName</code> argument is null.
@throws NoSuchBeingException if field not found.
@throws BugError if object is null and field is not static or if object is not null and field is static.
@throws BugError if value is not assignable to field type.
"""
Params.notNull(object, "Object instance or class");
Params.notNull(fieldName, "Field name");
if(object instanceof Class<?>) {
setFieldValue(null, (Class<?>)object, fieldName, value);
}
else {
setFieldValue(object, object.getClass(), fieldName, value);
}
} | java | public static void setFieldValue(Object object, String fieldName, Object value)
{
Params.notNull(object, "Object instance or class");
Params.notNull(fieldName, "Field name");
if(object instanceof Class<?>) {
setFieldValue(null, (Class<?>)object, fieldName, value);
}
else {
setFieldValue(object, object.getClass(), fieldName, value);
}
} | [
"public",
"static",
"void",
"setFieldValue",
"(",
"Object",
"object",
",",
"String",
"fieldName",
",",
"Object",
"value",
")",
"{",
"Params",
".",
"notNull",
"(",
"object",
",",
"\"Object instance or class\"",
")",
";",
"Params",
".",
"notNull",
"(",
"fieldName",
",",
"\"Field name\"",
")",
";",
"if",
"(",
"object",
"instanceof",
"Class",
"<",
"?",
">",
")",
"{",
"setFieldValue",
"(",
"null",
",",
"(",
"Class",
"<",
"?",
">",
")",
"object",
",",
"fieldName",
",",
"value",
")",
";",
"}",
"else",
"{",
"setFieldValue",
"(",
"object",
",",
"object",
".",
"getClass",
"(",
")",
",",
"fieldName",
",",
"value",
")",
";",
"}",
"}"
] | Set instance or class field value. Try to set field value throwing exception if field not found. If
<code>object</code> argument is a class, named field should be static; otherwise exception is thrown.
<p>
This setter tries to adapt <code>value</code> to field type: if <code>value</code> is a string and field type is
not, delegates {@link Converter#asObject(String, Class)}. Anyway, if <code>value</code> is not a string it should
be assignable to field type otherwise bug error is thrown.
@param object instance or class to set field value to,
@param fieldName field name,
@param value field value.
@throws IllegalArgumentException if <code>object</code> or <code>fieldName</code> argument is null.
@throws NoSuchBeingException if field not found.
@throws BugError if object is null and field is not static or if object is not null and field is static.
@throws BugError if value is not assignable to field type. | [
"Set",
"instance",
"or",
"class",
"field",
"value",
".",
"Try",
"to",
"set",
"field",
"value",
"throwing",
"exception",
"if",
"field",
"not",
"found",
".",
"If",
"<code",
">",
"object<",
"/",
"code",
">",
"argument",
"is",
"a",
"class",
"named",
"field",
"should",
"be",
"static",
";",
"otherwise",
"exception",
"is",
"thrown",
".",
"<p",
">",
"This",
"setter",
"tries",
"to",
"adapt",
"<code",
">",
"value<",
"/",
"code",
">",
"to",
"field",
"type",
":",
"if",
"<code",
">",
"value<",
"/",
"code",
">",
"is",
"a",
"string",
"and",
"field",
"type",
"is",
"not",
"delegates",
"{",
"@link",
"Converter#asObject",
"(",
"String",
"Class",
")",
"}",
".",
"Anyway",
"if",
"<code",
">",
"value<",
"/",
"code",
">",
"is",
"not",
"a",
"string",
"it",
"should",
"be",
"assignable",
"to",
"field",
"type",
"otherwise",
"bug",
"error",
"is",
"thrown",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L865-L875 |
Jasig/spring-portlet-contrib | spring-webmvc-portlet-contrib/src/main/java/org/jasig/springframework/web/portlet/context/PortletContextLoader.java | PortletContextLoader.configureAndRefreshPortletApplicationContext | protected void configureAndRefreshPortletApplicationContext(ConfigurablePortletApplicationContext pac, PortletContext pc) {
"""
<p>configureAndRefreshPortletApplicationContext.</p>
@param pac a {@link org.springframework.web.portlet.context.ConfigurablePortletApplicationContext} object.
@param pc a {@link javax.portlet.PortletContext} object.
"""
if (ObjectUtils.identityToString(pac).equals(pac.getId())) {
// The application context id is still set to its original default value
// -> assign a more useful id based on available information
String idParam = pc.getInitParameter(CONTEXT_ID_PARAM);
if (idParam != null) {
pac.setId(idParam);
}
else {
// Generate default id...
pac.setId(ConfigurablePortletApplicationContext.APPLICATION_CONTEXT_ID_PREFIX +
ObjectUtils.getDisplayString(pc.getPortletContextName()));
}
}
// Determine parent for root web application context, if any.
ApplicationContext parent = loadParentContext(pc);
pac.setParent(parent);
pac.setPortletContext(pc);
String initParameter = pc.getInitParameter(CONFIG_LOCATION_PARAM);
if (initParameter != null) {
pac.setConfigLocation(initParameter);
}
else {
try {
pac.setConfigLocation("/WEB-INF/portletApplicationContext.xml");
}
catch (UnsupportedOperationException e) {
//Ignore, may get triggered if the context doesn't support config locations
}
}
customizeContext(pc, pac);
pac.refresh();
} | java | protected void configureAndRefreshPortletApplicationContext(ConfigurablePortletApplicationContext pac, PortletContext pc) {
if (ObjectUtils.identityToString(pac).equals(pac.getId())) {
// The application context id is still set to its original default value
// -> assign a more useful id based on available information
String idParam = pc.getInitParameter(CONTEXT_ID_PARAM);
if (idParam != null) {
pac.setId(idParam);
}
else {
// Generate default id...
pac.setId(ConfigurablePortletApplicationContext.APPLICATION_CONTEXT_ID_PREFIX +
ObjectUtils.getDisplayString(pc.getPortletContextName()));
}
}
// Determine parent for root web application context, if any.
ApplicationContext parent = loadParentContext(pc);
pac.setParent(parent);
pac.setPortletContext(pc);
String initParameter = pc.getInitParameter(CONFIG_LOCATION_PARAM);
if (initParameter != null) {
pac.setConfigLocation(initParameter);
}
else {
try {
pac.setConfigLocation("/WEB-INF/portletApplicationContext.xml");
}
catch (UnsupportedOperationException e) {
//Ignore, may get triggered if the context doesn't support config locations
}
}
customizeContext(pc, pac);
pac.refresh();
} | [
"protected",
"void",
"configureAndRefreshPortletApplicationContext",
"(",
"ConfigurablePortletApplicationContext",
"pac",
",",
"PortletContext",
"pc",
")",
"{",
"if",
"(",
"ObjectUtils",
".",
"identityToString",
"(",
"pac",
")",
".",
"equals",
"(",
"pac",
".",
"getId",
"(",
")",
")",
")",
"{",
"// The application context id is still set to its original default value",
"// -> assign a more useful id based on available information",
"String",
"idParam",
"=",
"pc",
".",
"getInitParameter",
"(",
"CONTEXT_ID_PARAM",
")",
";",
"if",
"(",
"idParam",
"!=",
"null",
")",
"{",
"pac",
".",
"setId",
"(",
"idParam",
")",
";",
"}",
"else",
"{",
"// Generate default id...",
"pac",
".",
"setId",
"(",
"ConfigurablePortletApplicationContext",
".",
"APPLICATION_CONTEXT_ID_PREFIX",
"+",
"ObjectUtils",
".",
"getDisplayString",
"(",
"pc",
".",
"getPortletContextName",
"(",
")",
")",
")",
";",
"}",
"}",
"// Determine parent for root web application context, if any.",
"ApplicationContext",
"parent",
"=",
"loadParentContext",
"(",
"pc",
")",
";",
"pac",
".",
"setParent",
"(",
"parent",
")",
";",
"pac",
".",
"setPortletContext",
"(",
"pc",
")",
";",
"String",
"initParameter",
"=",
"pc",
".",
"getInitParameter",
"(",
"CONFIG_LOCATION_PARAM",
")",
";",
"if",
"(",
"initParameter",
"!=",
"null",
")",
"{",
"pac",
".",
"setConfigLocation",
"(",
"initParameter",
")",
";",
"}",
"else",
"{",
"try",
"{",
"pac",
".",
"setConfigLocation",
"(",
"\"/WEB-INF/portletApplicationContext.xml\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedOperationException",
"e",
")",
"{",
"//Ignore, may get triggered if the context doesn't support config locations",
"}",
"}",
"customizeContext",
"(",
"pc",
",",
"pac",
")",
";",
"pac",
".",
"refresh",
"(",
")",
";",
"}"
] | <p>configureAndRefreshPortletApplicationContext.</p>
@param pac a {@link org.springframework.web.portlet.context.ConfigurablePortletApplicationContext} object.
@param pc a {@link javax.portlet.PortletContext} object. | [
"<p",
">",
"configureAndRefreshPortletApplicationContext",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/Jasig/spring-portlet-contrib/blob/719240fa268ddc69900ce9775d9cad3b9c543c6b/spring-webmvc-portlet-contrib/src/main/java/org/jasig/springframework/web/portlet/context/PortletContextLoader.java#L280-L314 |
andkulikov/Transitions-Everywhere | library(1.x)/src/main/java/com/transitionseverywhere/Scene.java | Scene.getSceneForLayout | @NonNull
public static Scene getSceneForLayout(@NonNull ViewGroup sceneRoot, int layoutId, @NonNull Context context) {
"""
Returns a Scene described by the resource file associated with the given
<code>layoutId</code> parameter. If such a Scene has already been created,
that same Scene will be returned. This caching of layoutId-based scenes enables
sharing of common scenes between those created in code and those referenced
by {@link TransitionManager} XML resource files.
@param sceneRoot The root of the hierarchy in which scene changes
and transitions will take place.
@param layoutId The id of a standard layout resource file.
@param context The context used in the process of inflating
the layout resource.
@return
"""
SparseArray<Scene> scenes = (SparseArray<Scene>) sceneRoot.getTag(R.id.scene_layoutid_cache);
if (scenes == null) {
scenes = new SparseArray<Scene>();
sceneRoot.setTag(R.id.scene_layoutid_cache, scenes);
}
Scene scene = scenes.get(layoutId);
if (scene != null) {
return scene;
} else {
scene = new Scene(sceneRoot, layoutId, context);
scenes.put(layoutId, scene);
return scene;
}
} | java | @NonNull
public static Scene getSceneForLayout(@NonNull ViewGroup sceneRoot, int layoutId, @NonNull Context context) {
SparseArray<Scene> scenes = (SparseArray<Scene>) sceneRoot.getTag(R.id.scene_layoutid_cache);
if (scenes == null) {
scenes = new SparseArray<Scene>();
sceneRoot.setTag(R.id.scene_layoutid_cache, scenes);
}
Scene scene = scenes.get(layoutId);
if (scene != null) {
return scene;
} else {
scene = new Scene(sceneRoot, layoutId, context);
scenes.put(layoutId, scene);
return scene;
}
} | [
"@",
"NonNull",
"public",
"static",
"Scene",
"getSceneForLayout",
"(",
"@",
"NonNull",
"ViewGroup",
"sceneRoot",
",",
"int",
"layoutId",
",",
"@",
"NonNull",
"Context",
"context",
")",
"{",
"SparseArray",
"<",
"Scene",
">",
"scenes",
"=",
"(",
"SparseArray",
"<",
"Scene",
">",
")",
"sceneRoot",
".",
"getTag",
"(",
"R",
".",
"id",
".",
"scene_layoutid_cache",
")",
";",
"if",
"(",
"scenes",
"==",
"null",
")",
"{",
"scenes",
"=",
"new",
"SparseArray",
"<",
"Scene",
">",
"(",
")",
";",
"sceneRoot",
".",
"setTag",
"(",
"R",
".",
"id",
".",
"scene_layoutid_cache",
",",
"scenes",
")",
";",
"}",
"Scene",
"scene",
"=",
"scenes",
".",
"get",
"(",
"layoutId",
")",
";",
"if",
"(",
"scene",
"!=",
"null",
")",
"{",
"return",
"scene",
";",
"}",
"else",
"{",
"scene",
"=",
"new",
"Scene",
"(",
"sceneRoot",
",",
"layoutId",
",",
"context",
")",
";",
"scenes",
".",
"put",
"(",
"layoutId",
",",
"scene",
")",
";",
"return",
"scene",
";",
"}",
"}"
] | Returns a Scene described by the resource file associated with the given
<code>layoutId</code> parameter. If such a Scene has already been created,
that same Scene will be returned. This caching of layoutId-based scenes enables
sharing of common scenes between those created in code and those referenced
by {@link TransitionManager} XML resource files.
@param sceneRoot The root of the hierarchy in which scene changes
and transitions will take place.
@param layoutId The id of a standard layout resource file.
@param context The context used in the process of inflating
the layout resource.
@return | [
"Returns",
"a",
"Scene",
"described",
"by",
"the",
"resource",
"file",
"associated",
"with",
"the",
"given",
"<code",
">",
"layoutId<",
"/",
"code",
">",
"parameter",
".",
"If",
"such",
"a",
"Scene",
"has",
"already",
"been",
"created",
"that",
"same",
"Scene",
"will",
"be",
"returned",
".",
"This",
"caching",
"of",
"layoutId",
"-",
"based",
"scenes",
"enables",
"sharing",
"of",
"common",
"scenes",
"between",
"those",
"created",
"in",
"code",
"and",
"those",
"referenced",
"by",
"{",
"@link",
"TransitionManager",
"}",
"XML",
"resource",
"files",
"."
] | train | https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/Scene.java#L61-L76 |
liferay/com-liferay-commerce | commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountOrganizationRelPersistenceImpl.java | CommerceAccountOrganizationRelPersistenceImpl.findAll | @Override
public List<CommerceAccountOrganizationRel> findAll() {
"""
Returns all the commerce account organization rels.
@return the commerce account organization rels
"""
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceAccountOrganizationRel> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceAccountOrganizationRel",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce account organization rels.
@return the commerce account organization rels | [
"Returns",
"all",
"the",
"commerce",
"account",
"organization",
"rels",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountOrganizationRelPersistenceImpl.java#L1623-L1626 |
cdk/cdk | tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java | MolecularFormulaManipulator.getString | public static String getString(IMolecularFormula formula, boolean setOne) {
"""
Returns the string representation of the molecular formula.
Based on Hill System. The Hill system is a system of writing
chemical formulas such that the number of carbon atoms in a
molecule is indicated first, the number of hydrogen atoms next,
and then the number of all other chemical elements subsequently,
in alphabetical order. When the formula contains no carbon, all
the elements, including hydrogen, are listed alphabetically.
@param formula The IMolecularFormula Object
@param setOne True, when must be set the value 1 for elements with
one atom
@return A String containing the molecular formula
@see #getHTML(IMolecularFormula)
"""
if (containsElement(formula, formula.getBuilder().newInstance(IElement.class, "C")))
return getString(formula, generateOrderEle_Hill_WithCarbons(), setOne, false);
else
return getString(formula, generateOrderEle_Hill_NoCarbons(), setOne, false);
} | java | public static String getString(IMolecularFormula formula, boolean setOne) {
if (containsElement(formula, formula.getBuilder().newInstance(IElement.class, "C")))
return getString(formula, generateOrderEle_Hill_WithCarbons(), setOne, false);
else
return getString(formula, generateOrderEle_Hill_NoCarbons(), setOne, false);
} | [
"public",
"static",
"String",
"getString",
"(",
"IMolecularFormula",
"formula",
",",
"boolean",
"setOne",
")",
"{",
"if",
"(",
"containsElement",
"(",
"formula",
",",
"formula",
".",
"getBuilder",
"(",
")",
".",
"newInstance",
"(",
"IElement",
".",
"class",
",",
"\"C\"",
")",
")",
")",
"return",
"getString",
"(",
"formula",
",",
"generateOrderEle_Hill_WithCarbons",
"(",
")",
",",
"setOne",
",",
"false",
")",
";",
"else",
"return",
"getString",
"(",
"formula",
",",
"generateOrderEle_Hill_NoCarbons",
"(",
")",
",",
"setOne",
",",
"false",
")",
";",
"}"
] | Returns the string representation of the molecular formula.
Based on Hill System. The Hill system is a system of writing
chemical formulas such that the number of carbon atoms in a
molecule is indicated first, the number of hydrogen atoms next,
and then the number of all other chemical elements subsequently,
in alphabetical order. When the formula contains no carbon, all
the elements, including hydrogen, are listed alphabetically.
@param formula The IMolecularFormula Object
@param setOne True, when must be set the value 1 for elements with
one atom
@return A String containing the molecular formula
@see #getHTML(IMolecularFormula) | [
"Returns",
"the",
"string",
"representation",
"of",
"the",
"molecular",
"formula",
".",
"Based",
"on",
"Hill",
"System",
".",
"The",
"Hill",
"system",
"is",
"a",
"system",
"of",
"writing",
"chemical",
"formulas",
"such",
"that",
"the",
"number",
"of",
"carbon",
"atoms",
"in",
"a",
"molecule",
"is",
"indicated",
"first",
"the",
"number",
"of",
"hydrogen",
"atoms",
"next",
"and",
"then",
"the",
"number",
"of",
"all",
"other",
"chemical",
"elements",
"subsequently",
"in",
"alphabetical",
"order",
".",
"When",
"the",
"formula",
"contains",
"no",
"carbon",
"all",
"the",
"elements",
"including",
"hydrogen",
"are",
"listed",
"alphabetically",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java#L363-L369 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/websphere/channelfw/ChannelUtils.java | ChannelUtils.printThreadStackTrace | public static void printThreadStackTrace(TraceComponent logger, Thread thread) {
"""
Print debug stacktrace using given trace component.
@param logger
@param thread
"""
if (logger.isDebugEnabled()) {
chTrace.traceThreadStack(logger, thread);
}
} | java | public static void printThreadStackTrace(TraceComponent logger, Thread thread) {
if (logger.isDebugEnabled()) {
chTrace.traceThreadStack(logger, thread);
}
} | [
"public",
"static",
"void",
"printThreadStackTrace",
"(",
"TraceComponent",
"logger",
",",
"Thread",
"thread",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"chTrace",
".",
"traceThreadStack",
"(",
"logger",
",",
"thread",
")",
";",
"}",
"}"
] | Print debug stacktrace using given trace component.
@param logger
@param thread | [
"Print",
"debug",
"stacktrace",
"using",
"given",
"trace",
"component",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/websphere/channelfw/ChannelUtils.java#L94-L98 |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/SpringContextUtils.java | SpringContextUtils.contextMergedBeans | public static ApplicationContext contextMergedBeans(Map<String, ?> extraBeans, Class<?> config) {
"""
Loads a context from the annotations config and inject all objects in the Map
@param extraBeans Extra beans for being injected
@param config Configuration class
@return ApplicationContext generated
"""
final DefaultListableBeanFactory parentBeanFactory = buildListableBeanFactory(extraBeans);
//loads the annotation classes and add definitions in the context
GenericApplicationContext parentContext = new GenericApplicationContext(parentBeanFactory);
AnnotatedBeanDefinitionReader annotationReader = new AnnotatedBeanDefinitionReader(parentContext);
annotationReader.registerBean(config);
//refreshed the context to create class and make autowires
parentContext.refresh();
//return the created context
return parentContext;
} | java | public static ApplicationContext contextMergedBeans(Map<String, ?> extraBeans, Class<?> config) {
final DefaultListableBeanFactory parentBeanFactory = buildListableBeanFactory(extraBeans);
//loads the annotation classes and add definitions in the context
GenericApplicationContext parentContext = new GenericApplicationContext(parentBeanFactory);
AnnotatedBeanDefinitionReader annotationReader = new AnnotatedBeanDefinitionReader(parentContext);
annotationReader.registerBean(config);
//refreshed the context to create class and make autowires
parentContext.refresh();
//return the created context
return parentContext;
} | [
"public",
"static",
"ApplicationContext",
"contextMergedBeans",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"extraBeans",
",",
"Class",
"<",
"?",
">",
"config",
")",
"{",
"final",
"DefaultListableBeanFactory",
"parentBeanFactory",
"=",
"buildListableBeanFactory",
"(",
"extraBeans",
")",
";",
"//loads the annotation classes and add definitions in the context",
"GenericApplicationContext",
"parentContext",
"=",
"new",
"GenericApplicationContext",
"(",
"parentBeanFactory",
")",
";",
"AnnotatedBeanDefinitionReader",
"annotationReader",
"=",
"new",
"AnnotatedBeanDefinitionReader",
"(",
"parentContext",
")",
";",
"annotationReader",
".",
"registerBean",
"(",
"config",
")",
";",
"//refreshed the context to create class and make autowires",
"parentContext",
".",
"refresh",
"(",
")",
";",
"//return the created context",
"return",
"parentContext",
";",
"}"
] | Loads a context from the annotations config and inject all objects in the Map
@param extraBeans Extra beans for being injected
@param config Configuration class
@return ApplicationContext generated | [
"Loads",
"a",
"context",
"from",
"the",
"annotations",
"config",
"and",
"inject",
"all",
"objects",
"in",
"the",
"Map"
] | train | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/SpringContextUtils.java#L53-L66 |
pravega/pravega | segmentstore/contracts/src/main/java/io/pravega/segmentstore/contracts/tables/TableEntry.java | TableEntry.versioned | public static TableEntry versioned(@NonNull ArrayView key, @NonNull ArrayView value, long version) {
"""
Creates a new instance of the TableEntry class with a specified version.
@param key The Key.
@param value The Value.
@param version The desired version.
@return new instance of Table Entry with a specified version
"""
return new TableEntry(TableKey.versioned(key, version), value);
} | java | public static TableEntry versioned(@NonNull ArrayView key, @NonNull ArrayView value, long version) {
return new TableEntry(TableKey.versioned(key, version), value);
} | [
"public",
"static",
"TableEntry",
"versioned",
"(",
"@",
"NonNull",
"ArrayView",
"key",
",",
"@",
"NonNull",
"ArrayView",
"value",
",",
"long",
"version",
")",
"{",
"return",
"new",
"TableEntry",
"(",
"TableKey",
".",
"versioned",
"(",
"key",
",",
"version",
")",
",",
"value",
")",
";",
"}"
] | Creates a new instance of the TableEntry class with a specified version.
@param key The Key.
@param value The Value.
@param version The desired version.
@return new instance of Table Entry with a specified version | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"TableEntry",
"class",
"with",
"a",
"specified",
"version",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/contracts/src/main/java/io/pravega/segmentstore/contracts/tables/TableEntry.java#L80-L82 |
spring-projects/spring-loaded | springloaded/src/main/java/org/springsource/loaded/ri/ReflectiveInterceptor.java | ReflectiveInterceptor.asAccessibleField | private static Field asAccessibleField(Field field, Object target, boolean makeAccessibleCopy)
throws IllegalAccessException {
"""
Performs access checks and returns a (potential) copy of the field with accessibility flag set if this necessary
for the acces operation to succeed.
<p>
If any checks fail, an appropriate exception is raised.
Warning this method is sensitive to stack depth! Should expects to be called DIRECTLY from a jlr redicriction
method only!
"""
if (isDeleted(field)) {
throw Exceptions.noSuchFieldError(field);
}
Class<?> clazz = field.getDeclaringClass();
int mods = field.getModifiers();
if (field.isAccessible() || Modifier.isPublic(mods & jlClassGetModifiers(clazz))) {
//More expensive check not required / copy not required
}
else {
//More expensive check required
Class<?> callerClass = getCallerClass();
JVM.ensureMemberAccess(callerClass, clazz, target, mods);
if (makeAccessibleCopy) {
//TODO: This code is not covered by a test. It needs a non-reloadable type with non-public
// field, being accessed reflectively from a context that is "priviliged" to access it without setting the access flag.
field = JVM.copyField(field); // copy: we must not change accessible flag on original method!
field.setAccessible(true);
}
}
return makeAccessibleCopy ? field : null;
} | java | private static Field asAccessibleField(Field field, Object target, boolean makeAccessibleCopy)
throws IllegalAccessException {
if (isDeleted(field)) {
throw Exceptions.noSuchFieldError(field);
}
Class<?> clazz = field.getDeclaringClass();
int mods = field.getModifiers();
if (field.isAccessible() || Modifier.isPublic(mods & jlClassGetModifiers(clazz))) {
//More expensive check not required / copy not required
}
else {
//More expensive check required
Class<?> callerClass = getCallerClass();
JVM.ensureMemberAccess(callerClass, clazz, target, mods);
if (makeAccessibleCopy) {
//TODO: This code is not covered by a test. It needs a non-reloadable type with non-public
// field, being accessed reflectively from a context that is "priviliged" to access it without setting the access flag.
field = JVM.copyField(field); // copy: we must not change accessible flag on original method!
field.setAccessible(true);
}
}
return makeAccessibleCopy ? field : null;
} | [
"private",
"static",
"Field",
"asAccessibleField",
"(",
"Field",
"field",
",",
"Object",
"target",
",",
"boolean",
"makeAccessibleCopy",
")",
"throws",
"IllegalAccessException",
"{",
"if",
"(",
"isDeleted",
"(",
"field",
")",
")",
"{",
"throw",
"Exceptions",
".",
"noSuchFieldError",
"(",
"field",
")",
";",
"}",
"Class",
"<",
"?",
">",
"clazz",
"=",
"field",
".",
"getDeclaringClass",
"(",
")",
";",
"int",
"mods",
"=",
"field",
".",
"getModifiers",
"(",
")",
";",
"if",
"(",
"field",
".",
"isAccessible",
"(",
")",
"||",
"Modifier",
".",
"isPublic",
"(",
"mods",
"&",
"jlClassGetModifiers",
"(",
"clazz",
")",
")",
")",
"{",
"//More expensive check not required / copy not required",
"}",
"else",
"{",
"//More expensive check required",
"Class",
"<",
"?",
">",
"callerClass",
"=",
"getCallerClass",
"(",
")",
";",
"JVM",
".",
"ensureMemberAccess",
"(",
"callerClass",
",",
"clazz",
",",
"target",
",",
"mods",
")",
";",
"if",
"(",
"makeAccessibleCopy",
")",
"{",
"//TODO: This code is not covered by a test. It needs a non-reloadable type with non-public",
"// field, being accessed reflectively from a context that is \"priviliged\" to access it without setting the access flag.",
"field",
"=",
"JVM",
".",
"copyField",
"(",
"field",
")",
";",
"// copy: we must not change accessible flag on original method!",
"field",
".",
"setAccessible",
"(",
"true",
")",
";",
"}",
"}",
"return",
"makeAccessibleCopy",
"?",
"field",
":",
"null",
";",
"}"
] | Performs access checks and returns a (potential) copy of the field with accessibility flag set if this necessary
for the acces operation to succeed.
<p>
If any checks fail, an appropriate exception is raised.
Warning this method is sensitive to stack depth! Should expects to be called DIRECTLY from a jlr redicriction
method only! | [
"Performs",
"access",
"checks",
"and",
"returns",
"a",
"(",
"potential",
")",
"copy",
"of",
"the",
"field",
"with",
"accessibility",
"flag",
"set",
"if",
"this",
"necessary",
"for",
"the",
"acces",
"operation",
"to",
"succeed",
".",
"<p",
">",
"If",
"any",
"checks",
"fail",
"an",
"appropriate",
"exception",
"is",
"raised",
"."
] | train | https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/ri/ReflectiveInterceptor.java#L622-L645 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/opengl/InternalTextureLoader.java | InternalTextureLoader.getTexture | public Texture getTexture(String resourceName, boolean flipped, int filter) throws IOException {
"""
Get a texture from a resource location
@param resourceName The location to load the texture from
@param flipped True if we should flip the texture on the y axis while loading
@param filter The filter to use when scaling the texture
@return The texture loaded
@throws IOException Indicates a failure to load the image
"""
InputStream in = ResourceLoader.getResourceAsStream(resourceName);
return getTexture(in, resourceName, flipped, filter, null);
} | java | public Texture getTexture(String resourceName, boolean flipped, int filter) throws IOException {
InputStream in = ResourceLoader.getResourceAsStream(resourceName);
return getTexture(in, resourceName, flipped, filter, null);
} | [
"public",
"Texture",
"getTexture",
"(",
"String",
"resourceName",
",",
"boolean",
"flipped",
",",
"int",
"filter",
")",
"throws",
"IOException",
"{",
"InputStream",
"in",
"=",
"ResourceLoader",
".",
"getResourceAsStream",
"(",
"resourceName",
")",
";",
"return",
"getTexture",
"(",
"in",
",",
"resourceName",
",",
"flipped",
",",
"filter",
",",
"null",
")",
";",
"}"
] | Get a texture from a resource location
@param resourceName The location to load the texture from
@param flipped True if we should flip the texture on the y axis while loading
@param filter The filter to use when scaling the texture
@return The texture loaded
@throws IOException Indicates a failure to load the image | [
"Get",
"a",
"texture",
"from",
"a",
"resource",
"location"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/InternalTextureLoader.java#L168-L172 |
pmlopes/yoke | framework/src/main/java/com/jetdrone/vertx/yoke/MimeType.java | MimeType.getMime | public static String getMime(@NotNull String file, String defaultMimeType) {
"""
Returns a mime type string by parsing the file extension of a file string. If the extension is not found or
unknown the default value is returned.
@param file path to a file with extension
@param defaultMimeType what to return if not found
@return mime type
"""
int sep = file.lastIndexOf('.');
if (sep != -1) {
String extension = file.substring(sep + 1, file.length());
String mime = mimes.get(extension);
if (mime != null) {
return mime;
}
}
return defaultMimeType;
} | java | public static String getMime(@NotNull String file, String defaultMimeType) {
int sep = file.lastIndexOf('.');
if (sep != -1) {
String extension = file.substring(sep + 1, file.length());
String mime = mimes.get(extension);
if (mime != null) {
return mime;
}
}
return defaultMimeType;
} | [
"public",
"static",
"String",
"getMime",
"(",
"@",
"NotNull",
"String",
"file",
",",
"String",
"defaultMimeType",
")",
"{",
"int",
"sep",
"=",
"file",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"sep",
"!=",
"-",
"1",
")",
"{",
"String",
"extension",
"=",
"file",
".",
"substring",
"(",
"sep",
"+",
"1",
",",
"file",
".",
"length",
"(",
")",
")",
";",
"String",
"mime",
"=",
"mimes",
".",
"get",
"(",
"extension",
")",
";",
"if",
"(",
"mime",
"!=",
"null",
")",
"{",
"return",
"mime",
";",
"}",
"}",
"return",
"defaultMimeType",
";",
"}"
] | Returns a mime type string by parsing the file extension of a file string. If the extension is not found or
unknown the default value is returned.
@param file path to a file with extension
@param defaultMimeType what to return if not found
@return mime type | [
"Returns",
"a",
"mime",
"type",
"string",
"by",
"parsing",
"the",
"file",
"extension",
"of",
"a",
"file",
"string",
".",
"If",
"the",
"extension",
"is",
"not",
"found",
"or",
"unknown",
"the",
"default",
"value",
"is",
"returned",
"."
] | train | https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/MimeType.java#L76-L89 |
super-csv/super-csv | super-csv-dozer/src/main/java/org/supercsv/io/dozer/CsvDozerBeanReader.java | CsvDozerBeanReader.readIntoBean | private <T> T readIntoBean(final T bean, final Class<T> clazz, final CellProcessor[] processors) throws IOException {
"""
Reads a row of a CSV file and populates the a bean, using Dozer to map column values to the appropriate field. If
an existing bean is supplied, Dozer will populate that, otherwise Dozer will create an instance of type clazz
(only one of bean or clazz should be supplied). If processors are supplied then they are used, otherwise the raw
String values will be used.
@param bean
the bean to populate (if null, then clazz will be used instead)
@param clazz
the type to instantiate (only required if bean is null)
@param processors
the (optional) cell processors
@return the populated bean
@throws IOException
if an I/O error occurred
"""
if( readRow() ) {
if( processors == null ) {
// populate bean data with the raw String values
beanData.getColumns().clear();
beanData.getColumns().addAll(getColumns());
} else {
// populate bean data with the processed values
executeProcessors(beanData.getColumns(), processors);
}
if( bean != null ) {
// populate existing bean
dozerBeanMapper.map(beanData, bean);
return bean;
} else {
// let Dozer create a new bean
return dozerBeanMapper.map(beanData, clazz);
}
}
return null; // EOF
} | java | private <T> T readIntoBean(final T bean, final Class<T> clazz, final CellProcessor[] processors) throws IOException {
if( readRow() ) {
if( processors == null ) {
// populate bean data with the raw String values
beanData.getColumns().clear();
beanData.getColumns().addAll(getColumns());
} else {
// populate bean data with the processed values
executeProcessors(beanData.getColumns(), processors);
}
if( bean != null ) {
// populate existing bean
dozerBeanMapper.map(beanData, bean);
return bean;
} else {
// let Dozer create a new bean
return dozerBeanMapper.map(beanData, clazz);
}
}
return null; // EOF
} | [
"private",
"<",
"T",
">",
"T",
"readIntoBean",
"(",
"final",
"T",
"bean",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"CellProcessor",
"[",
"]",
"processors",
")",
"throws",
"IOException",
"{",
"if",
"(",
"readRow",
"(",
")",
")",
"{",
"if",
"(",
"processors",
"==",
"null",
")",
"{",
"// populate bean data with the raw String values",
"beanData",
".",
"getColumns",
"(",
")",
".",
"clear",
"(",
")",
";",
"beanData",
".",
"getColumns",
"(",
")",
".",
"addAll",
"(",
"getColumns",
"(",
")",
")",
";",
"}",
"else",
"{",
"// populate bean data with the processed values",
"executeProcessors",
"(",
"beanData",
".",
"getColumns",
"(",
")",
",",
"processors",
")",
";",
"}",
"if",
"(",
"bean",
"!=",
"null",
")",
"{",
"// populate existing bean",
"dozerBeanMapper",
".",
"map",
"(",
"beanData",
",",
"bean",
")",
";",
"return",
"bean",
";",
"}",
"else",
"{",
"// let Dozer create a new bean",
"return",
"dozerBeanMapper",
".",
"map",
"(",
"beanData",
",",
"clazz",
")",
";",
"}",
"}",
"return",
"null",
";",
"// EOF",
"}"
] | Reads a row of a CSV file and populates the a bean, using Dozer to map column values to the appropriate field. If
an existing bean is supplied, Dozer will populate that, otherwise Dozer will create an instance of type clazz
(only one of bean or clazz should be supplied). If processors are supplied then they are used, otherwise the raw
String values will be used.
@param bean
the bean to populate (if null, then clazz will be used instead)
@param clazz
the type to instantiate (only required if bean is null)
@param processors
the (optional) cell processors
@return the populated bean
@throws IOException
if an I/O error occurred | [
"Reads",
"a",
"row",
"of",
"a",
"CSV",
"file",
"and",
"populates",
"the",
"a",
"bean",
"using",
"Dozer",
"to",
"map",
"column",
"values",
"to",
"the",
"appropriate",
"field",
".",
"If",
"an",
"existing",
"bean",
"is",
"supplied",
"Dozer",
"will",
"populate",
"that",
"otherwise",
"Dozer",
"will",
"create",
"an",
"instance",
"of",
"type",
"clazz",
"(",
"only",
"one",
"of",
"bean",
"or",
"clazz",
"should",
"be",
"supplied",
")",
".",
"If",
"processors",
"are",
"supplied",
"then",
"they",
"are",
"used",
"otherwise",
"the",
"raw",
"String",
"values",
"will",
"be",
"used",
"."
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv-dozer/src/main/java/org/supercsv/io/dozer/CsvDozerBeanReader.java#L203-L226 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java | FDBigInteger.valueOfPow52 | public static FDBigInteger valueOfPow52(int p5, int p2) {
"""
/*@
@ requires p5 >= 0 && p2 >= 0;
@ assignable \nothing;
@ ensures \result.value() == \old(pow52(p5, p2));
@
"""
if (p5 != 0) {
if (p2 == 0) {
return big5pow(p5);
} else if (p5 < SMALL_5_POW.length) {
int pow5 = SMALL_5_POW[p5];
int wordcount = p2 >> 5;
int bitcount = p2 & 0x1f;
if (bitcount == 0) {
return new FDBigInteger(new int[]{pow5}, wordcount);
} else {
return new FDBigInteger(new int[]{
pow5 << bitcount,
pow5 >>> (32 - bitcount)
}, wordcount);
}
} else {
return big5pow(p5).leftShift(p2);
}
} else {
return valueOfPow2(p2);
}
} | java | public static FDBigInteger valueOfPow52(int p5, int p2) {
if (p5 != 0) {
if (p2 == 0) {
return big5pow(p5);
} else if (p5 < SMALL_5_POW.length) {
int pow5 = SMALL_5_POW[p5];
int wordcount = p2 >> 5;
int bitcount = p2 & 0x1f;
if (bitcount == 0) {
return new FDBigInteger(new int[]{pow5}, wordcount);
} else {
return new FDBigInteger(new int[]{
pow5 << bitcount,
pow5 >>> (32 - bitcount)
}, wordcount);
}
} else {
return big5pow(p5).leftShift(p2);
}
} else {
return valueOfPow2(p2);
}
} | [
"public",
"static",
"FDBigInteger",
"valueOfPow52",
"(",
"int",
"p5",
",",
"int",
"p2",
")",
"{",
"if",
"(",
"p5",
"!=",
"0",
")",
"{",
"if",
"(",
"p2",
"==",
"0",
")",
"{",
"return",
"big5pow",
"(",
"p5",
")",
";",
"}",
"else",
"if",
"(",
"p5",
"<",
"SMALL_5_POW",
".",
"length",
")",
"{",
"int",
"pow5",
"=",
"SMALL_5_POW",
"[",
"p5",
"]",
";",
"int",
"wordcount",
"=",
"p2",
">>",
"5",
";",
"int",
"bitcount",
"=",
"p2",
"&",
"0x1f",
";",
"if",
"(",
"bitcount",
"==",
"0",
")",
"{",
"return",
"new",
"FDBigInteger",
"(",
"new",
"int",
"[",
"]",
"{",
"pow5",
"}",
",",
"wordcount",
")",
";",
"}",
"else",
"{",
"return",
"new",
"FDBigInteger",
"(",
"new",
"int",
"[",
"]",
"{",
"pow5",
"<<",
"bitcount",
",",
"pow5",
">>>",
"(",
"32",
"-",
"bitcount",
")",
"}",
",",
"wordcount",
")",
";",
"}",
"}",
"else",
"{",
"return",
"big5pow",
"(",
"p5",
")",
".",
"leftShift",
"(",
"p2",
")",
";",
"}",
"}",
"else",
"{",
"return",
"valueOfPow2",
"(",
"p2",
")",
";",
"}",
"}"
] | /*@
@ requires p5 >= 0 && p2 >= 0;
@ assignable \nothing;
@ ensures \result.value() == \old(pow52(p5, p2));
@ | [
"/",
"*"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java#L250-L272 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java | ByteArrayWriter.writeBinaryString | public void writeBinaryString(byte[] data, int offset, int len)
throws IOException {
"""
Write a binary string to the array.
@param data
@param offset
@param len
@throws IOException
"""
if (data == null)
writeInt(0);
else {
writeInt(len);
write(data, offset, len);
}
} | java | public void writeBinaryString(byte[] data, int offset, int len)
throws IOException {
if (data == null)
writeInt(0);
else {
writeInt(len);
write(data, offset, len);
}
} | [
"public",
"void",
"writeBinaryString",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"writeInt",
"(",
"0",
")",
";",
"else",
"{",
"writeInt",
"(",
"len",
")",
";",
"write",
"(",
"data",
",",
"offset",
",",
"len",
")",
";",
"}",
"}"
] | Write a binary string to the array.
@param data
@param offset
@param len
@throws IOException | [
"Write",
"a",
"binary",
"string",
"to",
"the",
"array",
"."
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java#L115-L123 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.setOutlineCode | public void setOutlineCode(int index, String value) {
"""
Set an outline code value.
@param index outline code index (1-10)
@param value outline code value
"""
set(selectField(TaskFieldLists.CUSTOM_OUTLINE_CODE, index), value);
} | java | public void setOutlineCode(int index, String value)
{
set(selectField(TaskFieldLists.CUSTOM_OUTLINE_CODE, index), value);
} | [
"public",
"void",
"setOutlineCode",
"(",
"int",
"index",
",",
"String",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"TaskFieldLists",
".",
"CUSTOM_OUTLINE_CODE",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] | Set an outline code value.
@param index outline code index (1-10)
@param value outline code value | [
"Set",
"an",
"outline",
"code",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L2617-L2620 |
rythmengine/rythmengine | src/main/java/org/rythmengine/internal/ExtensionManager.java | ExtensionManager.registerUserDefinedParsers | public ExtensionManager registerUserDefinedParsers(String dialect, IParserFactory... parsers) {
"""
Register a special case parser to a dialect
<p/>
<p>for example, the play-rythm plugin might want to register a special case parser to
process something like @{Controller.actionMethod()} or &{'MSG_ID'} etc to "japid"
and "play-groovy" dialects
@param dialect
@param parsers
"""
engine.dialectManager().registerExternalParsers(dialect, parsers);
return this;
} | java | public ExtensionManager registerUserDefinedParsers(String dialect, IParserFactory... parsers) {
engine.dialectManager().registerExternalParsers(dialect, parsers);
return this;
} | [
"public",
"ExtensionManager",
"registerUserDefinedParsers",
"(",
"String",
"dialect",
",",
"IParserFactory",
"...",
"parsers",
")",
"{",
"engine",
".",
"dialectManager",
"(",
")",
".",
"registerExternalParsers",
"(",
"dialect",
",",
"parsers",
")",
";",
"return",
"this",
";",
"}"
] | Register a special case parser to a dialect
<p/>
<p>for example, the play-rythm plugin might want to register a special case parser to
process something like @{Controller.actionMethod()} or &{'MSG_ID'} etc to "japid"
and "play-groovy" dialects
@param dialect
@param parsers | [
"Register",
"a",
"special",
"case",
"parser",
"to",
"a",
"dialect",
"<p",
"/",
">",
"<p",
">",
"for",
"example",
"the",
"play",
"-",
"rythm",
"plugin",
"might",
"want",
"to",
"register",
"a",
"special",
"case",
"parser",
"to",
"process",
"something",
"like",
"@",
"{",
"Controller",
".",
"actionMethod",
"()",
"}",
"or",
"&",
"{",
"MSG_ID",
"}",
"etc",
"to",
"japid",
"and",
"play",
"-",
"groovy",
"dialects"
] | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/internal/ExtensionManager.java#L69-L72 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java | MultiNormalizerHybrid.revertFeatures | public void revertFeatures(@NonNull INDArray[] features, INDArray[] maskArrays, int input) {
"""
Undo (revert) the normalization applied by this DataNormalization instance to the features of a particular input
@param features The normalized array of inputs
@param maskArrays Optional mask arrays belonging to the inputs
@param input the index of the input to revert normalization on
"""
NormalizerStrategy strategy = getStrategy(globalInputStrategy, perInputStrategies, input);
if (strategy != null) {
INDArray mask = (maskArrays == null ? null : maskArrays[input]);
//noinspection unchecked
strategy.revert(features[input], mask, getInputStats(input));
}
} | java | public void revertFeatures(@NonNull INDArray[] features, INDArray[] maskArrays, int input) {
NormalizerStrategy strategy = getStrategy(globalInputStrategy, perInputStrategies, input);
if (strategy != null) {
INDArray mask = (maskArrays == null ? null : maskArrays[input]);
//noinspection unchecked
strategy.revert(features[input], mask, getInputStats(input));
}
} | [
"public",
"void",
"revertFeatures",
"(",
"@",
"NonNull",
"INDArray",
"[",
"]",
"features",
",",
"INDArray",
"[",
"]",
"maskArrays",
",",
"int",
"input",
")",
"{",
"NormalizerStrategy",
"strategy",
"=",
"getStrategy",
"(",
"globalInputStrategy",
",",
"perInputStrategies",
",",
"input",
")",
";",
"if",
"(",
"strategy",
"!=",
"null",
")",
"{",
"INDArray",
"mask",
"=",
"(",
"maskArrays",
"==",
"null",
"?",
"null",
":",
"maskArrays",
"[",
"input",
"]",
")",
";",
"//noinspection unchecked",
"strategy",
".",
"revert",
"(",
"features",
"[",
"input",
"]",
",",
"mask",
",",
"getInputStats",
"(",
"input",
")",
")",
";",
"}",
"}"
] | Undo (revert) the normalization applied by this DataNormalization instance to the features of a particular input
@param features The normalized array of inputs
@param maskArrays Optional mask arrays belonging to the inputs
@param input the index of the input to revert normalization on | [
"Undo",
"(",
"revert",
")",
"the",
"normalization",
"applied",
"by",
"this",
"DataNormalization",
"instance",
"to",
"the",
"features",
"of",
"a",
"particular",
"input"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java#L380-L387 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java | RuntimeModelIo.loadApplication | public static ApplicationLoadResult loadApplication( File projectDirectory ) {
"""
Loads an application from a directory.
<p>
The directory structure must be the following one:
</p>
<ul>
<li>descriptor</li>
<li>graph</li>
<li>instances (optional)</li>
</ul>
@param projectDirectory the project directory
@return a load result (never null)
"""
ApplicationLoadResult result = new ApplicationLoadResult();
ApplicationTemplate app = new ApplicationTemplate();
result.applicationTemplate = app;
ApplicationTemplateDescriptor appDescriptor = null;
File descDirectory = new File( projectDirectory, Constants.PROJECT_DIR_DESC );
// Read the application descriptor
DESC: if( ! descDirectory.exists()) {
RoboconfError error = new RoboconfError( ErrorCode.PROJ_NO_DESC_DIR, directory( projectDirectory ));
result.loadErrors.add( error );
} else {
File descriptorFile = new File( descDirectory, Constants.PROJECT_FILE_DESCRIPTOR );
if( ! descriptorFile.exists()) {
result.loadErrors.add( new RoboconfError( ErrorCode.PROJ_NO_DESC_FILE ));
break DESC;
}
try {
// Prepare the application
appDescriptor = ApplicationTemplateDescriptor.load( descriptorFile );
app.setName( appDescriptor.getName());
app.setDescription( appDescriptor.getDescription());
app.setVersion( appDescriptor.getVersion());
app.setDslId( appDescriptor.getDslId());
app.setExternalExportsPrefix( appDescriptor.getExternalExportsPrefix());
app.setTags( appDescriptor.tags );
for( Map.Entry<String,String> entry : appDescriptor.externalExports.entrySet())
app.externalExports.put( entry.getKey(), app.getExternalExportsPrefix() + "." + entry.getValue());
// Update the parsing context so that we can resolve errors locations
result.objectToSource.put( appDescriptor, new SourceReference( appDescriptor, descriptorFile, 1 ));
for( Map.Entry<String,Integer> entry : appDescriptor.propertyToLine.entrySet()) {
result.objectToSource.put( entry.getKey(), new SourceReference( entry.getKey(), descriptorFile, entry.getValue()));
}
// Resolve errors locations
Collection<ModelError> errors = RuntimeModelValidator.validate( appDescriptor );
result.loadErrors.addAll( errors );
} catch( IOException e ) {
RoboconfError error = new RoboconfError( ErrorCode.PROJ_READ_DESC_FILE, exception( e ));
result.loadErrors.add( error );
}
}
return loadApplication( projectDirectory, appDescriptor, result );
} | java | public static ApplicationLoadResult loadApplication( File projectDirectory ) {
ApplicationLoadResult result = new ApplicationLoadResult();
ApplicationTemplate app = new ApplicationTemplate();
result.applicationTemplate = app;
ApplicationTemplateDescriptor appDescriptor = null;
File descDirectory = new File( projectDirectory, Constants.PROJECT_DIR_DESC );
// Read the application descriptor
DESC: if( ! descDirectory.exists()) {
RoboconfError error = new RoboconfError( ErrorCode.PROJ_NO_DESC_DIR, directory( projectDirectory ));
result.loadErrors.add( error );
} else {
File descriptorFile = new File( descDirectory, Constants.PROJECT_FILE_DESCRIPTOR );
if( ! descriptorFile.exists()) {
result.loadErrors.add( new RoboconfError( ErrorCode.PROJ_NO_DESC_FILE ));
break DESC;
}
try {
// Prepare the application
appDescriptor = ApplicationTemplateDescriptor.load( descriptorFile );
app.setName( appDescriptor.getName());
app.setDescription( appDescriptor.getDescription());
app.setVersion( appDescriptor.getVersion());
app.setDslId( appDescriptor.getDslId());
app.setExternalExportsPrefix( appDescriptor.getExternalExportsPrefix());
app.setTags( appDescriptor.tags );
for( Map.Entry<String,String> entry : appDescriptor.externalExports.entrySet())
app.externalExports.put( entry.getKey(), app.getExternalExportsPrefix() + "." + entry.getValue());
// Update the parsing context so that we can resolve errors locations
result.objectToSource.put( appDescriptor, new SourceReference( appDescriptor, descriptorFile, 1 ));
for( Map.Entry<String,Integer> entry : appDescriptor.propertyToLine.entrySet()) {
result.objectToSource.put( entry.getKey(), new SourceReference( entry.getKey(), descriptorFile, entry.getValue()));
}
// Resolve errors locations
Collection<ModelError> errors = RuntimeModelValidator.validate( appDescriptor );
result.loadErrors.addAll( errors );
} catch( IOException e ) {
RoboconfError error = new RoboconfError( ErrorCode.PROJ_READ_DESC_FILE, exception( e ));
result.loadErrors.add( error );
}
}
return loadApplication( projectDirectory, appDescriptor, result );
} | [
"public",
"static",
"ApplicationLoadResult",
"loadApplication",
"(",
"File",
"projectDirectory",
")",
"{",
"ApplicationLoadResult",
"result",
"=",
"new",
"ApplicationLoadResult",
"(",
")",
";",
"ApplicationTemplate",
"app",
"=",
"new",
"ApplicationTemplate",
"(",
")",
";",
"result",
".",
"applicationTemplate",
"=",
"app",
";",
"ApplicationTemplateDescriptor",
"appDescriptor",
"=",
"null",
";",
"File",
"descDirectory",
"=",
"new",
"File",
"(",
"projectDirectory",
",",
"Constants",
".",
"PROJECT_DIR_DESC",
")",
";",
"// Read the application descriptor",
"DESC",
":",
"if",
"(",
"!",
"descDirectory",
".",
"exists",
"(",
")",
")",
"{",
"RoboconfError",
"error",
"=",
"new",
"RoboconfError",
"(",
"ErrorCode",
".",
"PROJ_NO_DESC_DIR",
",",
"directory",
"(",
"projectDirectory",
")",
")",
";",
"result",
".",
"loadErrors",
".",
"add",
"(",
"error",
")",
";",
"}",
"else",
"{",
"File",
"descriptorFile",
"=",
"new",
"File",
"(",
"descDirectory",
",",
"Constants",
".",
"PROJECT_FILE_DESCRIPTOR",
")",
";",
"if",
"(",
"!",
"descriptorFile",
".",
"exists",
"(",
")",
")",
"{",
"result",
".",
"loadErrors",
".",
"add",
"(",
"new",
"RoboconfError",
"(",
"ErrorCode",
".",
"PROJ_NO_DESC_FILE",
")",
")",
";",
"break",
"DESC",
";",
"}",
"try",
"{",
"// Prepare the application",
"appDescriptor",
"=",
"ApplicationTemplateDescriptor",
".",
"load",
"(",
"descriptorFile",
")",
";",
"app",
".",
"setName",
"(",
"appDescriptor",
".",
"getName",
"(",
")",
")",
";",
"app",
".",
"setDescription",
"(",
"appDescriptor",
".",
"getDescription",
"(",
")",
")",
";",
"app",
".",
"setVersion",
"(",
"appDescriptor",
".",
"getVersion",
"(",
")",
")",
";",
"app",
".",
"setDslId",
"(",
"appDescriptor",
".",
"getDslId",
"(",
")",
")",
";",
"app",
".",
"setExternalExportsPrefix",
"(",
"appDescriptor",
".",
"getExternalExportsPrefix",
"(",
")",
")",
";",
"app",
".",
"setTags",
"(",
"appDescriptor",
".",
"tags",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"appDescriptor",
".",
"externalExports",
".",
"entrySet",
"(",
")",
")",
"app",
".",
"externalExports",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"app",
".",
"getExternalExportsPrefix",
"(",
")",
"+",
"\".\"",
"+",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"// Update the parsing context so that we can resolve errors locations",
"result",
".",
"objectToSource",
".",
"put",
"(",
"appDescriptor",
",",
"new",
"SourceReference",
"(",
"appDescriptor",
",",
"descriptorFile",
",",
"1",
")",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
"entry",
":",
"appDescriptor",
".",
"propertyToLine",
".",
"entrySet",
"(",
")",
")",
"{",
"result",
".",
"objectToSource",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"new",
"SourceReference",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"descriptorFile",
",",
"entry",
".",
"getValue",
"(",
")",
")",
")",
";",
"}",
"// Resolve errors locations",
"Collection",
"<",
"ModelError",
">",
"errors",
"=",
"RuntimeModelValidator",
".",
"validate",
"(",
"appDescriptor",
")",
";",
"result",
".",
"loadErrors",
".",
"addAll",
"(",
"errors",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"RoboconfError",
"error",
"=",
"new",
"RoboconfError",
"(",
"ErrorCode",
".",
"PROJ_READ_DESC_FILE",
",",
"exception",
"(",
"e",
")",
")",
";",
"result",
".",
"loadErrors",
".",
"add",
"(",
"error",
")",
";",
"}",
"}",
"return",
"loadApplication",
"(",
"projectDirectory",
",",
"appDescriptor",
",",
"result",
")",
";",
"}"
] | Loads an application from a directory.
<p>
The directory structure must be the following one:
</p>
<ul>
<li>descriptor</li>
<li>graph</li>
<li>instances (optional)</li>
</ul>
@param projectDirectory the project directory
@return a load result (never null) | [
"Loads",
"an",
"application",
"from",
"a",
"directory",
".",
"<p",
">",
"The",
"directory",
"structure",
"must",
"be",
"the",
"following",
"one",
":",
"<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"descriptor<",
"/",
"li",
">",
"<li",
">",
"graph<",
"/",
"li",
">",
"<li",
">",
"instances",
"(",
"optional",
")",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">"
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java#L87-L139 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/util/StringHelper.java | StringHelper.getInteger | public static int getInteger(String pStr, int defval) {
"""
Returns the parsed integer value for the passed in String.
@param pStr A String value.
@return An integer value.
@see Integer#parseInt(java.lang.String)
"""
if (isEmpty(pStr)) return defval;
try {
return Integer.parseInt(pStr);
} catch (NumberFormatException nm) {
return defval;
}
} | java | public static int getInteger(String pStr, int defval) {
if (isEmpty(pStr)) return defval;
try {
return Integer.parseInt(pStr);
} catch (NumberFormatException nm) {
return defval;
}
} | [
"public",
"static",
"int",
"getInteger",
"(",
"String",
"pStr",
",",
"int",
"defval",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"pStr",
")",
")",
"return",
"defval",
";",
"try",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"pStr",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nm",
")",
"{",
"return",
"defval",
";",
"}",
"}"
] | Returns the parsed integer value for the passed in String.
@param pStr A String value.
@return An integer value.
@see Integer#parseInt(java.lang.String) | [
"Returns",
"the",
"parsed",
"integer",
"value",
"for",
"the",
"passed",
"in",
"String",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/StringHelper.java#L1008-L1015 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/MoveOnEventHandler.java | MoveOnEventHandler.doRecordChange | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) {
"""
Called when a change is the record status is about to happen/has happened.
If this file is selected (opened) move the field.
@param field If this file change is due to a field, this is the field.
@param iChangeType The type of change that occurred.
@param bDisplayOption If true, display any changes.
@return an error code.
""" // Read a valid record
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
if (((iChangeType == DBConstants.SELECT_TYPE) && (m_bMoveOnSelect))
|| ((iChangeType == DBConstants.AFTER_ADD_TYPE) && (m_bMoveOnAdd))
|| ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) && (m_bMoveOnUpdate)))
this.moveTheData(bDisplayOption, DBConstants.SCREEN_MOVE); // Do trigger a record change.
return iErrorCode;
} | java | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{ // Read a valid record
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
if (((iChangeType == DBConstants.SELECT_TYPE) && (m_bMoveOnSelect))
|| ((iChangeType == DBConstants.AFTER_ADD_TYPE) && (m_bMoveOnAdd))
|| ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) && (m_bMoveOnUpdate)))
this.moveTheData(bDisplayOption, DBConstants.SCREEN_MOVE); // Do trigger a record change.
return iErrorCode;
} | [
"public",
"int",
"doRecordChange",
"(",
"FieldInfo",
"field",
",",
"int",
"iChangeType",
",",
"boolean",
"bDisplayOption",
")",
"{",
"// Read a valid record",
"int",
"iErrorCode",
"=",
"super",
".",
"doRecordChange",
"(",
"field",
",",
"iChangeType",
",",
"bDisplayOption",
")",
";",
"// Initialize the record",
"if",
"(",
"iErrorCode",
"!=",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"return",
"iErrorCode",
";",
"if",
"(",
"(",
"(",
"iChangeType",
"==",
"DBConstants",
".",
"SELECT_TYPE",
")",
"&&",
"(",
"m_bMoveOnSelect",
")",
")",
"||",
"(",
"(",
"iChangeType",
"==",
"DBConstants",
".",
"AFTER_ADD_TYPE",
")",
"&&",
"(",
"m_bMoveOnAdd",
")",
")",
"||",
"(",
"(",
"iChangeType",
"==",
"DBConstants",
".",
"AFTER_UPDATE_TYPE",
")",
"&&",
"(",
"m_bMoveOnUpdate",
")",
")",
")",
"this",
".",
"moveTheData",
"(",
"bDisplayOption",
",",
"DBConstants",
".",
"SCREEN_MOVE",
")",
";",
"// Do trigger a record change.",
"return",
"iErrorCode",
";",
"}"
] | Called when a change is the record status is about to happen/has happened.
If this file is selected (opened) move the field.
@param field If this file change is due to a field, this is the field.
@param iChangeType The type of change that occurred.
@param bDisplayOption If true, display any changes.
@return an error code. | [
"Called",
"when",
"a",
"change",
"is",
"the",
"record",
"status",
"is",
"about",
"to",
"happen",
"/",
"has",
"happened",
".",
"If",
"this",
"file",
"is",
"selected",
"(",
"opened",
")",
"move",
"the",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/MoveOnEventHandler.java#L185-L195 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/MediaservicesInner.java | MediaservicesInner.createOrUpdate | public MediaServiceInner createOrUpdate(String resourceGroupName, String accountName, MediaServiceInner parameters) {
"""
Create or update a Media Services account.
Creates or updates a Media Services account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param parameters The request parameters
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the MediaServiceInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body();
} | java | public MediaServiceInner createOrUpdate(String resourceGroupName, String accountName, MediaServiceInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body();
} | [
"public",
"MediaServiceInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"MediaServiceInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Create or update a Media Services account.
Creates or updates a Media Services account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param parameters The request parameters
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the MediaServiceInner object if successful. | [
"Create",
"or",
"update",
"a",
"Media",
"Services",
"account",
".",
"Creates",
"or",
"updates",
"a",
"Media",
"Services",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/MediaservicesInner.java#L333-L335 |
Erudika/para | para-server/src/main/java/com/erudika/para/queue/AWSQueueUtils.java | AWSQueueUtils.getClient | public static AmazonSQS getClient() {
"""
Returns a client instance for AWS SQS.
@return a client that talks to SQS
"""
if (sqsClient != null) {
return sqsClient;
}
if (Config.IN_PRODUCTION) {
sqsClient = AmazonSQSClientBuilder.standard().build();
} else {
sqsClient = AmazonSQSClientBuilder.standard().
withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("x", "x"))).
withEndpointConfiguration(new EndpointConfiguration(LOCAL_ENDPOINT, "")).build();
}
Para.addDestroyListener(new DestroyListener() {
public void onDestroy() {
sqsClient.shutdown();
}
});
return sqsClient;
} | java | public static AmazonSQS getClient() {
if (sqsClient != null) {
return sqsClient;
}
if (Config.IN_PRODUCTION) {
sqsClient = AmazonSQSClientBuilder.standard().build();
} else {
sqsClient = AmazonSQSClientBuilder.standard().
withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("x", "x"))).
withEndpointConfiguration(new EndpointConfiguration(LOCAL_ENDPOINT, "")).build();
}
Para.addDestroyListener(new DestroyListener() {
public void onDestroy() {
sqsClient.shutdown();
}
});
return sqsClient;
} | [
"public",
"static",
"AmazonSQS",
"getClient",
"(",
")",
"{",
"if",
"(",
"sqsClient",
"!=",
"null",
")",
"{",
"return",
"sqsClient",
";",
"}",
"if",
"(",
"Config",
".",
"IN_PRODUCTION",
")",
"{",
"sqsClient",
"=",
"AmazonSQSClientBuilder",
".",
"standard",
"(",
")",
".",
"build",
"(",
")",
";",
"}",
"else",
"{",
"sqsClient",
"=",
"AmazonSQSClientBuilder",
".",
"standard",
"(",
")",
".",
"withCredentials",
"(",
"new",
"AWSStaticCredentialsProvider",
"(",
"new",
"BasicAWSCredentials",
"(",
"\"x\"",
",",
"\"x\"",
")",
")",
")",
".",
"withEndpointConfiguration",
"(",
"new",
"EndpointConfiguration",
"(",
"LOCAL_ENDPOINT",
",",
"\"\"",
")",
")",
".",
"build",
"(",
")",
";",
"}",
"Para",
".",
"addDestroyListener",
"(",
"new",
"DestroyListener",
"(",
")",
"{",
"public",
"void",
"onDestroy",
"(",
")",
"{",
"sqsClient",
".",
"shutdown",
"(",
")",
";",
"}",
"}",
")",
";",
"return",
"sqsClient",
";",
"}"
] | Returns a client instance for AWS SQS.
@return a client that talks to SQS | [
"Returns",
"a",
"client",
"instance",
"for",
"AWS",
"SQS",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/queue/AWSQueueUtils.java#L76-L94 |
ysc/word | src/main/java/org/apdplat/word/WordFrequencyStatistics.java | WordFrequencyStatistics.statistics | private void statistics(Word word, int times, Map<String, AtomicInteger> container) {
"""
统计词频
@param word 词
@param times 词频
@param container 内存中保存词频的数据结构
"""
statistics(word.getText(), times, container);
} | java | private void statistics(Word word, int times, Map<String, AtomicInteger> container){
statistics(word.getText(), times, container);
} | [
"private",
"void",
"statistics",
"(",
"Word",
"word",
",",
"int",
"times",
",",
"Map",
"<",
"String",
",",
"AtomicInteger",
">",
"container",
")",
"{",
"statistics",
"(",
"word",
".",
"getText",
"(",
")",
",",
"times",
",",
"container",
")",
";",
"}"
] | 统计词频
@param word 词
@param times 词频
@param container 内存中保存词频的数据结构 | [
"统计词频"
] | train | https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/WordFrequencyStatistics.java#L175-L177 |
m-m-m/util | lang/src/main/java/net/sf/mmm/util/lang/api/CaseSyntax.java | CaseSyntax.of | public static CaseSyntax of(Character separator, CaseConversion firstCharCase, CaseConversion wordStartCharCase) {
"""
The constructor. Will use {@link CaseConversion#LOWER_CASE} for {@link #getOtherCase() other} characters.
@param separator - see {@link #getWordSeparator()}.
@param firstCharCase - see {@link #getFirstCase()}.
@param wordStartCharCase - see {@link #getWordStartCase()}.
@return the requested {@link CaseSyntax}.
"""
return of(separator, firstCharCase, wordStartCharCase, CaseConversion.LOWER_CASE);
} | java | public static CaseSyntax of(Character separator, CaseConversion firstCharCase, CaseConversion wordStartCharCase) {
return of(separator, firstCharCase, wordStartCharCase, CaseConversion.LOWER_CASE);
} | [
"public",
"static",
"CaseSyntax",
"of",
"(",
"Character",
"separator",
",",
"CaseConversion",
"firstCharCase",
",",
"CaseConversion",
"wordStartCharCase",
")",
"{",
"return",
"of",
"(",
"separator",
",",
"firstCharCase",
",",
"wordStartCharCase",
",",
"CaseConversion",
".",
"LOWER_CASE",
")",
";",
"}"
] | The constructor. Will use {@link CaseConversion#LOWER_CASE} for {@link #getOtherCase() other} characters.
@param separator - see {@link #getWordSeparator()}.
@param firstCharCase - see {@link #getFirstCase()}.
@param wordStartCharCase - see {@link #getWordStartCase()}.
@return the requested {@link CaseSyntax}. | [
"The",
"constructor",
".",
"Will",
"use",
"{",
"@link",
"CaseConversion#LOWER_CASE",
"}",
"for",
"{",
"@link",
"#getOtherCase",
"()",
"other",
"}",
"characters",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/lang/src/main/java/net/sf/mmm/util/lang/api/CaseSyntax.java#L395-L398 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/EnglishGrammaticalRelations.java | EnglishGrammaticalRelations.getPrep | public static GrammaticalRelation getPrep(String prepositionString) {
"""
The "prep" grammatical relation. Used to collapse prepositions.<p>
They will be turned into prep_word, where "word" is a preposition
NOTE: Because these relations lack associated GrammaticalRelationAnnotations,
they cannot be arcs of a TreeGraphNode.
@param prepositionString The preposition to make a GrammaticalRelation out of
@return A grammatical relation for this preposition
"""
GrammaticalRelation result = preps.get(prepositionString);
if (result == null) {
synchronized(preps) {
result = preps.get(prepositionString);
if (result == null) {
result = new GrammaticalRelation(Language.English, "prep", "prep_collapsed", null, PREPOSITIONAL_MODIFIER, prepositionString);
preps.put(prepositionString, result);
threadSafeAddRelation(result);
}
}
}
return result;
} | java | public static GrammaticalRelation getPrep(String prepositionString) {
GrammaticalRelation result = preps.get(prepositionString);
if (result == null) {
synchronized(preps) {
result = preps.get(prepositionString);
if (result == null) {
result = new GrammaticalRelation(Language.English, "prep", "prep_collapsed", null, PREPOSITIONAL_MODIFIER, prepositionString);
preps.put(prepositionString, result);
threadSafeAddRelation(result);
}
}
}
return result;
} | [
"public",
"static",
"GrammaticalRelation",
"getPrep",
"(",
"String",
"prepositionString",
")",
"{",
"GrammaticalRelation",
"result",
"=",
"preps",
".",
"get",
"(",
"prepositionString",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"synchronized",
"(",
"preps",
")",
"{",
"result",
"=",
"preps",
".",
"get",
"(",
"prepositionString",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"GrammaticalRelation",
"(",
"Language",
".",
"English",
",",
"\"prep\"",
",",
"\"prep_collapsed\"",
",",
"null",
",",
"PREPOSITIONAL_MODIFIER",
",",
"prepositionString",
")",
";",
"preps",
".",
"put",
"(",
"prepositionString",
",",
"result",
")",
";",
"threadSafeAddRelation",
"(",
"result",
")",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] | The "prep" grammatical relation. Used to collapse prepositions.<p>
They will be turned into prep_word, where "word" is a preposition
NOTE: Because these relations lack associated GrammaticalRelationAnnotations,
they cannot be arcs of a TreeGraphNode.
@param prepositionString The preposition to make a GrammaticalRelation out of
@return A grammatical relation for this preposition | [
"The",
"prep",
"grammatical",
"relation",
".",
"Used",
"to",
"collapse",
"prepositions",
".",
"<p",
">",
"They",
"will",
"be",
"turned",
"into",
"prep_word",
"where",
"word",
"is",
"a",
"preposition"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/EnglishGrammaticalRelations.java#L1628-L1641 |
deephacks/confit | api-model/src/main/java/org/deephacks/confit/model/Bean.java | Bean.addReference | public void addReference(final String propertyName, final Collection<BeanId> refs) {
"""
Add a list of references to a property on this bean.
A reference identify other beans based on schema and instance id.
@param propertyName name of the property as defined by the bean's schema.
@param refs the reference as defined by the bean's schema.
"""
Preconditions.checkNotNull(refs);
Preconditions.checkNotNull(propertyName);
checkCircularReference(refs.toArray(new BeanId[refs.size()]));
List<BeanId> list = references.get(propertyName);
if (list == null) {
list = new ArrayList<>();
list.addAll(refs);
references.put(propertyName, list);
} else {
list.addAll(refs);
}
} | java | public void addReference(final String propertyName, final Collection<BeanId> refs) {
Preconditions.checkNotNull(refs);
Preconditions.checkNotNull(propertyName);
checkCircularReference(refs.toArray(new BeanId[refs.size()]));
List<BeanId> list = references.get(propertyName);
if (list == null) {
list = new ArrayList<>();
list.addAll(refs);
references.put(propertyName, list);
} else {
list.addAll(refs);
}
} | [
"public",
"void",
"addReference",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Collection",
"<",
"BeanId",
">",
"refs",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"refs",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"propertyName",
")",
";",
"checkCircularReference",
"(",
"refs",
".",
"toArray",
"(",
"new",
"BeanId",
"[",
"refs",
".",
"size",
"(",
")",
"]",
")",
")",
";",
"List",
"<",
"BeanId",
">",
"list",
"=",
"references",
".",
"get",
"(",
"propertyName",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"list",
".",
"addAll",
"(",
"refs",
")",
";",
"references",
".",
"put",
"(",
"propertyName",
",",
"list",
")",
";",
"}",
"else",
"{",
"list",
".",
"addAll",
"(",
"refs",
")",
";",
"}",
"}"
] | Add a list of references to a property on this bean.
A reference identify other beans based on schema and instance id.
@param propertyName name of the property as defined by the bean's schema.
@param refs the reference as defined by the bean's schema. | [
"Add",
"a",
"list",
"of",
"references",
"to",
"a",
"property",
"on",
"this",
"bean",
"."
] | train | https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/api-model/src/main/java/org/deephacks/confit/model/Bean.java#L286-L298 |
VoltDB/voltdb | src/frontend/org/voltdb/SQLStmt.java | SQLStmt.createWithPlan | static SQLStmt createWithPlan(byte[] sqlText,
long aggFragId,
byte[] aggPlanHash,
boolean isAggTransactional,
long collectorFragId,
byte[] collectorPlanHash,
boolean isCollectorTransactional,
boolean isReplicatedTableDML,
boolean isReadOnly,
VoltType[] params,
SiteProcedureConnection site) {
"""
Factory method to construct a SQLStmt instance from a plan outside the catalog.
@param sqlText Valid VoltDB compliant SQL
@param aggFragId Site-local id of the aggregator fragment
@param aggPlanHash 20 byte sha1 hash of the aggregator fragment plan
@param isAggTransactional Does the aggregator fragment read/write tables?
@param collectorFragId Site-local id of the collector fragment
@param collectorPlanHash 20 byte sha1 hash of the collector fragment plan
@param isCollectorTransactional Does the collector fragment read/write tables?
@param isReplicatedTableDML Flag set to true if replicated DML
@param isReadOnly Is SQL read only?
@param params Description of parameters expected by the statement
@param site SPC used for cleanup of plans
@return SQLStmt object with plan added
"""
SQLStmt stmt = new SQLStmt(sqlText, null);
stmt.aggregator = new SQLStmt.Frag(aggFragId, aggPlanHash, isAggTransactional);
if (collectorFragId > 0) {
stmt.collector = new SQLStmt.Frag(collectorFragId, collectorPlanHash, isCollectorTransactional);
}
/*
* Fill out the parameter types
*/
if (params != null) {
stmt.statementParamTypes = new byte[params.length];
for (int i = 0; i < params.length; i++) {
stmt.statementParamTypes[i] = params[i].getValue();
}
}
stmt.isReadOnly = isReadOnly;
stmt.isReplicatedTableDML = isReplicatedTableDML;
stmt.inCatalog = false;
stmt.site = site;
return stmt;
} | java | static SQLStmt createWithPlan(byte[] sqlText,
long aggFragId,
byte[] aggPlanHash,
boolean isAggTransactional,
long collectorFragId,
byte[] collectorPlanHash,
boolean isCollectorTransactional,
boolean isReplicatedTableDML,
boolean isReadOnly,
VoltType[] params,
SiteProcedureConnection site) {
SQLStmt stmt = new SQLStmt(sqlText, null);
stmt.aggregator = new SQLStmt.Frag(aggFragId, aggPlanHash, isAggTransactional);
if (collectorFragId > 0) {
stmt.collector = new SQLStmt.Frag(collectorFragId, collectorPlanHash, isCollectorTransactional);
}
/*
* Fill out the parameter types
*/
if (params != null) {
stmt.statementParamTypes = new byte[params.length];
for (int i = 0; i < params.length; i++) {
stmt.statementParamTypes[i] = params[i].getValue();
}
}
stmt.isReadOnly = isReadOnly;
stmt.isReplicatedTableDML = isReplicatedTableDML;
stmt.inCatalog = false;
stmt.site = site;
return stmt;
} | [
"static",
"SQLStmt",
"createWithPlan",
"(",
"byte",
"[",
"]",
"sqlText",
",",
"long",
"aggFragId",
",",
"byte",
"[",
"]",
"aggPlanHash",
",",
"boolean",
"isAggTransactional",
",",
"long",
"collectorFragId",
",",
"byte",
"[",
"]",
"collectorPlanHash",
",",
"boolean",
"isCollectorTransactional",
",",
"boolean",
"isReplicatedTableDML",
",",
"boolean",
"isReadOnly",
",",
"VoltType",
"[",
"]",
"params",
",",
"SiteProcedureConnection",
"site",
")",
"{",
"SQLStmt",
"stmt",
"=",
"new",
"SQLStmt",
"(",
"sqlText",
",",
"null",
")",
";",
"stmt",
".",
"aggregator",
"=",
"new",
"SQLStmt",
".",
"Frag",
"(",
"aggFragId",
",",
"aggPlanHash",
",",
"isAggTransactional",
")",
";",
"if",
"(",
"collectorFragId",
">",
"0",
")",
"{",
"stmt",
".",
"collector",
"=",
"new",
"SQLStmt",
".",
"Frag",
"(",
"collectorFragId",
",",
"collectorPlanHash",
",",
"isCollectorTransactional",
")",
";",
"}",
"/*\n * Fill out the parameter types\n */",
"if",
"(",
"params",
"!=",
"null",
")",
"{",
"stmt",
".",
"statementParamTypes",
"=",
"new",
"byte",
"[",
"params",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"params",
".",
"length",
";",
"i",
"++",
")",
"{",
"stmt",
".",
"statementParamTypes",
"[",
"i",
"]",
"=",
"params",
"[",
"i",
"]",
".",
"getValue",
"(",
")",
";",
"}",
"}",
"stmt",
".",
"isReadOnly",
"=",
"isReadOnly",
";",
"stmt",
".",
"isReplicatedTableDML",
"=",
"isReplicatedTableDML",
";",
"stmt",
".",
"inCatalog",
"=",
"false",
";",
"stmt",
".",
"site",
"=",
"site",
";",
"return",
"stmt",
";",
"}"
] | Factory method to construct a SQLStmt instance from a plan outside the catalog.
@param sqlText Valid VoltDB compliant SQL
@param aggFragId Site-local id of the aggregator fragment
@param aggPlanHash 20 byte sha1 hash of the aggregator fragment plan
@param isAggTransactional Does the aggregator fragment read/write tables?
@param collectorFragId Site-local id of the collector fragment
@param collectorPlanHash 20 byte sha1 hash of the collector fragment plan
@param isCollectorTransactional Does the collector fragment read/write tables?
@param isReplicatedTableDML Flag set to true if replicated DML
@param isReadOnly Is SQL read only?
@param params Description of parameters expected by the statement
@param site SPC used for cleanup of plans
@return SQLStmt object with plan added | [
"Factory",
"method",
"to",
"construct",
"a",
"SQLStmt",
"instance",
"from",
"a",
"plan",
"outside",
"the",
"catalog",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/SQLStmt.java#L158-L194 |
iorga-group/iraj | iraj/src/main/java/com/iorga/iraj/servlet/CacheAwareServlet.java | CacheAwareServlet.doHead | @Override
protected void doHead(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException {
"""
Process a HEAD request for the specified resource.
@param request
The servlet request we are processing
@param response
The servlet response we are creating
@exception IOException
if an input/output error occurs
@exception ServletException
if a servlet-specified error occurs
"""
// Serve the requested resource, without the data content
serveResource(request, response, false);
} | java | @Override
protected void doHead(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException {
// Serve the requested resource, without the data content
serveResource(request, response, false);
} | [
"@",
"Override",
"protected",
"void",
"doHead",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"// Serve the requested resource, without the data content",
"serveResource",
"(",
"request",
",",
"response",
",",
"false",
")",
";",
"}"
] | Process a HEAD request for the specified resource.
@param request
The servlet request we are processing
@param response
The servlet response we are creating
@exception IOException
if an input/output error occurs
@exception ServletException
if a servlet-specified error occurs | [
"Process",
"a",
"HEAD",
"request",
"for",
"the",
"specified",
"resource",
"."
] | train | https://github.com/iorga-group/iraj/blob/5fdee26464248f29833610de402275eb64505542/iraj/src/main/java/com/iorga/iraj/servlet/CacheAwareServlet.java#L184-L190 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.router_new_GET | public ArrayList<String> router_new_GET(String vrack) throws IOException {
"""
Get allowed durations for 'new' option
REST: GET /order/router/new
@param vrack [required] The name of your vrack
"""
String qPath = "/order/router/new";
StringBuilder sb = path(qPath);
query(sb, "vrack", vrack);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> router_new_GET(String vrack) throws IOException {
String qPath = "/order/router/new";
StringBuilder sb = path(qPath);
query(sb, "vrack", vrack);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"router_new_GET",
"(",
"String",
"vrack",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/router/new\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"query",
"(",
"sb",
",",
"\"vrack\"",
",",
"vrack",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t1",
")",
";",
"}"
] | Get allowed durations for 'new' option
REST: GET /order/router/new
@param vrack [required] The name of your vrack | [
"Get",
"allowed",
"durations",
"for",
"new",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L910-L916 |
i-net-software/jlessc | src/com/inet/lib/less/LessParser.java | LessParser.parse | void parse( URL baseURL, Reader input, ReaderFactory readerFactory ) throws MalformedURLException, LessException {
"""
Main method for parsing of main less file.
@param baseURL
the baseURL for import of external less data.
@param input
the less input data
@param readerFactory
A factory for the readers for imports.
@throws MalformedURLException
Should never occur
@throws LessException
if any parsing error occurred
"""
this.baseURL = baseURL;
this.readerFactory = readerFactory;
this.relativeURL = new URL( "file", null, "" );
this.reader = new LessLookAheadReader( input, null, false, false );
parse( this );
} | java | void parse( URL baseURL, Reader input, ReaderFactory readerFactory ) throws MalformedURLException, LessException {
this.baseURL = baseURL;
this.readerFactory = readerFactory;
this.relativeURL = new URL( "file", null, "" );
this.reader = new LessLookAheadReader( input, null, false, false );
parse( this );
} | [
"void",
"parse",
"(",
"URL",
"baseURL",
",",
"Reader",
"input",
",",
"ReaderFactory",
"readerFactory",
")",
"throws",
"MalformedURLException",
",",
"LessException",
"{",
"this",
".",
"baseURL",
"=",
"baseURL",
";",
"this",
".",
"readerFactory",
"=",
"readerFactory",
";",
"this",
".",
"relativeURL",
"=",
"new",
"URL",
"(",
"\"file\"",
",",
"null",
",",
"\"\"",
")",
";",
"this",
".",
"reader",
"=",
"new",
"LessLookAheadReader",
"(",
"input",
",",
"null",
",",
"false",
",",
"false",
")",
";",
"parse",
"(",
"this",
")",
";",
"}"
] | Main method for parsing of main less file.
@param baseURL
the baseURL for import of external less data.
@param input
the less input data
@param readerFactory
A factory for the readers for imports.
@throws MalformedURLException
Should never occur
@throws LessException
if any parsing error occurred | [
"Main",
"method",
"for",
"parsing",
"of",
"main",
"less",
"file",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L117-L123 |
overturetool/overture | core/typechecker/src/main/java/org/overture/typechecker/visitor/AbstractTypeCheckVisitor.java | AbstractTypeCheckVisitor.typeCheckLet | protected PType typeCheckLet(INode node, LinkedList<PDefinition> localDefs,
INode body, TypeCheckInfo question) throws AnalysisException {
"""
Type checks a let node
@param node
@param localDefs
@param body
@param question
@return
@throws AnalysisException
"""
// Each local definition is in scope for later local definitions...
Environment local = question.env;
for (PDefinition d : localDefs)
{
if (d instanceof AExplicitFunctionDefinition)
{
// Functions' names are in scope in their bodies, whereas
// simple variable declarations aren't
local = new FlatCheckedEnvironment(question.assistantFactory, d, local, question.scope); // cumulative
question.assistantFactory.createPDefinitionAssistant().implicitDefinitions(d, local);
question.assistantFactory.createPDefinitionAssistant().typeResolve(d, THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers));
if (question.env.isVDMPP())
{
SClassDefinition cdef = question.env.findClassDefinition();
// question.assistantFactory.createPDefinitionAssistant().setClassDefinition(d, cdef);
d.setClassDefinition(cdef);
d.setAccess(question.assistantFactory.createPAccessSpecifierAssistant().getStatic(d, true));
}
d.apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers));
} else
{
question.assistantFactory.createPDefinitionAssistant().implicitDefinitions(d, local);
question.assistantFactory.createPDefinitionAssistant().typeResolve(d, THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers));
d.apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope));
local = new FlatCheckedEnvironment(question.assistantFactory, d, local, question.scope); // cumulative
}
}
PType r = body.apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, null, question.constraint, null));
local.unusedCheck(question.env);
return r;
} | java | protected PType typeCheckLet(INode node, LinkedList<PDefinition> localDefs,
INode body, TypeCheckInfo question) throws AnalysisException
{
// Each local definition is in scope for later local definitions...
Environment local = question.env;
for (PDefinition d : localDefs)
{
if (d instanceof AExplicitFunctionDefinition)
{
// Functions' names are in scope in their bodies, whereas
// simple variable declarations aren't
local = new FlatCheckedEnvironment(question.assistantFactory, d, local, question.scope); // cumulative
question.assistantFactory.createPDefinitionAssistant().implicitDefinitions(d, local);
question.assistantFactory.createPDefinitionAssistant().typeResolve(d, THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers));
if (question.env.isVDMPP())
{
SClassDefinition cdef = question.env.findClassDefinition();
// question.assistantFactory.createPDefinitionAssistant().setClassDefinition(d, cdef);
d.setClassDefinition(cdef);
d.setAccess(question.assistantFactory.createPAccessSpecifierAssistant().getStatic(d, true));
}
d.apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers));
} else
{
question.assistantFactory.createPDefinitionAssistant().implicitDefinitions(d, local);
question.assistantFactory.createPDefinitionAssistant().typeResolve(d, THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers));
d.apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope));
local = new FlatCheckedEnvironment(question.assistantFactory, d, local, question.scope); // cumulative
}
}
PType r = body.apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, null, question.constraint, null));
local.unusedCheck(question.env);
return r;
} | [
"protected",
"PType",
"typeCheckLet",
"(",
"INode",
"node",
",",
"LinkedList",
"<",
"PDefinition",
">",
"localDefs",
",",
"INode",
"body",
",",
"TypeCheckInfo",
"question",
")",
"throws",
"AnalysisException",
"{",
"// Each local definition is in scope for later local definitions...",
"Environment",
"local",
"=",
"question",
".",
"env",
";",
"for",
"(",
"PDefinition",
"d",
":",
"localDefs",
")",
"{",
"if",
"(",
"d",
"instanceof",
"AExplicitFunctionDefinition",
")",
"{",
"// Functions' names are in scope in their bodies, whereas",
"// simple variable declarations aren't",
"local",
"=",
"new",
"FlatCheckedEnvironment",
"(",
"question",
".",
"assistantFactory",
",",
"d",
",",
"local",
",",
"question",
".",
"scope",
")",
";",
"// cumulative",
"question",
".",
"assistantFactory",
".",
"createPDefinitionAssistant",
"(",
")",
".",
"implicitDefinitions",
"(",
"d",
",",
"local",
")",
";",
"question",
".",
"assistantFactory",
".",
"createPDefinitionAssistant",
"(",
")",
".",
"typeResolve",
"(",
"d",
",",
"THIS",
",",
"new",
"TypeCheckInfo",
"(",
"question",
".",
"assistantFactory",
",",
"local",
",",
"question",
".",
"scope",
",",
"question",
".",
"qualifiers",
")",
")",
";",
"if",
"(",
"question",
".",
"env",
".",
"isVDMPP",
"(",
")",
")",
"{",
"SClassDefinition",
"cdef",
"=",
"question",
".",
"env",
".",
"findClassDefinition",
"(",
")",
";",
"// question.assistantFactory.createPDefinitionAssistant().setClassDefinition(d, cdef);",
"d",
".",
"setClassDefinition",
"(",
"cdef",
")",
";",
"d",
".",
"setAccess",
"(",
"question",
".",
"assistantFactory",
".",
"createPAccessSpecifierAssistant",
"(",
")",
".",
"getStatic",
"(",
"d",
",",
"true",
")",
")",
";",
"}",
"d",
".",
"apply",
"(",
"THIS",
",",
"new",
"TypeCheckInfo",
"(",
"question",
".",
"assistantFactory",
",",
"local",
",",
"question",
".",
"scope",
",",
"question",
".",
"qualifiers",
")",
")",
";",
"}",
"else",
"{",
"question",
".",
"assistantFactory",
".",
"createPDefinitionAssistant",
"(",
")",
".",
"implicitDefinitions",
"(",
"d",
",",
"local",
")",
";",
"question",
".",
"assistantFactory",
".",
"createPDefinitionAssistant",
"(",
")",
".",
"typeResolve",
"(",
"d",
",",
"THIS",
",",
"new",
"TypeCheckInfo",
"(",
"question",
".",
"assistantFactory",
",",
"local",
",",
"question",
".",
"scope",
",",
"question",
".",
"qualifiers",
")",
")",
";",
"d",
".",
"apply",
"(",
"THIS",
",",
"new",
"TypeCheckInfo",
"(",
"question",
".",
"assistantFactory",
",",
"local",
",",
"question",
".",
"scope",
")",
")",
";",
"local",
"=",
"new",
"FlatCheckedEnvironment",
"(",
"question",
".",
"assistantFactory",
",",
"d",
",",
"local",
",",
"question",
".",
"scope",
")",
";",
"// cumulative",
"}",
"}",
"PType",
"r",
"=",
"body",
".",
"apply",
"(",
"THIS",
",",
"new",
"TypeCheckInfo",
"(",
"question",
".",
"assistantFactory",
",",
"local",
",",
"question",
".",
"scope",
",",
"null",
",",
"question",
".",
"constraint",
",",
"null",
")",
")",
";",
"local",
".",
"unusedCheck",
"(",
"question",
".",
"env",
")",
";",
"return",
"r",
";",
"}"
] | Type checks a let node
@param node
@param localDefs
@param body
@param question
@return
@throws AnalysisException | [
"Type",
"checks",
"a",
"let",
"node"
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/visitor/AbstractTypeCheckVisitor.java#L192-L231 |
landawn/AbacusUtil | src/com/landawn/abacus/util/CSVUtil.java | CSVUtil.importCSV | @SuppressWarnings("rawtypes")
public static <E extends Exception> long importCSV(final File file, final long offset, final long count, final boolean skipTitle,
final Try.Predicate<String[], E> filter, final PreparedStatement stmt, final int batchSize, final int batchInterval,
final List<? extends Type> columnTypeList) throws UncheckedSQLException, UncheckedIOException, E {
"""
Imports the data from CSV to database.
@param file
@param offset
@param count
@param skipTitle
@param filter
@param stmt the column order in the sql must be consistent with the column order in the CSV file.
@param batchSize
@param batchInterval
@param columnTypeList set the column type to null to skip the column in CSV.
@return
"""
Reader reader = null;
try {
reader = new FileReader(file);
return importCSV(reader, offset, count, skipTitle, filter, stmt, batchSize, batchInterval, columnTypeList);
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
IOUtil.close(reader);
}
} | java | @SuppressWarnings("rawtypes")
public static <E extends Exception> long importCSV(final File file, final long offset, final long count, final boolean skipTitle,
final Try.Predicate<String[], E> filter, final PreparedStatement stmt, final int batchSize, final int batchInterval,
final List<? extends Type> columnTypeList) throws UncheckedSQLException, UncheckedIOException, E {
Reader reader = null;
try {
reader = new FileReader(file);
return importCSV(reader, offset, count, skipTitle, filter, stmt, batchSize, batchInterval, columnTypeList);
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
IOUtil.close(reader);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"<",
"E",
"extends",
"Exception",
">",
"long",
"importCSV",
"(",
"final",
"File",
"file",
",",
"final",
"long",
"offset",
",",
"final",
"long",
"count",
",",
"final",
"boolean",
"skipTitle",
",",
"final",
"Try",
".",
"Predicate",
"<",
"String",
"[",
"]",
",",
"E",
">",
"filter",
",",
"final",
"PreparedStatement",
"stmt",
",",
"final",
"int",
"batchSize",
",",
"final",
"int",
"batchInterval",
",",
"final",
"List",
"<",
"?",
"extends",
"Type",
">",
"columnTypeList",
")",
"throws",
"UncheckedSQLException",
",",
"UncheckedIOException",
",",
"E",
"{",
"Reader",
"reader",
"=",
"null",
";",
"try",
"{",
"reader",
"=",
"new",
"FileReader",
"(",
"file",
")",
";",
"return",
"importCSV",
"(",
"reader",
",",
"offset",
",",
"count",
",",
"skipTitle",
",",
"filter",
",",
"stmt",
",",
"batchSize",
",",
"batchInterval",
",",
"columnTypeList",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"UncheckedIOException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"IOUtil",
".",
"close",
"(",
"reader",
")",
";",
"}",
"}"
] | Imports the data from CSV to database.
@param file
@param offset
@param count
@param skipTitle
@param filter
@param stmt the column order in the sql must be consistent with the column order in the CSV file.
@param batchSize
@param batchInterval
@param columnTypeList set the column type to null to skip the column in CSV.
@return | [
"Imports",
"the",
"data",
"from",
"CSV",
"to",
"database",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/CSVUtil.java#L1140-L1155 |
pressgang-ccms/PressGangCCMSQuery | src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java | JPAUtils.findRoot | public static <T> Root<T> findRoot(CriteriaQuery<T> query) {
"""
Find Root of result type
@param query criteria query
@return the root of result type or null if none
"""
return findRoot(query, query.getResultType());
} | java | public static <T> Root<T> findRoot(CriteriaQuery<T> query) {
return findRoot(query, query.getResultType());
} | [
"public",
"static",
"<",
"T",
">",
"Root",
"<",
"T",
">",
"findRoot",
"(",
"CriteriaQuery",
"<",
"T",
">",
"query",
")",
"{",
"return",
"findRoot",
"(",
"query",
",",
"query",
".",
"getResultType",
"(",
")",
")",
";",
"}"
] | Find Root of result type
@param query criteria query
@return the root of result type or null if none | [
"Find",
"Root",
"of",
"result",
"type"
] | train | https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java#L107-L109 |
GoSimpleLLC/nbvcxz | src/main/java/me/gosimple/nbvcxz/resources/AdjacencyGraphUtil.java | AdjacencyGraphUtil.calcAverageDegree | public static double calcAverageDegree(HashMap<Character, String[]> keys) {
"""
Calculates the average "degree" of a keyboard or keypad. On the qwerty
keyboard, 'g' has degree 6, being adjacent to 'ftyhbv' and '\' has degree
1.
@param keys a keyboard or keypad
@return the average degree for this keyboard or keypad
"""
double average = 0d;
for (Map.Entry<Character, String[]> entry : keys.entrySet())
{
average += neighborsNumber(entry.getValue());
}
return average / (double) keys.size();
} | java | public static double calcAverageDegree(HashMap<Character, String[]> keys)
{
double average = 0d;
for (Map.Entry<Character, String[]> entry : keys.entrySet())
{
average += neighborsNumber(entry.getValue());
}
return average / (double) keys.size();
} | [
"public",
"static",
"double",
"calcAverageDegree",
"(",
"HashMap",
"<",
"Character",
",",
"String",
"[",
"]",
">",
"keys",
")",
"{",
"double",
"average",
"=",
"0d",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Character",
",",
"String",
"[",
"]",
">",
"entry",
":",
"keys",
".",
"entrySet",
"(",
")",
")",
"{",
"average",
"+=",
"neighborsNumber",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"average",
"/",
"(",
"double",
")",
"keys",
".",
"size",
"(",
")",
";",
"}"
] | Calculates the average "degree" of a keyboard or keypad. On the qwerty
keyboard, 'g' has degree 6, being adjacent to 'ftyhbv' and '\' has degree
1.
@param keys a keyboard or keypad
@return the average degree for this keyboard or keypad | [
"Calculates",
"the",
"average",
"degree",
"of",
"a",
"keyboard",
"or",
"keypad",
".",
"On",
"the",
"qwerty",
"keyboard",
"g",
"has",
"degree",
"6",
"being",
"adjacent",
"to",
"ftyhbv",
"and",
"\\",
"has",
"degree",
"1",
"."
] | train | https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/resources/AdjacencyGraphUtil.java#L281-L289 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/DateUtils.java | DateUtils.setMinutes | public static Date setMinutes(final Date date, final int amount) {
"""
Sets the minute field to a date returning a new object.
The original {@code Date} is unchanged.
@param date the date, not null
@param amount the amount to set
@return a new {@code Date} set with the specified value
@throws IllegalArgumentException if the date is null
@since 2.4
"""
return set(date, Calendar.MINUTE, amount);
} | java | public static Date setMinutes(final Date date, final int amount) {
return set(date, Calendar.MINUTE, amount);
} | [
"public",
"static",
"Date",
"setMinutes",
"(",
"final",
"Date",
"date",
",",
"final",
"int",
"amount",
")",
"{",
"return",
"set",
"(",
"date",
",",
"Calendar",
".",
"MINUTE",
",",
"amount",
")",
";",
"}"
] | Sets the minute field to a date returning a new object.
The original {@code Date} is unchanged.
@param date the date, not null
@param amount the amount to set
@return a new {@code Date} set with the specified value
@throws IllegalArgumentException if the date is null
@since 2.4 | [
"Sets",
"the",
"minute",
"field",
"to",
"a",
"date",
"returning",
"a",
"new",
"object",
".",
"The",
"original",
"{",
"@code",
"Date",
"}",
"is",
"unchanged",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L601-L603 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java | ToXMLStream.pushNamespace | protected boolean pushNamespace(String prefix, String uri) {
"""
From XSLTC
Declare a prefix to point to a namespace URI. Inform SAX handler
if this is a new prefix mapping.
"""
try
{
if (m_prefixMap.pushNamespace(
prefix, uri, m_elemContext.m_currentElemDepth))
{
startPrefixMapping(prefix, uri);
return true;
}
}
catch (SAXException e)
{
// falls through
}
return false;
} | java | protected boolean pushNamespace(String prefix, String uri)
{
try
{
if (m_prefixMap.pushNamespace(
prefix, uri, m_elemContext.m_currentElemDepth))
{
startPrefixMapping(prefix, uri);
return true;
}
}
catch (SAXException e)
{
// falls through
}
return false;
} | [
"protected",
"boolean",
"pushNamespace",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"{",
"try",
"{",
"if",
"(",
"m_prefixMap",
".",
"pushNamespace",
"(",
"prefix",
",",
"uri",
",",
"m_elemContext",
".",
"m_currentElemDepth",
")",
")",
"{",
"startPrefixMapping",
"(",
"prefix",
",",
"uri",
")",
";",
"return",
"true",
";",
"}",
"}",
"catch",
"(",
"SAXException",
"e",
")",
"{",
"// falls through",
"}",
"return",
"false",
";",
"}"
] | From XSLTC
Declare a prefix to point to a namespace URI. Inform SAX handler
if this is a new prefix mapping. | [
"From",
"XSLTC",
"Declare",
"a",
"prefix",
"to",
"point",
"to",
"a",
"namespace",
"URI",
".",
"Inform",
"SAX",
"handler",
"if",
"this",
"is",
"a",
"new",
"prefix",
"mapping",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java#L557-L573 |
m-m-m/util | datatype/src/main/java/net/sf/mmm/util/datatype/api/color/Color.java | Color.valueOf | public static Color valueOf(String color) {
"""
Parses the {@link Color} given as {@link String} representation.
@param color is the {@link Color} given as {@link String} representation.
@return the parsed {@link Color}.
"""
Objects.requireNonNull(color, "color");
Throwable cause = null;
try {
Color hexColor = parseHexString(color);
if (hexColor != null) {
return hexColor;
} else {
String upperColor = BasicHelper.toUpperCase(color);
Color namedColor = NAME_TO_COLOR_MAP.get(upperColor);
if (namedColor != null) {
return namedColor;
} else if (upperColor.startsWith(ColorModel.RGB.toString())) {
Color rgbColor = parseRgb(upperColor);
if (rgbColor != null) {
return rgbColor;
}
} else {
return GenericColor.valueOf(color).toColor();
}
}
} catch (NumberFormatException e) {
cause = e;
}
throw new IllegalArgumentException(color, cause);
} | java | public static Color valueOf(String color) {
Objects.requireNonNull(color, "color");
Throwable cause = null;
try {
Color hexColor = parseHexString(color);
if (hexColor != null) {
return hexColor;
} else {
String upperColor = BasicHelper.toUpperCase(color);
Color namedColor = NAME_TO_COLOR_MAP.get(upperColor);
if (namedColor != null) {
return namedColor;
} else if (upperColor.startsWith(ColorModel.RGB.toString())) {
Color rgbColor = parseRgb(upperColor);
if (rgbColor != null) {
return rgbColor;
}
} else {
return GenericColor.valueOf(color).toColor();
}
}
} catch (NumberFormatException e) {
cause = e;
}
throw new IllegalArgumentException(color, cause);
} | [
"public",
"static",
"Color",
"valueOf",
"(",
"String",
"color",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"color",
",",
"\"color\"",
")",
";",
"Throwable",
"cause",
"=",
"null",
";",
"try",
"{",
"Color",
"hexColor",
"=",
"parseHexString",
"(",
"color",
")",
";",
"if",
"(",
"hexColor",
"!=",
"null",
")",
"{",
"return",
"hexColor",
";",
"}",
"else",
"{",
"String",
"upperColor",
"=",
"BasicHelper",
".",
"toUpperCase",
"(",
"color",
")",
";",
"Color",
"namedColor",
"=",
"NAME_TO_COLOR_MAP",
".",
"get",
"(",
"upperColor",
")",
";",
"if",
"(",
"namedColor",
"!=",
"null",
")",
"{",
"return",
"namedColor",
";",
"}",
"else",
"if",
"(",
"upperColor",
".",
"startsWith",
"(",
"ColorModel",
".",
"RGB",
".",
"toString",
"(",
")",
")",
")",
"{",
"Color",
"rgbColor",
"=",
"parseRgb",
"(",
"upperColor",
")",
";",
"if",
"(",
"rgbColor",
"!=",
"null",
")",
"{",
"return",
"rgbColor",
";",
"}",
"}",
"else",
"{",
"return",
"GenericColor",
".",
"valueOf",
"(",
"color",
")",
".",
"toColor",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"cause",
"=",
"e",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"color",
",",
"cause",
")",
";",
"}"
] | Parses the {@link Color} given as {@link String} representation.
@param color is the {@link Color} given as {@link String} representation.
@return the parsed {@link Color}. | [
"Parses",
"the",
"{",
"@link",
"Color",
"}",
"given",
"as",
"{",
"@link",
"String",
"}",
"representation",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/datatype/src/main/java/net/sf/mmm/util/datatype/api/color/Color.java#L221-L247 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java | CPInstancePersistenceImpl.findByGroupId | @Override
public List<CPInstance> findByGroupId(long groupId, int start, int end) {
"""
Returns a range of all the cp instances where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPInstanceModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of cp instances
@param end the upper bound of the range of cp instances (not inclusive)
@return the range of matching cp instances
"""
return findByGroupId(groupId, start, end, null);
} | java | @Override
public List<CPInstance> findByGroupId(long groupId, int start, int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPInstance",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp instances where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPInstanceModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of cp instances
@param end the upper bound of the range of cp instances (not inclusive)
@return the range of matching cp instances | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"instances",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L1524-L1527 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/date/GosuDateUtil.java | GosuDateUtil.addHours | public static Date addHours(Date date, int iHours) {
"""
Adds the specified (signed) amount of hours to the given date. For
example, to subtract 5 hours from the current date, you can
achieve it by calling: <code>addHours(Date, -5)</code>.
@param date The time.
@param iHours The amount of hours to add.
@return A new date with the hours added.
"""
Calendar dateTime = dateToCalendar(date);
dateTime.add(Calendar.HOUR, iHours);
return dateTime.getTime();
} | java | public static Date addHours(Date date, int iHours) {
Calendar dateTime = dateToCalendar(date);
dateTime.add(Calendar.HOUR, iHours);
return dateTime.getTime();
} | [
"public",
"static",
"Date",
"addHours",
"(",
"Date",
"date",
",",
"int",
"iHours",
")",
"{",
"Calendar",
"dateTime",
"=",
"dateToCalendar",
"(",
"date",
")",
";",
"dateTime",
".",
"add",
"(",
"Calendar",
".",
"HOUR",
",",
"iHours",
")",
";",
"return",
"dateTime",
".",
"getTime",
"(",
")",
";",
"}"
] | Adds the specified (signed) amount of hours to the given date. For
example, to subtract 5 hours from the current date, you can
achieve it by calling: <code>addHours(Date, -5)</code>.
@param date The time.
@param iHours The amount of hours to add.
@return A new date with the hours added. | [
"Adds",
"the",
"specified",
"(",
"signed",
")",
"amount",
"of",
"hours",
"to",
"the",
"given",
"date",
".",
"For",
"example",
"to",
"subtract",
"5",
"hours",
"from",
"the",
"current",
"date",
"you",
"can",
"achieve",
"it",
"by",
"calling",
":",
"<code",
">",
"addHours",
"(",
"Date",
"-",
"5",
")",
"<",
"/",
"code",
">",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/date/GosuDateUtil.java#L60-L64 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/SeleniumSpec.java | SeleniumSpec.assertSeleniumTextOnElementPresent | @Then("^the element on index '(\\d+?)' has '(.+?)' as text$")
public void assertSeleniumTextOnElementPresent(Integer index, String text) {
"""
Verifies that a webelement previously found has {@code text} as text
@param index
@param text
"""
assertThat(commonspec.getPreviousWebElements()).as("There are less found elements than required")
.hasAtLeast(index);
String elementText = commonspec.getPreviousWebElements().getPreviousWebElements().get(index).getText().replace("\n", " ").replace("\r", " ");
if (!elementText.startsWith("regex:")) {
//We are verifying that a web element contains a string
assertThat(elementText.matches("(.*)" + text + "(.*)")).isTrue();
} else {
//We are verifying that a web element contains a regex
assertThat(elementText.matches(text.substring(text.indexOf("regex:") + 6, text.length()))).isTrue();
}
} | java | @Then("^the element on index '(\\d+?)' has '(.+?)' as text$")
public void assertSeleniumTextOnElementPresent(Integer index, String text) {
assertThat(commonspec.getPreviousWebElements()).as("There are less found elements than required")
.hasAtLeast(index);
String elementText = commonspec.getPreviousWebElements().getPreviousWebElements().get(index).getText().replace("\n", " ").replace("\r", " ");
if (!elementText.startsWith("regex:")) {
//We are verifying that a web element contains a string
assertThat(elementText.matches("(.*)" + text + "(.*)")).isTrue();
} else {
//We are verifying that a web element contains a regex
assertThat(elementText.matches(text.substring(text.indexOf("regex:") + 6, text.length()))).isTrue();
}
} | [
"@",
"Then",
"(",
"\"^the element on index '(\\\\d+?)' has '(.+?)' as text$\"",
")",
"public",
"void",
"assertSeleniumTextOnElementPresent",
"(",
"Integer",
"index",
",",
"String",
"text",
")",
"{",
"assertThat",
"(",
"commonspec",
".",
"getPreviousWebElements",
"(",
")",
")",
".",
"as",
"(",
"\"There are less found elements than required\"",
")",
".",
"hasAtLeast",
"(",
"index",
")",
";",
"String",
"elementText",
"=",
"commonspec",
".",
"getPreviousWebElements",
"(",
")",
".",
"getPreviousWebElements",
"(",
")",
".",
"get",
"(",
"index",
")",
".",
"getText",
"(",
")",
".",
"replace",
"(",
"\"\\n\"",
",",
"\" \"",
")",
".",
"replace",
"(",
"\"\\r\"",
",",
"\" \"",
")",
";",
"if",
"(",
"!",
"elementText",
".",
"startsWith",
"(",
"\"regex:\"",
")",
")",
"{",
"//We are verifying that a web element contains a string",
"assertThat",
"(",
"elementText",
".",
"matches",
"(",
"\"(.*)\"",
"+",
"text",
"+",
"\"(.*)\"",
")",
")",
".",
"isTrue",
"(",
")",
";",
"}",
"else",
"{",
"//We are verifying that a web element contains a regex",
"assertThat",
"(",
"elementText",
".",
"matches",
"(",
"text",
".",
"substring",
"(",
"text",
".",
"indexOf",
"(",
"\"regex:\"",
")",
"+",
"6",
",",
"text",
".",
"length",
"(",
")",
")",
")",
")",
".",
"isTrue",
"(",
")",
";",
"}",
"}"
] | Verifies that a webelement previously found has {@code text} as text
@param index
@param text | [
"Verifies",
"that",
"a",
"webelement",
"previously",
"found",
"has",
"{",
"@code",
"text",
"}",
"as",
"text"
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/SeleniumSpec.java#L399-L411 |
httl/httl | httl/src/main/java/httl/spi/codecs/json/JSONArray.java | JSONArray.getBoolean | public boolean getBoolean(int index, boolean def) {
"""
get boolean value.
@param index index.
@param def default value.
@return value or default value.
"""
Object tmp = mArray.get(index);
return tmp != null && tmp instanceof Boolean ? ((Boolean) tmp)
.booleanValue() : def;
} | java | public boolean getBoolean(int index, boolean def) {
Object tmp = mArray.get(index);
return tmp != null && tmp instanceof Boolean ? ((Boolean) tmp)
.booleanValue() : def;
} | [
"public",
"boolean",
"getBoolean",
"(",
"int",
"index",
",",
"boolean",
"def",
")",
"{",
"Object",
"tmp",
"=",
"mArray",
".",
"get",
"(",
"index",
")",
";",
"return",
"tmp",
"!=",
"null",
"&&",
"tmp",
"instanceof",
"Boolean",
"?",
"(",
"(",
"Boolean",
")",
"tmp",
")",
".",
"booleanValue",
"(",
")",
":",
"def",
";",
"}"
] | get boolean value.
@param index index.
@param def default value.
@return value or default value. | [
"get",
"boolean",
"value",
"."
] | train | https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/spi/codecs/json/JSONArray.java#L49-L53 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java | SparkComputationGraph.fitMultiDataSet | public ComputationGraph fitMultiDataSet(String path) {
"""
Fit the SparkComputationGraph network using a directory of serialized MultiDataSet objects
The assumption here is that the directory contains a number of serialized {@link MultiDataSet} objects
@param path Path to the directory containing the serialized MultiDataSet objcets
@return The MultiLayerNetwork after training
"""
if (Nd4j.getExecutioner() instanceof GridExecutioner)
((GridExecutioner) Nd4j.getExecutioner()).flushQueue();
JavaRDD<String> paths;
try {
paths = SparkUtils.listPaths(sc, path);
} catch (IOException e) {
throw new RuntimeException("Error listing paths in directory", e);
}
return fitPathsMultiDataSet(paths);
} | java | public ComputationGraph fitMultiDataSet(String path) {
if (Nd4j.getExecutioner() instanceof GridExecutioner)
((GridExecutioner) Nd4j.getExecutioner()).flushQueue();
JavaRDD<String> paths;
try {
paths = SparkUtils.listPaths(sc, path);
} catch (IOException e) {
throw new RuntimeException("Error listing paths in directory", e);
}
return fitPathsMultiDataSet(paths);
} | [
"public",
"ComputationGraph",
"fitMultiDataSet",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"Nd4j",
".",
"getExecutioner",
"(",
")",
"instanceof",
"GridExecutioner",
")",
"(",
"(",
"GridExecutioner",
")",
"Nd4j",
".",
"getExecutioner",
"(",
")",
")",
".",
"flushQueue",
"(",
")",
";",
"JavaRDD",
"<",
"String",
">",
"paths",
";",
"try",
"{",
"paths",
"=",
"SparkUtils",
".",
"listPaths",
"(",
"sc",
",",
"path",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Error listing paths in directory\"",
",",
"e",
")",
";",
"}",
"return",
"fitPathsMultiDataSet",
"(",
"paths",
")",
";",
"}"
] | Fit the SparkComputationGraph network using a directory of serialized MultiDataSet objects
The assumption here is that the directory contains a number of serialized {@link MultiDataSet} objects
@param path Path to the directory containing the serialized MultiDataSet objcets
@return The MultiLayerNetwork after training | [
"Fit",
"the",
"SparkComputationGraph",
"network",
"using",
"a",
"directory",
"of",
"serialized",
"MultiDataSet",
"objects",
"The",
"assumption",
"here",
"is",
"that",
"the",
"directory",
"contains",
"a",
"number",
"of",
"serialized",
"{",
"@link",
"MultiDataSet",
"}",
"objects"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L303-L315 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/persister/MapTilePersisterModel.java | MapTilePersisterModel.saveTiles | private void saveTiles(FileWriting file, int widthInTile, int step, int s) throws IOException {
"""
Save the active tiles.
@param file The output file.
@param widthInTile The horizontal tiles.
@param step The step number.
@param s The s value.
@throws IOException If error on saving.
"""
for (int tx = 0; tx < widthInTile; tx++)
{
for (int ty = 0; ty < map.getInTileHeight(); ty++)
{
final Tile tile = map.getTile(tx + s * step, ty);
if (tile != null)
{
saveTile(file, tile);
}
}
}
} | java | private void saveTiles(FileWriting file, int widthInTile, int step, int s) throws IOException
{
for (int tx = 0; tx < widthInTile; tx++)
{
for (int ty = 0; ty < map.getInTileHeight(); ty++)
{
final Tile tile = map.getTile(tx + s * step, ty);
if (tile != null)
{
saveTile(file, tile);
}
}
}
} | [
"private",
"void",
"saveTiles",
"(",
"FileWriting",
"file",
",",
"int",
"widthInTile",
",",
"int",
"step",
",",
"int",
"s",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"tx",
"=",
"0",
";",
"tx",
"<",
"widthInTile",
";",
"tx",
"++",
")",
"{",
"for",
"(",
"int",
"ty",
"=",
"0",
";",
"ty",
"<",
"map",
".",
"getInTileHeight",
"(",
")",
";",
"ty",
"++",
")",
"{",
"final",
"Tile",
"tile",
"=",
"map",
".",
"getTile",
"(",
"tx",
"+",
"s",
"*",
"step",
",",
"ty",
")",
";",
"if",
"(",
"tile",
"!=",
"null",
")",
"{",
"saveTile",
"(",
"file",
",",
"tile",
")",
";",
"}",
"}",
"}",
"}"
] | Save the active tiles.
@param file The output file.
@param widthInTile The horizontal tiles.
@param step The step number.
@param s The s value.
@throws IOException If error on saving. | [
"Save",
"the",
"active",
"tiles",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/persister/MapTilePersisterModel.java#L144-L157 |
apache/groovy | subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java | DateTimeExtensions.leftShift | public static YearMonth leftShift(final Month self, Year year) {
"""
Creates a {@link java.time.YearMonth} at the provided {@link java.time.Year}.
@param self a Month
@param year a Year
@return a YearMonth
@since 2.5.0
"""
return YearMonth.of(year.getValue(), self);
} | java | public static YearMonth leftShift(final Month self, Year year) {
return YearMonth.of(year.getValue(), self);
} | [
"public",
"static",
"YearMonth",
"leftShift",
"(",
"final",
"Month",
"self",
",",
"Year",
"year",
")",
"{",
"return",
"YearMonth",
".",
"of",
"(",
"year",
".",
"getValue",
"(",
")",
",",
"self",
")",
";",
"}"
] | Creates a {@link java.time.YearMonth} at the provided {@link java.time.Year}.
@param self a Month
@param year a Year
@return a YearMonth
@since 2.5.0 | [
"Creates",
"a",
"{",
"@link",
"java",
".",
"time",
".",
"YearMonth",
"}",
"at",
"the",
"provided",
"{",
"@link",
"java",
".",
"time",
".",
"Year",
"}",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L2067-L2069 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/ChecksumFileSystem.java | ChecksumFileSystem.setReplication | public boolean setReplication(Path src, short replication) throws IOException {
"""
Set replication for an existing file.
Implement the abstract <tt>setReplication</tt> of <tt>FileSystem</tt>
@param src file name
@param replication new replication
@throws IOException
@return true if successful;
false if file does not exist or is a directory
"""
boolean value = fs.setReplication(src, replication);
if (!value)
return false;
Path checkFile = getChecksumFile(src);
if (exists(checkFile))
fs.setReplication(checkFile, replication);
return true;
} | java | public boolean setReplication(Path src, short replication) throws IOException {
boolean value = fs.setReplication(src, replication);
if (!value)
return false;
Path checkFile = getChecksumFile(src);
if (exists(checkFile))
fs.setReplication(checkFile, replication);
return true;
} | [
"public",
"boolean",
"setReplication",
"(",
"Path",
"src",
",",
"short",
"replication",
")",
"throws",
"IOException",
"{",
"boolean",
"value",
"=",
"fs",
".",
"setReplication",
"(",
"src",
",",
"replication",
")",
";",
"if",
"(",
"!",
"value",
")",
"return",
"false",
";",
"Path",
"checkFile",
"=",
"getChecksumFile",
"(",
"src",
")",
";",
"if",
"(",
"exists",
"(",
"checkFile",
")",
")",
"fs",
".",
"setReplication",
"(",
"checkFile",
",",
"replication",
")",
";",
"return",
"true",
";",
"}"
] | Set replication for an existing file.
Implement the abstract <tt>setReplication</tt> of <tt>FileSystem</tt>
@param src file name
@param replication new replication
@throws IOException
@return true if successful;
false if file does not exist or is a directory | [
"Set",
"replication",
"for",
"an",
"existing",
"file",
".",
"Implement",
"the",
"abstract",
"<tt",
">",
"setReplication<",
"/",
"tt",
">",
"of",
"<tt",
">",
"FileSystem<",
"/",
"tt",
">"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java#L431-L441 |
netceteragroup/valdr-bean-validation | valdr-bean-validation/src/main/java/com/github/valdr/thirdparty/spring/AnnotationUtils.java | AnnotationUtils.isAnnotationInherited | public static boolean isAnnotationInherited(Class<? extends Annotation> annotationType, Class<?> clazz) {
"""
Determine whether an annotation for the specified {@code annotationType} is present
on the supplied {@code clazz} and is {@linkplain java.lang.annotation.Inherited inherited}
(i.e., not declared locally for the class).
<p>If the supplied {@code clazz} is an interface, only the interface itself will be checked.
In accordance with standard meta-annotation semantics, the inheritance hierarchy for interfaces
will not be traversed. See the {@linkplain java.lang.annotation.Inherited Javadoc} for the
{@code @Inherited} meta-annotation for further details regarding annotation inheritance.
@param annotationType the Class object corresponding to the annotation type
@param clazz the Class object corresponding to the class on which to check for the annotation
@return {@code true} if an annotation for the specified {@code annotationType} is present
on the supplied {@code clazz} and is <em>inherited</em>
@see Class#isAnnotationPresent(Class)
@see #isAnnotationDeclaredLocally(Class, Class)
"""
return (clazz.isAnnotationPresent(annotationType) && !isAnnotationDeclaredLocally(annotationType, clazz));
} | java | public static boolean isAnnotationInherited(Class<? extends Annotation> annotationType, Class<?> clazz) {
return (clazz.isAnnotationPresent(annotationType) && !isAnnotationDeclaredLocally(annotationType, clazz));
} | [
"public",
"static",
"boolean",
"isAnnotationInherited",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"return",
"(",
"clazz",
".",
"isAnnotationPresent",
"(",
"annotationType",
")",
"&&",
"!",
"isAnnotationDeclaredLocally",
"(",
"annotationType",
",",
"clazz",
")",
")",
";",
"}"
] | Determine whether an annotation for the specified {@code annotationType} is present
on the supplied {@code clazz} and is {@linkplain java.lang.annotation.Inherited inherited}
(i.e., not declared locally for the class).
<p>If the supplied {@code clazz} is an interface, only the interface itself will be checked.
In accordance with standard meta-annotation semantics, the inheritance hierarchy for interfaces
will not be traversed. See the {@linkplain java.lang.annotation.Inherited Javadoc} for the
{@code @Inherited} meta-annotation for further details regarding annotation inheritance.
@param annotationType the Class object corresponding to the annotation type
@param clazz the Class object corresponding to the class on which to check for the annotation
@return {@code true} if an annotation for the specified {@code annotationType} is present
on the supplied {@code clazz} and is <em>inherited</em>
@see Class#isAnnotationPresent(Class)
@see #isAnnotationDeclaredLocally(Class, Class) | [
"Determine",
"whether",
"an",
"annotation",
"for",
"the",
"specified",
"{"
] | train | https://github.com/netceteragroup/valdr-bean-validation/blob/3f49f1357c575a11331be2de867cf47809a83823/valdr-bean-validation/src/main/java/com/github/valdr/thirdparty/spring/AnnotationUtils.java#L303-L305 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/hadoop/cql3/CqlConfigHelper.java | CqlConfigHelper.setInputCQLPageRowSize | public static void setInputCQLPageRowSize(Configuration conf, String cqlPageRowSize) {
"""
Set the CQL query Limit for the input of this job.
@param conf Job configuration you are about to run
@param cqlPageRowSize
"""
if (cqlPageRowSize == null)
{
throw new UnsupportedOperationException("cql page row size may not be null");
}
conf.set(INPUT_CQL_PAGE_ROW_SIZE_CONFIG, cqlPageRowSize);
} | java | public static void setInputCQLPageRowSize(Configuration conf, String cqlPageRowSize)
{
if (cqlPageRowSize == null)
{
throw new UnsupportedOperationException("cql page row size may not be null");
}
conf.set(INPUT_CQL_PAGE_ROW_SIZE_CONFIG, cqlPageRowSize);
} | [
"public",
"static",
"void",
"setInputCQLPageRowSize",
"(",
"Configuration",
"conf",
",",
"String",
"cqlPageRowSize",
")",
"{",
"if",
"(",
"cqlPageRowSize",
"==",
"null",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"cql page row size may not be null\"",
")",
";",
"}",
"conf",
".",
"set",
"(",
"INPUT_CQL_PAGE_ROW_SIZE_CONFIG",
",",
"cqlPageRowSize",
")",
";",
"}"
] | Set the CQL query Limit for the input of this job.
@param conf Job configuration you are about to run
@param cqlPageRowSize | [
"Set",
"the",
"CQL",
"query",
"Limit",
"for",
"the",
"input",
"of",
"this",
"job",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/cql3/CqlConfigHelper.java#L108-L116 |
Impetus/Kundera | src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/LuceneIndexer.java | LuceneIndexer.updateOrCreateIndexNonSuperColumnFamily | private Document updateOrCreateIndexNonSuperColumnFamily(EntityMetadata metadata, final MetamodelImpl metaModel,
Object entity, String parentId, Class<?> clazz, boolean isUpdate, boolean isEmbeddedId, Object rowKey) {
"""
update or Create Index for non super columnfamily
@param metadata
@param metaModel
@param entity
@param parentId
@param clazz
@param isUpdate
@param isEmbeddedId
@param rowKey
@return
"""
Document document = new Document();
// Add entity class, PK info into document
addEntityClassToDocument(metadata, entity, document, metaModel);
// Add all entity fields(columns) into document
addEntityFieldsToDocument(metadata, entity, document, metaModel);
addAssociatedEntitiesToDocument(metadata, entity, document, metaModel);
addParentKeyToDocument(parentId, document, clazz);
if (isUpdate)
{
if (isEmbeddedId)
{
// updating delimited composite key
String compositeId = KunderaCoreUtils.prepareCompositeKey(metadata.getIdAttribute(), metaModel, rowKey);
updateDocument(compositeId, document, null);
// updating sub parts of composite key
EmbeddableType embeddableId = metaModel.embeddable(metadata.getIdAttribute().getBindableJavaType());
Set<Attribute> embeddedAttributes = embeddableId.getAttributes();
updateOrCreateIndexEmbeddedIdFields(embeddedAttributes, metaModel, document, metadata, rowKey);
}
else
{
updateDocument(rowKey.toString(), document, null);
}
}
else
{
indexDocument(metadata, document);
}
return document;
} | java | private Document updateOrCreateIndexNonSuperColumnFamily(EntityMetadata metadata, final MetamodelImpl metaModel,
Object entity, String parentId, Class<?> clazz, boolean isUpdate, boolean isEmbeddedId, Object rowKey)
{
Document document = new Document();
// Add entity class, PK info into document
addEntityClassToDocument(metadata, entity, document, metaModel);
// Add all entity fields(columns) into document
addEntityFieldsToDocument(metadata, entity, document, metaModel);
addAssociatedEntitiesToDocument(metadata, entity, document, metaModel);
addParentKeyToDocument(parentId, document, clazz);
if (isUpdate)
{
if (isEmbeddedId)
{
// updating delimited composite key
String compositeId = KunderaCoreUtils.prepareCompositeKey(metadata.getIdAttribute(), metaModel, rowKey);
updateDocument(compositeId, document, null);
// updating sub parts of composite key
EmbeddableType embeddableId = metaModel.embeddable(metadata.getIdAttribute().getBindableJavaType());
Set<Attribute> embeddedAttributes = embeddableId.getAttributes();
updateOrCreateIndexEmbeddedIdFields(embeddedAttributes, metaModel, document, metadata, rowKey);
}
else
{
updateDocument(rowKey.toString(), document, null);
}
}
else
{
indexDocument(metadata, document);
}
return document;
} | [
"private",
"Document",
"updateOrCreateIndexNonSuperColumnFamily",
"(",
"EntityMetadata",
"metadata",
",",
"final",
"MetamodelImpl",
"metaModel",
",",
"Object",
"entity",
",",
"String",
"parentId",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"boolean",
"isUpdate",
",",
"boolean",
"isEmbeddedId",
",",
"Object",
"rowKey",
")",
"{",
"Document",
"document",
"=",
"new",
"Document",
"(",
")",
";",
"// Add entity class, PK info into document",
"addEntityClassToDocument",
"(",
"metadata",
",",
"entity",
",",
"document",
",",
"metaModel",
")",
";",
"// Add all entity fields(columns) into document",
"addEntityFieldsToDocument",
"(",
"metadata",
",",
"entity",
",",
"document",
",",
"metaModel",
")",
";",
"addAssociatedEntitiesToDocument",
"(",
"metadata",
",",
"entity",
",",
"document",
",",
"metaModel",
")",
";",
"addParentKeyToDocument",
"(",
"parentId",
",",
"document",
",",
"clazz",
")",
";",
"if",
"(",
"isUpdate",
")",
"{",
"if",
"(",
"isEmbeddedId",
")",
"{",
"// updating delimited composite key",
"String",
"compositeId",
"=",
"KunderaCoreUtils",
".",
"prepareCompositeKey",
"(",
"metadata",
".",
"getIdAttribute",
"(",
")",
",",
"metaModel",
",",
"rowKey",
")",
";",
"updateDocument",
"(",
"compositeId",
",",
"document",
",",
"null",
")",
";",
"// updating sub parts of composite key",
"EmbeddableType",
"embeddableId",
"=",
"metaModel",
".",
"embeddable",
"(",
"metadata",
".",
"getIdAttribute",
"(",
")",
".",
"getBindableJavaType",
"(",
")",
")",
";",
"Set",
"<",
"Attribute",
">",
"embeddedAttributes",
"=",
"embeddableId",
".",
"getAttributes",
"(",
")",
";",
"updateOrCreateIndexEmbeddedIdFields",
"(",
"embeddedAttributes",
",",
"metaModel",
",",
"document",
",",
"metadata",
",",
"rowKey",
")",
";",
"}",
"else",
"{",
"updateDocument",
"(",
"rowKey",
".",
"toString",
"(",
")",
",",
"document",
",",
"null",
")",
";",
"}",
"}",
"else",
"{",
"indexDocument",
"(",
"metadata",
",",
"document",
")",
";",
"}",
"return",
"document",
";",
"}"
] | update or Create Index for non super columnfamily
@param metadata
@param metaModel
@param entity
@param parentId
@param clazz
@param isUpdate
@param isEmbeddedId
@param rowKey
@return | [
"update",
"or",
"Create",
"Index",
"for",
"non",
"super",
"columnfamily"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/LuceneIndexer.java#L775-L813 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java | PDBFileParser.getNewGroup | private Group getNewGroup(String recordName,Character aminoCode1, String aminoCode3) {
"""
initiate new resNum, either Hetatom, Nucleotide, or AminoAcid
"""
Group g = ChemCompGroupFactory.getGroupFromChemCompDictionary(aminoCode3);
if ( g != null && !g.getChemComp().isEmpty())
return g;
Group group;
if (aminoCode1 == null || StructureTools.UNKNOWN_GROUP_LABEL == aminoCode1 ){
group = new HetatomImpl();
} else if(StructureTools.isNucleotide(aminoCode3)) {
// it is a nucleotide
NucleotideImpl nu = new NucleotideImpl();
group = nu;
} else {
AminoAcidImpl aa = new AminoAcidImpl() ;
aa.setAminoType(aminoCode1);
group = aa ;
}
// System.out.println("new resNum type: "+ resNum.getType() );
return group ;
} | java | private Group getNewGroup(String recordName,Character aminoCode1, String aminoCode3) {
Group g = ChemCompGroupFactory.getGroupFromChemCompDictionary(aminoCode3);
if ( g != null && !g.getChemComp().isEmpty())
return g;
Group group;
if (aminoCode1 == null || StructureTools.UNKNOWN_GROUP_LABEL == aminoCode1 ){
group = new HetatomImpl();
} else if(StructureTools.isNucleotide(aminoCode3)) {
// it is a nucleotide
NucleotideImpl nu = new NucleotideImpl();
group = nu;
} else {
AminoAcidImpl aa = new AminoAcidImpl() ;
aa.setAminoType(aminoCode1);
group = aa ;
}
// System.out.println("new resNum type: "+ resNum.getType() );
return group ;
} | [
"private",
"Group",
"getNewGroup",
"(",
"String",
"recordName",
",",
"Character",
"aminoCode1",
",",
"String",
"aminoCode3",
")",
"{",
"Group",
"g",
"=",
"ChemCompGroupFactory",
".",
"getGroupFromChemCompDictionary",
"(",
"aminoCode3",
")",
";",
"if",
"(",
"g",
"!=",
"null",
"&&",
"!",
"g",
".",
"getChemComp",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"return",
"g",
";",
"Group",
"group",
";",
"if",
"(",
"aminoCode1",
"==",
"null",
"||",
"StructureTools",
".",
"UNKNOWN_GROUP_LABEL",
"==",
"aminoCode1",
")",
"{",
"group",
"=",
"new",
"HetatomImpl",
"(",
")",
";",
"}",
"else",
"if",
"(",
"StructureTools",
".",
"isNucleotide",
"(",
"aminoCode3",
")",
")",
"{",
"// it is a nucleotide",
"NucleotideImpl",
"nu",
"=",
"new",
"NucleotideImpl",
"(",
")",
";",
"group",
"=",
"nu",
";",
"}",
"else",
"{",
"AminoAcidImpl",
"aa",
"=",
"new",
"AminoAcidImpl",
"(",
")",
";",
"aa",
".",
"setAminoType",
"(",
"aminoCode1",
")",
";",
"group",
"=",
"aa",
";",
"}",
"//\t\tSystem.out.println(\"new resNum type: \"+ resNum.getType() );",
"return",
"group",
";",
"}"
] | initiate new resNum, either Hetatom, Nucleotide, or AminoAcid | [
"initiate",
"new",
"resNum",
"either",
"Hetatom",
"Nucleotide",
"or",
"AminoAcid"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L302-L326 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java | base_resource.stat_resource | protected base_resource stat_resource(nitro_service service,options option) throws Exception {
"""
Use this method to perform a stat operation on a netscaler resource.
@param service nitro_service object.
@param option options class object.
@return Requested Nitro stat resource.
@throws Exception Nitro exception is thrown.
"""
if (!service.isLogin())
service.login();
base_resource[] response = stat_request(service, option);
if (response != null && response.length > 0)
{
return response[0];
}
return null;
} | java | protected base_resource stat_resource(nitro_service service,options option) throws Exception
{
if (!service.isLogin())
service.login();
base_resource[] response = stat_request(service, option);
if (response != null && response.length > 0)
{
return response[0];
}
return null;
} | [
"protected",
"base_resource",
"stat_resource",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
")",
"service",
".",
"login",
"(",
")",
";",
"base_resource",
"[",
"]",
"response",
"=",
"stat_request",
"(",
"service",
",",
"option",
")",
";",
"if",
"(",
"response",
"!=",
"null",
"&&",
"response",
".",
"length",
">",
"0",
")",
"{",
"return",
"response",
"[",
"0",
"]",
";",
"}",
"return",
"null",
";",
"}"
] | Use this method to perform a stat operation on a netscaler resource.
@param service nitro_service object.
@param option options class object.
@return Requested Nitro stat resource.
@throws Exception Nitro exception is thrown. | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"stat",
"operation",
"on",
"a",
"netscaler",
"resource",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L323-L334 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java | ScreenField.doCommand | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) {
"""
Process the command.
<br />Step 1 - Process the command if possible and return true if processed.
<br />Step 2 - If I can't process, pass to all children (with me as the source).
<br />Step 3 - If children didn't process, pass to parent (with me as the source).
<br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop).
@param strCommand The command to process.
@param sourceSField The source screen field (to avoid echos).
@param iCommandOptions If this command creates a new screen, create in a new window?
@return true if success.
"""
if (this.getScreenFieldView() != null)
{
if (MenuConstants.SELECT.equalsIgnoreCase(strCommand))
if ((iCommandOptions & ScreenConstants.USE_NEW_WINDOW) == ScreenConstants.USE_NEW_WINDOW)
strCommand = MenuConstants.SELECT_DONT_CLOSE; // Special - Click select w/shift = don't close
return this.getScreenFieldView().doCommand(strCommand); // Give my view the first shot.
}
return false; // Not processed, BasePanels and above will override
} | java | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if (this.getScreenFieldView() != null)
{
if (MenuConstants.SELECT.equalsIgnoreCase(strCommand))
if ((iCommandOptions & ScreenConstants.USE_NEW_WINDOW) == ScreenConstants.USE_NEW_WINDOW)
strCommand = MenuConstants.SELECT_DONT_CLOSE; // Special - Click select w/shift = don't close
return this.getScreenFieldView().doCommand(strCommand); // Give my view the first shot.
}
return false; // Not processed, BasePanels and above will override
} | [
"public",
"boolean",
"doCommand",
"(",
"String",
"strCommand",
",",
"ScreenField",
"sourceSField",
",",
"int",
"iCommandOptions",
")",
"{",
"if",
"(",
"this",
".",
"getScreenFieldView",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"MenuConstants",
".",
"SELECT",
".",
"equalsIgnoreCase",
"(",
"strCommand",
")",
")",
"if",
"(",
"(",
"iCommandOptions",
"&",
"ScreenConstants",
".",
"USE_NEW_WINDOW",
")",
"==",
"ScreenConstants",
".",
"USE_NEW_WINDOW",
")",
"strCommand",
"=",
"MenuConstants",
".",
"SELECT_DONT_CLOSE",
";",
"// Special - Click select w/shift = don't close",
"return",
"this",
".",
"getScreenFieldView",
"(",
")",
".",
"doCommand",
"(",
"strCommand",
")",
";",
"// Give my view the first shot.",
"}",
"return",
"false",
";",
"// Not processed, BasePanels and above will override",
"}"
] | Process the command.
<br />Step 1 - Process the command if possible and return true if processed.
<br />Step 2 - If I can't process, pass to all children (with me as the source).
<br />Step 3 - If children didn't process, pass to parent (with me as the source).
<br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop).
@param strCommand The command to process.
@param sourceSField The source screen field (to avoid echos).
@param iCommandOptions If this command creates a new screen, create in a new window?
@return true if success. | [
"Process",
"the",
"command",
".",
"<br",
"/",
">",
"Step",
"1",
"-",
"Process",
"the",
"command",
"if",
"possible",
"and",
"return",
"true",
"if",
"processed",
".",
"<br",
"/",
">",
"Step",
"2",
"-",
"If",
"I",
"can",
"t",
"process",
"pass",
"to",
"all",
"children",
"(",
"with",
"me",
"as",
"the",
"source",
")",
".",
"<br",
"/",
">",
"Step",
"3",
"-",
"If",
"children",
"didn",
"t",
"process",
"pass",
"to",
"parent",
"(",
"with",
"me",
"as",
"the",
"source",
")",
".",
"<br",
"/",
">",
"Note",
":",
"Never",
"pass",
"to",
"a",
"parent",
"or",
"child",
"that",
"matches",
"the",
"source",
"(",
"to",
"avoid",
"an",
"endless",
"loop",
")",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java#L269-L279 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlInOut.java | XmlInOut.enableAllBehaviors | public static void enableAllBehaviors(Record record, boolean bEnableRecordBehaviors, boolean bEnableFieldBehaviors) {
"""
Enable or disable all the behaviors.
@param record The target record.
@param bEnableRecordBehaviors Enable/disable all the record behaviors.
@param bEnableFieldBehaviors Enable/disable all the field behaviors.
"""
if (record == null)
return;
record.setEnableListeners(bEnableRecordBehaviors); // Disable all file behaviors
for (int iFieldSeq = 0; iFieldSeq < record.getFieldCount(); iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
field.setEnableListeners(bEnableFieldBehaviors);
}
} | java | public static void enableAllBehaviors(Record record, boolean bEnableRecordBehaviors, boolean bEnableFieldBehaviors)
{
if (record == null)
return;
record.setEnableListeners(bEnableRecordBehaviors); // Disable all file behaviors
for (int iFieldSeq = 0; iFieldSeq < record.getFieldCount(); iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
field.setEnableListeners(bEnableFieldBehaviors);
}
} | [
"public",
"static",
"void",
"enableAllBehaviors",
"(",
"Record",
"record",
",",
"boolean",
"bEnableRecordBehaviors",
",",
"boolean",
"bEnableFieldBehaviors",
")",
"{",
"if",
"(",
"record",
"==",
"null",
")",
"return",
";",
"record",
".",
"setEnableListeners",
"(",
"bEnableRecordBehaviors",
")",
";",
"// Disable all file behaviors",
"for",
"(",
"int",
"iFieldSeq",
"=",
"0",
";",
"iFieldSeq",
"<",
"record",
".",
"getFieldCount",
"(",
")",
";",
"iFieldSeq",
"++",
")",
"{",
"BaseField",
"field",
"=",
"record",
".",
"getField",
"(",
"iFieldSeq",
")",
";",
"field",
".",
"setEnableListeners",
"(",
"bEnableFieldBehaviors",
")",
";",
"}",
"}"
] | Enable or disable all the behaviors.
@param record The target record.
@param bEnableRecordBehaviors Enable/disable all the record behaviors.
@param bEnableFieldBehaviors Enable/disable all the field behaviors. | [
"Enable",
"or",
"disable",
"all",
"the",
"behaviors",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlInOut.java#L624-L634 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java | DeterministicKey.ascertainParentFingerprint | private int ascertainParentFingerprint(DeterministicKey parentKey, int parentFingerprint)
throws IllegalArgumentException {
"""
Return the fingerprint of this key's parent as an int value, or zero if this key is the
root node of the key hierarchy. Raise an exception if the arguments are inconsistent.
This method exists to avoid code repetition in the constructors.
"""
if (parentFingerprint != 0) {
if (parent != null)
checkArgument(parent.getFingerprint() == parentFingerprint,
"parent fingerprint mismatch",
Integer.toHexString(parent.getFingerprint()), Integer.toHexString(parentFingerprint));
return parentFingerprint;
} else return 0;
} | java | private int ascertainParentFingerprint(DeterministicKey parentKey, int parentFingerprint)
throws IllegalArgumentException {
if (parentFingerprint != 0) {
if (parent != null)
checkArgument(parent.getFingerprint() == parentFingerprint,
"parent fingerprint mismatch",
Integer.toHexString(parent.getFingerprint()), Integer.toHexString(parentFingerprint));
return parentFingerprint;
} else return 0;
} | [
"private",
"int",
"ascertainParentFingerprint",
"(",
"DeterministicKey",
"parentKey",
",",
"int",
"parentFingerprint",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parentFingerprint",
"!=",
"0",
")",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"checkArgument",
"(",
"parent",
".",
"getFingerprint",
"(",
")",
"==",
"parentFingerprint",
",",
"\"parent fingerprint mismatch\"",
",",
"Integer",
".",
"toHexString",
"(",
"parent",
".",
"getFingerprint",
"(",
")",
")",
",",
"Integer",
".",
"toHexString",
"(",
"parentFingerprint",
")",
")",
";",
"return",
"parentFingerprint",
";",
"}",
"else",
"return",
"0",
";",
"}"
] | Return the fingerprint of this key's parent as an int value, or zero if this key is the
root node of the key hierarchy. Raise an exception if the arguments are inconsistent.
This method exists to avoid code repetition in the constructors. | [
"Return",
"the",
"fingerprint",
"of",
"this",
"key",
"s",
"parent",
"as",
"an",
"int",
"value",
"or",
"zero",
"if",
"this",
"key",
"is",
"the",
"root",
"node",
"of",
"the",
"key",
"hierarchy",
".",
"Raise",
"an",
"exception",
"if",
"the",
"arguments",
"are",
"inconsistent",
".",
"This",
"method",
"exists",
"to",
"avoid",
"code",
"repetition",
"in",
"the",
"constructors",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java#L118-L127 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/BitmapUtil.java | BitmapUtil.clipCircle | public static Bitmap clipCircle(@NonNull final Bitmap bitmap, final int size) {
"""
Clips the corners of a bitmap in order to transform it into a round shape. Additionally, the
bitmap is resized to a specific size. Bitmaps, whose width and height are not equal, will be
clipped to a square beforehand.
@param bitmap
The bitmap, which should be clipped, as an instance of the class {@link Bitmap}. The
bitmap may not be null
@param size
The size, the bitmap should be resized to, as an {@link Integer} value in pixels. The
size must be at least 1
@return The clipped bitmap as an instance of the class {@link Bitmap}
"""
Bitmap squareBitmap = clipSquare(bitmap, size);
int squareSize = squareBitmap.getWidth();
float radius = (float) squareSize / 2.0f;
Bitmap clippedBitmap = Bitmap.createBitmap(squareSize, squareSize, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(clippedBitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(Color.BLACK);
canvas.drawCircle(radius, radius, radius, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(squareBitmap, new Rect(0, 0, squareSize, squareSize),
new Rect(0, 0, squareSize, squareSize), paint);
return clippedBitmap;
} | java | public static Bitmap clipCircle(@NonNull final Bitmap bitmap, final int size) {
Bitmap squareBitmap = clipSquare(bitmap, size);
int squareSize = squareBitmap.getWidth();
float radius = (float) squareSize / 2.0f;
Bitmap clippedBitmap = Bitmap.createBitmap(squareSize, squareSize, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(clippedBitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(Color.BLACK);
canvas.drawCircle(radius, radius, radius, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(squareBitmap, new Rect(0, 0, squareSize, squareSize),
new Rect(0, 0, squareSize, squareSize), paint);
return clippedBitmap;
} | [
"public",
"static",
"Bitmap",
"clipCircle",
"(",
"@",
"NonNull",
"final",
"Bitmap",
"bitmap",
",",
"final",
"int",
"size",
")",
"{",
"Bitmap",
"squareBitmap",
"=",
"clipSquare",
"(",
"bitmap",
",",
"size",
")",
";",
"int",
"squareSize",
"=",
"squareBitmap",
".",
"getWidth",
"(",
")",
";",
"float",
"radius",
"=",
"(",
"float",
")",
"squareSize",
"/",
"2.0f",
";",
"Bitmap",
"clippedBitmap",
"=",
"Bitmap",
".",
"createBitmap",
"(",
"squareSize",
",",
"squareSize",
",",
"Bitmap",
".",
"Config",
".",
"ARGB_8888",
")",
";",
"Canvas",
"canvas",
"=",
"new",
"Canvas",
"(",
"clippedBitmap",
")",
";",
"Paint",
"paint",
"=",
"new",
"Paint",
"(",
")",
";",
"paint",
".",
"setAntiAlias",
"(",
"true",
")",
";",
"paint",
".",
"setColor",
"(",
"Color",
".",
"BLACK",
")",
";",
"canvas",
".",
"drawCircle",
"(",
"radius",
",",
"radius",
",",
"radius",
",",
"paint",
")",
";",
"paint",
".",
"setXfermode",
"(",
"new",
"PorterDuffXfermode",
"(",
"PorterDuff",
".",
"Mode",
".",
"SRC_IN",
")",
")",
";",
"canvas",
".",
"drawBitmap",
"(",
"squareBitmap",
",",
"new",
"Rect",
"(",
"0",
",",
"0",
",",
"squareSize",
",",
"squareSize",
")",
",",
"new",
"Rect",
"(",
"0",
",",
"0",
",",
"squareSize",
",",
"squareSize",
")",
",",
"paint",
")",
";",
"return",
"clippedBitmap",
";",
"}"
] | Clips the corners of a bitmap in order to transform it into a round shape. Additionally, the
bitmap is resized to a specific size. Bitmaps, whose width and height are not equal, will be
clipped to a square beforehand.
@param bitmap
The bitmap, which should be clipped, as an instance of the class {@link Bitmap}. The
bitmap may not be null
@param size
The size, the bitmap should be resized to, as an {@link Integer} value in pixels. The
size must be at least 1
@return The clipped bitmap as an instance of the class {@link Bitmap} | [
"Clips",
"the",
"corners",
"of",
"a",
"bitmap",
"in",
"order",
"to",
"transform",
"it",
"into",
"a",
"round",
"shape",
".",
"Additionally",
"the",
"bitmap",
"is",
"resized",
"to",
"a",
"specific",
"size",
".",
"Bitmaps",
"whose",
"width",
"and",
"height",
"are",
"not",
"equal",
"will",
"be",
"clipped",
"to",
"a",
"square",
"beforehand",
"."
] | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/BitmapUtil.java#L134-L148 |
SteelBridgeLabs/neo4j-gremlin-bolt | src/main/java/com/steelbridgelabs/oss/neo4j/structure/Neo4JVertex.java | Neo4JVertex.matchStatement | public String matchStatement(String alias, String idParameterName) {
"""
Generates a Cypher MATCH statement for the vertex, example:
<p>
MATCH (alias) WHERE alias.id = {id} AND (alias:Label1 OR alias:Label2)
</p>
@param alias The node alias.
@param idParameterName The name of the parameter that contains the vertex id.
@return the Cypher MATCH predicate or <code>null</code> if not required to MATCH the vertex.
"""
Objects.requireNonNull(alias, "alias cannot be null");
Objects.requireNonNull(idParameterName, "idParameterName cannot be null");
// create statement
return "MATCH " + matchPattern(alias) + " WHERE " + matchPredicate(alias, idParameterName);
} | java | public String matchStatement(String alias, String idParameterName) {
Objects.requireNonNull(alias, "alias cannot be null");
Objects.requireNonNull(idParameterName, "idParameterName cannot be null");
// create statement
return "MATCH " + matchPattern(alias) + " WHERE " + matchPredicate(alias, idParameterName);
} | [
"public",
"String",
"matchStatement",
"(",
"String",
"alias",
",",
"String",
"idParameterName",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"alias",
",",
"\"alias cannot be null\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"idParameterName",
",",
"\"idParameterName cannot be null\"",
")",
";",
"// create statement",
"return",
"\"MATCH \"",
"+",
"matchPattern",
"(",
"alias",
")",
"+",
"\" WHERE \"",
"+",
"matchPredicate",
"(",
"alias",
",",
"idParameterName",
")",
";",
"}"
] | Generates a Cypher MATCH statement for the vertex, example:
<p>
MATCH (alias) WHERE alias.id = {id} AND (alias:Label1 OR alias:Label2)
</p>
@param alias The node alias.
@param idParameterName The name of the parameter that contains the vertex id.
@return the Cypher MATCH predicate or <code>null</code> if not required to MATCH the vertex. | [
"Generates",
"a",
"Cypher",
"MATCH",
"statement",
"for",
"the",
"vertex",
"example",
":",
"<p",
">",
"MATCH",
"(",
"alias",
")",
"WHERE",
"alias",
".",
"id",
"=",
"{",
"id",
"}",
"AND",
"(",
"alias",
":",
"Label1",
"OR",
"alias",
":",
"Label2",
")",
"<",
"/",
"p",
">"
] | train | https://github.com/SteelBridgeLabs/neo4j-gremlin-bolt/blob/df3ab429e0c83affae6cd43d41edd90de80c032e/src/main/java/com/steelbridgelabs/oss/neo4j/structure/Neo4JVertex.java#L399-L404 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java | JQLChecker.extractPlaceHoldersAsSet | public Set<JQLPlaceHolder> extractPlaceHoldersAsSet(final JQLContext jqlContext, String jql) {
"""
Extract all bind parameters and dynamic part used in query.
@param jqlContext
the jql context
@param jql
the jql
@return the sets the
"""
return extractPlaceHolders(jqlContext, jql, new LinkedHashSet<JQLPlaceHolder>());
} | java | public Set<JQLPlaceHolder> extractPlaceHoldersAsSet(final JQLContext jqlContext, String jql) {
return extractPlaceHolders(jqlContext, jql, new LinkedHashSet<JQLPlaceHolder>());
} | [
"public",
"Set",
"<",
"JQLPlaceHolder",
">",
"extractPlaceHoldersAsSet",
"(",
"final",
"JQLContext",
"jqlContext",
",",
"String",
"jql",
")",
"{",
"return",
"extractPlaceHolders",
"(",
"jqlContext",
",",
"jql",
",",
"new",
"LinkedHashSet",
"<",
"JQLPlaceHolder",
">",
"(",
")",
")",
";",
"}"
] | Extract all bind parameters and dynamic part used in query.
@param jqlContext
the jql context
@param jql
the jql
@return the sets the | [
"Extract",
"all",
"bind",
"parameters",
"and",
"dynamic",
"part",
"used",
"in",
"query",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L833-L835 |
datasift/datasift-java | src/main/java/com/datasift/client/DataSiftConfig.java | DataSiftConfig.baseIngestionURL | public URI baseIngestionURL() {
"""
/*
@return A base URL to the DataSift Ingestion API. e.g. https://in.datasift.com/
"""
StringBuilder b = new StringBuilder()
.append(protocol())
.append(ingestionHost())
.append(":")
.append(port())
.append("/");
try {
return new URI(b.toString());
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Unable to construct a base URL for the ingestion API", e);
}
} | java | public URI baseIngestionURL() {
StringBuilder b = new StringBuilder()
.append(protocol())
.append(ingestionHost())
.append(":")
.append(port())
.append("/");
try {
return new URI(b.toString());
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Unable to construct a base URL for the ingestion API", e);
}
} | [
"public",
"URI",
"baseIngestionURL",
"(",
")",
"{",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"protocol",
"(",
")",
")",
".",
"append",
"(",
"ingestionHost",
"(",
")",
")",
".",
"append",
"(",
"\":\"",
")",
".",
"append",
"(",
"port",
"(",
")",
")",
".",
"append",
"(",
"\"/\"",
")",
";",
"try",
"{",
"return",
"new",
"URI",
"(",
"b",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unable to construct a base URL for the ingestion API\"",
",",
"e",
")",
";",
"}",
"}"
] | /*
@return A base URL to the DataSift Ingestion API. e.g. https://in.datasift.com/ | [
"/",
"*"
] | train | https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/DataSiftConfig.java#L185-L197 |
zxing/zxing | core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java | Decoder.getCharacter | private static String getCharacter(Table table, int code) {
"""
Gets the character (or string) corresponding to the passed code in the given table
@param table the table used
@param code the code of the character
"""
switch (table) {
case UPPER:
return UPPER_TABLE[code];
case LOWER:
return LOWER_TABLE[code];
case MIXED:
return MIXED_TABLE[code];
case PUNCT:
return PUNCT_TABLE[code];
case DIGIT:
return DIGIT_TABLE[code];
default:
// Should not reach here.
throw new IllegalStateException("Bad table");
}
} | java | private static String getCharacter(Table table, int code) {
switch (table) {
case UPPER:
return UPPER_TABLE[code];
case LOWER:
return LOWER_TABLE[code];
case MIXED:
return MIXED_TABLE[code];
case PUNCT:
return PUNCT_TABLE[code];
case DIGIT:
return DIGIT_TABLE[code];
default:
// Should not reach here.
throw new IllegalStateException("Bad table");
}
} | [
"private",
"static",
"String",
"getCharacter",
"(",
"Table",
"table",
",",
"int",
"code",
")",
"{",
"switch",
"(",
"table",
")",
"{",
"case",
"UPPER",
":",
"return",
"UPPER_TABLE",
"[",
"code",
"]",
";",
"case",
"LOWER",
":",
"return",
"LOWER_TABLE",
"[",
"code",
"]",
";",
"case",
"MIXED",
":",
"return",
"MIXED_TABLE",
"[",
"code",
"]",
";",
"case",
"PUNCT",
":",
"return",
"PUNCT_TABLE",
"[",
"code",
"]",
";",
"case",
"DIGIT",
":",
"return",
"DIGIT_TABLE",
"[",
"code",
"]",
";",
"default",
":",
"// Should not reach here.",
"throw",
"new",
"IllegalStateException",
"(",
"\"Bad table\"",
")",
";",
"}",
"}"
] | Gets the character (or string) corresponding to the passed code in the given table
@param table the table used
@param code the code of the character | [
"Gets",
"the",
"character",
"(",
"or",
"string",
")",
"corresponding",
"to",
"the",
"passed",
"code",
"in",
"the",
"given",
"table"
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java#L181-L197 |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.loadDnsCacheConfig | public static void loadDnsCacheConfig(String propertiesFileName) {
"""
Load dns config from the specified properties file on classpath, then set dns cache.
@param propertiesFileName specified properties file name on classpath.
@throws DnsCacheManipulatorException Operation fail
@see DnsCacheManipulator#setDnsCache(java.util.Properties)
"""
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertiesFileName);
if (inputStream == null) {
inputStream = DnsCacheManipulator.class.getClassLoader().getResourceAsStream(propertiesFileName);
}
if (inputStream == null) {
throw new DnsCacheManipulatorException("Fail to find " + propertiesFileName + " on classpath!");
}
try {
Properties properties = new Properties();
properties.load(inputStream);
inputStream.close();
setDnsCache(properties);
} catch (Exception e) {
final String message = String.format("Fail to loadDnsCacheConfig from %s, cause: %s",
propertiesFileName, e.toString());
throw new DnsCacheManipulatorException(message, e);
}
} | java | public static void loadDnsCacheConfig(String propertiesFileName) {
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertiesFileName);
if (inputStream == null) {
inputStream = DnsCacheManipulator.class.getClassLoader().getResourceAsStream(propertiesFileName);
}
if (inputStream == null) {
throw new DnsCacheManipulatorException("Fail to find " + propertiesFileName + " on classpath!");
}
try {
Properties properties = new Properties();
properties.load(inputStream);
inputStream.close();
setDnsCache(properties);
} catch (Exception e) {
final String message = String.format("Fail to loadDnsCacheConfig from %s, cause: %s",
propertiesFileName, e.toString());
throw new DnsCacheManipulatorException(message, e);
}
} | [
"public",
"static",
"void",
"loadDnsCacheConfig",
"(",
"String",
"propertiesFileName",
")",
"{",
"InputStream",
"inputStream",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"propertiesFileName",
")",
";",
"if",
"(",
"inputStream",
"==",
"null",
")",
"{",
"inputStream",
"=",
"DnsCacheManipulator",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"propertiesFileName",
")",
";",
"}",
"if",
"(",
"inputStream",
"==",
"null",
")",
"{",
"throw",
"new",
"DnsCacheManipulatorException",
"(",
"\"Fail to find \"",
"+",
"propertiesFileName",
"+",
"\" on classpath!\"",
")",
";",
"}",
"try",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"load",
"(",
"inputStream",
")",
";",
"inputStream",
".",
"close",
"(",
")",
";",
"setDnsCache",
"(",
"properties",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"final",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"Fail to loadDnsCacheConfig from %s, cause: %s\"",
",",
"propertiesFileName",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"throw",
"new",
"DnsCacheManipulatorException",
"(",
"message",
",",
"e",
")",
";",
"}",
"}"
] | Load dns config from the specified properties file on classpath, then set dns cache.
@param propertiesFileName specified properties file name on classpath.
@throws DnsCacheManipulatorException Operation fail
@see DnsCacheManipulator#setDnsCache(java.util.Properties) | [
"Load",
"dns",
"config",
"from",
"the",
"specified",
"properties",
"file",
"on",
"classpath",
"then",
"set",
"dns",
"cache",
"."
] | train | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L106-L125 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java | DocBookBuildUtilities.convertDocumentToFormattedString | public static String convertDocumentToFormattedString(final Document doc, final XMLFormatProperties xmlFormatProperties) {
"""
Convert a DOM Document to a Formatted String representation.
@param doc The DOM Document to be converted and formatted.
@param xmlFormatProperties The XML Formatting Properties.
@return The converted XML String representation.
"""
return convertDocumentToFormattedString(doc, xmlFormatProperties, true);
} | java | public static String convertDocumentToFormattedString(final Document doc, final XMLFormatProperties xmlFormatProperties) {
return convertDocumentToFormattedString(doc, xmlFormatProperties, true);
} | [
"public",
"static",
"String",
"convertDocumentToFormattedString",
"(",
"final",
"Document",
"doc",
",",
"final",
"XMLFormatProperties",
"xmlFormatProperties",
")",
"{",
"return",
"convertDocumentToFormattedString",
"(",
"doc",
",",
"xmlFormatProperties",
",",
"true",
")",
";",
"}"
] | Convert a DOM Document to a Formatted String representation.
@param doc The DOM Document to be converted and formatted.
@param xmlFormatProperties The XML Formatting Properties.
@return The converted XML String representation. | [
"Convert",
"a",
"DOM",
"Document",
"to",
"a",
"Formatted",
"String",
"representation",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L485-L487 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java | DynamoDBMapper.untransformAttributes | protected Map<String, AttributeValue> untransformAttributes(Class<?> clazz, Map<String, AttributeValue> attributeValues) {
"""
By default, just calls {@link #untransformAttributes(String, String, Map)}.
@param clazz
@param attributeValues
@return the decrypted attribute values
"""
Method hashKeyGetter = reflector.getHashKeyGetter(clazz);
String hashKeyName = reflector.getAttributeName(hashKeyGetter);
Method rangeKeyGetter = reflector.getRangeKeyGetter(clazz);
String rangeKeyName = rangeKeyGetter == null ? null : reflector.getAttributeName(rangeKeyGetter);
return untransformAttributes(hashKeyName, rangeKeyName, attributeValues);
} | java | protected Map<String, AttributeValue> untransformAttributes(Class<?> clazz, Map<String, AttributeValue> attributeValues) {
Method hashKeyGetter = reflector.getHashKeyGetter(clazz);
String hashKeyName = reflector.getAttributeName(hashKeyGetter);
Method rangeKeyGetter = reflector.getRangeKeyGetter(clazz);
String rangeKeyName = rangeKeyGetter == null ? null : reflector.getAttributeName(rangeKeyGetter);
return untransformAttributes(hashKeyName, rangeKeyName, attributeValues);
} | [
"protected",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
"untransformAttributes",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
"attributeValues",
")",
"{",
"Method",
"hashKeyGetter",
"=",
"reflector",
".",
"getHashKeyGetter",
"(",
"clazz",
")",
";",
"String",
"hashKeyName",
"=",
"reflector",
".",
"getAttributeName",
"(",
"hashKeyGetter",
")",
";",
"Method",
"rangeKeyGetter",
"=",
"reflector",
".",
"getRangeKeyGetter",
"(",
"clazz",
")",
";",
"String",
"rangeKeyName",
"=",
"rangeKeyGetter",
"==",
"null",
"?",
"null",
":",
"reflector",
".",
"getAttributeName",
"(",
"rangeKeyGetter",
")",
";",
"return",
"untransformAttributes",
"(",
"hashKeyName",
",",
"rangeKeyName",
",",
"attributeValues",
")",
";",
"}"
] | By default, just calls {@link #untransformAttributes(String, String, Map)}.
@param clazz
@param attributeValues
@return the decrypted attribute values | [
"By",
"default",
"just",
"calls",
"{"
] | train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L1347-L1353 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java | GoogleMapShapeConverter.toPolyhedralSurface | public PolyhedralSurface toPolyhedralSurface(
List<com.google.android.gms.maps.model.Polygon> polygonList) {
"""
Convert a list of {@link Polygon} to a {@link PolyhedralSurface}
@param polygonList polygon list
@return polyhedral surface
"""
return toPolyhedralSurface(polygonList, false, false);
} | java | public PolyhedralSurface toPolyhedralSurface(
List<com.google.android.gms.maps.model.Polygon> polygonList) {
return toPolyhedralSurface(polygonList, false, false);
} | [
"public",
"PolyhedralSurface",
"toPolyhedralSurface",
"(",
"List",
"<",
"com",
".",
"google",
".",
"android",
".",
"gms",
".",
"maps",
".",
"model",
".",
"Polygon",
">",
"polygonList",
")",
"{",
"return",
"toPolyhedralSurface",
"(",
"polygonList",
",",
"false",
",",
"false",
")",
";",
"}"
] | Convert a list of {@link Polygon} to a {@link PolyhedralSurface}
@param polygonList polygon list
@return polyhedral surface | [
"Convert",
"a",
"list",
"of",
"{",
"@link",
"Polygon",
"}",
"to",
"a",
"{",
"@link",
"PolyhedralSurface",
"}"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1207-L1210 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VirtualFile.java | VirtualFile.asDirectoryURL | public URL asDirectoryURL() throws MalformedURLException {
"""
Get file's URL as a directory. There will always be a trailing {@code "/"} character.
@return the url
@throws MalformedURLException if the URL is somehow malformed
"""
final String pathName = getPathName(false);
return new URL(VFSUtils.VFS_PROTOCOL, "", -1, parent == null ? pathName : pathName + "/", VFSUtils.VFS_URL_HANDLER);
} | java | public URL asDirectoryURL() throws MalformedURLException {
final String pathName = getPathName(false);
return new URL(VFSUtils.VFS_PROTOCOL, "", -1, parent == null ? pathName : pathName + "/", VFSUtils.VFS_URL_HANDLER);
} | [
"public",
"URL",
"asDirectoryURL",
"(",
")",
"throws",
"MalformedURLException",
"{",
"final",
"String",
"pathName",
"=",
"getPathName",
"(",
"false",
")",
";",
"return",
"new",
"URL",
"(",
"VFSUtils",
".",
"VFS_PROTOCOL",
",",
"\"\"",
",",
"-",
"1",
",",
"parent",
"==",
"null",
"?",
"pathName",
":",
"pathName",
"+",
"\"/\"",
",",
"VFSUtils",
".",
"VFS_URL_HANDLER",
")",
";",
"}"
] | Get file's URL as a directory. There will always be a trailing {@code "/"} character.
@return the url
@throws MalformedURLException if the URL is somehow malformed | [
"Get",
"file",
"s",
"URL",
"as",
"a",
"directory",
".",
"There",
"will",
"always",
"be",
"a",
"trailing",
"{",
"@code",
"/",
"}",
"character",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L547-L550 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.listOperations | public List<OperationInner> listOperations(String resourceGroupName, String name) {
"""
List all currently running operations on the App Service Environment.
List all currently running operations on the App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<OperationInner> object if successful.
"""
return listOperationsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | java | public List<OperationInner> listOperations(String resourceGroupName, String name) {
return listOperationsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | [
"public",
"List",
"<",
"OperationInner",
">",
"listOperations",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"listOperationsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | List all currently running operations on the App Service Environment.
List all currently running operations on the App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<OperationInner> object if successful. | [
"List",
"all",
"currently",
"running",
"operations",
"on",
"the",
"App",
"Service",
"Environment",
".",
"List",
"all",
"currently",
"running",
"operations",
"on",
"the",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3627-L3629 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java | CellUtil.mergingCells | public static int mergingCells(Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn, CellStyle cellStyle) {
"""
合并单元格,可以根据设置的值来合并行和列
@param sheet 表对象
@param firstRow 起始行,0开始
@param lastRow 结束行,0开始
@param firstColumn 起始列,0开始
@param lastColumn 结束列,0开始
@param cellStyle 单元格样式,只提取边框样式
@return 合并后的单元格号
"""
final CellRangeAddress cellRangeAddress = new CellRangeAddress(//
firstRow, // first row (0-based)
lastRow, // last row (0-based)
firstColumn, // first column (0-based)
lastColumn // last column (0-based)
);
if (null != cellStyle) {
RegionUtil.setBorderTop(cellStyle.getBorderTopEnum(), cellRangeAddress, sheet);
RegionUtil.setBorderRight(cellStyle.getBorderRightEnum(), cellRangeAddress, sheet);
RegionUtil.setBorderBottom(cellStyle.getBorderBottomEnum(), cellRangeAddress, sheet);
RegionUtil.setBorderLeft(cellStyle.getBorderLeftEnum(), cellRangeAddress, sheet);
}
return sheet.addMergedRegion(cellRangeAddress);
} | java | public static int mergingCells(Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn, CellStyle cellStyle) {
final CellRangeAddress cellRangeAddress = new CellRangeAddress(//
firstRow, // first row (0-based)
lastRow, // last row (0-based)
firstColumn, // first column (0-based)
lastColumn // last column (0-based)
);
if (null != cellStyle) {
RegionUtil.setBorderTop(cellStyle.getBorderTopEnum(), cellRangeAddress, sheet);
RegionUtil.setBorderRight(cellStyle.getBorderRightEnum(), cellRangeAddress, sheet);
RegionUtil.setBorderBottom(cellStyle.getBorderBottomEnum(), cellRangeAddress, sheet);
RegionUtil.setBorderLeft(cellStyle.getBorderLeftEnum(), cellRangeAddress, sheet);
}
return sheet.addMergedRegion(cellRangeAddress);
} | [
"public",
"static",
"int",
"mergingCells",
"(",
"Sheet",
"sheet",
",",
"int",
"firstRow",
",",
"int",
"lastRow",
",",
"int",
"firstColumn",
",",
"int",
"lastColumn",
",",
"CellStyle",
"cellStyle",
")",
"{",
"final",
"CellRangeAddress",
"cellRangeAddress",
"=",
"new",
"CellRangeAddress",
"(",
"//\r",
"firstRow",
",",
"// first row (0-based)\r",
"lastRow",
",",
"// last row (0-based)\r",
"firstColumn",
",",
"// first column (0-based)\r",
"lastColumn",
"// last column (0-based)\r",
")",
";",
"if",
"(",
"null",
"!=",
"cellStyle",
")",
"{",
"RegionUtil",
".",
"setBorderTop",
"(",
"cellStyle",
".",
"getBorderTopEnum",
"(",
")",
",",
"cellRangeAddress",
",",
"sheet",
")",
";",
"RegionUtil",
".",
"setBorderRight",
"(",
"cellStyle",
".",
"getBorderRightEnum",
"(",
")",
",",
"cellRangeAddress",
",",
"sheet",
")",
";",
"RegionUtil",
".",
"setBorderBottom",
"(",
"cellStyle",
".",
"getBorderBottomEnum",
"(",
")",
",",
"cellRangeAddress",
",",
"sheet",
")",
";",
"RegionUtil",
".",
"setBorderLeft",
"(",
"cellStyle",
".",
"getBorderLeftEnum",
"(",
")",
",",
"cellRangeAddress",
",",
"sheet",
")",
";",
"}",
"return",
"sheet",
".",
"addMergedRegion",
"(",
"cellRangeAddress",
")",
";",
"}"
] | 合并单元格,可以根据设置的值来合并行和列
@param sheet 表对象
@param firstRow 起始行,0开始
@param lastRow 结束行,0开始
@param firstColumn 起始列,0开始
@param lastColumn 结束列,0开始
@param cellStyle 单元格样式,只提取边框样式
@return 合并后的单元格号 | [
"合并单元格,可以根据设置的值来合并行和列"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java#L204-L219 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/feature/WigUtils.java | WigUtils.getHeaderInfo | private static String getHeaderInfo(String name, String headerLine) {
"""
Get information from a Wig header line.
@param name Name of the information, e.g.: span, chrom, step,...
@param headerLine Header line where to search that information
@return Value of the information
"""
String[] fields = headerLine.split("[\t ]");
for (String field : fields) {
if (field.startsWith(name + "=")) {
String[] subfields = field.split("=");
return subfields[1];
}
}
return null;
} | java | private static String getHeaderInfo(String name, String headerLine) {
String[] fields = headerLine.split("[\t ]");
for (String field : fields) {
if (field.startsWith(name + "=")) {
String[] subfields = field.split("=");
return subfields[1];
}
}
return null;
} | [
"private",
"static",
"String",
"getHeaderInfo",
"(",
"String",
"name",
",",
"String",
"headerLine",
")",
"{",
"String",
"[",
"]",
"fields",
"=",
"headerLine",
".",
"split",
"(",
"\"[\\t ]\"",
")",
";",
"for",
"(",
"String",
"field",
":",
"fields",
")",
"{",
"if",
"(",
"field",
".",
"startsWith",
"(",
"name",
"+",
"\"=\"",
")",
")",
"{",
"String",
"[",
"]",
"subfields",
"=",
"field",
".",
"split",
"(",
"\"=\"",
")",
";",
"return",
"subfields",
"[",
"1",
"]",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Get information from a Wig header line.
@param name Name of the information, e.g.: span, chrom, step,...
@param headerLine Header line where to search that information
@return Value of the information | [
"Get",
"information",
"from",
"a",
"Wig",
"header",
"line",
"."
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/feature/WigUtils.java#L240-L249 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java | EnvironmentsInner.beginStopAsync | public Observable<Void> beginStopAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName) {
"""
Stops an environment by stopping all resources inside the environment This operation can take a while to complete.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param environmentSettingName The name of the environment Setting.
@param environmentName The name of the environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return beginStopWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginStopAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName) {
return beginStopWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginStopAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"String",
"environmentSettingName",
",",
"String",
"environmentName",
")",
"{",
"return",
"beginStopWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccountName",
",",
"labName",
",",
"environmentSettingName",
",",
"environmentName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Stops an environment by stopping all resources inside the environment This operation can take a while to complete.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param environmentSettingName The name of the environment Setting.
@param environmentName The name of the environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Stops",
"an",
"environment",
"by",
"stopping",
"all",
"resources",
"inside",
"the",
"environment",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L1706-L1713 |
auth0/Auth0.Android | auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java | AuthenticationAPIClient.delegationWithIdToken | @SuppressWarnings("WeakerAccess")
public DelegationRequest<Map<String, Object>> delegationWithIdToken(@NonNull String idToken, @NonNull String apiType) {
"""
Performs a <a href="https://auth0.com/docs/api/authentication#delegation">delegation</a> request that will yield a delegation token.
Example usage:
<pre>
{@code
client.delegationWithIdToken("{id token}", "{app type, e.g. firebase}")
.start(new BaseCallback<Map<String, Object>>() {
{@literal}Override
public void onSuccess(Map<String, Object> payload) {}
{@literal}Override
public void onFailure(AuthenticationException error) {}
});
}
</pre>
@param idToken issued by Auth0 for the user. The token must not be expired.
@param apiType the delegation 'api_type' parameter
@return a request to configure and start
"""
ParameterizableRequest<Map<String, Object>, AuthenticationException> request = delegation()
.addParameter(ParameterBuilder.ID_TOKEN_KEY, idToken);
return new DelegationRequest<>(request)
.setApiType(apiType);
} | java | @SuppressWarnings("WeakerAccess")
public DelegationRequest<Map<String, Object>> delegationWithIdToken(@NonNull String idToken, @NonNull String apiType) {
ParameterizableRequest<Map<String, Object>, AuthenticationException> request = delegation()
.addParameter(ParameterBuilder.ID_TOKEN_KEY, idToken);
return new DelegationRequest<>(request)
.setApiType(apiType);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"DelegationRequest",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"delegationWithIdToken",
"(",
"@",
"NonNull",
"String",
"idToken",
",",
"@",
"NonNull",
"String",
"apiType",
")",
"{",
"ParameterizableRequest",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
",",
"AuthenticationException",
">",
"request",
"=",
"delegation",
"(",
")",
".",
"addParameter",
"(",
"ParameterBuilder",
".",
"ID_TOKEN_KEY",
",",
"idToken",
")",
";",
"return",
"new",
"DelegationRequest",
"<>",
"(",
"request",
")",
".",
"setApiType",
"(",
"apiType",
")",
";",
"}"
] | Performs a <a href="https://auth0.com/docs/api/authentication#delegation">delegation</a> request that will yield a delegation token.
Example usage:
<pre>
{@code
client.delegationWithIdToken("{id token}", "{app type, e.g. firebase}")
.start(new BaseCallback<Map<String, Object>>() {
{@literal}Override
public void onSuccess(Map<String, Object> payload) {}
{@literal}Override
public void onFailure(AuthenticationException error) {}
});
}
</pre>
@param idToken issued by Auth0 for the user. The token must not be expired.
@param apiType the delegation 'api_type' parameter
@return a request to configure and start | [
"Performs",
"a",
"<a",
"href",
"=",
"https",
":",
"//",
"auth0",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"authentication#delegation",
">",
"delegation<",
"/",
"a",
">",
"request",
"that",
"will",
"yield",
"a",
"delegation",
"token",
".",
"Example",
"usage",
":",
"<pre",
">",
"{",
"@code",
"client",
".",
"delegationWithIdToken",
"(",
"{",
"id",
"token",
"}",
"{",
"app",
"type",
"e",
".",
"g",
".",
"firebase",
"}",
")",
".",
"start",
"(",
"new",
"BaseCallback<Map<String",
"Object",
">>",
"()",
"{",
"{",
"@literal",
"}",
"Override",
"public",
"void",
"onSuccess",
"(",
"Map<String",
"Object",
">",
"payload",
")",
"{}"
] | train | https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java#L821-L828 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java | GenericGenerators.ifObjectsNotEqual | public static InsnList ifObjectsNotEqual(InsnList lhs, InsnList rhs, InsnList action) {
"""
Compares two objects and performs some action if the objects are NOT the same (uses != to check if not same).
@param lhs left hand side instruction list -- must leave an object on the stack
@param rhs right hand side instruction list -- must leave an object on the stack
@param action action to perform if results of {@code lhs} and {@code rhs} are not equal
@return instructions instruction list to perform some action if two objects are not equal
@throws NullPointerException if any argument is {@code null}
"""
Validate.notNull(lhs);
Validate.notNull(rhs);
Validate.notNull(action);
InsnList ret = new InsnList();
LabelNode equalLabelNode = new LabelNode();
ret.add(lhs);
ret.add(rhs);
ret.add(new JumpInsnNode(Opcodes.IF_ACMPEQ, equalLabelNode));
ret.add(action);
ret.add(equalLabelNode);
return ret;
} | java | public static InsnList ifObjectsNotEqual(InsnList lhs, InsnList rhs, InsnList action) {
Validate.notNull(lhs);
Validate.notNull(rhs);
Validate.notNull(action);
InsnList ret = new InsnList();
LabelNode equalLabelNode = new LabelNode();
ret.add(lhs);
ret.add(rhs);
ret.add(new JumpInsnNode(Opcodes.IF_ACMPEQ, equalLabelNode));
ret.add(action);
ret.add(equalLabelNode);
return ret;
} | [
"public",
"static",
"InsnList",
"ifObjectsNotEqual",
"(",
"InsnList",
"lhs",
",",
"InsnList",
"rhs",
",",
"InsnList",
"action",
")",
"{",
"Validate",
".",
"notNull",
"(",
"lhs",
")",
";",
"Validate",
".",
"notNull",
"(",
"rhs",
")",
";",
"Validate",
".",
"notNull",
"(",
"action",
")",
";",
"InsnList",
"ret",
"=",
"new",
"InsnList",
"(",
")",
";",
"LabelNode",
"equalLabelNode",
"=",
"new",
"LabelNode",
"(",
")",
";",
"ret",
".",
"add",
"(",
"lhs",
")",
";",
"ret",
".",
"add",
"(",
"rhs",
")",
";",
"ret",
".",
"add",
"(",
"new",
"JumpInsnNode",
"(",
"Opcodes",
".",
"IF_ACMPEQ",
",",
"equalLabelNode",
")",
")",
";",
"ret",
".",
"add",
"(",
"action",
")",
";",
"ret",
".",
"add",
"(",
"equalLabelNode",
")",
";",
"return",
"ret",
";",
"}"
] | Compares two objects and performs some action if the objects are NOT the same (uses != to check if not same).
@param lhs left hand side instruction list -- must leave an object on the stack
@param rhs right hand side instruction list -- must leave an object on the stack
@param action action to perform if results of {@code lhs} and {@code rhs} are not equal
@return instructions instruction list to perform some action if two objects are not equal
@throws NullPointerException if any argument is {@code null} | [
"Compares",
"two",
"objects",
"and",
"performs",
"some",
"action",
"if",
"the",
"objects",
"are",
"NOT",
"the",
"same",
"(",
"uses",
"!",
"=",
"to",
"check",
"if",
"not",
"same",
")",
"."
] | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L674-L691 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.