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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Bedework/bw-util | bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/ConfiguredXSLTFilter.java | ConfiguredXSLTFilter.tryPath | private boolean tryPath(StringBuilder prefix, String el, boolean dir) {
String path = prefix + "/" + el;
if (dir && directoryBrowsingDisallowed) {
path += "/" + xsltdirMarkerName;
}
if (debug()) {
debug("trypath: " + path);
}
try {
URL u = new URL(path);
URLConnection... | java | private boolean tryPath(StringBuilder prefix, String el, boolean dir) {
String path = prefix + "/" + el;
if (dir && directoryBrowsingDisallowed) {
path += "/" + xsltdirMarkerName;
}
if (debug()) {
debug("trypath: " + path);
}
try {
URL u = new URL(path);
URLConnection... | [
"private",
"boolean",
"tryPath",
"(",
"StringBuilder",
"prefix",
",",
"String",
"el",
",",
"boolean",
"dir",
")",
"{",
"String",
"path",
"=",
"prefix",
"+",
"\"/\"",
"+",
"el",
";",
"if",
"(",
"dir",
"&&",
"directoryBrowsingDisallowed",
")",
"{",
"path",
... | Try a path and see if it exists. If so append the element
@param prefix StringBuilder current path prefix
@param el String path element to append
@param dir true if el is a directory
@return boolean true if path is OK | [
"Try",
"a",
"path",
"and",
"see",
"if",
"it",
"exists",
".",
"If",
"so",
"append",
"the",
"element"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/ConfiguredXSLTFilter.java#L539-L577 | train |
sebastiangraf/treetank | thesismodules/integrity/src/main/java/org/treetank/bench/BenchUtils.java | BenchUtils.createDatas | public static final DumbData[][] createDatas(final int[] pDatasPerRevision) {
final DumbData[][] returnVal = new DumbData[pDatasPerRevision.length][];
for (int i = 0; i < pDatasPerRevision.length; i++) {
returnVal[i] = new DumbData[pDatasPerRevision[i]];
for (int j = 0; j < pData... | java | public static final DumbData[][] createDatas(final int[] pDatasPerRevision) {
final DumbData[][] returnVal = new DumbData[pDatasPerRevision.length][];
for (int i = 0; i < pDatasPerRevision.length; i++) {
returnVal[i] = new DumbData[pDatasPerRevision[i]];
for (int j = 0; j < pData... | [
"public",
"static",
"final",
"DumbData",
"[",
"]",
"[",
"]",
"createDatas",
"(",
"final",
"int",
"[",
"]",
"pDatasPerRevision",
")",
"{",
"final",
"DumbData",
"[",
"]",
"[",
"]",
"returnVal",
"=",
"new",
"DumbData",
"[",
"pDatasPerRevision",
".",
"length",... | Generating new data-elements passed on a given number of datas within a revision
@param pDatasPerRevision
denote the number of datas within all versions
@return a two-dimensional array containing the datas. | [
"Generating",
"new",
"data",
"-",
"elements",
"passed",
"on",
"a",
"given",
"number",
"of",
"datas",
"within",
"a",
"revision"
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/thesismodules/integrity/src/main/java/org/treetank/bench/BenchUtils.java#L37-L46 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/serialize/AbsSerializer.java | AbsSerializer.call | public Void call() throws TTException {
emitStartDocument();
long[] versionsToUse;
// if there are no versions specified, take the last one, of not version==0
if (mVersions.length == 0) {
if (mSession.getMostRecentVersion() > 0) {
versionsToUse = new long[] ... | java | public Void call() throws TTException {
emitStartDocument();
long[] versionsToUse;
// if there are no versions specified, take the last one, of not version==0
if (mVersions.length == 0) {
if (mSession.getMostRecentVersion() > 0) {
versionsToUse = new long[] ... | [
"public",
"Void",
"call",
"(",
")",
"throws",
"TTException",
"{",
"emitStartDocument",
"(",
")",
";",
"long",
"[",
"]",
"versionsToUse",
";",
"// if there are no versions specified, take the last one, of not version==0",
"if",
"(",
"mVersions",
".",
"length",
"==",
"0... | Serialize the storage.
@return null.
@throws TTException
if can't call serailzer | [
"Serialize",
"the",
"storage",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/serialize/AbsSerializer.java#L100-L198 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.getOneTaggedNode | public static Node getOneTaggedNode(final Node el,
final String name)
throws SAXException {
if (!el.hasChildNodes()) {
return null;
}
final NodeList children = el.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
final Node n ... | java | public static Node getOneTaggedNode(final Node el,
final String name)
throws SAXException {
if (!el.hasChildNodes()) {
return null;
}
final NodeList children = el.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
final Node n ... | [
"public",
"static",
"Node",
"getOneTaggedNode",
"(",
"final",
"Node",
"el",
",",
"final",
"String",
"name",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"!",
"el",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"final",
"NodeList... | Get the single named element.
@param el Node
@param name String tag name of required node
@return Node node value or null
@throws SAXException | [
"Get",
"the",
"single",
"named",
"element",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L123-L141 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.getOneNodeVal | public static String getOneNodeVal(final Node el, final String name)
throws SAXException {
/* We expect one child of type text */
if (!el.hasChildNodes()) {
return null;
}
NodeList children = el.getChildNodes();
if (children.getLength() > 1){
throw new SAXException("Multiple prop... | java | public static String getOneNodeVal(final Node el, final String name)
throws SAXException {
/* We expect one child of type text */
if (!el.hasChildNodes()) {
return null;
}
NodeList children = el.getChildNodes();
if (children.getLength() > 1){
throw new SAXException("Multiple prop... | [
"public",
"static",
"String",
"getOneNodeVal",
"(",
"final",
"Node",
"el",
",",
"final",
"String",
"name",
")",
"throws",
"SAXException",
"{",
"/* We expect one child of type text */",
"if",
"(",
"!",
"el",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"return",
"... | Get the value of an element. We expect 0 or 1 child nodes.
For no child node we return null, for more than one we raise an
exception.
@param el Node whose value we want
@param name String name to make exception messages more readable
@return String node value or null
@throws SAXException | [
"Get",
"the",
"value",
"of",
"an",
"element",
".",
"We",
"expect",
"0",
"or",
"1",
"child",
"nodes",
".",
"For",
"no",
"child",
"node",
"we",
"return",
"null",
"for",
"more",
"than",
"one",
"we",
"raise",
"an",
"exception",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L152-L167 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.getReqOneNodeVal | public static String getReqOneNodeVal(final Node el, final String name)
throws SAXException {
String str = getOneNodeVal(el, name);
if ((str == null) || (str.length() == 0)) {
throw new SAXException("Missing property value: " + name);
}
return str;
} | java | public static String getReqOneNodeVal(final Node el, final String name)
throws SAXException {
String str = getOneNodeVal(el, name);
if ((str == null) || (str.length() == 0)) {
throw new SAXException("Missing property value: " + name);
}
return str;
} | [
"public",
"static",
"String",
"getReqOneNodeVal",
"(",
"final",
"Node",
"el",
",",
"final",
"String",
"name",
")",
"throws",
"SAXException",
"{",
"String",
"str",
"=",
"getOneNodeVal",
"(",
"el",
",",
"name",
")",
";",
"if",
"(",
"(",
"str",
"==",
"null"... | Get the value of an element. We expect 1 child node otherwise we raise an
exception.
@param el Node whose value we want
@param name String name to make exception messages more readable
@return String node value
@throws SAXException | [
"Get",
"the",
"value",
"of",
"an",
"element",
".",
"We",
"expect",
"1",
"child",
"node",
"otherwise",
"we",
"raise",
"an",
"exception",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L189-L198 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.getAttrVal | public static String getAttrVal(final Element el, final String name)
throws SAXException {
Attr at = el.getAttributeNode(name);
if (at == null) {
return null;
}
return at.getValue();
} | java | public static String getAttrVal(final Element el, final String name)
throws SAXException {
Attr at = el.getAttributeNode(name);
if (at == null) {
return null;
}
return at.getValue();
} | [
"public",
"static",
"String",
"getAttrVal",
"(",
"final",
"Element",
"el",
",",
"final",
"String",
"name",
")",
"throws",
"SAXException",
"{",
"Attr",
"at",
"=",
"el",
".",
"getAttributeNode",
"(",
"name",
")",
";",
"if",
"(",
"at",
"==",
"null",
")",
... | Return the value of the named attribute of the given element.
@param el Element
@param name String name of desired attribute
@return String attribute value or null
@throws SAXException | [
"Return",
"the",
"value",
"of",
"the",
"named",
"attribute",
"of",
"the",
"given",
"element",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L218-L226 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.getReqAttrVal | public static String getReqAttrVal(final Element el, final String name)
throws SAXException {
String str = getAttrVal(el, name);
if ((str == null) || (str.length() == 0)) {
throw new SAXException("Missing attribute value: " + name);
}
return str;
} | java | public static String getReqAttrVal(final Element el, final String name)
throws SAXException {
String str = getAttrVal(el, name);
if ((str == null) || (str.length() == 0)) {
throw new SAXException("Missing attribute value: " + name);
}
return str;
} | [
"public",
"static",
"String",
"getReqAttrVal",
"(",
"final",
"Element",
"el",
",",
"final",
"String",
"name",
")",
"throws",
"SAXException",
"{",
"String",
"str",
"=",
"getAttrVal",
"(",
"el",
",",
"name",
")",
";",
"if",
"(",
"(",
"str",
"==",
"null",
... | Return the required value of the named attribute of the given element.
@param el Element
@param name String name of desired attribute
@return String attribute value
@throws SAXException | [
"Return",
"the",
"required",
"value",
"of",
"the",
"named",
"attribute",
"of",
"the",
"given",
"element",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L235-L244 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.getAttrVal | public static String getAttrVal(final NamedNodeMap nnm, final String name) {
Node nmAttr = nnm.getNamedItem(name);
if ((nmAttr == null) || (absent(nmAttr.getNodeValue()))) {
return null;
}
return nmAttr.getNodeValue();
} | java | public static String getAttrVal(final NamedNodeMap nnm, final String name) {
Node nmAttr = nnm.getNamedItem(name);
if ((nmAttr == null) || (absent(nmAttr.getNodeValue()))) {
return null;
}
return nmAttr.getNodeValue();
} | [
"public",
"static",
"String",
"getAttrVal",
"(",
"final",
"NamedNodeMap",
"nnm",
",",
"final",
"String",
"name",
")",
"{",
"Node",
"nmAttr",
"=",
"nnm",
".",
"getNamedItem",
"(",
"name",
")",
";",
"if",
"(",
"(",
"nmAttr",
"==",
"null",
")",
"||",
"(",... | Return the attribute value of the named attribute from the given map.
@param nnm NamedNodeMap
@param name String name of desired attribute
@return String attribute value or null | [
"Return",
"the",
"attribute",
"value",
"of",
"the",
"named",
"attribute",
"from",
"the",
"given",
"map",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L252-L260 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.getYesNoAttrVal | public static Boolean getYesNoAttrVal(final NamedNodeMap nnm, final String name)
throws SAXException {
String val = getAttrVal(nnm, name);
if (val == null) {
return null;
}
if ((!"yes".equals(val)) && (!"no".equals(val))) {
throw new SAXException("Invalid attribute value: " + val);
... | java | public static Boolean getYesNoAttrVal(final NamedNodeMap nnm, final String name)
throws SAXException {
String val = getAttrVal(nnm, name);
if (val == null) {
return null;
}
if ((!"yes".equals(val)) && (!"no".equals(val))) {
throw new SAXException("Invalid attribute value: " + val);
... | [
"public",
"static",
"Boolean",
"getYesNoAttrVal",
"(",
"final",
"NamedNodeMap",
"nnm",
",",
"final",
"String",
"name",
")",
"throws",
"SAXException",
"{",
"String",
"val",
"=",
"getAttrVal",
"(",
"nnm",
",",
"name",
")",
";",
"if",
"(",
"val",
"==",
"null"... | The attribute value of the named attribute in the given map must be
absent or "yes" or "no".
@param nnm NamedNodeMap
@param name String name of desired attribute
@return Boolean attribute value or null
@throws SAXException | [
"The",
"attribute",
"value",
"of",
"the",
"named",
"attribute",
"in",
"the",
"given",
"map",
"must",
"be",
"absent",
"or",
"yes",
"or",
"no",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L270-L283 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.getElements | public static List<Element> getElements(final Node nd) throws SAXException {
final List<Element> al = new ArrayList<>();
NodeList children = nd.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node curnode = children.item(i);
if (curnode.getNodeType() == Node.TEXT_NODE) {
... | java | public static List<Element> getElements(final Node nd) throws SAXException {
final List<Element> al = new ArrayList<>();
NodeList children = nd.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node curnode = children.item(i);
if (curnode.getNodeType() == Node.TEXT_NODE) {
... | [
"public",
"static",
"List",
"<",
"Element",
">",
"getElements",
"(",
"final",
"Node",
"nd",
")",
"throws",
"SAXException",
"{",
"final",
"List",
"<",
"Element",
">",
"al",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"NodeList",
"children",
"=",
"nd",
... | All the children must be elements or white space text nodes.
@param nd
@return Collection element nodes. Always non-null
@throws SAXException | [
"All",
"the",
"children",
"must",
"be",
"elements",
"or",
"white",
"space",
"text",
"nodes",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L305-L336 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.getElementContent | public static String getElementContent(final Element el,
final boolean trim) throws SAXException {
StringBuilder sb = new StringBuilder();
NodeList children = el.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node curnode = children.item(i)... | java | public static String getElementContent(final Element el,
final boolean trim) throws SAXException {
StringBuilder sb = new StringBuilder();
NodeList children = el.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node curnode = children.item(i)... | [
"public",
"static",
"String",
"getElementContent",
"(",
"final",
"Element",
"el",
",",
"final",
"boolean",
"trim",
")",
"throws",
"SAXException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"NodeList",
"children",
"=",
"el",
".",
... | Return the content for the current element. All leading and trailing
whitespace and embedded comments will be removed.
<p>This is only intended for an element with no child elements.
@param el
@param trim true to trim surrounding white-space
@return element content
@throws SAXException | [
"Return",
"the",
"content",
"for",
"the",
"current",
"element",
".",
"All",
"leading",
"and",
"trailing",
"whitespace",
"and",
"embedded",
"comments",
"will",
"be",
"removed",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L348-L374 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.setElementContent | public static void setElementContent(final Node n,
final String s) throws SAXException {
NodeList children = n.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node curnode = children.item(i);
n.removeChild(curnode);
}
Document d = n... | java | public static void setElementContent(final Node n,
final String s) throws SAXException {
NodeList children = n.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node curnode = children.item(i);
n.removeChild(curnode);
}
Document d = n... | [
"public",
"static",
"void",
"setElementContent",
"(",
"final",
"Node",
"n",
",",
"final",
"String",
"s",
")",
"throws",
"SAXException",
"{",
"NodeList",
"children",
"=",
"n",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"... | Replace the content for the current element.
@param n element
@param s string content
@throws SAXException | [
"Replace",
"the",
"content",
"for",
"the",
"current",
"element",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L382-L397 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.hasContent | public static boolean hasContent(final Element el) throws SAXException {
String s = getElementContent(el);
return (s != null) && (s.length() > 0);
} | java | public static boolean hasContent(final Element el) throws SAXException {
String s = getElementContent(el);
return (s != null) && (s.length() > 0);
} | [
"public",
"static",
"boolean",
"hasContent",
"(",
"final",
"Element",
"el",
")",
"throws",
"SAXException",
"{",
"String",
"s",
"=",
"getElementContent",
"(",
"el",
")",
";",
"return",
"(",
"s",
"!=",
"null",
")",
"&&",
"(",
"s",
".",
"length",
"(",
")"... | Return true if the current element has non zero length content.
@param el
@return boolean
@throws SAXException | [
"Return",
"true",
"if",
"the",
"current",
"element",
"has",
"non",
"zero",
"length",
"content",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L418-L422 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.hasChildren | public static boolean hasChildren(final Element el) throws SAXException {
NodeList children = el.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node curnode = children.item(i);
short ntype = curnode.getNodeType();
if ((ntype != Node.TEXT_NODE) &&
(ntype != Node.... | java | public static boolean hasChildren(final Element el) throws SAXException {
NodeList children = el.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node curnode = children.item(i);
short ntype = curnode.getNodeType();
if ((ntype != Node.TEXT_NODE) &&
(ntype != Node.... | [
"public",
"static",
"boolean",
"hasChildren",
"(",
"final",
"Element",
"el",
")",
"throws",
"SAXException",
"{",
"NodeList",
"children",
"=",
"el",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"... | See if this node has any children
@param el
@return boolean true for any child elements
@throws SAXException | [
"See",
"if",
"this",
"node",
"has",
"any",
"children"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L430-L445 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.nodeMatches | public static boolean nodeMatches(final Node nd, final QName tag) {
if (tag == null) {
return false;
}
String ns = nd.getNamespaceURI();
if (ns == null) {
/* It appears a node can have a NULL namespace but a QName has a zero length
*/
if ((tag.getNamespaceURI() != null) && (!"... | java | public static boolean nodeMatches(final Node nd, final QName tag) {
if (tag == null) {
return false;
}
String ns = nd.getNamespaceURI();
if (ns == null) {
/* It appears a node can have a NULL namespace but a QName has a zero length
*/
if ((tag.getNamespaceURI() != null) && (!"... | [
"public",
"static",
"boolean",
"nodeMatches",
"(",
"final",
"Node",
"nd",
",",
"final",
"QName",
"tag",
")",
"{",
"if",
"(",
"tag",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"String",
"ns",
"=",
"nd",
".",
"getNamespaceURI",
"(",
")",
";",... | See if node matches tag
@param nd
@param tag
@return boolean true for match | [
"See",
"if",
"node",
"matches",
"tag"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L474-L502 | train |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.fromNode | public static QName fromNode(final Node nd) {
String ns = nd.getNamespaceURI();
if (ns == null) {
/* It appears a node can have a NULL namespace but a QName has a zero length
*/
ns = "";
}
return new QName(ns, nd.getLocalName());
} | java | public static QName fromNode(final Node nd) {
String ns = nd.getNamespaceURI();
if (ns == null) {
/* It appears a node can have a NULL namespace but a QName has a zero length
*/
ns = "";
}
return new QName(ns, nd.getLocalName());
} | [
"public",
"static",
"QName",
"fromNode",
"(",
"final",
"Node",
"nd",
")",
"{",
"String",
"ns",
"=",
"nd",
".",
"getNamespaceURI",
"(",
")",
";",
"if",
"(",
"ns",
"==",
"null",
")",
"{",
"/* It appears a node can have a NULL namespace but a QName has a zero length\... | Return a QName for the node
@param nd
@return boolean true for match | [
"Return",
"a",
"QName",
"for",
"the",
"node"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L509-L519 | train |
Bedework/bw-util | bw-util-http/src/main/java/org/bedework/util/http/BasicHttpClient.java | BasicHttpClient.getSslSocketFactory | public static SSLSocketFactory getSslSocketFactory() {
if (!sslDisabled) {
return SSLSocketFactory.getSocketFactory();
}
try {
final X509Certificate[] _AcceptedIssuers = new X509Certificate[] {};
final SSLContext ctx = SSLContext.getInstance("TLS");
final X509TrustManager tm = new ... | java | public static SSLSocketFactory getSslSocketFactory() {
if (!sslDisabled) {
return SSLSocketFactory.getSocketFactory();
}
try {
final X509Certificate[] _AcceptedIssuers = new X509Certificate[] {};
final SSLContext ctx = SSLContext.getInstance("TLS");
final X509TrustManager tm = new ... | [
"public",
"static",
"SSLSocketFactory",
"getSslSocketFactory",
"(",
")",
"{",
"if",
"(",
"!",
"sslDisabled",
")",
"{",
"return",
"SSLSocketFactory",
".",
"getSocketFactory",
"(",
")",
";",
"}",
"try",
"{",
"final",
"X509Certificate",
"[",
"]",
"_AcceptedIssuers"... | Allow testing of features when we don't have any valid certs.
@return socket factory. | [
"Allow",
"testing",
"of",
"features",
"when",
"we",
"don",
"t",
"have",
"any",
"valid",
"certs",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-http/src/main/java/org/bedework/util/http/BasicHttpClient.java#L268-L298 | train |
Bedework/bw-util | bw-util-http/src/main/java/org/bedework/util/http/BasicHttpClient.java | BasicHttpClient.setCredentials | public void setCredentials(final String user, final String pw) {
if (user == null) {
credentials = null;
} else {
credentials = new UsernamePasswordCredentials(user, pw);
}
} | java | public void setCredentials(final String user, final String pw) {
if (user == null) {
credentials = null;
} else {
credentials = new UsernamePasswordCredentials(user, pw);
}
} | [
"public",
"void",
"setCredentials",
"(",
"final",
"String",
"user",
",",
"final",
"String",
"pw",
")",
"{",
"if",
"(",
"user",
"==",
"null",
")",
"{",
"credentials",
"=",
"null",
";",
"}",
"else",
"{",
"credentials",
"=",
"new",
"UsernamePasswordCredential... | Set the credentials. user == null for unauthenticated.
@param user
@param pw | [
"Set",
"the",
"credentials",
".",
"user",
"==",
"null",
"for",
"unauthenticated",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-http/src/main/java/org/bedework/util/http/BasicHttpClient.java#L420-L426 | train |
Bedework/bw-util | bw-util-http/src/main/java/org/bedework/util/http/BasicHttpClient.java | BasicHttpClient.sendRequest | public int sendRequest(final String methodName,
final String url,
final List<Header> hdrs,
final String contentType, final int contentLen,
final byte[] content) throws HttpException {
int sz = 0;
if (content != n... | java | public int sendRequest(final String methodName,
final String url,
final List<Header> hdrs,
final String contentType, final int contentLen,
final byte[] content) throws HttpException {
int sz = 0;
if (content != n... | [
"public",
"int",
"sendRequest",
"(",
"final",
"String",
"methodName",
",",
"final",
"String",
"url",
",",
"final",
"List",
"<",
"Header",
">",
"hdrs",
",",
"final",
"String",
"contentType",
",",
"final",
"int",
"contentLen",
",",
"final",
"byte",
"[",
"]",... | Send a request to the server
@param methodName the method, GET, PUT etc
@param url the url
@param hdrs may be null
@param contentType
@param contentLen
@param content
@return int status code
@throws HttpException | [
"Send",
"a",
"request",
"to",
"the",
"server"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-http/src/main/java/org/bedework/util/http/BasicHttpClient.java#L452-L526 | train |
Bedework/bw-util | bw-util-http/src/main/java/org/bedework/util/http/BasicHttpClient.java | BasicHttpClient.findMethod | protected HttpRequestBase findMethod(final String name,
final URI uri) throws HttpException {
String nm = name.toUpperCase();
if ("PUT".equals(nm)) {
return new HttpPut(uri);
}
if ("GET".equals(nm)) {
return new HttpGet(uri);
}
if ("DELETE".e... | java | protected HttpRequestBase findMethod(final String name,
final URI uri) throws HttpException {
String nm = name.toUpperCase();
if ("PUT".equals(nm)) {
return new HttpPut(uri);
}
if ("GET".equals(nm)) {
return new HttpGet(uri);
}
if ("DELETE".e... | [
"protected",
"HttpRequestBase",
"findMethod",
"(",
"final",
"String",
"name",
",",
"final",
"URI",
"uri",
")",
"throws",
"HttpException",
"{",
"String",
"nm",
"=",
"name",
".",
"toUpperCase",
"(",
")",
";",
"if",
"(",
"\"PUT\"",
".",
"equals",
"(",
"nm",
... | Specify the next method by name.
@param name of the method
@param uri target
@return method object
@throws HttpException | [
"Specify",
"the",
"next",
"method",
"by",
"name",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-http/src/main/java/org/bedework/util/http/BasicHttpClient.java#L696-L741 | train |
Bedework/bw-util | bw-util-http/src/main/java/org/bedework/util/http/BasicHttpClient.java | BasicHttpClient.release | public void release() throws HttpException {
try {
HttpEntity ent = getResponseEntity();
if (ent != null) {
InputStream is = ent.getContent();
is.close();
}
} catch (Throwable t) {
throw new HttpException(t.getLocalizedMessage(), t);
}
} | java | public void release() throws HttpException {
try {
HttpEntity ent = getResponseEntity();
if (ent != null) {
InputStream is = ent.getContent();
is.close();
}
} catch (Throwable t) {
throw new HttpException(t.getLocalizedMessage(), t);
}
} | [
"public",
"void",
"release",
"(",
")",
"throws",
"HttpException",
"{",
"try",
"{",
"HttpEntity",
"ent",
"=",
"getResponseEntity",
"(",
")",
";",
"if",
"(",
"ent",
"!=",
"null",
")",
"{",
"InputStream",
"is",
"=",
"ent",
".",
"getContent",
"(",
")",
";"... | Release the connection
@throws HttpException | [
"Release",
"the",
"connection"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-http/src/main/java/org/bedework/util/http/BasicHttpClient.java#L1014-L1025 | train |
sebastiangraf/treetank | coremodules/node/src/main/java/org/treetank/axis/ItemList.java | ItemList.addItem | public int addItem(final AtomicValue pItem) {
final int key = mList.size();
pItem.setNodeKey(key);
// TODO: +2 is necessary, because key -1 is the NULLDATA
final int itemKey = (key + 2) * (-1);
pItem.setNodeKey(itemKey);
mList.add(pItem);
return itemKey;
} | java | public int addItem(final AtomicValue pItem) {
final int key = mList.size();
pItem.setNodeKey(key);
// TODO: +2 is necessary, because key -1 is the NULLDATA
final int itemKey = (key + 2) * (-1);
pItem.setNodeKey(itemKey);
mList.add(pItem);
return itemKey;
} | [
"public",
"int",
"addItem",
"(",
"final",
"AtomicValue",
"pItem",
")",
"{",
"final",
"int",
"key",
"=",
"mList",
".",
"size",
"(",
")",
";",
"pItem",
".",
"setNodeKey",
"(",
"key",
")",
";",
"// TODO: +2 is necessary, because key -1 is the NULLDATA",
"final",
... | Adding to this list.
@param pItem
setting and item to this list | [
"Adding",
"to",
"this",
"list",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/node/src/main/java/org/treetank/axis/ItemList.java#L71-L80 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/io/PooledBuffers.java | PooledBuffers.release | static void release(BufferPool.Buffer buff) throws IOException {
if (buff.buf.length == staticConf.getSmallBufferSize()) {
smallBufferPool.put(buff);
} else if (buff.buf.length == staticConf.getMediumBufferSize()) {
mediumBufferPool.put(buff);
} else if (buff.buf.length == staticConf.getLargeBuf... | java | static void release(BufferPool.Buffer buff) throws IOException {
if (buff.buf.length == staticConf.getSmallBufferSize()) {
smallBufferPool.put(buff);
} else if (buff.buf.length == staticConf.getMediumBufferSize()) {
mediumBufferPool.put(buff);
} else if (buff.buf.length == staticConf.getLargeBuf... | [
"static",
"void",
"release",
"(",
"BufferPool",
".",
"Buffer",
"buff",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buff",
".",
"buf",
".",
"length",
"==",
"staticConf",
".",
"getSmallBufferSize",
"(",
")",
")",
"{",
"smallBufferPool",
".",
"put",
"(",
... | Release a buffer back to the pool. MUST be called to gain the
benefit of pooling.
@param buff - the buffer
@throws java.io.IOException | [
"Release",
"a",
"buffer",
"back",
"to",
"the",
"pool",
".",
"MUST",
"be",
"called",
"to",
"gain",
"the",
"benefit",
"of",
"pooling",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/io/PooledBuffers.java#L93-L101 | train |
Bedework/bw-util | bw-util-jms/src/main/java/org/bedework/util/jms/NotificationsHandlerFactory.java | NotificationsHandlerFactory.getHandler | private static NotificationsHandler getHandler(final String queueName,
final Properties pr) throws NotificationException {
if (handler != null) {
return handler;
}
synchronized (synchit) {
handler = new JmsNotificationsHandlerImpl(queueName, pr);... | java | private static NotificationsHandler getHandler(final String queueName,
final Properties pr) throws NotificationException {
if (handler != null) {
return handler;
}
synchronized (synchit) {
handler = new JmsNotificationsHandlerImpl(queueName, pr);... | [
"private",
"static",
"NotificationsHandler",
"getHandler",
"(",
"final",
"String",
"queueName",
",",
"final",
"Properties",
"pr",
")",
"throws",
"NotificationException",
"{",
"if",
"(",
"handler",
"!=",
"null",
")",
"{",
"return",
"handler",
";",
"}",
"synchroni... | Return a handler for the system event
@param queueName our queue
@param pr jms properties
@return NotificationsHandler
@throws NotificationException | [
"Return",
"a",
"handler",
"for",
"the",
"system",
"event"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-jms/src/main/java/org/bedework/util/jms/NotificationsHandlerFactory.java#L43-L54 | train |
Bedework/bw-util | bw-util-jms/src/main/java/org/bedework/util/jms/NotificationsHandlerFactory.java | NotificationsHandlerFactory.post | public static void post(final SysEvent ev,
final String queueName,
final Properties pr) throws NotificationException {
getHandler(queueName, pr).post(ev);
} | java | public static void post(final SysEvent ev,
final String queueName,
final Properties pr) throws NotificationException {
getHandler(queueName, pr).post(ev);
} | [
"public",
"static",
"void",
"post",
"(",
"final",
"SysEvent",
"ev",
",",
"final",
"String",
"queueName",
",",
"final",
"Properties",
"pr",
")",
"throws",
"NotificationException",
"{",
"getHandler",
"(",
"queueName",
",",
"pr",
")",
".",
"post",
"(",
"ev",
... | Called to notify container that an event occurred. In general this should
not be called directly as consumers may receive the messages immediately,
perhaps before the referenced data has been written.
@param ev the system event
@param queueName our queue
@param pr jms properties
@throws NotificationException | [
"Called",
"to",
"notify",
"container",
"that",
"an",
"event",
"occurred",
".",
"In",
"general",
"this",
"should",
"not",
"be",
"called",
"directly",
"as",
"consumers",
"may",
"receive",
"the",
"messages",
"immediately",
"perhaps",
"before",
"the",
"referenced",
... | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-jms/src/main/java/org/bedework/util/jms/NotificationsHandlerFactory.java#L66-L70 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.adjustCollection | public static <T> AdjustCollectionResult<T> adjustCollection(final Collection<T> newCol,
final Collection<T> toAdjust) {
final AdjustCollectionResult<T> acr = new AdjustCollectionResult<>();
acr.removed = new ArrayList<>();
acr.added = new ArrayLi... | java | public static <T> AdjustCollectionResult<T> adjustCollection(final Collection<T> newCol,
final Collection<T> toAdjust) {
final AdjustCollectionResult<T> acr = new AdjustCollectionResult<>();
acr.removed = new ArrayList<>();
acr.added = new ArrayLi... | [
"public",
"static",
"<",
"T",
">",
"AdjustCollectionResult",
"<",
"T",
">",
"adjustCollection",
"(",
"final",
"Collection",
"<",
"T",
">",
"newCol",
",",
"final",
"Collection",
"<",
"T",
">",
"toAdjust",
")",
"{",
"final",
"AdjustCollectionResult",
"<",
"T",... | Used to adjust a collection toAdjust so that it looks like the collection
newCol. The collection newCol will be unchanged but the result object will
contain a list of added and removed values.
@param newCol make it look like this
@param toAdjust if non-null will be adjusted
@return added and removed values | [
"Used",
"to",
"adjust",
"a",
"collection",
"toAdjust",
"so",
"that",
"it",
"looks",
"like",
"the",
"collection",
"newCol",
".",
"The",
"collection",
"newCol",
"will",
"be",
"unchanged",
"but",
"the",
"result",
"object",
"will",
"contain",
"a",
"list",
"of",
... | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L83-L114 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.pathElement | public static String pathElement(final int index,
final String path) {
final String[] paths = path.split("/");
int idx = index;
if ((paths[0] == null) || (paths[0].length() == 0)) {
// skip empty first part - leading "/"
idx++;
}
if (idx >= paths.len... | java | public static String pathElement(final int index,
final String path) {
final String[] paths = path.split("/");
int idx = index;
if ((paths[0] == null) || (paths[0].length() == 0)) {
// skip empty first part - leading "/"
idx++;
}
if (idx >= paths.len... | [
"public",
"static",
"String",
"pathElement",
"(",
"final",
"int",
"index",
",",
"final",
"String",
"path",
")",
"{",
"final",
"String",
"[",
"]",
"paths",
"=",
"path",
".",
"split",
"(",
"\"/\"",
")",
";",
"int",
"idx",
"=",
"index",
";",
"if",
"(",
... | get the nth element from the path - first is 0.
@param index of element we want
@param path from which we extract the element
@return element or null | [
"get",
"the",
"nth",
"element",
"from",
"the",
"path",
"-",
"first",
"is",
"0",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L186-L202 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.makeLocale | public static Locale makeLocale(final String val) throws Throwable {
String lang = null;
String country = ""; // NOT null for Locale
String variant = "";
if (val == null) {
throw new Exception("Bad Locale: NULL");
}
if (val.length() == 2) {
lang = val;
} else {
int pos = ... | java | public static Locale makeLocale(final String val) throws Throwable {
String lang = null;
String country = ""; // NOT null for Locale
String variant = "";
if (val == null) {
throw new Exception("Bad Locale: NULL");
}
if (val.length() == 2) {
lang = val;
} else {
int pos = ... | [
"public",
"static",
"Locale",
"makeLocale",
"(",
"final",
"String",
"val",
")",
"throws",
"Throwable",
"{",
"String",
"lang",
"=",
"null",
";",
"String",
"country",
"=",
"\"\"",
";",
"// NOT null for Locale",
"String",
"variant",
"=",
"\"\"",
";",
"if",
"(",... | make a locale from the standard underscore separated parts - no idea why
this isn't in Locale
@param val teh locale String e.g. en_US
@return a Locale
@throws Throwable | [
"make",
"a",
"locale",
"from",
"the",
"standard",
"underscore",
"separated",
"parts",
"-",
"no",
"idea",
"why",
"this",
"isn",
"t",
"in",
"Locale"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L211-L246 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.getPropertiesFromResource | public static Properties getPropertiesFromResource(final String name) throws Throwable {
Properties pr = new Properties();
InputStream is = null;
try {
try {
// The jboss?? way - should work for others as well.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
i... | java | public static Properties getPropertiesFromResource(final String name) throws Throwable {
Properties pr = new Properties();
InputStream is = null;
try {
try {
// The jboss?? way - should work for others as well.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
i... | [
"public",
"static",
"Properties",
"getPropertiesFromResource",
"(",
"final",
"String",
"name",
")",
"throws",
"Throwable",
"{",
"Properties",
"pr",
"=",
"new",
"Properties",
"(",
")",
";",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"try",
"{",
"// Th... | Load a named resource as a Properties object
@param name String resource name
@return Properties populated from the resource
@throws Throwable | [
"Load",
"a",
"named",
"resource",
"as",
"a",
"Properties",
"object"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L260-L295 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.getObject | public static Object getObject(final String className,
final Class cl) throws Exception {
try {
Object o = Class.forName(className).newInstance();
if (o == null) {
throw new Exception("Class " + className + " not found");
}
if (!cl.isInstance(o)) {
... | java | public static Object getObject(final String className,
final Class cl) throws Exception {
try {
Object o = Class.forName(className).newInstance();
if (o == null) {
throw new Exception("Class " + className + " not found");
}
if (!cl.isInstance(o)) {
... | [
"public",
"static",
"Object",
"getObject",
"(",
"final",
"String",
"className",
",",
"final",
"Class",
"cl",
")",
"throws",
"Exception",
"{",
"try",
"{",
"Object",
"o",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
".",
"newInstance",
"(",
")",
";... | Given a class name return an object of that class.
The class parameter is used to check that the
named class is an instance of that class.
@param className String class name
@param cl Class expected
@return Object checked to be an instance of that class
@throws Exception | [
"Given",
"a",
"class",
"name",
"return",
"an",
"object",
"of",
"that",
"class",
".",
"The",
"class",
"parameter",
"is",
"used",
"to",
"check",
"that",
"the",
"named",
"class",
"is",
"an",
"instance",
"of",
"that",
"class",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L306-L327 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.fmtMsg | public static String fmtMsg(final String fmt, final String arg1, final String arg2) {
Object[] o = new Object[2];
o[0] = arg1;
o[1] = arg2;
return MessageFormat.format(fmt, o);
} | java | public static String fmtMsg(final String fmt, final String arg1, final String arg2) {
Object[] o = new Object[2];
o[0] = arg1;
o[1] = arg2;
return MessageFormat.format(fmt, o);
} | [
"public",
"static",
"String",
"fmtMsg",
"(",
"final",
"String",
"fmt",
",",
"final",
"String",
"arg1",
",",
"final",
"String",
"arg2",
")",
"{",
"Object",
"[",
"]",
"o",
"=",
"new",
"Object",
"[",
"2",
"]",
";",
"o",
"[",
"0",
"]",
"=",
"arg1",
"... | Format a message consisting of a format string plus two string parameters
@param fmt
@param arg1
@param arg2
@return String formatted message | [
"Format",
"a",
"message",
"consisting",
"of",
"a",
"format",
"string",
"plus",
"two",
"string",
"parameters"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L422-L428 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.fmtMsg | public static String fmtMsg(final String fmt, final int arg) {
Object[] o = new Object[1];
o[0] = new Integer(arg);
return MessageFormat.format(fmt, o);
} | java | public static String fmtMsg(final String fmt, final int arg) {
Object[] o = new Object[1];
o[0] = new Integer(arg);
return MessageFormat.format(fmt, o);
} | [
"public",
"static",
"String",
"fmtMsg",
"(",
"final",
"String",
"fmt",
",",
"final",
"int",
"arg",
")",
"{",
"Object",
"[",
"]",
"o",
"=",
"new",
"Object",
"[",
"1",
"]",
";",
"o",
"[",
"0",
"]",
"=",
"new",
"Integer",
"(",
"arg",
")",
";",
"re... | Format a message consisting of a format string plus one integer parameter
@param fmt
@param arg
@return String formatted message | [
"Format",
"a",
"message",
"consisting",
"of",
"a",
"format",
"string",
"plus",
"one",
"integer",
"parameter"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L436-L441 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.makeRandomString | public static String makeRandomString(int length, int maxVal) {
if (length < 0) {
return null;
}
length = Math.min(length, 1025);
if (maxVal < 0) {
return null;
}
maxVal = Math.min(maxVal, 35);
StringBuffer res = new StringBuffer();
Random rand = new Random();
for (i... | java | public static String makeRandomString(int length, int maxVal) {
if (length < 0) {
return null;
}
length = Math.min(length, 1025);
if (maxVal < 0) {
return null;
}
maxVal = Math.min(maxVal, 35);
StringBuffer res = new StringBuffer();
Random rand = new Random();
for (i... | [
"public",
"static",
"String",
"makeRandomString",
"(",
"int",
"length",
",",
"int",
"maxVal",
")",
"{",
"if",
"(",
"length",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"length",
"=",
"Math",
".",
"min",
"(",
"length",
",",
"1025",
")",
";",
"i... | Creates a string of given length where each character comes from a
set of values 0-9 followed by A-Z.
@param length returned string will be this long. Less than 1k + 1
@param maxVal maximum ordinal value of characters. If < than 0,
return null. If > 35, 35 is used instead.
@return String the random string | [
"Creates",
"a",
"string",
"of",
"given",
"length",
"where",
"each",
"character",
"comes",
"from",
"a",
"set",
"of",
"values",
"0",
"-",
"9",
"followed",
"by",
"A",
"-",
"Z",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L456-L477 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.appendTextToArray | public static String[] appendTextToArray(String[] sarray, final String val,
final int maxEntries) {
if (sarray == null) {
if (maxEntries > 0) {
sarray = new String[1];
sarray[0] = val;
}
return sarray;
}
if (sarray.length > maxEntries) {... | java | public static String[] appendTextToArray(String[] sarray, final String val,
final int maxEntries) {
if (sarray == null) {
if (maxEntries > 0) {
sarray = new String[1];
sarray[0] = val;
}
return sarray;
}
if (sarray.length > maxEntries) {... | [
"public",
"static",
"String",
"[",
"]",
"appendTextToArray",
"(",
"String",
"[",
"]",
"sarray",
",",
"final",
"String",
"val",
",",
"final",
"int",
"maxEntries",
")",
"{",
"if",
"(",
"sarray",
"==",
"null",
")",
"{",
"if",
"(",
"maxEntries",
">",
"0",
... | Add a string to a string array of a given maximum length. Truncates
the string array if required.
New entries go at the end. old get dropped off the front.
@param sarray String[] to be updated
@param val new entry
@param maxEntries Number of entries we keep.
@return String[] Modified sarray | [
"Add",
"a",
"string",
"to",
"a",
"string",
"array",
"of",
"a",
"given",
"maximum",
"length",
".",
"Truncates",
"the",
"string",
"array",
"if",
"required",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L489-L528 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.encodeArray | public static String encodeArray(final String[] val){
if (val == null) {
return null;
}
int len = val.length;
if (len == 0) {
return "";
}
StringBuffer sb = new StringBuffer();
for (int i = 0; i < len; i++) {
if (i > 0) {
sb.append(" ");
}
String s ... | java | public static String encodeArray(final String[] val){
if (val == null) {
return null;
}
int len = val.length;
if (len == 0) {
return "";
}
StringBuffer sb = new StringBuffer();
for (int i = 0; i < len; i++) {
if (i > 0) {
sb.append(" ");
}
String s ... | [
"public",
"static",
"String",
"encodeArray",
"(",
"final",
"String",
"[",
"]",
"val",
")",
"{",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"len",
"=",
"val",
".",
"length",
";",
"if",
"(",
"len",
"==",
"0",
")",
... | Return a String representing the given String array, achieved by
URLEncoding the individual String elements then concatenating with
intervening blanks.
@param val String[] value to encode
@return String encoded value | [
"Return",
"a",
"String",
"representing",
"the",
"given",
"String",
"array",
"achieved",
"by",
"URLEncoding",
"the",
"individual",
"String",
"elements",
"then",
"concatenating",
"with",
"intervening",
"blanks",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L537-L569 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.decodeArray | public static String[] decodeArray(final String val){
if (val == null) {
return null;
}
int len = val.length();
if (len == 0) {
return new String[0];
}
ArrayList<String> al = new ArrayList<String>();
int i = 0;
while (i < len) {
int end = val.indexOf(" ", i);
... | java | public static String[] decodeArray(final String val){
if (val == null) {
return null;
}
int len = val.length();
if (len == 0) {
return new String[0];
}
ArrayList<String> al = new ArrayList<String>();
int i = 0;
while (i < len) {
int end = val.indexOf(" ", i);
... | [
"public",
"static",
"String",
"[",
"]",
"decodeArray",
"(",
"final",
"String",
"val",
")",
"{",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"len",
"=",
"val",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
"==",
... | Return a StringArray resulting from decoding the given String which
should have been encoded by encodeArray
@param val String value encoded by encodeArray
@return String[] decoded value | [
"Return",
"a",
"StringArray",
"resulting",
"from",
"decoding",
"the",
"given",
"String",
"which",
"should",
"have",
"been",
"encoded",
"by",
"encodeArray"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L577-L615 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.equalsString | public static boolean equalsString(final String thisStr, final String thatStr) {
if ((thisStr == null) && (thatStr == null)) {
return true;
}
if (thisStr == null) {
return false;
}
return thisStr.equals(thatStr);
} | java | public static boolean equalsString(final String thisStr, final String thatStr) {
if ((thisStr == null) && (thatStr == null)) {
return true;
}
if (thisStr == null) {
return false;
}
return thisStr.equals(thatStr);
} | [
"public",
"static",
"boolean",
"equalsString",
"(",
"final",
"String",
"thisStr",
",",
"final",
"String",
"thatStr",
")",
"{",
"if",
"(",
"(",
"thisStr",
"==",
"null",
")",
"&&",
"(",
"thatStr",
"==",
"null",
")",
")",
"{",
"return",
"true",
";",
"}",
... | Return true if Strings are equal including possible null
@param thisStr
@param thatStr
@return boolean true for equal | [
"Return",
"true",
"if",
"Strings",
"are",
"equal",
"including",
"possible",
"null"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L623-L633 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.compareStrings | public static int compareStrings(final String s1, final String s2) {
if (s1 == null) {
if (s2 != null) {
return -1;
}
return 0;
}
if (s2 == null) {
return 1;
}
return s1.compareTo(s2);
} | java | public static int compareStrings(final String s1, final String s2) {
if (s1 == null) {
if (s2 != null) {
return -1;
}
return 0;
}
if (s2 == null) {
return 1;
}
return s1.compareTo(s2);
} | [
"public",
"static",
"int",
"compareStrings",
"(",
"final",
"String",
"s1",
",",
"final",
"String",
"s2",
")",
"{",
"if",
"(",
"s1",
"==",
"null",
")",
"{",
"if",
"(",
"s2",
"!=",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"0",
";",... | Compare two strings. null is less than any non-null string.
@param s1 first string.
@param s2 second string.
@return int 0 if the s1 is equal to s2;
<0 if s1 is lexicographically less than s2;
>0 if s1 is lexicographically greater than s2. | [
"Compare",
"two",
"strings",
".",
"null",
"is",
"less",
"than",
"any",
"non",
"-",
"null",
"string",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L643-L657 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.getList | public static List<String> getList(final String val, final boolean emptyOk) throws Throwable {
List<String> l = new LinkedList<String>();
if ((val == null) || (val.length() == 0)) {
return l;
}
StringTokenizer st = new StringTokenizer(val, ",", false);
while (st.hasMoreTokens()) {
Stri... | java | public static List<String> getList(final String val, final boolean emptyOk) throws Throwable {
List<String> l = new LinkedList<String>();
if ((val == null) || (val.length() == 0)) {
return l;
}
StringTokenizer st = new StringTokenizer(val, ",", false);
while (st.hasMoreTokens()) {
Stri... | [
"public",
"static",
"List",
"<",
"String",
">",
"getList",
"(",
"final",
"String",
"val",
",",
"final",
"boolean",
"emptyOk",
")",
"throws",
"Throwable",
"{",
"List",
"<",
"String",
">",
"l",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",... | Turn a comma separated list into a List.
Throws exception for invalid list.
@param val String comma separated list
@param emptyOk Empty elements are OK
@return List of elements, never null
@throws Throwable for invalid list | [
"Turn",
"a",
"comma",
"separated",
"list",
"into",
"a",
"List",
".",
"Throws",
"exception",
"for",
"invalid",
"list",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L696-L721 | train |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.compare | public static int compare(final char[] thisone, final char[] thatone) {
if (thisone == thatone) {
return 0;
}
if (thisone == null) {
return -1;
}
if (thatone == null) {
return 1;
}
if (thisone.length < thatone.length) {
return -1;
}
if (thisone.length > th... | java | public static int compare(final char[] thisone, final char[] thatone) {
if (thisone == thatone) {
return 0;
}
if (thisone == null) {
return -1;
}
if (thatone == null) {
return 1;
}
if (thisone.length < thatone.length) {
return -1;
}
if (thisone.length > th... | [
"public",
"static",
"int",
"compare",
"(",
"final",
"char",
"[",
"]",
"thisone",
",",
"final",
"char",
"[",
"]",
"thatone",
")",
"{",
"if",
"(",
"thisone",
"==",
"thatone",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"thisone",
"==",
"null",
")",... | Compare two char arrays
@param thisone
@param thatone
@return int -1, 0, 1, | [
"Compare",
"two",
"char",
"arrays"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L828-L863 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/out/EditScript.java | EditScript.add | public Diff add(final Diff paramChange) {
assert paramChange != null;
final ITreeData item =
paramChange.getDiff() == EDiff.DELETED ? paramChange.getOldNode() : paramChange.getNewNode();
if (mChangeByNode.containsKey(item)) {
return paramChange;
}
mChange... | java | public Diff add(final Diff paramChange) {
assert paramChange != null;
final ITreeData item =
paramChange.getDiff() == EDiff.DELETED ? paramChange.getOldNode() : paramChange.getNewNode();
if (mChangeByNode.containsKey(item)) {
return paramChange;
}
mChange... | [
"public",
"Diff",
"add",
"(",
"final",
"Diff",
"paramChange",
")",
"{",
"assert",
"paramChange",
"!=",
"null",
";",
"final",
"ITreeData",
"item",
"=",
"paramChange",
".",
"getDiff",
"(",
")",
"==",
"EDiff",
".",
"DELETED",
"?",
"paramChange",
".",
"getOldN... | Adds a change to the edit script.
@param paramChange
{@link Diff} reference
@return the change | [
"Adds",
"a",
"change",
"to",
"the",
"edit",
"script",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/out/EditScript.java#L124-L134 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.startListening | public void startListening() throws FileNotFoundException, ClassNotFoundException, IOException,
ResourceNotExistingException, TTException {
mProcessingThread = new Thread() {
public void run() {
try {
processFileNotifications();
} catch (In... | java | public void startListening() throws FileNotFoundException, ClassNotFoundException, IOException,
ResourceNotExistingException, TTException {
mProcessingThread = new Thread() {
public void run() {
try {
processFileNotifications();
} catch (In... | [
"public",
"void",
"startListening",
"(",
")",
"throws",
"FileNotFoundException",
",",
"ClassNotFoundException",
",",
"IOException",
",",
"ResourceNotExistingException",
",",
"TTException",
"{",
"mProcessingThread",
"=",
"new",
"Thread",
"(",
")",
"{",
"public",
"void"... | Start listening to the defined folders.
@throws FileNotFoundException
@throws ClassNotFoundException
@throws IOException
@throws ResourceNotExistingException
@throws TTException | [
"Start",
"listening",
"to",
"the",
"defined",
"folders",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L137-L150 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.initSessions | private void initSessions() throws FileNotFoundException, ClassNotFoundException, IOException,
ResourceNotExistingException, TTException {
Map<String, String> filelisteners = getFilelisteners();
mSessions = new HashMap<String, ISession>();
mTrx = new HashMap<String, IFilelistenerWriteTrx... | java | private void initSessions() throws FileNotFoundException, ClassNotFoundException, IOException,
ResourceNotExistingException, TTException {
Map<String, String> filelisteners = getFilelisteners();
mSessions = new HashMap<String, ISession>();
mTrx = new HashMap<String, IFilelistenerWriteTrx... | [
"private",
"void",
"initSessions",
"(",
")",
"throws",
"FileNotFoundException",
",",
"ClassNotFoundException",
",",
"IOException",
",",
"ResourceNotExistingException",
",",
"TTException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"filelisteners",
"=",
"getFilelis... | This method is used to initialize a session with treetank for every
storage configuration thats in the database.
@throws FileNotFoundException
@throws ClassNotFoundException
@throws IOException
@throws ResourceNotExistingException
@throws TTException | [
"This",
"method",
"is",
"used",
"to",
"initialize",
"a",
"session",
"with",
"treetank",
"for",
"every",
"storage",
"configuration",
"thats",
"in",
"the",
"database",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L162-L191 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.watchParents | private void watchParents(Path p, String until) throws IOException {
if (p.getParent() != null && !until.equals(p.getParent().toString())) {
watchDir(p.getParent().toFile());
watchParents(p.getParent(), until);
}
} | java | private void watchParents(Path p, String until) throws IOException {
if (p.getParent() != null && !until.equals(p.getParent().toString())) {
watchDir(p.getParent().toFile());
watchParents(p.getParent(), until);
}
} | [
"private",
"void",
"watchParents",
"(",
"Path",
"p",
",",
"String",
"until",
")",
"throws",
"IOException",
"{",
"if",
"(",
"p",
".",
"getParent",
"(",
")",
"!=",
"null",
"&&",
"!",
"until",
".",
"equals",
"(",
"p",
".",
"getParent",
"(",
")",
".",
... | Watch parent folders of this file until the root listener path has been
reached.
@param p
@param until
@throws IOException | [
"Watch",
"parent",
"folders",
"of",
"this",
"file",
"until",
"the",
"root",
"listener",
"path",
"has",
"been",
"reached",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L201-L206 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.releaseSessions | private void releaseSessions() throws TTException {
if (mSessions == null) {
return;
}
// Closing all transactions.
try {
for (IFilelistenerWriteTrx trx : mTrx.values()) {
trx.close();
}
} catch (IllegalStateException ise) {
... | java | private void releaseSessions() throws TTException {
if (mSessions == null) {
return;
}
// Closing all transactions.
try {
for (IFilelistenerWriteTrx trx : mTrx.values()) {
trx.close();
}
} catch (IllegalStateException ise) {
... | [
"private",
"void",
"releaseSessions",
"(",
")",
"throws",
"TTException",
"{",
"if",
"(",
"mSessions",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// Closing all transactions.",
"try",
"{",
"for",
"(",
"IFilelistenerWriteTrx",
"trx",
":",
"mTrx",
".",
"values"... | Release transactions and session from treetank.
@throws TTException | [
"Release",
"transactions",
"and",
"session",
"from",
"treetank",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L213-L231 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.shutDownListener | public void shutDownListener() throws TTException, IOException {
for (ExecutorService s : mExecutorMap.values()) {
s.shutdown();
while (!s.isTerminated()) {
// Do nothing.
try {
Thread.sleep(1000);
} catch (InterruptedE... | java | public void shutDownListener() throws TTException, IOException {
for (ExecutorService s : mExecutorMap.values()) {
s.shutdown();
while (!s.isTerminated()) {
// Do nothing.
try {
Thread.sleep(1000);
} catch (InterruptedE... | [
"public",
"void",
"shutDownListener",
"(",
")",
"throws",
"TTException",
",",
"IOException",
"{",
"for",
"(",
"ExecutorService",
"s",
":",
"mExecutorMap",
".",
"values",
"(",
")",
")",
"{",
"s",
".",
"shutdown",
"(",
")",
";",
"while",
"(",
"!",
"s",
"... | Shutdown listening to the defined folders and release all bonds to
Treetank.
@throws TTException
@throws IOException | [
"Shutdown",
"listening",
"to",
"the",
"defined",
"folders",
"and",
"release",
"all",
"bonds",
"to",
"Treetank",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L240-L262 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.processFileNotifications | private void processFileNotifications() throws InterruptedException, TTException, IOException {
while (true) {
WatchKey key = mWatcher.take();
Path dir = mKeyPaths.get(key);
for (WatchEvent<?> evt : key.pollEvents()) {
WatchEvent.Kind<?> eventType = evt.kind()... | java | private void processFileNotifications() throws InterruptedException, TTException, IOException {
while (true) {
WatchKey key = mWatcher.take();
Path dir = mKeyPaths.get(key);
for (WatchEvent<?> evt : key.pollEvents()) {
WatchEvent.Kind<?> eventType = evt.kind()... | [
"private",
"void",
"processFileNotifications",
"(",
")",
"throws",
"InterruptedException",
",",
"TTException",
",",
"IOException",
"{",
"while",
"(",
"true",
")",
"{",
"WatchKey",
"key",
"=",
"mWatcher",
".",
"take",
"(",
")",
";",
"Path",
"dir",
"=",
"mKeyP... | In this method the notifications of the filesystem if anything changed in
a folder that the system is listening to are being extracted and
processed.
@throws InterruptedException
@throws IOException
@throws TTException | [
"In",
"this",
"method",
"the",
"notifications",
"of",
"the",
"filesystem",
"if",
"anything",
"changed",
"in",
"a",
"folder",
"that",
"the",
"system",
"is",
"listening",
"to",
"are",
"being",
"extracted",
"and",
"processed",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L273-L291 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.process | private void process(Path dir, Path file, WatchEvent.Kind<?> evtType) throws TTException, IOException,
InterruptedException {
// LOGGER.info("Processing " + file.getFileName() + " with event "
// + evtType);
IFilelistenerWriteTrx trx = null;
String rootPath = getListenerRootPath(... | java | private void process(Path dir, Path file, WatchEvent.Kind<?> evtType) throws TTException, IOException,
InterruptedException {
// LOGGER.info("Processing " + file.getFileName() + " with event "
// + evtType);
IFilelistenerWriteTrx trx = null;
String rootPath = getListenerRootPath(... | [
"private",
"void",
"process",
"(",
"Path",
"dir",
",",
"Path",
"file",
",",
"WatchEvent",
".",
"Kind",
"<",
"?",
">",
"evtType",
")",
"throws",
"TTException",
",",
"IOException",
",",
"InterruptedException",
"{",
"// LOGGER.info(\"Processing \" + file.getFileName() ... | This method is used to process the file system modifications.
@param dir
@param file
@param evtType
@throws IOException
@throws TTException
@throws InterruptedException | [
"This",
"method",
"is",
"used",
"to",
"process",
"the",
"file",
"system",
"modifications",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L327-L401 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.addSubDirectory | private void addSubDirectory(Path root, Path filePath) throws IOException {
String listener = getListenerRootPath(root);
List<String> listeners = mSubDirectories.get(listener);
if (listeners != null) {
if (mSubDirectories.get(listener).contains(filePath.toAbsolutePath())) {
... | java | private void addSubDirectory(Path root, Path filePath) throws IOException {
String listener = getListenerRootPath(root);
List<String> listeners = mSubDirectories.get(listener);
if (listeners != null) {
if (mSubDirectories.get(listener).contains(filePath.toAbsolutePath())) {
... | [
"private",
"void",
"addSubDirectory",
"(",
"Path",
"root",
",",
"Path",
"filePath",
")",
"throws",
"IOException",
"{",
"String",
"listener",
"=",
"getListenerRootPath",
"(",
"root",
")",
";",
"List",
"<",
"String",
">",
"listeners",
"=",
"mSubDirectories",
"."... | In this method a subdirectory is being added to the system and watched.
This is necessary since the {@link WatchService} doesn't support watching
a folder with higher depths than 1.
@param root
@param filePath
@throws IOException | [
"In",
"this",
"method",
"a",
"subdirectory",
"is",
"being",
"added",
"to",
"the",
"system",
"and",
"watched",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L413-L431 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.getListenerRootPath | private String getListenerRootPath(Path root) {
String listener = "";
for (String s : mFilelistenerToPaths.values()) {
if (root.toString().contains(s)) {
listener = s;
}
}
return listener;
} | java | private String getListenerRootPath(Path root) {
String listener = "";
for (String s : mFilelistenerToPaths.values()) {
if (root.toString().contains(s)) {
listener = s;
}
}
return listener;
} | [
"private",
"String",
"getListenerRootPath",
"(",
"Path",
"root",
")",
"{",
"String",
"listener",
"=",
"\"\"",
";",
"for",
"(",
"String",
"s",
":",
"mFilelistenerToPaths",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"root",
".",
"toString",
"(",
")",
... | This utility method allows you to get the root path for a subdirectory.
The root path is a directory that has been explicitly listened to and not
just recursively.
@param root
@return returns the root path as a String | [
"This",
"utility",
"method",
"allows",
"you",
"to",
"get",
"the",
"root",
"path",
"for",
"a",
"subdirectory",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L442-L452 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.getFilelisteners | public static Map<String, String> getFilelisteners() throws FileNotFoundException, IOException,
ClassNotFoundException {
mFilelistenerToPaths = new HashMap<String, String>();
File listenerFilePaths = new File(StorageManager.ROOT_PATH + File.separator + "mapping.data");
getFileListener... | java | public static Map<String, String> getFilelisteners() throws FileNotFoundException, IOException,
ClassNotFoundException {
mFilelistenerToPaths = new HashMap<String, String>();
File listenerFilePaths = new File(StorageManager.ROOT_PATH + File.separator + "mapping.data");
getFileListener... | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getFilelisteners",
"(",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
",",
"ClassNotFoundException",
"{",
"mFilelistenerToPaths",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",... | A utility method to get all filelisteners that are already defined and
stored.
@return returns a map of relative paths to the folders as the keyset and
the resourcenames that point to the configurations in the
valueset.
@throws FileNotFoundException
@throws IOException
@throws ClassNotFoundException | [
"A",
"utility",
"method",
"to",
"get",
"all",
"filelisteners",
"that",
"are",
"already",
"defined",
"and",
"stored",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L465-L475 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.addFilelistener | public static boolean addFilelistener(String pResourcename, String pListenerPath)
throws FileNotFoundException, IOException, ClassNotFoundException {
mFilelistenerToPaths = new HashMap<String, String>();
File listenerFilePaths = new File(StorageManager.ROOT_PATH + File.separator + "mapping.data... | java | public static boolean addFilelistener(String pResourcename, String pListenerPath)
throws FileNotFoundException, IOException, ClassNotFoundException {
mFilelistenerToPaths = new HashMap<String, String>();
File listenerFilePaths = new File(StorageManager.ROOT_PATH + File.separator + "mapping.data... | [
"public",
"static",
"boolean",
"addFilelistener",
"(",
"String",
"pResourcename",
",",
"String",
"pListenerPath",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
",",
"ClassNotFoundException",
"{",
"mFilelistenerToPaths",
"=",
"new",
"HashMap",
"<",
"String"... | Add a new filelistener to the system.
@param pResourcename
@param pListenerPath
@return return true if there has been a success.
@throws FileNotFoundException
@throws IOException
@throws ClassNotFoundException | [
"Add",
"a",
"new",
"filelistener",
"to",
"the",
"system",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L487-L507 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.removeFilelistener | public boolean removeFilelistener(String pResourcename) throws IOException, TTException,
ResourceNotExistingException {
mFilelistenerToPaths = new HashMap<String, String>();
File listenerFilePaths = new File(StorageManager.ROOT_PATH + File.separator + "mapping.data");
getFileListenersF... | java | public boolean removeFilelistener(String pResourcename) throws IOException, TTException,
ResourceNotExistingException {
mFilelistenerToPaths = new HashMap<String, String>();
File listenerFilePaths = new File(StorageManager.ROOT_PATH + File.separator + "mapping.data");
getFileListenersF... | [
"public",
"boolean",
"removeFilelistener",
"(",
"String",
"pResourcename",
")",
"throws",
"IOException",
",",
"TTException",
",",
"ResourceNotExistingException",
"{",
"mFilelistenerToPaths",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
... | You can remove a filelistener from the system identifying it with it's
Storagename.
The listeners have to be shutdown to do this task.
@param pResourcename
@return true if resource could be removed
@throws IOException
@throws TTException
@throws ResourceNotExistingException | [
"You",
"can",
"remove",
"a",
"filelistener",
"from",
"the",
"system",
"identifying",
"it",
"with",
"it",
"s",
"Storagename",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L521-L543 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.getFileListenersFromSystem | private static void getFileListenersFromSystem(File pListenerFilePaths) throws IOException {
if (!pListenerFilePaths.exists()) {
java.nio.file.Files.createFile(pListenerFilePaths.toPath());
} else {
byte[] bytes = java.nio.file.Files.readAllBytes(pListenerFilePaths.toPath());
... | java | private static void getFileListenersFromSystem(File pListenerFilePaths) throws IOException {
if (!pListenerFilePaths.exists()) {
java.nio.file.Files.createFile(pListenerFilePaths.toPath());
} else {
byte[] bytes = java.nio.file.Files.readAllBytes(pListenerFilePaths.toPath());
... | [
"private",
"static",
"void",
"getFileListenersFromSystem",
"(",
"File",
"pListenerFilePaths",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"pListenerFilePaths",
".",
"exists",
"(",
")",
")",
"{",
"java",
".",
"nio",
".",
"file",
".",
"Files",
".",
"cre... | This is a helper method that let's you initialize mFilelistenerToPaths
with all the filelisteners that have been stored in the filesystem.
@param pListenerFilePaths
@throws IOException | [
"This",
"is",
"a",
"helper",
"method",
"that",
"let",
"s",
"you",
"initialize",
"mFilelistenerToPaths",
"with",
"all",
"the",
"filelisteners",
"that",
"have",
"been",
"stored",
"in",
"the",
"filesystem",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L552-L567 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/collections/MapUtils.java | MapUtils.sortByValue | public static <K, V extends Comparable<V>> List<Entry<K, V>> sortByValue(Map<K, V> map) {
List<Entry<K, V>> entries = new ArrayList<>(map.entrySet());
entries.sort(new ByValue<>());
return entries;
} | java | public static <K, V extends Comparable<V>> List<Entry<K, V>> sortByValue(Map<K, V> map) {
List<Entry<K, V>> entries = new ArrayList<>(map.entrySet());
entries.sort(new ByValue<>());
return entries;
} | [
"public",
"static",
"<",
"K",
",",
"V",
"extends",
"Comparable",
"<",
"V",
">",
">",
"List",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"sortByValue",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"List",
"<",
"Entry",
"<",
"K",
",",... | Sorts the provided Map by the value instead of by key like TreeMap does.
The Value-Type needs to implement the Comparable-interface.
Note: this will require one Map.Entry for each element in the Map, so for very large
Maps this will incur some memory overhead but will not fully duplicate the contents of the map.
@pa... | [
"Sorts",
"the",
"provided",
"Map",
"by",
"the",
"value",
"instead",
"of",
"by",
"key",
"like",
"TreeMap",
"does",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/collections/MapUtils.java#L34-L38 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/collections/MapUtils.java | MapUtils.sortByValueAndKey | public static <K extends Comparable<K>, V extends Comparable<V>> List<Map.Entry<K, V>> sortByValueAndKey(Map<K, V> map) {
List<Map.Entry<K, V>> entries = new ArrayList<>(map.entrySet());
entries.sort(new ByValueAndKey<>());
return entries;
} | java | public static <K extends Comparable<K>, V extends Comparable<V>> List<Map.Entry<K, V>> sortByValueAndKey(Map<K, V> map) {
List<Map.Entry<K, V>> entries = new ArrayList<>(map.entrySet());
entries.sort(new ByValueAndKey<>());
return entries;
} | [
"public",
"static",
"<",
"K",
"extends",
"Comparable",
"<",
"K",
">",
",",
"V",
"extends",
"Comparable",
"<",
"V",
">",
">",
"List",
"<",
"Map",
".",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"sortByValueAndKey",
"(",
"Map",
"<",
"K",
",",
"V",
">",... | Sorts the provided Map by the value and then by key instead of by key like TreeMap does.
The Value-Type and Key-Type need to implement the Comparable-interface.
Note: this will require one Map.Entry for each element in the Map, so for very large
Maps this will incur some memory overhead but will not fully duplicate t... | [
"Sorts",
"the",
"provided",
"Map",
"by",
"the",
"value",
"and",
"then",
"by",
"key",
"instead",
"of",
"by",
"key",
"like",
"TreeMap",
"does",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/collections/MapUtils.java#L56-L60 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java | ReqUtil.getReqPar | public String getReqPar(final String name, final String def) {
final String s = Util.checkNull(request.getParameter(name));
if (s != null) {
return s;
}
return def;
} | java | public String getReqPar(final String name, final String def) {
final String s = Util.checkNull(request.getParameter(name));
if (s != null) {
return s;
}
return def;
} | [
"public",
"String",
"getReqPar",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"def",
")",
"{",
"final",
"String",
"s",
"=",
"Util",
".",
"checkNull",
"(",
"request",
".",
"getParameter",
"(",
"name",
")",
")",
";",
"if",
"(",
"s",
"!=",
"n... | Get a request parameter stripped of white space. Return default for null
or zero length.
@param name name of parameter
@param def default value
@return String value | [
"Get",
"a",
"request",
"parameter",
"stripped",
"of",
"white",
"space",
".",
"Return",
"default",
"for",
"null",
"or",
"zero",
"length",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java#L98-L106 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java | ReqUtil.getIntReqPar | public Integer getIntReqPar(final String name) throws Throwable {
String reqpar = getReqPar(name);
if (reqpar == null) {
return null;
}
return Integer.valueOf(reqpar);
} | java | public Integer getIntReqPar(final String name) throws Throwable {
String reqpar = getReqPar(name);
if (reqpar == null) {
return null;
}
return Integer.valueOf(reqpar);
} | [
"public",
"Integer",
"getIntReqPar",
"(",
"final",
"String",
"name",
")",
"throws",
"Throwable",
"{",
"String",
"reqpar",
"=",
"getReqPar",
"(",
"name",
")",
";",
"if",
"(",
"reqpar",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"Integer... | Get an Integer request parameter or null.
@param name name of parameter
@return Integer value or null
@throws Throwable | [
"Get",
"an",
"Integer",
"request",
"parameter",
"or",
"null",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java#L162-L170 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java | ReqUtil.getIntReqPar | public int getIntReqPar(final String name,
final int defaultVal) throws Throwable {
String reqpar = getReqPar(name);
if (reqpar == null) {
return defaultVal;
}
try {
return Integer.parseInt(reqpar);
} catch (Throwable t) {
return defaultVal; // XXX excep... | java | public int getIntReqPar(final String name,
final int defaultVal) throws Throwable {
String reqpar = getReqPar(name);
if (reqpar == null) {
return defaultVal;
}
try {
return Integer.parseInt(reqpar);
} catch (Throwable t) {
return defaultVal; // XXX excep... | [
"public",
"int",
"getIntReqPar",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"defaultVal",
")",
"throws",
"Throwable",
"{",
"String",
"reqpar",
"=",
"getReqPar",
"(",
"name",
")",
";",
"if",
"(",
"reqpar",
"==",
"null",
")",
"{",
"return",
"defa... | Get an integer valued request parameter.
@param name name of parameter
@param defaultVal
@return int value
@throws Throwable | [
"Get",
"an",
"integer",
"valued",
"request",
"parameter",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java#L179-L192 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java | ReqUtil.getLongReqPar | public Long getLongReqPar(final String name) throws Throwable {
String reqpar = getReqPar(name);
if (reqpar == null) {
return null;
}
return Long.valueOf(reqpar);
} | java | public Long getLongReqPar(final String name) throws Throwable {
String reqpar = getReqPar(name);
if (reqpar == null) {
return null;
}
return Long.valueOf(reqpar);
} | [
"public",
"Long",
"getLongReqPar",
"(",
"final",
"String",
"name",
")",
"throws",
"Throwable",
"{",
"String",
"reqpar",
"=",
"getReqPar",
"(",
"name",
")",
";",
"if",
"(",
"reqpar",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"Long",
... | Get a Long request parameter or null.
@param name name of parameter
@return Long value or null
@throws Throwable | [
"Get",
"a",
"Long",
"request",
"parameter",
"or",
"null",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java#L200-L208 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java | ReqUtil.getLongReqPar | public long getLongReqPar(final String name,
final long defaultVal) throws Throwable {
String reqpar = getReqPar(name);
if (reqpar == null) {
return defaultVal;
}
try {
return Long.parseLong(reqpar);
} catch (Throwable t) {
return defaultVal; // XXX ex... | java | public long getLongReqPar(final String name,
final long defaultVal) throws Throwable {
String reqpar = getReqPar(name);
if (reqpar == null) {
return defaultVal;
}
try {
return Long.parseLong(reqpar);
} catch (Throwable t) {
return defaultVal; // XXX ex... | [
"public",
"long",
"getLongReqPar",
"(",
"final",
"String",
"name",
",",
"final",
"long",
"defaultVal",
")",
"throws",
"Throwable",
"{",
"String",
"reqpar",
"=",
"getReqPar",
"(",
"name",
")",
";",
"if",
"(",
"reqpar",
"==",
"null",
")",
"{",
"return",
"d... | Get an long valued request parameter.
@param name name of parameter
@param defaultVal
@return long value
@throws Throwable | [
"Get",
"an",
"long",
"valued",
"request",
"parameter",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java#L217-L230 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java | ReqUtil.getBooleanReqPar | public Boolean getBooleanReqPar(final String name) throws Throwable {
String reqpar = getReqPar(name);
if (reqpar == null) {
return null;
}
try {
if (reqpar.equalsIgnoreCase("yes")) {
reqpar = "true";
}
return Boolean.valueOf(reqpar);
} catch (Throwable t) {
... | java | public Boolean getBooleanReqPar(final String name) throws Throwable {
String reqpar = getReqPar(name);
if (reqpar == null) {
return null;
}
try {
if (reqpar.equalsIgnoreCase("yes")) {
reqpar = "true";
}
return Boolean.valueOf(reqpar);
} catch (Throwable t) {
... | [
"public",
"Boolean",
"getBooleanReqPar",
"(",
"final",
"String",
"name",
")",
"throws",
"Throwable",
"{",
"String",
"reqpar",
"=",
"getReqPar",
"(",
"name",
")",
";",
"if",
"(",
"reqpar",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
... | Get a boolean valued request parameter.
@param name name of parameter
@return Boolean value or null for absent parameter
@throws Throwable | [
"Get",
"a",
"boolean",
"valued",
"request",
"parameter",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java#L238-L254 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java | ReqUtil.getBooleanReqPar | public boolean getBooleanReqPar(final String name,
final boolean defVal) throws Throwable {
boolean val = defVal;
Boolean valB = getBooleanReqPar(name);
if (valB != null) {
val = valB;
}
return val;
} | java | public boolean getBooleanReqPar(final String name,
final boolean defVal) throws Throwable {
boolean val = defVal;
Boolean valB = getBooleanReqPar(name);
if (valB != null) {
val = valB;
}
return val;
} | [
"public",
"boolean",
"getBooleanReqPar",
"(",
"final",
"String",
"name",
",",
"final",
"boolean",
"defVal",
")",
"throws",
"Throwable",
"{",
"boolean",
"val",
"=",
"defVal",
";",
"Boolean",
"valB",
"=",
"getBooleanReqPar",
"(",
"name",
")",
";",
"if",
"(",
... | Get a boolean valued request parameter giving a default value.
@param name name of parameter
@param defVal default value for absent parameter
@return boolean value
@throws Throwable | [
"Get",
"a",
"boolean",
"valued",
"request",
"parameter",
"giving",
"a",
"default",
"value",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java#L263-L272 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java | ReqUtil.setSessionAttr | public void setSessionAttr(final String attrName,
final Object val) {
final HttpSession sess = request.getSession(false);
if (sess == null) {
return;
}
sess.setAttribute(attrName, val);
} | java | public void setSessionAttr(final String attrName,
final Object val) {
final HttpSession sess = request.getSession(false);
if (sess == null) {
return;
}
sess.setAttribute(attrName, val);
} | [
"public",
"void",
"setSessionAttr",
"(",
"final",
"String",
"attrName",
",",
"final",
"Object",
"val",
")",
"{",
"final",
"HttpSession",
"sess",
"=",
"request",
".",
"getSession",
"(",
"false",
")",
";",
"if",
"(",
"sess",
"==",
"null",
")",
"{",
"return... | Set the value of a named session attribute.
@param attrName Name of the attribute
@param val Object | [
"Set",
"the",
"value",
"of",
"a",
"named",
"session",
"attribute",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java#L279-L288 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java | ReqUtil.removeSessionAttr | public void removeSessionAttr(final String attrName) {
final HttpSession sess = request.getSession(false);
if (sess == null) {
return;
}
sess.removeAttribute(attrName);
} | java | public void removeSessionAttr(final String attrName) {
final HttpSession sess = request.getSession(false);
if (sess == null) {
return;
}
sess.removeAttribute(attrName);
} | [
"public",
"void",
"removeSessionAttr",
"(",
"final",
"String",
"attrName",
")",
"{",
"final",
"HttpSession",
"sess",
"=",
"request",
".",
"getSession",
"(",
"false",
")",
";",
"if",
"(",
"sess",
"==",
"null",
")",
"{",
"return",
";",
"}",
"sess",
".",
... | Remove a named session attribute.
@param attrName Name of the attribute | [
"Remove",
"a",
"named",
"session",
"attribute",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java#L294-L302 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java | ReqUtil.getSessionAttr | public Object getSessionAttr(final String attrName) {
final HttpSession sess = request.getSession(false);
if (sess == null) {
return null;
}
return sess.getAttribute(attrName);
} | java | public Object getSessionAttr(final String attrName) {
final HttpSession sess = request.getSession(false);
if (sess == null) {
return null;
}
return sess.getAttribute(attrName);
} | [
"public",
"Object",
"getSessionAttr",
"(",
"final",
"String",
"attrName",
")",
"{",
"final",
"HttpSession",
"sess",
"=",
"request",
".",
"getSession",
"(",
"false",
")",
";",
"if",
"(",
"sess",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return"... | Return the value of a named session attribute.
@param attrName Name of the attribute
@return Object Attribute value or null | [
"Return",
"the",
"value",
"of",
"a",
"named",
"session",
"attribute",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java#L309-L317 | train |
Bedework/bw-util | bw-util-jmx/src/main/java/org/bedework/util/jmx/AnnotatedMBean.java | AnnotatedMBean.registerMBean | @SuppressWarnings("unchecked")
public static void registerMBean(final ManagementContext context,
final Object object,
final ObjectName objectName)
throws Exception {
String mbeanName = object.getClass().getName() + "MBean";
for (Class... | java | @SuppressWarnings("unchecked")
public static void registerMBean(final ManagementContext context,
final Object object,
final ObjectName objectName)
throws Exception {
String mbeanName = object.getClass().getName() + "MBean";
for (Class... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"void",
"registerMBean",
"(",
"final",
"ManagementContext",
"context",
",",
"final",
"Object",
"object",
",",
"final",
"ObjectName",
"objectName",
")",
"throws",
"Exception",
"{",
"String",
"m... | Register an mbean with the jmx context
@param context
@param object
@param objectName
@throws Exception | [
"Register",
"an",
"mbean",
"with",
"the",
"jmx",
"context"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-jmx/src/main/java/org/bedework/util/jmx/AnnotatedMBean.java#L58-L74 | train |
Bedework/bw-util | bw-util-jmx/src/main/java/org/bedework/util/jmx/AnnotatedMBean.java | AnnotatedMBean.getMethod | private Method getMethod(final MBeanOperationInfo op) {
final MBeanParameterInfo[] params = op.getSignature();
final String[] paramTypes = new String[params.length];
for (int i = 0; i < params.length; i++) {
paramTypes[i] = params[i].getType();
}
return getMethod(getMBeanInterface(), op.getNa... | java | private Method getMethod(final MBeanOperationInfo op) {
final MBeanParameterInfo[] params = op.getSignature();
final String[] paramTypes = new String[params.length];
for (int i = 0; i < params.length; i++) {
paramTypes[i] = params[i].getType();
}
return getMethod(getMBeanInterface(), op.getNa... | [
"private",
"Method",
"getMethod",
"(",
"final",
"MBeanOperationInfo",
"op",
")",
"{",
"final",
"MBeanParameterInfo",
"[",
"]",
"params",
"=",
"op",
".",
"getSignature",
"(",
")",
";",
"final",
"String",
"[",
"]",
"paramTypes",
"=",
"new",
"String",
"[",
"p... | Extracts the Method from the MBeanOperationInfo
@param op
@return | [
"Extracts",
"the",
"Method",
"from",
"the",
"MBeanOperationInfo"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-jmx/src/main/java/org/bedework/util/jmx/AnnotatedMBean.java#L156-L164 | train |
Bedework/bw-util | bw-util-jmx/src/main/java/org/bedework/util/jmx/AnnotatedMBean.java | AnnotatedMBean.getMethod | private static Method getMethod(final Class<?> mbean,
final String method,
final String... params) {
try {
final ClassLoader loader = mbean.getClassLoader();
final Class<?>[] paramClasses = new Class<?>[params.length];
for (int i ... | java | private static Method getMethod(final Class<?> mbean,
final String method,
final String... params) {
try {
final ClassLoader loader = mbean.getClassLoader();
final Class<?>[] paramClasses = new Class<?>[params.length];
for (int i ... | [
"private",
"static",
"Method",
"getMethod",
"(",
"final",
"Class",
"<",
"?",
">",
"mbean",
",",
"final",
"String",
"method",
",",
"final",
"String",
"...",
"params",
")",
"{",
"try",
"{",
"final",
"ClassLoader",
"loader",
"=",
"mbean",
".",
"getClassLoader... | Returns the Method with the specified name and parameter types for the given class,
null if it doesn't exist.
@param mbean
@param method
@param params
@return | [
"Returns",
"the",
"Method",
"with",
"the",
"specified",
"name",
"and",
"parameter",
"types",
"for",
"the",
"given",
"class",
"null",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-jmx/src/main/java/org/bedework/util/jmx/AnnotatedMBean.java#L174-L192 | train |
sebastiangraf/treetank | coremodules/commons/src/main/java/org/treetank/aspects/logging/LoggerAspect.java | LoggerAspect.advice | @Around("@annotation(org.treetank.aspects.logging.Logging)")
public Object advice(ProceedingJoinPoint pjp) throws Throwable {
final Signature sig = pjp.getSignature();
final Logger logger = FACTORY.getLogger(sig.getDeclaringTypeName());
logger.debug(new StringBuilder("Entering ").append(sig.... | java | @Around("@annotation(org.treetank.aspects.logging.Logging)")
public Object advice(ProceedingJoinPoint pjp) throws Throwable {
final Signature sig = pjp.getSignature();
final Logger logger = FACTORY.getLogger(sig.getDeclaringTypeName());
logger.debug(new StringBuilder("Entering ").append(sig.... | [
"@",
"Around",
"(",
"\"@annotation(org.treetank.aspects.logging.Logging)\"",
")",
"public",
"Object",
"advice",
"(",
"ProceedingJoinPoint",
"pjp",
")",
"throws",
"Throwable",
"{",
"final",
"Signature",
"sig",
"=",
"pjp",
".",
"getSignature",
"(",
")",
";",
"final",
... | Injection point for logging aspect
@param pjp
where the inject takes pace
@return the point reaches
@throws Throwable
if anything happens | [
"Injection",
"point",
"for",
"logging",
"aspect"
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/commons/src/main/java/org/treetank/aspects/logging/LoggerAspect.java#L51-L59 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/RestXPathProcessor.java | RestXPathProcessor.doXPathRes | private void doXPathRes(final String resource, final Long revision, final OutputStream output,
final boolean nodeid, final String xpath) throws TTException {
// Storage connection to treetank
ISession session = null;
INodeReadTrx rtx = null;
try {
if (mDatabase.exists... | java | private void doXPathRes(final String resource, final Long revision, final OutputStream output,
final boolean nodeid, final String xpath) throws TTException {
// Storage connection to treetank
ISession session = null;
INodeReadTrx rtx = null;
try {
if (mDatabase.exists... | [
"private",
"void",
"doXPathRes",
"(",
"final",
"String",
"resource",
",",
"final",
"Long",
"revision",
",",
"final",
"OutputStream",
"output",
",",
"final",
"boolean",
"nodeid",
",",
"final",
"String",
"xpath",
")",
"throws",
"TTException",
"{",
"// Storage conn... | This method performs an XPath evaluation and writes it to a given output
stream.
@param resource
The existing resource.
@param revision
The revision of the requested document.
@param output
The output stream where the results are written.
@param nodeid
<code>true</code> if node id's have to be delivered. <code>false</... | [
"This",
"method",
"performs",
"an",
"XPath",
"evaluation",
"and",
"writes",
"it",
"to",
"a",
"given",
"output",
"stream",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/RestXPathProcessor.java#L216-L242 | train |
Bedework/bw-util | bw-util-config/src/main/java/org/bedework/util/config/ConfigurationFileStore.java | ConfigurationFileStore.getStore | @Override
public ConfigurationStore getStore(final String name) throws ConfigException {
try {
final File dir = new File(dirPath);
final String newPath = dirPath + name;
final File[] files = dir.listFiles(new DirsOnly());
for (final File f: files) {
if (f.getName().equals(name)) ... | java | @Override
public ConfigurationStore getStore(final String name) throws ConfigException {
try {
final File dir = new File(dirPath);
final String newPath = dirPath + name;
final File[] files = dir.listFiles(new DirsOnly());
for (final File f: files) {
if (f.getName().equals(name)) ... | [
"@",
"Override",
"public",
"ConfigurationStore",
"getStore",
"(",
"final",
"String",
"name",
")",
"throws",
"ConfigException",
"{",
"try",
"{",
"final",
"File",
"dir",
"=",
"new",
"File",
"(",
"dirPath",
")",
";",
"final",
"String",
"newPath",
"=",
"dirPath"... | Get the named store. Create it if it does not exist
@param name of config
@return store
@throws ConfigException | [
"Get",
"the",
"named",
"store",
".",
"Create",
"it",
"if",
"it",
"does",
"not",
"exist"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-config/src/main/java/org/bedework/util/config/ConfigurationFileStore.java#L176-L199 | train |
Bedework/bw-util | bw-util-json/src/main/java/org/bedework/util/json/JsonUtil.java | JsonUtil.jsonNameVal | public static String jsonNameVal(final String indent,
final String name,
final String val) {
StringBuilder sb = new StringBuilder();
sb.append(indent);
sb.append("\"");
sb.append(name);
sb.append("\": ");
if (val != null) ... | java | public static String jsonNameVal(final String indent,
final String name,
final String val) {
StringBuilder sb = new StringBuilder();
sb.append(indent);
sb.append("\"");
sb.append(name);
sb.append("\": ");
if (val != null) ... | [
"public",
"static",
"String",
"jsonNameVal",
"(",
"final",
"String",
"indent",
",",
"final",
"String",
"name",
",",
"final",
"String",
"val",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"indent",
... | Encode a json name and value for output
@param indent initial space
@param name of field
@param val and value
@return encoded String | [
"Encode",
"a",
"json",
"name",
"and",
"value",
"for",
"output"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-json/src/main/java/org/bedework/util/json/JsonUtil.java#L120-L135 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/core/ResponseBuilder.java | ResponseBuilder.createResultElement | private static Element createResultElement(final Document document) {
return document.createElementNS(JaxRxConstants.URL, JaxRxConstants.JAXRX + ":results");
} | java | private static Element createResultElement(final Document document) {
return document.createElementNS(JaxRxConstants.URL, JaxRxConstants.JAXRX + ":results");
} | [
"private",
"static",
"Element",
"createResultElement",
"(",
"final",
"Document",
"document",
")",
"{",
"return",
"document",
".",
"createElementNS",
"(",
"JaxRxConstants",
".",
"URL",
",",
"JaxRxConstants",
".",
"JAXRX",
"+",
"\":results\"",
")",
";",
"}"
] | This method creates the response XML element.
@param document
The {@link Document} instance for the response.
@return The created XML {@link Element}. | [
"This",
"method",
"creates",
"the",
"response",
"XML",
"element",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/core/ResponseBuilder.java#L103-L105 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/core/ResponseBuilder.java | ResponseBuilder.buildDOMResponse | public static StreamingOutput buildDOMResponse(final List<String> availableResources) {
try {
final Document document = createSurroundingXMLResp();
final Element resElement = createResultElement(document);
final List<Element> resources = createCollectionElement(availableRes... | java | public static StreamingOutput buildDOMResponse(final List<String> availableResources) {
try {
final Document document = createSurroundingXMLResp();
final Element resElement = createResultElement(document);
final List<Element> resources = createCollectionElement(availableRes... | [
"public",
"static",
"StreamingOutput",
"buildDOMResponse",
"(",
"final",
"List",
"<",
"String",
">",
"availableResources",
")",
"{",
"try",
"{",
"final",
"Document",
"document",
"=",
"createSurroundingXMLResp",
"(",
")",
";",
"final",
"Element",
"resElement",
"=",... | Builds a DOM response.
@param availableResources
list of resources to include in the output
@return streaming output | [
"Builds",
"a",
"DOM",
"response",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/core/ResponseBuilder.java#L114-L129 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/core/ResponseBuilder.java | ResponseBuilder.createStream | public static StreamingOutput createStream(final Document doc) {
return new StreamingOutput() {
@Override
public void write(final OutputStream output) {
synchronized (output) {
final DOMSource domSource = new DOMSource(doc);
final ... | java | public static StreamingOutput createStream(final Document doc) {
return new StreamingOutput() {
@Override
public void write(final OutputStream output) {
synchronized (output) {
final DOMSource domSource = new DOMSource(doc);
final ... | [
"public",
"static",
"StreamingOutput",
"createStream",
"(",
"final",
"Document",
"doc",
")",
"{",
"return",
"new",
"StreamingOutput",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"write",
"(",
"final",
"OutputStream",
"output",
")",
"{",
"synchronized",
"... | Creates an output stream from the specified document.
@param doc
document input
@return output stream | [
"Creates",
"an",
"output",
"stream",
"from",
"the",
"specified",
"document",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/core/ResponseBuilder.java#L138-L158 | train |
Bedework/bw-util | bw-util-security/src/main/java/org/bedework/util/security/pki/PKITools.java | PKITools.writeFile | private void writeFile(final String fileName,
final byte[] bs,
final boolean append) throws IOException {
FileOutputStream fstr = null;
try {
fstr = new FileOutputStream(fileName, append);
fstr.write(bs);
// Terminate key with newline
f... | java | private void writeFile(final String fileName,
final byte[] bs,
final boolean append) throws IOException {
FileOutputStream fstr = null;
try {
fstr = new FileOutputStream(fileName, append);
fstr.write(bs);
// Terminate key with newline
f... | [
"private",
"void",
"writeFile",
"(",
"final",
"String",
"fileName",
",",
"final",
"byte",
"[",
"]",
"bs",
",",
"final",
"boolean",
"append",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"fstr",
"=",
"null",
";",
"try",
"{",
"fstr",
"=",
"new",
... | Write a single string to a file. Used to write keys
@param fileName String file to write to
@param bs bytes to write
@param append true to add the key to the file.
@throws IOException | [
"Write",
"a",
"single",
"string",
"to",
"a",
"file",
".",
"Used",
"to",
"write",
"keys"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-security/src/main/java/org/bedework/util/security/pki/PKITools.java#L433-L451 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/dom/DOMJaxRx.java | DOMJaxRx.root | static String root(final ResourcePath path) {
if (path.getDepth() == 1)
return path.getResourcePath();
throw new JaxRxException(404, "Resource not found: " + path);
} | java | static String root(final ResourcePath path) {
if (path.getDepth() == 1)
return path.getResourcePath();
throw new JaxRxException(404, "Resource not found: " + path);
} | [
"static",
"String",
"root",
"(",
"final",
"ResourcePath",
"path",
")",
"{",
"if",
"(",
"path",
".",
"getDepth",
"(",
")",
"==",
"1",
")",
"return",
"path",
".",
"getResourcePath",
"(",
")",
";",
"throw",
"new",
"JaxRxException",
"(",
"404",
",",
"\"Res... | Returns the root resource of the specified path.
@param path
path
@return root resource | [
"Returns",
"the",
"root",
"resource",
"of",
"the",
"specified",
"path",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/dom/DOMJaxRx.java#L183-L187 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/core/ResourcePath.java | ResourcePath.getResourcePath | public String getResourcePath() {
final StringBuilder sb = new StringBuilder();
for (final String r : resource)
sb.append(r + '/');
return sb.substring(0, Math.max(0, sb.length() - 1));
} | java | public String getResourcePath() {
final StringBuilder sb = new StringBuilder();
for (final String r : resource)
sb.append(r + '/');
return sb.substring(0, Math.max(0, sb.length() - 1));
} | [
"public",
"String",
"getResourcePath",
"(",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"String",
"r",
":",
"resource",
")",
"sb",
".",
"append",
"(",
"r",
"+",
"'",
"'",
")",
";",
"retur... | Returns the complete resource path string.
@return resource path string | [
"Returns",
"the",
"complete",
"resource",
"path",
"string",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/core/ResourcePath.java#L111-L116 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/core/ResourcePath.java | ResourcePath.getResource | public String getResource(final int level) {
if (level < resource.length) {
return resource[level];
}
// offset is out of bounds...
throw new IndexOutOfBoundsException("Index: " + level + ", Size: " + resource.length);
} | java | public String getResource(final int level) {
if (level < resource.length) {
return resource[level];
}
// offset is out of bounds...
throw new IndexOutOfBoundsException("Index: " + level + ", Size: " + resource.length);
} | [
"public",
"String",
"getResource",
"(",
"final",
"int",
"level",
")",
"{",
"if",
"(",
"level",
"<",
"resource",
".",
"length",
")",
"{",
"return",
"resource",
"[",
"level",
"]",
";",
"}",
"// offset is out of bounds...\r",
"throw",
"new",
"IndexOutOfBoundsExce... | Returns the resource at the specified level.
@param level
resource level
@return resource | [
"Returns",
"the",
"resource",
"at",
"the",
"specified",
"level",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/core/ResourcePath.java#L125-L131 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/HttpServletUtils.java | HttpServletUtils.getHeaders | public static String getHeaders(final HttpServletRequest req) {
Enumeration en = req.getHeaderNames();
StringBuffer sb = new StringBuffer();
while (en.hasMoreElements()) {
String name = (String) en.nextElement();
sb.append(name);
sb.append(": ");
sb.append(req.getHeader(name));
... | java | public static String getHeaders(final HttpServletRequest req) {
Enumeration en = req.getHeaderNames();
StringBuffer sb = new StringBuffer();
while (en.hasMoreElements()) {
String name = (String) en.nextElement();
sb.append(name);
sb.append(": ");
sb.append(req.getHeader(name));
... | [
"public",
"static",
"String",
"getHeaders",
"(",
"final",
"HttpServletRequest",
"req",
")",
"{",
"Enumeration",
"en",
"=",
"req",
".",
"getHeaderNames",
"(",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"while",
"(",
"en",
"."... | Return a concatenated string of all the headers
@param req Incoming HttpServletRequest object
@return header values | [
"Return",
"a",
"concatenated",
"string",
"of",
"all",
"the",
"headers"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/HttpServletUtils.java#L230-L242 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/HttpServletUtils.java | HttpServletUtils.dumpHeaders | public static void dumpHeaders(final HttpServletRequest req) {
Enumeration en = req.getHeaderNames();
while (en.hasMoreElements()) {
String name = (String) en.nextElement();
logger.debug(name + ": " + req.getHeader(name));
}
} | java | public static void dumpHeaders(final HttpServletRequest req) {
Enumeration en = req.getHeaderNames();
while (en.hasMoreElements()) {
String name = (String) en.nextElement();
logger.debug(name + ": " + req.getHeader(name));
}
} | [
"public",
"static",
"void",
"dumpHeaders",
"(",
"final",
"HttpServletRequest",
"req",
")",
"{",
"Enumeration",
"en",
"=",
"req",
".",
"getHeaderNames",
"(",
")",
";",
"while",
"(",
"en",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"String",
"name",
"=",
... | Print all the headers
@param req Incoming HttpServletRequest object | [
"Print",
"all",
"the",
"headers"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/HttpServletUtils.java#L248-L254 | train |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/HttpServletUtils.java | HttpServletUtils.getLocales | public static Collection<Locale> getLocales(final HttpServletRequest req) {
if (req.getHeader("Accept-Language") == null) {
return null;
}
@SuppressWarnings("unchecked")
Enumeration<Locale> lcs = req.getLocales();
ArrayList<Locale> locales = new ArrayList<Locale>();
while (lcs.hasMoreElem... | java | public static Collection<Locale> getLocales(final HttpServletRequest req) {
if (req.getHeader("Accept-Language") == null) {
return null;
}
@SuppressWarnings("unchecked")
Enumeration<Locale> lcs = req.getLocales();
ArrayList<Locale> locales = new ArrayList<Locale>();
while (lcs.hasMoreElem... | [
"public",
"static",
"Collection",
"<",
"Locale",
">",
"getLocales",
"(",
"final",
"HttpServletRequest",
"req",
")",
"{",
"if",
"(",
"req",
".",
"getHeader",
"(",
"\"Accept-Language\"",
")",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"@",
"Suppress... | If there is no Accept-Language header returns null, otherwise returns a
collection of Locales ordered with preferred first.
@param req
@return Collection of locales or null | [
"If",
"there",
"is",
"no",
"Accept",
"-",
"Language",
"header",
"returns",
"null",
"otherwise",
"returns",
"a",
"collection",
"of",
"Locales",
"ordered",
"with",
"preferred",
"first",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/HttpServletUtils.java#L262-L275 | train |
Bedework/bw-util | bw-util-timezones/src/main/java/org/bedework/util/timezones/Timezones.java | Timezones.initTimezones | public static void initTimezones(final String serverUrl) throws TimezonesException {
try {
if (tzs == null) {
tzs = (Timezones)Class.forName("org.bedework.util.timezones.TimezonesImpl").newInstance();
}
tzs.init(serverUrl);
} catch (final TimezonesException te) {
throw te;
}... | java | public static void initTimezones(final String serverUrl) throws TimezonesException {
try {
if (tzs == null) {
tzs = (Timezones)Class.forName("org.bedework.util.timezones.TimezonesImpl").newInstance();
}
tzs.init(serverUrl);
} catch (final TimezonesException te) {
throw te;
}... | [
"public",
"static",
"void",
"initTimezones",
"(",
"final",
"String",
"serverUrl",
")",
"throws",
"TimezonesException",
"{",
"try",
"{",
"if",
"(",
"tzs",
"==",
"null",
")",
"{",
"tzs",
"=",
"(",
"Timezones",
")",
"Class",
".",
"forName",
"(",
"\"org.bedewo... | Initialize the timezones system.
@param serverUrl url of timezone server
@throws TimezonesException on error | [
"Initialize",
"the",
"timezones",
"system",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-timezones/src/main/java/org/bedework/util/timezones/Timezones.java#L86-L98 | train |
Bedework/bw-util | bw-util-timezones/src/main/java/org/bedework/util/timezones/Timezones.java | Timezones.getThreadDefaultTzid | public static String getThreadDefaultTzid() throws TimezonesException {
final String id = threadTzid.get();
if (id != null) {
return id;
}
return getSystemDefaultTzid();
} | java | public static String getThreadDefaultTzid() throws TimezonesException {
final String id = threadTzid.get();
if (id != null) {
return id;
}
return getSystemDefaultTzid();
} | [
"public",
"static",
"String",
"getThreadDefaultTzid",
"(",
")",
"throws",
"TimezonesException",
"{",
"final",
"String",
"id",
"=",
"threadTzid",
".",
"get",
"(",
")",
";",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"return",
"id",
";",
"}",
"return",
"getS... | Get the default timezone id for this thread.
@return String id
@throws TimezonesException on error | [
"Get",
"the",
"default",
"timezone",
"id",
"for",
"this",
"thread",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-timezones/src/main/java/org/bedework/util/timezones/Timezones.java#L143-L150 | train |
Bedework/bw-util | bw-util-timezones/src/main/java/org/bedework/util/timezones/Timezones.java | Timezones.getUtc | public static String getUtc(final String time,
final String tzid) throws TimezonesException {
return getTimezones().calculateUtc(time, tzid);
} | java | public static String getUtc(final String time,
final String tzid) throws TimezonesException {
return getTimezones().calculateUtc(time, tzid);
} | [
"public",
"static",
"String",
"getUtc",
"(",
"final",
"String",
"time",
",",
"final",
"String",
"tzid",
")",
"throws",
"TimezonesException",
"{",
"return",
"getTimezones",
"(",
")",
".",
"calculateUtc",
"(",
"time",
",",
"tzid",
")",
";",
"}"
] | Given a String time value and a possibly null tzid,
will return a UTC formatted value. The supplied time should be of the
form yyyyMMdd or yyyyMMddThhmmss or yyyyMMddThhmmssZ
<p>The last form will be returned untouched, it's already UTC.
<p>the first will have T000000 appended to the parameter value then the
first an... | [
"Given",
"a",
"String",
"time",
"value",
"and",
"a",
"possibly",
"null",
"tzid",
"will",
"return",
"a",
"UTC",
"formatted",
"value",
".",
"The",
"supplied",
"time",
"should",
"be",
"of",
"the",
"form",
"yyyyMMdd",
"or",
"yyyyMMddThhmmss",
"or",
"yyyyMMddThhm... | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-timezones/src/main/java/org/bedework/util/timezones/Timezones.java#L191-L194 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/logging/log4j/Log4jUtils.java | Log4jUtils.rolloverLogfile | public static void rolloverLogfile() {
Logger logger = Logger.getRootLogger(); // NOSONAR - local logger used on purpose here
@SuppressWarnings("unchecked")
Enumeration<Object> appenders = logger.getAllAppenders();
while(appenders.hasMoreElements()) {
Object obj = appenders.nextElement();
if(obj ins... | java | public static void rolloverLogfile() {
Logger logger = Logger.getRootLogger(); // NOSONAR - local logger used on purpose here
@SuppressWarnings("unchecked")
Enumeration<Object> appenders = logger.getAllAppenders();
while(appenders.hasMoreElements()) {
Object obj = appenders.nextElement();
if(obj ins... | [
"public",
"static",
"void",
"rolloverLogfile",
"(",
")",
"{",
"Logger",
"logger",
"=",
"Logger",
".",
"getRootLogger",
"(",
")",
";",
"// NOSONAR - local logger used on purpose here",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Enumeration",
"<",
"Object",
... | Manually roll over logfiles to start with a new logfile | [
"Manually",
"roll",
"over",
"logfiles",
"to",
"start",
"with",
"a",
"new",
"logfile"
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/logging/log4j/Log4jUtils.java#L12-L22 | train |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/access/Storage.java | Storage.createStorage | public static synchronized boolean createStorage(final StorageConfiguration pStorageConfig)
throws TTIOException {
boolean returnVal = true;
// if file is existing, skipping
if (!pStorageConfig.mFile.exists() && pStorageConfig.mFile.mkdirs()) {
returnVal =
IOU... | java | public static synchronized boolean createStorage(final StorageConfiguration pStorageConfig)
throws TTIOException {
boolean returnVal = true;
// if file is existing, skipping
if (!pStorageConfig.mFile.exists() && pStorageConfig.mFile.mkdirs()) {
returnVal =
IOU... | [
"public",
"static",
"synchronized",
"boolean",
"createStorage",
"(",
"final",
"StorageConfiguration",
"pStorageConfig",
")",
"throws",
"TTIOException",
"{",
"boolean",
"returnVal",
"=",
"true",
";",
"// if file is existing, skipping",
"if",
"(",
"!",
"pStorageConfig",
"... | Creating a storage. This includes loading the storageconfiguration,
building up the structure and preparing everything for login.
@param pStorageConfig
which are used for the storage, including storage location
@return true if creation is valid, false otherwise
@throws TTIOException
if something odd happens within th... | [
"Creating",
"a",
"storage",
".",
"This",
"includes",
"loading",
"the",
"storageconfiguration",
"building",
"up",
"the",
"structure",
"and",
"preparing",
"everything",
"for",
"login",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/Storage.java#L103-L121 | train |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/access/Storage.java | Storage.truncateStorage | public static synchronized void truncateStorage(final StorageConfiguration pConf) throws TTException {
// check that database must be closed beforehand
if (!STORAGEMAP.containsKey(pConf.mFile)) {
if (existsStorage(pConf.mFile)) {
final IStorage storage = new Storage(pConf);
... | java | public static synchronized void truncateStorage(final StorageConfiguration pConf) throws TTException {
// check that database must be closed beforehand
if (!STORAGEMAP.containsKey(pConf.mFile)) {
if (existsStorage(pConf.mFile)) {
final IStorage storage = new Storage(pConf);
... | [
"public",
"static",
"synchronized",
"void",
"truncateStorage",
"(",
"final",
"StorageConfiguration",
"pConf",
")",
"throws",
"TTException",
"{",
"// check that database must be closed beforehand",
"if",
"(",
"!",
"STORAGEMAP",
".",
"containsKey",
"(",
"pConf",
".",
"mFi... | Truncate a storage. This deletes all relevant data. All running sessions
must be closed beforehand.
@param pConf
the storage at this path should be deleted.
@throws TTException
any kind of false Treetank behaviour | [
"Truncate",
"a",
"storage",
".",
"This",
"deletes",
"all",
"relevant",
"data",
".",
"All",
"running",
"sessions",
"must",
"be",
"closed",
"beforehand",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/Storage.java#L132-L147 | train |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/access/Storage.java | Storage.existsStorage | public static synchronized boolean existsStorage(final File pStoragePath) {
// if file is existing and folder is a tt-dataplace, delete it
if (pStoragePath.exists()
&& IOUtils.compareStructure(pStoragePath, StorageConfiguration.Paths.values()) == 0) {
return true;
} else ... | java | public static synchronized boolean existsStorage(final File pStoragePath) {
// if file is existing and folder is a tt-dataplace, delete it
if (pStoragePath.exists()
&& IOUtils.compareStructure(pStoragePath, StorageConfiguration.Paths.values()) == 0) {
return true;
} else ... | [
"public",
"static",
"synchronized",
"boolean",
"existsStorage",
"(",
"final",
"File",
"pStoragePath",
")",
"{",
"// if file is existing and folder is a tt-dataplace, delete it",
"if",
"(",
"pStoragePath",
".",
"exists",
"(",
")",
"&&",
"IOUtils",
".",
"compareStructure",
... | Check if Storage exists or not at a given path.
@param pStoragePath
to be checked.
@return true if existing, false otherwise. | [
"Check",
"if",
"Storage",
"exists",
"or",
"not",
"at",
"a",
"given",
"path",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/Storage.java#L156-L165 | train |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/access/Storage.java | Storage.openStorage | public static synchronized IStorage openStorage(final File pFile) throws TTException {
checkState(existsStorage(pFile), "DB could not be opened (since it was not created?) at location %s",
pFile);
StorageConfiguration config = StorageConfiguration.deserialize(pFile);
final Storage st... | java | public static synchronized IStorage openStorage(final File pFile) throws TTException {
checkState(existsStorage(pFile), "DB could not be opened (since it was not created?) at location %s",
pFile);
StorageConfiguration config = StorageConfiguration.deserialize(pFile);
final Storage st... | [
"public",
"static",
"synchronized",
"IStorage",
"openStorage",
"(",
"final",
"File",
"pFile",
")",
"throws",
"TTException",
"{",
"checkState",
"(",
"existsStorage",
"(",
"pFile",
")",
",",
"\"DB could not be opened (since it was not created?) at location %s\"",
",",
"pFil... | Open database. A database can be opened only once. Afterwards the
singleton instance bound to the File is given back.
@param pFile
where the database is located sessionConf a {@link SessionConfiguration} object to set up
the session
@return {@link IStorage} instance.
@throws TTException
if something odd happens | [
"Open",
"database",
".",
"A",
"database",
"can",
"be",
"opened",
"only",
"once",
".",
"Afterwards",
"the",
"singleton",
"instance",
"bound",
"to",
"the",
"File",
"is",
"given",
"back",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/Storage.java#L239-L250 | train |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/access/Storage.java | Storage.bootstrap | private static void bootstrap(final Storage pStorage, final ResourceConfiguration pResourceConf)
throws TTException {
final IBackend storage = pResourceConf.mBackend;
storage.initialize();
final IBackendWriter writer = storage.getWriter();
final UberBucket uberBucket = new Uber... | java | private static void bootstrap(final Storage pStorage, final ResourceConfiguration pResourceConf)
throws TTException {
final IBackend storage = pResourceConf.mBackend;
storage.initialize();
final IBackendWriter writer = storage.getWriter();
final UberBucket uberBucket = new Uber... | [
"private",
"static",
"void",
"bootstrap",
"(",
"final",
"Storage",
"pStorage",
",",
"final",
"ResourceConfiguration",
"pResourceConf",
")",
"throws",
"TTException",
"{",
"final",
"IBackend",
"storage",
"=",
"pResourceConf",
".",
"mBackend",
";",
"storage",
".",
"i... | Boostraping a resource within this storage.
@param pStorage
storage where the new resource should be created in.
@param pResourceConf
related {@link ResourceConfiguration} for the new resource
@throws TTException | [
"Boostraping",
"a",
"resource",
"within",
"this",
"storage",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/Storage.java#L338-L400 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java | XPathScanner.nextToken | public IXPathToken nextToken() {
// some tokens start in another state than the START state
mState = mStartState;
// reset startState
mStartState = State.START;
mOutput = new StringBuilder();
mFinnished = false;
mType = TokenType.INVALID;
mLastPos = mPos;... | java | public IXPathToken nextToken() {
// some tokens start in another state than the START state
mState = mStartState;
// reset startState
mStartState = State.START;
mOutput = new StringBuilder();
mFinnished = false;
mType = TokenType.INVALID;
mLastPos = mPos;... | [
"public",
"IXPathToken",
"nextToken",
"(",
")",
"{",
"// some tokens start in another state than the START state",
"mState",
"=",
"mStartState",
";",
"// reset startState",
"mStartState",
"=",
"State",
".",
"START",
";",
"mOutput",
"=",
"new",
"StringBuilder",
"(",
")",... | Reads the string char by char and returns one token by call. The scanning
starts in the start state, if not further specified before, and specifies
the next scanner state and the type of the future token according to its
first char. As soon as the current char does not fit the conditions for
the current token type, the... | [
"Reads",
"the",
"string",
"char",
"by",
"char",
"and",
"returns",
"one",
"token",
"by",
"call",
".",
"The",
"scanning",
"starts",
"in",
"the",
"start",
"state",
"if",
"not",
"further",
"specified",
"before",
"and",
"specifies",
"the",
"next",
"scanner",
"s... | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java#L128-L172 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java | XPathScanner.scanStart | private void scanStart() {
if (isNumber(mInput)) {
mState = State.NUMBER;
mOutput.append(mInput);
mType = TokenType.VALUE; // number
} else if (isFirstLetter(mInput)) {
mState = State.TEXT; // word
mOutput.append(mInput);
mType = T... | java | private void scanStart() {
if (isNumber(mInput)) {
mState = State.NUMBER;
mOutput.append(mInput);
mType = TokenType.VALUE; // number
} else if (isFirstLetter(mInput)) {
mState = State.TEXT; // word
mOutput.append(mInput);
mType = T... | [
"private",
"void",
"scanStart",
"(",
")",
"{",
"if",
"(",
"isNumber",
"(",
"mInput",
")",
")",
"{",
"mState",
"=",
"State",
".",
"NUMBER",
";",
"mOutput",
".",
"append",
"(",
"mInput",
")",
";",
"mType",
"=",
"TokenType",
".",
"VALUE",
";",
"// numbe... | Scans the first character of a token and decides, what type it is. | [
"Scans",
"the",
"first",
"character",
"of",
"a",
"token",
"and",
"decides",
"what",
"type",
"it",
"is",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java#L177-L211 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java | XPathScanner.retrieveType | private TokenType retrieveType(final char paramInput) {
TokenType type;
switch (paramInput) {
case ',':
type = TokenType.COMMA;
break;
case '(':
type = TokenType.OPEN_BR;
break;
case ')':
type = TokenType.CLOSE_BR;
... | java | private TokenType retrieveType(final char paramInput) {
TokenType type;
switch (paramInput) {
case ',':
type = TokenType.COMMA;
break;
case '(':
type = TokenType.OPEN_BR;
break;
case ')':
type = TokenType.CLOSE_BR;
... | [
"private",
"TokenType",
"retrieveType",
"(",
"final",
"char",
"paramInput",
")",
"{",
"TokenType",
"type",
";",
"switch",
"(",
"paramInput",
")",
"{",
"case",
"'",
"'",
":",
"type",
"=",
"TokenType",
".",
"COMMA",
";",
"break",
";",
"case",
"'",
"'",
"... | Returns the type of the given character.
@param paramInput
The character the type should be determined
@return type of the given character. | [
"Returns",
"the",
"type",
"of",
"the",
"given",
"character",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java#L220-L290 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java | XPathScanner.isSpecial | private boolean isSpecial(final char paramInput) {
return (paramInput == ')') || (paramInput == ';') || (paramInput == ',') || (paramInput == '@')
|| (paramInput == '[') || (paramInput == ']') || (paramInput == '=') || (paramInput == '"')
|| (paramInput == '\'') || (paramInput == '$') |... | java | private boolean isSpecial(final char paramInput) {
return (paramInput == ')') || (paramInput == ';') || (paramInput == ',') || (paramInput == '@')
|| (paramInput == '[') || (paramInput == ']') || (paramInput == '=') || (paramInput == '"')
|| (paramInput == '\'') || (paramInput == '$') |... | [
"private",
"boolean",
"isSpecial",
"(",
"final",
"char",
"paramInput",
")",
"{",
"return",
"(",
"paramInput",
"==",
"'",
"'",
")",
"||",
"(",
"paramInput",
"==",
"'",
"'",
")",
"||",
"(",
"paramInput",
"==",
"'",
"'",
")",
"||",
"(",
"paramInput",
"=... | Checks if the given character is a special character.
@param paramInput
The character to check.
@return Returns true, if the character is a special character. | [
"Checks",
"if",
"the",
"given",
"character",
"is",
"a",
"special",
"character",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java#L339-L345 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java | XPathScanner.scanNumber | private void scanNumber() {
if (mInput >= '0' && mInput <= '9') {
mOutput.append(mInput);
mPos++;
} else {
// could be an e-number
if (mInput == 'E' || mInput == 'e') {
mStartState = State.E_NUM;
}
mFinnished = true... | java | private void scanNumber() {
if (mInput >= '0' && mInput <= '9') {
mOutput.append(mInput);
mPos++;
} else {
// could be an e-number
if (mInput == 'E' || mInput == 'e') {
mStartState = State.E_NUM;
}
mFinnished = true... | [
"private",
"void",
"scanNumber",
"(",
")",
"{",
"if",
"(",
"mInput",
">=",
"'",
"'",
"&&",
"mInput",
"<=",
"'",
"'",
")",
"{",
"mOutput",
".",
"append",
"(",
"mInput",
")",
";",
"mPos",
"++",
";",
"}",
"else",
"{",
"// could be an e-number",
"if",
... | Scans a number token. A number only consists of digits. | [
"Scans",
"a",
"number",
"token",
".",
"A",
"number",
"only",
"consists",
"of",
"digits",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java#L350-L362 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java | XPathScanner.scanText | private void scanText() {
if (isLetter(mInput)) {
mOutput.append(mInput);
mPos++;
} else {
mType = TokenType.TEXT;
mFinnished = true;
}
} | java | private void scanText() {
if (isLetter(mInput)) {
mOutput.append(mInput);
mPos++;
} else {
mType = TokenType.TEXT;
mFinnished = true;
}
} | [
"private",
"void",
"scanText",
"(",
")",
"{",
"if",
"(",
"isLetter",
"(",
"mInput",
")",
")",
"{",
"mOutput",
".",
"append",
"(",
"mInput",
")",
";",
"mPos",
"++",
";",
"}",
"else",
"{",
"mType",
"=",
"TokenType",
".",
"TEXT",
";",
"mFinnished",
"=... | Scans text token. A text is everything that with a character. It can
contain numbers, all letters in upper or lower case and underscores. | [
"Scans",
"text",
"token",
".",
"A",
"text",
"is",
"everything",
"that",
"with",
"a",
"character",
".",
"It",
"can",
"contain",
"numbers",
"all",
"letters",
"in",
"upper",
"or",
"lower",
"case",
"and",
"underscores",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java#L368-L378 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java | XPathScanner.scanENum | private void scanENum() {
if (mInput == 'E' || mInput == 'e') {
mOutput.append(mInput);
mState = State.START;
mType = TokenType.E_NUMBER;
mFinnished = true;
mPos++;
} else {
mFinnished = true;
mState = State.START;
... | java | private void scanENum() {
if (mInput == 'E' || mInput == 'e') {
mOutput.append(mInput);
mState = State.START;
mType = TokenType.E_NUMBER;
mFinnished = true;
mPos++;
} else {
mFinnished = true;
mState = State.START;
... | [
"private",
"void",
"scanENum",
"(",
")",
"{",
"if",
"(",
"mInput",
"==",
"'",
"'",
"||",
"mInput",
"==",
"'",
"'",
")",
"{",
"mOutput",
".",
"append",
"(",
"mInput",
")",
";",
"mState",
"=",
"State",
".",
"START",
";",
"mType",
"=",
"TokenType",
... | Scans all numbers that contain an e. | [
"Scans",
"all",
"numbers",
"that",
"contain",
"an",
"e",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathScanner.java#L420-L433 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.