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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java | ParseTreeUtils.findNode | public static <V> Node<V> findNode(List<Node<V>> parents, Predicate<Node<V>> predicate) {
checkArgNotNull(predicate, "predicate");
if (parents != null && !parents.isEmpty()) {
for (Node<V> child : parents) {
Node<V> found = findNode(child, predicate);
if (foun... | java | public static <V> Node<V> findNode(List<Node<V>> parents, Predicate<Node<V>> predicate) {
checkArgNotNull(predicate, "predicate");
if (parents != null && !parents.isEmpty()) {
for (Node<V> child : parents) {
Node<V> found = findNode(child, predicate);
if (foun... | [
"public",
"static",
"<",
"V",
">",
"Node",
"<",
"V",
">",
"findNode",
"(",
"List",
"<",
"Node",
"<",
"V",
">",
">",
"parents",
",",
"Predicate",
"<",
"Node",
"<",
"V",
">",
">",
"predicate",
")",
"{",
"checkArgNotNull",
"(",
"predicate",
",",
"\"pr... | Returns the first node underneath the given parents for which the given predicate evaluates to true.
If parents is null or empty or no node is found the method returns null.
@param parents the parent Nodes to look through
@param predicate the predicate
@return the Node if found or null if not found | [
"Returns",
"the",
"first",
"node",
"underneath",
"the",
"given",
"parents",
"for",
"which",
"the",
"given",
"predicate",
"evaluates",
"to",
"true",
".",
"If",
"parents",
"is",
"null",
"or",
"empty",
"or",
"no",
"node",
"is",
"found",
"the",
"method",
"retu... | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java#L163-L172 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java | ParseTreeUtils.findNodeByLabel | public static <V> Node<V> findNodeByLabel(Node<V> parent, String labelPrefix) {
return findNode(parent, new LabelPrefixPredicate<V>(labelPrefix));
} | java | public static <V> Node<V> findNodeByLabel(Node<V> parent, String labelPrefix) {
return findNode(parent, new LabelPrefixPredicate<V>(labelPrefix));
} | [
"public",
"static",
"<",
"V",
">",
"Node",
"<",
"V",
">",
"findNodeByLabel",
"(",
"Node",
"<",
"V",
">",
"parent",
",",
"String",
"labelPrefix",
")",
"{",
"return",
"findNode",
"(",
"parent",
",",
"new",
"LabelPrefixPredicate",
"<",
"V",
">",
"(",
"lab... | Returns the first node underneath the given parent for which matches the given label prefix.
If parents is null or empty or no node is found the method returns null.
@param parent the parent node
@param labelPrefix the label prefix to look for
@return the Node if found or null if not found | [
"Returns",
"the",
"first",
"node",
"underneath",
"the",
"given",
"parent",
"for",
"which",
"matches",
"the",
"given",
"label",
"prefix",
".",
"If",
"parents",
"is",
"null",
"or",
"empty",
"or",
"no",
"node",
"is",
"found",
"the",
"method",
"returns",
"null... | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java#L182-L184 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java | ParseTreeUtils.findNodeByLabel | public static <V> Node<V> findNodeByLabel(List<Node<V>> parents, String labelPrefix) {
return findNode(parents, new LabelPrefixPredicate<V>(labelPrefix));
} | java | public static <V> Node<V> findNodeByLabel(List<Node<V>> parents, String labelPrefix) {
return findNode(parents, new LabelPrefixPredicate<V>(labelPrefix));
} | [
"public",
"static",
"<",
"V",
">",
"Node",
"<",
"V",
">",
"findNodeByLabel",
"(",
"List",
"<",
"Node",
"<",
"V",
">",
">",
"parents",
",",
"String",
"labelPrefix",
")",
"{",
"return",
"findNode",
"(",
"parents",
",",
"new",
"LabelPrefixPredicate",
"<",
... | Returns the first node underneath the given parents which matches the given label prefix.
If parents is null or empty or no node is found the method returns null.
@param parents the parent Nodes to look through
@param labelPrefix the label prefix to look for
@return the Node if found or null if not found | [
"Returns",
"the",
"first",
"node",
"underneath",
"the",
"given",
"parents",
"which",
"matches",
"the",
"given",
"label",
"prefix",
".",
"If",
"parents",
"is",
"null",
"or",
"empty",
"or",
"no",
"node",
"is",
"found",
"the",
"method",
"returns",
"null",
"."... | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java#L194-L196 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java | ParseTreeUtils.findLastNode | public static <V> Node<V> findLastNode(List<Node<V>> parents, Predicate<Node<V>> predicate) {
checkArgNotNull(predicate, "predicate");
if (parents != null && !parents.isEmpty()) {
int parentsSize = parents.size();
for (int i = parentsSize - 1; i >= 0; i--) {
Node<... | java | public static <V> Node<V> findLastNode(List<Node<V>> parents, Predicate<Node<V>> predicate) {
checkArgNotNull(predicate, "predicate");
if (parents != null && !parents.isEmpty()) {
int parentsSize = parents.size();
for (int i = parentsSize - 1; i >= 0; i--) {
Node<... | [
"public",
"static",
"<",
"V",
">",
"Node",
"<",
"V",
">",
"findLastNode",
"(",
"List",
"<",
"Node",
"<",
"V",
">",
">",
"parents",
",",
"Predicate",
"<",
"Node",
"<",
"V",
">",
">",
"predicate",
")",
"{",
"checkArgNotNull",
"(",
"predicate",
",",
"... | Returns the last node underneath the given parents for which the given predicate evaluates to true.
If parents is null or empty or no node is found the method returns null.
@param parents the parent Nodes to look through
@param predicate the predicate
@return the Node if found or null if not found | [
"Returns",
"the",
"last",
"node",
"underneath",
"the",
"given",
"parents",
"for",
"which",
"the",
"given",
"predicate",
"evaluates",
"to",
"true",
".",
"If",
"parents",
"is",
"null",
"or",
"empty",
"or",
"no",
"node",
"is",
"found",
"the",
"method",
"retur... | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java#L226-L236 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java | ParseTreeUtils.collectNodes | public static <V, C extends Collection<Node<V>>> C collectNodes(Node<V> parent,
Predicate<Node<V>> predicate,
C collection) {
checkArgNotNull(predicate, "predicate");
c... | java | public static <V, C extends Collection<Node<V>>> C collectNodes(Node<V> parent,
Predicate<Node<V>> predicate,
C collection) {
checkArgNotNull(predicate, "predicate");
c... | [
"public",
"static",
"<",
"V",
",",
"C",
"extends",
"Collection",
"<",
"Node",
"<",
"V",
">",
">",
">",
"C",
"collectNodes",
"(",
"Node",
"<",
"V",
">",
"parent",
",",
"Predicate",
"<",
"Node",
"<",
"V",
">",
">",
"predicate",
",",
"C",
"collection"... | Collects all nodes underneath the given parent for which the given predicate evaluates to true.
@param parent the parent Node
@param predicate the predicate
@param collection the collection to collect the found Nodes into
@return the same collection instance passed as a parameter | [
"Collects",
"all",
"nodes",
"underneath",
"the",
"given",
"parent",
"for",
"which",
"the",
"given",
"predicate",
"evaluates",
"to",
"true",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java#L246-L253 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java | ParseTreeUtils.getNodeText | public static String getNodeText(Node<?> node, InputBuffer inputBuffer) {
checkArgNotNull(node, "node");
checkArgNotNull(inputBuffer, "inputBuffer");
if (node.hasError()) {
// if the node has a parse error we cannot simply cut a string out of the underlying input buffer, since we
... | java | public static String getNodeText(Node<?> node, InputBuffer inputBuffer) {
checkArgNotNull(node, "node");
checkArgNotNull(inputBuffer, "inputBuffer");
if (node.hasError()) {
// if the node has a parse error we cannot simply cut a string out of the underlying input buffer, since we
... | [
"public",
"static",
"String",
"getNodeText",
"(",
"Node",
"<",
"?",
">",
"node",
",",
"InputBuffer",
"inputBuffer",
")",
"{",
"checkArgNotNull",
"(",
"node",
",",
"\"node\"",
")",
";",
"checkArgNotNull",
"(",
"inputBuffer",
",",
"\"inputBuffer\"",
")",
";",
... | Returns the input text matched by the given node, with error correction.
@param node the node
@param inputBuffer the underlying inputBuffer
@return null if node is null otherwise a string with the matched input text (which can be empty) | [
"Returns",
"the",
"input",
"text",
"matched",
"by",
"the",
"given",
"node",
"with",
"error",
"correction",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java#L262-L294 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java | ParseTreeUtils.collectNodes | public static <V, C extends Collection<Node<V>>> C collectNodes(List<Node<V>> parents,
Predicate<Node<V>> predicate,
C collection) {
checkArgNotNull(predicate, "predicate");
... | java | public static <V, C extends Collection<Node<V>>> C collectNodes(List<Node<V>> parents,
Predicate<Node<V>> predicate,
C collection) {
checkArgNotNull(predicate, "predicate");
... | [
"public",
"static",
"<",
"V",
",",
"C",
"extends",
"Collection",
"<",
"Node",
"<",
"V",
">",
">",
">",
"C",
"collectNodes",
"(",
"List",
"<",
"Node",
"<",
"V",
">",
">",
"parents",
",",
"Predicate",
"<",
"Node",
"<",
"V",
">",
">",
"predicate",
"... | Collects all nodes underneath the given parents for which the given predicate evaluates to true.
@param parents the parent Nodes to look through
@param predicate the predicate
@param collection the collection to collect the found Nodes into
@return the same collection instance passed as a parameter | [
"Collects",
"all",
"nodes",
"underneath",
"the",
"given",
"parents",
"for",
"which",
"the",
"given",
"predicate",
"evaluates",
"to",
"true",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java#L304-L318 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/buffers/InputBufferUtils.java | InputBufferUtils.collectContent | public static String collectContent(InputBuffer buf) {
StringBuilder sb = new StringBuilder();
int ix = 0;
loop:
while (true) {
char c = buf.charAt(ix++);
switch (c) {
case INDENT:
sb.append('\u00bb'); // right pointed double a... | java | public static String collectContent(InputBuffer buf) {
StringBuilder sb = new StringBuilder();
int ix = 0;
loop:
while (true) {
char c = buf.charAt(ix++);
switch (c) {
case INDENT:
sb.append('\u00bb'); // right pointed double a... | [
"public",
"static",
"String",
"collectContent",
"(",
"InputBuffer",
"buf",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"ix",
"=",
"0",
";",
"loop",
":",
"while",
"(",
"true",
")",
"{",
"char",
"c",
"=",
"buf",
... | Collects the actual input text the input buffer provides into a String.
This is especially useful for IndentDedentInputBuffers created by "transformIndents".
@param buf the input buffer to collect from
@return a string containing the content of the given input buffer | [
"Collects",
"the",
"actual",
"input",
"text",
"the",
"input",
"buffer",
"provides",
"into",
"a",
"String",
".",
"This",
"is",
"especially",
"useful",
"for",
"IndentDedentInputBuffers",
"created",
"by",
"transformIndents",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/buffers/InputBufferUtils.java#L31-L52 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/StringVar.java | StringVar.append | public boolean append(char c) {
return set(get() == null ? String.valueOf(c) : get() + c);
} | java | public boolean append(char c) {
return set(get() == null ? String.valueOf(c) : get() + c);
} | [
"public",
"boolean",
"append",
"(",
"char",
"c",
")",
"{",
"return",
"set",
"(",
"get",
"(",
")",
"==",
"null",
"?",
"String",
".",
"valueOf",
"(",
"c",
")",
":",
"get",
"(",
")",
"+",
"c",
")",
";",
"}"
] | Appends the given char.
If this instance is currently uninitialized the given char is used for initialization.
@param c the char to append
@return true | [
"Appends",
"the",
"given",
"char",
".",
"If",
"this",
"instance",
"is",
"currently",
"uninitialized",
"the",
"given",
"char",
"is",
"used",
"for",
"initialization",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/StringVar.java#L78-L80 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/Checks.java | Checks.ensure | public static void ensure(boolean condition, String errorMessageFormat, Object... errorMessageArgs) {
if (!condition) {
throw new GrammarException(errorMessageFormat, errorMessageArgs);
}
} | java | public static void ensure(boolean condition, String errorMessageFormat, Object... errorMessageArgs) {
if (!condition) {
throw new GrammarException(errorMessageFormat, errorMessageArgs);
}
} | [
"public",
"static",
"void",
"ensure",
"(",
"boolean",
"condition",
",",
"String",
"errorMessageFormat",
",",
"Object",
"...",
"errorMessageArgs",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"GrammarException",
"(",
"errorMessageFormat",
",",... | Throws a GrammarException if the given condition is not met.
@param condition the condition
@param errorMessageFormat the error message format
@param errorMessageArgs the error message arguments | [
"Throws",
"a",
"GrammarException",
"if",
"the",
"given",
"condition",
"is",
"not",
"met",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/Checks.java#L35-L39 | train |
sirthias/parboiled | parboiled-java/src/main/java/org/parboiled/transform/InstructionGroupCreator.java | InstructionGroupCreator.sort | private void sort(InstructionGroup group) {
final InsnList instructions = method.instructions;
Collections.sort(group.getNodes(), new Comparator<InstructionGraphNode>() {
public int compare(InstructionGraphNode a, InstructionGraphNode b) {
return Integer.valueOf(instructions.... | java | private void sort(InstructionGroup group) {
final InsnList instructions = method.instructions;
Collections.sort(group.getNodes(), new Comparator<InstructionGraphNode>() {
public int compare(InstructionGraphNode a, InstructionGraphNode b) {
return Integer.valueOf(instructions.... | [
"private",
"void",
"sort",
"(",
"InstructionGroup",
"group",
")",
"{",
"final",
"InsnList",
"instructions",
"=",
"method",
".",
"instructions",
";",
"Collections",
".",
"sort",
"(",
"group",
".",
"getNodes",
"(",
")",
",",
"new",
"Comparator",
"<",
"Instruct... | sort the group instructions according to their method index | [
"sort",
"the",
"group",
"instructions",
"according",
"to",
"their",
"method",
"index"
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-java/src/main/java/org/parboiled/transform/InstructionGroupCreator.java#L101-L109 | train |
sirthias/parboiled | parboiled-java/src/main/java/org/parboiled/transform/InstructionGroupCreator.java | InstructionGroupCreator.markUngroupedEnclosedNodes | private void markUngroupedEnclosedNodes(InstructionGroup group) {
while_:
while (true) {
for (int i = getIndexOfFirstInsn(group), max = getIndexOfLastInsn(group); i < max; i++) {
InstructionGraphNode node = method.getGraphNodes().get(i);
if (node.getGroup() ==... | java | private void markUngroupedEnclosedNodes(InstructionGroup group) {
while_:
while (true) {
for (int i = getIndexOfFirstInsn(group), max = getIndexOfLastInsn(group); i < max; i++) {
InstructionGraphNode node = method.getGraphNodes().get(i);
if (node.getGroup() ==... | [
"private",
"void",
"markUngroupedEnclosedNodes",
"(",
"InstructionGroup",
"group",
")",
"{",
"while_",
":",
"while",
"(",
"true",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"getIndexOfFirstInsn",
"(",
"group",
")",
",",
"max",
"=",
"getIndexOfLastInsn",
"(",
"gr... | also capture all group nodes "hidden" behind xLoads | [
"also",
"capture",
"all",
"group",
"nodes",
"hidden",
"behind",
"xLoads"
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-java/src/main/java/org/parboiled/transform/InstructionGroupCreator.java#L112-L125 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/MatcherPath.java | MatcherPath.isPrefixOf | public boolean isPrefixOf(MatcherPath that) {
checkArgNotNull(that, "that");
return element.level <= that.element.level &&
(this == that || (that.parent != null && isPrefixOf(that.parent)));
} | java | public boolean isPrefixOf(MatcherPath that) {
checkArgNotNull(that, "that");
return element.level <= that.element.level &&
(this == that || (that.parent != null && isPrefixOf(that.parent)));
} | [
"public",
"boolean",
"isPrefixOf",
"(",
"MatcherPath",
"that",
")",
"{",
"checkArgNotNull",
"(",
"that",
",",
"\"that\"",
")",
";",
"return",
"element",
".",
"level",
"<=",
"that",
".",
"element",
".",
"level",
"&&",
"(",
"this",
"==",
"that",
"||",
"(",... | Determines whether this path is a prefix of the given other path.
@param that the other path
@return true if this path is a prefix of the given other path | [
"Determines",
"whether",
"this",
"path",
"is",
"a",
"prefix",
"of",
"the",
"given",
"other",
"path",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/MatcherPath.java#L70-L74 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/MatcherPath.java | MatcherPath.getElementAtLevel | public Element getElementAtLevel(int level) {
checkArgument(level >= 0);
if (level > element.level) return null;
if (level < element.level) return parent.getElementAtLevel(level);
return element;
} | java | public Element getElementAtLevel(int level) {
checkArgument(level >= 0);
if (level > element.level) return null;
if (level < element.level) return parent.getElementAtLevel(level);
return element;
} | [
"public",
"Element",
"getElementAtLevel",
"(",
"int",
"level",
")",
"{",
"checkArgument",
"(",
"level",
">=",
"0",
")",
";",
"if",
"(",
"level",
">",
"element",
".",
"level",
")",
"return",
"null",
";",
"if",
"(",
"level",
"<",
"element",
".",
"level",... | Returns the Element at the given level.
@param level the level to get the element from
@return the element | [
"Returns",
"the",
"Element",
"at",
"the",
"given",
"level",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/MatcherPath.java#L81-L86 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/MatcherPath.java | MatcherPath.commonPrefix | public MatcherPath commonPrefix(MatcherPath that) {
checkArgNotNull(that, "that");
if (element.level > that.element.level) return parent.commonPrefix(that);
if (element.level < that.element.level) return commonPrefix(that.parent);
if (this == that) return this;
return (parent != ... | java | public MatcherPath commonPrefix(MatcherPath that) {
checkArgNotNull(that, "that");
if (element.level > that.element.level) return parent.commonPrefix(that);
if (element.level < that.element.level) return commonPrefix(that.parent);
if (this == that) return this;
return (parent != ... | [
"public",
"MatcherPath",
"commonPrefix",
"(",
"MatcherPath",
"that",
")",
"{",
"checkArgNotNull",
"(",
"that",
",",
"\"that\"",
")",
";",
"if",
"(",
"element",
".",
"level",
">",
"that",
".",
"element",
".",
"level",
")",
"return",
"parent",
".",
"commonPr... | Returns the common prefix of this MatcherPath and the given other one.
@param that the other path
@return the common prefix or null | [
"Returns",
"the",
"common",
"prefix",
"of",
"this",
"MatcherPath",
"and",
"the",
"given",
"other",
"one",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/MatcherPath.java#L94-L100 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/MatcherPath.java | MatcherPath.contains | public boolean contains(Matcher matcher) {
return element.matcher == matcher || (parent != null && parent.contains(matcher));
} | java | public boolean contains(Matcher matcher) {
return element.matcher == matcher || (parent != null && parent.contains(matcher));
} | [
"public",
"boolean",
"contains",
"(",
"Matcher",
"matcher",
")",
"{",
"return",
"element",
".",
"matcher",
"==",
"matcher",
"||",
"(",
"parent",
"!=",
"null",
"&&",
"parent",
".",
"contains",
"(",
"matcher",
")",
")",
";",
"}"
] | Determines whether the given matcher is contained in this path.
@param matcher the matcher
@return true if contained | [
"Determines",
"whether",
"the",
"given",
"matcher",
"is",
"contained",
"in",
"this",
"path",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/MatcherPath.java#L108-L110 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/Filters.java | Filters.preventLoops | public static Predicate<Matcher> preventLoops() {
return new Predicate<Matcher>() {
private final Set<Matcher> visited = new HashSet<Matcher>();
public boolean apply(Matcher node) {
node = unwrap(node);
if (visited.contains(node)) {
re... | java | public static Predicate<Matcher> preventLoops() {
return new Predicate<Matcher>() {
private final Set<Matcher> visited = new HashSet<Matcher>();
public boolean apply(Matcher node) {
node = unwrap(node);
if (visited.contains(node)) {
re... | [
"public",
"static",
"Predicate",
"<",
"Matcher",
">",
"preventLoops",
"(",
")",
"{",
"return",
"new",
"Predicate",
"<",
"Matcher",
">",
"(",
")",
"{",
"private",
"final",
"Set",
"<",
"Matcher",
">",
"visited",
"=",
"new",
"HashSet",
"<",
"Matcher",
">",
... | A predicate for rule tree printing. Prevents SOEs by detecting and suppressing loops in the rule tree.
@return a predicate | [
"A",
"predicate",
"for",
"rule",
"tree",
"printing",
".",
"Prevents",
"SOEs",
"by",
"detecting",
"and",
"suppressing",
"loops",
"in",
"the",
"rule",
"tree",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/Filters.java#L70-L83 | train |
sirthias/parboiled | parboiled-java/src/main/java/org/parboiled/transform/InstructionGroupPreparer.java | InstructionGroupPreparer.extractInstructions | private void extractInstructions(InstructionGroup group) {
for (InstructionGraphNode node : group.getNodes()) {
if (node != group.getRoot()) {
AbstractInsnNode insn = node.getInstruction();
method.instructions.remove(insn);
group.getInstructions().add(... | java | private void extractInstructions(InstructionGroup group) {
for (InstructionGraphNode node : group.getNodes()) {
if (node != group.getRoot()) {
AbstractInsnNode insn = node.getInstruction();
method.instructions.remove(insn);
group.getInstructions().add(... | [
"private",
"void",
"extractInstructions",
"(",
"InstructionGroup",
"group",
")",
"{",
"for",
"(",
"InstructionGraphNode",
"node",
":",
"group",
".",
"getNodes",
"(",
")",
")",
"{",
"if",
"(",
"node",
"!=",
"group",
".",
"getRoot",
"(",
")",
")",
"{",
"Ab... | move all group instructions except for the root from the underlying method into the groups Insnlist | [
"move",
"all",
"group",
"instructions",
"except",
"for",
"the",
"root",
"from",
"the",
"underlying",
"method",
"into",
"the",
"groups",
"Insnlist"
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-java/src/main/java/org/parboiled/transform/InstructionGroupPreparer.java#L61-L69 | train |
sirthias/parboiled | parboiled-java/src/main/java/org/parboiled/transform/InstructionGroupPreparer.java | InstructionGroupPreparer.extractFields | private void extractFields(InstructionGroup group) {
List<FieldNode> fields = group.getFields();
for (InstructionGraphNode node : group.getNodes()) {
if (node.isXLoad()) {
VarInsnNode insn = (VarInsnNode) node.getInstruction();
// check whether we already hav... | java | private void extractFields(InstructionGroup group) {
List<FieldNode> fields = group.getFields();
for (InstructionGraphNode node : group.getNodes()) {
if (node.isXLoad()) {
VarInsnNode insn = (VarInsnNode) node.getInstruction();
// check whether we already hav... | [
"private",
"void",
"extractFields",
"(",
"InstructionGroup",
"group",
")",
"{",
"List",
"<",
"FieldNode",
">",
"fields",
"=",
"group",
".",
"getFields",
"(",
")",
";",
"for",
"(",
"InstructionGraphNode",
"node",
":",
"group",
".",
"getNodes",
"(",
")",
")"... | create FieldNodes for all xLoad instructions | [
"create",
"FieldNodes",
"for",
"all",
"xLoad",
"instructions"
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-java/src/main/java/org/parboiled/transform/InstructionGroupPreparer.java#L72-L98 | train |
sirthias/parboiled | parboiled-java/src/main/java/org/parboiled/transform/InstructionGroupPreparer.java | InstructionGroupPreparer.name | private synchronized void name(InstructionGroup group, ParserClassNode classNode) {
// generate an MD5 hash across the buffer, use only the first 96 bit
MD5Digester digester = new MD5Digester(classNode.name);
group.getInstructions().accept(digester);
for (FieldNode field: group.getFields... | java | private synchronized void name(InstructionGroup group, ParserClassNode classNode) {
// generate an MD5 hash across the buffer, use only the first 96 bit
MD5Digester digester = new MD5Digester(classNode.name);
group.getInstructions().accept(digester);
for (FieldNode field: group.getFields... | [
"private",
"synchronized",
"void",
"name",
"(",
"InstructionGroup",
"group",
",",
"ParserClassNode",
"classNode",
")",
"{",
"// generate an MD5 hash across the buffer, use only the first 96 bit",
"MD5Digester",
"digester",
"=",
"new",
"MD5Digester",
"(",
"classNode",
".",
"... | set a group name base on the hash across all group instructions and fields | [
"set",
"a",
"group",
"name",
"base",
"on",
"the",
"hash",
"across",
"all",
"group",
"instructions",
"and",
"fields"
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-java/src/main/java/org/parboiled/transform/InstructionGroupPreparer.java#L101-L114 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/Characters.java | Characters.add | public Characters add(Characters other) {
checkArgNotNull(other, "other");
if (!subtractive && !other.subtractive) {
return addToChars(other.chars);
}
if (subtractive && other.subtractive) {
return retainAllChars(other.chars);
}
return subtractive ... | java | public Characters add(Characters other) {
checkArgNotNull(other, "other");
if (!subtractive && !other.subtractive) {
return addToChars(other.chars);
}
if (subtractive && other.subtractive) {
return retainAllChars(other.chars);
}
return subtractive ... | [
"public",
"Characters",
"add",
"(",
"Characters",
"other",
")",
"{",
"checkArgNotNull",
"(",
"other",
",",
"\"other\"",
")",
";",
"if",
"(",
"!",
"subtractive",
"&&",
"!",
"other",
".",
"subtractive",
")",
"{",
"return",
"addToChars",
"(",
"other",
".",
... | Returns a new Characters object containing all the characters of this instance plus all characters of the
given instance.
@param other the other Characters to add
@return a new Characters object | [
"Returns",
"a",
"new",
"Characters",
"object",
"containing",
"all",
"the",
"characters",
"of",
"this",
"instance",
"plus",
"all",
"characters",
"of",
"the",
"given",
"instance",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/Characters.java#L106-L115 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/Characters.java | Characters.remove | public Characters remove(Characters other) {
checkArgNotNull(other, "other");
if (!subtractive && !other.subtractive) {
return removeFromChars(other.chars);
}
if (subtractive && other.subtractive) {
return new Characters(false, other.removeFromChars(chars).chars);... | java | public Characters remove(Characters other) {
checkArgNotNull(other, "other");
if (!subtractive && !other.subtractive) {
return removeFromChars(other.chars);
}
if (subtractive && other.subtractive) {
return new Characters(false, other.removeFromChars(chars).chars);... | [
"public",
"Characters",
"remove",
"(",
"Characters",
"other",
")",
"{",
"checkArgNotNull",
"(",
"other",
",",
"\"other\"",
")",
";",
"if",
"(",
"!",
"subtractive",
"&&",
"!",
"other",
".",
"subtractive",
")",
"{",
"return",
"removeFromChars",
"(",
"other",
... | Returns a new Characters object containing all the characters of this instance minus all characters of the
given instance.
@param other the other Characters to remove
@return a new Characters object | [
"Returns",
"a",
"new",
"Characters",
"object",
"containing",
"all",
"the",
"characters",
"of",
"this",
"instance",
"minus",
"all",
"characters",
"of",
"the",
"given",
"instance",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/Characters.java#L124-L133 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/IndexRange.java | IndexRange.overlapsWith | public boolean overlapsWith(IndexRange other) {
checkArgNotNull(other, "other");
return end > other.start && other.end > start;
} | java | public boolean overlapsWith(IndexRange other) {
checkArgNotNull(other, "other");
return end > other.start && other.end > start;
} | [
"public",
"boolean",
"overlapsWith",
"(",
"IndexRange",
"other",
")",
"{",
"checkArgNotNull",
"(",
"other",
",",
"\"other\"",
")",
";",
"return",
"end",
">",
"other",
".",
"start",
"&&",
"other",
".",
"end",
">",
"start",
";",
"}"
] | Determines whether this range overlaps with the given other one.
@param other the other range
@return true if there is at least one index that is contained in both ranges | [
"Determines",
"whether",
"this",
"range",
"overlaps",
"with",
"the",
"given",
"other",
"one",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/IndexRange.java#L68-L71 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/IndexRange.java | IndexRange.touches | public boolean touches(IndexRange other) {
checkArgNotNull(other, "other");
return other.end == start || end == other.start;
} | java | public boolean touches(IndexRange other) {
checkArgNotNull(other, "other");
return other.end == start || end == other.start;
} | [
"public",
"boolean",
"touches",
"(",
"IndexRange",
"other",
")",
"{",
"checkArgNotNull",
"(",
"other",
",",
"\"other\"",
")",
";",
"return",
"other",
".",
"end",
"==",
"start",
"||",
"end",
"==",
"other",
".",
"start",
";",
"}"
] | Determines whether this range immediated follows or precedes the given other one.
@param other the other range
@return true if this range immediated follows or precedes the given other one. | [
"Determines",
"whether",
"this",
"range",
"immediated",
"follows",
"or",
"precedes",
"the",
"given",
"other",
"one",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/IndexRange.java#L101-L104 | train |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/IndexRange.java | IndexRange.mergedWith | public IndexRange mergedWith(IndexRange other) {
checkArgNotNull(other, "other");
return new IndexRange(Math.min(start, other.start), Math.max(end, other.end));
} | java | public IndexRange mergedWith(IndexRange other) {
checkArgNotNull(other, "other");
return new IndexRange(Math.min(start, other.start), Math.max(end, other.end));
} | [
"public",
"IndexRange",
"mergedWith",
"(",
"IndexRange",
"other",
")",
"{",
"checkArgNotNull",
"(",
"other",
",",
"\"other\"",
")",
";",
"return",
"new",
"IndexRange",
"(",
"Math",
".",
"min",
"(",
"start",
",",
"other",
".",
"start",
")",
",",
"Math",
"... | Created a new IndexRange that spans all characters between the smallest and the highest index of the two ranges.
@param other the other range
@return a new IndexRange instance | [
"Created",
"a",
"new",
"IndexRange",
"that",
"spans",
"all",
"characters",
"between",
"the",
"smallest",
"and",
"the",
"highest",
"index",
"of",
"the",
"two",
"ranges",
"."
] | 84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/IndexRange.java#L112-L115 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/RippleEffectDrawer.java | RippleEffectDrawer.getPreparedPaint | private Paint getPreparedPaint() {
getActionButton().resetPaint();
Paint paint = getActionButton().getPaint();
paint.setStyle(Paint.Style.FILL);
paint.setColor(getActionButton().getButtonColorRipple());
return paint;
} | java | private Paint getPreparedPaint() {
getActionButton().resetPaint();
Paint paint = getActionButton().getPaint();
paint.setStyle(Paint.Style.FILL);
paint.setColor(getActionButton().getButtonColorRipple());
return paint;
} | [
"private",
"Paint",
"getPreparedPaint",
"(",
")",
"{",
"getActionButton",
"(",
")",
".",
"resetPaint",
"(",
")",
";",
"Paint",
"paint",
"=",
"getActionButton",
"(",
")",
".",
"getPaint",
"(",
")",
";",
"paint",
".",
"setStyle",
"(",
"Paint",
".",
"Style"... | Returns the paint, which is prepared for Ripple Effect drawing
@return paint, which is prepared for Ripple Effect drawing | [
"Returns",
"the",
"paint",
"which",
"is",
"prepared",
"for",
"Ripple",
"Effect",
"drawing"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/RippleEffectDrawer.java#L164-L170 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.initShadowRadius | private void initShadowRadius(TypedArray attrs) {
int index = R.styleable.ActionButton_shadow_radius;
if (attrs.hasValue(index)) {
shadowRadius = attrs.getDimension(index, shadowRadius);
LOGGER.trace("Initialized Action Button shadow radius: {}", getShadowRadius());
}
} | java | private void initShadowRadius(TypedArray attrs) {
int index = R.styleable.ActionButton_shadow_radius;
if (attrs.hasValue(index)) {
shadowRadius = attrs.getDimension(index, shadowRadius);
LOGGER.trace("Initialized Action Button shadow radius: {}", getShadowRadius());
}
} | [
"private",
"void",
"initShadowRadius",
"(",
"TypedArray",
"attrs",
")",
"{",
"int",
"index",
"=",
"R",
".",
"styleable",
".",
"ActionButton_shadow_radius",
";",
"if",
"(",
"attrs",
".",
"hasValue",
"(",
"index",
")",
")",
"{",
"shadowRadius",
"=",
"attrs",
... | Initializes the shadow radius
@param attrs attributes of the XML tag that is inflating the view | [
"Initializes",
"the",
"shadow",
"radius"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L431-L437 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.initShadowXOffset | private void initShadowXOffset(TypedArray attrs) {
int index = R.styleable.ActionButton_shadow_xOffset;
if (attrs.hasValue(index)) {
shadowXOffset = attrs.getDimension(index, shadowXOffset);
LOGGER.trace("Initialized Action Button X-axis offset: {}", getShadowXOffset());
}
} | java | private void initShadowXOffset(TypedArray attrs) {
int index = R.styleable.ActionButton_shadow_xOffset;
if (attrs.hasValue(index)) {
shadowXOffset = attrs.getDimension(index, shadowXOffset);
LOGGER.trace("Initialized Action Button X-axis offset: {}", getShadowXOffset());
}
} | [
"private",
"void",
"initShadowXOffset",
"(",
"TypedArray",
"attrs",
")",
"{",
"int",
"index",
"=",
"R",
".",
"styleable",
".",
"ActionButton_shadow_xOffset",
";",
"if",
"(",
"attrs",
".",
"hasValue",
"(",
"index",
")",
")",
"{",
"shadowXOffset",
"=",
"attrs"... | Initializes the shadow X-axis offset
@param attrs attributes of the XML tag that is inflating the view | [
"Initializes",
"the",
"shadow",
"X",
"-",
"axis",
"offset"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L444-L450 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.initShadowYOffset | private void initShadowYOffset(TypedArray attrs) {
int index = R.styleable.ActionButton_shadow_yOffset;
if (attrs.hasValue(index)) {
shadowYOffset = attrs.getDimension(index, shadowYOffset);
LOGGER.trace("Initialized Action Button shadow Y-axis offset: {}", getShadowYOffset());
}
} | java | private void initShadowYOffset(TypedArray attrs) {
int index = R.styleable.ActionButton_shadow_yOffset;
if (attrs.hasValue(index)) {
shadowYOffset = attrs.getDimension(index, shadowYOffset);
LOGGER.trace("Initialized Action Button shadow Y-axis offset: {}", getShadowYOffset());
}
} | [
"private",
"void",
"initShadowYOffset",
"(",
"TypedArray",
"attrs",
")",
"{",
"int",
"index",
"=",
"R",
".",
"styleable",
".",
"ActionButton_shadow_yOffset",
";",
"if",
"(",
"attrs",
".",
"hasValue",
"(",
"index",
")",
")",
"{",
"shadowYOffset",
"=",
"attrs"... | Initializes the shadow Y-axis offset
@param attrs attributes of the XML tag that is inflating the view | [
"Initializes",
"the",
"shadow",
"Y",
"-",
"axis",
"offset"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L457-L463 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.initShadowColor | private void initShadowColor(TypedArray attrs) {
int index = R.styleable.ActionButton_shadow_color;
if (attrs.hasValue(index)) {
shadowColor = attrs.getColor(index, shadowColor);
LOGGER.trace("Initialized Action Button shadow color: {}", getShadowColor());
}
} | java | private void initShadowColor(TypedArray attrs) {
int index = R.styleable.ActionButton_shadow_color;
if (attrs.hasValue(index)) {
shadowColor = attrs.getColor(index, shadowColor);
LOGGER.trace("Initialized Action Button shadow color: {}", getShadowColor());
}
} | [
"private",
"void",
"initShadowColor",
"(",
"TypedArray",
"attrs",
")",
"{",
"int",
"index",
"=",
"R",
".",
"styleable",
".",
"ActionButton_shadow_color",
";",
"if",
"(",
"attrs",
".",
"hasValue",
"(",
"index",
")",
")",
"{",
"shadowColor",
"=",
"attrs",
".... | Initializes the shadow color
@param attrs attributes of the XML tag that is inflating the view | [
"Initializes",
"the",
"shadow",
"color"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L470-L476 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.initShadowResponsiveEffectEnabled | private void initShadowResponsiveEffectEnabled(TypedArray attrs) {
int index = R.styleable.ActionButton_shadowResponsiveEffect_enabled;
if (attrs.hasValue(index)) {
shadowResponsiveEffectEnabled = attrs.getBoolean(index, shadowResponsiveEffectEnabled);
LOGGER.trace("Initialized Action Button Shadow Responsive... | java | private void initShadowResponsiveEffectEnabled(TypedArray attrs) {
int index = R.styleable.ActionButton_shadowResponsiveEffect_enabled;
if (attrs.hasValue(index)) {
shadowResponsiveEffectEnabled = attrs.getBoolean(index, shadowResponsiveEffectEnabled);
LOGGER.trace("Initialized Action Button Shadow Responsive... | [
"private",
"void",
"initShadowResponsiveEffectEnabled",
"(",
"TypedArray",
"attrs",
")",
"{",
"int",
"index",
"=",
"R",
".",
"styleable",
".",
"ActionButton_shadowResponsiveEffect_enabled",
";",
"if",
"(",
"attrs",
".",
"hasValue",
"(",
"index",
")",
")",
"{",
"... | Initializes the Shadow Responsive Effect
@param attrs attributes of the XML tag that is inflating the view | [
"Initializes",
"the",
"Shadow",
"Responsive",
"Effect"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L483-L490 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.initStrokeWidth | private void initStrokeWidth(TypedArray attrs) {
int index = R.styleable.ActionButton_stroke_width;
if (attrs.hasValue(index)) {
strokeWidth = attrs.getDimension(index, strokeWidth);
LOGGER.trace("Initialized Action Button stroke width: {}", getStrokeWidth());
}
} | java | private void initStrokeWidth(TypedArray attrs) {
int index = R.styleable.ActionButton_stroke_width;
if (attrs.hasValue(index)) {
strokeWidth = attrs.getDimension(index, strokeWidth);
LOGGER.trace("Initialized Action Button stroke width: {}", getStrokeWidth());
}
} | [
"private",
"void",
"initStrokeWidth",
"(",
"TypedArray",
"attrs",
")",
"{",
"int",
"index",
"=",
"R",
".",
"styleable",
".",
"ActionButton_stroke_width",
";",
"if",
"(",
"attrs",
".",
"hasValue",
"(",
"index",
")",
")",
"{",
"strokeWidth",
"=",
"attrs",
".... | Initializes the stroke width
@param attrs attributes of the XML tag that is inflating the view | [
"Initializes",
"the",
"stroke",
"width"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L497-L503 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.initStrokeColor | private void initStrokeColor(TypedArray attrs) {
int index = R.styleable.ActionButton_stroke_color;
if (attrs.hasValue(index)) {
strokeColor = attrs.getColor(index, strokeColor);
LOGGER.trace("Initialized Action Button stroke color: {}", getStrokeColor());
}
} | java | private void initStrokeColor(TypedArray attrs) {
int index = R.styleable.ActionButton_stroke_color;
if (attrs.hasValue(index)) {
strokeColor = attrs.getColor(index, strokeColor);
LOGGER.trace("Initialized Action Button stroke color: {}", getStrokeColor());
}
} | [
"private",
"void",
"initStrokeColor",
"(",
"TypedArray",
"attrs",
")",
"{",
"int",
"index",
"=",
"R",
".",
"styleable",
".",
"ActionButton_stroke_color",
";",
"if",
"(",
"attrs",
".",
"hasValue",
"(",
"index",
")",
")",
"{",
"strokeColor",
"=",
"attrs",
".... | Initializes the stroke color
@param attrs attributes of the XML tag that is inflating the view | [
"Initializes",
"the",
"stroke",
"color"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L510-L516 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.startAnimation | @SuppressWarnings("all")
@Override
public void startAnimation(Animation animation) {
if (animation != null &&
(getAnimation() == null || getAnimation().hasEnded())) {
super.startAnimation(animation);
}
} | java | @SuppressWarnings("all")
@Override
public void startAnimation(Animation animation) {
if (animation != null &&
(getAnimation() == null || getAnimation().hasEnded())) {
super.startAnimation(animation);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"@",
"Override",
"public",
"void",
"startAnimation",
"(",
"Animation",
"animation",
")",
"{",
"if",
"(",
"animation",
"!=",
"null",
"&&",
"(",
"getAnimation",
"(",
")",
"==",
"null",
"||",
"getAnimation",
"(",
... | Adds additional checking whether animation is null before starting to play it
@param animation animation to play | [
"Adds",
"additional",
"checking",
"whether",
"animation",
"is",
"null",
"before",
"starting",
"to",
"play",
"it"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L1395-L1402 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.hasElevation | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
private boolean hasElevation() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && getElevation() > 0.0f;
} | java | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
private boolean hasElevation() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && getElevation() > 0.0f;
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
")",
"private",
"boolean",
"hasElevation",
"(",
")",
"{",
"return",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
"&&",
"getElevation",
"(... | Checks whether view elevation is enabled
@return true if view elevation enabled, otherwise false | [
"Checks",
"whether",
"view",
"elevation",
"is",
"enabled"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L1567-L1570 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.drawStroke | protected void drawStroke(Canvas canvas) {
resetPaint();
getPaint().setStyle(Paint.Style.STROKE);
getPaint().setStrokeWidth(getStrokeWidth());
getPaint().setColor(getStrokeColor());
canvas.drawCircle(calculateCenterX(), calculateCenterY(), calculateCircleRadius(), getPaint());
LOGGER.trace("Drawn the Action... | java | protected void drawStroke(Canvas canvas) {
resetPaint();
getPaint().setStyle(Paint.Style.STROKE);
getPaint().setStrokeWidth(getStrokeWidth());
getPaint().setColor(getStrokeColor());
canvas.drawCircle(calculateCenterX(), calculateCenterY(), calculateCircleRadius(), getPaint());
LOGGER.trace("Drawn the Action... | [
"protected",
"void",
"drawStroke",
"(",
"Canvas",
"canvas",
")",
"{",
"resetPaint",
"(",
")",
";",
"getPaint",
"(",
")",
".",
"setStyle",
"(",
"Paint",
".",
"Style",
".",
"STROKE",
")",
";",
"getPaint",
"(",
")",
".",
"setStrokeWidth",
"(",
"getStrokeWid... | Draws stroke around the main circle
@param canvas canvas, on which circle is to be drawn | [
"Draws",
"stroke",
"around",
"the",
"main",
"circle"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L1577-L1584 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.drawImage | protected void drawImage(Canvas canvas) {
int startPointX = (int) (calculateCenterX() - getImageSize() / 2);
int startPointY = (int) (calculateCenterY() - getImageSize() / 2);
int endPointX = (int) (startPointX + getImageSize());
int endPointY = (int) (startPointY + getImageSize());
getImage().setBounds(start... | java | protected void drawImage(Canvas canvas) {
int startPointX = (int) (calculateCenterX() - getImageSize() / 2);
int startPointY = (int) (calculateCenterY() - getImageSize() / 2);
int endPointX = (int) (startPointX + getImageSize());
int endPointY = (int) (startPointY + getImageSize());
getImage().setBounds(start... | [
"protected",
"void",
"drawImage",
"(",
"Canvas",
"canvas",
")",
"{",
"int",
"startPointX",
"=",
"(",
"int",
")",
"(",
"calculateCenterX",
"(",
")",
"-",
"getImageSize",
"(",
")",
"/",
"2",
")",
";",
"int",
"startPointY",
"=",
"(",
"int",
")",
"(",
"c... | Draws the image centered inside the view
@param canvas canvas, on which circle is to be drawn | [
"Draws",
"the",
"image",
"centered",
"inside",
"the",
"view"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L1591-L1601 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.onMeasure | @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
LOGGER.trace("Called Action Button onMeasure");
setMeasuredDimension(calculateMeasuredWidth(), calculateMeasuredHeight());
LOGGER.trace("Measured the Action Button size: heigh... | java | @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
LOGGER.trace("Called Action Button onMeasure");
setMeasuredDimension(calculateMeasuredWidth(), calculateMeasuredHeight());
LOGGER.trace("Measured the Action Button size: heigh... | [
"@",
"Override",
"protected",
"void",
"onMeasure",
"(",
"int",
"widthMeasureSpec",
",",
"int",
"heightMeasureSpec",
")",
"{",
"super",
".",
"onMeasure",
"(",
"widthMeasureSpec",
",",
"heightMeasureSpec",
")",
";",
"LOGGER",
".",
"trace",
"(",
"\"Called Action Butt... | Sets the measured dimension for the entire view
@param widthMeasureSpec horizontal space requirements as imposed by the parent.
The requirements are encoded with
{@link android.view.View.MeasureSpec}
@param heightMeasureSpec vertical space requirements as imposed by the parent.
The requirements are encoded with
{@link... | [
"Sets",
"the",
"measured",
"dimension",
"for",
"the",
"entire",
"view"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L1613-L1619 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.calculateShadowWidth | private int calculateShadowWidth() {
float mShadowRadius = isShadowResponsiveEffectEnabled() ?
((ShadowResponsiveDrawer) shadowResponsiveDrawer).getMaxShadowRadius() : getShadowRadius();
int shadowWidth = hasShadow() ? (int) ((mShadowRadius + Math.abs(getShadowXOffset())) * 2) : 0;
LOGGER.trace("Calculated Ac... | java | private int calculateShadowWidth() {
float mShadowRadius = isShadowResponsiveEffectEnabled() ?
((ShadowResponsiveDrawer) shadowResponsiveDrawer).getMaxShadowRadius() : getShadowRadius();
int shadowWidth = hasShadow() ? (int) ((mShadowRadius + Math.abs(getShadowXOffset())) * 2) : 0;
LOGGER.trace("Calculated Ac... | [
"private",
"int",
"calculateShadowWidth",
"(",
")",
"{",
"float",
"mShadowRadius",
"=",
"isShadowResponsiveEffectEnabled",
"(",
")",
"?",
"(",
"(",
"ShadowResponsiveDrawer",
")",
"shadowResponsiveDrawer",
")",
".",
"getMaxShadowRadius",
"(",
")",
":",
"getShadowRadius... | Calculates shadow width in actual pixels
@return shadow width in actual pixels | [
"Calculates",
"shadow",
"width",
"in",
"actual",
"pixels"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L1648-L1654 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ActionButton.java | ActionButton.calculateShadowHeight | private int calculateShadowHeight() {
float mShadowRadius = isShadowResponsiveEffectEnabled() ?
((ShadowResponsiveDrawer) shadowResponsiveDrawer).getMaxShadowRadius() : getShadowRadius();
int shadowHeight = hasShadow() ? (int) ((mShadowRadius + Math.abs(getShadowYOffset())) * 2) : 0;
LOGGER.trace("Calculated ... | java | private int calculateShadowHeight() {
float mShadowRadius = isShadowResponsiveEffectEnabled() ?
((ShadowResponsiveDrawer) shadowResponsiveDrawer).getMaxShadowRadius() : getShadowRadius();
int shadowHeight = hasShadow() ? (int) ((mShadowRadius + Math.abs(getShadowYOffset())) * 2) : 0;
LOGGER.trace("Calculated ... | [
"private",
"int",
"calculateShadowHeight",
"(",
")",
"{",
"float",
"mShadowRadius",
"=",
"isShadowResponsiveEffectEnabled",
"(",
")",
"?",
"(",
"(",
"ShadowResponsiveDrawer",
")",
"shadowResponsiveDrawer",
")",
".",
"getMaxShadowRadius",
"(",
")",
":",
"getShadowRadiu... | Calculates shadow height in actual pixels
@return shadow height in actual pixels | [
"Calculates",
"shadow",
"height",
"in",
"actual",
"pixels"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ActionButton.java#L1661-L1667 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/ViewInvalidator.java | ViewInvalidator.invalidate | void invalidate() {
if (isInvalidationRequired()) {
view.postInvalidate();
LOGGER.trace("Called view invalidation");
}
if (isInvalidationDelayedRequired()) {
view.postInvalidateDelayed(getInvalidationDelay());
LOGGER.trace("Called view delayed invalidation. Delay time is: {}", getInvalidationDelay());... | java | void invalidate() {
if (isInvalidationRequired()) {
view.postInvalidate();
LOGGER.trace("Called view invalidation");
}
if (isInvalidationDelayedRequired()) {
view.postInvalidateDelayed(getInvalidationDelay());
LOGGER.trace("Called view delayed invalidation. Delay time is: {}", getInvalidationDelay());... | [
"void",
"invalidate",
"(",
")",
"{",
"if",
"(",
"isInvalidationRequired",
"(",
")",
")",
"{",
"view",
".",
"postInvalidate",
"(",
")",
";",
"LOGGER",
".",
"trace",
"(",
"\"Called view invalidation\"",
")",
";",
"}",
"if",
"(",
"isInvalidationDelayedRequired",
... | Invalidates the view based on the current invalidator configuration | [
"Invalidates",
"the",
"view",
"based",
"on",
"the",
"current",
"invalidator",
"configuration"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/ViewInvalidator.java#L125-L135 | train |
Scalified/fab | fab/src/main/java/com/scalified/fab/TouchPoint.java | TouchPoint.isInsideCircle | boolean isInsideCircle(float centerPointX, float centerPointY, float radius) {
double xValue = Math.pow((getX() - centerPointX), 2);
double yValue = Math.pow((getY() - centerPointY), 2);
double radiusValue = Math.pow(radius, 2);
boolean touchPointInsideCircle = xValue + yValue <= radiusValue;
LOGGER.trace("De... | java | boolean isInsideCircle(float centerPointX, float centerPointY, float radius) {
double xValue = Math.pow((getX() - centerPointX), 2);
double yValue = Math.pow((getY() - centerPointY), 2);
double radiusValue = Math.pow(radius, 2);
boolean touchPointInsideCircle = xValue + yValue <= radiusValue;
LOGGER.trace("De... | [
"boolean",
"isInsideCircle",
"(",
"float",
"centerPointX",
",",
"float",
"centerPointY",
",",
"float",
"radius",
")",
"{",
"double",
"xValue",
"=",
"Math",
".",
"pow",
"(",
"(",
"getX",
"(",
")",
"-",
"centerPointX",
")",
",",
"2",
")",
";",
"double",
... | Checks whether the touch point is inside the circle or not
@param centerPointX circle X-axis center coordinate
@param centerPointY circle Y-axis center coordinate
@param radius circle radius
@return true if touch point is inside the circle, otherwise false | [
"Checks",
"whether",
"the",
"touch",
"point",
"is",
"inside",
"the",
"circle",
"or",
"not"
] | 0fc001e2f21223871d05d28b192a32ea70726884 | https://github.com/Scalified/fab/blob/0fc001e2f21223871d05d28b192a32ea70726884/fab/src/main/java/com/scalified/fab/TouchPoint.java#L170-L177 | train |
GraphWalker/graphwalker-project | graphwalker-core/src/main/java/org/graphwalker/core/algorithm/AllClassificationCombinations.java | AllClassificationCombinations.getClassifications | public List<Classification.RuntimeClassification> getClassifications() {
List<Classification.RuntimeClassification> result = new ArrayList<>();
getClassifications(result, tree.getRoot());
return result;
} | java | public List<Classification.RuntimeClassification> getClassifications() {
List<Classification.RuntimeClassification> result = new ArrayList<>();
getClassifications(result, tree.getRoot());
return result;
} | [
"public",
"List",
"<",
"Classification",
".",
"RuntimeClassification",
">",
"getClassifications",
"(",
")",
"{",
"List",
"<",
"Classification",
".",
"RuntimeClassification",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"getClassifications",
"(",
... | Returns list of bottom level classes | [
"Returns",
"list",
"of",
"bottom",
"level",
"classes"
] | e4a091c21c53cce830c3a94c30578702276228af | https://github.com/GraphWalker/graphwalker-project/blob/e4a091c21c53cce830c3a94c30578702276228af/graphwalker-core/src/main/java/org/graphwalker/core/algorithm/AllClassificationCombinations.java#L54-L58 | train |
GraphWalker/graphwalker-project | graphwalker-restful/src/main/java/org/graphwalker/restful/Util.java | Util.getStepAsJSON | public static JSONObject getStepAsJSON(Machine machine, boolean verbose, boolean showUnvisited) {
JSONObject object = new JSONObject();
if (verbose) {
object.put("modelName", FilenameUtils.getBaseName(machine.getCurrentContext().getModel().getName()));
}
if (machine.getCurrentContext().getCurrentE... | java | public static JSONObject getStepAsJSON(Machine machine, boolean verbose, boolean showUnvisited) {
JSONObject object = new JSONObject();
if (verbose) {
object.put("modelName", FilenameUtils.getBaseName(machine.getCurrentContext().getModel().getName()));
}
if (machine.getCurrentContext().getCurrentE... | [
"public",
"static",
"JSONObject",
"getStepAsJSON",
"(",
"Machine",
"machine",
",",
"boolean",
"verbose",
",",
"boolean",
"showUnvisited",
")",
"{",
"JSONObject",
"object",
"=",
"new",
"JSONObject",
"(",
")",
";",
"if",
"(",
"verbose",
")",
"{",
"object",
"."... | Will create a JSON formatted string representing the current step. The step
is the current element, which can be either a vertex orn an edge.
@param verbose Print more details if true
@param showUnvisited Print all unvisited elements if true
@return The JSON string representing the current step. | [
"Will",
"create",
"a",
"JSON",
"formatted",
"string",
"representing",
"the",
"current",
"step",
".",
"The",
"step",
"is",
"the",
"current",
"element",
"which",
"can",
"be",
"either",
"a",
"vertex",
"orn",
"an",
"edge",
"."
] | e4a091c21c53cce830c3a94c30578702276228af | https://github.com/GraphWalker/graphwalker-project/blob/e4a091c21c53cce830c3a94c30578702276228af/graphwalker-restful/src/main/java/org/graphwalker/restful/Util.java#L53-L110 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/scratch/GenerateDistancePolynomials16.java | GenerateDistancePolynomials16.next | private static void next() {
final short t0 = s0;
short t1 = s1;
t1 ^= t0;
s0 = (short) (rotl(t0, 8) ^ t1 ^ t1 << 5);
s1 = rotl(t1, 13);
} | java | private static void next() {
final short t0 = s0;
short t1 = s1;
t1 ^= t0;
s0 = (short) (rotl(t0, 8) ^ t1 ^ t1 << 5);
s1 = rotl(t1, 13);
} | [
"private",
"static",
"void",
"next",
"(",
")",
"{",
"final",
"short",
"t0",
"=",
"s0",
";",
"short",
"t1",
"=",
"s1",
";",
"t1",
"^=",
"t0",
";",
"s0",
"=",
"(",
"short",
")",
"(",
"rotl",
"(",
"t0",
",",
"8",
")",
"^",
"t1",
"^",
"t1",
"<<... | 8-5-13 x^32 + x^19 + x^10 + x^9 + x^8 + x^6 + x^5 + x^4 + x^2 + x + 1 | [
"8",
"-",
"5",
"-",
"13",
"x^32",
"+",
"x^19",
"+",
"x^10",
"+",
"x^9",
"+",
"x^8",
"+",
"x^6",
"+",
"x^5",
"+",
"x^4",
"+",
"x^2",
"+",
"x",
"+",
"1"
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/scratch/GenerateDistancePolynomials16.java#L17-L23 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/util/EliasFanoMonotoneLongBigList.java | EliasFanoMonotoneLongBigList.computeParameters | private static long[] computeParameters(final LongIterator iterator) {
long v = -1, prev = -1, c = 0;
while(iterator.hasNext()) {
v = iterator.nextLong();
if (prev > v) throw new IllegalArgumentException("The list of values is not monotone: " + prev + " > " + v);
prev = v;
c++;
}
return new long[] ... | java | private static long[] computeParameters(final LongIterator iterator) {
long v = -1, prev = -1, c = 0;
while(iterator.hasNext()) {
v = iterator.nextLong();
if (prev > v) throw new IllegalArgumentException("The list of values is not monotone: " + prev + " > " + v);
prev = v;
c++;
}
return new long[] ... | [
"private",
"static",
"long",
"[",
"]",
"computeParameters",
"(",
"final",
"LongIterator",
"iterator",
")",
"{",
"long",
"v",
"=",
"-",
"1",
",",
"prev",
"=",
"-",
"1",
",",
"c",
"=",
"0",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")"... | Computes the number of elements and the last element returned by the given iterator.
@param iterator an iterator.
@return a two-element array of longs containing the number of elements returned by
the iterator and the last returned element, respectively. | [
"Computes",
"the",
"number",
"of",
"elements",
"and",
"the",
"last",
"element",
"returned",
"by",
"the",
"given",
"iterator",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/util/EliasFanoMonotoneLongBigList.java#L142-L152 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/Hashes.java | Hashes.preprocessJenkins | public static long[][] preprocessJenkins(final BitVector bv, final long seed) {
final long length = bv.length();
final int wordLength = (int) (length / (Long.SIZE * 3)) + 1;
final long aa[] = new long[wordLength], bb[] = new long[wordLength],
cc[] = new long[wordLength];
long a, b, c, from = 0;
if (aa.le... | java | public static long[][] preprocessJenkins(final BitVector bv, final long seed) {
final long length = bv.length();
final int wordLength = (int) (length / (Long.SIZE * 3)) + 1;
final long aa[] = new long[wordLength], bb[] = new long[wordLength],
cc[] = new long[wordLength];
long a, b, c, from = 0;
if (aa.le... | [
"public",
"static",
"long",
"[",
"]",
"[",
"]",
"preprocessJenkins",
"(",
"final",
"BitVector",
"bv",
",",
"final",
"long",
"seed",
")",
"{",
"final",
"long",
"length",
"=",
"bv",
".",
"length",
"(",
")",
";",
"final",
"int",
"wordLength",
"=",
"(",
... | Preprocesses a bit vector so that Jenkins 64-bit hashing can be computed
in constant time on all prefixes.
@param bv
a bit vector.
@param seed
a seed for the hash.
@return an array of three element; each element is an array containing
the state of the variables <code>a</code>, <code>b</code> and
<code>c</code> during ... | [
"Preprocesses",
"a",
"bit",
"vector",
"so",
"that",
"Jenkins",
"64",
"-",
"bit",
"hashing",
"can",
"be",
"computed",
"in",
"constant",
"time",
"on",
"all",
"prefixes",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/Hashes.java#L351-L422 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/Hashes.java | Hashes.murmur | public static long murmur(final BitVector bv, final long seed) {
long h = seed, k;
long from = 0;
final long length = bv.length();
while (length - from >= Long.SIZE) {
k = bv.getLong(from, from += Long.SIZE);
k *= M;
k ^= k >>> R;
k *= M;
h ^= k;
h *= M;
}
if (length > from) {
k = b... | java | public static long murmur(final BitVector bv, final long seed) {
long h = seed, k;
long from = 0;
final long length = bv.length();
while (length - from >= Long.SIZE) {
k = bv.getLong(from, from += Long.SIZE);
k *= M;
k ^= k >>> R;
k *= M;
h ^= k;
h *= M;
}
if (length > from) {
k = b... | [
"public",
"static",
"long",
"murmur",
"(",
"final",
"BitVector",
"bv",
",",
"final",
"long",
"seed",
")",
"{",
"long",
"h",
"=",
"seed",
",",
"k",
";",
"long",
"from",
"=",
"0",
";",
"final",
"long",
"length",
"=",
"bv",
".",
"length",
"(",
")",
... | MurmurHash 64-bit
<p>
This code is based on a mix of the sources that can be found at
<a href="http://sites.google.com/site/smhasher/">MurmurHash's web
site</a>, and in particular on the version consuming 64 bits at a time,
which has been merged with the 2A version to obtain an
{@linkplain #preprocessMurmur(BitVector,... | [
"MurmurHash",
"64",
"-",
"bit"
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/Hashes.java#L768-L802 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/Hashes.java | Hashes.murmur | public static long murmur(final BitVector bv, final long prefixLength, final long[] state) {
final long precomputedUpTo = prefixLength - prefixLength % Long.SIZE;
long h = state[(int) (precomputedUpTo / Long.SIZE)], k;
if (prefixLength > precomputedUpTo) {
k = bv.getLong(precomputedUpTo, prefixLength);
k *... | java | public static long murmur(final BitVector bv, final long prefixLength, final long[] state) {
final long precomputedUpTo = prefixLength - prefixLength % Long.SIZE;
long h = state[(int) (precomputedUpTo / Long.SIZE)], k;
if (prefixLength > precomputedUpTo) {
k = bv.getLong(precomputedUpTo, prefixLength);
k *... | [
"public",
"static",
"long",
"murmur",
"(",
"final",
"BitVector",
"bv",
",",
"final",
"long",
"prefixLength",
",",
"final",
"long",
"[",
"]",
"state",
")",
"{",
"final",
"long",
"precomputedUpTo",
"=",
"prefixLength",
"-",
"prefixLength",
"%",
"Long",
".",
... | Constant-time MurmurHash 64-bit hashing for any prefix.
@param bv
a bit vector.
@param prefixLength
the length of the prefix of <code>bv</code> over which the
hash must be computed.
@param state
the state array returned by
{@link #preprocessMurmur(BitVector, long)}.
@return the hash for the prefix of <code>bv</code> o... | [
"Constant",
"-",
"time",
"MurmurHash",
"64",
"-",
"bit",
"hashing",
"for",
"any",
"prefix",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/Hashes.java#L819-L842 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/Hashes.java | Hashes.murmur | public static long murmur(final BitVector bv, final long prefixLength, final long[] state, final long lcp) {
final int startStateWord = (int) (Math.min(lcp, prefixLength) / Long.SIZE);
long h = state[startStateWord], k;
long from = startStateWord * Long.SIZE;
while (prefixLength - from >= Long.SIZE) {
k = b... | java | public static long murmur(final BitVector bv, final long prefixLength, final long[] state, final long lcp) {
final int startStateWord = (int) (Math.min(lcp, prefixLength) / Long.SIZE);
long h = state[startStateWord], k;
long from = startStateWord * Long.SIZE;
while (prefixLength - from >= Long.SIZE) {
k = b... | [
"public",
"static",
"long",
"murmur",
"(",
"final",
"BitVector",
"bv",
",",
"final",
"long",
"prefixLength",
",",
"final",
"long",
"[",
"]",
"state",
",",
"final",
"long",
"lcp",
")",
"{",
"final",
"int",
"startStateWord",
"=",
"(",
"int",
")",
"(",
"M... | Constant-time MurmurHash 64-bit hashing reusing precomputed state
partially.
@param bv
a bit vector.
@param prefixLength
the length of the prefix of <code>bv</code> over which the
hash must be computed.
@param state
the state array returned by
{@link #preprocessMurmur(BitVector, long)}.
@param lcp
the length of the lo... | [
"Constant",
"-",
"time",
"MurmurHash",
"64",
"-",
"bit",
"hashing",
"reusing",
"precomputed",
"state",
"partially",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/Hashes.java#L864-L898 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/Hashes.java | Hashes.preprocessMurmur | public static long[] preprocessMurmur(final BitVector bv, final long seed) {
long h = seed, k;
long from = 0;
final long length = bv.length();
final int wordLength = (int) (length / Long.SIZE);
final long state[] = new long[wordLength + 1];
int i = 0;
state[i++] = h;
for (; length - from >= Long.SIZE... | java | public static long[] preprocessMurmur(final BitVector bv, final long seed) {
long h = seed, k;
long from = 0;
final long length = bv.length();
final int wordLength = (int) (length / Long.SIZE);
final long state[] = new long[wordLength + 1];
int i = 0;
state[i++] = h;
for (; length - from >= Long.SIZE... | [
"public",
"static",
"long",
"[",
"]",
"preprocessMurmur",
"(",
"final",
"BitVector",
"bv",
",",
"final",
"long",
"seed",
")",
"{",
"long",
"h",
"=",
"seed",
",",
"k",
";",
"long",
"from",
"=",
"0",
";",
"final",
"long",
"length",
"=",
"bv",
".",
"l... | Preprocesses a bit vector so that MurmurHash 64-bit can be computed in
constant time on all prefixes.
@param bv
a bit vector.
@param seed
a seed for the hash.
@return an array containing the state of the variables <code>h</code>
during the hash computation; these vector must be passed to
{@link #murmur(BitVector, long... | [
"Preprocesses",
"a",
"bit",
"vector",
"so",
"that",
"MurmurHash",
"64",
"-",
"bit",
"can",
"be",
"computed",
"in",
"constant",
"time",
"on",
"all",
"prefixes",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/Hashes.java#L914-L938 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/Hashes.java | Hashes.murmur3 | public static long murmur3(final BitVector bv, final long seed) {
long h1 = 0x9368e53c2f6af274L ^ seed;
long h2 = 0x586dcd208f7cd3fdL ^ seed;
long c1 = 0x87c37b91114253d5L;
long c2 = 0x4cf5ad432745937fL;
long from = 0;
final long length = bv.length();
long k1, k2;
while (length - from >= Long.SIZE * ... | java | public static long murmur3(final BitVector bv, final long seed) {
long h1 = 0x9368e53c2f6af274L ^ seed;
long h2 = 0x586dcd208f7cd3fdL ^ seed;
long c1 = 0x87c37b91114253d5L;
long c2 = 0x4cf5ad432745937fL;
long from = 0;
final long length = bv.length();
long k1, k2;
while (length - from >= Long.SIZE * ... | [
"public",
"static",
"long",
"murmur3",
"(",
"final",
"BitVector",
"bv",
",",
"final",
"long",
"seed",
")",
"{",
"long",
"h1",
"=",
"0x9368e53c2f6af274",
"",
"L",
"^",
"seed",
";",
"long",
"h2",
"=",
"0x586dcd208f7cd3fd",
"",
"L",
"^",
"seed",
";",
"lon... | MurmurHash3 64-bit
<p>
This code is based on a mix of the sources that can be found at
<a href="http://sites.google.com/site/smhasher/">MurmurHash's web
site</a>.
<p>
<strong>Warning</strong>: this code is still experimental.
@param bv
a bit vector.
@param seed
a seed for the hash.
@return a hash. | [
"MurmurHash3",
"64",
"-",
"bit"
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/Hashes.java#L1066-L1141 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/Hashes.java | Hashes.murmur3 | public static void murmur3(final BitVector bv, final long prefixLength, final long[] hh1, final long[] hh2, final long[] cc1, final long cc2[], final long h[]) {
final int startStateWord = (int) (prefixLength / (2 * Long.SIZE));
long precomputedUpTo = startStateWord * 2L * Long.SIZE;
long h1 = hh1[startStateWord... | java | public static void murmur3(final BitVector bv, final long prefixLength, final long[] hh1, final long[] hh2, final long[] cc1, final long cc2[], final long h[]) {
final int startStateWord = (int) (prefixLength / (2 * Long.SIZE));
long precomputedUpTo = startStateWord * 2L * Long.SIZE;
long h1 = hh1[startStateWord... | [
"public",
"static",
"void",
"murmur3",
"(",
"final",
"BitVector",
"bv",
",",
"final",
"long",
"prefixLength",
",",
"final",
"long",
"[",
"]",
"hh1",
",",
"final",
"long",
"[",
"]",
"hh2",
",",
"final",
"long",
"[",
"]",
"cc1",
",",
"final",
"long",
"... | Constant-time MurmurHash3 128-bit hashing for any prefix.
<p>
<strong>Warning</strong>: this code is still experimental.
@param bv
a bit vector.
@param prefixLength
the length of the prefix of <code>bv</code> over which the
hash must be computed.
@param hh1
the first component of the state array returned by
{@link #p... | [
"Constant",
"-",
"time",
"MurmurHash3",
"128",
"-",
"bit",
"hashing",
"for",
"any",
"prefix",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/Hashes.java#L1171-L1225 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/Hashes.java | Hashes.murmur3 | public static void murmur3(final BitVector bv, final long prefixLength, final long[] hh1, final long[] hh2, final long[] cc1, final long cc2[], final long lcp, final long h[]) {
final int startStateWord = (int) (Math.min(lcp, prefixLength) / (2 * Long.SIZE));
long from = startStateWord * 2L * Long.SIZE;
long h1 ... | java | public static void murmur3(final BitVector bv, final long prefixLength, final long[] hh1, final long[] hh2, final long[] cc1, final long cc2[], final long lcp, final long h[]) {
final int startStateWord = (int) (Math.min(lcp, prefixLength) / (2 * Long.SIZE));
long from = startStateWord * 2L * Long.SIZE;
long h1 ... | [
"public",
"static",
"void",
"murmur3",
"(",
"final",
"BitVector",
"bv",
",",
"final",
"long",
"prefixLength",
",",
"final",
"long",
"[",
"]",
"hh1",
",",
"final",
"long",
"[",
"]",
"hh2",
",",
"final",
"long",
"[",
"]",
"cc1",
",",
"final",
"long",
"... | Constant-time MurmurHash3 128-bit hashing reusing precomputed state
partially.
<p>
<strong>Warning</strong>: this code is still experimental.
@param bv
a bit vector.
@param prefixLength
the length of the prefix of <code>bv</code> over which the
hash must be computed.
@param hh1
the first component of the state array ... | [
"Constant",
"-",
"time",
"MurmurHash3",
"128",
"-",
"bit",
"hashing",
"reusing",
"precomputed",
"state",
"partially",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/Hashes.java#L1336-L1415 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/Hashes.java | Hashes.preprocessMurmur3 | public static long[][] preprocessMurmur3(final BitVector bv, final long seed) {
long from = 0;
final long length = bv.length();
long h1 = 0x9368e53c2f6af274L ^ seed;
long h2 = 0x586dcd208f7cd3fdL ^ seed;
long c1 = 0x87c37b91114253d5L;
long c2 = 0x4cf5ad432745937fL;
final int wordLength = (int) (length ... | java | public static long[][] preprocessMurmur3(final BitVector bv, final long seed) {
long from = 0;
final long length = bv.length();
long h1 = 0x9368e53c2f6af274L ^ seed;
long h2 = 0x586dcd208f7cd3fdL ^ seed;
long c1 = 0x87c37b91114253d5L;
long c2 = 0x4cf5ad432745937fL;
final int wordLength = (int) (length ... | [
"public",
"static",
"long",
"[",
"]",
"[",
"]",
"preprocessMurmur3",
"(",
"final",
"BitVector",
"bv",
",",
"final",
"long",
"seed",
")",
"{",
"long",
"from",
"=",
"0",
";",
"final",
"long",
"length",
"=",
"bv",
".",
"length",
"(",
")",
";",
"long",
... | Preprocesses a bit vector so that MurmurHash3 can be computed in constant
time on all prefixes.
<p>
<strong>Warning</strong>: this code is still experimental.
@param bv
a bit vector.
@param seed
a seed for the hash.
@return an array of four component arrays containing the state of the
variables <code>h1</code>, <code... | [
"Preprocesses",
"a",
"bit",
"vector",
"so",
"that",
"MurmurHash3",
"can",
"be",
"computed",
"in",
"constant",
"time",
"on",
"all",
"prefixes",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/Hashes.java#L1543-L1595 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/Hashes.java | Hashes.preprocessSpooky4 | public static long[] preprocessSpooky4(final BitVector bv, final long seed) {
final long length = bv.length();
if (length < Long.SIZE * 2) return null;
final long[] state = new long[4 * (int) (length + Long.SIZE * 2) / (4 * Long.SIZE)];
long h0, h1, h2, h3;
h0 = seed;
h1 = seed;
h2 = ARBITRARY_BITS;
h3... | java | public static long[] preprocessSpooky4(final BitVector bv, final long seed) {
final long length = bv.length();
if (length < Long.SIZE * 2) return null;
final long[] state = new long[4 * (int) (length + Long.SIZE * 2) / (4 * Long.SIZE)];
long h0, h1, h2, h3;
h0 = seed;
h1 = seed;
h2 = ARBITRARY_BITS;
h3... | [
"public",
"static",
"long",
"[",
"]",
"preprocessSpooky4",
"(",
"final",
"BitVector",
"bv",
",",
"final",
"long",
"seed",
")",
"{",
"final",
"long",
"length",
"=",
"bv",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
"<",
"Long",
".",
"SIZE",
"*"... | Preprocesses a bit vector so that SpookyHash 4-word-state can be computed
in constant time on all prefixes.
@param bv
a bit vector.
@param seed
a seed for the hash.
@return an array containing the four internal words of state during the
hash computation; it can be passed to
{@link #spooky4(BitVector, long, long, long[... | [
"Preprocesses",
"a",
"bit",
"vector",
"so",
"that",
"SpookyHash",
"4",
"-",
"word",
"-",
"state",
"can",
"be",
"computed",
"in",
"constant",
"time",
"on",
"all",
"prefixes",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/Hashes.java#L2171-L2240 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/MinimalPerfectHashFunction.java | MinimalPerfectHashFunction.getLongByTriple | public long getLongByTriple(final long[] triple) {
if (n == 0) return defRetValue;
final int[] e = new int[3];
final int chunk = chunkShift == Long.SIZE ? 0 : (int)(triple[0] >>> chunkShift);
final long chunkOffset = offset[chunk];
HypergraphSorter.tripleToEdge(triple, seed[chunk], (int)(offset[chunk + 1] - c... | java | public long getLongByTriple(final long[] triple) {
if (n == 0) return defRetValue;
final int[] e = new int[3];
final int chunk = chunkShift == Long.SIZE ? 0 : (int)(triple[0] >>> chunkShift);
final long chunkOffset = offset[chunk];
HypergraphSorter.tripleToEdge(triple, seed[chunk], (int)(offset[chunk + 1] - c... | [
"public",
"long",
"getLongByTriple",
"(",
"final",
"long",
"[",
"]",
"triple",
")",
"{",
"if",
"(",
"n",
"==",
"0",
")",
"return",
"defRetValue",
";",
"final",
"int",
"[",
"]",
"e",
"=",
"new",
"int",
"[",
"3",
"]",
";",
"final",
"int",
"chunk",
... | Low-level access to the output of this minimal perfect hash function.
<p>This method makes it possible to build several kind of functions on the same {@link ChunkedHashStore} and
then retrieve the resulting values by generating a single triple of hashes. The method
{@link TwoStepsMWHCFunction#getLong(Object)} is a goo... | [
"Low",
"-",
"level",
"access",
"to",
"the",
"output",
"of",
"this",
"minimal",
"perfect",
"hash",
"function",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/MinimalPerfectHashFunction.java#L514-L525 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java | HypergraphSorter.sort | private boolean sort() {
// We cache all variables for faster access
final int[] d = this.d;
//System.err.println("Visiting...");
if (LOGGER.isDebugEnabled()) LOGGER.debug("Peeling hypergraph...");
top = 0;
for(int i = 0; i < numVertices; i++) if (d[i] == 1) peel(i);
if (LOGGER.isDebugEnabled()) LOGGER.... | java | private boolean sort() {
// We cache all variables for faster access
final int[] d = this.d;
//System.err.println("Visiting...");
if (LOGGER.isDebugEnabled()) LOGGER.debug("Peeling hypergraph...");
top = 0;
for(int i = 0; i < numVertices; i++) if (d[i] == 1) peel(i);
if (LOGGER.isDebugEnabled()) LOGGER.... | [
"private",
"boolean",
"sort",
"(",
")",
"{",
"// We cache all variables for faster access",
"final",
"int",
"[",
"]",
"d",
"=",
"this",
".",
"d",
";",
"//System.err.println(\"Visiting...\");",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"LOGGER",
... | Sorts the edges of a random 3-hypergraph in “leaf peeling” order.
@return true if the sorting procedure succeeded. | [
"Sorts",
"the",
"edges",
"of",
"a",
"random",
"3",
"-",
"hypergraph",
"in",
"&ldquo",
";",
"leaf",
"peeling&rdquo",
";",
"order",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java#L363-L375 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/LcpMonotoneMinimalPerfectHashFunction.java | Builder.build | public LcpMonotoneMinimalPerfectHashFunction<T> build() throws IOException {
if (built) throw new IllegalStateException("This builder has been already used");
built = true;
return new LcpMonotoneMinimalPerfectHashFunction<>(keys, numKeys, transform, signatureWidth, tempDir);
} | java | public LcpMonotoneMinimalPerfectHashFunction<T> build() throws IOException {
if (built) throw new IllegalStateException("This builder has been already used");
built = true;
return new LcpMonotoneMinimalPerfectHashFunction<>(keys, numKeys, transform, signatureWidth, tempDir);
} | [
"public",
"LcpMonotoneMinimalPerfectHashFunction",
"<",
"T",
">",
"build",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"built",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"This builder has been already used\"",
")",
";",
"built",
"=",
"true",
";",
... | Builds an LCP monotone minimal perfect hash function.
@return an {@link LcpMonotoneMinimalPerfectHashFunction} instance with the specified parameters.
@throws IllegalStateException if called more than once. | [
"Builds",
"an",
"LCP",
"monotone",
"minimal",
"perfect",
"hash",
"function",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/LcpMonotoneMinimalPerfectHashFunction.java#L176-L180 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java | ChunkedHashStore.add | public void add(final T o, final long value) throws IOException {
final long[] triple = new long[3];
Hashes.spooky4(transform.toBitVector(o), seed, triple);
add(triple, value);
} | java | public void add(final T o, final long value) throws IOException {
final long[] triple = new long[3];
Hashes.spooky4(transform.toBitVector(o), seed, triple);
add(triple, value);
} | [
"public",
"void",
"add",
"(",
"final",
"T",
"o",
",",
"final",
"long",
"value",
")",
"throws",
"IOException",
"{",
"final",
"long",
"[",
"]",
"triple",
"=",
"new",
"long",
"[",
"3",
"]",
";",
"Hashes",
".",
"spooky4",
"(",
"transform",
".",
"toBitVec... | Adds an element to this store, associating it with a specified value.
@param o the element to be added.
@param value the associated value. | [
"Adds",
"an",
"element",
"to",
"this",
"store",
"associating",
"it",
"with",
"a",
"specified",
"value",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java#L305-L309 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java | ChunkedHashStore.add | private void add(final long[] triple, final long value) throws IOException {
final int chunk = (int)(triple[0] >>> DISK_CHUNKS_SHIFT);
count[chunk]++;
checkedForDuplicates = false;
if (DEBUG) System.err.println("Adding " + Arrays.toString(triple));
writeLong(triple[0], byteBuffer[chunk], writableByteChannel[c... | java | private void add(final long[] triple, final long value) throws IOException {
final int chunk = (int)(triple[0] >>> DISK_CHUNKS_SHIFT);
count[chunk]++;
checkedForDuplicates = false;
if (DEBUG) System.err.println("Adding " + Arrays.toString(triple));
writeLong(triple[0], byteBuffer[chunk], writableByteChannel[c... | [
"private",
"void",
"add",
"(",
"final",
"long",
"[",
"]",
"triple",
",",
"final",
"long",
"value",
")",
"throws",
"IOException",
"{",
"final",
"int",
"chunk",
"=",
"(",
"int",
")",
"(",
"triple",
"[",
"0",
"]",
">>>",
"DISK_CHUNKS_SHIFT",
")",
";",
"... | Adds a triple to this store.
@param triple the triple to be added.
@param value the associated value. | [
"Adds",
"a",
"triple",
"to",
"this",
"store",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java#L324-L336 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java | ChunkedHashStore.addAll | public void addAll(final Iterator<? extends T> elements, final LongIterator values, final boolean requiresValue2CountMap) throws IOException {
if (pl != null) {
pl.expectedUpdates = -1;
pl.start("Adding elements...");
}
final long[] triple = new long[3];
while(elements.hasNext()) {
Hashes.spooky4(trans... | java | public void addAll(final Iterator<? extends T> elements, final LongIterator values, final boolean requiresValue2CountMap) throws IOException {
if (pl != null) {
pl.expectedUpdates = -1;
pl.start("Adding elements...");
}
final long[] triple = new long[3];
while(elements.hasNext()) {
Hashes.spooky4(trans... | [
"public",
"void",
"addAll",
"(",
"final",
"Iterator",
"<",
"?",
"extends",
"T",
">",
"elements",
",",
"final",
"LongIterator",
"values",
",",
"final",
"boolean",
"requiresValue2CountMap",
")",
"throws",
"IOException",
"{",
"if",
"(",
"pl",
"!=",
"null",
")",... | Adds the elements returned by an iterator to this store, associating them with specified values,
possibly building the associated value frequency map.
@param elements an iterator returning elements.
@param values an iterator on values parallel to {@code elements}.
@param requiresValue2CountMap whether to build the val... | [
"Adds",
"the",
"elements",
"returned",
"by",
"an",
"iterator",
"to",
"this",
"store",
"associating",
"them",
"with",
"specified",
"values",
"possibly",
"building",
"the",
"associated",
"value",
"frequency",
"map",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java#L345-L358 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java | ChunkedHashStore.addAll | public void addAll(final Iterator<? extends T> elements, final LongIterator values) throws IOException {
addAll(elements, values, false);
} | java | public void addAll(final Iterator<? extends T> elements, final LongIterator values) throws IOException {
addAll(elements, values, false);
} | [
"public",
"void",
"addAll",
"(",
"final",
"Iterator",
"<",
"?",
"extends",
"T",
">",
"elements",
",",
"final",
"LongIterator",
"values",
")",
"throws",
"IOException",
"{",
"addAll",
"(",
"elements",
",",
"values",
",",
"false",
")",
";",
"}"
] | Adds the elements returned by an iterator to this store, associating them with specified values.
@param elements an iterator returning elements.
@param values an iterator on values parallel to {@code elements}. | [
"Adds",
"the",
"elements",
"returned",
"by",
"an",
"iterator",
"to",
"this",
"store",
"associating",
"them",
"with",
"specified",
"values",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java#L365-L367 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java | ChunkedHashStore.close | @Override
public void close() throws IOException {
if (! closed) {
LOGGER.debug("Wall clock for quicksort: " + Util.format(quickSortWallTime / 1E9) + "s");
closed = true;
for(final WritableByteChannel channel: writableByteChannel) channel.close();
for(final File f: file) f.delete();
}
} | java | @Override
public void close() throws IOException {
if (! closed) {
LOGGER.debug("Wall clock for quicksort: " + Util.format(quickSortWallTime / 1E9) + "s");
closed = true;
for(final WritableByteChannel channel: writableByteChannel) channel.close();
for(final File f: file) f.delete();
}
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"closed",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Wall clock for quicksort: \"",
"+",
"Util",
".",
"format",
"(",
"quickSortWallTime",
"/",
"1E9",
")",
"+... | Closes this store, disposing all associated resources. | [
"Closes",
"this",
"store",
"disposing",
"all",
"associated",
"resources",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java#L501-L509 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java | ChunkedHashStore.reset | public void reset(final long seed) throws IOException {
if (locked) throw new IllegalStateException();
if (DEBUG) System.err.println("RESET(" + seed + ")");
filteredSize = 0;
this.seed = seed;
checkedForDuplicates = false;
Arrays.fill(count, 0);
for (int i = 0; i < DISK_CHUNKS; i++) {
writableByteChann... | java | public void reset(final long seed) throws IOException {
if (locked) throw new IllegalStateException();
if (DEBUG) System.err.println("RESET(" + seed + ")");
filteredSize = 0;
this.seed = seed;
checkedForDuplicates = false;
Arrays.fill(count, 0);
for (int i = 0; i < DISK_CHUNKS; i++) {
writableByteChann... | [
"public",
"void",
"reset",
"(",
"final",
"long",
"seed",
")",
"throws",
"IOException",
"{",
"if",
"(",
"locked",
")",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"if",
"(",
"DEBUG",
")",
"System",
".",
"err",
".",
"println",
"(",
"\"RESET(\""... | Resets this store using a new seed. All accumulated data are cleared, and a new seed is reinstated.
@param seed the new seed.
@throws IllegalStateException if this store was locked by a call to {@link #seed()}, and never {@linkplain #clear() cleared} thereafter. | [
"Resets",
"this",
"store",
"using",
"a",
"new",
"seed",
".",
"All",
"accumulated",
"data",
"are",
"cleared",
"and",
"a",
"new",
"seed",
"is",
"reinstated",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java#L517-L529 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java | ChunkedHashStore.checkAndRetry | public void checkAndRetry(final Iterable<? extends T> iterable, final LongIterable values) throws IOException {
final RandomGenerator random = new XoRoShiRo128PlusRandomGenerator();
int duplicates = 0;
for(;;)
try {
check();
break;
}
catch (final DuplicateException e) {
if (duplicates++ > 3)... | java | public void checkAndRetry(final Iterable<? extends T> iterable, final LongIterable values) throws IOException {
final RandomGenerator random = new XoRoShiRo128PlusRandomGenerator();
int duplicates = 0;
for(;;)
try {
check();
break;
}
catch (final DuplicateException e) {
if (duplicates++ > 3)... | [
"public",
"void",
"checkAndRetry",
"(",
"final",
"Iterable",
"<",
"?",
"extends",
"T",
">",
"iterable",
",",
"final",
"LongIterable",
"values",
")",
"throws",
"IOException",
"{",
"final",
"RandomGenerator",
"random",
"=",
"new",
"XoRoShiRo128PlusRandomGenerator",
... | Checks that this store has no duplicate triples, and try to rebuild if this fails to happen.
@param iterable the elements with which the store will be refilled if there are duplicate triples.
@param values the values that will be associated with the elements returned by <code>iterable</code>.
@throws IllegalArgumentEx... | [
"Checks",
"that",
"this",
"store",
"has",
"no",
"duplicate",
"triples",
"and",
"try",
"to",
"rebuild",
"if",
"this",
"fails",
"to",
"happen",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java#L547-L564 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java | ChunkedHashStore.signatures | public LongBigList signatures(final int signatureWidth, final ProgressLogger pl) throws IOException {
final LongBigList signatures = LongArrayBitVector.getInstance().asLongBigList(signatureWidth);
final long signatureMask = -1L >>> Long.SIZE - signatureWidth;
signatures.size(size());
pl.expectedUpdates = size()... | java | public LongBigList signatures(final int signatureWidth, final ProgressLogger pl) throws IOException {
final LongBigList signatures = LongArrayBitVector.getInstance().asLongBigList(signatureWidth);
final long signatureMask = -1L >>> Long.SIZE - signatureWidth;
signatures.size(size());
pl.expectedUpdates = size()... | [
"public",
"LongBigList",
"signatures",
"(",
"final",
"int",
"signatureWidth",
",",
"final",
"ProgressLogger",
"pl",
")",
"throws",
"IOException",
"{",
"final",
"LongBigList",
"signatures",
"=",
"LongArrayBitVector",
".",
"getInstance",
"(",
")",
".",
"asLongBigList"... | Generate a list of signatures using the lowest bits of the first hash in this store.
<p>For this method to work, this store must contain ranks.
@param signatureWidth the width in bits of the signatures.
@param pl a progress logger. | [
"Generate",
"a",
"list",
"of",
"signatures",
"using",
"the",
"lowest",
"bits",
"of",
"the",
"first",
"hash",
"in",
"this",
"store",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java#L586-L603 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java | ChunkedHashStore.log2Chunks | public int log2Chunks(final int log2chunks) {
this.chunks = 1 << log2chunks;
diskChunkStep = (int)Math.max(DISK_CHUNKS / chunks, 1);
virtualDiskChunks = DISK_CHUNKS / diskChunkStep;
if (DEBUG) {
System.err.print("Chunk sizes: ");
final double avg = filteredSize / (double)DISK_CHUNKS;
double var = 0;
... | java | public int log2Chunks(final int log2chunks) {
this.chunks = 1 << log2chunks;
diskChunkStep = (int)Math.max(DISK_CHUNKS / chunks, 1);
virtualDiskChunks = DISK_CHUNKS / diskChunkStep;
if (DEBUG) {
System.err.print("Chunk sizes: ");
final double avg = filteredSize / (double)DISK_CHUNKS;
double var = 0;
... | [
"public",
"int",
"log2Chunks",
"(",
"final",
"int",
"log2chunks",
")",
"{",
"this",
".",
"chunks",
"=",
"1",
"<<",
"log2chunks",
";",
"diskChunkStep",
"=",
"(",
"int",
")",
"Math",
".",
"max",
"(",
"DISK_CHUNKS",
"/",
"chunks",
",",
"1",
")",
";",
"v... | Sets the number of chunks.
<p>Once the store is filled, you must call this method to set the number of chunks. The store will take
care of merging or fragmenting disk chunks to get exactly the desired chunks.
@param log2chunks the base-2 logarithm of the number of chunks.
@return the shift to be applied to the first ... | [
"Sets",
"the",
"number",
"of",
"chunks",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/io/ChunkedHashStore.java#L614-L640 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/bits/SimpleSelect.java | SimpleSelect.select | public long[] select(long rank, long[] dest, final int offset, final int length) {
if (length == 0) return dest;
final long s = select(rank);
dest[offset] = s;
int curr = (int)(s / Long.SIZE);
long window = bits[curr] & -1L << s;
window &= window - 1;
for(int i = 1; i < length; i++) {
while(window ==... | java | public long[] select(long rank, long[] dest, final int offset, final int length) {
if (length == 0) return dest;
final long s = select(rank);
dest[offset] = s;
int curr = (int)(s / Long.SIZE);
long window = bits[curr] & -1L << s;
window &= window - 1;
for(int i = 1; i < length; i++) {
while(window ==... | [
"public",
"long",
"[",
"]",
"select",
"(",
"long",
"rank",
",",
"long",
"[",
"]",
"dest",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"length",
")",
"{",
"if",
"(",
"length",
"==",
"0",
")",
"return",
"dest",
";",
"final",
"long",
"s",
"=... | Performs a bulk select of consecutive ranks into a given array fragment.
@param rank the first rank to select.
@param dest the destination array; it will be filled with {@code length} positions of consecutive bits starting at position {@code offset}.
@param offset the first bit position written in {@code dest}.
@param... | [
"Performs",
"a",
"bulk",
"select",
"of",
"consecutive",
"ranks",
"into",
"a",
"given",
"array",
"fragment",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/bits/SimpleSelect.java#L271-L287 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/solve/Modulo2SparseSystem.java | Modulo2Equation.add | public void add(final Modulo2Equation equation) {
int i = 0, j = 0, k = 0;
final int s = variables.size(), t = equation.variables.size();
final int[] a = variables.elements(), b = equation.variables.elements(), result = new int[s + t];
if (t != 0 && s != 0) {
for (;;) {
if (a[i] < b[j]) {
re... | java | public void add(final Modulo2Equation equation) {
int i = 0, j = 0, k = 0;
final int s = variables.size(), t = equation.variables.size();
final int[] a = variables.elements(), b = equation.variables.elements(), result = new int[s + t];
if (t != 0 && s != 0) {
for (;;) {
if (a[i] < b[j]) {
re... | [
"public",
"void",
"add",
"(",
"final",
"Modulo2Equation",
"equation",
")",
"{",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"0",
",",
"k",
"=",
"0",
";",
"final",
"int",
"s",
"=",
"variables",
".",
"size",
"(",
")",
",",
"t",
"=",
"equation",
".",
"va... | Adds the provided equation to this equation.
@param equation an equation. | [
"Adds",
"the",
"provided",
"equation",
"to",
"this",
"equation",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/solve/Modulo2SparseSystem.java#L74-L104 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/solve/Modulo2SparseSystem.java | Modulo2Equation.scalarProduct | public static long scalarProduct(final Modulo2Equation e, long[] solution) {
long sum = 0;
for(final IntListIterator iterator = e.variables.iterator(); iterator.hasNext();)
sum ^= solution[iterator.nextInt()];
return sum;
} | java | public static long scalarProduct(final Modulo2Equation e, long[] solution) {
long sum = 0;
for(final IntListIterator iterator = e.variables.iterator(); iterator.hasNext();)
sum ^= solution[iterator.nextInt()];
return sum;
} | [
"public",
"static",
"long",
"scalarProduct",
"(",
"final",
"Modulo2Equation",
"e",
",",
"long",
"[",
"]",
"solution",
")",
"{",
"long",
"sum",
"=",
"0",
";",
"for",
"(",
"final",
"IntListIterator",
"iterator",
"=",
"e",
".",
"variables",
".",
"iterator",
... | Returns the modulo-2 scalar product of the two provided bit vectors.
@return the modulo-2 scalar product of {@code e} and {code f}. | [
"Returns",
"the",
"modulo",
"-",
"2",
"scalar",
"product",
"of",
"the",
"two",
"provided",
"bit",
"vectors",
"."
] | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/solve/Modulo2SparseSystem.java#L137-L142 | train |
vigna/Sux4J | src/it/unimi/dsi/sux4j/scratch/GenerateDistancePolynomials.java | GenerateDistancePolynomials.next | private static void next() {
final long t0 = s0;
long t1 = s1;
t1 ^= t0;
s0 = Long.rotateLeft(t0, 55) ^ t1 ^ t1 << 14;
s1 = Long.rotateLeft(t1, 36);
} | java | private static void next() {
final long t0 = s0;
long t1 = s1;
t1 ^= t0;
s0 = Long.rotateLeft(t0, 55) ^ t1 ^ t1 << 14;
s1 = Long.rotateLeft(t1, 36);
} | [
"private",
"static",
"void",
"next",
"(",
")",
"{",
"final",
"long",
"t0",
"=",
"s0",
";",
"long",
"t1",
"=",
"s1",
";",
"t1",
"^=",
"t0",
";",
"s0",
"=",
"Long",
".",
"rotateLeft",
"(",
"t0",
",",
"55",
")",
"^",
"t1",
"^",
"t1",
"<<",
"14",... | 55-14-36 63 x^128 + x^118 + x^117 + x^114 + x^112 + x^109 + x^108 + x^107 + x^106 + x^103 + x^102 + x^101 + x^99 + x^98 + x^96 + x^94 + x^93 + x^92 + x^91 + x^90 + x^89 + x^88 + x^85 + x^83 + x^80 + x^79 + x^78 + x^77 + x^76 + x^75 + x^71 + x^67 + x^65 + x^62 + x^60 + x^59 + x^58 + x^57 + x^56 + x^55 + x^54 + x^52 + x^... | [
"55",
"-",
"14",
"-",
"36",
"63",
"x^128",
"+",
"x^118",
"+",
"x^117",
"+",
"x^114",
"+",
"x^112",
"+",
"x^109",
"+",
"x^108",
"+",
"x^107",
"+",
"x^106",
"+",
"x^103",
"+",
"x^102",
"+",
"x^101",
"+",
"x^99",
"+",
"x^98",
"+",
"x^96",
"+",
"x^... | d57de8fa897c7d273e0e6dae7a3274174f175a5f | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/scratch/GenerateDistancePolynomials.java#L13-L19 | train |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/converter/EnumConverter.java | EnumConverter.convert | @Override
public Object convert(String value, Class type) {
if (isNullOrEmpty(value)) {
return null;
}
if (Character.isDigit(value.charAt(0))) {
return resolveByOrdinal(value, type);
} else {
return resolveByName(value, type);
}
} | java | @Override
public Object convert(String value, Class type) {
if (isNullOrEmpty(value)) {
return null;
}
if (Character.isDigit(value.charAt(0))) {
return resolveByOrdinal(value, type);
} else {
return resolveByName(value, type);
}
} | [
"@",
"Override",
"public",
"Object",
"convert",
"(",
"String",
"value",
",",
"Class",
"type",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"value",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"Character",
".",
"isDigit",
"(",
"value",
".",
"c... | Enums are always final, so I can suppress this warning safely | [
"Enums",
"are",
"always",
"final",
"so",
"I",
"can",
"suppress",
"this",
"warning",
"safely"
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/converter/EnumConverter.java#L46-L57 | train |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/view/LinkToHandler.java | LinkToHandler.removeGeneratedClasses | @PreDestroy
public void removeGeneratedClasses() {
ClassPool pool = ClassPool.getDefault();
for (Class<?> clazz : interfaces.values()) {
CtClass ctClass = pool.getOrNull(clazz.getName());
if (ctClass != null) {
ctClass.detach();
logger.debug("class {} is detached", clazz.getName());
}
}
} | java | @PreDestroy
public void removeGeneratedClasses() {
ClassPool pool = ClassPool.getDefault();
for (Class<?> clazz : interfaces.values()) {
CtClass ctClass = pool.getOrNull(clazz.getName());
if (ctClass != null) {
ctClass.detach();
logger.debug("class {} is detached", clazz.getName());
}
}
} | [
"@",
"PreDestroy",
"public",
"void",
"removeGeneratedClasses",
"(",
")",
"{",
"ClassPool",
"pool",
"=",
"ClassPool",
".",
"getDefault",
"(",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"clazz",
":",
"interfaces",
".",
"values",
"(",
")",
")",
"{",
"C... | Remove generated classes when application stops, due reload context issues. | [
"Remove",
"generated",
"classes",
"when",
"application",
"stops",
"due",
"reload",
"context",
"issues",
"."
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/view/LinkToHandler.java#L228-L238 | train |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/validator/beanvalidation/MethodValidator.java | MethodValidator.hasConstraints | private boolean hasConstraints(ControllerMethod controllerMethod) {
Method method = controllerMethod.getMethod();
if (method.getParameterTypes().length == 0) {
logger.debug("method {} has no parameters, skipping", controllerMethod);
return false;
}
BeanDescriptor bean = bvalidator.getConstraintsForClass(c... | java | private boolean hasConstraints(ControllerMethod controllerMethod) {
Method method = controllerMethod.getMethod();
if (method.getParameterTypes().length == 0) {
logger.debug("method {} has no parameters, skipping", controllerMethod);
return false;
}
BeanDescriptor bean = bvalidator.getConstraintsForClass(c... | [
"private",
"boolean",
"hasConstraints",
"(",
"ControllerMethod",
"controllerMethod",
")",
"{",
"Method",
"method",
"=",
"controllerMethod",
".",
"getMethod",
"(",
")",
";",
"if",
"(",
"method",
".",
"getParameterTypes",
"(",
")",
".",
"length",
"==",
"0",
")",... | Only accepts if method isn't parameterless and have at least one constraint. | [
"Only",
"accepts",
"if",
"method",
"isn",
"t",
"parameterless",
"and",
"have",
"at",
"least",
"one",
"constraint",
"."
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/validator/beanvalidation/MethodValidator.java#L80-L92 | train |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/validator/beanvalidation/MethodValidator.java | MethodValidator.extractCategory | protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) {
Iterator<Node> path = violation.getPropertyPath().iterator();
Node method = path.next();
logger.debug("Constraint violation on method {}: {}", method, violation);
StringBuilder cat = new StringBuilder();
cat.a... | java | protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) {
Iterator<Node> path = violation.getPropertyPath().iterator();
Node method = path.next();
logger.debug("Constraint violation on method {}: {}", method, violation);
StringBuilder cat = new StringBuilder();
cat.a... | [
"protected",
"String",
"extractCategory",
"(",
"ValuedParameter",
"[",
"]",
"params",
",",
"ConstraintViolation",
"<",
"Object",
">",
"violation",
")",
"{",
"Iterator",
"<",
"Node",
">",
"path",
"=",
"violation",
".",
"getPropertyPath",
"(",
")",
".",
"iterato... | Returns the category for this constraint violation. By default, the category returned
is the full path for property. You can override this method if you prefer another strategy. | [
"Returns",
"the",
"category",
"for",
"this",
"constraint",
"violation",
".",
"By",
"default",
"the",
"category",
"returned",
"is",
"the",
"full",
"path",
"for",
"property",
".",
"You",
"can",
"override",
"this",
"method",
"if",
"you",
"prefer",
"another",
"s... | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/validator/beanvalidation/MethodValidator.java#L117-L130 | train |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/validator/beanvalidation/MethodValidator.java | MethodValidator.extractInternacionalizedMessage | protected String extractInternacionalizedMessage(ConstraintViolation<Object> v) {
return interpolator.interpolate(v.getMessageTemplate(), new BeanValidatorContext(v), locale.get());
} | java | protected String extractInternacionalizedMessage(ConstraintViolation<Object> v) {
return interpolator.interpolate(v.getMessageTemplate(), new BeanValidatorContext(v), locale.get());
} | [
"protected",
"String",
"extractInternacionalizedMessage",
"(",
"ConstraintViolation",
"<",
"Object",
">",
"v",
")",
"{",
"return",
"interpolator",
".",
"interpolate",
"(",
"v",
".",
"getMessageTemplate",
"(",
")",
",",
"new",
"BeanValidatorContext",
"(",
"v",
")",... | Returns the internacionalized message for this constraint violation. | [
"Returns",
"the",
"internacionalized",
"message",
"for",
"this",
"constraint",
"violation",
"."
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/validator/beanvalidation/MethodValidator.java#L135-L137 | train |
caelum/vraptor4 | vraptor-musicjungle/src/main/java/br/com/caelum/vraptor/musicjungle/interceptor/AuthorizationInterceptor.java | AuthorizationInterceptor.intercept | @AroundCall
public void intercept(SimpleInterceptorStack stack) {
User current = info.getUser();
try {
dao.refresh(current);
} catch (Exception e) {
// could happen if the user does not exist in the database or if there's no user logged in.
}
/**
* You can use the result even in interceptors, but ... | java | @AroundCall
public void intercept(SimpleInterceptorStack stack) {
User current = info.getUser();
try {
dao.refresh(current);
} catch (Exception e) {
// could happen if the user does not exist in the database or if there's no user logged in.
}
/**
* You can use the result even in interceptors, but ... | [
"@",
"AroundCall",
"public",
"void",
"intercept",
"(",
"SimpleInterceptorStack",
"stack",
")",
"{",
"User",
"current",
"=",
"info",
".",
"getUser",
"(",
")",
";",
"try",
"{",
"dao",
".",
"refresh",
"(",
"current",
")",
";",
"}",
"catch",
"(",
"Exception"... | Intercepts the request and checks if there is a user logged in. | [
"Intercepts",
"the",
"request",
"and",
"checks",
"if",
"there",
"is",
"a",
"user",
"logged",
"in",
"."
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-musicjungle/src/main/java/br/com/caelum/vraptor/musicjungle/interceptor/AuthorizationInterceptor.java#L71-L94 | train |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/serialization/xstream/XStreamConverters.java | XStreamConverters.registerComponents | public void registerComponents(XStream xstream) {
for(Converter converter : converters) {
xstream.registerConverter(converter);
logger.debug("registered Xstream converter for {}", converter.getClass().getName());
}
for(SingleValueConverter converter : singleValueConverters) {
xstream.registerConverter(c... | java | public void registerComponents(XStream xstream) {
for(Converter converter : converters) {
xstream.registerConverter(converter);
logger.debug("registered Xstream converter for {}", converter.getClass().getName());
}
for(SingleValueConverter converter : singleValueConverters) {
xstream.registerConverter(c... | [
"public",
"void",
"registerComponents",
"(",
"XStream",
"xstream",
")",
"{",
"for",
"(",
"Converter",
"converter",
":",
"converters",
")",
"{",
"xstream",
".",
"registerConverter",
"(",
"converter",
")",
";",
"logger",
".",
"debug",
"(",
"\"registered Xstream co... | Method used to register all the XStream converters scanned to a XStream instance
@param xstream | [
"Method",
"used",
"to",
"register",
"all",
"the",
"XStream",
"converters",
"scanned",
"to",
"a",
"XStream",
"instance"
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/serialization/xstream/XStreamConverters.java#L62-L72 | train |
caelum/vraptor4 | vraptor-musicjungle/src/main/java/br/com/caelum/vraptor/musicjungle/controller/MusicController.java | MusicController.showAllMusicsAsJSON | @Public @Path("/musics/list/json")
public void showAllMusicsAsJSON() {
result.use(json()).from(musicDao.listAll()).serialize();
} | java | @Public @Path("/musics/list/json")
public void showAllMusicsAsJSON() {
result.use(json()).from(musicDao.listAll()).serialize();
} | [
"@",
"Public",
"@",
"Path",
"(",
"\"/musics/list/json\"",
")",
"public",
"void",
"showAllMusicsAsJSON",
"(",
")",
"{",
"result",
".",
"use",
"(",
"json",
"(",
")",
")",
".",
"from",
"(",
"musicDao",
".",
"listAll",
"(",
")",
")",
".",
"serialize",
"(",... | Show all list of registered musics in json format | [
"Show",
"all",
"list",
"of",
"registered",
"musics",
"in",
"json",
"format"
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-musicjungle/src/main/java/br/com/caelum/vraptor/musicjungle/controller/MusicController.java#L194-L197 | train |
caelum/vraptor4 | vraptor-musicjungle/src/main/java/br/com/caelum/vraptor/musicjungle/controller/MusicController.java | MusicController.showAllMusicsAsXML | @Public @Path("/musics/list/xml")
public void showAllMusicsAsXML() {
result.use(xml()).from(musicDao.listAll()).serialize();
} | java | @Public @Path("/musics/list/xml")
public void showAllMusicsAsXML() {
result.use(xml()).from(musicDao.listAll()).serialize();
} | [
"@",
"Public",
"@",
"Path",
"(",
"\"/musics/list/xml\"",
")",
"public",
"void",
"showAllMusicsAsXML",
"(",
")",
"{",
"result",
".",
"use",
"(",
"xml",
"(",
")",
")",
".",
"from",
"(",
"musicDao",
".",
"listAll",
"(",
")",
")",
".",
"serialize",
"(",
... | Show all list of registered musics in xml format | [
"Show",
"all",
"list",
"of",
"registered",
"musics",
"in",
"xml",
"format"
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-musicjungle/src/main/java/br/com/caelum/vraptor/musicjungle/controller/MusicController.java#L202-L205 | train |
caelum/vraptor4 | vraptor-musicjungle/src/main/java/br/com/caelum/vraptor/musicjungle/controller/MusicController.java | MusicController.showAllMusicsAsHTTP | @Public @Path("/musics/list/http")
public void showAllMusicsAsHTTP() {
result.use(http()).body("<p class=\"content\">"+
musicDao.listAll().toString()+"</p>");
} | java | @Public @Path("/musics/list/http")
public void showAllMusicsAsHTTP() {
result.use(http()).body("<p class=\"content\">"+
musicDao.listAll().toString()+"</p>");
} | [
"@",
"Public",
"@",
"Path",
"(",
"\"/musics/list/http\"",
")",
"public",
"void",
"showAllMusicsAsHTTP",
"(",
")",
"{",
"result",
".",
"use",
"(",
"http",
"(",
")",
")",
".",
"body",
"(",
"\"<p class=\\\"content\\\">\"",
"+",
"musicDao",
".",
"listAll",
"(",
... | Show all list of registered musics in http format | [
"Show",
"all",
"list",
"of",
"registered",
"musics",
"in",
"http",
"format"
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-musicjungle/src/main/java/br/com/caelum/vraptor/musicjungle/controller/MusicController.java#L210-L214 | train |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/validator/MessageList.java | MessageList.getGrouped | public Map<String, Collection<Message>> getGrouped() {
if (grouped == null) {
grouped = FluentIterable.from(delegate).index(byCategoryMapping()).asMap();
}
return grouped;
} | java | public Map<String, Collection<Message>> getGrouped() {
if (grouped == null) {
grouped = FluentIterable.from(delegate).index(byCategoryMapping()).asMap();
}
return grouped;
} | [
"public",
"Map",
"<",
"String",
",",
"Collection",
"<",
"Message",
">",
">",
"getGrouped",
"(",
")",
"{",
"if",
"(",
"grouped",
"==",
"null",
")",
"{",
"grouped",
"=",
"FluentIterable",
".",
"from",
"(",
"delegate",
")",
".",
"index",
"(",
"byCategoryM... | Return messages grouped by category. This method can useful if you want to get messages for a specific
category. | [
"Return",
"messages",
"grouped",
"by",
"category",
".",
"This",
"method",
"can",
"useful",
"if",
"you",
"want",
"to",
"get",
"messages",
"for",
"a",
"specific",
"category",
"."
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/validator/MessageList.java#L53-L58 | train |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/validator/MessageList.java | MessageList.from | public MessageListItem from(final String category) {
List<String> messages = FluentIterable.from(delegate)
.filter(byCategory(category))
.transform(toMessageString())
.toList();
return new MessageListItem(messages);
} | java | public MessageListItem from(final String category) {
List<String> messages = FluentIterable.from(delegate)
.filter(byCategory(category))
.transform(toMessageString())
.toList();
return new MessageListItem(messages);
} | [
"public",
"MessageListItem",
"from",
"(",
"final",
"String",
"category",
")",
"{",
"List",
"<",
"String",
">",
"messages",
"=",
"FluentIterable",
".",
"from",
"(",
"delegate",
")",
".",
"filter",
"(",
"byCategory",
"(",
"category",
")",
")",
".",
"transfor... | Return all messages by category. This method can useful if you want to get messages from a specific
category. | [
"Return",
"all",
"messages",
"by",
"category",
".",
"This",
"method",
"can",
"useful",
"if",
"you",
"want",
"to",
"get",
"messages",
"from",
"a",
"specific",
"category",
"."
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/validator/MessageList.java#L64-L71 | train |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/http/route/PathAnnotationRoutesParser.java | PathAnnotationRoutesParser.extractControllerNameFrom | protected String extractControllerNameFrom(Class<?> type) {
String prefix = extractPrefix(type);
if (isNullOrEmpty(prefix)) {
String baseName = StringUtils.lowercaseFirst(type.getSimpleName());
if (baseName.endsWith("Controller")) {
return "/" + baseName.substring(0, baseName.lastIndexOf("Controller"... | java | protected String extractControllerNameFrom(Class<?> type) {
String prefix = extractPrefix(type);
if (isNullOrEmpty(prefix)) {
String baseName = StringUtils.lowercaseFirst(type.getSimpleName());
if (baseName.endsWith("Controller")) {
return "/" + baseName.substring(0, baseName.lastIndexOf("Controller"... | [
"protected",
"String",
"extractControllerNameFrom",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"String",
"prefix",
"=",
"extractPrefix",
"(",
"type",
")",
";",
"if",
"(",
"isNullOrEmpty",
"(",
"prefix",
")",
")",
"{",
"String",
"baseName",
"=",
"String... | You can override this method for use a different convention for your
controller name, given a type | [
"You",
"can",
"override",
"this",
"method",
"for",
"use",
"a",
"different",
"convention",
"for",
"your",
"controller",
"name",
"given",
"a",
"type"
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/http/route/PathAnnotationRoutesParser.java#L216-L227 | train |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/http/route/DefaultRouteBuilder.java | DefaultRouteBuilder.getRouteStrategy | protected Route getRouteStrategy(ControllerMethod controllerMethod, Parameter[] parameterNames) {
return new FixedMethodStrategy(originalUri, controllerMethod, this.supportedMethods, builder.build(), priority, parameterNames);
} | java | protected Route getRouteStrategy(ControllerMethod controllerMethod, Parameter[] parameterNames) {
return new FixedMethodStrategy(originalUri, controllerMethod, this.supportedMethods, builder.build(), priority, parameterNames);
} | [
"protected",
"Route",
"getRouteStrategy",
"(",
"ControllerMethod",
"controllerMethod",
",",
"Parameter",
"[",
"]",
"parameterNames",
")",
"{",
"return",
"new",
"FixedMethodStrategy",
"(",
"originalUri",
",",
"controllerMethod",
",",
"this",
".",
"supportedMethods",
",... | Override this method to change the default Route implementation
@param controllerMethod The ControllerMethod
@param parameterNames parameters of the method
@return Route representation | [
"Override",
"this",
"method",
"to",
"change",
"the",
"default",
"Route",
"implementation"
] | 593ce9ad60f9d38c360881b2132417c56b8cc093 | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/http/route/DefaultRouteBuilder.java#L200-L202 | train |
Netflix/frigga | src/main/java/com/netflix/frigga/autoscaling/AutoScalingGroupNameBuilder.java | AutoScalingGroupNameBuilder.buildGroupName | public String buildGroupName(Boolean doValidation) {
NameValidation.notEmpty(appName, "appName");
if (doValidation) {
validateNames(appName, stack, countries, devPhase, hardware, partners, revision, usedBy, redBlackSwap,
zoneVar);
if (detail != null && !detai... | java | public String buildGroupName(Boolean doValidation) {
NameValidation.notEmpty(appName, "appName");
if (doValidation) {
validateNames(appName, stack, countries, devPhase, hardware, partners, revision, usedBy, redBlackSwap,
zoneVar);
if (detail != null && !detai... | [
"public",
"String",
"buildGroupName",
"(",
"Boolean",
"doValidation",
")",
"{",
"NameValidation",
".",
"notEmpty",
"(",
"appName",
",",
"\"appName\"",
")",
";",
"if",
"(",
"doValidation",
")",
"{",
"validateNames",
"(",
"appName",
",",
"stack",
",",
"countries... | Construct and return the name of the auto scaling group.
@param doValidation validate the supplied parameters before constructing the name
@return auto scaling group name | [
"Construct",
"and",
"return",
"the",
"name",
"of",
"the",
"auto",
"scaling",
"group",
"."
] | 38afefd1726116f3431b95fcb96a6af640b99d10 | https://github.com/Netflix/frigga/blob/38afefd1726116f3431b95fcb96a6af640b99d10/src/main/java/com/netflix/frigga/autoscaling/AutoScalingGroupNameBuilder.java#L55-L80 | train |
Netflix/frigga | src/main/java/com/netflix/frigga/NameValidation.java | NameValidation.notEmpty | public static String notEmpty(String value, String variableName) {
if (value == null) {
throw new NullPointerException("ERROR: Trying to use String with null " + variableName);
}
if (value.isEmpty()) {
throw new IllegalArgumentException("ERROR: Illegal empty string for " ... | java | public static String notEmpty(String value, String variableName) {
if (value == null) {
throw new NullPointerException("ERROR: Trying to use String with null " + variableName);
}
if (value.isEmpty()) {
throw new IllegalArgumentException("ERROR: Illegal empty string for " ... | [
"public",
"static",
"String",
"notEmpty",
"(",
"String",
"value",
",",
"String",
"variableName",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"ERROR: Trying to use String with null \"",
"+",
"variableName",
"... | Validates if provided value is non-null and non-empty.
@param value the string to validate
@param variableName name of the variable to include in error messages
@return the value parameter if valid, throws an exception otherwise | [
"Validates",
"if",
"provided",
"value",
"is",
"non",
"-",
"null",
"and",
"non",
"-",
"empty",
"."
] | 38afefd1726116f3431b95fcb96a6af640b99d10 | https://github.com/Netflix/frigga/blob/38afefd1726116f3431b95fcb96a6af640b99d10/src/main/java/com/netflix/frigga/NameValidation.java#L41-L49 | train |
Netflix/frigga | src/main/java/com/netflix/frigga/NameValidation.java | NameValidation.usesReservedFormat | public static Boolean usesReservedFormat(String name) {
return checkMatch(name, PUSH_FORMAT_PATTERN) || checkMatch(name, LABELED_VARIABLE_PATTERN);
} | java | public static Boolean usesReservedFormat(String name) {
return checkMatch(name, PUSH_FORMAT_PATTERN) || checkMatch(name, LABELED_VARIABLE_PATTERN);
} | [
"public",
"static",
"Boolean",
"usesReservedFormat",
"(",
"String",
"name",
")",
"{",
"return",
"checkMatch",
"(",
"name",
",",
"PUSH_FORMAT_PATTERN",
")",
"||",
"checkMatch",
"(",
"name",
",",
"LABELED_VARIABLE_PATTERN",
")",
";",
"}"
] | Determines whether a name ends with the reserved format -v000 where 0 represents any digit, or starts with the
reserved format z0 where z is any letter, or contains a hyphen-separated token that starts with the z0 format.
@param name to inspect
@return true if the name ends with the reserved format | [
"Determines",
"whether",
"a",
"name",
"ends",
"with",
"the",
"reserved",
"format",
"-",
"v000",
"where",
"0",
"represents",
"any",
"digit",
"or",
"starts",
"with",
"the",
"reserved",
"format",
"z0",
"where",
"z",
"is",
"any",
"letter",
"or",
"contains",
"a... | 38afefd1726116f3431b95fcb96a6af640b99d10 | https://github.com/Netflix/frigga/blob/38afefd1726116f3431b95fcb96a6af640b99d10/src/main/java/com/netflix/frigga/NameValidation.java#L93-L95 | train |
Netflix/frigga | src/main/java/com/netflix/frigga/cluster/ClusterGrouper.java | ClusterGrouper.groupByClusterName | public static <T> Map<String, List<T>> groupByClusterName(List<T> inputs, AsgNameProvider<T> nameProvider) {
Map<String, List<T>> clusterNamesToAsgs = new HashMap<String, List<T>>();
for (T input : inputs) {
String clusterName = Names.parseName(nameProvider.extractAsgName(input)).getCluster(... | java | public static <T> Map<String, List<T>> groupByClusterName(List<T> inputs, AsgNameProvider<T> nameProvider) {
Map<String, List<T>> clusterNamesToAsgs = new HashMap<String, List<T>>();
for (T input : inputs) {
String clusterName = Names.parseName(nameProvider.extractAsgName(input)).getCluster(... | [
"public",
"static",
"<",
"T",
">",
"Map",
"<",
"String",
",",
"List",
"<",
"T",
">",
">",
"groupByClusterName",
"(",
"List",
"<",
"T",
">",
"inputs",
",",
"AsgNameProvider",
"<",
"T",
">",
"nameProvider",
")",
"{",
"Map",
"<",
"String",
",",
"List",
... | Groups a list of ASG related objects by cluster name.
@param <T> Type to group
@param inputs list of objects associated with an ASG
@param nameProvider strategy object used to extract the ASG name of the object type of the input list
@return map of cluster name to list of input object | [
"Groups",
"a",
"list",
"of",
"ASG",
"related",
"objects",
"by",
"cluster",
"name",
"."
] | 38afefd1726116f3431b95fcb96a6af640b99d10 | https://github.com/Netflix/frigga/blob/38afefd1726116f3431b95fcb96a6af640b99d10/src/main/java/com/netflix/frigga/cluster/ClusterGrouper.java#L39-L49 | train |
Netflix/frigga | src/main/java/com/netflix/frigga/cluster/ClusterGrouper.java | ClusterGrouper.groupAsgNamesByClusterName | public static Map<String, List<String>> groupAsgNamesByClusterName(List<String> asgNames) {
return groupByClusterName(asgNames, new AsgNameProvider<String>() {
public String extractAsgName(String asgName) {
return asgName;
}
});
} | java | public static Map<String, List<String>> groupAsgNamesByClusterName(List<String> asgNames) {
return groupByClusterName(asgNames, new AsgNameProvider<String>() {
public String extractAsgName(String asgName) {
return asgName;
}
});
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"groupAsgNamesByClusterName",
"(",
"List",
"<",
"String",
">",
"asgNames",
")",
"{",
"return",
"groupByClusterName",
"(",
"asgNames",
",",
"new",
"AsgNameProvider",
"<",
"String",
... | Groups a list of ASG names by cluster name.
@param asgNames list of asg names
@return map of cluster name to list of ASG names in that cluster | [
"Groups",
"a",
"list",
"of",
"ASG",
"names",
"by",
"cluster",
"name",
"."
] | 38afefd1726116f3431b95fcb96a6af640b99d10 | https://github.com/Netflix/frigga/blob/38afefd1726116f3431b95fcb96a6af640b99d10/src/main/java/com/netflix/frigga/cluster/ClusterGrouper.java#L57-L63 | train |
Netflix/frigga | src/main/java/com/netflix/frigga/ami/AppVersion.java | AppVersion.parseName | public static AppVersion parseName(String amiName) {
if (amiName == null) {
return null;
}
Matcher matcher = APP_VERSION_PATTERN.matcher(amiName);
if (!matcher.matches()) {
return null;
}
AppVersion parsedName = new AppVersion();
parsedName... | java | public static AppVersion parseName(String amiName) {
if (amiName == null) {
return null;
}
Matcher matcher = APP_VERSION_PATTERN.matcher(amiName);
if (!matcher.matches()) {
return null;
}
AppVersion parsedName = new AppVersion();
parsedName... | [
"public",
"static",
"AppVersion",
"parseName",
"(",
"String",
"amiName",
")",
"{",
"if",
"(",
"amiName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Matcher",
"matcher",
"=",
"APP_VERSION_PATTERN",
".",
"matcher",
"(",
"amiName",
")",
";",
"if",
... | Parses the appversion tag into its component parts.
@param amiName the text of the AMI's appversion tag
@return bean representing the component parts of the appversion tag | [
"Parses",
"the",
"appversion",
"tag",
"into",
"its",
"component",
"parts",
"."
] | 38afefd1726116f3431b95fcb96a6af640b99d10 | https://github.com/Netflix/frigga/blob/38afefd1726116f3431b95fcb96a6af640b99d10/src/main/java/com/netflix/frigga/ami/AppVersion.java#L54-L74 | train |
Netflix/frigga | src/main/java/com/netflix/frigga/ami/BaseAmiInfo.java | BaseAmiInfo.parseDescription | public static BaseAmiInfo parseDescription(String imageDescription) {
BaseAmiInfo info = new BaseAmiInfo();
if (imageDescription == null) {
return info;
}
info.baseAmiId = extractBaseAmiId(imageDescription);
info.baseAmiName = extractBaseAmiName(imageDescription);
... | java | public static BaseAmiInfo parseDescription(String imageDescription) {
BaseAmiInfo info = new BaseAmiInfo();
if (imageDescription == null) {
return info;
}
info.baseAmiId = extractBaseAmiId(imageDescription);
info.baseAmiName = extractBaseAmiName(imageDescription);
... | [
"public",
"static",
"BaseAmiInfo",
"parseDescription",
"(",
"String",
"imageDescription",
")",
"{",
"BaseAmiInfo",
"info",
"=",
"new",
"BaseAmiInfo",
"(",
")",
";",
"if",
"(",
"imageDescription",
"==",
"null",
")",
"{",
"return",
"info",
";",
"}",
"info",
".... | Parse an AMI description into its component parts.
@param imageDescription description field of an AMI created by Netflix's bakery
@return bean representing the component parts of the AMI description | [
"Parse",
"an",
"AMI",
"description",
"into",
"its",
"component",
"parts",
"."
] | 38afefd1726116f3431b95fcb96a6af640b99d10 | https://github.com/Netflix/frigga/blob/38afefd1726116f3431b95fcb96a6af640b99d10/src/main/java/com/netflix/frigga/ami/BaseAmiInfo.java#L48-L67 | train |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/ServerRequestIdentifyUserRequest.java | ServerRequestIdentifyUserRequest.isExistingID | public boolean isExistingID() {
try {
String userId= getPost().getString(Defines.Jsonkey.Identity.getKey());
return (userId != null && userId.equals(prefHelper_.getIdentity()));
} catch (JSONException e) {
e.printStackTrace();
return false;
}
... | java | public boolean isExistingID() {
try {
String userId= getPost().getString(Defines.Jsonkey.Identity.getKey());
return (userId != null && userId.equals(prefHelper_.getIdentity()));
} catch (JSONException e) {
e.printStackTrace();
return false;
}
... | [
"public",
"boolean",
"isExistingID",
"(",
")",
"{",
"try",
"{",
"String",
"userId",
"=",
"getPost",
"(",
")",
".",
"getString",
"(",
"Defines",
".",
"Jsonkey",
".",
"Identity",
".",
"getKey",
"(",
")",
")",
";",
"return",
"(",
"userId",
"!=",
"null",
... | Return true if the user id provided for user identification is the same as existing id
@return True if the user id refferes to the existing user | [
"Return",
"true",
"if",
"the",
"user",
"id",
"provided",
"for",
"user",
"identification",
"is",
"the",
"same",
"as",
"existing",
"id"
] | e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848 | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/ServerRequestIdentifyUserRequest.java#L119-L128 | train |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/util/ContentMetadata.java | ContentMetadata.addCustomMetadata | public ContentMetadata addCustomMetadata(String key, String value) {
customMetadata.put(key, value);
return this;
} | java | public ContentMetadata addCustomMetadata(String key, String value) {
customMetadata.put(key, value);
return this;
} | [
"public",
"ContentMetadata",
"addCustomMetadata",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"customMetadata",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds any custom metadata associated with the qualifying content item
@param key Name of the custom data
@param value Value for the custom data
@return {@link ContentMetadata} object for method chaining | [
"Adds",
"any",
"custom",
"metadata",
"associated",
"with",
"the",
"qualifying",
"content",
"item"
] | e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848 | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/util/ContentMetadata.java#L156-L159 | train |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/AnimatedDialog.java | AnimatedDialog.setDialogWindowAttributes | public void setDialogWindowAttributes() {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCR... | java | public void setDialogWindowAttributes() {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCR... | [
"public",
"void",
"setDialogWindowAttributes",
"(",
")",
"{",
"requestWindowFeature",
"(",
"Window",
".",
"FEATURE_NO_TITLE",
")",
";",
"getWindow",
"(",
")",
".",
"setBackgroundDrawable",
"(",
"new",
"ColorDrawable",
"(",
"Color",
".",
"TRANSPARENT",
")",
")",
... | Set the window attributes for the invite dialog. | [
"Set",
"the",
"window",
"attributes",
"for",
"the",
"invite",
"dialog",
"."
] | e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848 | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/AnimatedDialog.java#L92-L106 | train |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/DeviceInfo.java | DeviceInfo.initialize | static DeviceInfo initialize(Context context) {
if (thisInstance_ == null) {
thisInstance_ = new DeviceInfo(context);
}
return thisInstance_;
} | java | static DeviceInfo initialize(Context context) {
if (thisInstance_ == null) {
thisInstance_ = new DeviceInfo(context);
}
return thisInstance_;
} | [
"static",
"DeviceInfo",
"initialize",
"(",
"Context",
"context",
")",
"{",
"if",
"(",
"thisInstance_",
"==",
"null",
")",
"{",
"thisInstance_",
"=",
"new",
"DeviceInfo",
"(",
"context",
")",
";",
"}",
"return",
"thisInstance_",
";",
"}"
] | Initialize the singleton instance for deviceInfo class
@return {@link DeviceInfo} global instance | [
"Initialize",
"the",
"singleton",
"instance",
"for",
"deviceInfo",
"class"
] | e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848 | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/DeviceInfo.java#L29-L34 | train |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/DeviceInfo.java | DeviceInfo.updateRequestWithV1Params | void updateRequestWithV1Params(JSONObject requestObj) {
try {
SystemObserver.UniqueId hardwareID = getHardwareID();
if (!isNullOrEmptyOrBlank(hardwareID.getId())) {
requestObj.put(Defines.Jsonkey.HardwareID.getKey(), hardwareID.getId());
requestObj.put(Def... | java | void updateRequestWithV1Params(JSONObject requestObj) {
try {
SystemObserver.UniqueId hardwareID = getHardwareID();
if (!isNullOrEmptyOrBlank(hardwareID.getId())) {
requestObj.put(Defines.Jsonkey.HardwareID.getKey(), hardwareID.getId());
requestObj.put(Def... | [
"void",
"updateRequestWithV1Params",
"(",
"JSONObject",
"requestObj",
")",
"{",
"try",
"{",
"SystemObserver",
".",
"UniqueId",
"hardwareID",
"=",
"getHardwareID",
"(",
")",
";",
"if",
"(",
"!",
"isNullOrEmptyOrBlank",
"(",
"hardwareID",
".",
"getId",
"(",
")",
... | Update the given server request JSON with device params
@param requestObj JSON object for Branch server request | [
"Update",
"the",
"given",
"server",
"request",
"JSON",
"with",
"device",
"params"
] | e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848 | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/DeviceInfo.java#L60-L111 | train |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/ServerRequestInitSession.java | ServerRequestInitSession.updateLinkReferrerParams | void updateLinkReferrerParams() {
// Add link identifier if present
String linkIdentifier = prefHelper_.getLinkClickIdentifier();
if (!linkIdentifier.equals(PrefHelper.NO_STRING_VALUE)) {
try {
getPost().put(Defines.Jsonkey.LinkIdentifier.getKey(), linkIdentifier);
... | java | void updateLinkReferrerParams() {
// Add link identifier if present
String linkIdentifier = prefHelper_.getLinkClickIdentifier();
if (!linkIdentifier.equals(PrefHelper.NO_STRING_VALUE)) {
try {
getPost().put(Defines.Jsonkey.LinkIdentifier.getKey(), linkIdentifier);
... | [
"void",
"updateLinkReferrerParams",
"(",
")",
"{",
"// Add link identifier if present",
"String",
"linkIdentifier",
"=",
"prefHelper_",
".",
"getLinkClickIdentifier",
"(",
")",
";",
"if",
"(",
"!",
"linkIdentifier",
".",
"equals",
"(",
"PrefHelper",
".",
"NO_STRING_VA... | Update link referrer params like play store referrer params
For link clicked installs link click id is updated when install referrer broadcast is received
Also update any googleSearchReferrer available with play store referrer broadcast
@see InstallListener
@see Branch#setPlayStoreReferrerCheckTimeout(long) | [
"Update",
"link",
"referrer",
"params",
"like",
"play",
"store",
"referrer",
"params",
"For",
"link",
"clicked",
"installs",
"link",
"click",
"id",
"is",
"updated",
"when",
"install",
"referrer",
"broadcast",
"is",
"received",
"Also",
"update",
"any",
"googleSea... | e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848 | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/ServerRequestInitSession.java#L157-L191 | train |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/SystemObserver.java | SystemObserver.getPackageName | static String getPackageName(Context context) {
String packageName = "";
if (context != null) {
try {
final PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
packageName = packageInfo.packageName;
} ... | java | static String getPackageName(Context context) {
String packageName = "";
if (context != null) {
try {
final PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
packageName = packageInfo.packageName;
} ... | [
"static",
"String",
"getPackageName",
"(",
"Context",
"context",
")",
"{",
"String",
"packageName",
"=",
"\"\"",
";",
"if",
"(",
"context",
"!=",
"null",
")",
"{",
"try",
"{",
"final",
"PackageInfo",
"packageInfo",
"=",
"context",
".",
"getPackageManager",
"... | Get the package name for this application.
@param context Context.
@return {@link String} with value as package name. Empty String in case of error | [
"Get",
"the",
"package",
"name",
"for",
"this",
"application",
"."
] | e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848 | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/SystemObserver.java#L69-L80 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.