id
int32
0
165k
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
14,000
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.lastElementSibling
public Element lastElementSibling() { List<Element> siblings = parent().childElementsList(); return siblings.size() > 1 ? siblings.get(siblings.size() - 1) : null; }
java
public Element lastElementSibling() { List<Element> siblings = parent().childElementsList(); return siblings.size() > 1 ? siblings.get(siblings.size() - 1) : null; }
[ "public", "Element", "lastElementSibling", "(", ")", "{", "List", "<", "Element", ">", "siblings", "=", "parent", "(", ")", ".", "childElementsList", "(", ")", ";", "return", "siblings", ".", "size", "(", ")", ">", "1", "?", "siblings", ".", "get", "("...
Gets the last element sibling of this element @return the last sibling that is an element (aka the parent's last element child)
[ "Gets", "the", "last", "element", "sibling", "of", "this", "element" ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L766-L769
14,001
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.getElementsByTag
public Elements getElementsByTag(String tagName) { Validate.notEmpty(tagName); tagName = normalize(tagName); return Collector.collect(new Evaluator.Tag(tagName), this); }
java
public Elements getElementsByTag(String tagName) { Validate.notEmpty(tagName); tagName = normalize(tagName); return Collector.collect(new Evaluator.Tag(tagName), this); }
[ "public", "Elements", "getElementsByTag", "(", "String", "tagName", ")", "{", "Validate", ".", "notEmpty", "(", "tagName", ")", ";", "tagName", "=", "normalize", "(", "tagName", ")", ";", "return", "Collector", ".", "collect", "(", "new", "Evaluator", ".", ...
Finds elements, including and recursively under this element, with the specified tag name. @param tagName The tag name to search for (case insensitively). @return a matching unmodifiable list of elements. Will be empty if this element and none of its children match.
[ "Finds", "elements", "including", "and", "recursively", "under", "this", "element", "with", "the", "specified", "tag", "name", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L787-L792
14,002
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.getElementsByAttribute
public Elements getElementsByAttribute(String key) { Validate.notEmpty(key); key = key.trim(); return Collector.collect(new Evaluator.Attribute(key), this); }
java
public Elements getElementsByAttribute(String key) { Validate.notEmpty(key); key = key.trim(); return Collector.collect(new Evaluator.Attribute(key), this); }
[ "public", "Elements", "getElementsByAttribute", "(", "String", "key", ")", "{", "Validate", ".", "notEmpty", "(", "key", ")", ";", "key", "=", "key", ".", "trim", "(", ")", ";", "return", "Collector", ".", "collect", "(", "new", "Evaluator", ".", "Attrib...
Find elements that have a named attribute set. Case insensitive. @param key name of the attribute, e.g. {@code href} @return elements that have this attribute, empty if none
[ "Find", "elements", "that", "have", "a", "named", "attribute", "set", ".", "Case", "insensitive", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L836-L841
14,003
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.getElementsByAttributeValue
public Elements getElementsByAttributeValue(String key, String value) { return Collector.collect(new Evaluator.AttributeWithValue(key, value), this); }
java
public Elements getElementsByAttributeValue(String key, String value) { return Collector.collect(new Evaluator.AttributeWithValue(key, value), this); }
[ "public", "Elements", "getElementsByAttributeValue", "(", "String", "key", ",", "String", "value", ")", "{", "return", "Collector", ".", "collect", "(", "new", "Evaluator", ".", "AttributeWithValue", "(", "key", ",", "value", ")", ",", "this", ")", ";", "}" ...
Find elements that have an attribute with the specific value. Case insensitive. @param key name of the attribute @param value value of the attribute @return elements that have this attribute with this value, empty if none
[ "Find", "elements", "that", "have", "an", "attribute", "with", "the", "specific", "value", ".", "Case", "insensitive", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L863-L865
14,004
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.getElementsByAttributeValueNot
public Elements getElementsByAttributeValueNot(String key, String value) { return Collector.collect(new Evaluator.AttributeWithValueNot(key, value), this); }
java
public Elements getElementsByAttributeValueNot(String key, String value) { return Collector.collect(new Evaluator.AttributeWithValueNot(key, value), this); }
[ "public", "Elements", "getElementsByAttributeValueNot", "(", "String", "key", ",", "String", "value", ")", "{", "return", "Collector", ".", "collect", "(", "new", "Evaluator", ".", "AttributeWithValueNot", "(", "key", ",", "value", ")", ",", "this", ")", ";", ...
Find elements that either do not have this attribute, or have it with a different value. Case insensitive. @param key name of the attribute @param value value of the attribute @return elements that do not have a matching attribute
[ "Find", "elements", "that", "either", "do", "not", "have", "this", "attribute", "or", "have", "it", "with", "a", "different", "value", ".", "Case", "insensitive", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L874-L876
14,005
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.getElementsByAttributeValueStarting
public Elements getElementsByAttributeValueStarting(String key, String valuePrefix) { return Collector.collect(new Evaluator.AttributeWithValueStarting(key, valuePrefix), this); }
java
public Elements getElementsByAttributeValueStarting(String key, String valuePrefix) { return Collector.collect(new Evaluator.AttributeWithValueStarting(key, valuePrefix), this); }
[ "public", "Elements", "getElementsByAttributeValueStarting", "(", "String", "key", ",", "String", "valuePrefix", ")", "{", "return", "Collector", ".", "collect", "(", "new", "Evaluator", ".", "AttributeWithValueStarting", "(", "key", ",", "valuePrefix", ")", ",", ...
Find elements that have attributes that start with the value prefix. Case insensitive. @param key name of the attribute @param valuePrefix start of attribute value @return elements that have attributes that start with the value prefix
[ "Find", "elements", "that", "have", "attributes", "that", "start", "with", "the", "value", "prefix", ".", "Case", "insensitive", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L885-L887
14,006
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.getElementsByAttributeValueEnding
public Elements getElementsByAttributeValueEnding(String key, String valueSuffix) { return Collector.collect(new Evaluator.AttributeWithValueEnding(key, valueSuffix), this); }
java
public Elements getElementsByAttributeValueEnding(String key, String valueSuffix) { return Collector.collect(new Evaluator.AttributeWithValueEnding(key, valueSuffix), this); }
[ "public", "Elements", "getElementsByAttributeValueEnding", "(", "String", "key", ",", "String", "valueSuffix", ")", "{", "return", "Collector", ".", "collect", "(", "new", "Evaluator", ".", "AttributeWithValueEnding", "(", "key", ",", "valueSuffix", ")", ",", "thi...
Find elements that have attributes that end with the value suffix. Case insensitive. @param key name of the attribute @param valueSuffix end of the attribute value @return elements that have attributes that end with the value suffix
[ "Find", "elements", "that", "have", "attributes", "that", "end", "with", "the", "value", "suffix", ".", "Case", "insensitive", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L896-L898
14,007
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.getElementsByAttributeValueContaining
public Elements getElementsByAttributeValueContaining(String key, String match) { return Collector.collect(new Evaluator.AttributeWithValueContaining(key, match), this); }
java
public Elements getElementsByAttributeValueContaining(String key, String match) { return Collector.collect(new Evaluator.AttributeWithValueContaining(key, match), this); }
[ "public", "Elements", "getElementsByAttributeValueContaining", "(", "String", "key", ",", "String", "match", ")", "{", "return", "Collector", ".", "collect", "(", "new", "Evaluator", ".", "AttributeWithValueContaining", "(", "key", ",", "match", ")", ",", "this", ...
Find elements that have attributes whose value contains the match string. Case insensitive. @param key name of the attribute @param match substring of value to search for @return elements that have attributes containing this text
[ "Find", "elements", "that", "have", "attributes", "whose", "value", "contains", "the", "match", "string", ".", "Case", "insensitive", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L907-L909
14,008
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.getElementsMatchingText
public Elements getElementsMatchingText(String regex) { Pattern pattern; try { pattern = Pattern.compile(regex); } catch (PatternSyntaxException e) { throw new IllegalArgumentException("Pattern syntax error: " + regex, e); } return getElementsMatchingText(...
java
public Elements getElementsMatchingText(String regex) { Pattern pattern; try { pattern = Pattern.compile(regex); } catch (PatternSyntaxException e) { throw new IllegalArgumentException("Pattern syntax error: " + regex, e); } return getElementsMatchingText(...
[ "public", "Elements", "getElementsMatchingText", "(", "String", "regex", ")", "{", "Pattern", "pattern", ";", "try", "{", "pattern", "=", "Pattern", ".", "compile", "(", "regex", ")", ";", "}", "catch", "(", "PatternSyntaxException", "e", ")", "{", "throw", ...
Find elements whose text matches the supplied regular expression. @param regex regular expression to match text against. You can use <a href="http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html#embedded">embedded flags</a> (such as (?i) and (?m) to control regex options. @return elements matching the s...
[ "Find", "elements", "whose", "text", "matches", "the", "supplied", "regular", "expression", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L1003-L1011
14,009
jhy/jsoup
src/main/java/org/jsoup/internal/ConstrainableInputStream.java
ConstrainableInputStream.wrap
public static ConstrainableInputStream wrap(InputStream in, int bufferSize, int maxSize) { return in instanceof ConstrainableInputStream ? (ConstrainableInputStream) in : new ConstrainableInputStream(in, bufferSize, maxSize); }
java
public static ConstrainableInputStream wrap(InputStream in, int bufferSize, int maxSize) { return in instanceof ConstrainableInputStream ? (ConstrainableInputStream) in : new ConstrainableInputStream(in, bufferSize, maxSize); }
[ "public", "static", "ConstrainableInputStream", "wrap", "(", "InputStream", "in", ",", "int", "bufferSize", ",", "int", "maxSize", ")", "{", "return", "in", "instanceof", "ConstrainableInputStream", "?", "(", "ConstrainableInputStream", ")", "in", ":", "new", "Con...
If this InputStream is not already a ConstrainableInputStream, let it be one. @param in the input stream to (maybe) wrap @param bufferSize the buffer size to use when reading @param maxSize the maximum size to allow to be read. 0 == infinite. @return a constrainable input stream
[ "If", "this", "InputStream", "is", "not", "already", "a", "ConstrainableInputStream", "let", "it", "be", "one", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/internal/ConstrainableInputStream.java#L42-L46
14,010
jhy/jsoup
src/main/java/org/jsoup/internal/ConstrainableInputStream.java
ConstrainableInputStream.readToByteBuffer
public ByteBuffer readToByteBuffer(int max) throws IOException { Validate.isTrue(max >= 0, "maxSize must be 0 (unlimited) or larger"); final boolean localCapped = max > 0; // still possibly capped in total stream final int bufferSize = localCapped && max < DefaultSize ? max : DefaultSize; ...
java
public ByteBuffer readToByteBuffer(int max) throws IOException { Validate.isTrue(max >= 0, "maxSize must be 0 (unlimited) or larger"); final boolean localCapped = max > 0; // still possibly capped in total stream final int bufferSize = localCapped && max < DefaultSize ? max : DefaultSize; ...
[ "public", "ByteBuffer", "readToByteBuffer", "(", "int", "max", ")", "throws", "IOException", "{", "Validate", ".", "isTrue", "(", "max", ">=", "0", ",", "\"maxSize must be 0 (unlimited) or larger\"", ")", ";", "final", "boolean", "localCapped", "=", "max", ">", ...
Reads this inputstream to a ByteBuffer. The supplied max may be less than the inputstream's max, to support reading just the first bytes.
[ "Reads", "this", "inputstream", "to", "a", "ByteBuffer", ".", "The", "supplied", "max", "may", "be", "less", "than", "the", "inputstream", "s", "max", "to", "support", "reading", "just", "the", "first", "bytes", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/internal/ConstrainableInputStream.java#L76-L99
14,011
jhy/jsoup
src/main/java/org/jsoup/parser/HtmlTreeBuilder.java
HtmlTreeBuilder.popStackToClose
void popStackToClose(String... elNames) { for (int pos = stack.size() -1; pos >= 0; pos--) { Element next = stack.get(pos); stack.remove(pos); if (inSorted(next.normalName(), elNames)) break; } }
java
void popStackToClose(String... elNames) { for (int pos = stack.size() -1; pos >= 0; pos--) { Element next = stack.get(pos); stack.remove(pos); if (inSorted(next.normalName(), elNames)) break; } }
[ "void", "popStackToClose", "(", "String", "...", "elNames", ")", "{", "for", "(", "int", "pos", "=", "stack", ".", "size", "(", ")", "-", "1", ";", "pos", ">=", "0", ";", "pos", "--", ")", "{", "Element", "next", "=", "stack", ".", "get", "(", ...
elnames is sorted, comes from Constants
[ "elnames", "is", "sorted", "comes", "from", "Constants" ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/HtmlTreeBuilder.java#L343-L350
14,012
jhy/jsoup
src/main/java/org/jsoup/parser/HtmlTreeBuilder.java
HtmlTreeBuilder.pushActiveFormattingElements
void pushActiveFormattingElements(Element in) { int numSeen = 0; for (int pos = formattingElements.size() -1; pos >= 0; pos--) { Element el = formattingElements.get(pos); if (el == null) // marker break; if (isSameFormattingElement(in, el)) ...
java
void pushActiveFormattingElements(Element in) { int numSeen = 0; for (int pos = formattingElements.size() -1; pos >= 0; pos--) { Element el = formattingElements.get(pos); if (el == null) // marker break; if (isSameFormattingElement(in, el)) ...
[ "void", "pushActiveFormattingElements", "(", "Element", "in", ")", "{", "int", "numSeen", "=", "0", ";", "for", "(", "int", "pos", "=", "formattingElements", ".", "size", "(", ")", "-", "1", ";", "pos", ">=", "0", ";", "pos", "--", ")", "{", "Element...
active formatting elements
[ "active", "formatting", "elements" ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/HtmlTreeBuilder.java#L598-L614
14,013
jhy/jsoup
src/main/java/org/jsoup/nodes/Attributes.java
Attributes.checkCapacity
private void checkCapacity(int minNewSize) { Validate.isTrue(minNewSize >= size); int curSize = keys.length; if (curSize >= minNewSize) return; int newSize = curSize >= InitialCapacity ? size * GrowthFactor : InitialCapacity; if (minNewSize > newSize) new...
java
private void checkCapacity(int minNewSize) { Validate.isTrue(minNewSize >= size); int curSize = keys.length; if (curSize >= minNewSize) return; int newSize = curSize >= InitialCapacity ? size * GrowthFactor : InitialCapacity; if (minNewSize > newSize) new...
[ "private", "void", "checkCapacity", "(", "int", "minNewSize", ")", "{", "Validate", ".", "isTrue", "(", "minNewSize", ">=", "size", ")", ";", "int", "curSize", "=", "keys", ".", "length", ";", "if", "(", "curSize", ">=", "minNewSize", ")", "return", ";",...
check there's room for more
[ "check", "there", "s", "room", "for", "more" ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L48-L60
14,014
jhy/jsoup
src/main/java/org/jsoup/nodes/Attributes.java
Attributes.copyOf
private static String[] copyOf(String[] orig, int size) { final String[] copy = new String[size]; System.arraycopy(orig, 0, copy, 0, Math.min(orig.length, size)); return copy; }
java
private static String[] copyOf(String[] orig, int size) { final String[] copy = new String[size]; System.arraycopy(orig, 0, copy, 0, Math.min(orig.length, size)); return copy; }
[ "private", "static", "String", "[", "]", "copyOf", "(", "String", "[", "]", "orig", ",", "int", "size", ")", "{", "final", "String", "[", "]", "copy", "=", "new", "String", "[", "size", "]", ";", "System", ".", "arraycopy", "(", "orig", ",", "0", ...
simple implementation of Arrays.copy, for support of Android API 8.
[ "simple", "implementation", "of", "Arrays", ".", "copy", "for", "support", "of", "Android", "API", "8", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L63-L68
14,015
jhy/jsoup
src/main/java/org/jsoup/nodes/Attributes.java
Attributes.get
public String get(String key) { int i = indexOfKey(key); return i == NotFound ? EmptyString : checkNotNull(vals[i]); }
java
public String get(String key) { int i = indexOfKey(key); return i == NotFound ? EmptyString : checkNotNull(vals[i]); }
[ "public", "String", "get", "(", "String", "key", ")", "{", "int", "i", "=", "indexOfKey", "(", "key", ")", ";", "return", "i", "==", "NotFound", "?", "EmptyString", ":", "checkNotNull", "(", "vals", "[", "i", "]", ")", ";", "}" ]
Get an attribute value by key. @param key the (case-sensitive) attribute key @return the attribute value if set; or empty string if not set (or a boolean attribute). @see #hasKey(String)
[ "Get", "an", "attribute", "value", "by", "key", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L99-L102
14,016
jhy/jsoup
src/main/java/org/jsoup/nodes/Attributes.java
Attributes.getIgnoreCase
public String getIgnoreCase(String key) { int i = indexOfKeyIgnoreCase(key); return i == NotFound ? EmptyString : checkNotNull(vals[i]); }
java
public String getIgnoreCase(String key) { int i = indexOfKeyIgnoreCase(key); return i == NotFound ? EmptyString : checkNotNull(vals[i]); }
[ "public", "String", "getIgnoreCase", "(", "String", "key", ")", "{", "int", "i", "=", "indexOfKeyIgnoreCase", "(", "key", ")", ";", "return", "i", "==", "NotFound", "?", "EmptyString", ":", "checkNotNull", "(", "vals", "[", "i", "]", ")", ";", "}" ]
Get an attribute's value by case-insensitive key @param key the attribute name @return the first matching attribute value if set; or empty string if not set (ora boolean attribute).
[ "Get", "an", "attribute", "s", "value", "by", "case", "-", "insensitive", "key" ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L109-L112
14,017
jhy/jsoup
src/main/java/org/jsoup/nodes/Attributes.java
Attributes.add
private void add(String key, String value) { checkCapacity(size + 1); keys[size] = key; vals[size] = value; size++; }
java
private void add(String key, String value) { checkCapacity(size + 1); keys[size] = key; vals[size] = value; size++; }
[ "private", "void", "add", "(", "String", "key", ",", "String", "value", ")", "{", "checkCapacity", "(", "size", "+", "1", ")", ";", "keys", "[", "size", "]", "=", "key", ";", "vals", "[", "size", "]", "=", "value", ";", "size", "++", ";", "}" ]
adds without checking if this key exists
[ "adds", "without", "checking", "if", "this", "key", "exists" ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L115-L120
14,018
jhy/jsoup
src/main/java/org/jsoup/nodes/Attributes.java
Attributes.put
public Attributes put(String key, boolean value) { if (value) putIgnoreCase(key, null); else remove(key); return this; }
java
public Attributes put(String key, boolean value) { if (value) putIgnoreCase(key, null); else remove(key); return this; }
[ "public", "Attributes", "put", "(", "String", "key", ",", "boolean", "value", ")", "{", "if", "(", "value", ")", "putIgnoreCase", "(", "key", ",", "null", ")", ";", "else", "remove", "(", "key", ")", ";", "return", "this", ";", "}" ]
Set a new boolean attribute, remove attribute if value is false. @param key case <b>insensitive</b> attribute key @param value attribute value @return these attributes, for chaining
[ "Set", "a", "new", "boolean", "attribute", "remove", "attribute", "if", "value", "is", "false", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L154-L160
14,019
jhy/jsoup
src/main/java/org/jsoup/nodes/Attributes.java
Attributes.remove
private void remove(int index) { Validate.isFalse(index >= size); int shifted = size - index - 1; if (shifted > 0) { System.arraycopy(keys, index + 1, keys, index, shifted); System.arraycopy(vals, index + 1, vals, index, shifted); } size--; keys[si...
java
private void remove(int index) { Validate.isFalse(index >= size); int shifted = size - index - 1; if (shifted > 0) { System.arraycopy(keys, index + 1, keys, index, shifted); System.arraycopy(vals, index + 1, vals, index, shifted); } size--; keys[si...
[ "private", "void", "remove", "(", "int", "index", ")", "{", "Validate", ".", "isFalse", "(", "index", ">=", "size", ")", ";", "int", "shifted", "=", "size", "-", "index", "-", "1", ";", "if", "(", "shifted", ">", "0", ")", "{", "System", ".", "ar...
removes and shifts up
[ "removes", "and", "shifts", "up" ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L175-L185
14,020
jhy/jsoup
src/main/java/org/jsoup/nodes/Attributes.java
Attributes.addAll
public void addAll(Attributes incoming) { if (incoming.size() == 0) return; checkCapacity(size + incoming.size); for (Attribute attr : incoming) { // todo - should this be case insensitive? put(attr); } }
java
public void addAll(Attributes incoming) { if (incoming.size() == 0) return; checkCapacity(size + incoming.size); for (Attribute attr : incoming) { // todo - should this be case insensitive? put(attr); } }
[ "public", "void", "addAll", "(", "Attributes", "incoming", ")", "{", "if", "(", "incoming", ".", "size", "(", ")", "==", "0", ")", "return", ";", "checkCapacity", "(", "size", "+", "incoming", ".", "size", ")", ";", "for", "(", "Attribute", "attr", "...
Add all the attributes from the incoming set to this set. @param incoming attributes to add to these attributes.
[ "Add", "all", "the", "attributes", "from", "the", "incoming", "set", "to", "this", "set", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L237-L247
14,021
jhy/jsoup
src/main/java/org/jsoup/nodes/Attributes.java
Attributes.asList
public List<Attribute> asList() { ArrayList<Attribute> list = new ArrayList<>(size); for (int i = 0; i < size; i++) { Attribute attr = vals[i] == null ? new BooleanAttribute(keys[i]) : // deprecated class, but maybe someone still wants it new Attribute(keys[i]...
java
public List<Attribute> asList() { ArrayList<Attribute> list = new ArrayList<>(size); for (int i = 0; i < size; i++) { Attribute attr = vals[i] == null ? new BooleanAttribute(keys[i]) : // deprecated class, but maybe someone still wants it new Attribute(keys[i]...
[ "public", "List", "<", "Attribute", ">", "asList", "(", ")", "{", "ArrayList", "<", "Attribute", ">", "list", "=", "new", "ArrayList", "<>", "(", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{...
Get the attributes as a List, for iteration. @return an view of the attributes as an unmodifialbe List.
[ "Get", "the", "attributes", "as", "a", "List", "for", "iteration", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L276-L285
14,022
jhy/jsoup
src/main/java/org/jsoup/nodes/Attributes.java
Attributes.html
public String html() { StringBuilder sb = StringUtil.borrowBuilder(); try { html(sb, (new Document("")).outputSettings()); // output settings a bit funky, but this html() seldom used } catch (IOException e) { // ought never happen throw new SerializationException(e); ...
java
public String html() { StringBuilder sb = StringUtil.borrowBuilder(); try { html(sb, (new Document("")).outputSettings()); // output settings a bit funky, but this html() seldom used } catch (IOException e) { // ought never happen throw new SerializationException(e); ...
[ "public", "String", "html", "(", ")", "{", "StringBuilder", "sb", "=", "StringUtil", ".", "borrowBuilder", "(", ")", ";", "try", "{", "html", "(", "sb", ",", "(", "new", "Document", "(", "\"\"", ")", ")", ".", "outputSettings", "(", ")", ")", ";", ...
Get the HTML representation of these attributes. @return HTML @throws SerializationException if the HTML representation of the attributes cannot be constructed.
[ "Get", "the", "HTML", "representation", "of", "these", "attributes", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L301-L309
14,023
jhy/jsoup
src/main/java/org/jsoup/nodes/Attributes.java
Attributes.normalize
public void normalize() { for (int i = 0; i < size; i++) { keys[i] = lowerCase(keys[i]); } }
java
public void normalize() { for (int i = 0; i < size; i++) { keys[i] = lowerCase(keys[i]); } }
[ "public", "void", "normalize", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "keys", "[", "i", "]", "=", "lowerCase", "(", "keys", "[", "i", "]", ")", ";", "}", "}" ]
Internal method. Lowercases all keys.
[ "Internal", "method", ".", "Lowercases", "all", "keys", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Attributes.java#L379-L383
14,024
jhy/jsoup
src/main/java/org/jsoup/nodes/TextNode.java
TextNode.splitText
public TextNode splitText(int offset) { final String text = coreValue(); Validate.isTrue(offset >= 0, "Split offset must be not be negative"); Validate.isTrue(offset < text.length(), "Split offset must not be greater than current text length"); String head = text.substring(0, offset); ...
java
public TextNode splitText(int offset) { final String text = coreValue(); Validate.isTrue(offset >= 0, "Split offset must be not be negative"); Validate.isTrue(offset < text.length(), "Split offset must not be greater than current text length"); String head = text.substring(0, offset); ...
[ "public", "TextNode", "splitText", "(", "int", "offset", ")", "{", "final", "String", "text", "=", "coreValue", "(", ")", ";", "Validate", ".", "isTrue", "(", "offset", ">=", "0", ",", "\"Split offset must be not be negative\"", ")", ";", "Validate", ".", "i...
Split this text node into two nodes at the specified string offset. After splitting, this node will contain the original text up to the offset, and will have a new text node sibling containing the text after the offset. @param offset string offset point to split node at. @return the newly created text node containing t...
[ "Split", "this", "text", "node", "into", "two", "nodes", "at", "the", "specified", "string", "offset", ".", "After", "splitting", "this", "node", "will", "contain", "the", "original", "text", "up", "to", "the", "offset", "and", "will", "have", "a", "new", ...
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/TextNode.java#L81-L94
14,025
jhy/jsoup
src/main/java/org/jsoup/parser/TokenQueue.java
TokenQueue.matches
public boolean matches(String seq) { return queue.regionMatches(true, pos, seq, 0, seq.length()); }
java
public boolean matches(String seq) { return queue.regionMatches(true, pos, seq, 0, seq.length()); }
[ "public", "boolean", "matches", "(", "String", "seq", ")", "{", "return", "queue", ".", "regionMatches", "(", "true", ",", "pos", ",", "seq", ",", "0", ",", "seq", ".", "length", "(", ")", ")", ";", "}" ]
Tests if the next characters on the queue match the sequence. Case insensitive. @param seq String to check queue for. @return true if the next characters match.
[ "Tests", "if", "the", "next", "characters", "on", "the", "queue", "match", "the", "sequence", ".", "Case", "insensitive", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/TokenQueue.java#L69-L71
14,026
jhy/jsoup
src/main/java/org/jsoup/parser/TokenQueue.java
TokenQueue.matchesAny
public boolean matchesAny(String... seq) { for (String s : seq) { if (matches(s)) return true; } return false; }
java
public boolean matchesAny(String... seq) { for (String s : seq) { if (matches(s)) return true; } return false; }
[ "public", "boolean", "matchesAny", "(", "String", "...", "seq", ")", "{", "for", "(", "String", "s", ":", "seq", ")", "{", "if", "(", "matches", "(", "s", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
Tests if the next characters match any of the sequences. Case insensitive. @param seq list of strings to case insensitively check for @return true of any matched, false if none did
[ "Tests", "if", "the", "next", "characters", "match", "any", "of", "the", "sequences", ".", "Case", "insensitive", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/TokenQueue.java#L88-L94
14,027
jhy/jsoup
src/main/java/org/jsoup/parser/TokenQueue.java
TokenQueue.consumeTo
public String consumeTo(String seq) { int offset = queue.indexOf(seq, pos); if (offset != -1) { String consumed = queue.substring(pos, offset); pos += consumed.length(); return consumed; } else { return remainder(); } }
java
public String consumeTo(String seq) { int offset = queue.indexOf(seq, pos); if (offset != -1) { String consumed = queue.substring(pos, offset); pos += consumed.length(); return consumed; } else { return remainder(); } }
[ "public", "String", "consumeTo", "(", "String", "seq", ")", "{", "int", "offset", "=", "queue", ".", "indexOf", "(", "seq", ",", "pos", ")", ";", "if", "(", "offset", "!=", "-", "1", ")", "{", "String", "consumed", "=", "queue", ".", "substring", "...
Pulls a string off the queue, up to but exclusive of the match sequence, or to the queue running out. @param seq String to end on (and not include in return, but leave on queue). <b>Case sensitive.</b> @return The matched data consumed from queue.
[ "Pulls", "a", "string", "off", "the", "queue", "up", "to", "but", "exclusive", "of", "the", "match", "sequence", "or", "to", "the", "queue", "running", "out", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/TokenQueue.java#L180-L189
14,028
jhy/jsoup
src/main/java/org/jsoup/parser/TokenQueue.java
TokenQueue.unescape
public static String unescape(String in) { StringBuilder out = StringUtil.borrowBuilder(); char last = 0; for (char c : in.toCharArray()) { if (c == ESC) { if (last != 0 && last == ESC) out.append(c); } else ...
java
public static String unescape(String in) { StringBuilder out = StringUtil.borrowBuilder(); char last = 0; for (char c : in.toCharArray()) { if (c == ESC) { if (last != 0 && last == ESC) out.append(c); } else ...
[ "public", "static", "String", "unescape", "(", "String", "in", ")", "{", "StringBuilder", "out", "=", "StringUtil", ".", "borrowBuilder", "(", ")", ";", "char", "last", "=", "0", ";", "for", "(", "char", "c", ":", "in", ".", "toCharArray", "(", ")", ...
Unescape a \ escaped string. @param in backslash escaped string @return unescaped string
[ "Unescape", "a", "\\", "escaped", "string", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/TokenQueue.java#L304-L317
14,029
jhy/jsoup
src/main/java/org/jsoup/nodes/XmlDeclaration.java
XmlDeclaration.getWholeDeclaration
public String getWholeDeclaration() { StringBuilder sb = StringUtil.borrowBuilder(); try { getWholeDeclaration(sb, new Document.OutputSettings()); } catch (IOException e) { throw new SerializationException(e); } return StringUtil.releaseBuilder(sb).trim();...
java
public String getWholeDeclaration() { StringBuilder sb = StringUtil.borrowBuilder(); try { getWholeDeclaration(sb, new Document.OutputSettings()); } catch (IOException e) { throw new SerializationException(e); } return StringUtil.releaseBuilder(sb).trim();...
[ "public", "String", "getWholeDeclaration", "(", ")", "{", "StringBuilder", "sb", "=", "StringUtil", ".", "borrowBuilder", "(", ")", ";", "try", "{", "getWholeDeclaration", "(", "sb", ",", "new", "Document", ".", "OutputSettings", "(", ")", ")", ";", "}", "...
Get the unencoded XML declaration. @return XML declaration
[ "Get", "the", "unencoded", "XML", "declaration", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/XmlDeclaration.java#L55-L63
14,030
jhy/jsoup
src/main/java/org/jsoup/parser/ParseSettings.java
ParseSettings.normalizeTag
public String normalizeTag(String name) { name = name.trim(); if (!preserveTagCase) name = lowerCase(name); return name; }
java
public String normalizeTag(String name) { name = name.trim(); if (!preserveTagCase) name = lowerCase(name); return name; }
[ "public", "String", "normalizeTag", "(", "String", "name", ")", "{", "name", "=", "name", ".", "trim", "(", ")", ";", "if", "(", "!", "preserveTagCase", ")", "name", "=", "lowerCase", "(", "name", ")", ";", "return", "name", ";", "}" ]
Normalizes a tag name according to the case preservation setting.
[ "Normalizes", "a", "tag", "name", "according", "to", "the", "case", "preservation", "setting", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/ParseSettings.java#L41-L46
14,031
jhy/jsoup
src/main/java/org/jsoup/parser/ParseSettings.java
ParseSettings.normalizeAttribute
public String normalizeAttribute(String name) { name = name.trim(); if (!preserveAttributeCase) name = lowerCase(name); return name; }
java
public String normalizeAttribute(String name) { name = name.trim(); if (!preserveAttributeCase) name = lowerCase(name); return name; }
[ "public", "String", "normalizeAttribute", "(", "String", "name", ")", "{", "name", "=", "name", ".", "trim", "(", ")", ";", "if", "(", "!", "preserveAttributeCase", ")", "name", "=", "lowerCase", "(", "name", ")", ";", "return", "name", ";", "}" ]
Normalizes an attribute according to the case preservation setting.
[ "Normalizes", "an", "attribute", "according", "to", "the", "case", "preservation", "setting", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/ParseSettings.java#L51-L56
14,032
jhy/jsoup
src/main/java/org/jsoup/parser/Parser.java
Parser.setTrackErrors
public Parser setTrackErrors(int maxErrors) { errors = maxErrors > 0 ? ParseErrorList.tracking(maxErrors) : ParseErrorList.noTracking(); return this; }
java
public Parser setTrackErrors(int maxErrors) { errors = maxErrors > 0 ? ParseErrorList.tracking(maxErrors) : ParseErrorList.noTracking(); return this; }
[ "public", "Parser", "setTrackErrors", "(", "int", "maxErrors", ")", "{", "errors", "=", "maxErrors", ">", "0", "?", "ParseErrorList", ".", "tracking", "(", "maxErrors", ")", ":", "ParseErrorList", ".", "noTracking", "(", ")", ";", "return", "this", ";", "}...
Enable or disable parse error tracking for the next parse. @param maxErrors the maximum number of errors to track. Set to 0 to disable. @return this, for chaining
[ "Enable", "or", "disable", "parse", "error", "tracking", "for", "the", "next", "parse", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/Parser.java#L74-L77
14,033
jhy/jsoup
src/main/java/org/jsoup/parser/Parser.java
Parser.parse
public static Document parse(String html, String baseUri) { TreeBuilder treeBuilder = new HtmlTreeBuilder(); return treeBuilder.parse(new StringReader(html), baseUri, new Parser(treeBuilder)); }
java
public static Document parse(String html, String baseUri) { TreeBuilder treeBuilder = new HtmlTreeBuilder(); return treeBuilder.parse(new StringReader(html), baseUri, new Parser(treeBuilder)); }
[ "public", "static", "Document", "parse", "(", "String", "html", ",", "String", "baseUri", ")", "{", "TreeBuilder", "treeBuilder", "=", "new", "HtmlTreeBuilder", "(", ")", ";", "return", "treeBuilder", ".", "parse", "(", "new", "StringReader", "(", "html", ")...
Parse HTML into a Document. @param html HTML to parse @param baseUri base URI of document (i.e. original fetch location), for resolving relative URLs. @return parsed Document
[ "Parse", "HTML", "into", "a", "Document", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/Parser.java#L105-L108
14,034
jhy/jsoup
src/main/java/org/jsoup/parser/Parser.java
Parser.parseXmlFragment
public static List<Node> parseXmlFragment(String fragmentXml, String baseUri) { XmlTreeBuilder treeBuilder = new XmlTreeBuilder(); return treeBuilder.parseFragment(fragmentXml, baseUri, new Parser(treeBuilder)); }
java
public static List<Node> parseXmlFragment(String fragmentXml, String baseUri) { XmlTreeBuilder treeBuilder = new XmlTreeBuilder(); return treeBuilder.parseFragment(fragmentXml, baseUri, new Parser(treeBuilder)); }
[ "public", "static", "List", "<", "Node", ">", "parseXmlFragment", "(", "String", "fragmentXml", ",", "String", "baseUri", ")", "{", "XmlTreeBuilder", "treeBuilder", "=", "new", "XmlTreeBuilder", "(", ")", ";", "return", "treeBuilder", ".", "parseFragment", "(", ...
Parse a fragment of XML into a list of nodes. @param fragmentXml the fragment of XML to parse @param baseUri base URI of document (i.e. original fetch location), for resolving relative URLs. @return list of nodes parsed from the input XML.
[ "Parse", "a", "fragment", "of", "XML", "into", "a", "list", "of", "nodes", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/Parser.java#L150-L153
14,035
jhy/jsoup
src/main/java/org/jsoup/parser/Parser.java
Parser.unescapeEntities
public static String unescapeEntities(String string, boolean inAttribute) { Tokeniser tokeniser = new Tokeniser(new CharacterReader(string), ParseErrorList.noTracking()); return tokeniser.unescapeEntities(inAttribute); }
java
public static String unescapeEntities(String string, boolean inAttribute) { Tokeniser tokeniser = new Tokeniser(new CharacterReader(string), ParseErrorList.noTracking()); return tokeniser.unescapeEntities(inAttribute); }
[ "public", "static", "String", "unescapeEntities", "(", "String", "string", ",", "boolean", "inAttribute", ")", "{", "Tokeniser", "tokeniser", "=", "new", "Tokeniser", "(", "new", "CharacterReader", "(", "string", ")", ",", "ParseErrorList", ".", "noTracking", "(...
Utility method to unescape HTML entities from a string @param string HTML escaped string @param inAttribute if the string is to be escaped in strict mode (as attributes are) @return an unescaped string
[ "Utility", "method", "to", "unescape", "HTML", "entities", "from", "a", "string" ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/Parser.java#L183-L186
14,036
jhy/jsoup
src/main/java/org/jsoup/parser/Tokeniser.java
Tokeniser.unescapeEntities
String unescapeEntities(boolean inAttribute) { StringBuilder builder = StringUtil.borrowBuilder(); while (!reader.isEmpty()) { builder.append(reader.consumeTo('&')); if (reader.matches('&')) { reader.consume(); int[] c = consumeCharacterReference(n...
java
String unescapeEntities(boolean inAttribute) { StringBuilder builder = StringUtil.borrowBuilder(); while (!reader.isEmpty()) { builder.append(reader.consumeTo('&')); if (reader.matches('&')) { reader.consume(); int[] c = consumeCharacterReference(n...
[ "String", "unescapeEntities", "(", "boolean", "inAttribute", ")", "{", "StringBuilder", "builder", "=", "StringUtil", ".", "borrowBuilder", "(", ")", ";", "while", "(", "!", "reader", ".", "isEmpty", "(", ")", ")", "{", "builder", ".", "append", "(", "read...
Utility method to consume reader and unescape entities found within. @param inAttribute if the text to be unescaped is in an attribute @return unescaped string from reader
[ "Utility", "method", "to", "consume", "reader", "and", "unescape", "entities", "found", "within", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/Tokeniser.java#L277-L295
14,037
jhy/jsoup
src/main/java/org/jsoup/examples/HtmlToPlainText.java
HtmlToPlainText.getPlainText
public String getPlainText(Element element) { FormattingVisitor formatter = new FormattingVisitor(); NodeTraversor.traverse(formatter, element); // walk the DOM, and call .head() and .tail() for each node return formatter.toString(); }
java
public String getPlainText(Element element) { FormattingVisitor formatter = new FormattingVisitor(); NodeTraversor.traverse(formatter, element); // walk the DOM, and call .head() and .tail() for each node return formatter.toString(); }
[ "public", "String", "getPlainText", "(", "Element", "element", ")", "{", "FormattingVisitor", "formatter", "=", "new", "FormattingVisitor", "(", ")", ";", "NodeTraversor", ".", "traverse", "(", "formatter", ",", "element", ")", ";", "// walk the DOM, and call .head(...
Format an Element to plain-text @param element the root element to format @return formatted text
[ "Format", "an", "Element", "to", "plain", "-", "text" ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/examples/HtmlToPlainText.java#L61-L66
14,038
jhy/jsoup
src/main/java/org/jsoup/nodes/Comment.java
Comment.isXmlDeclaration
public boolean isXmlDeclaration() { String data = getData(); return (data.length() > 1 && (data.startsWith("!") || data.startsWith("?"))); }
java
public boolean isXmlDeclaration() { String data = getData(); return (data.length() > 1 && (data.startsWith("!") || data.startsWith("?"))); }
[ "public", "boolean", "isXmlDeclaration", "(", ")", "{", "String", "data", "=", "getData", "(", ")", ";", "return", "(", "data", ".", "length", "(", ")", ">", "1", "&&", "(", "data", ".", "startsWith", "(", "\"!\"", ")", "||", "data", ".", "startsWith...
Check if this comment looks like an XML Declaration. @return true if it looks like, maybe, it's an XML Declaration.
[ "Check", "if", "this", "comment", "looks", "like", "an", "XML", "Declaration", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Comment.java#L65-L68
14,039
jhy/jsoup
src/main/java/org/jsoup/nodes/Comment.java
Comment.asXmlDeclaration
public XmlDeclaration asXmlDeclaration() { String data = getData(); Document doc = Jsoup.parse("<" + data.substring(1, data.length() -1) + ">", baseUri(), Parser.xmlParser()); XmlDeclaration decl = null; if (doc.children().size() > 0) { Element el = doc.child(0); ...
java
public XmlDeclaration asXmlDeclaration() { String data = getData(); Document doc = Jsoup.parse("<" + data.substring(1, data.length() -1) + ">", baseUri(), Parser.xmlParser()); XmlDeclaration decl = null; if (doc.children().size() > 0) { Element el = doc.child(0); ...
[ "public", "XmlDeclaration", "asXmlDeclaration", "(", ")", "{", "String", "data", "=", "getData", "(", ")", ";", "Document", "doc", "=", "Jsoup", ".", "parse", "(", "\"<\"", "+", "data", ".", "substring", "(", "1", ",", "data", ".", "length", "(", ")", ...
Attempt to cast this comment to an XML Declaration note. @return an XML declaration if it could be parsed as one, null otherwise.
[ "Attempt", "to", "cast", "this", "comment", "to", "an", "XML", "Declaration", "note", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Comment.java#L74-L84
14,040
jhy/jsoup
src/main/java/org/jsoup/select/QueryParser.java
QueryParser.parse
public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } }
java
public static Evaluator parse(String query) { try { QueryParser p = new QueryParser(query); return p.parse(); } catch (IllegalArgumentException e) { throw new Selector.SelectorParseException(e.getMessage()); } }
[ "public", "static", "Evaluator", "parse", "(", "String", "query", ")", "{", "try", "{", "QueryParser", "p", "=", "new", "QueryParser", "(", "query", ")", ";", "return", "p", ".", "parse", "(", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e",...
Parse a CSS query into an Evaluator. @param query CSS query @return Evaluator
[ "Parse", "a", "CSS", "query", "into", "an", "Evaluator", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/select/QueryParser.java#L39-L46
14,041
jhy/jsoup
src/main/java/org/jsoup/select/QueryParser.java
QueryParser.parse
Evaluator parse() { tq.consumeWhitespace(); if (tq.matchesAny(combinators)) { // if starts with a combinator, use root as elements evals.add(new StructuralEvaluator.Root()); combinator(tq.consume()); } else { findElements(); } while (!tq.isEm...
java
Evaluator parse() { tq.consumeWhitespace(); if (tq.matchesAny(combinators)) { // if starts with a combinator, use root as elements evals.add(new StructuralEvaluator.Root()); combinator(tq.consume()); } else { findElements(); } while (!tq.isEm...
[ "Evaluator", "parse", "(", ")", "{", "tq", ".", "consumeWhitespace", "(", ")", ";", "if", "(", "tq", ".", "matchesAny", "(", "combinators", ")", ")", "{", "// if starts with a combinator, use root as elements", "evals", ".", "add", "(", "new", "StructuralEvaluat...
Parse the query @return Evaluator
[ "Parse", "the", "query" ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/select/QueryParser.java#L52-L79
14,042
jhy/jsoup
src/main/java/org/jsoup/nodes/NodeUtils.java
NodeUtils.parser
static Parser parser(Node node) { Document doc = node.ownerDocument(); return doc != null && doc.parser() != null ? doc.parser() : new Parser(new HtmlTreeBuilder()); }
java
static Parser parser(Node node) { Document doc = node.ownerDocument(); return doc != null && doc.parser() != null ? doc.parser() : new Parser(new HtmlTreeBuilder()); }
[ "static", "Parser", "parser", "(", "Node", "node", ")", "{", "Document", "doc", "=", "node", ".", "ownerDocument", "(", ")", ";", "return", "doc", "!=", "null", "&&", "doc", ".", "parser", "(", ")", "!=", "null", "?", "doc", ".", "parser", "(", ")"...
Get the parser that was used to make this node, or the default HTML parser if it has no parent.
[ "Get", "the", "parser", "that", "was", "used", "to", "make", "this", "node", "or", "the", "default", "HTML", "parser", "if", "it", "has", "no", "parent", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/NodeUtils.java#L23-L26
14,043
jhy/jsoup
src/main/java/org/jsoup/select/Selector.java
Selector.selectFirst
public static Element selectFirst(String cssQuery, Element root) { Validate.notEmpty(cssQuery); return Collector.findFirst(QueryParser.parse(cssQuery), root); }
java
public static Element selectFirst(String cssQuery, Element root) { Validate.notEmpty(cssQuery); return Collector.findFirst(QueryParser.parse(cssQuery), root); }
[ "public", "static", "Element", "selectFirst", "(", "String", "cssQuery", ",", "Element", "root", ")", "{", "Validate", ".", "notEmpty", "(", "cssQuery", ")", ";", "return", "Collector", ".", "findFirst", "(", "QueryParser", ".", "parse", "(", "cssQuery", ")"...
Find the first element that matches the query. @param cssQuery CSS selector @param root root element to descend into @return the matching element, or <b>null</b> if none.
[ "Find", "the", "first", "element", "that", "matches", "the", "query", "." ]
68ff8cbe7ad847059737a09c567a501a7f1d251f
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/select/Selector.java#L157-L160
14,044
alibaba/transmittable-thread-local
src/main/java/com/alibaba/ttl/TtlRecursiveTask.java
TtlRecursiveTask.exec
protected final boolean exec() { Object backup = replay(captured); try { result = compute(); return true; } finally { restore(backup); } }
java
protected final boolean exec() { Object backup = replay(captured); try { result = compute(); return true; } finally { restore(backup); } }
[ "protected", "final", "boolean", "exec", "(", ")", "{", "Object", "backup", "=", "replay", "(", "captured", ")", ";", "try", "{", "result", "=", "compute", "(", ")", ";", "return", "true", ";", "}", "finally", "{", "restore", "(", "backup", ")", ";",...
Implements execution conventions for RecursiveTask.
[ "Implements", "execution", "conventions", "for", "RecursiveTask", "." ]
30b4d99cdb7064b4c1797d2e40bfa07adce8e7f9
https://github.com/alibaba/transmittable-thread-local/blob/30b4d99cdb7064b4c1797d2e40bfa07adce8e7f9/src/main/java/com/alibaba/ttl/TtlRecursiveTask.java#L52-L60
14,045
kiegroup/drools
drools-verifier/drools-verifier-drl/src/main/java/org/drools/verifier/report/components/MissingRange.java
MissingRange.getReversedOperator
public static Operator getReversedOperator(Operator e) { if ( e.equals( Operator.NOT_EQUAL ) ) { return Operator.EQUAL; } else if ( e.equals( Operator.EQUAL ) ) { return Operator.NOT_EQUAL; } else if ( e.equals( Operator.GREATER ) ) { return Operator.LESS_OR_E...
java
public static Operator getReversedOperator(Operator e) { if ( e.equals( Operator.NOT_EQUAL ) ) { return Operator.EQUAL; } else if ( e.equals( Operator.EQUAL ) ) { return Operator.NOT_EQUAL; } else if ( e.equals( Operator.GREATER ) ) { return Operator.LESS_OR_E...
[ "public", "static", "Operator", "getReversedOperator", "(", "Operator", "e", ")", "{", "if", "(", "e", ".", "equals", "(", "Operator", ".", "NOT_EQUAL", ")", ")", "{", "return", "Operator", ".", "EQUAL", ";", "}", "else", "if", "(", "e", ".", "equals",...
Takes the given operator e, and returns a reversed version of it. @return operator
[ "Takes", "the", "given", "operator", "e", "and", "returns", "a", "reversed", "version", "of", "it", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-verifier/drools-verifier-drl/src/main/java/org/drools/verifier/report/components/MissingRange.java#L49-L66
14,046
kiegroup/drools
drools-workbench-models/drools-workbench-models-guided-template/src/main/java/org/drools/workbench/models/guided/template/shared/TemplateModel.java
TemplateModel.addRow
private String addRow(String rowId, String[] row) { Map<InterpolationVariable, Integer> vars = getInterpolationVariables(); if (row.length != vars.size() - 1) { throw new IllegalArgumentException("Invalid numbers of columns: " + row.length + " expected: " ...
java
private String addRow(String rowId, String[] row) { Map<InterpolationVariable, Integer> vars = getInterpolationVariables(); if (row.length != vars.size() - 1) { throw new IllegalArgumentException("Invalid numbers of columns: " + row.length + " expected: " ...
[ "private", "String", "addRow", "(", "String", "rowId", ",", "String", "[", "]", "row", ")", "{", "Map", "<", "InterpolationVariable", ",", "Integer", ">", "vars", "=", "getInterpolationVariables", "(", ")", ";", "if", "(", "row", ".", "length", "!=", "va...
Append a row of data @param rowId @param row @return
[ "Append", "a", "row", "of", "data" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-workbench-models/drools-workbench-models-guided-template/src/main/java/org/drools/workbench/models/guided/template/shared/TemplateModel.java#L50-L78
14,047
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java
KnowledgeBuilderImpl.addPackageFromDrl
public void addPackageFromDrl(final Reader reader) throws DroolsParserException, IOException { addPackageFromDrl(reader, new ReaderResource(reader, ResourceType.DRL)); }
java
public void addPackageFromDrl(final Reader reader) throws DroolsParserException, IOException { addPackageFromDrl(reader, new ReaderResource(reader, ResourceType.DRL)); }
[ "public", "void", "addPackageFromDrl", "(", "final", "Reader", "reader", ")", "throws", "DroolsParserException", ",", "IOException", "{", "addPackageFromDrl", "(", "reader", ",", "new", "ReaderResource", "(", "reader", ",", "ResourceType", ".", "DRL", ")", ")", ...
Load a rule package from DRL source. @throws DroolsParserException @throws java.io.IOException
[ "Load", "a", "rule", "package", "from", "DRL", "source", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java#L344-L347
14,048
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java
KnowledgeBuilderImpl.addPackageFromDrl
public void addPackageFromDrl(final Reader reader, final Resource sourceResource) throws DroolsParserException, IOException { this.resource = sourceResource; final DrlParser parser = new DrlParser(configuration.getLanguageLevel()); final PackageDescr...
java
public void addPackageFromDrl(final Reader reader, final Resource sourceResource) throws DroolsParserException, IOException { this.resource = sourceResource; final DrlParser parser = new DrlParser(configuration.getLanguageLevel()); final PackageDescr...
[ "public", "void", "addPackageFromDrl", "(", "final", "Reader", "reader", ",", "final", "Resource", "sourceResource", ")", "throws", "DroolsParserException", ",", "IOException", "{", "this", ".", "resource", "=", "sourceResource", ";", "final", "DrlParser", "parser",...
Load a rule package from DRL source and associate all loaded artifacts with the given resource. @param reader @param sourceResource the source resource for the read artifacts @throws DroolsParserException @throws IOException
[ "Load", "a", "rule", "package", "from", "DRL", "source", "and", "associate", "all", "loaded", "artifacts", "with", "the", "given", "resource", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java#L358-L373
14,049
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java
KnowledgeBuilderImpl.addPackageFromXml
public void addPackageFromXml(final Reader reader) throws DroolsParserException, IOException { this.resource = new ReaderResource(reader, ResourceType.XDRL); final XmlPackageReader xmlReader = new XmlPackageReader(this.configuration.getSemanticModules()); xmlReader.getParser().setCla...
java
public void addPackageFromXml(final Reader reader) throws DroolsParserException, IOException { this.resource = new ReaderResource(reader, ResourceType.XDRL); final XmlPackageReader xmlReader = new XmlPackageReader(this.configuration.getSemanticModules()); xmlReader.getParser().setCla...
[ "public", "void", "addPackageFromXml", "(", "final", "Reader", "reader", ")", "throws", "DroolsParserException", ",", "IOException", "{", "this", ".", "resource", "=", "new", "ReaderResource", "(", "reader", ",", "ResourceType", ".", "XDRL", ")", ";", "final", ...
Load a rule package from XML source. @param reader @throws DroolsParserException @throws IOException
[ "Load", "a", "rule", "package", "from", "XML", "source", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java#L586-L601
14,050
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java
KnowledgeBuilderImpl.addPackageFromDrl
public void addPackageFromDrl(final Reader source, final Reader dsl) throws DroolsParserException, IOException { this.resource = new ReaderResource(source, ResourceType.DSLR); final DrlParser parser = new DrlParser(configuration.getLanguageLevel()); ...
java
public void addPackageFromDrl(final Reader source, final Reader dsl) throws DroolsParserException, IOException { this.resource = new ReaderResource(source, ResourceType.DSLR); final DrlParser parser = new DrlParser(configuration.getLanguageLevel()); ...
[ "public", "void", "addPackageFromDrl", "(", "final", "Reader", "source", ",", "final", "Reader", "dsl", ")", "throws", "DroolsParserException", ",", "IOException", "{", "this", ".", "resource", "=", "new", "ReaderResource", "(", "source", ",", "ResourceType", "....
Load a rule package from DRL source using the supplied DSL configuration. @param source The source of the rules. @param dsl The source of the domain specific language configuration. @throws DroolsParserException @throws IOException
[ "Load", "a", "rule", "package", "from", "DRL", "source", "using", "the", "supplied", "DSL", "configuration", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java#L638-L650
14,051
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java
KnowledgeBuilderImpl.inheritPackageAttributes
private void inheritPackageAttributes(Map<String, AttributeDescr> pkgAttributes, RuleDescr ruleDescr) { if (pkgAttributes == null) { return; } for (AttributeDescr attrDescr : pkgAttributes.values()) { ruleDescr.getAttributes().put...
java
private void inheritPackageAttributes(Map<String, AttributeDescr> pkgAttributes, RuleDescr ruleDescr) { if (pkgAttributes == null) { return; } for (AttributeDescr attrDescr : pkgAttributes.values()) { ruleDescr.getAttributes().put...
[ "private", "void", "inheritPackageAttributes", "(", "Map", "<", "String", ",", "AttributeDescr", ">", "pkgAttributes", ",", "RuleDescr", "ruleDescr", ")", "{", "if", "(", "pkgAttributes", "==", "null", ")", "{", "return", ";", "}", "for", "(", "AttributeDescr"...
Entity rules inherit package attributes
[ "Entity", "rules", "inherit", "package", "attributes" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/builder/impl/KnowledgeBuilderImpl.java#L2090-L2098
14,052
kiegroup/drools
drools-core/src/main/java/org/drools/core/management/DroolsManagementAgent.java
DroolsManagementAgent.getKnowledgeSessionBean
private GenericKieSessionMonitoringImpl getKnowledgeSessionBean(CBSKey cbsKey, KieRuntimeEventManager ksession) { if (mbeansRefs.get(cbsKey) != null) { return (GenericKieSessionMonitoringImpl) mbeansRefs.get(cbsKey); } else { if (ksession instanceof StatelessKnowledgeSession) { ...
java
private GenericKieSessionMonitoringImpl getKnowledgeSessionBean(CBSKey cbsKey, KieRuntimeEventManager ksession) { if (mbeansRefs.get(cbsKey) != null) { return (GenericKieSessionMonitoringImpl) mbeansRefs.get(cbsKey); } else { if (ksession instanceof StatelessKnowledgeSession) { ...
[ "private", "GenericKieSessionMonitoringImpl", "getKnowledgeSessionBean", "(", "CBSKey", "cbsKey", ",", "KieRuntimeEventManager", "ksession", ")", "{", "if", "(", "mbeansRefs", ".", "get", "(", "cbsKey", ")", "!=", "null", ")", "{", "return", "(", "GenericKieSessionM...
Get currently registered session monitor, eventually creating it if necessary. @return the currently registered or newly created session monitor, or null if unable to create and register it on the JMX server.
[ "Get", "currently", "registered", "session", "monitor", "eventually", "creating", "it", "if", "necessary", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/management/DroolsManagementAgent.java#L150-L188
14,053
kiegroup/drools
drools-core/src/main/java/org/drools/core/phreak/PhreakBranchNode.java
PhreakBranchNode.getBranchTuples
private BranchTuples getBranchTuples(LeftTupleSink sink, LeftTuple leftTuple) { BranchTuples branchTuples = new BranchTuples(); LeftTuple child = leftTuple.getFirstChild(); if ( child != null ) { // assigns the correct main or rtn LeftTuple based on the identified sink if...
java
private BranchTuples getBranchTuples(LeftTupleSink sink, LeftTuple leftTuple) { BranchTuples branchTuples = new BranchTuples(); LeftTuple child = leftTuple.getFirstChild(); if ( child != null ) { // assigns the correct main or rtn LeftTuple based on the identified sink if...
[ "private", "BranchTuples", "getBranchTuples", "(", "LeftTupleSink", "sink", ",", "LeftTuple", "leftTuple", ")", "{", "BranchTuples", "branchTuples", "=", "new", "BranchTuples", "(", ")", ";", "LeftTuple", "child", "=", "leftTuple", ".", "getFirstChild", "(", ")", ...
A branch has two potential sinks. rtnSink is for the sink if the contained logic returns true. mainSink is for propagations after the branch node, if they are allowed. it may have one or the other or both. there is no state that indicates whether one or the other or both are present, so all tuple children must be insp...
[ "A", "branch", "has", "two", "potential", "sinks", ".", "rtnSink", "is", "for", "the", "sink", "if", "the", "contained", "logic", "returns", "true", ".", "mainSink", "is", "for", "propagations", "after", "the", "branch", "node", "if", "they", "are", "allow...
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/phreak/PhreakBranchNode.java#L220-L240
14,054
kiegroup/drools
drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java
DefaultBeanClassBuilder.buildClassHeader
protected ClassWriter buildClassHeader(ClassLoader classLoader, ClassDefinition classDef) { boolean reactive = classDef.isReactive(); String[] original = classDef.getInterfaces(); int interfacesNr = original.length + (reactive ? 2 : 1); String[...
java
protected ClassWriter buildClassHeader(ClassLoader classLoader, ClassDefinition classDef) { boolean reactive = classDef.isReactive(); String[] original = classDef.getInterfaces(); int interfacesNr = original.length + (reactive ? 2 : 1); String[...
[ "protected", "ClassWriter", "buildClassHeader", "(", "ClassLoader", "classLoader", ",", "ClassDefinition", "classDef", ")", "{", "boolean", "reactive", "=", "classDef", ".", "isReactive", "(", ")", ";", "String", "[", "]", "original", "=", "classDef", ".", "getI...
Defines the class header for the given class definition
[ "Defines", "the", "class", "header", "for", "the", "given", "class", "definition" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java#L851-L884
14,055
kiegroup/drools
drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java
DefaultBeanClassBuilder.buildField
protected void buildField( ClassVisitor cw, FieldDefinition fieldDef) { FieldVisitor fv = cw.visitField( Opcodes.ACC_PROTECTED, fieldDef.getName(), BuildUtils.getTypeDescriptor( fieldDef.getTypeName(...
java
protected void buildField( ClassVisitor cw, FieldDefinition fieldDef) { FieldVisitor fv = cw.visitField( Opcodes.ACC_PROTECTED, fieldDef.getName(), BuildUtils.getTypeDescriptor( fieldDef.getTypeName(...
[ "protected", "void", "buildField", "(", "ClassVisitor", "cw", ",", "FieldDefinition", "fieldDef", ")", "{", "FieldVisitor", "fv", "=", "cw", ".", "visitField", "(", "Opcodes", ".", "ACC_PROTECTED", ",", "fieldDef", ".", "getName", "(", ")", ",", "BuildUtils", ...
Creates the field defined by the given FieldDefinition @param cw @param fieldDef
[ "Creates", "the", "field", "defined", "by", "the", "given", "FieldDefinition" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java#L894-L906
14,056
kiegroup/drools
drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java
DefaultBeanClassBuilder.buildDefaultConstructor
protected void buildDefaultConstructor(ClassVisitor cw, ClassDefinition classDef) { MethodVisitor mv = cw.visitMethod( Opcodes.ACC_PUBLIC, "<init>", Type.getMethodDescriptor( Type.VOID_TYPE, new Type[]{} ), ...
java
protected void buildDefaultConstructor(ClassVisitor cw, ClassDefinition classDef) { MethodVisitor mv = cw.visitMethod( Opcodes.ACC_PUBLIC, "<init>", Type.getMethodDescriptor( Type.VOID_TYPE, new Type[]{} ), ...
[ "protected", "void", "buildDefaultConstructor", "(", "ClassVisitor", "cw", ",", "ClassDefinition", "classDef", ")", "{", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "Opcodes", ".", "ACC_PUBLIC", ",", "\"<init>\"", ",", "Type", ".", "getMethodDescrip...
Creates a default constructor for the class @param cw
[ "Creates", "a", "default", "constructor", "for", "the", "class" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java#L915-L950
14,057
kiegroup/drools
drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java
DefaultBeanClassBuilder.initializeDynamicTypeStructures
protected void initializeDynamicTypeStructures( MethodVisitor mv, ClassDefinition classDef) { if ( classDef.isFullTraiting() ) { mv.visitVarInsn( ALOAD, 0 ); mv.visitTypeInsn( NEW, Type.getInternalName( TraitFieldTMSImpl.class ) ); mv.visitInsn( DUP ); mv.visitMe...
java
protected void initializeDynamicTypeStructures( MethodVisitor mv, ClassDefinition classDef) { if ( classDef.isFullTraiting() ) { mv.visitVarInsn( ALOAD, 0 ); mv.visitTypeInsn( NEW, Type.getInternalName( TraitFieldTMSImpl.class ) ); mv.visitInsn( DUP ); mv.visitMe...
[ "protected", "void", "initializeDynamicTypeStructures", "(", "MethodVisitor", "mv", ",", "ClassDefinition", "classDef", ")", "{", "if", "(", "classDef", ".", "isFullTraiting", "(", ")", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "...
Initializes the trait map and dynamic property map to empty values @param mv @param classDef
[ "Initializes", "the", "trait", "map", "and", "dynamic", "property", "map", "to", "empty", "values" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java#L1058-L1101
14,058
kiegroup/drools
drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java
DefaultBeanClassBuilder.buildConstructorWithFields
protected void buildConstructorWithFields(ClassVisitor cw, ClassDefinition classDef, Collection<FieldDefinition> fieldDefs) { Type[] params = new Type[fieldDefs.size()]; int index = 0; for ( FieldDefini...
java
protected void buildConstructorWithFields(ClassVisitor cw, ClassDefinition classDef, Collection<FieldDefinition> fieldDefs) { Type[] params = new Type[fieldDefs.size()]; int index = 0; for ( FieldDefini...
[ "protected", "void", "buildConstructorWithFields", "(", "ClassVisitor", "cw", ",", "ClassDefinition", "classDef", ",", "Collection", "<", "FieldDefinition", ">", "fieldDefs", ")", "{", "Type", "[", "]", "params", "=", "new", "Type", "[", "fieldDefs", ".", "size"...
Creates a constructor that takes and assigns values to all fields in the order they are declared. @param cw @param classDef
[ "Creates", "a", "constructor", "that", "takes", "and", "assigns", "values", "to", "all", "fields", "in", "the", "order", "they", "are", "declared", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java#L1110-L1162
14,059
kiegroup/drools
drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java
DefaultBeanClassBuilder.buildGetMethod
protected void buildGetMethod(ClassVisitor cw, ClassDefinition classDef, FieldDefinition fieldDef) { MethodVisitor mv; // Get method { mv = cw.visitMethod( Opcodes.ACC_PUBLIC, fieldDef.getReadMeth...
java
protected void buildGetMethod(ClassVisitor cw, ClassDefinition classDef, FieldDefinition fieldDef) { MethodVisitor mv; // Get method { mv = cw.visitMethod( Opcodes.ACC_PUBLIC, fieldDef.getReadMeth...
[ "protected", "void", "buildGetMethod", "(", "ClassVisitor", "cw", ",", "ClassDefinition", "classDef", ",", "FieldDefinition", "fieldDef", ")", "{", "MethodVisitor", "mv", ";", "// Get method", "{", "mv", "=", "cw", ".", "visitMethod", "(", "Opcodes", ".", "ACC_P...
Creates the get method for the given field definition @param cw @param classDef @param fieldDef
[ "Creates", "the", "get", "method", "for", "the", "given", "field", "definition" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java#L1307-L1358
14,060
kiegroup/drools
drools-core/src/main/java/org/drools/core/xml/ExtensibleXmlParser.java
ExtensibleXmlParser.startElementBuilder
public void startElementBuilder(final String tagName, final Attributes attrs) { this.attrs = attrs; this.characters = new StringBuilder(); final Element element = this.document.createElement( tagName ); //final DefaultConfiguration config = new Def...
java
public void startElementBuilder(final String tagName, final Attributes attrs) { this.attrs = attrs; this.characters = new StringBuilder(); final Element element = this.document.createElement( tagName ); //final DefaultConfiguration config = new Def...
[ "public", "void", "startElementBuilder", "(", "final", "String", "tagName", ",", "final", "Attributes", "attrs", ")", "{", "this", ".", "attrs", "=", "attrs", ";", "this", ".", "characters", "=", "new", "StringBuilder", "(", ")", ";", "final", "Element", "...
Start a configuration node. @param tagName Tag name. @param attrs Tag attributes.
[ "Start", "a", "configuration", "node", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/xml/ExtensibleXmlParser.java#L532-L556
14,061
kiegroup/drools
drools-core/src/main/java/org/drools/core/xml/ExtensibleXmlParser.java
ExtensibleXmlParser.endElementBuilder
public Element endElementBuilder() { final Element element = (Element) this.configurationStack.removeLast(); if ( this.characters != null ) { element.appendChild( this.document.createTextNode( this.characters.toString() ) ); } this.characters = null; return element;...
java
public Element endElementBuilder() { final Element element = (Element) this.configurationStack.removeLast(); if ( this.characters != null ) { element.appendChild( this.document.createTextNode( this.characters.toString() ) ); } this.characters = null; return element;...
[ "public", "Element", "endElementBuilder", "(", ")", "{", "final", "Element", "element", "=", "(", "Element", ")", "this", ".", "configurationStack", ".", "removeLast", "(", ")", ";", "if", "(", "this", ".", "characters", "!=", "null", ")", "{", "element", ...
End a configuration node. @return The configuration.
[ "End", "a", "configuration", "node", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/xml/ExtensibleXmlParser.java#L589-L598
14,062
kiegroup/drools
drools-core/src/main/java/org/drools/core/xml/ExtensibleXmlParser.java
ExtensibleXmlParser.initEntityResolver
private void initEntityResolver() { final String entityResolveClazzName = System.getProperty( ExtensibleXmlParser.ENTITY_RESOLVER_PROPERTY_NAME ); if ( entityResolveClazzName != null && entityResolveClazzName.length() > 0 ) { try { final Class entityResolverClazz = classLoad...
java
private void initEntityResolver() { final String entityResolveClazzName = System.getProperty( ExtensibleXmlParser.ENTITY_RESOLVER_PROPERTY_NAME ); if ( entityResolveClazzName != null && entityResolveClazzName.length() > 0 ) { try { final Class entityResolverClazz = classLoad...
[ "private", "void", "initEntityResolver", "(", ")", "{", "final", "String", "entityResolveClazzName", "=", "System", ".", "getProperty", "(", "ExtensibleXmlParser", ".", "ENTITY_RESOLVER_PROPERTY_NAME", ")", ";", "if", "(", "entityResolveClazzName", "!=", "null", "&&",...
Initializes EntityResolver that is configured via system property ENTITY_RESOLVER_PROPERTY_NAME.
[ "Initializes", "EntityResolver", "that", "is", "configured", "via", "system", "property", "ENTITY_RESOLVER_PROPERTY_NAME", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/xml/ExtensibleXmlParser.java#L767-L777
14,063
kiegroup/drools
drools-core/src/main/java/org/drools/core/definitions/ProcessPackage.java
ProcessPackage.getOrCreate
public static ProcessPackage getOrCreate(ResourceTypePackageRegistry rtps) { ProcessPackage rtp = (ProcessPackage) rtps.get(ResourceType.BPMN2); if (rtp == null) { rtp = new ProcessPackage(); // register the same instance for all types. There is no distinction rtps.pu...
java
public static ProcessPackage getOrCreate(ResourceTypePackageRegistry rtps) { ProcessPackage rtp = (ProcessPackage) rtps.get(ResourceType.BPMN2); if (rtp == null) { rtp = new ProcessPackage(); // register the same instance for all types. There is no distinction rtps.pu...
[ "public", "static", "ProcessPackage", "getOrCreate", "(", "ResourceTypePackageRegistry", "rtps", ")", "{", "ProcessPackage", "rtp", "=", "(", "ProcessPackage", ")", "rtps", ".", "get", "(", "ResourceType", ".", "BPMN2", ")", ";", "if", "(", "rtp", "==", "null"...
Finds or creates and registers a package in the given registry instance @return the package that has been found
[ "Finds", "or", "creates", "and", "registers", "a", "package", "in", "the", "given", "registry", "instance" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/definitions/ProcessPackage.java#L37-L47
14,064
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/lang/descr/ForallDescr.java
ForallDescr.getBasePattern
public PatternDescr getBasePattern() { if ( this.patterns.size() > 1 ) { return (PatternDescr) this.patterns.get( 0 ); } else if ( this.patterns.size() == 1 ) { // in case there is only one pattern, we do a rewrite, so: // forall( Cheese( type == "stilton" ) ) ...
java
public PatternDescr getBasePattern() { if ( this.patterns.size() > 1 ) { return (PatternDescr) this.patterns.get( 0 ); } else if ( this.patterns.size() == 1 ) { // in case there is only one pattern, we do a rewrite, so: // forall( Cheese( type == "stilton" ) ) ...
[ "public", "PatternDescr", "getBasePattern", "(", ")", "{", "if", "(", "this", ".", "patterns", ".", "size", "(", ")", ">", "1", ")", "{", "return", "(", "PatternDescr", ")", "this", ".", "patterns", ".", "get", "(", "0", ")", ";", "}", "else", "if"...
Returns the base pattern from the forall CE @return
[ "Returns", "the", "base", "pattern", "from", "the", "forall", "CE" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/lang/descr/ForallDescr.java#L61-L77
14,065
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/lang/descr/ForallDescr.java
ForallDescr.getRemainingPatterns
public List<BaseDescr> getRemainingPatterns() { if ( this.patterns.size() > 1 ) { return this.patterns.subList( 1, this.patterns.size() ); } else if ( this.patterns.size() == 1 ) { // in case there is only one pattern, we do a rewrite, so...
java
public List<BaseDescr> getRemainingPatterns() { if ( this.patterns.size() > 1 ) { return this.patterns.subList( 1, this.patterns.size() ); } else if ( this.patterns.size() == 1 ) { // in case there is only one pattern, we do a rewrite, so...
[ "public", "List", "<", "BaseDescr", ">", "getRemainingPatterns", "(", ")", "{", "if", "(", "this", ".", "patterns", ".", "size", "(", ")", ">", "1", ")", "{", "return", "this", ".", "patterns", ".", "subList", "(", "1", ",", "this", ".", "patterns", ...
Returns the remaining patterns from the forall CE @return
[ "Returns", "the", "remaining", "patterns", "from", "the", "forall", "CE" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/lang/descr/ForallDescr.java#L83-L99
14,066
kiegroup/drools
drools-core/src/main/java/org/drools/core/rule/Forall.java
Forall.getInnerDeclarations
public Map<String, Declaration> getInnerDeclarations() { final Map inner = new HashMap( this.basePattern.getOuterDeclarations() ); for ( Pattern pattern : remainingPatterns ) { inner.putAll( pattern.getOuterDeclarations() ); } return inner; }
java
public Map<String, Declaration> getInnerDeclarations() { final Map inner = new HashMap( this.basePattern.getOuterDeclarations() ); for ( Pattern pattern : remainingPatterns ) { inner.putAll( pattern.getOuterDeclarations() ); } return inner; }
[ "public", "Map", "<", "String", ",", "Declaration", ">", "getInnerDeclarations", "(", ")", "{", "final", "Map", "inner", "=", "new", "HashMap", "(", "this", ".", "basePattern", ".", "getOuterDeclarations", "(", ")", ")", ";", "for", "(", "Pattern", "patter...
Forall inner declarations are only provided by the base patterns since it negates the remaining patterns
[ "Forall", "inner", "declarations", "are", "only", "provided", "by", "the", "base", "patterns", "since", "it", "negates", "the", "remaining", "patterns" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/rule/Forall.java#L85-L91
14,067
kiegroup/drools
drools-core/src/main/java/org/drools/core/definitions/impl/KnowledgePackageImpl.java
KnowledgePackageImpl.addProcess
public void addProcess(Process process) { ResourceTypePackageRegistry rtps = getResourceTypePackages(); ProcessPackage rtp = ProcessPackage.getOrCreate(rtps); rtp.add(process); }
java
public void addProcess(Process process) { ResourceTypePackageRegistry rtps = getResourceTypePackages(); ProcessPackage rtp = ProcessPackage.getOrCreate(rtps); rtp.add(process); }
[ "public", "void", "addProcess", "(", "Process", "process", ")", "{", "ResourceTypePackageRegistry", "rtps", "=", "getResourceTypePackages", "(", ")", ";", "ProcessPackage", "rtp", "=", "ProcessPackage", ".", "getOrCreate", "(", "rtps", ")", ";", "rtp", ".", "add...
Add a rule flow to this package.
[ "Add", "a", "rule", "flow", "to", "this", "package", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/definitions/impl/KnowledgePackageImpl.java#L484-L488
14,068
kiegroup/drools
drools-core/src/main/java/org/drools/core/definitions/impl/KnowledgePackageImpl.java
KnowledgePackageImpl.getRuleFlows
public Map<String, Process> getRuleFlows() { ProcessPackage rtp = (ProcessPackage) getResourceTypePackages().get(ResourceType.BPMN2); return rtp == null? Collections.emptyMap() : rtp.getRuleFlows(); }
java
public Map<String, Process> getRuleFlows() { ProcessPackage rtp = (ProcessPackage) getResourceTypePackages().get(ResourceType.BPMN2); return rtp == null? Collections.emptyMap() : rtp.getRuleFlows(); }
[ "public", "Map", "<", "String", ",", "Process", ">", "getRuleFlows", "(", ")", "{", "ProcessPackage", "rtp", "=", "(", "ProcessPackage", ")", "getResourceTypePackages", "(", ")", ".", "get", "(", "ResourceType", ".", "BPMN2", ")", ";", "return", "rtp", "==...
Get the rule flows for this package. The key is the ruleflow id. It will be Collections.EMPTY_MAP if none have been added.
[ "Get", "the", "rule", "flows", "for", "this", "package", ".", "The", "key", "is", "the", "ruleflow", "id", ".", "It", "will", "be", "Collections", ".", "EMPTY_MAP", "if", "none", "have", "been", "added", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/definitions/impl/KnowledgePackageImpl.java#L494-L497
14,069
kiegroup/drools
drools-core/src/main/java/org/drools/core/definitions/impl/KnowledgePackageImpl.java
KnowledgePackageImpl.removeRuleFlow
public void removeRuleFlow(String id) { ProcessPackage rtp = (ProcessPackage) getResourceTypePackages().get(ResourceType.BPMN2); if (rtp == null || rtp.lookup(id) == null) { throw new IllegalArgumentException("The rule flow with id [" + id + "] is not part of this package."); } ...
java
public void removeRuleFlow(String id) { ProcessPackage rtp = (ProcessPackage) getResourceTypePackages().get(ResourceType.BPMN2); if (rtp == null || rtp.lookup(id) == null) { throw new IllegalArgumentException("The rule flow with id [" + id + "] is not part of this package."); } ...
[ "public", "void", "removeRuleFlow", "(", "String", "id", ")", "{", "ProcessPackage", "rtp", "=", "(", "ProcessPackage", ")", "getResourceTypePackages", "(", ")", ".", "get", "(", "ResourceType", ".", "BPMN2", ")", ";", "if", "(", "rtp", "==", "null", "||",...
Rule flows can be removed by ID.
[ "Rule", "flows", "can", "be", "removed", "by", "ID", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/definitions/impl/KnowledgePackageImpl.java#L502-L508
14,070
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java
DefaultExpander.addDSLMapping
public void addDSLMapping(final DSLMapping mapping) { for ( DSLMappingEntry entry : mapping.getEntries() ) { if ( DSLMappingEntry.KEYWORD.equals( entry.getSection() ) ) { this.keywords.add( entry ); } else if ( DSLMappingEntry.CONDITION.equals( entry.getSection() ) ) { ...
java
public void addDSLMapping(final DSLMapping mapping) { for ( DSLMappingEntry entry : mapping.getEntries() ) { if ( DSLMappingEntry.KEYWORD.equals( entry.getSection() ) ) { this.keywords.add( entry ); } else if ( DSLMappingEntry.CONDITION.equals( entry.getSection() ) ) { ...
[ "public", "void", "addDSLMapping", "(", "final", "DSLMapping", "mapping", ")", "{", "for", "(", "DSLMappingEntry", "entry", ":", "mapping", ".", "getEntries", "(", ")", ")", "{", "if", "(", "DSLMappingEntry", ".", "KEYWORD", ".", "equals", "(", "entry", "....
Add the new mapping to this expander. @param mapping
[ "Add", "the", "new", "mapping", "to", "this", "expander", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java#L117-L138
14,071
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java
DefaultExpander.expandConstructions
private StringBuffer expandConstructions(final String drl) { // display keys if requested if ( showKeyword ) { for ( DSLMappingEntry entry : this.keywords ) { logger.info( "keyword: " + entry.getMappingKey() ); logger.info( " " + entry.getKeyPattern() ...
java
private StringBuffer expandConstructions(final String drl) { // display keys if requested if ( showKeyword ) { for ( DSLMappingEntry entry : this.keywords ) { logger.info( "keyword: " + entry.getMappingKey() ); logger.info( " " + entry.getKeyPattern() ...
[ "private", "StringBuffer", "expandConstructions", "(", "final", "String", "drl", ")", "{", "// display keys if requested", "if", "(", "showKeyword", ")", "{", "for", "(", "DSLMappingEntry", "entry", ":", "this", ".", "keywords", ")", "{", "logger", ".", "info", ...
Expand constructions like rules and queries @param drl @return
[ "Expand", "constructions", "like", "rules", "and", "queries" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java#L230-L304
14,072
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java
DefaultExpander.cleanupExpressions
private String cleanupExpressions(String drl) { // execute cleanup for ( final DSLMappingEntry entry : this.cleanup ) { drl = entry.getKeyPattern().matcher( drl ).replaceAll( entry.getValuePattern() ); } return drl; }
java
private String cleanupExpressions(String drl) { // execute cleanup for ( final DSLMappingEntry entry : this.cleanup ) { drl = entry.getKeyPattern().matcher( drl ).replaceAll( entry.getValuePattern() ); } return drl; }
[ "private", "String", "cleanupExpressions", "(", "String", "drl", ")", "{", "// execute cleanup", "for", "(", "final", "DSLMappingEntry", "entry", ":", "this", ".", "cleanup", ")", "{", "drl", "=", "entry", ".", "getKeyPattern", "(", ")", ".", "matcher", "(",...
Clean up constructions that exists only in the unexpanded code @param drl @return
[ "Clean", "up", "constructions", "that", "exists", "only", "in", "the", "unexpanded", "code" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java#L312-L318
14,073
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java
DefaultExpander.expandKeywords
private String expandKeywords(String drl) { substitutions = new ArrayList<Map<String, String>>(); // apply all keywords templates drl = substitute( drl, this.keywords, 0, useKeyword, false ); ...
java
private String expandKeywords(String drl) { substitutions = new ArrayList<Map<String, String>>(); // apply all keywords templates drl = substitute( drl, this.keywords, 0, useKeyword, false ); ...
[ "private", "String", "expandKeywords", "(", "String", "drl", ")", "{", "substitutions", "=", "new", "ArrayList", "<", "Map", "<", "String", ",", "String", ">", ">", "(", ")", ";", "// apply all keywords templates", "drl", "=", "substitute", "(", "drl", ",", ...
Expand all configured keywords @param drl @return
[ "Expand", "all", "configured", "keywords" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java#L338-L348
14,074
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java
DefaultExpander.expandLHS
private String expandLHS(final String lhs, int lineOffset) { substitutions = new ArrayList<Map<String, String>>(); // logger.info( "*** LHS>" + lhs + "<" ); final StringBuilder buf = new StringBuilder(); final String[] lines = lhs.split( (lhs...
java
private String expandLHS(final String lhs, int lineOffset) { substitutions = new ArrayList<Map<String, String>>(); // logger.info( "*** LHS>" + lhs + "<" ); final StringBuilder buf = new StringBuilder(); final String[] lines = lhs.split( (lhs...
[ "private", "String", "expandLHS", "(", "final", "String", "lhs", ",", "int", "lineOffset", ")", "{", "substitutions", "=", "new", "ArrayList", "<", "Map", "<", "String", ",", "String", ">", ">", "(", ")", ";", "// logger.info( \"*** LHS>\" + lhs + \"<\" )...
Expand LHS for a construction @param lhs @param lineOffset @return
[ "Expand", "LHS", "for", "a", "construction" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java#L541-L607
14,075
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java
DefaultExpander.loadDrlFile
private String loadDrlFile(final Reader drl) throws IOException { final StringBuilder buf = new StringBuilder(); final BufferedReader input = new BufferedReader( drl ); String line; while ( (line = input.readLine()) != null ) { buf.append( line ); buf.append( nl )...
java
private String loadDrlFile(final Reader drl) throws IOException { final StringBuilder buf = new StringBuilder(); final BufferedReader input = new BufferedReader( drl ); String line; while ( (line = input.readLine()) != null ) { buf.append( line ); buf.append( nl )...
[ "private", "String", "loadDrlFile", "(", "final", "Reader", "drl", ")", "throws", "IOException", "{", "final", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "final", "BufferedReader", "input", "=", "new", "BufferedReader", "(", "drl", ")"...
Reads the stream into a String
[ "Reads", "the", "stream", "into", "a", "String" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/lang/dsl/DefaultExpander.java#L695-L704
14,076
kiegroup/drools
drools-core/src/main/java/org/drools/core/common/DefaultAgenda.java
DefaultAgenda.addItemToActivationGroup
public void addItemToActivationGroup(final AgendaItem item) { if ( item.isRuleAgendaItem() ) { throw new UnsupportedOperationException("defensive programming, making sure this isn't called, before removing"); } String group = item.getRule().getActivationGroup(); if ( group !=...
java
public void addItemToActivationGroup(final AgendaItem item) { if ( item.isRuleAgendaItem() ) { throw new UnsupportedOperationException("defensive programming, making sure this isn't called, before removing"); } String group = item.getRule().getActivationGroup(); if ( group !=...
[ "public", "void", "addItemToActivationGroup", "(", "final", "AgendaItem", "item", ")", "{", "if", "(", "item", ".", "isRuleAgendaItem", "(", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"defensive programming, making sure this isn't called, befor...
If the item belongs to an activation group, add it @param item
[ "If", "the", "item", "belongs", "to", "an", "activation", "group", "add", "it" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/common/DefaultAgenda.java#L319-L335
14,077
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/lang/DRL6Lexer.java
DRL6Lexer.emit
public Token emit() { Token t = new DroolsToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); emit(t); return t; ...
java
public Token emit() { Token t = new DroolsToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); emit(t); return t; ...
[ "public", "Token", "emit", "(", ")", "{", "Token", "t", "=", "new", "DroolsToken", "(", "input", ",", "state", ".", "type", ",", "state", ".", "channel", ",", "state", ".", "tokenStartCharIndex", ",", "getCharIndex", "(", ")", "-", "1", ")", ";", "t"...
The standard method called to automatically emit a token at the outermost lexical rule. The token object should point into the char buffer start..stop. If there is a text override in 'text', use that to set the token's text. Override this method to emit custom Token objects.
[ "The", "standard", "method", "called", "to", "automatically", "emit", "a", "token", "at", "the", "outermost", "lexical", "rule", ".", "The", "token", "object", "should", "point", "into", "the", "char", "buffer", "start", "..", "stop", ".", "If", "there", "...
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/lang/DRL6Lexer.java#L99-L106
14,078
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/reteoo/compiled/ObjectTypeNodeCompiler.java
ObjectTypeNodeCompiler.createClassDeclaration
private void createClassDeclaration() { builder.append("package ").append(PACKAGE_NAME).append(";").append(NEWLINE); builder.append("public class ").append(generatedClassSimpleName).append(" extends "). append(CompiledNetwork.class.getName()).append("{ ").append(NEWLINE); builde...
java
private void createClassDeclaration() { builder.append("package ").append(PACKAGE_NAME).append(";").append(NEWLINE); builder.append("public class ").append(generatedClassSimpleName).append(" extends "). append(CompiledNetwork.class.getName()).append("{ ").append(NEWLINE); builde...
[ "private", "void", "createClassDeclaration", "(", ")", "{", "builder", ".", "append", "(", "\"package \"", ")", ".", "append", "(", "PACKAGE_NAME", ")", ".", "append", "(", "\";\"", ")", ".", "append", "(", "NEWLINE", ")", ";", "builder", ".", "append", ...
This method will output the package statement, followed by the opening of the class declaration
[ "This", "method", "will", "output", "the", "package", "statement", "followed", "by", "the", "opening", "of", "the", "class", "declaration" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/reteoo/compiled/ObjectTypeNodeCompiler.java#L137-L143
14,079
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/reteoo/compiled/ObjectTypeNodeCompiler.java
ObjectTypeNodeCompiler.createConstructor
private void createConstructor(Collection<HashedAlphasDeclaration> hashedAlphaDeclarations) { builder.append("public ").append(generatedClassSimpleName).append("(org.drools.core.spi.InternalReadAccessor readAccessor) {").append(NEWLINE); builder.append("this.readAccessor = readAccessor;\n"); /...
java
private void createConstructor(Collection<HashedAlphasDeclaration> hashedAlphaDeclarations) { builder.append("public ").append(generatedClassSimpleName).append("(org.drools.core.spi.InternalReadAccessor readAccessor) {").append(NEWLINE); builder.append("this.readAccessor = readAccessor;\n"); /...
[ "private", "void", "createConstructor", "(", "Collection", "<", "HashedAlphasDeclaration", ">", "hashedAlphaDeclarations", ")", "{", "builder", ".", "append", "(", "\"public \"", ")", ".", "append", "(", "generatedClassSimpleName", ")", ".", "append", "(", "\"(org.d...
Creates the constructor for the generated class. If the hashedAlphaDeclarations is empty, it will just output a empty default constructor; if it is not, the constructor will contain code to fill the hash alpha maps with the values and node ids. @param hashedAlphaDeclarations declarations used for creating statements t...
[ "Creates", "the", "constructor", "for", "the", "generated", "class", ".", "If", "the", "hashedAlphaDeclarations", "is", "empty", "it", "will", "just", "output", "a", "empty", "default", "constructor", ";", "if", "it", "is", "not", "the", "constructor", "will",...
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/reteoo/compiled/ObjectTypeNodeCompiler.java#L153-L192
14,080
kiegroup/drools
drools-workbench-models/drools-workbench-models-datamodel-api/src/main/java/org/drools/workbench/models/datamodel/auditlog/DefaultAuditLogFilter.java
DefaultAuditLogFilter.accept
@Override public boolean accept( final AuditLogEntry entry ) { if ( !acceptedTypes.containsKey( entry.getGenericType() ) ) { return false; } return acceptedTypes.get( entry.getGenericType() ); }
java
@Override public boolean accept( final AuditLogEntry entry ) { if ( !acceptedTypes.containsKey( entry.getGenericType() ) ) { return false; } return acceptedTypes.get( entry.getGenericType() ); }
[ "@", "Override", "public", "boolean", "accept", "(", "final", "AuditLogEntry", "entry", ")", "{", "if", "(", "!", "acceptedTypes", ".", "containsKey", "(", "entry", ".", "getGenericType", "(", ")", ")", ")", "{", "return", "false", ";", "}", "return", "a...
This is the filtering method. When an AuditLogEntry is added to an AuditLog the AuditLog calls this method to determine whether the AuditLogEntry should be added. @param entry @return true if the AuditLogEntry should be added to the AuditLog
[ "This", "is", "the", "filtering", "method", ".", "When", "an", "AuditLogEntry", "is", "added", "to", "an", "AuditLog", "the", "AuditLog", "calls", "this", "method", "to", "determine", "whether", "the", "AuditLogEntry", "should", "be", "added", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-workbench-models/drools-workbench-models-datamodel-api/src/main/java/org/drools/workbench/models/datamodel/auditlog/DefaultAuditLogFilter.java#L47-L53
14,081
kiegroup/drools
drools-core/src/main/java/org/drools/core/base/mvel/MVELDebugHandler.java
MVELDebugHandler.onBreak
private final static int onBreak(Frame frame) { // We always fall back to Debugger.CONTINUE after each onBreak to avoid eternal step-over flag //int oldReturn = onBreakReturn; //onBreakReturn = Debugger.CONTINUE; //return oldReturn; if (verbose) { logger.info("Continu...
java
private final static int onBreak(Frame frame) { // We always fall back to Debugger.CONTINUE after each onBreak to avoid eternal step-over flag //int oldReturn = onBreakReturn; //onBreakReturn = Debugger.CONTINUE; //return oldReturn; if (verbose) { logger.info("Continu...
[ "private", "final", "static", "int", "onBreak", "(", "Frame", "frame", ")", "{", "// We always fall back to Debugger.CONTINUE after each onBreak to avoid eternal step-over flag", "//int oldReturn = onBreakReturn;", "//onBreakReturn = Debugger.CONTINUE;", "//return oldReturn;", "if", "(...
This is catched by the remote debugger @param frame
[ "This", "is", "catched", "by", "the", "remote", "debugger" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/base/mvel/MVELDebugHandler.java#L55-L64
14,082
kiegroup/drools
drools-workbench-models/drools-workbench-models-datamodel-api/src/main/java/org/drools/workbench/models/datamodel/rule/FactPattern.java
FactPattern.addConstraint
public void addConstraint( final FieldConstraint constraint ) { if ( constraintList == null ) { constraintList = new CompositeFieldConstraint(); } this.constraintList.addConstraint( constraint ); }
java
public void addConstraint( final FieldConstraint constraint ) { if ( constraintList == null ) { constraintList = new CompositeFieldConstraint(); } this.constraintList.addConstraint( constraint ); }
[ "public", "void", "addConstraint", "(", "final", "FieldConstraint", "constraint", ")", "{", "if", "(", "constraintList", "==", "null", ")", "{", "constraintList", "=", "new", "CompositeFieldConstraint", "(", ")", ";", "}", "this", ".", "constraintList", ".", "...
This will add a top level constraint.
[ "This", "will", "add", "a", "top", "level", "constraint", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-workbench-models/drools-workbench-models-datamodel-api/src/main/java/org/drools/workbench/models/datamodel/rule/FactPattern.java#L66-L71
14,083
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationFactory.java
TypeDeclarationFactory.mergeTypeDeclarations
protected void mergeTypeDeclarations(TypeDeclaration oldDeclaration, TypeDeclaration newDeclaration) { if (oldDeclaration == null) { return; } //add the missing fields (if any) to newDeclaration for (FieldDefinition oldFactField : oldDe...
java
protected void mergeTypeDeclarations(TypeDeclaration oldDeclaration, TypeDeclaration newDeclaration) { if (oldDeclaration == null) { return; } //add the missing fields (if any) to newDeclaration for (FieldDefinition oldFactField : oldDe...
[ "protected", "void", "mergeTypeDeclarations", "(", "TypeDeclaration", "oldDeclaration", ",", "TypeDeclaration", "newDeclaration", ")", "{", "if", "(", "oldDeclaration", "==", "null", ")", "{", "return", ";", "}", "//add the missing fields (if any) to newDeclaration", "for...
Merges all the missing FactFields from oldDefinition into newDeclaration.
[ "Merges", "all", "the", "missing", "FactFields", "from", "oldDefinition", "into", "newDeclaration", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationFactory.java#L191-L207
14,084
kiegroup/drools
drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java
KnowledgeBaseImpl.populateGlobalsMap
private void populateGlobalsMap(Map<String, String> globs) throws ClassNotFoundException { this.globals = new HashMap<String, Class<?>>(); for (Map.Entry<String, String> entry : globs.entrySet()) { addGlobal( entry.getKey(), this.rootClassLoader.loadClass( entry.getVal...
java
private void populateGlobalsMap(Map<String, String> globs) throws ClassNotFoundException { this.globals = new HashMap<String, Class<?>>(); for (Map.Entry<String, String> entry : globs.entrySet()) { addGlobal( entry.getKey(), this.rootClassLoader.loadClass( entry.getVal...
[ "private", "void", "populateGlobalsMap", "(", "Map", "<", "String", ",", "String", ">", "globs", ")", "throws", "ClassNotFoundException", "{", "this", ".", "globals", "=", "new", "HashMap", "<", "String", ",", "Class", "<", "?", ">", ">", "(", ")", ";", ...
globals class types must be re-wired after serialization @throws ClassNotFoundException
[ "globals", "class", "types", "must", "be", "re", "-", "wired", "after", "serialization" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java#L588-L594
14,085
kiegroup/drools
drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java
KnowledgeBaseImpl.populateTypeDeclarationMaps
private void populateTypeDeclarationMaps() throws ClassNotFoundException { for (InternalKnowledgePackage pkg : this.pkgs.values()) { for (TypeDeclaration type : pkg.getTypeDeclarations().values()) { type.setTypeClass(this.rootClassLoader.loadClass(type.getTypeClassName())); ...
java
private void populateTypeDeclarationMaps() throws ClassNotFoundException { for (InternalKnowledgePackage pkg : this.pkgs.values()) { for (TypeDeclaration type : pkg.getTypeDeclarations().values()) { type.setTypeClass(this.rootClassLoader.loadClass(type.getTypeClassName())); ...
[ "private", "void", "populateTypeDeclarationMaps", "(", ")", "throws", "ClassNotFoundException", "{", "for", "(", "InternalKnowledgePackage", "pkg", ":", "this", ".", "pkgs", ".", "values", "(", ")", ")", "{", "for", "(", "TypeDeclaration", "type", ":", "pkg", ...
type classes must be re-wired after serialization @throws ClassNotFoundException
[ "type", "classes", "must", "be", "re", "-", "wired", "after", "serialization" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java#L601-L609
14,086
kiegroup/drools
drools-core/src/main/java/org/drools/core/rule/JavaDialectRuntimeData.java
JavaDialectRuntimeData.reload
public void reload() { // drops the classLoader and adds a new one this.classLoader = makeClassLoader(); // Wire up invokers try { for (Entry<String, Wireable> entry : invokerLookups.entrySet()) { wire( classLoader, entry.getKey(), entry.getValue(), true ); ...
java
public void reload() { // drops the classLoader and adds a new one this.classLoader = makeClassLoader(); // Wire up invokers try { for (Entry<String, Wireable> entry : invokerLookups.entrySet()) { wire( classLoader, entry.getKey(), entry.getValue(), true ); ...
[ "public", "void", "reload", "(", ")", "{", "// drops the classLoader and adds a new one", "this", ".", "classLoader", "=", "makeClassLoader", "(", ")", ";", "// Wire up invokers", "try", "{", "for", "(", "Entry", "<", "String", ",", "Wireable", ">", "entry", ":"...
This class drops the classLoader and reloads it. During this process it must re-wire all the invokeables.
[ "This", "class", "drops", "the", "classLoader", "and", "reloads", "it", ".", "During", "this", "process", "it", "must", "re", "-", "wire", "all", "the", "invokeables", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/rule/JavaDialectRuntimeData.java#L482-L502
14,087
kiegroup/drools
drools-core/src/main/java/org/drools/core/impl/StatefulKnowledgeSessionImpl.java
StatefulKnowledgeSessionImpl.fireUntilHalt
public void fireUntilHalt(final AgendaFilter agendaFilter) { if ( isSequential() ) { throw new IllegalStateException( "fireUntilHalt() can not be called in sequential mode." ); } try { startOperation(); agenda.fireUntilHalt( agendaFilter ); } finally ...
java
public void fireUntilHalt(final AgendaFilter agendaFilter) { if ( isSequential() ) { throw new IllegalStateException( "fireUntilHalt() can not be called in sequential mode." ); } try { startOperation(); agenda.fireUntilHalt( agendaFilter ); } finally ...
[ "public", "void", "fireUntilHalt", "(", "final", "AgendaFilter", "agendaFilter", ")", "{", "if", "(", "isSequential", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"fireUntilHalt() can not be called in sequential mode.\"", ")", ";", "}", "try", ...
Keeps firing activations until a halt is called. If in a given moment, there is no activation to fire, it will wait for an activation to be added to an active agenda group or rule flow group. @param agendaFilter filters the activations that may fire @throws IllegalStateException if this method is called when running ...
[ "Keeps", "firing", "activations", "until", "a", "halt", "is", "called", ".", "If", "in", "a", "given", "moment", "there", "is", "no", "activation", "to", "fire", "it", "will", "wait", "for", "an", "activation", "to", "be", "added", "to", "an", "active", ...
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/impl/StatefulKnowledgeSessionImpl.java#L1362-L1373
14,088
kiegroup/drools
drools-core/src/main/java/org/drools/core/impl/StatefulKnowledgeSessionImpl.java
StatefulKnowledgeSessionImpl.endOperation
public void endOperation() { if (this.opCounter.decrementAndGet() == 0) { // means the engine is idle, so, set the timestamp this.lastIdleTimestamp.set(this.timerService.getCurrentTime()); if (this.endOperationListener != null) { this.endOperationListener.endO...
java
public void endOperation() { if (this.opCounter.decrementAndGet() == 0) { // means the engine is idle, so, set the timestamp this.lastIdleTimestamp.set(this.timerService.getCurrentTime()); if (this.endOperationListener != null) { this.endOperationListener.endO...
[ "public", "void", "endOperation", "(", ")", "{", "if", "(", "this", ".", "opCounter", ".", "decrementAndGet", "(", ")", "==", "0", ")", "{", "// means the engine is idle, so, set the timestamp", "this", ".", "lastIdleTimestamp", ".", "set", "(", "this", ".", "...
This method must be called after finishing any work in the engine, like inserting a new fact or firing a new rule. It will reset the engine idle time counter. This method must be extremely light to avoid contentions when called by multiple threads/entry-points
[ "This", "method", "must", "be", "called", "after", "finishing", "any", "work", "in", "the", "engine", "like", "inserting", "a", "new", "fact", "or", "firing", "a", "new", "rule", ".", "It", "will", "reset", "the", "engine", "idle", "time", "counter", "."...
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/impl/StatefulKnowledgeSessionImpl.java#L2021-L2029
14,089
kiegroup/drools
drools-core/src/main/java/org/drools/core/definitions/rule/impl/RuleImpl.java
RuleImpl.isEffective
public boolean isEffective(Tuple tuple, RuleTerminalNode rtn, WorkingMemory workingMemory) { if ( !this.enabled.getValue( tuple, rtn.getEnabledDeclarations(), this, ...
java
public boolean isEffective(Tuple tuple, RuleTerminalNode rtn, WorkingMemory workingMemory) { if ( !this.enabled.getValue( tuple, rtn.getEnabledDeclarations(), this, ...
[ "public", "boolean", "isEffective", "(", "Tuple", "tuple", ",", "RuleTerminalNode", "rtn", ",", "WorkingMemory", "workingMemory", ")", "{", "if", "(", "!", "this", ".", "enabled", ".", "getValue", "(", "tuple", ",", "rtn", ".", "getEnabledDeclarations", "(", ...
This returns true is the rule is effective. If the rule is not effective, it cannot activate. This uses the dateEffective, dateExpires and enabled flag to decide this.
[ "This", "returns", "true", "is", "the", "rule", "is", "effective", ".", "If", "the", "rule", "is", "not", "effective", "it", "cannot", "activate", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/definitions/rule/impl/RuleImpl.java#L419-L442
14,090
kiegroup/drools
drools-core/src/main/java/org/drools/core/definitions/rule/impl/RuleImpl.java
RuleImpl.getTransformedLhs
public GroupElement[] getTransformedLhs( LogicTransformer transformer, Map<String, Class<?>> globals ) throws InvalidPatternException { //Moved to getExtendedLhs --final GroupElement cloned = (GroupElement) this.lhsRoot.clone(); return transformer.transform( getExtendedLhs( this, ...
java
public GroupElement[] getTransformedLhs( LogicTransformer transformer, Map<String, Class<?>> globals ) throws InvalidPatternException { //Moved to getExtendedLhs --final GroupElement cloned = (GroupElement) this.lhsRoot.clone(); return transformer.transform( getExtendedLhs( this, ...
[ "public", "GroupElement", "[", "]", "getTransformedLhs", "(", "LogicTransformer", "transformer", ",", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "globals", ")", "throws", "InvalidPatternException", "{", "//Moved to getExtendedLhs --final GroupElement cloned...
Uses the LogicTransformer to process the Rule patters - if no ORs are used this will return an array of a single AND element. If there are Ors it will return an And element for each possible logic branch. The processing uses as a clone of the Rule's patterns, so they are not changed. @return @throws org.drools.core.ru...
[ "Uses", "the", "LogicTransformer", "to", "process", "the", "Rule", "patters", "-", "if", "no", "ORs", "are", "used", "this", "will", "return", "an", "array", "of", "a", "single", "AND", "element", ".", "If", "there", "are", "Ors", "it", "will", "return",...
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/definitions/rule/impl/RuleImpl.java#L596-L601
14,091
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/parser/feel11/FEELParser.java
FEELParser.isVariableNamePartValid
public static boolean isVariableNamePartValid( String namePart, Scope scope ) { if ( DIGITS_PATTERN.matcher(namePart).matches() ) { return true; } if ( REUSABLE_KEYWORDS.contains(namePart) ) { return scope.followUp(namePart, true); } return isVariableNameV...
java
public static boolean isVariableNamePartValid( String namePart, Scope scope ) { if ( DIGITS_PATTERN.matcher(namePart).matches() ) { return true; } if ( REUSABLE_KEYWORDS.contains(namePart) ) { return scope.followUp(namePart, true); } return isVariableNameV...
[ "public", "static", "boolean", "isVariableNamePartValid", "(", "String", "namePart", ",", "Scope", "scope", ")", "{", "if", "(", "DIGITS_PATTERN", ".", "matcher", "(", "namePart", ")", ".", "matches", "(", ")", ")", "{", "return", "true", ";", "}", "if", ...
Either namePart is a string of digits, or it must be a valid name itself
[ "Either", "namePart", "is", "a", "string", "of", "digits", "or", "it", "must", "be", "a", "valid", "name", "itself" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/parser/feel11/FEELParser.java#L82-L90
14,092
kiegroup/drools
drools-core/src/main/java/org/drools/core/rule/ImportDeclaration.java
ImportDeclaration.matches
public boolean matches( Class<?> clazz ) { // fully qualified import? if( this.target.equals( clazz.getName() ) ) { return true; } // wild card imports if( this.target.endsWith( ".*" ) ) { String prefix = this.target.substring( 0, this.target.indexOf( ".*...
java
public boolean matches( Class<?> clazz ) { // fully qualified import? if( this.target.equals( clazz.getName() ) ) { return true; } // wild card imports if( this.target.endsWith( ".*" ) ) { String prefix = this.target.substring( 0, this.target.indexOf( ".*...
[ "public", "boolean", "matches", "(", "Class", "<", "?", ">", "clazz", ")", "{", "// fully qualified import?", "if", "(", "this", ".", "target", ".", "equals", "(", "clazz", ".", "getName", "(", ")", ")", ")", "{", "return", "true", ";", "}", "// wild c...
Returns true if this ImportDeclaration correctly matches to the given clazz @param name @return
[ "Returns", "true", "if", "this", "ImportDeclaration", "correctly", "matches", "to", "the", "given", "clazz" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/rule/ImportDeclaration.java#L90-L111
14,093
kiegroup/drools
drools-core/src/main/java/org/drools/core/marshalling/impl/ProtobufInputMarshaller.java
ProtobufInputMarshaller.readSession
public static StatefulKnowledgeSessionImpl readSession(StatefulKnowledgeSessionImpl session, MarshallerReaderContext context) throws IOException, ClassNotFoundException { Prot...
java
public static StatefulKnowledgeSessionImpl readSession(StatefulKnowledgeSessionImpl session, MarshallerReaderContext context) throws IOException, ClassNotFoundException { Prot...
[ "public", "static", "StatefulKnowledgeSessionImpl", "readSession", "(", "StatefulKnowledgeSessionImpl", "session", ",", "MarshallerReaderContext", "context", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "ProtobufMessages", ".", "KnowledgeSession", "_session...
Stream the data into an existing session @param session @param context @return @throws IOException @throws ClassNotFoundException
[ "Stream", "the", "data", "into", "an", "existing", "session" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/marshalling/impl/ProtobufInputMarshaller.java#L108-L124
14,094
kiegroup/drools
drools-core/src/main/java/org/drools/core/marshalling/impl/ProtobufInputMarshaller.java
ProtobufInputMarshaller.readSession
public static ReadSessionResult readSession(MarshallerReaderContext context, int id) throws IOException, ClassNotFoundException { return readSession( context, id, EnvironmentFactory.newEnvironment(...
java
public static ReadSessionResult readSession(MarshallerReaderContext context, int id) throws IOException, ClassNotFoundException { return readSession( context, id, EnvironmentFactory.newEnvironment(...
[ "public", "static", "ReadSessionResult", "readSession", "(", "MarshallerReaderContext", "context", ",", "int", "id", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "return", "readSession", "(", "context", ",", "id", ",", "EnvironmentFactory", ".", ...
Create a new session into which to read the stream data
[ "Create", "a", "new", "session", "into", "which", "to", "read", "the", "stream", "data" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/marshalling/impl/ProtobufInputMarshaller.java#L129-L135
14,095
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/JavaDialect.java
JavaDialect.compileAll
public void compileAll() { if (this.generatedClassList.isEmpty()) { this.errorHandlers.clear(); return; } final String[] classes = new String[this.generatedClassList.size()]; this.generatedClassList.toArray(classes); File dumpDir = this.configuration.getP...
java
public void compileAll() { if (this.generatedClassList.isEmpty()) { this.errorHandlers.clear(); return; } final String[] classes = new String[this.generatedClassList.size()]; this.generatedClassList.toArray(classes); File dumpDir = this.configuration.getP...
[ "public", "void", "compileAll", "(", ")", "{", "if", "(", "this", ".", "generatedClassList", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "errorHandlers", ".", "clear", "(", ")", ";", "return", ";", "}", "final", "String", "[", "]", "classes", "=...
This actually triggers the compiling of all the resources. Errors are mapped back to the element that originally generated the semantic code.
[ "This", "actually", "triggers", "the", "compiling", "of", "all", "the", "resources", ".", "Errors", "are", "mapped", "back", "to", "the", "element", "that", "originally", "generated", "the", "semantic", "code", "." ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/JavaDialect.java#L406-L446
14,096
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/JavaDialect.java
JavaDialect.addRule
public void addRule(final RuleBuildContext context) { final RuleImpl rule = context.getRule(); final RuleDescr ruleDescr = context.getRuleDescr(); RuleClassBuilder classBuilder = context.getDialect().getRuleClassBuilder(); String ruleClass = classBuilder.buildRule(context); // ...
java
public void addRule(final RuleBuildContext context) { final RuleImpl rule = context.getRule(); final RuleDescr ruleDescr = context.getRuleDescr(); RuleClassBuilder classBuilder = context.getDialect().getRuleClassBuilder(); String ruleClass = classBuilder.buildRule(context); // ...
[ "public", "void", "addRule", "(", "final", "RuleBuildContext", "context", ")", "{", "final", "RuleImpl", "rule", "=", "context", ".", "getRule", "(", ")", ";", "final", "RuleDescr", "ruleDescr", "=", "context", ".", "getRuleDescr", "(", ")", ";", "RuleClassB...
This will add the rule for compiling later on. It will not actually call the compiler
[ "This", "will", "add", "the", "rule", "for", "compiling", "later", "on", ".", "It", "will", "not", "actually", "call", "the", "compiler" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/java/JavaDialect.java#L485-L537
14,097
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELEvalBuilder.java
MVELEvalBuilder.build
public RuleConditionElement build(final RuleBuildContext context, final BaseDescr descr, final Pattern prefixPattern) { boolean typesafe = context.isTypesafe(); // it must be an EvalDescr final EvalDescr evalDescr = (Eva...
java
public RuleConditionElement build(final RuleBuildContext context, final BaseDescr descr, final Pattern prefixPattern) { boolean typesafe = context.isTypesafe(); // it must be an EvalDescr final EvalDescr evalDescr = (Eva...
[ "public", "RuleConditionElement", "build", "(", "final", "RuleBuildContext", "context", ",", "final", "BaseDescr", "descr", ",", "final", "Pattern", "prefixPattern", ")", "{", "boolean", "typesafe", "=", "context", ".", "isTypesafe", "(", ")", ";", "// it must be ...
Builds and returns an Eval Conditional Element @param context The current build context @param descr The Eval Descriptor to build the eval conditional element from @return the Eval Conditional Element
[ "Builds", "and", "returns", "an", "Eval", "Conditional", "Element" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/rule/builder/dialect/mvel/MVELEvalBuilder.java#L63-L122
14,098
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java
CompiledFEELSemanticMappings.div
public static Object div(Object left, BigDecimal right) { return right == null || right.signum() == 0 ? null : InfixOpNode.div(left, right, null); }
java
public static Object div(Object left, BigDecimal right) { return right == null || right.signum() == 0 ? null : InfixOpNode.div(left, right, null); }
[ "public", "static", "Object", "div", "(", "Object", "left", ",", "BigDecimal", "right", ")", "{", "return", "right", "==", "null", "||", "right", ".", "signum", "(", ")", "==", "0", "?", "null", ":", "InfixOpNode", ".", "div", "(", "left", ",", "righ...
to ground to null if right = 0
[ "to", "ground", "to", "null", "if", "right", "=", "0" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java#L327-L329
14,099
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java
CompiledFEELSemanticMappings.ne
public static Boolean ne(Object left, Object right) { return not(EvalHelper.isEqual(left, right, null)); }
java
public static Boolean ne(Object left, Object right) { return not(EvalHelper.isEqual(left, right, null)); }
[ "public", "static", "Boolean", "ne", "(", "Object", "left", ",", "Object", "right", ")", "{", "return", "not", "(", "EvalHelper", ".", "isEqual", "(", "left", ",", "right", ",", "null", ")", ")", ";", "}" ]
FEEL spec Table 39
[ "FEEL", "spec", "Table", "39" ]
22b0275d6dbe93070b8090948502cf46eda543c4
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java#L414-L416