repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/nvdl/ModeUsage.java | ModeUsage.getAttributeProcessing | int getAttributeProcessing() {
if (attributeProcessing == -1) {
attributeProcessing = resolve(mode).getAttributeProcessing();
if (modeMap != null) {
for (Enumeration e = modeMap.values();
e.hasMoreElements()
&& attributeProcessing != Mode.ATTRIBUTE_PROCESSING_FULL;)
attributeProcessing = Math.max(resolve((Mode)e.nextElement()).getAttributeProcessing(),
attributeProcessing);
}
}
return attributeProcessing;
} | java | int getAttributeProcessing() {
if (attributeProcessing == -1) {
attributeProcessing = resolve(mode).getAttributeProcessing();
if (modeMap != null) {
for (Enumeration e = modeMap.values();
e.hasMoreElements()
&& attributeProcessing != Mode.ATTRIBUTE_PROCESSING_FULL;)
attributeProcessing = Math.max(resolve((Mode)e.nextElement()).getAttributeProcessing(),
attributeProcessing);
}
}
return attributeProcessing;
} | [
"int",
"getAttributeProcessing",
"(",
")",
"{",
"if",
"(",
"attributeProcessing",
"==",
"-",
"1",
")",
"{",
"attributeProcessing",
"=",
"resolve",
"(",
"mode",
")",
".",
"getAttributeProcessing",
"(",
")",
";",
"if",
"(",
"modeMap",
"!=",
"null",
")",
"{",... | Get the maximum attribute processing value from the default mode and
from all the modes specified in the contexts.
@return The attribute processing value. | [
"Get",
"the",
"maximum",
"attribute",
"processing",
"value",
"from",
"the",
"default",
"mode",
"and",
"from",
"all",
"the",
"modes",
"specified",
"in",
"the",
"contexts",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/ModeUsage.java#L108-L120 | train |
KnisterPeter/Smaller | bundles/resource/src/main/java/de/matrixweb/smaller/resource/SourceMerger.java | SourceMerger.getMergedJsonFile | public String getMergedJsonFile(final VFS vfs,
final ResourceResolver resolver, final String in) throws IOException {
final VFile file = vfs.find("/__temp__json__input");
final List<Resource> resources = getJsonSourceFiles(resolver.resolve(in));
// Hack which tries to replace all non-js sources with js sources in case of
// mixed json-input file
boolean foundJs = false;
boolean foundNonJs = false;
for (final Resource resource : resources) {
foundJs |= FilenameUtils.isExtension(resource.getPath(), "js");
foundNonJs |= !FilenameUtils.isExtension(resource.getPath(), "js");
}
if (foundJs && foundNonJs) {
for (int i = 0, n = resources.size(); i < n; i++) {
final Resource resource = resources.get(i);
if (!FilenameUtils.isExtension(resource.getPath(), "js")) {
final Resource jsResource = resource.getResolver().resolve(
FilenameUtils.getName(FilenameUtils.removeExtension(resource
.getPath()) + ".js"));
resources.add(resources.indexOf(resource), jsResource);
resources.remove(resource);
}
}
}
VFSUtils.write(file, merge(resources));
return file.getPath();
} | java | public String getMergedJsonFile(final VFS vfs,
final ResourceResolver resolver, final String in) throws IOException {
final VFile file = vfs.find("/__temp__json__input");
final List<Resource> resources = getJsonSourceFiles(resolver.resolve(in));
// Hack which tries to replace all non-js sources with js sources in case of
// mixed json-input file
boolean foundJs = false;
boolean foundNonJs = false;
for (final Resource resource : resources) {
foundJs |= FilenameUtils.isExtension(resource.getPath(), "js");
foundNonJs |= !FilenameUtils.isExtension(resource.getPath(), "js");
}
if (foundJs && foundNonJs) {
for (int i = 0, n = resources.size(); i < n; i++) {
final Resource resource = resources.get(i);
if (!FilenameUtils.isExtension(resource.getPath(), "js")) {
final Resource jsResource = resource.getResolver().resolve(
FilenameUtils.getName(FilenameUtils.removeExtension(resource
.getPath()) + ".js"));
resources.add(resources.indexOf(resource), jsResource);
resources.remove(resource);
}
}
}
VFSUtils.write(file, merge(resources));
return file.getPath();
} | [
"public",
"String",
"getMergedJsonFile",
"(",
"final",
"VFS",
"vfs",
",",
"final",
"ResourceResolver",
"resolver",
",",
"final",
"String",
"in",
")",
"throws",
"IOException",
"{",
"final",
"VFile",
"file",
"=",
"vfs",
".",
"find",
"(",
"\"/__temp__json__input\""... | Returns a merged temporary file with all contents listed in the given json
file paths.
@param vfs
The {@link VFS} to use
@param resolver
The {@link ResourceResolver} to use
@param in
The input json file
@return Returns a file path into the {@link VFS} to the temp file
@throws IOException | [
"Returns",
"a",
"merged",
"temporary",
"file",
"with",
"all",
"contents",
"listed",
"in",
"the",
"given",
"json",
"file",
"paths",
"."
] | 2bd6d3422a251fe1ed203e829fd2b1024d728bed | https://github.com/KnisterPeter/Smaller/blob/2bd6d3422a251fe1ed203e829fd2b1024d728bed/bundles/resource/src/main/java/de/matrixweb/smaller/resource/SourceMerger.java#L102-L130 | train |
KnisterPeter/Smaller | bundles/resource/src/main/java/de/matrixweb/smaller/resource/SourceMerger.java | SourceMerger.isUniqueFileResolved | private boolean isUniqueFileResolved(final Set<String> alreadyHandled,
final String s) {
return this.uniqueFiles && alreadyHandled.contains(s);
} | java | private boolean isUniqueFileResolved(final Set<String> alreadyHandled,
final String s) {
return this.uniqueFiles && alreadyHandled.contains(s);
} | [
"private",
"boolean",
"isUniqueFileResolved",
"(",
"final",
"Set",
"<",
"String",
">",
"alreadyHandled",
",",
"final",
"String",
"s",
")",
"{",
"return",
"this",
".",
"uniqueFiles",
"&&",
"alreadyHandled",
".",
"contains",
"(",
"s",
")",
";",
"}"
] | Examines a source file whether it is already resolved when it should be
unique.
@param alreadyHandled
all source files already resolved
@param s
source file to resolve
@return true if source files should be unique and the source file already
resolved | [
"Examines",
"a",
"source",
"file",
"whether",
"it",
"is",
"already",
"resolved",
"when",
"it",
"should",
"be",
"unique",
"."
] | 2bd6d3422a251fe1ed203e829fd2b1024d728bed | https://github.com/KnisterPeter/Smaller/blob/2bd6d3422a251fe1ed203e829fd2b1024d728bed/bundles/resource/src/main/java/de/matrixweb/smaller/resource/SourceMerger.java#L187-L190 | train |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/internal/ToHelper.java | ToHelper.getDomainClass | public Class<?> getDomainClass(Class<?> toClass) {
Class<?> declaredClass = getDeclaredDomainClass(toClass);
return classReplacer.replaceClass(declaredClass);
} | java | public Class<?> getDomainClass(Class<?> toClass) {
Class<?> declaredClass = getDeclaredDomainClass(toClass);
return classReplacer.replaceClass(declaredClass);
} | [
"public",
"Class",
"<",
"?",
">",
"getDomainClass",
"(",
"Class",
"<",
"?",
">",
"toClass",
")",
"{",
"Class",
"<",
"?",
">",
"declaredClass",
"=",
"getDeclaredDomainClass",
"(",
"toClass",
")",
";",
"return",
"classReplacer",
".",
"replaceClass",
"(",
"de... | Get domain class for transfer object.
@param toClass transfer object class
@return domain class as annotated on class | [
"Get",
"domain",
"class",
"for",
"transfer",
"object",
"."
] | eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8 | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/internal/ToHelper.java#L68-L71 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/ValidationDriver.java | ValidationDriver.validate | public boolean validate(InputSource in) throws SAXException, IOException {
if (schema == null)
throw new IllegalStateException("cannot validate without schema");
if (validator == null)
validator = schema.createValidator(instanceProperties);
if (xr == null) {
xr = ResolverFactory.createResolver(instanceProperties).createXMLReader();
xr.setErrorHandler(eh);
}
eh.reset();
xr.setContentHandler(validator.getContentHandler());
DTDHandler dh = validator.getDTDHandler();
if (dh != null)
xr.setDTDHandler(dh);
try {
xr.parse(in);
return !eh.getHadErrorOrFatalError();
}
finally {
validator.reset();
}
} | java | public boolean validate(InputSource in) throws SAXException, IOException {
if (schema == null)
throw new IllegalStateException("cannot validate without schema");
if (validator == null)
validator = schema.createValidator(instanceProperties);
if (xr == null) {
xr = ResolverFactory.createResolver(instanceProperties).createXMLReader();
xr.setErrorHandler(eh);
}
eh.reset();
xr.setContentHandler(validator.getContentHandler());
DTDHandler dh = validator.getDTDHandler();
if (dh != null)
xr.setDTDHandler(dh);
try {
xr.parse(in);
return !eh.getHadErrorOrFatalError();
}
finally {
validator.reset();
}
} | [
"public",
"boolean",
"validate",
"(",
"InputSource",
"in",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"if",
"(",
"schema",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"cannot validate without schema\"",
")",
";",
"if",
"(",
"v... | Validates a document against the currently loaded schema. This can be called
multiple times in order to validate multiple documents.
@param in the InputSource for the document to be validated
@return <code>true</code> if the document is valid; <code>false</code> otherwise
@throws java.lang.IllegalStateException if there is no currently loaded schema
@throws java.io.IOException if an I/O error occurred
@throws org.xml.sax.SAXException if an XMLReader or ErrorHandler threw a SAXException | [
"Validates",
"a",
"document",
"against",
"the",
"currently",
"loaded",
"schema",
".",
"This",
"can",
"be",
"called",
"multiple",
"times",
"in",
"order",
"to",
"validate",
"multiple",
"documents",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/ValidationDriver.java#L145-L166 | train |
davityle/ngAndroid | ng-processor/src/main/java/com/github/davityle/ngprocessor/util/TypeUtils.java | TypeUtils.getOperatorKind | public TypeMirror getOperatorKind(TypeMirror leftMirror, TypeMirror rightMirror , TokenType.BinaryOperator operator){
if(leftMirror == null || rightMirror == null)
return null;
TypeKind leftKind = leftMirror.getKind();
TypeKind rightKind = rightMirror.getKind();
if(isString(leftMirror))
return leftMirror;
if(isString(rightMirror))
return rightMirror;
if(either(leftKind, rightKind, TypeKind.BOOLEAN) ) {
if(operator != null) {
messageUtils.error(Option.<Element>absent(), "Cannot perform perform the operation '%s' with a boolean type. (%s %s %s)", operator.toString(), leftMirror, operator.toString(), rightMirror);
}
return null;
}
if(leftKind.isPrimitive() && rightKind.isPrimitive()) {
if (typeUtils.isSameType(leftMirror, rightMirror))
return typeUtils.getPrimitiveType(leftKind);
if (either(leftKind, rightKind, TypeKind.DOUBLE))
return typeUtils.getPrimitiveType(TypeKind.DOUBLE);
if (either(leftKind, rightKind, TypeKind.FLOAT))
return typeUtils.getPrimitiveType(TypeKind.FLOAT);
if (either(leftKind, rightKind, TypeKind.LONG))
return typeUtils.getPrimitiveType(TypeKind.LONG);
if (
either(leftKind, rightKind, TypeKind.INT) ||
either(leftKind, rightKind, TypeKind.CHAR) ||
either(leftKind, rightKind, TypeKind.SHORT) ||
either(leftKind, rightKind, TypeKind.BYTE)
) {
return typeUtils.getPrimitiveType(TypeKind.INT);
}
}
TypeMirror intMirror = typeUtils.getPrimitiveType(TypeKind.INT);
if(both(assignable(intMirror, leftMirror), assignable(intMirror, rightMirror)))
return intMirror;
TypeMirror longMirror = typeUtils.getPrimitiveType(TypeKind.LONG);
if(both(assignable(longMirror, leftMirror), assignable(longMirror, rightMirror)))
return longMirror;
TypeMirror floatMirror = typeUtils.getPrimitiveType(TypeKind.FLOAT);
if(both(assignable(floatMirror, leftMirror), assignable(floatMirror, rightMirror)))
return floatMirror;
TypeMirror doubleMirror = typeUtils.getPrimitiveType(TypeKind.DOUBLE);
if(both(assignable(doubleMirror, leftMirror), assignable(doubleMirror, rightMirror)))
return doubleMirror;
return null;
} | java | public TypeMirror getOperatorKind(TypeMirror leftMirror, TypeMirror rightMirror , TokenType.BinaryOperator operator){
if(leftMirror == null || rightMirror == null)
return null;
TypeKind leftKind = leftMirror.getKind();
TypeKind rightKind = rightMirror.getKind();
if(isString(leftMirror))
return leftMirror;
if(isString(rightMirror))
return rightMirror;
if(either(leftKind, rightKind, TypeKind.BOOLEAN) ) {
if(operator != null) {
messageUtils.error(Option.<Element>absent(), "Cannot perform perform the operation '%s' with a boolean type. (%s %s %s)", operator.toString(), leftMirror, operator.toString(), rightMirror);
}
return null;
}
if(leftKind.isPrimitive() && rightKind.isPrimitive()) {
if (typeUtils.isSameType(leftMirror, rightMirror))
return typeUtils.getPrimitiveType(leftKind);
if (either(leftKind, rightKind, TypeKind.DOUBLE))
return typeUtils.getPrimitiveType(TypeKind.DOUBLE);
if (either(leftKind, rightKind, TypeKind.FLOAT))
return typeUtils.getPrimitiveType(TypeKind.FLOAT);
if (either(leftKind, rightKind, TypeKind.LONG))
return typeUtils.getPrimitiveType(TypeKind.LONG);
if (
either(leftKind, rightKind, TypeKind.INT) ||
either(leftKind, rightKind, TypeKind.CHAR) ||
either(leftKind, rightKind, TypeKind.SHORT) ||
either(leftKind, rightKind, TypeKind.BYTE)
) {
return typeUtils.getPrimitiveType(TypeKind.INT);
}
}
TypeMirror intMirror = typeUtils.getPrimitiveType(TypeKind.INT);
if(both(assignable(intMirror, leftMirror), assignable(intMirror, rightMirror)))
return intMirror;
TypeMirror longMirror = typeUtils.getPrimitiveType(TypeKind.LONG);
if(both(assignable(longMirror, leftMirror), assignable(longMirror, rightMirror)))
return longMirror;
TypeMirror floatMirror = typeUtils.getPrimitiveType(TypeKind.FLOAT);
if(both(assignable(floatMirror, leftMirror), assignable(floatMirror, rightMirror)))
return floatMirror;
TypeMirror doubleMirror = typeUtils.getPrimitiveType(TypeKind.DOUBLE);
if(both(assignable(doubleMirror, leftMirror), assignable(doubleMirror, rightMirror)))
return doubleMirror;
return null;
} | [
"public",
"TypeMirror",
"getOperatorKind",
"(",
"TypeMirror",
"leftMirror",
",",
"TypeMirror",
"rightMirror",
",",
"TokenType",
".",
"BinaryOperator",
"operator",
")",
"{",
"if",
"(",
"leftMirror",
"==",
"null",
"||",
"rightMirror",
"==",
"null",
")",
"return",
... | rules for this method are found here
http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.6.2
If any operand is of a reference type, it is subjected to unboxing conversion (§5.1.8).
Widening primitive conversion (§5.1.2) is applied to convert either or both operands as specified by the following rules:
If either operand is of type double, the other is converted to double.
Otherwise, if either operand is of type float, the other is converted to float.
Otherwise, if either operand is of type long, the other is converted to long.
Otherwise, both operands are converted to type int.
test this hardcore..
@param leftMirror
@param rightMirror
@param operator
@return | [
"rules",
"for",
"this",
"method",
"are",
"found",
"here"
] | 1497a9752cd3d4918035531cd072fd01576328e9 | https://github.com/davityle/ngAndroid/blob/1497a9752cd3d4918035531cd072fd01576328e9/ng-processor/src/main/java/com/github/davityle/ngprocessor/util/TypeUtils.java#L79-L138 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/nvdl/AttachAction.java | AttachAction.perform | void perform(ContentHandler handler, SectionState state) {
final ModeUsage modeUsage = getModeUsage();
if (handler != null)
state.addActiveHandler(handler, modeUsage);
else
state.addAttributeValidationModeUsage(modeUsage);
state.addChildMode(modeUsage, handler);
} | java | void perform(ContentHandler handler, SectionState state) {
final ModeUsage modeUsage = getModeUsage();
if (handler != null)
state.addActiveHandler(handler, modeUsage);
else
state.addAttributeValidationModeUsage(modeUsage);
state.addChildMode(modeUsage, handler);
} | [
"void",
"perform",
"(",
"ContentHandler",
"handler",
",",
"SectionState",
"state",
")",
"{",
"final",
"ModeUsage",
"modeUsage",
"=",
"getModeUsage",
"(",
")",
";",
"if",
"(",
"handler",
"!=",
"null",
")",
"state",
".",
"addActiveHandler",
"(",
"handler",
","... | Performs this action on the section state.
@param handler ???
@param state The section state. | [
"Performs",
"this",
"action",
"on",
"the",
"section",
"state",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/AttachAction.java#L24-L31 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/relaxng/parse/compact/CompactSyntaxTokenManager.java | CompactSyntaxTokenManager.getNextToken | public Token getNextToken()
{
Token specialToken = null;
Token matchedToken;
int curPos = 0;
EOFLoop :
for (;;)
{
try
{
curChar = input_stream.BeginToken();
}
catch(EOFException e)
{
jjmatchedKind = 0;
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
return matchedToken;
}
image = jjimage;
image.setLength(0);
jjimageLen = 0;
switch(curLexState)
{
case 0:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_0();
break;
case 1:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_1();
break;
case 2:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_2();
break;
}
if (jjmatchedKind != 0x7fffffff)
{
if (jjmatchedPos + 1 < curPos)
input_stream.backup(curPos - jjmatchedPos - 1);
if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
return matchedToken;
}
else
{
if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
if (specialToken == null)
specialToken = matchedToken;
else
{
matchedToken.specialToken = specialToken;
specialToken = (specialToken.next = matchedToken);
}
SkipLexicalActions(matchedToken);
}
else
SkipLexicalActions(null);
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
continue EOFLoop;
}
}
int error_line = input_stream.getEndLine();
int error_column = input_stream.getEndColumn();
String error_after = null;
boolean EOFSeen = false;
try { input_stream.readChar(); input_stream.backup(1); }
catch (EOFException e1) {
EOFSeen = true;
error_after = curPos <= 1 ? "" : input_stream.GetImage();
if (curChar == '\n' || curChar == '\r') {
error_line++;
error_column = 0;
}
else
error_column++;
}
if (!EOFSeen) {
input_stream.backup(1);
error_after = curPos <= 1 ? "" : input_stream.GetImage();
}
throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
}
} | java | public Token getNextToken()
{
Token specialToken = null;
Token matchedToken;
int curPos = 0;
EOFLoop :
for (;;)
{
try
{
curChar = input_stream.BeginToken();
}
catch(EOFException e)
{
jjmatchedKind = 0;
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
return matchedToken;
}
image = jjimage;
image.setLength(0);
jjimageLen = 0;
switch(curLexState)
{
case 0:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_0();
break;
case 1:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_1();
break;
case 2:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_2();
break;
}
if (jjmatchedKind != 0x7fffffff)
{
if (jjmatchedPos + 1 < curPos)
input_stream.backup(curPos - jjmatchedPos - 1);
if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
return matchedToken;
}
else
{
if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
if (specialToken == null)
specialToken = matchedToken;
else
{
matchedToken.specialToken = specialToken;
specialToken = (specialToken.next = matchedToken);
}
SkipLexicalActions(matchedToken);
}
else
SkipLexicalActions(null);
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
continue EOFLoop;
}
}
int error_line = input_stream.getEndLine();
int error_column = input_stream.getEndColumn();
String error_after = null;
boolean EOFSeen = false;
try { input_stream.readChar(); input_stream.backup(1); }
catch (EOFException e1) {
EOFSeen = true;
error_after = curPos <= 1 ? "" : input_stream.GetImage();
if (curChar == '\n' || curChar == '\r') {
error_line++;
error_column = 0;
}
else
error_column++;
}
if (!EOFSeen) {
input_stream.backup(1);
error_after = curPos <= 1 ? "" : input_stream.GetImage();
}
throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
}
} | [
"public",
"Token",
"getNextToken",
"(",
")",
"{",
"Token",
"specialToken",
"=",
"null",
";",
"Token",
"matchedToken",
";",
"int",
"curPos",
"=",
"0",
";",
"EOFLoop",
":",
"for",
"(",
";",
";",
")",
"{",
"try",
"{",
"curChar",
"=",
"input_stream",
".",
... | Get the next Token. | [
"Get",
"the",
"next",
"Token",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/relaxng/parse/compact/CompactSyntaxTokenManager.java#L1695-L1791 | train |
davityle/ngAndroid | lib/src/main/java/com/ngandroid/lib/utils/DefaultValueFormatter.java | DefaultValueFormatter.filter | @Override
public String filter(String value, String previousValue){
if(previousValue != null && value.length() > previousValue.length())
return value;
return value.equals("0") || value.equals("0.0") ? "" : value;
} | java | @Override
public String filter(String value, String previousValue){
if(previousValue != null && value.length() > previousValue.length())
return value;
return value.equals("0") || value.equals("0.0") ? "" : value;
} | [
"@",
"Override",
"public",
"String",
"filter",
"(",
"String",
"value",
",",
"String",
"previousValue",
")",
"{",
"if",
"(",
"previousValue",
"!=",
"null",
"&&",
"value",
".",
"length",
"(",
")",
">",
"previousValue",
".",
"length",
"(",
")",
")",
"return... | The default filter removes the display of '0' or '0.0' if the user has erased the text. This is
to prevent a number being shown when the user tries to erase it.
@param value the value that is being filtered
@param previousValue the previous value
@return | [
"The",
"default",
"filter",
"removes",
"the",
"display",
"of",
"0",
"or",
"0",
".",
"0",
"if",
"the",
"user",
"has",
"erased",
"the",
"text",
".",
"This",
"is",
"to",
"prevent",
"a",
"number",
"being",
"shown",
"when",
"the",
"user",
"tries",
"to",
"... | 1497a9752cd3d4918035531cd072fd01576328e9 | https://github.com/davityle/ngAndroid/blob/1497a9752cd3d4918035531cd072fd01576328e9/lib/src/main/java/com/ngandroid/lib/utils/DefaultValueFormatter.java#L99-L104 | train |
bingoohuang/westid | src/main/java/com/github/bingoohuang/westid/Util.java | Util.ipToString | public String ipToString(long ip) {
// if ip is bigger than 255.255.255.255 or smaller than 0.0.0.0
if (ip > 4294967295l || ip < 0) {
throw new IllegalArgumentException("invalid ip");
}
val ipAddress = new StringBuilder();
for (int i = 3; i >= 0; i--) {
int shift = i * 8;
ipAddress.append((ip & (0xff << shift)) >> shift);
if (i > 0) {
ipAddress.append(".");
}
}
return ipAddress.toString();
} | java | public String ipToString(long ip) {
// if ip is bigger than 255.255.255.255 or smaller than 0.0.0.0
if (ip > 4294967295l || ip < 0) {
throw new IllegalArgumentException("invalid ip");
}
val ipAddress = new StringBuilder();
for (int i = 3; i >= 0; i--) {
int shift = i * 8;
ipAddress.append((ip & (0xff << shift)) >> shift);
if (i > 0) {
ipAddress.append(".");
}
}
return ipAddress.toString();
} | [
"public",
"String",
"ipToString",
"(",
"long",
"ip",
")",
"{",
"// if ip is bigger than 255.255.255.255 or smaller than 0.0.0.0",
"if",
"(",
"ip",
">",
"4294967295l",
"||",
"ip",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"invalid ip\"",
... | Returns the 32bit dotted format of the provided long ip.
@param ip the long ip
@return the 32bit dotted format of <code>ip</code>
@throws IllegalArgumentException if <code>ip</code> is invalid | [
"Returns",
"the",
"32bit",
"dotted",
"format",
"of",
"the",
"provided",
"long",
"ip",
"."
] | ebc44cd6169d62863dc6117bc2c769f36827b93e | https://github.com/bingoohuang/westid/blob/ebc44cd6169d62863dc6117bc2c769f36827b93e/src/main/java/com/github/bingoohuang/westid/Util.java#L29-L44 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/datatype/xsd/regex/java/Translator.java | SimpleCharClass.outputComplementDirect | void outputComplementDirect(StringBuffer buf) {
if (!surrogatesDirect && getContainsBmp() == NONE)
buf.append("[\u0000-\uFFFF]");
else {
buf.append("[^");
inClassOutputDirect(buf);
buf.append(']');
}
} | java | void outputComplementDirect(StringBuffer buf) {
if (!surrogatesDirect && getContainsBmp() == NONE)
buf.append("[\u0000-\uFFFF]");
else {
buf.append("[^");
inClassOutputDirect(buf);
buf.append(']');
}
} | [
"void",
"outputComplementDirect",
"(",
"StringBuffer",
"buf",
")",
"{",
"if",
"(",
"!",
"surrogatesDirect",
"&&",
"getContainsBmp",
"(",
")",
"==",
"NONE",
")",
"buf",
".",
"append",
"(",
"\"[\\u0000-\\uFFFF]\"",
")",
";",
"else",
"{",
"buf",
".",
"append",
... | must not call if containsBmp == ALL && !surrogatesDirect | [
"must",
"not",
"call",
"if",
"containsBmp",
"==",
"ALL",
"&&",
"!surrogatesDirect"
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/datatype/xsd/regex/java/Translator.java#L571-L579 | train |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/AutomaticListTypeConverter.java | AutomaticListTypeConverter.doConvertOne | public Object doConvertOne(JTransfo jTransfo, Object toObject, Class<?> domainObjectType, String... tags)
throws JTransfoException {
return jTransfo.convertTo(toObject, domainObjectType, tags);
} | java | public Object doConvertOne(JTransfo jTransfo, Object toObject, Class<?> domainObjectType, String... tags)
throws JTransfoException {
return jTransfo.convertTo(toObject, domainObjectType, tags);
} | [
"public",
"Object",
"doConvertOne",
"(",
"JTransfo",
"jTransfo",
",",
"Object",
"toObject",
",",
"Class",
"<",
"?",
">",
"domainObjectType",
",",
"String",
"...",
"tags",
")",
"throws",
"JTransfoException",
"{",
"return",
"jTransfo",
".",
"convertTo",
"(",
"to... | Do the actual conversion of one object.
@param jTransfo jTransfo instance in use
@param toObject transfer object
@param domainObjectType domain object type
@param tags tags which indicate which fields can be converted based on {@link MapOnly} annotations.
@return domain object
@throws JTransfoException oops, cannot convert | [
"Do",
"the",
"actual",
"conversion",
"of",
"one",
"object",
"."
] | eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8 | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/AutomaticListTypeConverter.java#L77-L80 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/resolver/xml/transform/Transform.java | Transform.createSAXURIResolver | public static URIResolver createSAXURIResolver(Resolver resolver) {
final SAXResolver saxResolver = new SAXResolver(resolver);
return new URIResolver() {
public Source resolve(String href, String base) throws TransformerException {
try {
return saxResolver.resolve(href, base);
}
catch (SAXException e) {
throw toTransformerException(e);
}
catch (IOException e) {
throw new TransformerException(e);
}
}
};
} | java | public static URIResolver createSAXURIResolver(Resolver resolver) {
final SAXResolver saxResolver = new SAXResolver(resolver);
return new URIResolver() {
public Source resolve(String href, String base) throws TransformerException {
try {
return saxResolver.resolve(href, base);
}
catch (SAXException e) {
throw toTransformerException(e);
}
catch (IOException e) {
throw new TransformerException(e);
}
}
};
} | [
"public",
"static",
"URIResolver",
"createSAXURIResolver",
"(",
"Resolver",
"resolver",
")",
"{",
"final",
"SAXResolver",
"saxResolver",
"=",
"new",
"SAXResolver",
"(",
"resolver",
")",
";",
"return",
"new",
"URIResolver",
"(",
")",
"{",
"public",
"Source",
"res... | Creates a URIResolver that returns a SAXSource.
@param resolver
@return | [
"Creates",
"a",
"URIResolver",
"that",
"returns",
"a",
"SAXSource",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/resolver/xml/transform/Transform.java#L32-L47 | train |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/internal/TaggedConverter.java | TaggedConverter.addConverters | public void addConverters(Converter converter, String... tags) {
for (String tag : tags) {
if (tag.startsWith("!")) {
notConverters.put(tag.substring(1), converter);
} else {
converters.put(tag, converter);
}
}
} | java | public void addConverters(Converter converter, String... tags) {
for (String tag : tags) {
if (tag.startsWith("!")) {
notConverters.put(tag.substring(1), converter);
} else {
converters.put(tag, converter);
}
}
} | [
"public",
"void",
"addConverters",
"(",
"Converter",
"converter",
",",
"String",
"...",
"tags",
")",
"{",
"for",
"(",
"String",
"tag",
":",
"tags",
")",
"{",
"if",
"(",
"tag",
".",
"startsWith",
"(",
"\"!\"",
")",
")",
"{",
"notConverters",
".",
"put",... | Add the converter which should be used for a specific tag.
@param tags tags for which the converter applies
@param converter converter for the tag | [
"Add",
"the",
"converter",
"which",
"should",
"be",
"used",
"for",
"a",
"specific",
"tag",
"."
] | eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8 | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/internal/TaggedConverter.java#L34-L42 | train |
dashorst/wicket-stuff-markup-validator | whattf/src/main/java/org/whattf/datatype/Pattern.java | Pattern.checkValid | public void checkValid(CharSequence literal)
throws DatatypeException {
// TODO find out what kind of thread concurrency guarantees are made
ContextFactory cf = new ContextFactory();
Context cx = cf.enterContext();
RegExpImpl rei = new RegExpImpl();
String anchoredRegex = "^(?:" + literal + ")$";
try {
rei.compileRegExp(cx, anchoredRegex, "");
} catch (EcmaError ee) {
throw newDatatypeException(ee.getErrorMessage());
} finally {
Context.exit();
}
} | java | public void checkValid(CharSequence literal)
throws DatatypeException {
// TODO find out what kind of thread concurrency guarantees are made
ContextFactory cf = new ContextFactory();
Context cx = cf.enterContext();
RegExpImpl rei = new RegExpImpl();
String anchoredRegex = "^(?:" + literal + ")$";
try {
rei.compileRegExp(cx, anchoredRegex, "");
} catch (EcmaError ee) {
throw newDatatypeException(ee.getErrorMessage());
} finally {
Context.exit();
}
} | [
"public",
"void",
"checkValid",
"(",
"CharSequence",
"literal",
")",
"throws",
"DatatypeException",
"{",
"// TODO find out what kind of thread concurrency guarantees are made",
"ContextFactory",
"cf",
"=",
"new",
"ContextFactory",
"(",
")",
";",
"Context",
"cx",
"=",
"cf"... | Checks that the value compiles as an anchored JavaScript regular expression.
@param literal the value
@param context ignored
@throws DatatypeException if the value isn't valid
@see org.relaxng.datatype.Datatype#checkValid(java.lang.String, org.relaxng.datatype.ValidationContext) | [
"Checks",
"that",
"the",
"value",
"compiles",
"as",
"an",
"anchored",
"JavaScript",
"regular",
"expression",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/whattf/src/main/java/org/whattf/datatype/Pattern.java#L59-L73 | train |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/impl/matchers/NameMatcher.java | NameMatcher.nameEquals | public static <T extends Key <T>> NameMatcher <T> nameEquals (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.EQUALS);
} | java | public static <T extends Key <T>> NameMatcher <T> nameEquals (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.EQUALS);
} | [
"public",
"static",
"<",
"T",
"extends",
"Key",
"<",
"T",
">",
">",
"NameMatcher",
"<",
"T",
">",
"nameEquals",
"(",
"final",
"String",
"compareTo",
")",
"{",
"return",
"new",
"NameMatcher",
"<>",
"(",
"compareTo",
",",
"StringOperatorName",
".",
"EQUALS",... | Create a NameMatcher that matches names equaling the given string. | [
"Create",
"a",
"NameMatcher",
"that",
"matches",
"names",
"equaling",
"the",
"given",
"string",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/matchers/NameMatcher.java#L40-L43 | train |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/impl/matchers/NameMatcher.java | NameMatcher.nameStartsWith | public static <U extends Key <U>> NameMatcher <U> nameStartsWith (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.STARTS_WITH);
} | java | public static <U extends Key <U>> NameMatcher <U> nameStartsWith (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.STARTS_WITH);
} | [
"public",
"static",
"<",
"U",
"extends",
"Key",
"<",
"U",
">",
">",
"NameMatcher",
"<",
"U",
">",
"nameStartsWith",
"(",
"final",
"String",
"compareTo",
")",
"{",
"return",
"new",
"NameMatcher",
"<>",
"(",
"compareTo",
",",
"StringOperatorName",
".",
"STAR... | Create a NameMatcher that matches names starting with the given string. | [
"Create",
"a",
"NameMatcher",
"that",
"matches",
"names",
"starting",
"with",
"the",
"given",
"string",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/matchers/NameMatcher.java#L64-L67 | train |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/impl/matchers/NameMatcher.java | NameMatcher.nameEndsWith | public static <U extends Key <U>> NameMatcher <U> nameEndsWith (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.ENDS_WITH);
} | java | public static <U extends Key <U>> NameMatcher <U> nameEndsWith (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.ENDS_WITH);
} | [
"public",
"static",
"<",
"U",
"extends",
"Key",
"<",
"U",
">",
">",
"NameMatcher",
"<",
"U",
">",
"nameEndsWith",
"(",
"final",
"String",
"compareTo",
")",
"{",
"return",
"new",
"NameMatcher",
"<>",
"(",
"compareTo",
",",
"StringOperatorName",
".",
"ENDS_W... | Create a NameMatcher that matches names ending with the given string. | [
"Create",
"a",
"NameMatcher",
"that",
"matches",
"names",
"ending",
"with",
"the",
"given",
"string",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/matchers/NameMatcher.java#L89-L92 | train |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/impl/matchers/NameMatcher.java | NameMatcher.nameContains | public static <U extends Key <U>> NameMatcher <U> nameContains (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.CONTAINS);
} | java | public static <U extends Key <U>> NameMatcher <U> nameContains (final String compareTo)
{
return new NameMatcher <> (compareTo, StringOperatorName.CONTAINS);
} | [
"public",
"static",
"<",
"U",
"extends",
"Key",
"<",
"U",
">",
">",
"NameMatcher",
"<",
"U",
">",
"nameContains",
"(",
"final",
"String",
"compareTo",
")",
"{",
"return",
"new",
"NameMatcher",
"<>",
"(",
"compareTo",
",",
"StringOperatorName",
".",
"CONTAI... | Create a NameMatcher that matches names containing the given string. | [
"Create",
"a",
"NameMatcher",
"that",
"matches",
"names",
"containing",
"the",
"given",
"string",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/matchers/NameMatcher.java#L114-L117 | train |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/TypeUtil.java | TypeUtil.getFirstTypeArgument | public static Class<?> getFirstTypeArgument(Type type) {
if (type instanceof ParameterizedType) {
ParameterizedType p = (ParameterizedType) type;
return getRawClass(p.getActualTypeArguments()[0]);
} else {
return null;
}
} | java | public static Class<?> getFirstTypeArgument(Type type) {
if (type instanceof ParameterizedType) {
ParameterizedType p = (ParameterizedType) type;
return getRawClass(p.getActualTypeArguments()[0]);
} else {
return null;
}
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getFirstTypeArgument",
"(",
"Type",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"ParameterizedType",
")",
"{",
"ParameterizedType",
"p",
"=",
"(",
"ParameterizedType",
")",
"type",
";",
"return",
"getRawClass... | Get declared type parameter of the type has one.
@param type type
@return declared parameter class | [
"Get",
"declared",
"type",
"parameter",
"of",
"the",
"type",
"has",
"one",
"."
] | eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8 | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/TypeUtil.java#L52-L59 | train |
codegist/crest | core/src/main/java/org/codegist/crest/param/ParamProcessors.java | ParamProcessors.newInstance | public static ParamProcessor newInstance(ParamType type, String listSeparator){
switch(type){
case COOKIE:
return listSeparator != null ? new CollectionMergingCookieParamProcessor(listSeparator) : DefaultCookieParamProcessor.INSTANCE;
default:
return listSeparator != null ? new CollectionMergingParamProcessor(listSeparator) : DefaultParamProcessor.INSTANCE;
}
} | java | public static ParamProcessor newInstance(ParamType type, String listSeparator){
switch(type){
case COOKIE:
return listSeparator != null ? new CollectionMergingCookieParamProcessor(listSeparator) : DefaultCookieParamProcessor.INSTANCE;
default:
return listSeparator != null ? new CollectionMergingParamProcessor(listSeparator) : DefaultParamProcessor.INSTANCE;
}
} | [
"public",
"static",
"ParamProcessor",
"newInstance",
"(",
"ParamType",
"type",
",",
"String",
"listSeparator",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"COOKIE",
":",
"return",
"listSeparator",
"!=",
"null",
"?",
"new",
"CollectionMergingCookieParamProce... | Returns an instance of a param processor.
@param type parameter type
@param listSeparator list separator if applicable, otherwise null
@return instance of param processor | [
"Returns",
"an",
"instance",
"of",
"a",
"param",
"processor",
"."
] | e99ba7728b27d2ddb2c247261350f1b6fa7a6698 | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/param/ParamProcessors.java#L48-L55 | train |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/TriggerBuilder.java | TriggerBuilder.forJob | @Nonnull
public TriggerBuilder <T> forJob (@Nonnull final IJobDetail jobDetail)
{
final JobKey k = jobDetail.getKey ();
if (k.getName () == null)
throw new IllegalArgumentException ("The given job has not yet had a name assigned to it.");
m_aJobKey = k;
return this;
} | java | @Nonnull
public TriggerBuilder <T> forJob (@Nonnull final IJobDetail jobDetail)
{
final JobKey k = jobDetail.getKey ();
if (k.getName () == null)
throw new IllegalArgumentException ("The given job has not yet had a name assigned to it.");
m_aJobKey = k;
return this;
} | [
"@",
"Nonnull",
"public",
"TriggerBuilder",
"<",
"T",
">",
"forJob",
"(",
"@",
"Nonnull",
"final",
"IJobDetail",
"jobDetail",
")",
"{",
"final",
"JobKey",
"k",
"=",
"jobDetail",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"k",
".",
"getName",
"(",
")",
... | Set the identity of the Job which should be fired by the produced Trigger,
by extracting the JobKey from the given job.
@param jobDetail
the Job to fire.
@return the updated TriggerBuilder
@see ITrigger#getJobKey() | [
"Set",
"the",
"identity",
"of",
"the",
"Job",
"which",
"should",
"be",
"fired",
"by",
"the",
"produced",
"Trigger",
"by",
"extracting",
"the",
"JobKey",
"from",
"the",
"given",
"job",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/TriggerBuilder.java#L363-L371 | train |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/TagsUtil.java | TagsUtil.add | public static String[] add(String[] base, String... extraTags) {
if (null == base || base.length == 0) {
return extraTags;
}
if (extraTags.length == 0) {
return base;
}
List<String> tags = new ArrayList<>(Arrays.asList(base));
tags.addAll(Arrays.asList(extraTags));
return tags.toArray(new String[tags.size()]);
} | java | public static String[] add(String[] base, String... extraTags) {
if (null == base || base.length == 0) {
return extraTags;
}
if (extraTags.length == 0) {
return base;
}
List<String> tags = new ArrayList<>(Arrays.asList(base));
tags.addAll(Arrays.asList(extraTags));
return tags.toArray(new String[tags.size()]);
} | [
"public",
"static",
"String",
"[",
"]",
"add",
"(",
"String",
"[",
"]",
"base",
",",
"String",
"...",
"extraTags",
")",
"{",
"if",
"(",
"null",
"==",
"base",
"||",
"base",
".",
"length",
"==",
"0",
")",
"{",
"return",
"extraTags",
";",
"}",
"if",
... | Add extra tags to the existing set.
@param base base set of tags
@param extraTags tags which need to be added
@return class | [
"Add",
"extra",
"tags",
"to",
"the",
"existing",
"set",
"."
] | eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8 | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/TagsUtil.java#L31-L41 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/datatype/xsd/DatatypeBase.java | DatatypeBase.allowsValue | boolean allowsValue(String str, ValidationContext vc) {
try {
getValue(str, vc);
return true;
}
catch (DatatypeException e) {
return false;
}
} | java | boolean allowsValue(String str, ValidationContext vc) {
try {
getValue(str, vc);
return true;
}
catch (DatatypeException e) {
return false;
}
} | [
"boolean",
"allowsValue",
"(",
"String",
"str",
",",
"ValidationContext",
"vc",
")",
"{",
"try",
"{",
"getValue",
"(",
"str",
",",
"vc",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"DatatypeException",
"e",
")",
"{",
"return",
"false",
";",
"}"... | Requires lexicallyAllows to be true | [
"Requires",
"lexicallyAllows",
"to",
"be",
"true"
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/datatype/xsd/DatatypeBase.java#L84-L92 | train |
julianghionoiu/tdl-client-java | src/main/java/tdl/client/runner/ChallengeSession.java | ChallengeSession.start | public void start() {
recordingSystem = new RecordingSystem(config.getRecordingSystemShouldBeOn());
AuditStream auditStream = config.getAuditStream();
if (!recordingSystem.isRecordingSystemOk()) {
auditStream.println("Please run `record_screen_and_upload` before continuing.");
return;
}
auditStream.println("Connecting to " + config.getHostname());
runApp();
} | java | public void start() {
recordingSystem = new RecordingSystem(config.getRecordingSystemShouldBeOn());
AuditStream auditStream = config.getAuditStream();
if (!recordingSystem.isRecordingSystemOk()) {
auditStream.println("Please run `record_screen_and_upload` before continuing.");
return;
}
auditStream.println("Connecting to " + config.getHostname());
runApp();
} | [
"public",
"void",
"start",
"(",
")",
"{",
"recordingSystem",
"=",
"new",
"RecordingSystem",
"(",
"config",
".",
"getRecordingSystemShouldBeOn",
"(",
")",
")",
";",
"AuditStream",
"auditStream",
"=",
"config",
".",
"getAuditStream",
"(",
")",
";",
"if",
"(",
... | ~~~~~~~~ The entry point ~~~~~~~~~ | [
"~~~~~~~~",
"The",
"entry",
"point",
"~~~~~~~~~"
] | b84bcf6fa4528b4097bd19e893ca95003a0dcff0 | https://github.com/julianghionoiu/tdl-client-java/blob/b84bcf6fa4528b4097bd19e893ca95003a0dcff0/src/main/java/tdl/client/runner/ChallengeSession.java#L36-L46 | train |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/internal/AccessorSyntheticField.java | AccessorSyntheticField.get | public Object get(Object object) throws IllegalAccessException, IllegalArgumentException {
if (null != getter) {
try {
return getter.invoke(object);
} catch (InvocationTargetException ite) {
if (ite.getCause() instanceof RuntimeException && !(ite.getCause() instanceof JTransfoException)) {
throw (RuntimeException) ite.getCause();
}
throw new JTransfoException(String.format(GET_SET_ITO, getter.getName(), object.getClass().getName(),
getter.getDeclaringClass().getName(), ite.getCause().getMessage()), ite.getCause());
}
} else {
if (!getUsingFieldLogged) {
log.warn("Cannot find getter (not public, wrong name or wrong type), "
+ "using field to access field {} of {}.", name, field.getType().getName());
getUsingFieldLogged = true;
}
return field.get(object);
}
} | java | public Object get(Object object) throws IllegalAccessException, IllegalArgumentException {
if (null != getter) {
try {
return getter.invoke(object);
} catch (InvocationTargetException ite) {
if (ite.getCause() instanceof RuntimeException && !(ite.getCause() instanceof JTransfoException)) {
throw (RuntimeException) ite.getCause();
}
throw new JTransfoException(String.format(GET_SET_ITO, getter.getName(), object.getClass().getName(),
getter.getDeclaringClass().getName(), ite.getCause().getMessage()), ite.getCause());
}
} else {
if (!getUsingFieldLogged) {
log.warn("Cannot find getter (not public, wrong name or wrong type), "
+ "using field to access field {} of {}.", name, field.getType().getName());
getUsingFieldLogged = true;
}
return field.get(object);
}
} | [
"public",
"Object",
"get",
"(",
"Object",
"object",
")",
"throws",
"IllegalAccessException",
",",
"IllegalArgumentException",
"{",
"if",
"(",
"null",
"!=",
"getter",
")",
"{",
"try",
"{",
"return",
"getter",
".",
"invoke",
"(",
"object",
")",
";",
"}",
"ca... | Get field value.
@param object object which contains the field.
@return field value
@throws IllegalAccessException illegal access
@throws IllegalArgumentException illegal argument | [
"Get",
"field",
"value",
"."
] | eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8 | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/internal/AccessorSyntheticField.java#L101-L120 | train |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/internal/AccessorSyntheticField.java | AccessorSyntheticField.set | public void set(Object object, Object value) throws IllegalAccessException, IllegalArgumentException {
if (null != setter) {
try {
setter.invoke(object, value);
} catch (InvocationTargetException ite) {
if (ite.getCause() instanceof RuntimeException && !(ite.getCause() instanceof JTransfoException)) {
throw (RuntimeException) ite.getCause();
}
throw new JTransfoException(String.format(GET_SET_ITO, setter.getName(), object.getClass().getName(),
setter.getDeclaringClass().getName(), ite.getCause().getMessage()), ite.getCause());
}
} else {
if (!setUsingFieldLogged) {
log.warn("Cannot find setter (not public, wrong name or wrong type), "
+ "using field to access field {} of {}.", name, field.getType().getName());
setUsingFieldLogged = true;
}
field.set(object, value);
}
} | java | public void set(Object object, Object value) throws IllegalAccessException, IllegalArgumentException {
if (null != setter) {
try {
setter.invoke(object, value);
} catch (InvocationTargetException ite) {
if (ite.getCause() instanceof RuntimeException && !(ite.getCause() instanceof JTransfoException)) {
throw (RuntimeException) ite.getCause();
}
throw new JTransfoException(String.format(GET_SET_ITO, setter.getName(), object.getClass().getName(),
setter.getDeclaringClass().getName(), ite.getCause().getMessage()), ite.getCause());
}
} else {
if (!setUsingFieldLogged) {
log.warn("Cannot find setter (not public, wrong name or wrong type), "
+ "using field to access field {} of {}.", name, field.getType().getName());
setUsingFieldLogged = true;
}
field.set(object, value);
}
} | [
"public",
"void",
"set",
"(",
"Object",
"object",
",",
"Object",
"value",
")",
"throws",
"IllegalAccessException",
",",
"IllegalArgumentException",
"{",
"if",
"(",
"null",
"!=",
"setter",
")",
"{",
"try",
"{",
"setter",
".",
"invoke",
"(",
"object",
",",
"... | Set field value.
@param object object which contains the field.
@param value field value
@throws IllegalAccessException illegal access
@throws IllegalArgumentException illegal argument | [
"Set",
"field",
"value",
"."
] | eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8 | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/internal/AccessorSyntheticField.java#L130-L149 | train |
codegist/crest | core/src/main/java/org/codegist/crest/util/MultiParts.java | MultiParts.hasMultiPart | public static boolean hasMultiPart(ParamConfig[] paramConfigs){
for(ParamConfig cfg : paramConfigs){
if(hasMultiPart(cfg.getMetaDatas())) {
return true;
}
}
return false;
} | java | public static boolean hasMultiPart(ParamConfig[] paramConfigs){
for(ParamConfig cfg : paramConfigs){
if(hasMultiPart(cfg.getMetaDatas())) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"hasMultiPart",
"(",
"ParamConfig",
"[",
"]",
"paramConfigs",
")",
"{",
"for",
"(",
"ParamConfig",
"cfg",
":",
"paramConfigs",
")",
"{",
"if",
"(",
"hasMultiPart",
"(",
"cfg",
".",
"getMetaDatas",
"(",
")",
")",
")",
"{",
"... | Checks if the given param config array contains a param with multipart meta datas.
@param paramConfigs param config array to look for multipart meta datas
@return true if multipart metadata found | [
"Checks",
"if",
"the",
"given",
"param",
"config",
"array",
"contains",
"a",
"param",
"with",
"multipart",
"meta",
"datas",
"."
] | e99ba7728b27d2ddb2c247261350f1b6fa7a6698 | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/util/MultiParts.java#L86-L93 | train |
codegist/crest | core/src/main/java/org/codegist/crest/util/MultiParts.java | MultiParts.putMetaDatas | public static void putMetaDatas(Map<String, Object> metadatas, String contentType, String fileName){
metadatas.put(MULTIPART_FLAG, true);
if(isNotBlank(contentType)) {
metadatas.put(CONTENT_TYPE, contentType);
}
if(isNotBlank(fileName)) {
metadatas.put(FILENAME, fileName);
}
} | java | public static void putMetaDatas(Map<String, Object> metadatas, String contentType, String fileName){
metadatas.put(MULTIPART_FLAG, true);
if(isNotBlank(contentType)) {
metadatas.put(CONTENT_TYPE, contentType);
}
if(isNotBlank(fileName)) {
metadatas.put(FILENAME, fileName);
}
} | [
"public",
"static",
"void",
"putMetaDatas",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"metadatas",
",",
"String",
"contentType",
",",
"String",
"fileName",
")",
"{",
"metadatas",
".",
"put",
"(",
"MULTIPART_FLAG",
",",
"true",
")",
";",
"if",
"(",
"... | Puts multipart metadata informations into the given metadata map
@param metadatas map to put the metadata into
@param contentType multipart content-type. can be null or empty
@param fileName multipart file name. can be null or empty | [
"Puts",
"multipart",
"metadata",
"informations",
"into",
"the",
"given",
"metadata",
"map"
] | e99ba7728b27d2ddb2c247261350f1b6fa7a6698 | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/util/MultiParts.java#L119-L127 | train |
codegist/crest | core/src/main/java/org/codegist/crest/util/MultiParts.java | MultiParts.toMetaDatas | public static Map<String,Object> toMetaDatas(String contentType, String fileName){
Map<String,Object> metadatas = new HashMap<String, Object>();
putMetaDatas(metadatas, contentType, fileName);
return metadatas;
} | java | public static Map<String,Object> toMetaDatas(String contentType, String fileName){
Map<String,Object> metadatas = new HashMap<String, Object>();
putMetaDatas(metadatas, contentType, fileName);
return metadatas;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"toMetaDatas",
"(",
"String",
"contentType",
",",
"String",
"fileName",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"metadatas",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">... | Returns a multipart metadata map
@param contentType multipart content-type. can be null or empty
@param fileName multipart file name. can be null or empty | [
"Returns",
"a",
"multipart",
"metadata",
"map"
] | e99ba7728b27d2ddb2c247261350f1b6fa7a6698 | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/util/MultiParts.java#L134-L138 | train |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/simpl/SystemPropertyInstanceIdGenerator.java | SystemPropertyInstanceIdGenerator.generateInstanceId | public String generateInstanceId () throws SchedulerException
{
String property = System.getProperty (getSystemPropertyName ());
if (property == null)
throw new SchedulerException ("No value for '" +
SYSTEM_PROPERTY +
"' system property found, please configure your environment accordingly!");
if (getPrepend () != null)
property = getPrepend () + property;
if (getPostpend () != null)
property = property + getPostpend ();
return property;
} | java | public String generateInstanceId () throws SchedulerException
{
String property = System.getProperty (getSystemPropertyName ());
if (property == null)
throw new SchedulerException ("No value for '" +
SYSTEM_PROPERTY +
"' system property found, please configure your environment accordingly!");
if (getPrepend () != null)
property = getPrepend () + property;
if (getPostpend () != null)
property = property + getPostpend ();
return property;
} | [
"public",
"String",
"generateInstanceId",
"(",
")",
"throws",
"SchedulerException",
"{",
"String",
"property",
"=",
"System",
".",
"getProperty",
"(",
"getSystemPropertyName",
"(",
")",
")",
";",
"if",
"(",
"property",
"==",
"null",
")",
"throw",
"new",
"Sched... | Returns the cluster wide value for this scheduler instance's id, based on a
system property
@return the value of the system property named by the value of
{@link #getSystemPropertyName()} - which defaults to
{@link #SYSTEM_PROPERTY}.
@throws SchedulerException
Shouldn't a value be found | [
"Returns",
"the",
"cluster",
"wide",
"value",
"for",
"this",
"scheduler",
"instance",
"s",
"id",
"based",
"on",
"a",
"system",
"property"
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/simpl/SystemPropertyInstanceIdGenerator.java#L61-L75 | train |
dashorst/wicket-stuff-markup-validator | whattf/src/main/resources/relaxng/datatype/java/src/org/whattf/datatype/IriRef.java | IriRef.underbarStringToSentence | protected static final String underbarStringToSentence(String str) {
if (str == null) {
return null;
}
char[] buf = new char[str.length()];
// preserve case of first character
buf[0] = str.charAt(0);
for (int i = 1; i < str.length(); i++) {
char c = str.charAt(i);
if (c >= 'A' && c <= 'Z') {
c += 0x20;
} else if (c == 0x5f) {
// convert underbar to space
c = 0x20;
}
buf[i] = c;
}
return new String(buf);
} | java | protected static final String underbarStringToSentence(String str) {
if (str == null) {
return null;
}
char[] buf = new char[str.length()];
// preserve case of first character
buf[0] = str.charAt(0);
for (int i = 1; i < str.length(); i++) {
char c = str.charAt(i);
if (c >= 'A' && c <= 'Z') {
c += 0x20;
} else if (c == 0x5f) {
// convert underbar to space
c = 0x20;
}
buf[i] = c;
}
return new String(buf);
} | [
"protected",
"static",
"final",
"String",
"underbarStringToSentence",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"char",
"[",
"]",
"buf",
"=",
"new",
"char",
"[",
"str",
".",
"length",
"(",
"... | Turn "FOO_BAR_BAZ" into "Foo bar baz". | [
"Turn",
"FOO_BAR_BAZ",
"into",
"Foo",
"bar",
"baz",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/whattf/src/main/resources/relaxng/datatype/java/src/org/whattf/datatype/IriRef.java#L306-L324 | train |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java | JCusolverDn.cusolverDnSpotrf_bufferSize | public static int cusolverDnSpotrf_bufferSize(
cusolverDnHandle handle,
int uplo,
int n,
Pointer A,
int lda,
int[] Lwork)
{
return checkResult(cusolverDnSpotrf_bufferSizeNative(handle, uplo, n, A, lda, Lwork));
} | java | public static int cusolverDnSpotrf_bufferSize(
cusolverDnHandle handle,
int uplo,
int n,
Pointer A,
int lda,
int[] Lwork)
{
return checkResult(cusolverDnSpotrf_bufferSizeNative(handle, uplo, n, A, lda, Lwork));
} | [
"public",
"static",
"int",
"cusolverDnSpotrf_bufferSize",
"(",
"cusolverDnHandle",
"handle",
",",
"int",
"uplo",
",",
"int",
"n",
",",
"Pointer",
"A",
",",
"int",
"lda",
",",
"int",
"[",
"]",
"Lwork",
")",
"{",
"return",
"checkResult",
"(",
"cusolverDnSpotrf... | Cholesky factorization and its solver | [
"Cholesky",
"factorization",
"and",
"its",
"solver"
] | 2600c7eca36a92a60ebcc78cae6e028e0c1d00b9 | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java#L105-L114 | train |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java | JCusolverDn.cusolverDnSpotrfBatched | public static int cusolverDnSpotrfBatched(
cusolverDnHandle handle,
int uplo,
int n,
Pointer Aarray,
int lda,
Pointer infoArray,
int batchSize)
{
return checkResult(cusolverDnSpotrfBatchedNative(handle, uplo, n, Aarray, lda, infoArray, batchSize));
} | java | public static int cusolverDnSpotrfBatched(
cusolverDnHandle handle,
int uplo,
int n,
Pointer Aarray,
int lda,
Pointer infoArray,
int batchSize)
{
return checkResult(cusolverDnSpotrfBatchedNative(handle, uplo, n, Aarray, lda, infoArray, batchSize));
} | [
"public",
"static",
"int",
"cusolverDnSpotrfBatched",
"(",
"cusolverDnHandle",
"handle",
",",
"int",
"uplo",
",",
"int",
"n",
",",
"Pointer",
"Aarray",
",",
"int",
"lda",
",",
"Pointer",
"infoArray",
",",
"int",
"batchSize",
")",
"{",
"return",
"checkResult",
... | batched Cholesky factorization and its solver | [
"batched",
"Cholesky",
"factorization",
"and",
"its",
"solver"
] | 2600c7eca36a92a60ebcc78cae6e028e0c1d00b9 | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java#L374-L384 | train |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java | JCusolverDn.cusolverDnSorgqr_bufferSize | public static int cusolverDnSorgqr_bufferSize(
cusolverDnHandle handle,
int m,
int n,
int k,
Pointer A,
int lda,
Pointer tau,
int[] lwork)
{
return checkResult(cusolverDnSorgqr_bufferSizeNative(handle, m, n, k, A, lda, tau, lwork));
} | java | public static int cusolverDnSorgqr_bufferSize(
cusolverDnHandle handle,
int m,
int n,
int k,
Pointer A,
int lda,
Pointer tau,
int[] lwork)
{
return checkResult(cusolverDnSorgqr_bufferSizeNative(handle, m, n, k, A, lda, tau, lwork));
} | [
"public",
"static",
"int",
"cusolverDnSorgqr_bufferSize",
"(",
"cusolverDnHandle",
"handle",
",",
"int",
"m",
",",
"int",
"n",
",",
"int",
"k",
",",
"Pointer",
"A",
",",
"int",
"lda",
",",
"Pointer",
"tau",
",",
"int",
"[",
"]",
"lwork",
")",
"{",
"ret... | generate unitary matrix Q from QR factorization | [
"generate",
"unitary",
"matrix",
"Q",
"from",
"QR",
"factorization"
] | 2600c7eca36a92a60ebcc78cae6e028e0c1d00b9 | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java#L1115-L1126 | train |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java | JCusolverDn.cusolverDnSorgtr_bufferSize | public static int cusolverDnSorgtr_bufferSize(
cusolverDnHandle handle,
int uplo,
int n,
Pointer A,
int lda,
Pointer tau,
int[] lwork)
{
return checkResult(cusolverDnSorgtr_bufferSizeNative(handle, uplo, n, A, lda, tau, lwork));
} | java | public static int cusolverDnSorgtr_bufferSize(
cusolverDnHandle handle,
int uplo,
int n,
Pointer A,
int lda,
Pointer tau,
int[] lwork)
{
return checkResult(cusolverDnSorgtr_bufferSizeNative(handle, uplo, n, A, lda, tau, lwork));
} | [
"public",
"static",
"int",
"cusolverDnSorgtr_bufferSize",
"(",
"cusolverDnHandle",
"handle",
",",
"int",
"uplo",
",",
"int",
"n",
",",
"Pointer",
"A",
",",
"int",
"lda",
",",
"Pointer",
"tau",
",",
"int",
"[",
"]",
"lwork",
")",
"{",
"return",
"checkResult... | generate unitary Q comes from sytrd | [
"generate",
"unitary",
"Q",
"comes",
"from",
"sytrd"
] | 2600c7eca36a92a60ebcc78cae6e028e0c1d00b9 | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java#L2369-L2379 | train |
brutusin/commons | src/main/java/org/brutusin/commons/utils/CryptoUtils.java | CryptoUtils.getHash | private static String getHash(String str, String algorithm) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(str.getBytes());
byte byteData[] = md.digest();
StringBuilder hexString = new StringBuilder();
for (int i = 0; i < byteData.length; i++) {
String hex = Integer.toHexString(0xff & byteData[i]);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}
return hexString.toString();
} | java | private static String getHash(String str, String algorithm) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(str.getBytes());
byte byteData[] = md.digest();
StringBuilder hexString = new StringBuilder();
for (int i = 0; i < byteData.length; i++) {
String hex = Integer.toHexString(0xff & byteData[i]);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}
return hexString.toString();
} | [
"private",
"static",
"String",
"getHash",
"(",
"String",
"str",
",",
"String",
"algorithm",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"MessageDigest",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"algorithm",
")",
";",
"md",
".",
"update",
"(",
"... | Return the hezadecimal representation of the string digest given the
specified algorithm.
@param str
@param algorithm
@return
@throws NoSuchAlgorithmException | [
"Return",
"the",
"hezadecimal",
"representation",
"of",
"the",
"string",
"digest",
"given",
"the",
"specified",
"algorithm",
"."
] | 70685df2b2456d0bf1e6a4754d72c87bba4949df | https://github.com/brutusin/commons/blob/70685df2b2456d0bf1e6a4754d72c87bba4949df/src/main/java/org/brutusin/commons/utils/CryptoUtils.java#L67-L84 | train |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/DailyCalendar.java | DailyCalendar.split | private String [] split (final String string, final String delim)
{
final List <String> result = new ArrayList <> ();
final StringTokenizer stringTokenizer = new StringTokenizer (string, delim);
while (stringTokenizer.hasMoreTokens ())
{
result.add (stringTokenizer.nextToken ());
}
return result.toArray (new String [result.size ()]);
} | java | private String [] split (final String string, final String delim)
{
final List <String> result = new ArrayList <> ();
final StringTokenizer stringTokenizer = new StringTokenizer (string, delim);
while (stringTokenizer.hasMoreTokens ())
{
result.add (stringTokenizer.nextToken ());
}
return result.toArray (new String [result.size ()]);
} | [
"private",
"String",
"[",
"]",
"split",
"(",
"final",
"String",
"string",
",",
"final",
"String",
"delim",
")",
"{",
"final",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"StringTokenizer",
"stringTokenizer",... | Helper method to split the given string by the given delimiter. | [
"Helper",
"method",
"to",
"split",
"the",
"given",
"string",
"by",
"the",
"given",
"delimiter",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/DailyCalendar.java#L702-L713 | train |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/DailyCalendar.java | DailyCalendar._validate | private void _validate (final int hourOfDay, final int minute, final int second, final int millis)
{
if (hourOfDay < 0 || hourOfDay > 23)
{
throw new IllegalArgumentException (invalidHourOfDay + hourOfDay);
}
if (minute < 0 || minute > 59)
{
throw new IllegalArgumentException (invalidMinute + minute);
}
if (second < 0 || second > 59)
{
throw new IllegalArgumentException (invalidSecond + second);
}
if (millis < 0 || millis > 999)
{
throw new IllegalArgumentException (invalidMillis + millis);
}
} | java | private void _validate (final int hourOfDay, final int minute, final int second, final int millis)
{
if (hourOfDay < 0 || hourOfDay > 23)
{
throw new IllegalArgumentException (invalidHourOfDay + hourOfDay);
}
if (minute < 0 || minute > 59)
{
throw new IllegalArgumentException (invalidMinute + minute);
}
if (second < 0 || second > 59)
{
throw new IllegalArgumentException (invalidSecond + second);
}
if (millis < 0 || millis > 999)
{
throw new IllegalArgumentException (invalidMillis + millis);
}
} | [
"private",
"void",
"_validate",
"(",
"final",
"int",
"hourOfDay",
",",
"final",
"int",
"minute",
",",
"final",
"int",
"second",
",",
"final",
"int",
"millis",
")",
"{",
"if",
"(",
"hourOfDay",
"<",
"0",
"||",
"hourOfDay",
">",
"23",
")",
"{",
"throw",
... | Checks the specified values for validity as a set of time values.
@param hourOfDay
the hour of the time to check (in military (24-hour) time)
@param minute
the minute of the time to check
@param second
the second of the time to check
@param millis
the millisecond of the time to check | [
"Checks",
"the",
"specified",
"values",
"for",
"validity",
"as",
"a",
"set",
"of",
"time",
"values",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/DailyCalendar.java#L925-L943 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/nvdl/NvdlSchemaReceiverFactory.java | NvdlSchemaReceiverFactory.createSchemaReceiver | public SchemaReceiver createSchemaReceiver(String namespaceUri, PropertyMap properties) {
if (!SchemaImpl.NVDL_URI.equals(namespaceUri))
return null;
return new SchemaReceiverImpl(properties);
} | java | public SchemaReceiver createSchemaReceiver(String namespaceUri, PropertyMap properties) {
if (!SchemaImpl.NVDL_URI.equals(namespaceUri))
return null;
return new SchemaReceiverImpl(properties);
} | [
"public",
"SchemaReceiver",
"createSchemaReceiver",
"(",
"String",
"namespaceUri",
",",
"PropertyMap",
"properties",
")",
"{",
"if",
"(",
"!",
"SchemaImpl",
".",
"NVDL_URI",
".",
"equals",
"(",
"namespaceUri",
")",
")",
"return",
"null",
";",
"return",
"new",
... | Checks if the namespace is the NVDL namespace and if yes then it creates
a schema receiver, otherwise returns null. | [
"Checks",
"if",
"the",
"namespace",
"is",
"the",
"NVDL",
"namespace",
"and",
"if",
"yes",
"then",
"it",
"creates",
"a",
"schema",
"receiver",
"otherwise",
"returns",
"null",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/NvdlSchemaReceiverFactory.java#L16-L20 | train |
BreizhBeans/ThriftMongoBridge | src/main/java/org/breizhbeans/thrift/tools/thriftmongobridge/protocol/TBSONProtocol.java | TBSONProtocol.pushContext | protected void pushContext(Context c) {
Stack<Context> stack = threadSafeContextStack.get();
if (stack == null) {
stack = new Stack<Context>();
stack.push(c);
threadSafeContextStack.set(stack);
} else {
threadSafeContextStack.get().push(c);
}
} | java | protected void pushContext(Context c) {
Stack<Context> stack = threadSafeContextStack.get();
if (stack == null) {
stack = new Stack<Context>();
stack.push(c);
threadSafeContextStack.set(stack);
} else {
threadSafeContextStack.get().push(c);
}
} | [
"protected",
"void",
"pushContext",
"(",
"Context",
"c",
")",
"{",
"Stack",
"<",
"Context",
">",
"stack",
"=",
"threadSafeContextStack",
".",
"get",
"(",
")",
";",
"if",
"(",
"stack",
"==",
"null",
")",
"{",
"stack",
"=",
"new",
"Stack",
"<",
"Context"... | Push a new write context onto the stack. | [
"Push",
"a",
"new",
"write",
"context",
"onto",
"the",
"stack",
"."
] | 0b86606601a818b6c2489f6920c3780beda3e8c8 | https://github.com/BreizhBeans/ThriftMongoBridge/blob/0b86606601a818b6c2489f6920c3780beda3e8c8/src/main/java/org/breizhbeans/thrift/tools/thriftmongobridge/protocol/TBSONProtocol.java#L401-L410 | train |
brutusin/commons | src/main/java/org/brutusin/commons/io/LineReader.java | LineReader.run | public final void run() throws IOException, InterruptedException {
InputStreamReader isr = new InputStreamReader(this.is, this.charset);
BufferedReader br = new BufferedReader(isr);
this.line = null;
this.lineNumber = 0;
try {
do {
if (this.exit) {
return;
}
if(Thread.currentThread().isInterrupted()){
throw new InterruptedException();
}
this.nextLine = br.readLine();
try {
if (this.line != null) {
processLine(this.line);
if (this.exit) {
return;
}
}
} catch (Exception e) {
onExceptionFound(e);
} finally {
this.lineNumber++;
this.line = this.nextLine;
}
} while (this.line != null);
} finally {
onFinish();
}
} | java | public final void run() throws IOException, InterruptedException {
InputStreamReader isr = new InputStreamReader(this.is, this.charset);
BufferedReader br = new BufferedReader(isr);
this.line = null;
this.lineNumber = 0;
try {
do {
if (this.exit) {
return;
}
if(Thread.currentThread().isInterrupted()){
throw new InterruptedException();
}
this.nextLine = br.readLine();
try {
if (this.line != null) {
processLine(this.line);
if (this.exit) {
return;
}
}
} catch (Exception e) {
onExceptionFound(e);
} finally {
this.lineNumber++;
this.line = this.nextLine;
}
} while (this.line != null);
} finally {
onFinish();
}
} | [
"public",
"final",
"void",
"run",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"InputStreamReader",
"isr",
"=",
"new",
"InputStreamReader",
"(",
"this",
".",
"is",
",",
"this",
".",
"charset",
")",
";",
"BufferedReader",
"br",
"=",
"n... | Synchronously processes the input stream
@throws IOException
@throws InterruptedException | [
"Synchronously",
"processes",
"the",
"input",
"stream"
] | 70685df2b2456d0bf1e6a4754d72c87bba4949df | https://github.com/brutusin/commons/blob/70685df2b2456d0bf1e6a4754d72c87bba4949df/src/main/java/org/brutusin/commons/io/LineReader.java#L68-L99 | train |
darcy-framework/darcy-web | src/main/java/com/redhat/darcy/web/HtmlTable.java | HtmlTable.byHeader | protected Locator byHeader(int colIndex) {
if (colIndex < 1) {
throw new IllegalArgumentException("Column index must be greater than 0.");
}
String xpath = headerTag.isPresent()
? "./thead/tr[1]/th[" + colIndex + "]"
: "./tr[1]/th[" + colIndex + "]";
return byInner(By.xpath(xpath));
} | java | protected Locator byHeader(int colIndex) {
if (colIndex < 1) {
throw new IllegalArgumentException("Column index must be greater than 0.");
}
String xpath = headerTag.isPresent()
? "./thead/tr[1]/th[" + colIndex + "]"
: "./tr[1]/th[" + colIndex + "]";
return byInner(By.xpath(xpath));
} | [
"protected",
"Locator",
"byHeader",
"(",
"int",
"colIndex",
")",
"{",
"if",
"(",
"colIndex",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Column index must be greater than 0.\"",
")",
";",
"}",
"String",
"xpath",
"=",
"headerTag",
".",... | Conveniently allows column implementations to lookup headers without duplicating the effort
to come up with xpath for each column's header. Simply use this method with that column's
index.
@return A locator that finds a header cell based on a column index. It does this by
constructing an xpath. If a {@code<thead>} tag is present, this will use,
"./thead/tr[1]/th[colIndex]". If no {@code<thead>} tag is present, "./tr[1]/th[colIndex]"
will be used.
<p>If your modelling an unconventionally structured html table, you're encouraged to override
this method.
@param colIndex index of the column to find a header cell, starting from the left at 1. | [
"Conveniently",
"allows",
"column",
"implementations",
"to",
"lookup",
"headers",
"without",
"duplicating",
"the",
"effort",
"to",
"come",
"up",
"with",
"xpath",
"for",
"each",
"column",
"s",
"header",
".",
"Simply",
"use",
"this",
"method",
"with",
"that",
"c... | 4e9b67c9f39d53fec5bf5ad40ddfdc828d9df472 | https://github.com/darcy-framework/darcy-web/blob/4e9b67c9f39d53fec5bf5ad40ddfdc828d9df472/src/main/java/com/redhat/darcy/web/HtmlTable.java#L165-L175 | train |
darcy-framework/darcy-web | src/main/java/com/redhat/darcy/web/HtmlTable.java | HtmlTable.byRowColumn | protected Locator byRowColumn(int rowIndex, int colIndex) {
if (rowIndex < 1) {
throw new IllegalArgumentException("Row index must be greater than 0.");
}
if (colIndex < 1) {
throw new IllegalArgumentException("Column index must be greater than 0.");
}
String xpath = bodyTag.isPresent()
? "./tbody/tr[" + rowIndex + "]/td[" + colIndex + "]"
: "./tr[" + rowIndex + "]/td[" + colIndex + "]";
return byInner(By.xpath(xpath));
} | java | protected Locator byRowColumn(int rowIndex, int colIndex) {
if (rowIndex < 1) {
throw new IllegalArgumentException("Row index must be greater than 0.");
}
if (colIndex < 1) {
throw new IllegalArgumentException("Column index must be greater than 0.");
}
String xpath = bodyTag.isPresent()
? "./tbody/tr[" + rowIndex + "]/td[" + colIndex + "]"
: "./tr[" + rowIndex + "]/td[" + colIndex + "]";
return byInner(By.xpath(xpath));
} | [
"protected",
"Locator",
"byRowColumn",
"(",
"int",
"rowIndex",
",",
"int",
"colIndex",
")",
"{",
"if",
"(",
"rowIndex",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Row index must be greater than 0.\"",
")",
";",
"}",
"if",
"(",
"col... | Conveniently allows column implementations to lookup cells inside a column without
duplicating the effort to come up with xpath for each column's cells. Simply use this method
with that column's index.
@return A locator that finds a cell based on a row and column index. It does this by
constructing an xpath. If a {@code<tbody>} tag is present, this will use,
"./tbody/tr[rowIndex]/td[colIndex]". If no {@code<tbody>} tag is present,
"./tr[rowIndex]/td[colIndex]" will be used.
<p>If your modelling an unconventionally structured html table, you're encouraged to override
this method.
@param rowIndex Starting from the top, at 1.
@param colIndex Starting from the left, at 1. | [
"Conveniently",
"allows",
"column",
"implementations",
"to",
"lookup",
"cells",
"inside",
"a",
"column",
"without",
"duplicating",
"the",
"effort",
"to",
"come",
"up",
"with",
"xpath",
"for",
"each",
"column",
"s",
"cells",
".",
"Simply",
"use",
"this",
"metho... | 4e9b67c9f39d53fec5bf5ad40ddfdc828d9df472 | https://github.com/darcy-framework/darcy-web/blob/4e9b67c9f39d53fec5bf5ad40ddfdc828d9df472/src/main/java/com/redhat/darcy/web/HtmlTable.java#L193-L207 | train |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/utils/CircularLossyQueue.java | CircularLossyQueue.push | public void push (final T newVal)
{
final int index = (int) (m_aCurrentIndex.incrementAndGet () % m_nMaxSize);
m_aCircularArray[index].set (newVal);
} | java | public void push (final T newVal)
{
final int index = (int) (m_aCurrentIndex.incrementAndGet () % m_nMaxSize);
m_aCircularArray[index].set (newVal);
} | [
"public",
"void",
"push",
"(",
"final",
"T",
"newVal",
")",
"{",
"final",
"int",
"index",
"=",
"(",
"int",
")",
"(",
"m_aCurrentIndex",
".",
"incrementAndGet",
"(",
")",
"%",
"m_nMaxSize",
")",
";",
"m_aCircularArray",
"[",
"index",
"]",
".",
"set",
"(... | Adds a new item
@param newVal
value to push | [
"Adds",
"a",
"new",
"item"
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/utils/CircularLossyQueue.java#L62-L66 | train |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/utils/CircularLossyQueue.java | CircularLossyQueue.toArray | public T [] toArray (@Nonnull final T [] type)
{
if (type.length > m_nMaxSize)
throw new IllegalArgumentException ("Size of array passed in cannot be greater than " + m_nMaxSize);
final int curIndex = _getCurrentIndex ();
for (int k = 0; k < type.length; k++)
{
final int index = _getIndex (curIndex - k);
type[k] = m_aCircularArray[index].get ();
}
return type;
} | java | public T [] toArray (@Nonnull final T [] type)
{
if (type.length > m_nMaxSize)
throw new IllegalArgumentException ("Size of array passed in cannot be greater than " + m_nMaxSize);
final int curIndex = _getCurrentIndex ();
for (int k = 0; k < type.length; k++)
{
final int index = _getIndex (curIndex - k);
type[k] = m_aCircularArray[index].get ();
}
return type;
} | [
"public",
"T",
"[",
"]",
"toArray",
"(",
"@",
"Nonnull",
"final",
"T",
"[",
"]",
"type",
")",
"{",
"if",
"(",
"type",
".",
"length",
">",
"m_nMaxSize",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Size of array passed in cannot be greater than \"",
... | Returns an array of the current elements in the queue. The order of elements
is in reverse order of the order items were added.
@param type
destination
@return An array containing the current elements in the queue. The first
element of the array is the tail of the queue and the last element is
the head of the queue | [
"Returns",
"an",
"array",
"of",
"the",
"current",
"elements",
"in",
"the",
"queue",
".",
"The",
"order",
"of",
"elements",
"is",
"in",
"reverse",
"order",
"of",
"the",
"order",
"items",
"were",
"added",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/utils/CircularLossyQueue.java#L78-L90 | train |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/internal/ConverterHelper.java | ConverterHelper.getToConverter | public ToConverter getToConverter(Class toClass, Class domainClass) throws JTransfoException {
ToConverter converter = withPreConverter(toClass);
List<SyntheticField> domainFields = reflectionHelper.getSyntheticFields(domainClass);
for (Field field : reflectionHelper.getFields(toClass)) {
boolean isTransient = Modifier.isTransient(field.getModifiers());
List<NotMapped> notMapped = reflectionHelper.getAnnotationWithMeta(field, NotMapped.class);
if (!isTransient && (0 == notMapped.size())) {
List<MappedBy> mappedBies = reflectionHelper.getAnnotationWithMeta(field, MappedBy.class);
if (mappedBies.size() > 1) {
throw new JTransfoException("Field " + field.getName() + " on type " +
field.getDeclaringClass().getName() +
" MappedBy is ambiguous, check your meta-annotations.");
}
MappedBy mappedBy = null;
if (1 == mappedBies.size()) {
mappedBy = mappedBies.get(0);
}
boolean isStatic = (0 != (field.getModifiers() & Modifier.STATIC));
if (0 != mappedBies.size() || !isStatic) {
buildConverters(field, domainFields, domainClass, converter, mappedBy);
}
}
}
addPostConverter(converter, toClass);
return converter;
} | java | public ToConverter getToConverter(Class toClass, Class domainClass) throws JTransfoException {
ToConverter converter = withPreConverter(toClass);
List<SyntheticField> domainFields = reflectionHelper.getSyntheticFields(domainClass);
for (Field field : reflectionHelper.getFields(toClass)) {
boolean isTransient = Modifier.isTransient(field.getModifiers());
List<NotMapped> notMapped = reflectionHelper.getAnnotationWithMeta(field, NotMapped.class);
if (!isTransient && (0 == notMapped.size())) {
List<MappedBy> mappedBies = reflectionHelper.getAnnotationWithMeta(field, MappedBy.class);
if (mappedBies.size() > 1) {
throw new JTransfoException("Field " + field.getName() + " on type " +
field.getDeclaringClass().getName() +
" MappedBy is ambiguous, check your meta-annotations.");
}
MappedBy mappedBy = null;
if (1 == mappedBies.size()) {
mappedBy = mappedBies.get(0);
}
boolean isStatic = (0 != (field.getModifiers() & Modifier.STATIC));
if (0 != mappedBies.size() || !isStatic) {
buildConverters(field, domainFields, domainClass, converter, mappedBy);
}
}
}
addPostConverter(converter, toClass);
return converter;
} | [
"public",
"ToConverter",
"getToConverter",
"(",
"Class",
"toClass",
",",
"Class",
"domainClass",
")",
"throws",
"JTransfoException",
"{",
"ToConverter",
"converter",
"=",
"withPreConverter",
"(",
"toClass",
")",
";",
"List",
"<",
"SyntheticField",
">",
"domainFields... | Build the descriptor for conversion between given object types.
@param toClass transfer object class, contains the annotations for the conversion
@param domainClass domain class as other side of conversion
@return conversion descriptor
@throws JTransfoException cannot build converter | [
"Build",
"the",
"descriptor",
"for",
"conversion",
"between",
"given",
"object",
"types",
"."
] | eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8 | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/internal/ConverterHelper.java#L57-L85 | train |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/internal/ConverterHelper.java | ConverterHelper.withPath | String withPath(String[] path) {
StringBuilder sb = new StringBuilder();
if (path.length > 0) {
sb.append(" (with path ");
for (int i = 0; i < path.length - 1; i++) {
sb.append(path[i]);
sb.append(".");
}
sb.append(path[path.length - 1]);
sb.append(") ");
}
return sb.toString();
} | java | String withPath(String[] path) {
StringBuilder sb = new StringBuilder();
if (path.length > 0) {
sb.append(" (with path ");
for (int i = 0; i < path.length - 1; i++) {
sb.append(path[i]);
sb.append(".");
}
sb.append(path[path.length - 1]);
sb.append(") ");
}
return sb.toString();
} | [
"String",
"withPath",
"(",
"String",
"[",
"]",
"path",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"path",
".",
"length",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"\" (with path \"",
")",
";",
"for",
... | Convert path array to a readable representation.
@param path array of path elements
@return original path string | [
"Convert",
"path",
"array",
"to",
"a",
"readable",
"representation",
"."
] | eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8 | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/internal/ConverterHelper.java#L243-L256 | train |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/internal/ConverterHelper.java | ConverterHelper.findField | SyntheticField[] findField(List<SyntheticField> domainFields, String fieldName, String[] path,
Class<?> type, boolean readOnlyField) throws JTransfoException {
List<SyntheticField> fields = domainFields;
SyntheticField[] result = new SyntheticField[path.length + 1];
int index = 0;
Class<?> currentType = type;
for (; index < path.length; index++) {
boolean found = false;
for (SyntheticField field : fields) {
if (field.getName().equals(path[index])) {
found = true;
result[index] = field;
break;
}
}
if (!found) {
result[index] = new AccessorSyntheticField(reflectionHelper, currentType, path[index], readOnlyField);
}
currentType = result[index].getType();
fields = reflectionHelper.getSyntheticFields(currentType);
}
for (SyntheticField field : fields) {
if (field.getName().equals(fieldName)) {
result[index] = field;
return result;
}
}
result[index] = new AccessorSyntheticField(reflectionHelper, currentType, fieldName, readOnlyField);
return result;
} | java | SyntheticField[] findField(List<SyntheticField> domainFields, String fieldName, String[] path,
Class<?> type, boolean readOnlyField) throws JTransfoException {
List<SyntheticField> fields = domainFields;
SyntheticField[] result = new SyntheticField[path.length + 1];
int index = 0;
Class<?> currentType = type;
for (; index < path.length; index++) {
boolean found = false;
for (SyntheticField field : fields) {
if (field.getName().equals(path[index])) {
found = true;
result[index] = field;
break;
}
}
if (!found) {
result[index] = new AccessorSyntheticField(reflectionHelper, currentType, path[index], readOnlyField);
}
currentType = result[index].getType();
fields = reflectionHelper.getSyntheticFields(currentType);
}
for (SyntheticField field : fields) {
if (field.getName().equals(fieldName)) {
result[index] = field;
return result;
}
}
result[index] = new AccessorSyntheticField(reflectionHelper, currentType, fieldName, readOnlyField);
return result;
} | [
"SyntheticField",
"[",
"]",
"findField",
"(",
"List",
"<",
"SyntheticField",
">",
"domainFields",
",",
"String",
"fieldName",
",",
"String",
"[",
"]",
"path",
",",
"Class",
"<",
"?",
">",
"type",
",",
"boolean",
"readOnlyField",
")",
"throws",
"JTransfoExcep... | Find one field in a list of fields.
@param domainFields list of fields in domain object
@param fieldName field to search
@param path list of intermediate fields for transitive fields
@param type type of object to find fields in
@param readOnlyField is the requested field read only
@return field with requested name or null when not found
@throws JTransfoException cannot find fields | [
"Find",
"one",
"field",
"in",
"a",
"list",
"of",
"fields",
"."
] | eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8 | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/internal/ConverterHelper.java#L269-L298 | train |
joachimvda/jtransfo | core/src/main/java/org/jtransfo/internal/ConverterHelper.java | ConverterHelper.getDefaultTypeConverter | TypeConverter getDefaultTypeConverter(Type toField, Type domainField) {
for (TypeConverter typeConverter : typeConvertersInOrder) {
if (typeConverter.canConvert(toField, domainField)) {
return typeConverter;
}
}
return new NoConversionTypeConverter(); // default to no type conversion
} | java | TypeConverter getDefaultTypeConverter(Type toField, Type domainField) {
for (TypeConverter typeConverter : typeConvertersInOrder) {
if (typeConverter.canConvert(toField, domainField)) {
return typeConverter;
}
}
return new NoConversionTypeConverter(); // default to no type conversion
} | [
"TypeConverter",
"getDefaultTypeConverter",
"(",
"Type",
"toField",
",",
"Type",
"domainField",
")",
"{",
"for",
"(",
"TypeConverter",
"typeConverter",
":",
"typeConvertersInOrder",
")",
"{",
"if",
"(",
"typeConverter",
".",
"canConvert",
"(",
"toField",
",",
"dom... | Get the default type converter given the field types to convert between.
@param toField transfer object field class
@param domainField domain object field class
@return type converter | [
"Get",
"the",
"default",
"type",
"converter",
"given",
"the",
"field",
"types",
"to",
"convert",
"between",
"."
] | eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8 | https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/internal/ConverterHelper.java#L400-L407 | train |
julianghionoiu/tdl-client-java | src/main/java/tdl/client/runner/ChallengeServerClient.java | ChallengeServerClient.sendAction | String sendAction(String action) throws
ClientErrorException, ServerErrorException, OtherCommunicationException {
try {
String encodedPath = URLEncoder.encode(this.journeyId, "UTF-8");
String url = String.format("http://%s:%d/action/%s/%s", this.hostname, port, action, encodedPath);
HttpResponse<String> response = Unirest.post(url)
.header("Accept", this.acceptHeader)
.header("Accept-Charset", "UTF-8")
.asString();
ensureStatusOk(response);
return response.getBody();
} catch (UnirestException | UnsupportedEncodingException e ) {
throw new OtherCommunicationException("Could not perform POST request",e);
}
} | java | String sendAction(String action) throws
ClientErrorException, ServerErrorException, OtherCommunicationException {
try {
String encodedPath = URLEncoder.encode(this.journeyId, "UTF-8");
String url = String.format("http://%s:%d/action/%s/%s", this.hostname, port, action, encodedPath);
HttpResponse<String> response = Unirest.post(url)
.header("Accept", this.acceptHeader)
.header("Accept-Charset", "UTF-8")
.asString();
ensureStatusOk(response);
return response.getBody();
} catch (UnirestException | UnsupportedEncodingException e ) {
throw new OtherCommunicationException("Could not perform POST request",e);
}
} | [
"String",
"sendAction",
"(",
"String",
"action",
")",
"throws",
"ClientErrorException",
",",
"ServerErrorException",
",",
"OtherCommunicationException",
"{",
"try",
"{",
"String",
"encodedPath",
"=",
"URLEncoder",
".",
"encode",
"(",
"this",
".",
"journeyId",
",",
... | ~~~~~~~ POST ~~~~~~~~ | [
"~~~~~~~",
"POST",
"~~~~~~~~"
] | b84bcf6fa4528b4097bd19e893ca95003a0dcff0 | https://github.com/julianghionoiu/tdl-client-java/blob/b84bcf6fa4528b4097bd19e893ca95003a0dcff0/src/main/java/tdl/client/runner/ChallengeServerClient.java#L55-L69 | train |
julianghionoiu/tdl-client-java | src/main/java/tdl/client/runner/ChallengeServerClient.java | ChallengeServerClient.ensureStatusOk | private static void ensureStatusOk(HttpResponse<String> response) throws ClientErrorException,
ServerErrorException, OtherCommunicationException {
int responseStatus = response.getStatus();
if (isClientError(responseStatus)) {
throw new ClientErrorException(response.getBody());
} else if (isServerError(responseStatus)) {
throw new ServerErrorException();
} else if (isOtherErrorResponse(responseStatus)) {
throw new OtherCommunicationException();
}
} | java | private static void ensureStatusOk(HttpResponse<String> response) throws ClientErrorException,
ServerErrorException, OtherCommunicationException {
int responseStatus = response.getStatus();
if (isClientError(responseStatus)) {
throw new ClientErrorException(response.getBody());
} else if (isServerError(responseStatus)) {
throw new ServerErrorException();
} else if (isOtherErrorResponse(responseStatus)) {
throw new OtherCommunicationException();
}
} | [
"private",
"static",
"void",
"ensureStatusOk",
"(",
"HttpResponse",
"<",
"String",
">",
"response",
")",
"throws",
"ClientErrorException",
",",
"ServerErrorException",
",",
"OtherCommunicationException",
"{",
"int",
"responseStatus",
"=",
"response",
".",
"getStatus",
... | ~~~~~~~ Error handling ~~~~~~~~~ | [
"~~~~~~~",
"Error",
"handling",
"~~~~~~~~~"
] | b84bcf6fa4528b4097bd19e893ca95003a0dcff0 | https://github.com/julianghionoiu/tdl-client-java/blob/b84bcf6fa4528b4097bd19e893ca95003a0dcff0/src/main/java/tdl/client/runner/ChallengeServerClient.java#L74-L84 | train |
isisaddons-legacy/isis-wicket-gmap3 | fixture/src/main/java/org/isisaddons/wicket/gmap3/fixture/dom/Gmap3WicketToDoItems.java | Gmap3WicketToDoItems.newToDo | @Programmatic // for use by fixtures
public Gmap3ToDoItem newToDo(
final String description,
final String userName) {
final Gmap3ToDoItem toDoItem = repositoryService.instantiate(Gmap3ToDoItem.class);
toDoItem.setDescription(description);
toDoItem.setOwnedBy(userName);
toDoItem.setLocation(
new Location(51.5172+random(-0.05, +0.05), 0.1182 + random(-0.05, +0.05)));
repositoryService.persistAndFlush(toDoItem);
return toDoItem;
} | java | @Programmatic // for use by fixtures
public Gmap3ToDoItem newToDo(
final String description,
final String userName) {
final Gmap3ToDoItem toDoItem = repositoryService.instantiate(Gmap3ToDoItem.class);
toDoItem.setDescription(description);
toDoItem.setOwnedBy(userName);
toDoItem.setLocation(
new Location(51.5172+random(-0.05, +0.05), 0.1182 + random(-0.05, +0.05)));
repositoryService.persistAndFlush(toDoItem);
return toDoItem;
} | [
"@",
"Programmatic",
"// for use by fixtures",
"public",
"Gmap3ToDoItem",
"newToDo",
"(",
"final",
"String",
"description",
",",
"final",
"String",
"userName",
")",
"{",
"final",
"Gmap3ToDoItem",
"toDoItem",
"=",
"repositoryService",
".",
"instantiate",
"(",
"Gmap3ToD... | region > programmatic helpers | [
"region",
">",
"programmatic",
"helpers"
] | 64fc6bc9c2d43ccdaae7b31e8943059d709f2895 | https://github.com/isisaddons-legacy/isis-wicket-gmap3/blob/64fc6bc9c2d43ccdaae7b31e8943059d709f2895/fixture/src/main/java/org/isisaddons/wicket/gmap3/fixture/dom/Gmap3WicketToDoItems.java#L159-L173 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java | DurationDatatype.computeDays | private static BigInteger computeDays(BigInteger months, int refYear, int refMonth) {
switch (months.signum()) {
case 0:
return BigInteger.valueOf(0);
case -1:
return computeDays(months.negate(), refYear, refMonth).negate();
}
// Complete cycle of Gregorian calendar is 400 years
BigInteger[] tem = months.divideAndRemainder(BigInteger.valueOf(400*12));
--refMonth; // use 0 base to match Java
int total = 0;
for (int rem = tem[1].intValue(); rem > 0; rem--) {
total += daysInMonth(refYear, refMonth);
if (++refMonth == 12) {
refMonth = 0;
refYear++;
}
}
// In the Gregorian calendar, there are 97 (= 100 + 4 - 1) leap years every 400 years.
return tem[0].multiply(BigInteger.valueOf(365*400 + 97)).add(BigInteger.valueOf(total));
} | java | private static BigInteger computeDays(BigInteger months, int refYear, int refMonth) {
switch (months.signum()) {
case 0:
return BigInteger.valueOf(0);
case -1:
return computeDays(months.negate(), refYear, refMonth).negate();
}
// Complete cycle of Gregorian calendar is 400 years
BigInteger[] tem = months.divideAndRemainder(BigInteger.valueOf(400*12));
--refMonth; // use 0 base to match Java
int total = 0;
for (int rem = tem[1].intValue(); rem > 0; rem--) {
total += daysInMonth(refYear, refMonth);
if (++refMonth == 12) {
refMonth = 0;
refYear++;
}
}
// In the Gregorian calendar, there are 97 (= 100 + 4 - 1) leap years every 400 years.
return tem[0].multiply(BigInteger.valueOf(365*400 + 97)).add(BigInteger.valueOf(total));
} | [
"private",
"static",
"BigInteger",
"computeDays",
"(",
"BigInteger",
"months",
",",
"int",
"refYear",
",",
"int",
"refMonth",
")",
"{",
"switch",
"(",
"months",
".",
"signum",
"(",
")",
")",
"{",
"case",
"0",
":",
"return",
"BigInteger",
".",
"valueOf",
... | Returns the number of days spanned by a period of months starting with a particular
reference year and month. | [
"Returns",
"the",
"number",
"of",
"days",
"spanned",
"by",
"a",
"period",
"of",
"months",
"starting",
"with",
"a",
"particular",
"reference",
"year",
"and",
"month",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java#L179-L199 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java | DurationDatatype.daysPlusSeconds | private static BigDecimal daysPlusSeconds(BigInteger days, BigDecimal seconds) {
return seconds.add(new BigDecimal(days.multiply(BigInteger.valueOf(24*60*60))));
} | java | private static BigDecimal daysPlusSeconds(BigInteger days, BigDecimal seconds) {
return seconds.add(new BigDecimal(days.multiply(BigInteger.valueOf(24*60*60))));
} | [
"private",
"static",
"BigDecimal",
"daysPlusSeconds",
"(",
"BigInteger",
"days",
",",
"BigDecimal",
"seconds",
")",
"{",
"return",
"seconds",
".",
"add",
"(",
"new",
"BigDecimal",
"(",
"days",
".",
"multiply",
"(",
"BigInteger",
".",
"valueOf",
"(",
"24",
"*... | Returns the total number of seconds from a specified number of days and seconds. | [
"Returns",
"the",
"total",
"number",
"of",
"seconds",
"from",
"a",
"specified",
"number",
"of",
"days",
"and",
"seconds",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java#L221-L223 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java | DurationDatatype.computeMonths | private static BigInteger computeMonths(Duration d) {
return d.getYears().multiply(BigInteger.valueOf(12)).add(d.getMonths());
} | java | private static BigInteger computeMonths(Duration d) {
return d.getYears().multiply(BigInteger.valueOf(12)).add(d.getMonths());
} | [
"private",
"static",
"BigInteger",
"computeMonths",
"(",
"Duration",
"d",
")",
"{",
"return",
"d",
".",
"getYears",
"(",
")",
".",
"multiply",
"(",
"BigInteger",
".",
"valueOf",
"(",
"12",
")",
")",
".",
"add",
"(",
"d",
".",
"getMonths",
"(",
")",
"... | Returns the total number of months specified by the year and month fields of the duration | [
"Returns",
"the",
"total",
"number",
"of",
"months",
"specified",
"by",
"the",
"year",
"and",
"month",
"fields",
"of",
"the",
"duration"
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java#L228-L230 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java | DurationDatatype.computeSeconds | private static BigDecimal computeSeconds(Duration d) {
return d.getSeconds().add(new BigDecimal(d.getDays().multiply(BigInteger.valueOf(24))
.add(d.getHours()).multiply(BigInteger.valueOf(60))
.add(d.getMinutes()).multiply(BigInteger.valueOf(60))));
} | java | private static BigDecimal computeSeconds(Duration d) {
return d.getSeconds().add(new BigDecimal(d.getDays().multiply(BigInteger.valueOf(24))
.add(d.getHours()).multiply(BigInteger.valueOf(60))
.add(d.getMinutes()).multiply(BigInteger.valueOf(60))));
} | [
"private",
"static",
"BigDecimal",
"computeSeconds",
"(",
"Duration",
"d",
")",
"{",
"return",
"d",
".",
"getSeconds",
"(",
")",
".",
"add",
"(",
"new",
"BigDecimal",
"(",
"d",
".",
"getDays",
"(",
")",
".",
"multiply",
"(",
"BigInteger",
".",
"valueOf",... | Returns the total number of seconds specified by the days, hours, minuts and seconds fields of
the duration. | [
"Returns",
"the",
"total",
"number",
"of",
"seconds",
"specified",
"by",
"the",
"days",
"hours",
"minuts",
"and",
"seconds",
"fields",
"of",
"the",
"duration",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java#L236-L240 | train |
microfocus-idol/java-idol-types | src/main/java/com/hp/autonomy/types/idol/marshalling/processors/CopyResponseProcessor.java | CopyResponseProcessor.process | @Override
public Boolean process(final AciResponseInputStream aciResponse) {
try {
IOUtils.copy(aciResponse, outputStream);
outputStream.flush();
return true;
}
catch(final IOException e) {
throw new ProcessorException(e);
}
} | java | @Override
public Boolean process(final AciResponseInputStream aciResponse) {
try {
IOUtils.copy(aciResponse, outputStream);
outputStream.flush();
return true;
}
catch(final IOException e) {
throw new ProcessorException(e);
}
} | [
"@",
"Override",
"public",
"Boolean",
"process",
"(",
"final",
"AciResponseInputStream",
"aciResponse",
")",
"{",
"try",
"{",
"IOUtils",
".",
"copy",
"(",
"aciResponse",
",",
"outputStream",
")",
";",
"outputStream",
".",
"flush",
"(",
")",
";",
"return",
"t... | Copies the given AciResponseInputStream into the OutputStream.
@param aciResponse The AciResponseInputStream to read
@return true If the method completes successfully
@throws ProcessorException If an IOException is thrown internally. | [
"Copies",
"the",
"given",
"AciResponseInputStream",
"into",
"the",
"OutputStream",
"."
] | 2d98a74ccd72d1bcc9577675c0c6165b313b9a76 | https://github.com/microfocus-idol/java-idol-types/blob/2d98a74ccd72d1bcc9577675c0c6165b313b9a76/src/main/java/com/hp/autonomy/types/idol/marshalling/processors/CopyResponseProcessor.java#L40-L52 | train |
RestComm/mss-arquillian | mss-arquillian-utilities-extension/src/main/java/org/jboss/arquillian/container/mss/extension/SipStackTool.java | SipStackTool.initializeSipStack | public SipStack initializeSipStack(String transport, String myPort, Properties myProperties) throws Exception {
/*
* http://code.google.com/p/mobicents/issues/detail?id=3121
* Reset sipStack when calling initializeSipStack method
*/
tearDown();
try
{
sipStack = new SipStack(transport, Integer.valueOf(myPort), myProperties);
logger.info("SipStack - "+sipStackName+" - created!");
}
catch (Exception ex)
{
logger.info("Exception: " + ex.getClass().getName() + ": "
+ ex.getMessage());
throw ex;
}
initialized = true;
return sipStack;
} | java | public SipStack initializeSipStack(String transport, String myPort, Properties myProperties) throws Exception {
/*
* http://code.google.com/p/mobicents/issues/detail?id=3121
* Reset sipStack when calling initializeSipStack method
*/
tearDown();
try
{
sipStack = new SipStack(transport, Integer.valueOf(myPort), myProperties);
logger.info("SipStack - "+sipStackName+" - created!");
}
catch (Exception ex)
{
logger.info("Exception: " + ex.getClass().getName() + ": "
+ ex.getMessage());
throw ex;
}
initialized = true;
return sipStack;
} | [
"public",
"SipStack",
"initializeSipStack",
"(",
"String",
"transport",
",",
"String",
"myPort",
",",
"Properties",
"myProperties",
")",
"throws",
"Exception",
"{",
"/*\n\t\t * http://code.google.com/p/mobicents/issues/detail?id=3121\n\t\t * Reset sipStack when calling initializeSipS... | Initialize SipStack using provided properties | [
"Initialize",
"SipStack",
"using",
"provided",
"properties"
] | d217b4e53701282c6e7176365a03be6f898342be | https://github.com/RestComm/mss-arquillian/blob/d217b4e53701282c6e7176365a03be6f898342be/mss-arquillian-utilities-extension/src/main/java/org/jboss/arquillian/container/mss/extension/SipStackTool.java#L126-L148 | train |
vnesek/nmote-xr | src/main/java/com/nmote/xr/FacadeEndpoint.java | FacadeEndpoint.newProxy | public T newProxy() {
Object proxy = Proxy.newProxyInstance(classLoader, exportInterfaces, this);
return clazz.cast(proxy);
} | java | public T newProxy() {
Object proxy = Proxy.newProxyInstance(classLoader, exportInterfaces, this);
return clazz.cast(proxy);
} | [
"public",
"T",
"newProxy",
"(",
")",
"{",
"Object",
"proxy",
"=",
"Proxy",
".",
"newProxyInstance",
"(",
"classLoader",
",",
"exportInterfaces",
",",
"this",
")",
";",
"return",
"clazz",
".",
"cast",
"(",
"proxy",
")",
";",
"}"
] | Creates an proxy implementing T and all passed additional interfaces.
@return new proxy instance | [
"Creates",
"an",
"proxy",
"implementing",
"T",
"and",
"all",
"passed",
"additional",
"interfaces",
"."
] | 6c584142a38a9dbc6401c75614d8d207f64f658d | https://github.com/vnesek/nmote-xr/blob/6c584142a38a9dbc6401c75614d8d207f64f658d/src/main/java/com/nmote/xr/FacadeEndpoint.java#L117-L120 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/resolver/xml/sax/SAX.java | SAX.setInput | public static void setInput(Input input, InputSource inputSource) {
input.setByteStream(inputSource.getByteStream());
input.setCharacterStream(inputSource.getCharacterStream());
input.setUri(inputSource.getSystemId());
input.setEncoding(inputSource.getEncoding());
} | java | public static void setInput(Input input, InputSource inputSource) {
input.setByteStream(inputSource.getByteStream());
input.setCharacterStream(inputSource.getCharacterStream());
input.setUri(inputSource.getSystemId());
input.setEncoding(inputSource.getEncoding());
} | [
"public",
"static",
"void",
"setInput",
"(",
"Input",
"input",
",",
"InputSource",
"inputSource",
")",
"{",
"input",
".",
"setByteStream",
"(",
"inputSource",
".",
"getByteStream",
"(",
")",
")",
";",
"input",
".",
"setCharacterStream",
"(",
"inputSource",
"."... | public because needed by transform package | [
"public",
"because",
"needed",
"by",
"transform",
"package"
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/resolver/xml/sax/SAX.java#L91-L96 | train |
dashorst/wicket-stuff-markup-validator | isorelax/src/main/java/org/iso_relax/jaxp/ValidatingSAXParser.java | ValidatingSAXParser.getXMLReader | public XMLReader getXMLReader() throws SAXException
{
XMLFilter filter = _Verifier.getVerifierFilter();
filter.setParent(_WrappedParser.getXMLReader());
return filter;
} | java | public XMLReader getXMLReader() throws SAXException
{
XMLFilter filter = _Verifier.getVerifierFilter();
filter.setParent(_WrappedParser.getXMLReader());
return filter;
} | [
"public",
"XMLReader",
"getXMLReader",
"(",
")",
"throws",
"SAXException",
"{",
"XMLFilter",
"filter",
"=",
"_Verifier",
".",
"getVerifierFilter",
"(",
")",
";",
"filter",
".",
"setParent",
"(",
"_WrappedParser",
".",
"getXMLReader",
"(",
")",
")",
";",
"retur... | returns a new XMLReader for parsing and validating the input | [
"returns",
"a",
"new",
"XMLReader",
"for",
"parsing",
"and",
"validating",
"the",
"input"
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/isorelax/src/main/java/org/iso_relax/jaxp/ValidatingSAXParser.java#L53-L58 | train |
dashorst/wicket-stuff-markup-validator | isorelax/src/main/java/org/iso_relax/jaxp/ValidatingSAXParser.java | ValidatingSAXParser.parse | public void parse(File f, DefaultHandler dh) throws SAXException, IOException
{
XMLReader reader = getXMLReader();
InputSource source = new InputSource(new FileInputStream(f));
reader.setContentHandler(dh);
reader.parse(source);
} | java | public void parse(File f, DefaultHandler dh) throws SAXException, IOException
{
XMLReader reader = getXMLReader();
InputSource source = new InputSource(new FileInputStream(f));
reader.setContentHandler(dh);
reader.parse(source);
} | [
"public",
"void",
"parse",
"(",
"File",
"f",
",",
"DefaultHandler",
"dh",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"XMLReader",
"reader",
"=",
"getXMLReader",
"(",
")",
";",
"InputSource",
"source",
"=",
"new",
"InputSource",
"(",
"new",
"File... | parses and validates the given File using the given DefaultHandler | [
"parses",
"and",
"validates",
"the",
"given",
"File",
"using",
"the",
"given",
"DefaultHandler"
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/isorelax/src/main/java/org/iso_relax/jaxp/ValidatingSAXParser.java#L102-L108 | train |
dashorst/wicket-stuff-markup-validator | isorelax/src/main/java/org/iso_relax/jaxp/ValidatingSAXParser.java | ValidatingSAXParser.parse | public void parse(InputSource source, DefaultHandler dh) throws SAXException, IOException
{
XMLReader reader = getXMLReader();
reader.setContentHandler(dh);
reader.parse(source);
} | java | public void parse(InputSource source, DefaultHandler dh) throws SAXException, IOException
{
XMLReader reader = getXMLReader();
reader.setContentHandler(dh);
reader.parse(source);
} | [
"public",
"void",
"parse",
"(",
"InputSource",
"source",
",",
"DefaultHandler",
"dh",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"XMLReader",
"reader",
"=",
"getXMLReader",
"(",
")",
";",
"reader",
".",
"setContentHandler",
"(",
"dh",
")",
";",
... | parses and validates the given InputSource using the given DefaultHandler | [
"parses",
"and",
"validates",
"the",
"given",
"InputSource",
"using",
"the",
"given",
"DefaultHandler"
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/isorelax/src/main/java/org/iso_relax/jaxp/ValidatingSAXParser.java#L112-L117 | train |
julianghionoiu/tdl-client-java | src/main/java/tdl/client/queue/abstractions/Request.java | Request.getAuditText | @Override
public String getAuditText() {
return String.format("id = %s, req = %s(%s)",
getId(), getMethodName(), PresentationUtils.toDisplayableString(getParams()));
} | java | @Override
public String getAuditText() {
return String.format("id = %s, req = %s(%s)",
getId(), getMethodName(), PresentationUtils.toDisplayableString(getParams()));
} | [
"@",
"Override",
"public",
"String",
"getAuditText",
"(",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"id = %s, req = %s(%s)\"",
",",
"getId",
"(",
")",
",",
"getMethodName",
"(",
")",
",",
"PresentationUtils",
".",
"toDisplayableString",
"(",
"getParams... | ~~~ Pretty print | [
"~~~",
"Pretty",
"print"
] | b84bcf6fa4528b4097bd19e893ca95003a0dcff0 | https://github.com/julianghionoiu/tdl-client-java/blob/b84bcf6fa4528b4097bd19e893ca95003a0dcff0/src/main/java/tdl/client/queue/abstractions/Request.java#L39-L43 | train |
vnesek/nmote-xr | src/main/java/com/nmote/xr/XmlRpcHandler.java | XmlRpcHandler.newXMLReader | XMLReader newXMLReader() throws ParserConfigurationException, SAXException, FactoryConfigurationError {
SAXParserFactory parserFactory = SAXParserFactory.newInstance();
SAXParser saxParser = parserFactory.newSAXParser();
XMLReader reader = saxParser.getXMLReader();
reader.setContentHandler(this);
return reader;
} | java | XMLReader newXMLReader() throws ParserConfigurationException, SAXException, FactoryConfigurationError {
SAXParserFactory parserFactory = SAXParserFactory.newInstance();
SAXParser saxParser = parserFactory.newSAXParser();
XMLReader reader = saxParser.getXMLReader();
reader.setContentHandler(this);
return reader;
} | [
"XMLReader",
"newXMLReader",
"(",
")",
"throws",
"ParserConfigurationException",
",",
"SAXException",
",",
"FactoryConfigurationError",
"{",
"SAXParserFactory",
"parserFactory",
"=",
"SAXParserFactory",
".",
"newInstance",
"(",
")",
";",
"SAXParser",
"saxParser",
"=",
"... | Convenience method that creates a XMLReader configured with this
XmlRpcHandler instance.
@return
@throws ParserConfigurationException
@throws SAXException
@throws FactoryConfigurationError | [
"Convenience",
"method",
"that",
"creates",
"a",
"XMLReader",
"configured",
"with",
"this",
"XmlRpcHandler",
"instance",
"."
] | 6c584142a38a9dbc6401c75614d8d207f64f658d | https://github.com/vnesek/nmote-xr/blob/6c584142a38a9dbc6401c75614d8d207f64f658d/src/main/java/com/nmote/xr/XmlRpcHandler.java#L353-L359 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/util/Uri.java | Uri.isValid | public static boolean isValid(String s) {
try {
new URI(UriEncoder.encode(s));
}
catch (URISyntaxException e) {
return false;
}
return true;
} | java | public static boolean isValid(String s) {
try {
new URI(UriEncoder.encode(s));
}
catch (URISyntaxException e) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isValid",
"(",
"String",
"s",
")",
"{",
"try",
"{",
"new",
"URI",
"(",
"UriEncoder",
".",
"encode",
"(",
"s",
")",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"return"... | Tests whether a string is a valid URI reference.
@param s the String to be tested
@return true is s is a valid URI reference, false otherwise | [
"Tests",
"whether",
"a",
"string",
"is",
"a",
"valid",
"URI",
"reference",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/util/Uri.java#L12-L20 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/util/Uri.java | Uri.isAbsolute | public static boolean isAbsolute(String uri) {
int i = uri.indexOf(':');
if (i < 0)
return false;
while (--i >= 0) {
switch (uri.charAt(i)) {
case '#':
case '/':
case '?':
return false;
}
}
return true;
} | java | public static boolean isAbsolute(String uri) {
int i = uri.indexOf(':');
if (i < 0)
return false;
while (--i >= 0) {
switch (uri.charAt(i)) {
case '#':
case '/':
case '?':
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isAbsolute",
"(",
"String",
"uri",
")",
"{",
"int",
"i",
"=",
"uri",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"i",
"<",
"0",
")",
"return",
"false",
";",
"while",
"(",
"--",
"i",
">=",
"0",
")",
"{",
... | Tests whether a valid URI reference is absolute. It is allowed to pass an invalid URI reference,
but the result is not defined. It is also allowed to pass a valid URI with leading
and trailing whitespace.
@param uri the URI to be tested, must not be null
@return true if the URI reference is absolute, false otherwise | [
"Tests",
"whether",
"a",
"valid",
"URI",
"reference",
"is",
"absolute",
".",
"It",
"is",
"allowed",
"to",
"pass",
"an",
"invalid",
"URI",
"reference",
"but",
"the",
"result",
"is",
"not",
"defined",
".",
"It",
"is",
"also",
"allowed",
"to",
"pass",
"a",
... | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/util/Uri.java#L56-L69 | train |
dashorst/wicket-stuff-markup-validator | htmlvalidator/src/main/java/org/wicketstuff/htmlvalidator/HtmlValidationConfiguration.java | HtmlValidationConfiguration.mustShowWindowForError | public boolean mustShowWindowForError(SAXParseException error) {
for (Pattern curIgnorePattern : ignoreErrorsForWindow) {
if (curIgnorePattern.matcher(error.getMessage()).find())
return false;
}
return true;
} | java | public boolean mustShowWindowForError(SAXParseException error) {
for (Pattern curIgnorePattern : ignoreErrorsForWindow) {
if (curIgnorePattern.matcher(error.getMessage()).find())
return false;
}
return true;
} | [
"public",
"boolean",
"mustShowWindowForError",
"(",
"SAXParseException",
"error",
")",
"{",
"for",
"(",
"Pattern",
"curIgnorePattern",
":",
"ignoreErrorsForWindow",
")",
"{",
"if",
"(",
"curIgnorePattern",
".",
"matcher",
"(",
"error",
".",
"getMessage",
"(",
")",... | Determines whether the validation result window should pop up for this
particular error. If just one error instructs that the window should pop
up, it does so.
@param error
the validation error
@return <code>true</code> when the window should automatically pop up,
rendering the markup error in the face of the user | [
"Determines",
"whether",
"the",
"validation",
"result",
"window",
"should",
"pop",
"up",
"for",
"this",
"particular",
"error",
".",
"If",
"just",
"one",
"error",
"instructs",
"that",
"the",
"window",
"should",
"pop",
"up",
"it",
"does",
"so",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/htmlvalidator/src/main/java/org/wicketstuff/htmlvalidator/HtmlValidationConfiguration.java#L60-L66 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/nvdl/Mode.java | Mode.getElementActionsExplicit | private ActionSet getElementActionsExplicit(String ns) {
ActionSet actions = (ActionSet)elementMap.get(ns);
if (actions==null) {
// iterate namespace specifications.
for (Enumeration e = nssElementMap.keys(); e.hasMoreElements() && actions==null;) {
NamespaceSpecification nssI = (NamespaceSpecification)e.nextElement();
// If a namespace specification convers the current namespace URI then we get those actions.
if (nssI.covers(ns)) {
actions = (ActionSet)nssElementMap.get(nssI);
}
}
// Store them in the element Map for faster access next time.
if (actions!=null) {
elementMap.put(ns, actions);
}
}
// Look into the included modes
if (actions == null && includedModes != null) {
Iterator i = includedModes.iterator();
while (actions == null && i.hasNext()) {
Mode includedMode = (Mode)i.next();
actions = includedMode.getElementActionsExplicit(ns);
}
if (actions != null) {
actions = actions.changeCurrentMode(this);
elementMap.put(ns, actions);
}
}
// No actions specified, look into the base mode.
if (actions == null && baseMode != null) {
actions = baseMode.getElementActionsExplicit(ns);
if (actions != null) {
actions = actions.changeCurrentMode(this);
elementMap.put(ns, actions);
}
}
if (actions!=null && actions.getCancelNestedActions()) {
actions = null;
}
return actions;
} | java | private ActionSet getElementActionsExplicit(String ns) {
ActionSet actions = (ActionSet)elementMap.get(ns);
if (actions==null) {
// iterate namespace specifications.
for (Enumeration e = nssElementMap.keys(); e.hasMoreElements() && actions==null;) {
NamespaceSpecification nssI = (NamespaceSpecification)e.nextElement();
// If a namespace specification convers the current namespace URI then we get those actions.
if (nssI.covers(ns)) {
actions = (ActionSet)nssElementMap.get(nssI);
}
}
// Store them in the element Map for faster access next time.
if (actions!=null) {
elementMap.put(ns, actions);
}
}
// Look into the included modes
if (actions == null && includedModes != null) {
Iterator i = includedModes.iterator();
while (actions == null && i.hasNext()) {
Mode includedMode = (Mode)i.next();
actions = includedMode.getElementActionsExplicit(ns);
}
if (actions != null) {
actions = actions.changeCurrentMode(this);
elementMap.put(ns, actions);
}
}
// No actions specified, look into the base mode.
if (actions == null && baseMode != null) {
actions = baseMode.getElementActionsExplicit(ns);
if (actions != null) {
actions = actions.changeCurrentMode(this);
elementMap.put(ns, actions);
}
}
if (actions!=null && actions.getCancelNestedActions()) {
actions = null;
}
return actions;
} | [
"private",
"ActionSet",
"getElementActionsExplicit",
"(",
"String",
"ns",
")",
"{",
"ActionSet",
"actions",
"=",
"(",
"ActionSet",
")",
"elementMap",
".",
"get",
"(",
"ns",
")",
";",
"if",
"(",
"actions",
"==",
"null",
")",
"{",
"// iterate namespace specifica... | Look for element actions specifically specified
for this namespace. If the current mode does not have
actions for that namespace look at base modes. If the actions
are defined in a base mode we need to get a copy of those actions
associated with this mode, so we call changeCurrentMode on them.
@param ns The namespace
@return A set of element actions. | [
"Look",
"for",
"element",
"actions",
"specifically",
"specified",
"for",
"this",
"namespace",
".",
"If",
"the",
"current",
"mode",
"does",
"not",
"have",
"actions",
"for",
"that",
"namespace",
"look",
"at",
"base",
"modes",
".",
"If",
"the",
"actions",
"are"... | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/Mode.java#L159-L202 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/nvdl/Mode.java | Mode.getAttributeActionsExplicit | private AttributeActionSet getAttributeActionsExplicit(String ns) {
AttributeActionSet actions = (AttributeActionSet)attributeMap.get(ns);
if (actions==null) {
// iterate namespace specifications.
for (Enumeration e = nssAttributeMap.keys(); e.hasMoreElements() && actions==null;) {
NamespaceSpecification nssI = (NamespaceSpecification)e.nextElement();
// If a namespace specification convers the current namespace URI then we get those actions.
if (nssI.covers(ns)) {
actions = (AttributeActionSet)nssAttributeMap.get(nssI);
}
}
// Store them in the element Map for faster access next time.
if (actions!=null) {
attributeMap.put(ns, actions);
}
}
// Look into the included modes
if (actions == null && includedModes != null) {
Iterator i = includedModes.iterator();
while (actions == null && i.hasNext()) {
Mode includedMode = (Mode)i.next();
actions = includedMode.getAttributeActionsExplicit(ns);
}
if (actions != null) {
attributeMap.put(ns, actions);
}
}
if (actions == null && baseMode != null) {
actions = baseMode.getAttributeActionsExplicit(ns);
if (actions != null)
attributeMap.put(ns, actions);
}
if (actions!=null && actions.getCancelNestedActions()) {
actions = null;
}
return actions;
} | java | private AttributeActionSet getAttributeActionsExplicit(String ns) {
AttributeActionSet actions = (AttributeActionSet)attributeMap.get(ns);
if (actions==null) {
// iterate namespace specifications.
for (Enumeration e = nssAttributeMap.keys(); e.hasMoreElements() && actions==null;) {
NamespaceSpecification nssI = (NamespaceSpecification)e.nextElement();
// If a namespace specification convers the current namespace URI then we get those actions.
if (nssI.covers(ns)) {
actions = (AttributeActionSet)nssAttributeMap.get(nssI);
}
}
// Store them in the element Map for faster access next time.
if (actions!=null) {
attributeMap.put(ns, actions);
}
}
// Look into the included modes
if (actions == null && includedModes != null) {
Iterator i = includedModes.iterator();
while (actions == null && i.hasNext()) {
Mode includedMode = (Mode)i.next();
actions = includedMode.getAttributeActionsExplicit(ns);
}
if (actions != null) {
attributeMap.put(ns, actions);
}
}
if (actions == null && baseMode != null) {
actions = baseMode.getAttributeActionsExplicit(ns);
if (actions != null)
attributeMap.put(ns, actions);
}
if (actions!=null && actions.getCancelNestedActions()) {
actions = null;
}
return actions;
} | [
"private",
"AttributeActionSet",
"getAttributeActionsExplicit",
"(",
"String",
"ns",
")",
"{",
"AttributeActionSet",
"actions",
"=",
"(",
"AttributeActionSet",
")",
"attributeMap",
".",
"get",
"(",
"ns",
")",
";",
"if",
"(",
"actions",
"==",
"null",
")",
"{",
... | Look for attribute actions specifically specified
for this namespace. If the current mode does not have
actions for that namespace look at base modes. If the actions
are defined in a base mode we need to get a copy of those actions
associated with this mode, so we call changeCurrentMode on them.
@param ns The namespace
@return A set of attribute actions. | [
"Look",
"for",
"attribute",
"actions",
"specifically",
"specified",
"for",
"this",
"namespace",
".",
"If",
"the",
"current",
"mode",
"does",
"not",
"have",
"actions",
"for",
"that",
"namespace",
"look",
"at",
"base",
"modes",
".",
"If",
"the",
"actions",
"ar... | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/Mode.java#L231-L269 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/nvdl/Mode.java | Mode.bindElement | boolean bindElement(String ns, String wildcard, ActionSet actions) {
NamespaceSpecification nss = new NamespaceSpecification(ns, wildcard);
if (nssElementMap.get(nss) != null)
return false;
for (Enumeration e = nssElementMap.keys(); e.hasMoreElements();) {
NamespaceSpecification nssI = (NamespaceSpecification)e.nextElement();
if (nss.compete(nssI)) {
return false;
}
}
nssElementMap.put(nss, actions);
return true;
} | java | boolean bindElement(String ns, String wildcard, ActionSet actions) {
NamespaceSpecification nss = new NamespaceSpecification(ns, wildcard);
if (nssElementMap.get(nss) != null)
return false;
for (Enumeration e = nssElementMap.keys(); e.hasMoreElements();) {
NamespaceSpecification nssI = (NamespaceSpecification)e.nextElement();
if (nss.compete(nssI)) {
return false;
}
}
nssElementMap.put(nss, actions);
return true;
} | [
"boolean",
"bindElement",
"(",
"String",
"ns",
",",
"String",
"wildcard",
",",
"ActionSet",
"actions",
")",
"{",
"NamespaceSpecification",
"nss",
"=",
"new",
"NamespaceSpecification",
"(",
"ns",
",",
"wildcard",
")",
";",
"if",
"(",
"nssElementMap",
".",
"get"... | Adds a set of element actions to be performed in this mode
for elements in a specified namespace.
@param ns The namespace pattern.
@param wildcard The wildcard character.
@param actions The set of element actions.
@return true if successfully added, that is the namespace was
not already present in the elementMap, otherwise false, the
caller should signal a script error in this case. | [
"Adds",
"a",
"set",
"of",
"element",
"actions",
"to",
"be",
"performed",
"in",
"this",
"mode",
"for",
"elements",
"in",
"a",
"specified",
"namespace",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/Mode.java#L364-L376 | train |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/nvdl/Mode.java | Mode.bindAttribute | boolean bindAttribute(String ns, String wildcard, AttributeActionSet actions) {
NamespaceSpecification nss = new NamespaceSpecification(ns, wildcard);
if (nssAttributeMap.get(nss) != null)
return false;
for (Enumeration e = nssAttributeMap.keys(); e.hasMoreElements();) {
NamespaceSpecification nssI = (NamespaceSpecification)e.nextElement();
if (nss.compete(nssI)) {
return false;
}
}
nssAttributeMap.put(nss, actions);
return true;
} | java | boolean bindAttribute(String ns, String wildcard, AttributeActionSet actions) {
NamespaceSpecification nss = new NamespaceSpecification(ns, wildcard);
if (nssAttributeMap.get(nss) != null)
return false;
for (Enumeration e = nssAttributeMap.keys(); e.hasMoreElements();) {
NamespaceSpecification nssI = (NamespaceSpecification)e.nextElement();
if (nss.compete(nssI)) {
return false;
}
}
nssAttributeMap.put(nss, actions);
return true;
} | [
"boolean",
"bindAttribute",
"(",
"String",
"ns",
",",
"String",
"wildcard",
",",
"AttributeActionSet",
"actions",
")",
"{",
"NamespaceSpecification",
"nss",
"=",
"new",
"NamespaceSpecification",
"(",
"ns",
",",
"wildcard",
")",
";",
"if",
"(",
"nssAttributeMap",
... | Adds a set of attribute actions to be performed in this mode
for attributes in a specified namespace.
@param ns The namespace pattern.
@param wildcard The wildcard character.
@param actions The set of attribute actions.
@return true if successfully added, that is the namespace was
not already present in the attributeMap, otherwise false, the
caller should signal a script error in this case. | [
"Adds",
"a",
"set",
"of",
"attribute",
"actions",
"to",
"be",
"performed",
"in",
"this",
"mode",
"for",
"attributes",
"in",
"a",
"specified",
"namespace",
"."
] | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/Mode.java#L389-L401 | train |
isisaddons-legacy/isis-wicket-gmap3 | cpt/src/main/java/org/isisaddons/wicket/gmap3/cpt/ui/CollectionOfEntitiesAsLocatablesFactory.java | CollectionOfEntitiesAsLocatablesFactory.isInternetReachable | private static boolean isInternetReachable()
{
try {
final URL url = new URL("http://www.google.com");
final HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection();
urlConnect.setConnectTimeout(1000);
urlConnect.getContent();
urlConnect.disconnect();
} catch (UnknownHostException e) {
return false;
} catch (IOException e) {
return false;
}
return true;
} | java | private static boolean isInternetReachable()
{
try {
final URL url = new URL("http://www.google.com");
final HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection();
urlConnect.setConnectTimeout(1000);
urlConnect.getContent();
urlConnect.disconnect();
} catch (UnknownHostException e) {
return false;
} catch (IOException e) {
return false;
}
return true;
} | [
"private",
"static",
"boolean",
"isInternetReachable",
"(",
")",
"{",
"try",
"{",
"final",
"URL",
"url",
"=",
"new",
"URL",
"(",
"\"http://www.google.com\"",
")",
";",
"final",
"HttpURLConnection",
"urlConnect",
"=",
"(",
"HttpURLConnection",
")",
"url",
".",
... | Tries to retrieve some content, 1 second timeout. | [
"Tries",
"to",
"retrieve",
"some",
"content",
"1",
"second",
"timeout",
"."
] | 64fc6bc9c2d43ccdaae7b31e8943059d709f2895 | https://github.com/isisaddons-legacy/isis-wicket-gmap3/blob/64fc6bc9c2d43ccdaae7b31e8943059d709f2895/cpt/src/main/java/org/isisaddons/wicket/gmap3/cpt/ui/CollectionOfEntitiesAsLocatablesFactory.java#L87-L101 | train |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/DateBuilder.java | DateBuilder.build | @Nonnull
public Date build ()
{
Calendar cal;
if (m_aTZ != null && m_aLocale != null)
cal = Calendar.getInstance (m_aTZ, m_aLocale);
else
if (m_aTZ != null)
cal = Calendar.getInstance (m_aTZ, Locale.getDefault (Locale.Category.FORMAT));
else
if (m_aLocale != null)
cal = Calendar.getInstance (TimeZone.getDefault (), m_aLocale);
else
cal = PDTFactory.createCalendar ();
cal.set (Calendar.YEAR, m_nYear);
cal.set (Calendar.MONTH, m_nMonth - 1);
cal.set (Calendar.DAY_OF_MONTH, m_nDay);
cal.set (Calendar.HOUR_OF_DAY, m_nHour);
cal.set (Calendar.MINUTE, m_nMinute);
cal.set (Calendar.SECOND, m_nSecond);
cal.set (Calendar.MILLISECOND, 0);
return cal.getTime ();
} | java | @Nonnull
public Date build ()
{
Calendar cal;
if (m_aTZ != null && m_aLocale != null)
cal = Calendar.getInstance (m_aTZ, m_aLocale);
else
if (m_aTZ != null)
cal = Calendar.getInstance (m_aTZ, Locale.getDefault (Locale.Category.FORMAT));
else
if (m_aLocale != null)
cal = Calendar.getInstance (TimeZone.getDefault (), m_aLocale);
else
cal = PDTFactory.createCalendar ();
cal.set (Calendar.YEAR, m_nYear);
cal.set (Calendar.MONTH, m_nMonth - 1);
cal.set (Calendar.DAY_OF_MONTH, m_nDay);
cal.set (Calendar.HOUR_OF_DAY, m_nHour);
cal.set (Calendar.MINUTE, m_nMinute);
cal.set (Calendar.SECOND, m_nSecond);
cal.set (Calendar.MILLISECOND, 0);
return cal.getTime ();
} | [
"@",
"Nonnull",
"public",
"Date",
"build",
"(",
")",
"{",
"Calendar",
"cal",
";",
"if",
"(",
"m_aTZ",
"!=",
"null",
"&&",
"m_aLocale",
"!=",
"null",
")",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
"m_aTZ",
",",
"m_aLocale",
")",
";",
"else",
"i... | Build the Date defined by this builder instance. | [
"Build",
"the",
"Date",
"defined",
"by",
"this",
"builder",
"instance",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/DateBuilder.java#L159-L182 | train |
codegist/crest | core/src/main/java/org/codegist/crest/config/annotate/StringBasedAnnotationHandler.java | StringBasedAnnotationHandler.ph | protected String[] ph(String... strs) {
String[] res = new String[strs.length];
for(int i = 0; i < res.length; i++){
res[i] = ph(strs[i]);
}
return res;
} | java | protected String[] ph(String... strs) {
String[] res = new String[strs.length];
for(int i = 0; i < res.length; i++){
res[i] = ph(strs[i]);
}
return res;
} | [
"protected",
"String",
"[",
"]",
"ph",
"(",
"String",
"...",
"strs",
")",
"{",
"String",
"[",
"]",
"res",
"=",
"new",
"String",
"[",
"strs",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"res",
".",
"length",
";",
... | replace any placeholder from the given strings
@param strs strings to replace the placeholders from
@return same string with the placeholders merged
@see org.codegist.crest.CRest#placeholder(String, String) | [
"replace",
"any",
"placeholder",
"from",
"the",
"given",
"strings"
] | e99ba7728b27d2ddb2c247261350f1b6fa7a6698 | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/config/annotate/StringBasedAnnotationHandler.java#L51-L57 | train |
codegist/crest | core/src/main/java/org/codegist/crest/interceptor/AbstractRequestInterceptor.java | AbstractRequestInterceptor.newParamConfig | public ParamConfigBuilder newParamConfig(Class<?> type, Type genericType){
return paramConfigBuilderFactory.newInstance(type, genericType);
} | java | public ParamConfigBuilder newParamConfig(Class<?> type, Type genericType){
return paramConfigBuilderFactory.newInstance(type, genericType);
} | [
"public",
"ParamConfigBuilder",
"newParamConfig",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Type",
"genericType",
")",
"{",
"return",
"paramConfigBuilderFactory",
".",
"newInstance",
"(",
"type",
",",
"genericType",
")",
";",
"}"
] | Returns a new param config for the given class and generic type
@param type param config class
@param genericType param config generic type
@return the new param config | [
"Returns",
"a",
"new",
"param",
"config",
"for",
"the",
"given",
"class",
"and",
"generic",
"type"
] | e99ba7728b27d2ddb2c247261350f1b6fa7a6698 | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/interceptor/AbstractRequestInterceptor.java#L59-L61 | train |
davityle/ngAndroid | ng-processor/src/main/java/com/github/davityle/ngprocessor/xml/XmlUtils.java | XmlUtils.getXmlScopes | public Map<Layout, Collection<XmlScope>> getXmlScopes() {
List<File> layoutDirs = layoutsFinder.findLayoutDirs();
Collection<File> layoutFiles = collectionUtils.flatMap(layoutDirs, new CollectionUtils.Function<File, Collection<File>>() {
@Override
public Collection<File> apply(File file) {
return collectionUtils.filter(Arrays.asList(file.listFiles()), new CollectionUtils.Function<File, Boolean>() {
@Override
public Boolean apply(File file) {
return file.getName().endsWith(".xml");
}
});
}
});
Collection<Document> docs = collectionUtils.flatMapOpt(layoutFiles, new CollectionUtils.Function<File, Option<Document>>() {
@Override
public Option<Document> apply(File file) {
return getDocumentFromFile(file);
}
});
return collectionUtils.toMap(collectionUtils.flatMapOpt(docs, new CollectionUtils.Function<Document, Option<Tuple<Layout, Collection<XmlScope>>>>() {
@Override
public Option<Tuple<Layout, Collection<XmlScope>>> apply(Document doc) {
Option<String> optNameSpace = namespaceFinder.getNameSpace(doc);
if (optNameSpace.isPresent()) {
attrPattern = Pattern.compile(String.format(NAMESPACE_ATTRIBUTE_REG, optNameSpace.get()));
Collection<XmlScope> scopes = getScopes(doc);
return Option.of(Tuple.of(new Layout(doc.getDocumentURI()), scopes));
} else {
return Option.absent();
}
}
}));
} | java | public Map<Layout, Collection<XmlScope>> getXmlScopes() {
List<File> layoutDirs = layoutsFinder.findLayoutDirs();
Collection<File> layoutFiles = collectionUtils.flatMap(layoutDirs, new CollectionUtils.Function<File, Collection<File>>() {
@Override
public Collection<File> apply(File file) {
return collectionUtils.filter(Arrays.asList(file.listFiles()), new CollectionUtils.Function<File, Boolean>() {
@Override
public Boolean apply(File file) {
return file.getName().endsWith(".xml");
}
});
}
});
Collection<Document> docs = collectionUtils.flatMapOpt(layoutFiles, new CollectionUtils.Function<File, Option<Document>>() {
@Override
public Option<Document> apply(File file) {
return getDocumentFromFile(file);
}
});
return collectionUtils.toMap(collectionUtils.flatMapOpt(docs, new CollectionUtils.Function<Document, Option<Tuple<Layout, Collection<XmlScope>>>>() {
@Override
public Option<Tuple<Layout, Collection<XmlScope>>> apply(Document doc) {
Option<String> optNameSpace = namespaceFinder.getNameSpace(doc);
if (optNameSpace.isPresent()) {
attrPattern = Pattern.compile(String.format(NAMESPACE_ATTRIBUTE_REG, optNameSpace.get()));
Collection<XmlScope> scopes = getScopes(doc);
return Option.of(Tuple.of(new Layout(doc.getDocumentURI()), scopes));
} else {
return Option.absent();
}
}
}));
} | [
"public",
"Map",
"<",
"Layout",
",",
"Collection",
"<",
"XmlScope",
">",
">",
"getXmlScopes",
"(",
")",
"{",
"List",
"<",
"File",
">",
"layoutDirs",
"=",
"layoutsFinder",
".",
"findLayoutDirs",
"(",
")",
";",
"Collection",
"<",
"File",
">",
"layoutFiles",
... | maps all of the layouts to their scopes, could be optimized
@return | [
"maps",
"all",
"of",
"the",
"layouts",
"to",
"their",
"scopes",
"could",
"be",
"optimized"
] | 1497a9752cd3d4918035531cd072fd01576328e9 | https://github.com/davityle/ngAndroid/blob/1497a9752cd3d4918035531cd072fd01576328e9/ng-processor/src/main/java/com/github/davityle/ngprocessor/xml/XmlUtils.java#L81-L116 | train |
phax/ph-schedule | ph-schedule/src/main/java/com/helger/schedule/quartz/GlobalQuartzScheduler.java | GlobalQuartzScheduler.setGroupName | public void setGroupName (@Nonnull @Nonempty final String sGroupName)
{
ValueEnforcer.notEmpty (sGroupName, "GroupName");
m_sGroupName = sGroupName;
} | java | public void setGroupName (@Nonnull @Nonempty final String sGroupName)
{
ValueEnforcer.notEmpty (sGroupName, "GroupName");
m_sGroupName = sGroupName;
} | [
"public",
"void",
"setGroupName",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sGroupName",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sGroupName",
",",
"\"GroupName\"",
")",
";",
"m_sGroupName",
"=",
"sGroupName",
";",
"}"
] | Set the Quartz internal group name.
@param sGroupName
The new group name to be used. May neither be <code>null</code> nor
empty. | [
"Set",
"the",
"Quartz",
"internal",
"group",
"name",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-schedule/src/main/java/com/helger/schedule/quartz/GlobalQuartzScheduler.java#L96-L100 | train |
phax/ph-schedule | ph-schedule/src/main/java/com/helger/schedule/quartz/GlobalQuartzScheduler.java | GlobalQuartzScheduler.addJobListener | public void addJobListener (@Nonnull final IJobListener aJobListener)
{
ValueEnforcer.notNull (aJobListener, "JobListener");
try
{
m_aScheduler.getListenerManager ().addJobListener (aJobListener, EverythingMatcher.allJobs ());
}
catch (final SchedulerException ex)
{
throw new IllegalStateException ("Failed to add job listener " + aJobListener.toString (), ex);
}
} | java | public void addJobListener (@Nonnull final IJobListener aJobListener)
{
ValueEnforcer.notNull (aJobListener, "JobListener");
try
{
m_aScheduler.getListenerManager ().addJobListener (aJobListener, EverythingMatcher.allJobs ());
}
catch (final SchedulerException ex)
{
throw new IllegalStateException ("Failed to add job listener " + aJobListener.toString (), ex);
}
} | [
"public",
"void",
"addJobListener",
"(",
"@",
"Nonnull",
"final",
"IJobListener",
"aJobListener",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aJobListener",
",",
"\"JobListener\"",
")",
";",
"try",
"{",
"m_aScheduler",
".",
"getListenerManager",
"(",
")",
"... | Add a job listener for all jobs.
@param aJobListener
The job listener to be added. May not be <code>null</code>. | [
"Add",
"a",
"job",
"listener",
"for",
"all",
"jobs",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-schedule/src/main/java/com/helger/schedule/quartz/GlobalQuartzScheduler.java#L108-L120 | train |
phax/ph-schedule | ph-schedule/src/main/java/com/helger/schedule/quartz/GlobalQuartzScheduler.java | GlobalQuartzScheduler.scheduleJob | @Nonnull
public TriggerKey scheduleJob (@Nonnull final String sJobName,
@Nonnull final JDK8TriggerBuilder <? extends ITrigger> aTriggerBuilder,
@Nonnull final Class <? extends IJob> aJobClass,
@Nullable final Map <String, ? extends Object> aJobData)
{
ValueEnforcer.notNull (sJobName, "JobName");
ValueEnforcer.notNull (aTriggerBuilder, "TriggerBuilder");
ValueEnforcer.notNull (aJobClass, "JobClass");
// what to do
final IJobDetail aJobDetail = JobBuilder.newJob (aJobClass).withIdentity (sJobName, m_sGroupName).build ();
// add custom parameters
aJobDetail.getJobDataMap ().putAllIn (aJobData);
try
{
// Schedule now
final ITrigger aTrigger = aTriggerBuilder.build ();
m_aScheduler.scheduleJob (aJobDetail, aTrigger);
final TriggerKey ret = aTrigger.getKey ();
LOGGER.info ("Succesfully scheduled job '" +
sJobName +
"' with TriggerKey " +
ret.toString () +
" - starting at " +
PDTFactory.createLocalDateTime (aTrigger.getStartTime ()));
return ret;
}
catch (final SchedulerException ex)
{
throw new RuntimeException (ex);
}
} | java | @Nonnull
public TriggerKey scheduleJob (@Nonnull final String sJobName,
@Nonnull final JDK8TriggerBuilder <? extends ITrigger> aTriggerBuilder,
@Nonnull final Class <? extends IJob> aJobClass,
@Nullable final Map <String, ? extends Object> aJobData)
{
ValueEnforcer.notNull (sJobName, "JobName");
ValueEnforcer.notNull (aTriggerBuilder, "TriggerBuilder");
ValueEnforcer.notNull (aJobClass, "JobClass");
// what to do
final IJobDetail aJobDetail = JobBuilder.newJob (aJobClass).withIdentity (sJobName, m_sGroupName).build ();
// add custom parameters
aJobDetail.getJobDataMap ().putAllIn (aJobData);
try
{
// Schedule now
final ITrigger aTrigger = aTriggerBuilder.build ();
m_aScheduler.scheduleJob (aJobDetail, aTrigger);
final TriggerKey ret = aTrigger.getKey ();
LOGGER.info ("Succesfully scheduled job '" +
sJobName +
"' with TriggerKey " +
ret.toString () +
" - starting at " +
PDTFactory.createLocalDateTime (aTrigger.getStartTime ()));
return ret;
}
catch (final SchedulerException ex)
{
throw new RuntimeException (ex);
}
} | [
"@",
"Nonnull",
"public",
"TriggerKey",
"scheduleJob",
"(",
"@",
"Nonnull",
"final",
"String",
"sJobName",
",",
"@",
"Nonnull",
"final",
"JDK8TriggerBuilder",
"<",
"?",
"extends",
"ITrigger",
">",
"aTriggerBuilder",
",",
"@",
"Nonnull",
"final",
"Class",
"<",
... | This method is only for testing purposes.
@param sJobName
Name of the job. Needs to be unique since no two job details with
the same name may exist.
@param aTriggerBuilder
The trigger builder instance to schedule the job
@param aJobClass
Class to execute
@param aJobData
Additional parameters. May be <code>null</code>.
@return The created trigger key for further usage. Never <code>null</code>. | [
"This",
"method",
"is",
"only",
"for",
"testing",
"purposes",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-schedule/src/main/java/com/helger/schedule/quartz/GlobalQuartzScheduler.java#L145-L180 | train |
phax/ph-schedule | ph-schedule/src/main/java/com/helger/schedule/quartz/GlobalQuartzScheduler.java | GlobalQuartzScheduler.scheduleJobNowOnce | @Nonnull
public TriggerKey scheduleJobNowOnce (@Nonnull final String sJobName,
@Nonnull final Class <? extends IJob> aJobClass,
@Nullable final Map <String, ? extends Object> aJobData)
{
return scheduleJob (sJobName,
JDK8TriggerBuilder.newTrigger ()
.startNow ()
.withSchedule (SimpleScheduleBuilder.simpleSchedule ()
.withIntervalInMinutes (1)
.withRepeatCount (0)),
aJobClass,
aJobData);
} | java | @Nonnull
public TriggerKey scheduleJobNowOnce (@Nonnull final String sJobName,
@Nonnull final Class <? extends IJob> aJobClass,
@Nullable final Map <String, ? extends Object> aJobData)
{
return scheduleJob (sJobName,
JDK8TriggerBuilder.newTrigger ()
.startNow ()
.withSchedule (SimpleScheduleBuilder.simpleSchedule ()
.withIntervalInMinutes (1)
.withRepeatCount (0)),
aJobClass,
aJobData);
} | [
"@",
"Nonnull",
"public",
"TriggerKey",
"scheduleJobNowOnce",
"(",
"@",
"Nonnull",
"final",
"String",
"sJobName",
",",
"@",
"Nonnull",
"final",
"Class",
"<",
"?",
"extends",
"IJob",
">",
"aJobClass",
",",
"@",
"Nullable",
"final",
"Map",
"<",
"String",
",",
... | Schedule a new job that should be executed now and only once.
@param sJobName
Name of the job - must be unique within the whole system!
@param aJobClass
The Job class to be executed.
@param aJobData
Optional job data map.
@return The created trigger key for further usage. Never <code>null</code>. | [
"Schedule",
"a",
"new",
"job",
"that",
"should",
"be",
"executed",
"now",
"and",
"only",
"once",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-schedule/src/main/java/com/helger/schedule/quartz/GlobalQuartzScheduler.java#L193-L206 | train |
phax/ph-schedule | ph-schedule/src/main/java/com/helger/schedule/quartz/GlobalQuartzScheduler.java | GlobalQuartzScheduler.shutdown | public void shutdown () throws SchedulerException
{
try
{
// Shutdown but wait for jobs to complete
m_aScheduler.shutdown (true);
LOGGER.info ("Successfully shutdown GlobalQuartzScheduler");
}
catch (final SchedulerException ex)
{
LOGGER.error ("Failed to shutdown GlobalQuartzScheduler", ex);
throw ex;
}
} | java | public void shutdown () throws SchedulerException
{
try
{
// Shutdown but wait for jobs to complete
m_aScheduler.shutdown (true);
LOGGER.info ("Successfully shutdown GlobalQuartzScheduler");
}
catch (final SchedulerException ex)
{
LOGGER.error ("Failed to shutdown GlobalQuartzScheduler", ex);
throw ex;
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"throws",
"SchedulerException",
"{",
"try",
"{",
"// Shutdown but wait for jobs to complete",
"m_aScheduler",
".",
"shutdown",
"(",
"true",
")",
";",
"LOGGER",
".",
"info",
"(",
"\"Successfully shutdown GlobalQuartzScheduler\"",
"... | Shutdown the scheduler and wait for all jobs to complete.
@throws SchedulerException
If something goes wrong | [
"Shutdown",
"the",
"scheduler",
"and",
"wait",
"for",
"all",
"jobs",
"to",
"complete",
"."
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-schedule/src/main/java/com/helger/schedule/quartz/GlobalQuartzScheduler.java#L284-L297 | train |
cwilper/fcrepo-misc | fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/DefaultContentResolver.java | DefaultContentResolver.setHttpClient | public void setHttpClient(HttpClient httpClient) {
if (httpClient != defaultHttpClient
&& this.httpClient == defaultHttpClient) {
defaultHttpClient.getConnectionManager().shutdown();
}
this.httpClient = httpClient;
} | java | public void setHttpClient(HttpClient httpClient) {
if (httpClient != defaultHttpClient
&& this.httpClient == defaultHttpClient) {
defaultHttpClient.getConnectionManager().shutdown();
}
this.httpClient = httpClient;
} | [
"public",
"void",
"setHttpClient",
"(",
"HttpClient",
"httpClient",
")",
"{",
"if",
"(",
"httpClient",
"!=",
"defaultHttpClient",
"&&",
"this",
".",
"httpClient",
"==",
"defaultHttpClient",
")",
"{",
"defaultHttpClient",
".",
"getConnectionManager",
"(",
")",
".",... | Sets the HTTP client. If the new client is different from the default,
and the default is still in use, it will be automatically closed.
@param httpClient the new value, never <code>null</code>. | [
"Sets",
"the",
"HTTP",
"client",
".",
"If",
"the",
"new",
"client",
"is",
"different",
"from",
"the",
"default",
"and",
"the",
"default",
"is",
"still",
"in",
"use",
"it",
"will",
"be",
"automatically",
"closed",
"."
] | 3ed0e7025c5b1d4faaa373b699be229ed72465b6 | https://github.com/cwilper/fcrepo-misc/blob/3ed0e7025c5b1d4faaa373b699be229ed72465b6/fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/DefaultContentResolver.java#L44-L50 | train |
cwilper/fcrepo-misc | fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/XMLUtil.java | XMLUtil.closeQuietly | public static void closeQuietly(XMLStreamWriter writer) {
if (writer != null) {
try {
writer.close();
} catch (XMLStreamException e) {
logger.warn("Error while closing", e);
}
}
} | java | public static void closeQuietly(XMLStreamWriter writer) {
if (writer != null) {
try {
writer.close();
} catch (XMLStreamException e) {
logger.warn("Error while closing", e);
}
}
} | [
"public",
"static",
"void",
"closeQuietly",
"(",
"XMLStreamWriter",
"writer",
")",
"{",
"if",
"(",
"writer",
"!=",
"null",
")",
"{",
"try",
"{",
"writer",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"XMLStreamException",
"e",
")",
"{",
"logger",
".... | Closes the given writer without throwing an exception on failure.
Instead, a warning will be logged.
@param writer the writer to close. | [
"Closes",
"the",
"given",
"writer",
"without",
"throwing",
"an",
"exception",
"on",
"failure",
".",
"Instead",
"a",
"warning",
"will",
"be",
"logged",
"."
] | 3ed0e7025c5b1d4faaa373b699be229ed72465b6 | https://github.com/cwilper/fcrepo-misc/blob/3ed0e7025c5b1d4faaa373b699be229ed72465b6/fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/XMLUtil.java#L159-L167 | train |
cwilper/fcrepo-misc | fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/XMLUtil.java | XMLUtil.closeQuietly | public static void closeQuietly(XMLStreamReader reader) {
if (reader != null) {
try {
reader.close();
} catch (XMLStreamException e) {
logger.warn("Error while closing", e);
}
}
} | java | public static void closeQuietly(XMLStreamReader reader) {
if (reader != null) {
try {
reader.close();
} catch (XMLStreamException e) {
logger.warn("Error while closing", e);
}
}
} | [
"public",
"static",
"void",
"closeQuietly",
"(",
"XMLStreamReader",
"reader",
")",
"{",
"if",
"(",
"reader",
"!=",
"null",
")",
"{",
"try",
"{",
"reader",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"XMLStreamException",
"e",
")",
"{",
"logger",
".... | Closes the given reader without throwing an exception on failure.
Instead, a warning will be logged.
@param reader the writer to close. | [
"Closes",
"the",
"given",
"reader",
"without",
"throwing",
"an",
"exception",
"on",
"failure",
".",
"Instead",
"a",
"warning",
"will",
"be",
"logged",
"."
] | 3ed0e7025c5b1d4faaa373b699be229ed72465b6 | https://github.com/cwilper/fcrepo-misc/blob/3ed0e7025c5b1d4faaa373b699be229ed72465b6/fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/XMLUtil.java#L175-L183 | train |
cwilper/fcrepo-misc | fcrepo-httpclient/src/main/java/com/github/cwilper/fcrepo/httpclient/HttpUtil.java | HttpUtil.get | public static InputStream get(HttpClient httpClient,
URI requestURI) throws IOException {
HttpEntity entity = doGet(httpClient, requestURI);
if (entity == null) {
return new ByteArrayInputStream(new byte[0]);
}
return entity.getContent();
} | java | public static InputStream get(HttpClient httpClient,
URI requestURI) throws IOException {
HttpEntity entity = doGet(httpClient, requestURI);
if (entity == null) {
return new ByteArrayInputStream(new byte[0]);
}
return entity.getContent();
} | [
"public",
"static",
"InputStream",
"get",
"(",
"HttpClient",
"httpClient",
",",
"URI",
"requestURI",
")",
"throws",
"IOException",
"{",
"HttpEntity",
"entity",
"=",
"doGet",
"(",
"httpClient",
",",
"requestURI",
")",
";",
"if",
"(",
"entity",
"==",
"null",
"... | Performs an HTTP GET using the given client, returning an input stream
over the response body. The caller MUST close the stream when finished.
@param httpClient the client to use.
@param requestURI the http or https url.
@return an input stream over the response body.
@throws IOException if the request fails for any reason, including
a non-200 status code. | [
"Performs",
"an",
"HTTP",
"GET",
"using",
"the",
"given",
"client",
"returning",
"an",
"input",
"stream",
"over",
"the",
"response",
"body",
".",
"The",
"caller",
"MUST",
"close",
"the",
"stream",
"when",
"finished",
"."
] | 3ed0e7025c5b1d4faaa373b699be229ed72465b6 | https://github.com/cwilper/fcrepo-misc/blob/3ed0e7025c5b1d4faaa373b699be229ed72465b6/fcrepo-httpclient/src/main/java/com/github/cwilper/fcrepo/httpclient/HttpUtil.java#L52-L59 | train |
cwilper/fcrepo-misc | fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/DefaultContentHandler.java | DefaultContentHandler.baseDir | private File baseDir() throws IOException {
if (baseDir == null) {
baseDir = File.createTempFile("fcrepo-dto", null);
if (!baseDir.delete()) {
throw new IOException("Can't delete temp file " + baseDir);
}
if (!baseDir.mkdir()) {
throw new IOException("Can't create temp dir " + baseDir);
}
}
return baseDir;
} | java | private File baseDir() throws IOException {
if (baseDir == null) {
baseDir = File.createTempFile("fcrepo-dto", null);
if (!baseDir.delete()) {
throw new IOException("Can't delete temp file " + baseDir);
}
if (!baseDir.mkdir()) {
throw new IOException("Can't create temp dir " + baseDir);
}
}
return baseDir;
} | [
"private",
"File",
"baseDir",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"baseDir",
"==",
"null",
")",
"{",
"baseDir",
"=",
"File",
".",
"createTempFile",
"(",
"\"fcrepo-dto\"",
",",
"null",
")",
";",
"if",
"(",
"!",
"baseDir",
".",
"delete",
"... | allocates the temporary base directory lazily | [
"allocates",
"the",
"temporary",
"base",
"directory",
"lazily"
] | 3ed0e7025c5b1d4faaa373b699be229ed72465b6 | https://github.com/cwilper/fcrepo-misc/blob/3ed0e7025c5b1d4faaa373b699be229ed72465b6/fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/DefaultContentHandler.java#L112-L123 | train |
cwilper/fcrepo-misc | fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/DefaultContentHandler.java | DefaultContentHandler.rmDir | private static void rmDir(File dir) {
for (File file: dir.listFiles()) {
if (file.isDirectory()) {
rmDir(file);
} else {
if (!file.delete()) {
logger.warn("Can't delete file " + file);
}
}
}
if (!dir.delete()) {
logger.warn("Can't delete dir " + dir);
}
} | java | private static void rmDir(File dir) {
for (File file: dir.listFiles()) {
if (file.isDirectory()) {
rmDir(file);
} else {
if (!file.delete()) {
logger.warn("Can't delete file " + file);
}
}
}
if (!dir.delete()) {
logger.warn("Can't delete dir " + dir);
}
} | [
"private",
"static",
"void",
"rmDir",
"(",
"File",
"dir",
")",
"{",
"for",
"(",
"File",
"file",
":",
"dir",
".",
"listFiles",
"(",
")",
")",
"{",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"rmDir",
"(",
"file",
")",
";",
"}",
"e... | recursively remove a directory, logging warnings if needed. | [
"recursively",
"remove",
"a",
"directory",
"logging",
"warnings",
"if",
"needed",
"."
] | 3ed0e7025c5b1d4faaa373b699be229ed72465b6 | https://github.com/cwilper/fcrepo-misc/blob/3ed0e7025c5b1d4faaa373b699be229ed72465b6/fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/DefaultContentHandler.java#L134-L147 | train |
cwilper/fcrepo-misc | fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/ContentHandlingDTOReader.java | ContentHandlingDTOReader.setContentHandler | public void setContentHandler(ContentHandler contentHandler) {
if (contentHandler == null) throw new NullPointerException();
if (contentHandler != defaultContentHandler
&& this.contentHandler == defaultContentHandler) {
defaultContentHandler.close();
}
} | java | public void setContentHandler(ContentHandler contentHandler) {
if (contentHandler == null) throw new NullPointerException();
if (contentHandler != defaultContentHandler
&& this.contentHandler == defaultContentHandler) {
defaultContentHandler.close();
}
} | [
"public",
"void",
"setContentHandler",
"(",
"ContentHandler",
"contentHandler",
")",
"{",
"if",
"(",
"contentHandler",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"if",
"(",
"contentHandler",
"!=",
"defaultContentHandler",
"&&",
"this... | Sets the content handler. If the new content handler is different
from the default, and the default is still in use, it will be
automatically closed.
@param contentHandler the new value, never <code>null</code>.
@throws NullPointerException if the value is null. | [
"Sets",
"the",
"content",
"handler",
".",
"If",
"the",
"new",
"content",
"handler",
"is",
"different",
"from",
"the",
"default",
"and",
"the",
"default",
"is",
"still",
"in",
"use",
"it",
"will",
"be",
"automatically",
"closed",
"."
] | 3ed0e7025c5b1d4faaa373b699be229ed72465b6 | https://github.com/cwilper/fcrepo-misc/blob/3ed0e7025c5b1d4faaa373b699be229ed72465b6/fcrepo-dto/fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io/ContentHandlingDTOReader.java#L34-L40 | train |
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/validationMapping11/ValidationMappingDescriptorImpl.java | ValidationMappingDescriptorImpl.getNamespaces | public List<String> getNamespaces()
{
List<String> namespaceList = new ArrayList<String>();
java.util.Map<String, String> attributes = model.getAttributes();
for (Entry<String, String> e : attributes.entrySet())
{
final String name = e.getKey();
final String value = e.getValue();
if (value != null && value.startsWith("http://"))
{
namespaceList.add(name + "=" + value);
}
}
return namespaceList;
} | java | public List<String> getNamespaces()
{
List<String> namespaceList = new ArrayList<String>();
java.util.Map<String, String> attributes = model.getAttributes();
for (Entry<String, String> e : attributes.entrySet())
{
final String name = e.getKey();
final String value = e.getValue();
if (value != null && value.startsWith("http://"))
{
namespaceList.add(name + "=" + value);
}
}
return namespaceList;
} | [
"public",
"List",
"<",
"String",
">",
"getNamespaces",
"(",
")",
"{",
"List",
"<",
"String",
">",
"namespaceList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attrib... | Returns all defined namespaces.
@return all defined namespaces | [
"Returns",
"all",
"defined",
"namespaces",
"."
] | cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/validationMapping11/ValidationMappingDescriptorImpl.java#L94-L108 | train |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/permutation/neigh/SingleSwapNeighbourhood.java | SingleSwapNeighbourhood.getRandomMove | @Override
public SingleSwapMove getRandomMove(PermutationSolution solution, Random rnd) {
int n = solution.size();
// check: move possible
if(n < 2){
return null;
}
// pick two random, distinct positions to swap
int i = rnd.nextInt(n);
int j = rnd.nextInt(n-1);
if(j >= i){
j++;
}
// generate swap move
return new SingleSwapMove(i, j);
} | java | @Override
public SingleSwapMove getRandomMove(PermutationSolution solution, Random rnd) {
int n = solution.size();
// check: move possible
if(n < 2){
return null;
}
// pick two random, distinct positions to swap
int i = rnd.nextInt(n);
int j = rnd.nextInt(n-1);
if(j >= i){
j++;
}
// generate swap move
return new SingleSwapMove(i, j);
} | [
"@",
"Override",
"public",
"SingleSwapMove",
"getRandomMove",
"(",
"PermutationSolution",
"solution",
",",
"Random",
"rnd",
")",
"{",
"int",
"n",
"=",
"solution",
".",
"size",
"(",
")",
";",
"// check: move possible",
"if",
"(",
"n",
"<",
"2",
")",
"{",
"r... | Create a random single swap move.
@param solution permutation solution to which the move is to be applied
@param rnd source of randomness used to generate random move
@return random swap move, <code>null</code> if the permutation contains
less than 2 items | [
"Create",
"a",
"random",
"single",
"swap",
"move",
"."
] | 37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2 | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/permutation/neigh/SingleSwapNeighbourhood.java#L41-L56 | train |
DaGeRe/KoPeMe | kopeme-core/src/main/java/de/dagere/kopeme/PerformanceKoPeMeStatement.java | PerformanceKoPeMeStatement.evaluate | public final void evaluate() throws IllegalAccessException, InvocationTargetException {
if (simple) tr.startCollection();
fTestMethod.invoke(fTarget, params);
if (simple) tr.stopCollection();
} | java | public final void evaluate() throws IllegalAccessException, InvocationTargetException {
if (simple) tr.startCollection();
fTestMethod.invoke(fTarget, params);
if (simple) tr.stopCollection();
} | [
"public",
"final",
"void",
"evaluate",
"(",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"if",
"(",
"simple",
")",
"tr",
".",
"startCollection",
"(",
")",
";",
"fTestMethod",
".",
"invoke",
"(",
"fTarget",
",",
"params",
")",... | Evaluates the statement, i.e. executes the tests.
@throws IllegalAccessException Thrown if access to the testmethod is illegal
@throws InvocationTargetException Thrown if an exception occurs during invocation | [
"Evaluates",
"the",
"statement",
"i",
".",
"e",
".",
"executes",
"the",
"tests",
"."
] | a4939113cba73cb20a2c7d6dc8d34d0139a3e340 | https://github.com/DaGeRe/KoPeMe/blob/a4939113cba73cb20a2c7d6dc8d34d0139a3e340/kopeme-core/src/main/java/de/dagere/kopeme/PerformanceKoPeMeStatement.java#L45-L49 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/net/Telefonnummer.java | Telefonnummer.getInlandsnummer | public Telefonnummer getInlandsnummer() {
if (getLaenderkennzahl().isPresent()) {
String nummer = this.getCode().substring(3).trim();
if (StringUtils.startsWithAny(nummer, "1", "2", "3", "4", "5", "6", "7", "8", "9")) {
nummer = "0" + nummer;
}
return new Telefonnummer(nummer);
} else {
return this;
}
} | java | public Telefonnummer getInlandsnummer() {
if (getLaenderkennzahl().isPresent()) {
String nummer = this.getCode().substring(3).trim();
if (StringUtils.startsWithAny(nummer, "1", "2", "3", "4", "5", "6", "7", "8", "9")) {
nummer = "0" + nummer;
}
return new Telefonnummer(nummer);
} else {
return this;
}
} | [
"public",
"Telefonnummer",
"getInlandsnummer",
"(",
")",
"{",
"if",
"(",
"getLaenderkennzahl",
"(",
")",
".",
"isPresent",
"(",
")",
")",
"{",
"String",
"nummer",
"=",
"this",
".",
"getCode",
"(",
")",
".",
"substring",
"(",
"3",
")",
".",
"trim",
"(",... | Liefert die Telefonnummer ohne Laenderkennzahl, dafuer mit Vorwahl
inklusive fuehrender Null.
@return z.B. 0811/32168 | [
"Liefert",
"die",
"Telefonnummer",
"ohne",
"Laenderkennzahl",
"dafuer",
"mit",
"Vorwahl",
"inklusive",
"fuehrender",
"Null",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/net/Telefonnummer.java#L115-L125 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/net/Telefonnummer.java | Telefonnummer.getRufnummer | public Telefonnummer getRufnummer() {
String inlandsnummer = RegExUtils.replaceAll(this.getInlandsnummer().toString(), "[ /]+", " ");
return new Telefonnummer(StringUtils.substringAfter(inlandsnummer, " ").replaceAll(" ", ""));
} | java | public Telefonnummer getRufnummer() {
String inlandsnummer = RegExUtils.replaceAll(this.getInlandsnummer().toString(), "[ /]+", " ");
return new Telefonnummer(StringUtils.substringAfter(inlandsnummer, " ").replaceAll(" ", ""));
} | [
"public",
"Telefonnummer",
"getRufnummer",
"(",
")",
"{",
"String",
"inlandsnummer",
"=",
"RegExUtils",
".",
"replaceAll",
"(",
"this",
".",
"getInlandsnummer",
"(",
")",
".",
"toString",
"(",
")",
",",
"\"[ /]+\"",
",",
"\" \"",
")",
";",
"return",
"new",
... | Liefert die Nummer der Ortsvermittlungsstelle, d.h. die Telefonnummer
ohne Vorwahl und Laenderkennzahl.
@return z.B. "32168" | [
"Liefert",
"die",
"Nummer",
"der",
"Ortsvermittlungsstelle",
"d",
".",
"h",
".",
"die",
"Telefonnummer",
"ohne",
"Vorwahl",
"und",
"Laenderkennzahl",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/net/Telefonnummer.java#L172-L175 | train |
oboehm/jfachwert | src/main/java/de/jfachwert/net/Telefonnummer.java | Telefonnummer.toDinString | public String toDinString() {
Optional<String> laenderkennzahl = getLaenderkennzahl();
return laenderkennzahl.map(s -> s + " " + getVorwahl().substring(1) + " " + getRufnummer()).orElseGet(
() -> getVorwahl() + " " + getRufnummer());
} | java | public String toDinString() {
Optional<String> laenderkennzahl = getLaenderkennzahl();
return laenderkennzahl.map(s -> s + " " + getVorwahl().substring(1) + " " + getRufnummer()).orElseGet(
() -> getVorwahl() + " " + getRufnummer());
} | [
"public",
"String",
"toDinString",
"(",
")",
"{",
"Optional",
"<",
"String",
">",
"laenderkennzahl",
"=",
"getLaenderkennzahl",
"(",
")",
";",
"return",
"laenderkennzahl",
".",
"map",
"(",
"s",
"->",
"s",
"+",
"\" \"",
"+",
"getVorwahl",
"(",
")",
".",
"... | Gibt den String nach DIN 5008 aus. Die Nummern werden dabei
funktionsbezogen durch Leerzeichen und die Durchwahl mit Bindestrich
abgetrennt.
@return z.B. "+49 30 12345-67" bzw. "030 12345-67" | [
"Gibt",
"den",
"String",
"nach",
"DIN",
"5008",
"aus",
".",
"Die",
"Nummern",
"werden",
"dabei",
"funktionsbezogen",
"durch",
"Leerzeichen",
"und",
"die",
"Durchwahl",
"mit",
"Bindestrich",
"abgetrennt",
"."
] | 67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/net/Telefonnummer.java#L221-L225 | train |
davidcarboni/restolino | src/main/java/com/github/davidcarboni/restolino/helpers/QueryString.java | QueryString.toQueryString | public String toQueryString() {
String result = null;
List<String> parameters = new ArrayList<>();
for (Map.Entry<String, String> entry : entrySet()) {
// We don't encode the key because it could legitimately contain
// things like underscores, e.g. "_escaped_fragment_" would become:
// "%5Fescaped%5Ffragment%5F"
String key = entry.getKey();
String value;
try {
value = URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException("Error encoding URL", e);
}
// Jetty class *appears* to need Java 8
//String value = UrlEncoded.encodeString(entry.getValue());
parameters.add(key + "=" + value);
}
if (parameters.size() > 0) {
result = StringUtils.join(parameters, '&');
}
return result;
} | java | public String toQueryString() {
String result = null;
List<String> parameters = new ArrayList<>();
for (Map.Entry<String, String> entry : entrySet()) {
// We don't encode the key because it could legitimately contain
// things like underscores, e.g. "_escaped_fragment_" would become:
// "%5Fescaped%5Ffragment%5F"
String key = entry.getKey();
String value;
try {
value = URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException("Error encoding URL", e);
}
// Jetty class *appears* to need Java 8
//String value = UrlEncoded.encodeString(entry.getValue());
parameters.add(key + "=" + value);
}
if (parameters.size() > 0) {
result = StringUtils.join(parameters, '&');
}
return result;
} | [
"public",
"String",
"toQueryString",
"(",
")",
"{",
"String",
"result",
"=",
"null",
";",
"List",
"<",
"String",
">",
"parameters",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"ent... | A value suitable for constructinng URIs with. This means that if there
are no parameters, null will be returned.
@return If the map is empty, null, otherwise an escaped query string. | [
"A",
"value",
"suitable",
"for",
"constructinng",
"URIs",
"with",
".",
"This",
"means",
"that",
"if",
"there",
"are",
"no",
"parameters",
"null",
"will",
"be",
"returned",
"."
] | 3f84ece1bd016fbb597c624d46fcca5a2580a33d | https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/helpers/QueryString.java#L72-L97 | train |
kyoken74/gwt-angular | gwt-angular-prettify/src/main/java/com/asayama/gwt/angular/prettify/client/directive/Prettyprint.java | Prettyprint.compile | @Override
public void compile(JQElement element, JSON attrs) {
String text = SafeHtmlUtils.htmlEscape(element.text());
element.empty().append(prettifier.prettify(text));
} | java | @Override
public void compile(JQElement element, JSON attrs) {
String text = SafeHtmlUtils.htmlEscape(element.text());
element.empty().append(prettifier.prettify(text));
} | [
"@",
"Override",
"public",
"void",
"compile",
"(",
"JQElement",
"element",
",",
"JSON",
"attrs",
")",
"{",
"String",
"text",
"=",
"SafeHtmlUtils",
".",
"htmlEscape",
"(",
"element",
".",
"text",
"(",
")",
")",
";",
"element",
".",
"empty",
"(",
")",
".... | Processes the element body using Prettify filter. | [
"Processes",
"the",
"element",
"body",
"using",
"Prettify",
"filter",
"."
] | 99a6efa277dd4771d9cba976b25fdf0ac4fdeca2 | https://github.com/kyoken74/gwt-angular/blob/99a6efa277dd4771d9cba976b25fdf0ac4fdeca2/gwt-angular-prettify/src/main/java/com/asayama/gwt/angular/prettify/client/directive/Prettyprint.java#L30-L34 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/consumers/OneElement.java | OneElement.apply | @Override
public E apply(Iterator<E> consumable) {
dbc.precondition(consumable != null, "consuming a null iterator");
dbc.precondition(consumable.hasNext(), "no element to consume");
final E found = consumable.next();
dbc.state(!consumable.hasNext(), "found more than one element consuming the iterator");
return found;
} | java | @Override
public E apply(Iterator<E> consumable) {
dbc.precondition(consumable != null, "consuming a null iterator");
dbc.precondition(consumable.hasNext(), "no element to consume");
final E found = consumable.next();
dbc.state(!consumable.hasNext(), "found more than one element consuming the iterator");
return found;
} | [
"@",
"Override",
"public",
"E",
"apply",
"(",
"Iterator",
"<",
"E",
">",
"consumable",
")",
"{",
"dbc",
".",
"precondition",
"(",
"consumable",
"!=",
"null",
",",
"\"consuming a null iterator\"",
")",
";",
"dbc",
".",
"precondition",
"(",
"consumable",
".",
... | Consumes the iterator and yields the only element contained in it.
@param consumable the iterator to be consumed
@throws IllegalArgumentException if the source iterator is empty
@throws IllegalStateException if the source iterator contains more than
one element
@return the only element contained in the iterator | [
"Consumes",
"the",
"iterator",
"and",
"yields",
"the",
"only",
"element",
"contained",
"in",
"it",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/consumers/OneElement.java#L25-L32 | train |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Pagination.java | Pagination.page | public static <T> Pair<Integer, List<T>> page(long start, long howMany, Iterator<T> iterator) {
final Pair<Long, List<T>> page = Pagination.LongPages.page(start, howMany, iterator);
dbc.state(page.first() <= Integer.MAX_VALUE, "iterator size overflows an integer");
return Pair.of(page.first().intValue(), page.second());
} | java | public static <T> Pair<Integer, List<T>> page(long start, long howMany, Iterator<T> iterator) {
final Pair<Long, List<T>> page = Pagination.LongPages.page(start, howMany, iterator);
dbc.state(page.first() <= Integer.MAX_VALUE, "iterator size overflows an integer");
return Pair.of(page.first().intValue(), page.second());
} | [
"public",
"static",
"<",
"T",
">",
"Pair",
"<",
"Integer",
",",
"List",
"<",
"T",
">",
">",
"page",
"(",
"long",
"start",
",",
"long",
"howMany",
",",
"Iterator",
"<",
"T",
">",
"iterator",
")",
"{",
"final",
"Pair",
"<",
"Long",
",",
"List",
"<"... | Creates a page view of an iterator.
@param <T> the element type parameter
@param start the index where the page starts
@param howMany the page size
@param iterator the iterator to be sliced
@return a pair containing the iterator size and the requested page | [
"Creates",
"a",
"page",
"view",
"of",
"an",
"iterator",
"."
] | 98115a436e35335c5e8831f9fdc12f6d93d524be | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Pagination.java#L28-L32 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.