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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,800 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java | CharsTrie.next | public Result next(int inUnit) {
int pos=pos_;
if(pos<0) {
return Result.NO_MATCH;
}
int length=remainingMatchLength_; // Actual remaining match length minus 1.
if(length>=0) {
// Remaining part of a linear-match node.
if(inUnit==chars_.charAt(pos++)) {
remainingMatchLength_=--length;
pos_=pos;
int node;
return (length<0 && (node=chars_.charAt(pos))>=kMinValueLead) ?
valueResults_[node>>15] : Result.NO_VALUE;
} else {
stop();
return Result.NO_MATCH;
}
}
return nextImpl(pos, inUnit);
} | java | public Result next(int inUnit) {
int pos=pos_;
if(pos<0) {
return Result.NO_MATCH;
}
int length=remainingMatchLength_; // Actual remaining match length minus 1.
if(length>=0) {
// Remaining part of a linear-match node.
if(inUnit==chars_.charAt(pos++)) {
remainingMatchLength_=--length;
pos_=pos;
int node;
return (length<0 && (node=chars_.charAt(pos))>=kMinValueLead) ?
valueResults_[node>>15] : Result.NO_VALUE;
} else {
stop();
return Result.NO_MATCH;
}
}
return nextImpl(pos, inUnit);
} | [
"public",
"Result",
"next",
"(",
"int",
"inUnit",
")",
"{",
"int",
"pos",
"=",
"pos_",
";",
"if",
"(",
"pos",
"<",
"0",
")",
"{",
"return",
"Result",
".",
"NO_MATCH",
";",
"}",
"int",
"length",
"=",
"remainingMatchLength_",
";",
"// Actual remaining matc... | Traverses the trie from the current state for this input char.
@param inUnit Input char value. Values below 0 and above 0xffff will never match.
@return The match/value Result. | [
"Traverses",
"the",
"trie",
"from",
"the",
"current",
"state",
"for",
"this",
"input",
"char",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java#L169-L189 |
33,801 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java | CharsTrie.nextForCodePoint | public Result nextForCodePoint(int cp) {
return cp<=0xffff ?
next(cp) :
(next(UTF16.getLeadSurrogate(cp)).hasNext() ?
next(UTF16.getTrailSurrogate(cp)) :
Result.NO_MATCH);
} | java | public Result nextForCodePoint(int cp) {
return cp<=0xffff ?
next(cp) :
(next(UTF16.getLeadSurrogate(cp)).hasNext() ?
next(UTF16.getTrailSurrogate(cp)) :
Result.NO_MATCH);
} | [
"public",
"Result",
"nextForCodePoint",
"(",
"int",
"cp",
")",
"{",
"return",
"cp",
"<=",
"0xffff",
"?",
"next",
"(",
"cp",
")",
":",
"(",
"next",
"(",
"UTF16",
".",
"getLeadSurrogate",
"(",
"cp",
")",
")",
".",
"hasNext",
"(",
")",
"?",
"next",
"(... | Traverses the trie from the current state for the
one or two UTF-16 code units for this input code point.
@param cp A Unicode code point 0..0x10ffff.
@return The match/value Result. | [
"Traverses",
"the",
"trie",
"from",
"the",
"current",
"state",
"for",
"the",
"one",
"or",
"two",
"UTF",
"-",
"16",
"code",
"units",
"for",
"this",
"input",
"code",
"point",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java#L197-L203 |
33,802 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java | CharsTrie.getUniqueValue | public long getUniqueValue() /*const*/ {
int pos=pos_;
if(pos<0) {
return 0;
}
// Skip the rest of a pending linear-match node.
long uniqueValue=findUniqueValue(chars_, pos+remainingMatchLength_+1, 0);
// Ignore internally used bits 63..33; extend the actual value's sign bit from bit 32.
return (uniqueValue<<31)>>31;
} | java | public long getUniqueValue() /*const*/ {
int pos=pos_;
if(pos<0) {
return 0;
}
// Skip the rest of a pending linear-match node.
long uniqueValue=findUniqueValue(chars_, pos+remainingMatchLength_+1, 0);
// Ignore internally used bits 63..33; extend the actual value's sign bit from bit 32.
return (uniqueValue<<31)>>31;
} | [
"public",
"long",
"getUniqueValue",
"(",
")",
"/*const*/",
"{",
"int",
"pos",
"=",
"pos_",
";",
"if",
"(",
"pos",
"<",
"0",
")",
"{",
"return",
"0",
";",
"}",
"// Skip the rest of a pending linear-match node.",
"long",
"uniqueValue",
"=",
"findUniqueValue",
"(... | Determines whether all strings reachable from the current state
map to the same value, and if so, returns that value.
@return The unique value in bits 32..1 with bit 0 set,
if all strings reachable from the current state
map to the same value; otherwise returns 0. | [
"Determines",
"whether",
"all",
"strings",
"reachable",
"from",
"the",
"current",
"state",
"map",
"to",
"the",
"same",
"value",
"and",
"if",
"so",
"returns",
"that",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java#L319-L328 |
33,803 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java | CharsTrie.iterator | public static Iterator iterator(CharSequence trieChars, int offset, int maxStringLength) {
return new Iterator(trieChars, offset, -1, maxStringLength);
} | java | public static Iterator iterator(CharSequence trieChars, int offset, int maxStringLength) {
return new Iterator(trieChars, offset, -1, maxStringLength);
} | [
"public",
"static",
"Iterator",
"iterator",
"(",
"CharSequence",
"trieChars",
",",
"int",
"offset",
",",
"int",
"maxStringLength",
")",
"{",
"return",
"new",
"Iterator",
"(",
"trieChars",
",",
"offset",
",",
"-",
"1",
",",
"maxStringLength",
")",
";",
"}"
] | Iterates from the root of a char-serialized BytesTrie.
@param trieChars CharSequence that contains the serialized trie.
@param offset Root offset of the trie in the CharSequence.
@param maxStringLength If 0, the iterator returns full strings.
Otherwise, the iterator returns strings with this maximum length.
@return A new CharsTrie.Iterator. | [
"Iterates",
"from",
"the",
"root",
"of",
"a",
"char",
"-",
"serialized",
"BytesTrie",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java#L395-L397 |
33,804 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java | CharsTrie.readValue | private static int readValue(CharSequence chars, int pos, int leadUnit) {
int value;
if(leadUnit<kMinTwoUnitValueLead) {
value=leadUnit;
} else if(leadUnit<kThreeUnitValueLead) {
value=((leadUnit-kMinTwoUnitValueLead)<<16)|chars.charAt(pos);
} else {
value=(chars.charAt(pos)<<16)|chars.charAt(pos+1);
}
return value;
} | java | private static int readValue(CharSequence chars, int pos, int leadUnit) {
int value;
if(leadUnit<kMinTwoUnitValueLead) {
value=leadUnit;
} else if(leadUnit<kThreeUnitValueLead) {
value=((leadUnit-kMinTwoUnitValueLead)<<16)|chars.charAt(pos);
} else {
value=(chars.charAt(pos)<<16)|chars.charAt(pos+1);
}
return value;
} | [
"private",
"static",
"int",
"readValue",
"(",
"CharSequence",
"chars",
",",
"int",
"pos",
",",
"int",
"leadUnit",
")",
"{",
"int",
"value",
";",
"if",
"(",
"leadUnit",
"<",
"kMinTwoUnitValueLead",
")",
"{",
"value",
"=",
"leadUnit",
";",
"}",
"else",
"if... | pos is already after the leadUnit, and the lead unit has bit 15 reset. | [
"pos",
"is",
"already",
"after",
"the",
"leadUnit",
"and",
"the",
"lead",
"unit",
"has",
"bit",
"15",
"reset",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java#L627-L637 |
33,805 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java | CharsTrie.nextImpl | private Result nextImpl(int pos, int inUnit) {
int node=chars_.charAt(pos++);
for(;;) {
if(node<kMinLinearMatch) {
return branchNext(pos, node, inUnit);
} else if(node<kMinValueLead) {
// Match the first of length+1 units.
int length=node-kMinLinearMatch; // Actual match length minus 1.
if(inUnit==chars_.charAt(pos++)) {
remainingMatchLength_=--length;
pos_=pos;
return (length<0 && (node=chars_.charAt(pos))>=kMinValueLead) ?
valueResults_[node>>15] : Result.NO_VALUE;
} else {
// No match.
break;
}
} else if((node&kValueIsFinal)!=0) {
// No further matching units.
break;
} else {
// Skip intermediate value.
pos=skipNodeValue(pos, node);
node&=kNodeTypeMask;
}
}
stop();
return Result.NO_MATCH;
} | java | private Result nextImpl(int pos, int inUnit) {
int node=chars_.charAt(pos++);
for(;;) {
if(node<kMinLinearMatch) {
return branchNext(pos, node, inUnit);
} else if(node<kMinValueLead) {
// Match the first of length+1 units.
int length=node-kMinLinearMatch; // Actual match length minus 1.
if(inUnit==chars_.charAt(pos++)) {
remainingMatchLength_=--length;
pos_=pos;
return (length<0 && (node=chars_.charAt(pos))>=kMinValueLead) ?
valueResults_[node>>15] : Result.NO_VALUE;
} else {
// No match.
break;
}
} else if((node&kValueIsFinal)!=0) {
// No further matching units.
break;
} else {
// Skip intermediate value.
pos=skipNodeValue(pos, node);
node&=kNodeTypeMask;
}
}
stop();
return Result.NO_MATCH;
} | [
"private",
"Result",
"nextImpl",
"(",
"int",
"pos",
",",
"int",
"inUnit",
")",
"{",
"int",
"node",
"=",
"chars_",
".",
"charAt",
"(",
"pos",
"++",
")",
";",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"node",
"<",
"kMinLinearMatch",
")",
"{",
"ret... | Requires remainingLength_<0. | [
"Requires",
"remainingLength_<0",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java#L767-L795 |
33,806 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java | CharsTrie.findUniqueValueFromBranch | private static long findUniqueValueFromBranch(CharSequence chars, int pos, int length,
long uniqueValue) {
while(length>kMaxBranchLinearSubNodeLength) {
++pos; // ignore the comparison unit
uniqueValue=findUniqueValueFromBranch(chars, jumpByDelta(chars, pos), length>>1, uniqueValue);
if(uniqueValue==0) {
return 0;
}
length=length-(length>>1);
pos=skipDelta(chars, pos);
}
do {
++pos; // ignore a comparison unit
// handle its value
int node=chars.charAt(pos++);
boolean isFinal=(node&kValueIsFinal)!=0;
node&=0x7fff;
int value=readValue(chars, pos, node);
pos=skipValue(pos, node);
if(isFinal) {
if(uniqueValue!=0) {
if(value!=(int)(uniqueValue>>1)) {
return 0;
}
} else {
uniqueValue=((long)value<<1)|1;
}
} else {
uniqueValue=findUniqueValue(chars, pos+value, uniqueValue);
if(uniqueValue==0) {
return 0;
}
}
} while(--length>1);
// ignore the last comparison byte
return ((long)(pos+1)<<33)|(uniqueValue&0x1ffffffffL);
} | java | private static long findUniqueValueFromBranch(CharSequence chars, int pos, int length,
long uniqueValue) {
while(length>kMaxBranchLinearSubNodeLength) {
++pos; // ignore the comparison unit
uniqueValue=findUniqueValueFromBranch(chars, jumpByDelta(chars, pos), length>>1, uniqueValue);
if(uniqueValue==0) {
return 0;
}
length=length-(length>>1);
pos=skipDelta(chars, pos);
}
do {
++pos; // ignore a comparison unit
// handle its value
int node=chars.charAt(pos++);
boolean isFinal=(node&kValueIsFinal)!=0;
node&=0x7fff;
int value=readValue(chars, pos, node);
pos=skipValue(pos, node);
if(isFinal) {
if(uniqueValue!=0) {
if(value!=(int)(uniqueValue>>1)) {
return 0;
}
} else {
uniqueValue=((long)value<<1)|1;
}
} else {
uniqueValue=findUniqueValue(chars, pos+value, uniqueValue);
if(uniqueValue==0) {
return 0;
}
}
} while(--length>1);
// ignore the last comparison byte
return ((long)(pos+1)<<33)|(uniqueValue&0x1ffffffffL);
} | [
"private",
"static",
"long",
"findUniqueValueFromBranch",
"(",
"CharSequence",
"chars",
",",
"int",
"pos",
",",
"int",
"length",
",",
"long",
"uniqueValue",
")",
"{",
"while",
"(",
"length",
">",
"kMaxBranchLinearSubNodeLength",
")",
"{",
"++",
"pos",
";",
"//... | On return, if not 0, then bits 63..33 contain the updated non-negative pos. | [
"On",
"return",
"if",
"not",
"0",
"then",
"bits",
"63",
"..",
"33",
"contain",
"the",
"updated",
"non",
"-",
"negative",
"pos",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java#L802-L838 |
33,807 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java | CharsTrie.findUniqueValue | private static long findUniqueValue(CharSequence chars, int pos, long uniqueValue) {
int node=chars.charAt(pos++);
for(;;) {
if(node<kMinLinearMatch) {
if(node==0) {
node=chars.charAt(pos++);
}
uniqueValue=findUniqueValueFromBranch(chars, pos, node+1, uniqueValue);
if(uniqueValue==0) {
return 0;
}
pos=(int)(uniqueValue>>>33);
node=chars.charAt(pos++);
} else if(node<kMinValueLead) {
// linear-match node
pos+=node-kMinLinearMatch+1; // Ignore the match units.
node=chars.charAt(pos++);
} else {
boolean isFinal=(node&kValueIsFinal)!=0;
int value;
if(isFinal) {
value=readValue(chars, pos, node&0x7fff);
} else {
value=readNodeValue(chars, pos, node);
}
if(uniqueValue!=0) {
if(value!=(int)(uniqueValue>>1)) {
return 0;
}
} else {
uniqueValue=((long)value<<1)|1;
}
if(isFinal) {
return uniqueValue;
}
pos=skipNodeValue(pos, node);
node&=kNodeTypeMask;
}
}
} | java | private static long findUniqueValue(CharSequence chars, int pos, long uniqueValue) {
int node=chars.charAt(pos++);
for(;;) {
if(node<kMinLinearMatch) {
if(node==0) {
node=chars.charAt(pos++);
}
uniqueValue=findUniqueValueFromBranch(chars, pos, node+1, uniqueValue);
if(uniqueValue==0) {
return 0;
}
pos=(int)(uniqueValue>>>33);
node=chars.charAt(pos++);
} else if(node<kMinValueLead) {
// linear-match node
pos+=node-kMinLinearMatch+1; // Ignore the match units.
node=chars.charAt(pos++);
} else {
boolean isFinal=(node&kValueIsFinal)!=0;
int value;
if(isFinal) {
value=readValue(chars, pos, node&0x7fff);
} else {
value=readNodeValue(chars, pos, node);
}
if(uniqueValue!=0) {
if(value!=(int)(uniqueValue>>1)) {
return 0;
}
} else {
uniqueValue=((long)value<<1)|1;
}
if(isFinal) {
return uniqueValue;
}
pos=skipNodeValue(pos, node);
node&=kNodeTypeMask;
}
}
} | [
"private",
"static",
"long",
"findUniqueValue",
"(",
"CharSequence",
"chars",
",",
"int",
"pos",
",",
"long",
"uniqueValue",
")",
"{",
"int",
"node",
"=",
"chars",
".",
"charAt",
"(",
"pos",
"++",
")",
";",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
... | Otherwise, uniqueValue is 0. Bits 63..33 are ignored. | [
"Otherwise",
"uniqueValue",
"is",
"0",
".",
"Bits",
"63",
"..",
"33",
"are",
"ignored",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java#L843-L882 |
33,808 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/HttpURLConnection.java | HttpURLConnection.setFixedLengthStreamingMode | public void setFixedLengthStreamingMode(long contentLength) {
if (connected) {
throw new IllegalStateException("Already connected");
}
if (chunkLength != -1) {
throw new IllegalStateException(
"Chunked encoding streaming mode set");
}
if (contentLength < 0) {
throw new IllegalArgumentException("invalid content length");
}
fixedContentLengthLong = contentLength;
} | java | public void setFixedLengthStreamingMode(long contentLength) {
if (connected) {
throw new IllegalStateException("Already connected");
}
if (chunkLength != -1) {
throw new IllegalStateException(
"Chunked encoding streaming mode set");
}
if (contentLength < 0) {
throw new IllegalArgumentException("invalid content length");
}
fixedContentLengthLong = contentLength;
} | [
"public",
"void",
"setFixedLengthStreamingMode",
"(",
"long",
"contentLength",
")",
"{",
"if",
"(",
"connected",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Already connected\"",
")",
";",
"}",
"if",
"(",
"chunkLength",
"!=",
"-",
"1",
")",
"{",... | This method is used to enable streaming of a HTTP request body
without internal buffering, when the content length is known in
advance.
<P> An exception will be thrown if the application attempts to write
more data than the indicated content-length, or if the application
closes the OutputStream before writing the indicated amount.
<P> When output streaming is enabled, authentication and redirection
cannot be handled automatically. A {@linkplain HttpRetryException} will
be thrown when reading the response if authentication or redirection
are required. This exception can be queried for the details of the
error.
<P> This method must be called before the URLConnection is connected.
<P> The content length set by invoking this method takes precedence
over any value set by {@link #setFixedLengthStreamingMode(int)}.
@param contentLength
The number of bytes which will be written to the OutputStream.
@throws IllegalStateException
if URLConnection is already connected or if a different
streaming mode is already enabled.
@throws IllegalArgumentException
if a content length less than zero is specified.
@since 1.7 | [
"This",
"method",
"is",
"used",
"to",
"enable",
"streaming",
"of",
"a",
"HTTP",
"request",
"body",
"without",
"internal",
"buffering",
"when",
"the",
"content",
"length",
"is",
"known",
"in",
"advance",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/HttpURLConnection.java#L404-L416 |
33,809 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java | DocumentImpl.shallowCopy | private NodeImpl shallowCopy(short operation, Node node) {
switch (node.getNodeType()) {
case Node.ATTRIBUTE_NODE:
AttrImpl attr = (AttrImpl) node;
AttrImpl attrCopy;
if (attr.namespaceAware) {
attrCopy = createAttributeNS(attr.getNamespaceURI(), attr.getLocalName());
attrCopy.setPrefix(attr.getPrefix());
} else {
attrCopy = createAttribute(attr.getName());
}
attrCopy.setNodeValue(attr.getValue());
return attrCopy;
case Node.CDATA_SECTION_NODE:
return createCDATASection(((CharacterData) node).getData());
case Node.COMMENT_NODE:
return createComment(((Comment) node).getData());
case Node.DOCUMENT_FRAGMENT_NODE:
return createDocumentFragment();
case Node.DOCUMENT_NODE:
case Node.DOCUMENT_TYPE_NODE:
throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
"Cannot copy node of type " + node.getNodeType());
case Node.ELEMENT_NODE:
ElementImpl element = (ElementImpl) node;
ElementImpl elementCopy;
if (element.namespaceAware) {
elementCopy = createElementNS(element.getNamespaceURI(), element.getLocalName());
elementCopy.setPrefix(element.getPrefix());
} else {
elementCopy = createElement(element.getTagName());
}
NamedNodeMap attributes = element.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
AttrImpl elementAttr = (AttrImpl) attributes.item(i);
AttrImpl elementAttrCopy = (AttrImpl) shallowCopy(operation, elementAttr);
notifyUserDataHandlers(operation, elementAttr, elementAttrCopy);
if (elementAttr.namespaceAware) {
elementCopy.setAttributeNodeNS(elementAttrCopy);
} else {
elementCopy.setAttributeNode(elementAttrCopy);
}
}
return elementCopy;
case Node.ENTITY_NODE:
case Node.NOTATION_NODE:
// TODO: implement this when we support these node types
throw new UnsupportedOperationException();
case Node.ENTITY_REFERENCE_NODE:
/*
* When we support entities in the doctype, this will need to
* behave differently for clones vs. imports. Clones copy
* entities by value, copying the referenced subtree from the
* original document. Imports copy entities by reference,
* possibly referring to a different subtree in the new
* document.
*/
return createEntityReference(node.getNodeName());
case Node.PROCESSING_INSTRUCTION_NODE:
ProcessingInstruction pi = (ProcessingInstruction) node;
return createProcessingInstruction(pi.getTarget(), pi.getData());
case Node.TEXT_NODE:
return createTextNode(((Text) node).getData());
default:
throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
"Unsupported node type " + node.getNodeType());
}
} | java | private NodeImpl shallowCopy(short operation, Node node) {
switch (node.getNodeType()) {
case Node.ATTRIBUTE_NODE:
AttrImpl attr = (AttrImpl) node;
AttrImpl attrCopy;
if (attr.namespaceAware) {
attrCopy = createAttributeNS(attr.getNamespaceURI(), attr.getLocalName());
attrCopy.setPrefix(attr.getPrefix());
} else {
attrCopy = createAttribute(attr.getName());
}
attrCopy.setNodeValue(attr.getValue());
return attrCopy;
case Node.CDATA_SECTION_NODE:
return createCDATASection(((CharacterData) node).getData());
case Node.COMMENT_NODE:
return createComment(((Comment) node).getData());
case Node.DOCUMENT_FRAGMENT_NODE:
return createDocumentFragment();
case Node.DOCUMENT_NODE:
case Node.DOCUMENT_TYPE_NODE:
throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
"Cannot copy node of type " + node.getNodeType());
case Node.ELEMENT_NODE:
ElementImpl element = (ElementImpl) node;
ElementImpl elementCopy;
if (element.namespaceAware) {
elementCopy = createElementNS(element.getNamespaceURI(), element.getLocalName());
elementCopy.setPrefix(element.getPrefix());
} else {
elementCopy = createElement(element.getTagName());
}
NamedNodeMap attributes = element.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
AttrImpl elementAttr = (AttrImpl) attributes.item(i);
AttrImpl elementAttrCopy = (AttrImpl) shallowCopy(operation, elementAttr);
notifyUserDataHandlers(operation, elementAttr, elementAttrCopy);
if (elementAttr.namespaceAware) {
elementCopy.setAttributeNodeNS(elementAttrCopy);
} else {
elementCopy.setAttributeNode(elementAttrCopy);
}
}
return elementCopy;
case Node.ENTITY_NODE:
case Node.NOTATION_NODE:
// TODO: implement this when we support these node types
throw new UnsupportedOperationException();
case Node.ENTITY_REFERENCE_NODE:
/*
* When we support entities in the doctype, this will need to
* behave differently for clones vs. imports. Clones copy
* entities by value, copying the referenced subtree from the
* original document. Imports copy entities by reference,
* possibly referring to a different subtree in the new
* document.
*/
return createEntityReference(node.getNodeName());
case Node.PROCESSING_INSTRUCTION_NODE:
ProcessingInstruction pi = (ProcessingInstruction) node;
return createProcessingInstruction(pi.getTarget(), pi.getData());
case Node.TEXT_NODE:
return createTextNode(((Text) node).getData());
default:
throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
"Unsupported node type " + node.getNodeType());
}
} | [
"private",
"NodeImpl",
"shallowCopy",
"(",
"short",
"operation",
",",
"Node",
"node",
")",
"{",
"switch",
"(",
"node",
".",
"getNodeType",
"(",
")",
")",
"{",
"case",
"Node",
".",
"ATTRIBUTE_NODE",
":",
"AttrImpl",
"attr",
"=",
"(",
"AttrImpl",
")",
"nod... | Returns a shallow copy of the given node. If the node is an element node,
its attributes are always copied.
@param node a node belonging to any document or DOM implementation.
@param operation the operation type to use when notifying user data
handlers of copied element attributes. It is the caller's
responsibility to notify user data handlers of the returned node.
@return a new node whose document is this document and whose DOM
implementation is this DOM implementation. | [
"Returns",
"a",
"shallow",
"copy",
"of",
"the",
"given",
"node",
".",
"If",
"the",
"node",
"is",
"an",
"element",
"node",
"its",
"attributes",
"are",
"always",
"copied",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java#L129-L207 |
33,810 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java | DocumentImpl.cloneOrImportNode | Node cloneOrImportNode(short operation, Node node, boolean deep) {
NodeImpl copy = shallowCopy(operation, node);
if (deep) {
NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
copy.appendChild(cloneOrImportNode(operation, list.item(i), deep));
}
}
notifyUserDataHandlers(operation, node, copy);
return copy;
} | java | Node cloneOrImportNode(short operation, Node node, boolean deep) {
NodeImpl copy = shallowCopy(operation, node);
if (deep) {
NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
copy.appendChild(cloneOrImportNode(operation, list.item(i), deep));
}
}
notifyUserDataHandlers(operation, node, copy);
return copy;
} | [
"Node",
"cloneOrImportNode",
"(",
"short",
"operation",
",",
"Node",
"node",
",",
"boolean",
"deep",
")",
"{",
"NodeImpl",
"copy",
"=",
"shallowCopy",
"(",
"operation",
",",
"node",
")",
";",
"if",
"(",
"deep",
")",
"{",
"NodeList",
"list",
"=",
"node",
... | Returns a copy of the given node or subtree with this document as its
owner.
@param operation either {@link UserDataHandler#NODE_CLONED} or
{@link UserDataHandler#NODE_IMPORTED}.
@param node a node belonging to any document or DOM implementation.
@param deep true to recursively copy any child nodes; false to do no such
copying and return a node with no children. | [
"Returns",
"a",
"copy",
"of",
"the",
"given",
"node",
"or",
"subtree",
"with",
"this",
"document",
"as",
"its",
"owner",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java#L219-L231 |
33,811 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java | DocumentImpl.insertChildAt | @Override public Node insertChildAt(Node toInsert, int index) {
if (toInsert instanceof Element && getDocumentElement() != null) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
"Only one root element allowed");
}
if (toInsert instanceof DocumentType && getDoctype() != null) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
"Only one DOCTYPE element allowed");
}
return super.insertChildAt(toInsert, index);
} | java | @Override public Node insertChildAt(Node toInsert, int index) {
if (toInsert instanceof Element && getDocumentElement() != null) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
"Only one root element allowed");
}
if (toInsert instanceof DocumentType && getDoctype() != null) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
"Only one DOCTYPE element allowed");
}
return super.insertChildAt(toInsert, index);
} | [
"@",
"Override",
"public",
"Node",
"insertChildAt",
"(",
"Node",
"toInsert",
",",
"int",
"index",
")",
"{",
"if",
"(",
"toInsert",
"instanceof",
"Element",
"&&",
"getDocumentElement",
"(",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"DOMException",
"(",
"... | Document elements may have at most one root element and at most one DTD
element. | [
"Document",
"elements",
"may",
"have",
"at",
"most",
"one",
"root",
"element",
"and",
"at",
"most",
"one",
"DTD",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java#L419-L429 |
33,812 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java | DocumentImpl.getUserDataMap | Map<String, UserData> getUserDataMap(NodeImpl node) {
if (nodeToUserData == null) {
nodeToUserData = new WeakHashMap<NodeImpl, Map<String, UserData>>();
}
Map<String, UserData> userDataMap = nodeToUserData.get(node);
if (userDataMap == null) {
userDataMap = new HashMap<String, UserData>();
nodeToUserData.put(node, userDataMap);
}
return userDataMap;
} | java | Map<String, UserData> getUserDataMap(NodeImpl node) {
if (nodeToUserData == null) {
nodeToUserData = new WeakHashMap<NodeImpl, Map<String, UserData>>();
}
Map<String, UserData> userDataMap = nodeToUserData.get(node);
if (userDataMap == null) {
userDataMap = new HashMap<String, UserData>();
nodeToUserData.put(node, userDataMap);
}
return userDataMap;
} | [
"Map",
"<",
"String",
",",
"UserData",
">",
"getUserDataMap",
"(",
"NodeImpl",
"node",
")",
"{",
"if",
"(",
"nodeToUserData",
"==",
"null",
")",
"{",
"nodeToUserData",
"=",
"new",
"WeakHashMap",
"<",
"NodeImpl",
",",
"Map",
"<",
"String",
",",
"UserData",
... | Returns a map with the user data objects attached to the specified node.
This map is readable and writable. | [
"Returns",
"a",
"map",
"with",
"the",
"user",
"data",
"objects",
"attached",
"to",
"the",
"specified",
"node",
".",
"This",
"map",
"is",
"readable",
"and",
"writable",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java#L495-L505 |
33,813 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java | DocumentImpl.getUserDataMapForRead | Map<String, UserData> getUserDataMapForRead(NodeImpl node) {
if (nodeToUserData == null) {
return Collections.emptyMap();
}
Map<String, UserData> userDataMap = nodeToUserData.get(node);
return userDataMap == null
? Collections.<String, UserData>emptyMap()
: userDataMap;
} | java | Map<String, UserData> getUserDataMapForRead(NodeImpl node) {
if (nodeToUserData == null) {
return Collections.emptyMap();
}
Map<String, UserData> userDataMap = nodeToUserData.get(node);
return userDataMap == null
? Collections.<String, UserData>emptyMap()
: userDataMap;
} | [
"Map",
"<",
"String",
",",
"UserData",
">",
"getUserDataMapForRead",
"(",
"NodeImpl",
"node",
")",
"{",
"if",
"(",
"nodeToUserData",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyMap",
"(",
")",
";",
"}",
"Map",
"<",
"String",
",",
"UserDat... | Returns a map with the user data objects attached to the specified node.
The returned map may be read-only. | [
"Returns",
"a",
"map",
"with",
"the",
"user",
"data",
"objects",
"attached",
"to",
"the",
"specified",
"node",
".",
"The",
"returned",
"map",
"may",
"be",
"read",
"-",
"only",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java#L511-L519 |
33,814 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.eleminateRedundent | protected void eleminateRedundent(ElemTemplateElement psuedoVarRecipient, Vector paths)
{
int n = paths.size();
int numPathsEliminated = 0;
int numUniquePathsEliminated = 0;
for (int i = 0; i < n; i++)
{
ExpressionOwner owner = (ExpressionOwner) paths.elementAt(i);
if (null != owner)
{
int found = findAndEliminateRedundant(i + 1, i, owner, psuedoVarRecipient, paths);
if (found > 0)
numUniquePathsEliminated++;
numPathsEliminated += found;
}
}
eleminateSharedPartialPaths(psuedoVarRecipient, paths);
if(DIAGNOSE_NUM_PATHS_REDUCED)
diagnoseNumPaths(paths, numPathsEliminated, numUniquePathsEliminated);
} | java | protected void eleminateRedundent(ElemTemplateElement psuedoVarRecipient, Vector paths)
{
int n = paths.size();
int numPathsEliminated = 0;
int numUniquePathsEliminated = 0;
for (int i = 0; i < n; i++)
{
ExpressionOwner owner = (ExpressionOwner) paths.elementAt(i);
if (null != owner)
{
int found = findAndEliminateRedundant(i + 1, i, owner, psuedoVarRecipient, paths);
if (found > 0)
numUniquePathsEliminated++;
numPathsEliminated += found;
}
}
eleminateSharedPartialPaths(psuedoVarRecipient, paths);
if(DIAGNOSE_NUM_PATHS_REDUCED)
diagnoseNumPaths(paths, numPathsEliminated, numUniquePathsEliminated);
} | [
"protected",
"void",
"eleminateRedundent",
"(",
"ElemTemplateElement",
"psuedoVarRecipient",
",",
"Vector",
"paths",
")",
"{",
"int",
"n",
"=",
"paths",
".",
"size",
"(",
")",
";",
"int",
"numPathsEliminated",
"=",
"0",
";",
"int",
"numUniquePathsEliminated",
"=... | Method to be called after the all expressions within an
node context have been visited. It eliminates redundent
expressions by creating a variable in the psuedoVarRecipient
for each redundent expression, and then rewriting the redundent
expression to be a variable reference.
@param psuedoVarRecipient The owner of the subtree from where the
paths were collected.
@param paths A vector of paths that hold ExpressionOwner objects,
which must yield LocationPathIterators. | [
"Method",
"to",
"be",
"called",
"after",
"the",
"all",
"expressions",
"within",
"an",
"node",
"context",
"have",
"been",
"visited",
".",
"It",
"eliminates",
"redundent",
"expressions",
"by",
"creating",
"a",
"variable",
"in",
"the",
"psuedoVarRecipient",
"for",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L121-L142 |
33,815 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.eleminateSharedPartialPaths | protected void eleminateSharedPartialPaths(ElemTemplateElement psuedoVarRecipient, Vector paths)
{
MultistepExprHolder list = createMultistepExprList(paths);
if(null != list)
{
if(DIAGNOSE_MULTISTEPLIST)
list.diagnose();
boolean isGlobal = (paths == m_absPaths);
// Iterate over the list, starting with the most number of paths,
// trying to find the longest matches first.
int longestStepsCount = list.m_stepCount;
for (int i = longestStepsCount-1; i >= 1; i--)
{
MultistepExprHolder next = list;
while(null != next)
{
if(next.m_stepCount < i)
break;
list = matchAndEliminatePartialPaths(next, list, isGlobal, i, psuedoVarRecipient);
next = next.m_next;
}
}
}
} | java | protected void eleminateSharedPartialPaths(ElemTemplateElement psuedoVarRecipient, Vector paths)
{
MultistepExprHolder list = createMultistepExprList(paths);
if(null != list)
{
if(DIAGNOSE_MULTISTEPLIST)
list.diagnose();
boolean isGlobal = (paths == m_absPaths);
// Iterate over the list, starting with the most number of paths,
// trying to find the longest matches first.
int longestStepsCount = list.m_stepCount;
for (int i = longestStepsCount-1; i >= 1; i--)
{
MultistepExprHolder next = list;
while(null != next)
{
if(next.m_stepCount < i)
break;
list = matchAndEliminatePartialPaths(next, list, isGlobal, i, psuedoVarRecipient);
next = next.m_next;
}
}
}
} | [
"protected",
"void",
"eleminateSharedPartialPaths",
"(",
"ElemTemplateElement",
"psuedoVarRecipient",
",",
"Vector",
"paths",
")",
"{",
"MultistepExprHolder",
"list",
"=",
"createMultistepExprList",
"(",
"paths",
")",
";",
"if",
"(",
"null",
"!=",
"list",
")",
"{",
... | Eliminate the shared partial paths in the expression list.
@param psuedoVarRecipient The recipient of the psuedo vars.
@param paths A vector of paths that hold ExpressionOwner objects,
which must yield LocationPathIterators. | [
"Eliminate",
"the",
"shared",
"partial",
"paths",
"in",
"the",
"expression",
"list",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L152-L177 |
33,816 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.matchAndEliminatePartialPaths | protected MultistepExprHolder matchAndEliminatePartialPaths(MultistepExprHolder testee,
MultistepExprHolder head,
boolean isGlobal,
int lengthToTest,
ElemTemplateElement varScope)
{
if(null == testee.m_exprOwner)
return head;
// Start with the longest possible match, and move down.
WalkingIterator iter1 = (WalkingIterator) testee.m_exprOwner.getExpression();
if(partialIsVariable(testee, lengthToTest))
return head;
MultistepExprHolder matchedPaths = null;
MultistepExprHolder matchedPathsTail = null;
MultistepExprHolder meh = head;
while( null != meh)
{
if ((meh != testee) && (null != meh.m_exprOwner))
{
WalkingIterator iter2 = (WalkingIterator) meh.m_exprOwner.getExpression();
if (stepsEqual(iter1, iter2, lengthToTest))
{
if (null == matchedPaths)
{
try
{
matchedPaths = (MultistepExprHolder)testee.clone();
testee.m_exprOwner = null; // So it won't be processed again.
}
catch(CloneNotSupportedException cnse){}
matchedPathsTail = matchedPaths;
matchedPathsTail.m_next = null;
}
try
{
matchedPathsTail.m_next = (MultistepExprHolder)meh.clone();
meh.m_exprOwner = null; // So it won't be processed again.
}
catch(CloneNotSupportedException cnse){}
matchedPathsTail = matchedPathsTail.m_next;
matchedPathsTail.m_next = null;
}
}
meh = meh.m_next;
}
int matchCount = 0;
if(null != matchedPaths)
{
ElemTemplateElement root = isGlobal ? varScope : findCommonAncestor(matchedPaths);
WalkingIterator sharedIter = (WalkingIterator)matchedPaths.m_exprOwner.getExpression();
WalkingIterator newIter = createIteratorFromSteps(sharedIter, lengthToTest);
ElemVariable var = createPseudoVarDecl(root, newIter, isGlobal);
if(DIAGNOSE_MULTISTEPLIST)
System.err.println("Created var: "+var.getName()+(isGlobal ? "(Global)" : ""));
while(null != matchedPaths)
{
ExpressionOwner owner = matchedPaths.m_exprOwner;
WalkingIterator iter = (WalkingIterator)owner.getExpression();
if(DIAGNOSE_MULTISTEPLIST)
diagnoseLineNumber(iter);
LocPathIterator newIter2 =
changePartToRef(var.getName(), iter, lengthToTest, isGlobal);
owner.setExpression(newIter2);
matchedPaths = matchedPaths.m_next;
}
}
if(DIAGNOSE_MULTISTEPLIST)
diagnoseMultistepList(matchCount, lengthToTest, isGlobal);
return head;
} | java | protected MultistepExprHolder matchAndEliminatePartialPaths(MultistepExprHolder testee,
MultistepExprHolder head,
boolean isGlobal,
int lengthToTest,
ElemTemplateElement varScope)
{
if(null == testee.m_exprOwner)
return head;
// Start with the longest possible match, and move down.
WalkingIterator iter1 = (WalkingIterator) testee.m_exprOwner.getExpression();
if(partialIsVariable(testee, lengthToTest))
return head;
MultistepExprHolder matchedPaths = null;
MultistepExprHolder matchedPathsTail = null;
MultistepExprHolder meh = head;
while( null != meh)
{
if ((meh != testee) && (null != meh.m_exprOwner))
{
WalkingIterator iter2 = (WalkingIterator) meh.m_exprOwner.getExpression();
if (stepsEqual(iter1, iter2, lengthToTest))
{
if (null == matchedPaths)
{
try
{
matchedPaths = (MultistepExprHolder)testee.clone();
testee.m_exprOwner = null; // So it won't be processed again.
}
catch(CloneNotSupportedException cnse){}
matchedPathsTail = matchedPaths;
matchedPathsTail.m_next = null;
}
try
{
matchedPathsTail.m_next = (MultistepExprHolder)meh.clone();
meh.m_exprOwner = null; // So it won't be processed again.
}
catch(CloneNotSupportedException cnse){}
matchedPathsTail = matchedPathsTail.m_next;
matchedPathsTail.m_next = null;
}
}
meh = meh.m_next;
}
int matchCount = 0;
if(null != matchedPaths)
{
ElemTemplateElement root = isGlobal ? varScope : findCommonAncestor(matchedPaths);
WalkingIterator sharedIter = (WalkingIterator)matchedPaths.m_exprOwner.getExpression();
WalkingIterator newIter = createIteratorFromSteps(sharedIter, lengthToTest);
ElemVariable var = createPseudoVarDecl(root, newIter, isGlobal);
if(DIAGNOSE_MULTISTEPLIST)
System.err.println("Created var: "+var.getName()+(isGlobal ? "(Global)" : ""));
while(null != matchedPaths)
{
ExpressionOwner owner = matchedPaths.m_exprOwner;
WalkingIterator iter = (WalkingIterator)owner.getExpression();
if(DIAGNOSE_MULTISTEPLIST)
diagnoseLineNumber(iter);
LocPathIterator newIter2 =
changePartToRef(var.getName(), iter, lengthToTest, isGlobal);
owner.setExpression(newIter2);
matchedPaths = matchedPaths.m_next;
}
}
if(DIAGNOSE_MULTISTEPLIST)
diagnoseMultistepList(matchCount, lengthToTest, isGlobal);
return head;
} | [
"protected",
"MultistepExprHolder",
"matchAndEliminatePartialPaths",
"(",
"MultistepExprHolder",
"testee",
",",
"MultistepExprHolder",
"head",
",",
"boolean",
"isGlobal",
",",
"int",
"lengthToTest",
",",
"ElemTemplateElement",
"varScope",
")",
"{",
"if",
"(",
"null",
"=... | For a given path, see if there are any partitial matches in the list,
and, if there are, replace those partial paths with psuedo variable refs,
and create the psuedo variable decl.
@return The head of the list, which may have changed. | [
"For",
"a",
"given",
"path",
"see",
"if",
"there",
"are",
"any",
"partitial",
"matches",
"in",
"the",
"list",
"and",
"if",
"there",
"are",
"replace",
"those",
"partial",
"paths",
"with",
"psuedo",
"variable",
"refs",
"and",
"create",
"the",
"psuedo",
"vari... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L186-L262 |
33,817 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.partialIsVariable | boolean partialIsVariable(MultistepExprHolder testee, int lengthToTest)
{
if(1 == lengthToTest)
{
WalkingIterator wi = (WalkingIterator)testee.m_exprOwner.getExpression();
if(wi.getFirstWalker() instanceof FilterExprWalker)
return true;
}
return false;
} | java | boolean partialIsVariable(MultistepExprHolder testee, int lengthToTest)
{
if(1 == lengthToTest)
{
WalkingIterator wi = (WalkingIterator)testee.m_exprOwner.getExpression();
if(wi.getFirstWalker() instanceof FilterExprWalker)
return true;
}
return false;
} | [
"boolean",
"partialIsVariable",
"(",
"MultistepExprHolder",
"testee",
",",
"int",
"lengthToTest",
")",
"{",
"if",
"(",
"1",
"==",
"lengthToTest",
")",
"{",
"WalkingIterator",
"wi",
"=",
"(",
"WalkingIterator",
")",
"testee",
".",
"m_exprOwner",
".",
"getExpressi... | Check if results of partial reduction will just be a variable, in
which case, skip it. | [
"Check",
"if",
"results",
"of",
"partial",
"reduction",
"will",
"just",
"be",
"a",
"variable",
"in",
"which",
"case",
"skip",
"it",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L268-L277 |
33,818 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.diagnoseLineNumber | protected void diagnoseLineNumber(Expression expr)
{
ElemTemplateElement e = getElemFromExpression(expr);
System.err.println(" " + e.getSystemId() + " Line " + e.getLineNumber());
} | java | protected void diagnoseLineNumber(Expression expr)
{
ElemTemplateElement e = getElemFromExpression(expr);
System.err.println(" " + e.getSystemId() + " Line " + e.getLineNumber());
} | [
"protected",
"void",
"diagnoseLineNumber",
"(",
"Expression",
"expr",
")",
"{",
"ElemTemplateElement",
"e",
"=",
"getElemFromExpression",
"(",
"expr",
")",
";",
"System",
".",
"err",
".",
"println",
"(",
"\" \"",
"+",
"e",
".",
"getSystemId",
"(",
")",
"+"... | Tell what line number belongs to a given expression. | [
"Tell",
"what",
"line",
"number",
"belongs",
"to",
"a",
"given",
"expression",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L282-L286 |
33,819 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.findCommonAncestor | protected ElemTemplateElement findCommonAncestor(MultistepExprHolder head)
{
// Not sure this algorithm is the best, but will do for the moment.
int numExprs = head.getLength();
// The following could be made cheaper by pre-allocating large arrays,
// but then we would have to assume a max number of reductions,
// which I am not inclined to do right now.
ElemTemplateElement[] elems = new ElemTemplateElement[numExprs];
int[] ancestorCounts = new int[numExprs];
// Loop through, getting the parent elements, and counting the
// ancestors.
MultistepExprHolder next = head;
int shortestAncestorCount = 10000;
for(int i = 0; i < numExprs; i++)
{
ElemTemplateElement elem =
getElemFromExpression(next.m_exprOwner.getExpression());
elems[i] = elem;
int numAncestors = countAncestors(elem);
ancestorCounts[i] = numAncestors;
if(numAncestors < shortestAncestorCount)
{
shortestAncestorCount = numAncestors;
}
next = next.m_next;
}
// Now loop through and "correct" the elements that have more ancestors.
for(int i = 0; i < numExprs; i++)
{
if(ancestorCounts[i] > shortestAncestorCount)
{
int numStepCorrection = ancestorCounts[i] - shortestAncestorCount;
for(int j = 0; j < numStepCorrection; j++)
{
elems[i] = elems[i].getParentElem();
}
}
}
// Now everyone has an equal number of ancestors. Walk up from here
// equally until all are equal.
ElemTemplateElement first = null;
while(shortestAncestorCount-- >= 0)
{
boolean areEqual = true;
first = elems[0];
for(int i = 1; i < numExprs; i++)
{
if(first != elems[i])
{
areEqual = false;
break;
}
}
// This second check is to make sure we have a common ancestor that is not the same
// as the expression owner... i.e. the var decl has to go above the expression owner.
if(areEqual && isNotSameAsOwner(head, first) && first.canAcceptVariables())
{
if(DIAGNOSE_MULTISTEPLIST)
{
System.err.print(first.getClass().getName());
System.err.println(" at " + first.getSystemId() + " Line " + first.getLineNumber());
}
return first;
}
for(int i = 0; i < numExprs; i++)
{
elems[i] = elems[i].getParentElem();
}
}
assertion(false, "Could not find common ancestor!!!");
return null;
} | java | protected ElemTemplateElement findCommonAncestor(MultistepExprHolder head)
{
// Not sure this algorithm is the best, but will do for the moment.
int numExprs = head.getLength();
// The following could be made cheaper by pre-allocating large arrays,
// but then we would have to assume a max number of reductions,
// which I am not inclined to do right now.
ElemTemplateElement[] elems = new ElemTemplateElement[numExprs];
int[] ancestorCounts = new int[numExprs];
// Loop through, getting the parent elements, and counting the
// ancestors.
MultistepExprHolder next = head;
int shortestAncestorCount = 10000;
for(int i = 0; i < numExprs; i++)
{
ElemTemplateElement elem =
getElemFromExpression(next.m_exprOwner.getExpression());
elems[i] = elem;
int numAncestors = countAncestors(elem);
ancestorCounts[i] = numAncestors;
if(numAncestors < shortestAncestorCount)
{
shortestAncestorCount = numAncestors;
}
next = next.m_next;
}
// Now loop through and "correct" the elements that have more ancestors.
for(int i = 0; i < numExprs; i++)
{
if(ancestorCounts[i] > shortestAncestorCount)
{
int numStepCorrection = ancestorCounts[i] - shortestAncestorCount;
for(int j = 0; j < numStepCorrection; j++)
{
elems[i] = elems[i].getParentElem();
}
}
}
// Now everyone has an equal number of ancestors. Walk up from here
// equally until all are equal.
ElemTemplateElement first = null;
while(shortestAncestorCount-- >= 0)
{
boolean areEqual = true;
first = elems[0];
for(int i = 1; i < numExprs; i++)
{
if(first != elems[i])
{
areEqual = false;
break;
}
}
// This second check is to make sure we have a common ancestor that is not the same
// as the expression owner... i.e. the var decl has to go above the expression owner.
if(areEqual && isNotSameAsOwner(head, first) && first.canAcceptVariables())
{
if(DIAGNOSE_MULTISTEPLIST)
{
System.err.print(first.getClass().getName());
System.err.println(" at " + first.getSystemId() + " Line " + first.getLineNumber());
}
return first;
}
for(int i = 0; i < numExprs; i++)
{
elems[i] = elems[i].getParentElem();
}
}
assertion(false, "Could not find common ancestor!!!");
return null;
} | [
"protected",
"ElemTemplateElement",
"findCommonAncestor",
"(",
"MultistepExprHolder",
"head",
")",
"{",
"// Not sure this algorithm is the best, but will do for the moment.",
"int",
"numExprs",
"=",
"head",
".",
"getLength",
"(",
")",
";",
"// The following could be made cheaper ... | Given a linked list of expressions, find the common ancestor that is
suitable for holding a psuedo variable for shared access. | [
"Given",
"a",
"linked",
"list",
"of",
"expressions",
"find",
"the",
"common",
"ancestor",
"that",
"is",
"suitable",
"for",
"holding",
"a",
"psuedo",
"variable",
"for",
"shared",
"access",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L292-L368 |
33,820 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.isNotSameAsOwner | protected boolean isNotSameAsOwner(MultistepExprHolder head, ElemTemplateElement ete)
{
MultistepExprHolder next = head;
while(null != next)
{
ElemTemplateElement elemOwner = getElemFromExpression(next.m_exprOwner.getExpression());
if(elemOwner == ete)
return false;
next = next.m_next;
}
return true;
} | java | protected boolean isNotSameAsOwner(MultistepExprHolder head, ElemTemplateElement ete)
{
MultistepExprHolder next = head;
while(null != next)
{
ElemTemplateElement elemOwner = getElemFromExpression(next.m_exprOwner.getExpression());
if(elemOwner == ete)
return false;
next = next.m_next;
}
return true;
} | [
"protected",
"boolean",
"isNotSameAsOwner",
"(",
"MultistepExprHolder",
"head",
",",
"ElemTemplateElement",
"ete",
")",
"{",
"MultistepExprHolder",
"next",
"=",
"head",
";",
"while",
"(",
"null",
"!=",
"next",
")",
"{",
"ElemTemplateElement",
"elemOwner",
"=",
"ge... | Find out if the given ElemTemplateElement is not the same as one of
the ElemTemplateElement owners of the expressions.
@param head Head of linked list of expression owners.
@param ete The ElemTemplateElement that is a candidate for a psuedo
variable parent.
@return true if the given ElemTemplateElement is not the same as one of
the ElemTemplateElement owners of the expressions. This is to make sure
we find an ElemTemplateElement that is in a viable position to hold
psuedo variables that are visible to the references. | [
"Find",
"out",
"if",
"the",
"given",
"ElemTemplateElement",
"is",
"not",
"the",
"same",
"as",
"one",
"of",
"the",
"ElemTemplateElement",
"owners",
"of",
"the",
"expressions",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L382-L393 |
33,821 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.countAncestors | protected int countAncestors(ElemTemplateElement elem)
{
int count = 0;
while(null != elem)
{
count++;
elem = elem.getParentElem();
}
return count;
} | java | protected int countAncestors(ElemTemplateElement elem)
{
int count = 0;
while(null != elem)
{
count++;
elem = elem.getParentElem();
}
return count;
} | [
"protected",
"int",
"countAncestors",
"(",
"ElemTemplateElement",
"elem",
")",
"{",
"int",
"count",
"=",
"0",
";",
"while",
"(",
"null",
"!=",
"elem",
")",
"{",
"count",
"++",
";",
"elem",
"=",
"elem",
".",
"getParentElem",
"(",
")",
";",
"}",
"return"... | Count the number of ancestors that a ElemTemplateElement has.
@param elem An representation of an element in an XSLT stylesheet.
@return The number of ancestors of elem (including the element itself). | [
"Count",
"the",
"number",
"of",
"ancestors",
"that",
"a",
"ElemTemplateElement",
"has",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L401-L410 |
33,822 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.diagnoseMultistepList | protected void diagnoseMultistepList(
int matchCount,
int lengthToTest,
boolean isGlobal)
{
if (matchCount > 0)
{
System.err.print(
"Found multistep matches: " + matchCount + ", " + lengthToTest + " length");
if (isGlobal)
System.err.println(" (global)");
else
System.err.println();
}
} | java | protected void diagnoseMultistepList(
int matchCount,
int lengthToTest,
boolean isGlobal)
{
if (matchCount > 0)
{
System.err.print(
"Found multistep matches: " + matchCount + ", " + lengthToTest + " length");
if (isGlobal)
System.err.println(" (global)");
else
System.err.println();
}
} | [
"protected",
"void",
"diagnoseMultistepList",
"(",
"int",
"matchCount",
",",
"int",
"lengthToTest",
",",
"boolean",
"isGlobal",
")",
"{",
"if",
"(",
"matchCount",
">",
"0",
")",
"{",
"System",
".",
"err",
".",
"print",
"(",
"\"Found multistep matches: \"",
"+"... | Print out diagnostics about partial multistep evaluation. | [
"Print",
"out",
"diagnostics",
"about",
"partial",
"multistep",
"evaluation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L415-L429 |
33,823 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.changePartToRef | protected LocPathIterator changePartToRef(final QName uniquePseudoVarName, WalkingIterator wi,
final int numSteps, final boolean isGlobal)
{
Variable var = new Variable();
var.setQName(uniquePseudoVarName);
var.setIsGlobal(isGlobal);
if(isGlobal)
{ ElemTemplateElement elem = getElemFromExpression(wi);
StylesheetRoot root = elem.getStylesheetRoot();
Vector vars = root.getVariablesAndParamsComposed();
var.setIndex(vars.size()-1);
}
// Walk to the first walker after the one's we are replacing.
AxesWalker walker = wi.getFirstWalker();
for(int i = 0; i < numSteps; i++)
{
assertion(null != walker, "Walker should not be null!");
walker = walker.getNextWalker();
}
if(null != walker)
{
FilterExprWalker few = new FilterExprWalker(wi);
few.setInnerExpression(var);
few.exprSetParent(wi);
few.setNextWalker(walker);
walker.setPrevWalker(few);
wi.setFirstWalker(few);
return wi;
}
else
{
FilterExprIteratorSimple feis = new FilterExprIteratorSimple(var);
feis.exprSetParent(wi.exprGetParent());
return feis;
}
} | java | protected LocPathIterator changePartToRef(final QName uniquePseudoVarName, WalkingIterator wi,
final int numSteps, final boolean isGlobal)
{
Variable var = new Variable();
var.setQName(uniquePseudoVarName);
var.setIsGlobal(isGlobal);
if(isGlobal)
{ ElemTemplateElement elem = getElemFromExpression(wi);
StylesheetRoot root = elem.getStylesheetRoot();
Vector vars = root.getVariablesAndParamsComposed();
var.setIndex(vars.size()-1);
}
// Walk to the first walker after the one's we are replacing.
AxesWalker walker = wi.getFirstWalker();
for(int i = 0; i < numSteps; i++)
{
assertion(null != walker, "Walker should not be null!");
walker = walker.getNextWalker();
}
if(null != walker)
{
FilterExprWalker few = new FilterExprWalker(wi);
few.setInnerExpression(var);
few.exprSetParent(wi);
few.setNextWalker(walker);
walker.setPrevWalker(few);
wi.setFirstWalker(few);
return wi;
}
else
{
FilterExprIteratorSimple feis = new FilterExprIteratorSimple(var);
feis.exprSetParent(wi.exprGetParent());
return feis;
}
} | [
"protected",
"LocPathIterator",
"changePartToRef",
"(",
"final",
"QName",
"uniquePseudoVarName",
",",
"WalkingIterator",
"wi",
",",
"final",
"int",
"numSteps",
",",
"final",
"boolean",
"isGlobal",
")",
"{",
"Variable",
"var",
"=",
"new",
"Variable",
"(",
")",
";... | Change a given number of steps to a single variable reference.
@param uniquePseudoVarName The name of the variable reference.
@param wi The walking iterator that is to be changed.
@param numSteps The number of steps to be changed.
@param isGlobal true if this will be a global reference. | [
"Change",
"a",
"given",
"number",
"of",
"steps",
"to",
"a",
"single",
"variable",
"reference",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L439-L477 |
33,824 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.createIteratorFromSteps | protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps)
{
WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver());
try
{
AxesWalker walker = (AxesWalker)wi.getFirstWalker().clone();
newIter.setFirstWalker(walker);
walker.setLocPathIterator(newIter);
for(int i = 1; i < numSteps; i++)
{
AxesWalker next = (AxesWalker)walker.getNextWalker().clone();
walker.setNextWalker(next);
next.setLocPathIterator(newIter);
walker = next;
}
walker.setNextWalker(null);
}
catch(CloneNotSupportedException cnse)
{
throw new WrappedRuntimeException(cnse);
}
return newIter;
} | java | protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps)
{
WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver());
try
{
AxesWalker walker = (AxesWalker)wi.getFirstWalker().clone();
newIter.setFirstWalker(walker);
walker.setLocPathIterator(newIter);
for(int i = 1; i < numSteps; i++)
{
AxesWalker next = (AxesWalker)walker.getNextWalker().clone();
walker.setNextWalker(next);
next.setLocPathIterator(newIter);
walker = next;
}
walker.setNextWalker(null);
}
catch(CloneNotSupportedException cnse)
{
throw new WrappedRuntimeException(cnse);
}
return newIter;
} | [
"protected",
"WalkingIterator",
"createIteratorFromSteps",
"(",
"final",
"WalkingIterator",
"wi",
",",
"int",
"numSteps",
")",
"{",
"WalkingIterator",
"newIter",
"=",
"new",
"WalkingIterator",
"(",
"wi",
".",
"getPrefixResolver",
"(",
")",
")",
";",
"try",
"{",
... | Create a new WalkingIterator from the steps in another WalkingIterator.
@param wi The iterator from where the steps will be taken.
@param numSteps The number of steps from the first to copy into the new
iterator.
@return The new iterator. | [
"Create",
"a",
"new",
"WalkingIterator",
"from",
"the",
"steps",
"in",
"another",
"WalkingIterator",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L487-L509 |
33,825 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.stepsEqual | protected boolean stepsEqual(WalkingIterator iter1, WalkingIterator iter2,
int numSteps)
{
AxesWalker aw1 = iter1.getFirstWalker();
AxesWalker aw2 = iter2.getFirstWalker();
for(int i = 0; (i < numSteps); i++)
{
if((null == aw1) || (null == aw2))
return false;
if(!aw1.deepEquals(aw2))
return false;
aw1 = aw1.getNextWalker();
aw2 = aw2.getNextWalker();
}
assertion((null != aw1) || (null != aw2), "Total match is incorrect!");
return true;
} | java | protected boolean stepsEqual(WalkingIterator iter1, WalkingIterator iter2,
int numSteps)
{
AxesWalker aw1 = iter1.getFirstWalker();
AxesWalker aw2 = iter2.getFirstWalker();
for(int i = 0; (i < numSteps); i++)
{
if((null == aw1) || (null == aw2))
return false;
if(!aw1.deepEquals(aw2))
return false;
aw1 = aw1.getNextWalker();
aw2 = aw2.getNextWalker();
}
assertion((null != aw1) || (null != aw2), "Total match is incorrect!");
return true;
} | [
"protected",
"boolean",
"stepsEqual",
"(",
"WalkingIterator",
"iter1",
",",
"WalkingIterator",
"iter2",
",",
"int",
"numSteps",
")",
"{",
"AxesWalker",
"aw1",
"=",
"iter1",
".",
"getFirstWalker",
"(",
")",
";",
"AxesWalker",
"aw2",
"=",
"iter2",
".",
"getFirst... | Compare a given number of steps between two iterators, to see if they are equal.
@param iter1 The first iterator to compare.
@param iter2 The second iterator to compare.
@param numSteps The number of steps to compare.
@return true If the given number of steps are equal. | [
"Compare",
"a",
"given",
"number",
"of",
"steps",
"between",
"two",
"iterators",
"to",
"see",
"if",
"they",
"are",
"equal",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L520-L541 |
33,826 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.createMultistepExprList | protected MultistepExprHolder createMultistepExprList(Vector paths)
{
MultistepExprHolder first = null;
int n = paths.size();
for(int i = 0; i < n; i++)
{
ExpressionOwner eo = (ExpressionOwner)paths.elementAt(i);
if(null == eo)
continue;
// Assuming location path iterators should be OK.
LocPathIterator lpi = (LocPathIterator)eo.getExpression();
int numPaths = countSteps(lpi);
if(numPaths > 1)
{
if(null == first)
first = new MultistepExprHolder(eo, numPaths, null);
else
first = first.addInSortedOrder(eo, numPaths);
}
}
if((null == first) || (first.getLength() <= 1))
return null;
else
return first;
} | java | protected MultistepExprHolder createMultistepExprList(Vector paths)
{
MultistepExprHolder first = null;
int n = paths.size();
for(int i = 0; i < n; i++)
{
ExpressionOwner eo = (ExpressionOwner)paths.elementAt(i);
if(null == eo)
continue;
// Assuming location path iterators should be OK.
LocPathIterator lpi = (LocPathIterator)eo.getExpression();
int numPaths = countSteps(lpi);
if(numPaths > 1)
{
if(null == first)
first = new MultistepExprHolder(eo, numPaths, null);
else
first = first.addInSortedOrder(eo, numPaths);
}
}
if((null == first) || (first.getLength() <= 1))
return null;
else
return first;
} | [
"protected",
"MultistepExprHolder",
"createMultistepExprList",
"(",
"Vector",
"paths",
")",
"{",
"MultistepExprHolder",
"first",
"=",
"null",
";",
"int",
"n",
"=",
"paths",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",... | For the reduction of location path parts, create a list of all
the multistep paths with more than one step, sorted by the
number of steps, with the most steps occuring earlier in the list.
If the list is only one member, don't bother returning it.
@param paths Vector of ExpressionOwner objects, which may contain null entries.
The ExpressionOwner objects must own LocPathIterator objects.
@return null if no multipart paths are found or the list is only of length 1,
otherwise the first MultistepExprHolder in a linked list of these objects. | [
"For",
"the",
"reduction",
"of",
"location",
"path",
"parts",
"create",
"a",
"list",
"of",
"all",
"the",
"multistep",
"paths",
"with",
"more",
"than",
"one",
"step",
"sorted",
"by",
"the",
"number",
"of",
"steps",
"with",
"the",
"most",
"steps",
"occuring"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L554-L580 |
33,827 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.findAndEliminateRedundant | protected int findAndEliminateRedundant(int start, int firstOccuranceIndex,
ExpressionOwner firstOccuranceOwner,
ElemTemplateElement psuedoVarRecipient,
Vector paths)
throws org.w3c.dom.DOMException
{
MultistepExprHolder head = null;
MultistepExprHolder tail = null;
int numPathsFound = 0;
int n = paths.size();
Expression expr1 = firstOccuranceOwner.getExpression();
if(DEBUG)
assertIsLocPathIterator(expr1, firstOccuranceOwner);
boolean isGlobal = (paths == m_absPaths);
LocPathIterator lpi = (LocPathIterator)expr1;
int stepCount = countSteps(lpi);
for(int j = start; j < n; j++)
{
ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j);
if(null != owner2)
{
Expression expr2 = owner2.getExpression();
boolean isEqual = expr2.deepEquals(lpi);
if(isEqual)
{
LocPathIterator lpi2 = (LocPathIterator)expr2;
if(null == head)
{
head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
tail = head;
numPathsFound++;
}
tail.m_next = new MultistepExprHolder(owner2, stepCount, null);
tail = tail.m_next;
// Null out the occurance, so we don't have to test it again.
paths.setElementAt(null, j);
// foundFirst = true;
numPathsFound++;
}
}
}
// Change all globals in xsl:templates, etc, to global vars no matter what.
if((0 == numPathsFound) && isGlobal)
{
head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
numPathsFound++;
}
if(null != head)
{
ElemTemplateElement root = isGlobal ? psuedoVarRecipient : findCommonAncestor(head);
LocPathIterator sharedIter = (LocPathIterator)head.m_exprOwner.getExpression();
ElemVariable var = createPseudoVarDecl(root, sharedIter, isGlobal);
if(DIAGNOSE_MULTISTEPLIST)
System.err.println("Created var: "+var.getName()+(isGlobal ? "(Global)" : ""));
QName uniquePseudoVarName = var.getName();
while(null != head)
{
ExpressionOwner owner = head.m_exprOwner;
if(DIAGNOSE_MULTISTEPLIST)
diagnoseLineNumber(owner.getExpression());
changeToVarRef(uniquePseudoVarName, owner, paths, root);
head = head.m_next;
}
// Replace the first occurance with the variable's XPath, so
// that further reduction may take place if needed.
paths.setElementAt(var.getSelect(), firstOccuranceIndex);
}
return numPathsFound;
} | java | protected int findAndEliminateRedundant(int start, int firstOccuranceIndex,
ExpressionOwner firstOccuranceOwner,
ElemTemplateElement psuedoVarRecipient,
Vector paths)
throws org.w3c.dom.DOMException
{
MultistepExprHolder head = null;
MultistepExprHolder tail = null;
int numPathsFound = 0;
int n = paths.size();
Expression expr1 = firstOccuranceOwner.getExpression();
if(DEBUG)
assertIsLocPathIterator(expr1, firstOccuranceOwner);
boolean isGlobal = (paths == m_absPaths);
LocPathIterator lpi = (LocPathIterator)expr1;
int stepCount = countSteps(lpi);
for(int j = start; j < n; j++)
{
ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j);
if(null != owner2)
{
Expression expr2 = owner2.getExpression();
boolean isEqual = expr2.deepEquals(lpi);
if(isEqual)
{
LocPathIterator lpi2 = (LocPathIterator)expr2;
if(null == head)
{
head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
tail = head;
numPathsFound++;
}
tail.m_next = new MultistepExprHolder(owner2, stepCount, null);
tail = tail.m_next;
// Null out the occurance, so we don't have to test it again.
paths.setElementAt(null, j);
// foundFirst = true;
numPathsFound++;
}
}
}
// Change all globals in xsl:templates, etc, to global vars no matter what.
if((0 == numPathsFound) && isGlobal)
{
head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
numPathsFound++;
}
if(null != head)
{
ElemTemplateElement root = isGlobal ? psuedoVarRecipient : findCommonAncestor(head);
LocPathIterator sharedIter = (LocPathIterator)head.m_exprOwner.getExpression();
ElemVariable var = createPseudoVarDecl(root, sharedIter, isGlobal);
if(DIAGNOSE_MULTISTEPLIST)
System.err.println("Created var: "+var.getName()+(isGlobal ? "(Global)" : ""));
QName uniquePseudoVarName = var.getName();
while(null != head)
{
ExpressionOwner owner = head.m_exprOwner;
if(DIAGNOSE_MULTISTEPLIST)
diagnoseLineNumber(owner.getExpression());
changeToVarRef(uniquePseudoVarName, owner, paths, root);
head = head.m_next;
}
// Replace the first occurance with the variable's XPath, so
// that further reduction may take place if needed.
paths.setElementAt(var.getSelect(), firstOccuranceIndex);
}
return numPathsFound;
} | [
"protected",
"int",
"findAndEliminateRedundant",
"(",
"int",
"start",
",",
"int",
"firstOccuranceIndex",
",",
"ExpressionOwner",
"firstOccuranceOwner",
",",
"ElemTemplateElement",
"psuedoVarRecipient",
",",
"Vector",
"paths",
")",
"throws",
"org",
".",
"w3c",
".",
"do... | Look through the vector from start point, looking for redundant occurances.
When one or more are found, create a psuedo variable declaration, insert
it into the stylesheet, and replace the occurance with a reference to
the psuedo variable. When a redundent variable is found, it's slot in
the vector will be replaced by null.
@param start The position to start looking in the vector.
@param firstOccuranceIndex The position of firstOccuranceOwner.
@param firstOccuranceOwner The owner of the expression we are looking for.
@param psuedoVarRecipient Where to put the psuedo variables.
@return The number of expression occurances that were modified. | [
"Look",
"through",
"the",
"vector",
"from",
"start",
"point",
"looking",
"for",
"redundant",
"occurances",
".",
"When",
"one",
"or",
"more",
"are",
"found",
"create",
"a",
"psuedo",
"variable",
"declaration",
"insert",
"it",
"into",
"the",
"stylesheet",
"and",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L596-L670 |
33,828 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.oldFindAndEliminateRedundant | protected int oldFindAndEliminateRedundant(int start, int firstOccuranceIndex,
ExpressionOwner firstOccuranceOwner,
ElemTemplateElement psuedoVarRecipient,
Vector paths)
throws org.w3c.dom.DOMException
{
QName uniquePseudoVarName = null;
boolean foundFirst = false;
int numPathsFound = 0;
int n = paths.size();
Expression expr1 = firstOccuranceOwner.getExpression();
if(DEBUG)
assertIsLocPathIterator(expr1, firstOccuranceOwner);
boolean isGlobal = (paths == m_absPaths);
LocPathIterator lpi = (LocPathIterator)expr1;
for(int j = start; j < n; j++)
{
ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j);
if(null != owner2)
{
Expression expr2 = owner2.getExpression();
boolean isEqual = expr2.deepEquals(lpi);
if(isEqual)
{
LocPathIterator lpi2 = (LocPathIterator)expr2;
if(!foundFirst)
{
foundFirst = true;
// Insert variable decl into psuedoVarRecipient
// We want to insert this into the first legitimate
// position for a variable.
ElemVariable var = createPseudoVarDecl(psuedoVarRecipient, lpi, isGlobal);
if(null == var)
return 0;
uniquePseudoVarName = var.getName();
changeToVarRef(uniquePseudoVarName, firstOccuranceOwner,
paths, psuedoVarRecipient);
// Replace the first occurance with the variable's XPath, so
// that further reduction may take place if needed.
paths.setElementAt(var.getSelect(), firstOccuranceIndex);
numPathsFound++;
}
changeToVarRef(uniquePseudoVarName, owner2, paths, psuedoVarRecipient);
// Null out the occurance, so we don't have to test it again.
paths.setElementAt(null, j);
// foundFirst = true;
numPathsFound++;
}
}
}
// Change all globals in xsl:templates, etc, to global vars no matter what.
if((0 == numPathsFound) && (paths == m_absPaths))
{
ElemVariable var = createPseudoVarDecl(psuedoVarRecipient, lpi, true);
if(null == var)
return 0;
uniquePseudoVarName = var.getName();
changeToVarRef(uniquePseudoVarName, firstOccuranceOwner, paths, psuedoVarRecipient);
paths.setElementAt(var.getSelect(), firstOccuranceIndex);
numPathsFound++;
}
return numPathsFound;
} | java | protected int oldFindAndEliminateRedundant(int start, int firstOccuranceIndex,
ExpressionOwner firstOccuranceOwner,
ElemTemplateElement psuedoVarRecipient,
Vector paths)
throws org.w3c.dom.DOMException
{
QName uniquePseudoVarName = null;
boolean foundFirst = false;
int numPathsFound = 0;
int n = paths.size();
Expression expr1 = firstOccuranceOwner.getExpression();
if(DEBUG)
assertIsLocPathIterator(expr1, firstOccuranceOwner);
boolean isGlobal = (paths == m_absPaths);
LocPathIterator lpi = (LocPathIterator)expr1;
for(int j = start; j < n; j++)
{
ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j);
if(null != owner2)
{
Expression expr2 = owner2.getExpression();
boolean isEqual = expr2.deepEquals(lpi);
if(isEqual)
{
LocPathIterator lpi2 = (LocPathIterator)expr2;
if(!foundFirst)
{
foundFirst = true;
// Insert variable decl into psuedoVarRecipient
// We want to insert this into the first legitimate
// position for a variable.
ElemVariable var = createPseudoVarDecl(psuedoVarRecipient, lpi, isGlobal);
if(null == var)
return 0;
uniquePseudoVarName = var.getName();
changeToVarRef(uniquePseudoVarName, firstOccuranceOwner,
paths, psuedoVarRecipient);
// Replace the first occurance with the variable's XPath, so
// that further reduction may take place if needed.
paths.setElementAt(var.getSelect(), firstOccuranceIndex);
numPathsFound++;
}
changeToVarRef(uniquePseudoVarName, owner2, paths, psuedoVarRecipient);
// Null out the occurance, so we don't have to test it again.
paths.setElementAt(null, j);
// foundFirst = true;
numPathsFound++;
}
}
}
// Change all globals in xsl:templates, etc, to global vars no matter what.
if((0 == numPathsFound) && (paths == m_absPaths))
{
ElemVariable var = createPseudoVarDecl(psuedoVarRecipient, lpi, true);
if(null == var)
return 0;
uniquePseudoVarName = var.getName();
changeToVarRef(uniquePseudoVarName, firstOccuranceOwner, paths, psuedoVarRecipient);
paths.setElementAt(var.getSelect(), firstOccuranceIndex);
numPathsFound++;
}
return numPathsFound;
} | [
"protected",
"int",
"oldFindAndEliminateRedundant",
"(",
"int",
"start",
",",
"int",
"firstOccuranceIndex",
",",
"ExpressionOwner",
"firstOccuranceOwner",
",",
"ElemTemplateElement",
"psuedoVarRecipient",
",",
"Vector",
"paths",
")",
"throws",
"org",
".",
"w3c",
".",
... | To be removed. | [
"To",
"be",
"removed",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L675-L743 |
33,829 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.countSteps | protected int countSteps(LocPathIterator lpi)
{
if(lpi instanceof WalkingIterator)
{
WalkingIterator wi = (WalkingIterator)lpi;
AxesWalker aw = wi.getFirstWalker();
int count = 0;
while(null != aw)
{
count++;
aw = aw.getNextWalker();
}
return count;
}
else
return 1;
} | java | protected int countSteps(LocPathIterator lpi)
{
if(lpi instanceof WalkingIterator)
{
WalkingIterator wi = (WalkingIterator)lpi;
AxesWalker aw = wi.getFirstWalker();
int count = 0;
while(null != aw)
{
count++;
aw = aw.getNextWalker();
}
return count;
}
else
return 1;
} | [
"protected",
"int",
"countSteps",
"(",
"LocPathIterator",
"lpi",
")",
"{",
"if",
"(",
"lpi",
"instanceof",
"WalkingIterator",
")",
"{",
"WalkingIterator",
"wi",
"=",
"(",
"WalkingIterator",
")",
"lpi",
";",
"AxesWalker",
"aw",
"=",
"wi",
".",
"getFirstWalker",... | Count the steps in a given location path.
@param lpi The location path iterator that owns the steps.
@return The number of steps in the given location path. | [
"Count",
"the",
"steps",
"in",
"a",
"given",
"location",
"path",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L751-L767 |
33,830 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.changeToVarRef | protected void changeToVarRef(QName varName, ExpressionOwner owner,
Vector paths, ElemTemplateElement psuedoVarRecipient)
{
Variable varRef = (paths == m_absPaths) ? new VariableSafeAbsRef() : new Variable();
varRef.setQName(varName);
if(paths == m_absPaths)
{
StylesheetRoot root = (StylesheetRoot)psuedoVarRecipient;
Vector globalVars = root.getVariablesAndParamsComposed();
// Assume this operation is occuring just after the decl has
// been added.
varRef.setIndex(globalVars.size()-1);
varRef.setIsGlobal(true);
}
owner.setExpression(varRef);
} | java | protected void changeToVarRef(QName varName, ExpressionOwner owner,
Vector paths, ElemTemplateElement psuedoVarRecipient)
{
Variable varRef = (paths == m_absPaths) ? new VariableSafeAbsRef() : new Variable();
varRef.setQName(varName);
if(paths == m_absPaths)
{
StylesheetRoot root = (StylesheetRoot)psuedoVarRecipient;
Vector globalVars = root.getVariablesAndParamsComposed();
// Assume this operation is occuring just after the decl has
// been added.
varRef.setIndex(globalVars.size()-1);
varRef.setIsGlobal(true);
}
owner.setExpression(varRef);
} | [
"protected",
"void",
"changeToVarRef",
"(",
"QName",
"varName",
",",
"ExpressionOwner",
"owner",
",",
"Vector",
"paths",
",",
"ElemTemplateElement",
"psuedoVarRecipient",
")",
"{",
"Variable",
"varRef",
"=",
"(",
"paths",
"==",
"m_absPaths",
")",
"?",
"new",
"Va... | Change the expression owned by the owner argument to a variable reference
of the given name.
Warning: For global vars, this function relies on the variable declaration
to which it refers having been added just prior to this function being called,
so that the reference index can be determined from the size of the global variables
list minus one.
@param varName The name of the variable which will be referenced.
@param owner The owner of the expression which will be replaced by a variable ref.
@param paths The paths list that the iterator came from, mainly to determine
if this is a local or global reduction.
@param psuedoVarRecipient The element within whose scope the variable is
being inserted, possibly a StylesheetRoot. | [
"Change",
"the",
"expression",
"owned",
"by",
"the",
"owner",
"argument",
"to",
"a",
"variable",
"reference",
"of",
"the",
"given",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L785-L800 |
33,831 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.createPseudoVarDecl | protected ElemVariable createPseudoVarDecl(
ElemTemplateElement psuedoVarRecipient,
LocPathIterator lpi, boolean isGlobal)
throws org.w3c.dom.DOMException
{
QName uniquePseudoVarName = new QName (PSUEDOVARNAMESPACE, "#"+getPseudoVarID());
if(isGlobal)
{
return createGlobalPseudoVarDecl(uniquePseudoVarName,
(StylesheetRoot)psuedoVarRecipient, lpi);
}
else
return createLocalPseudoVarDecl(uniquePseudoVarName, psuedoVarRecipient, lpi);
} | java | protected ElemVariable createPseudoVarDecl(
ElemTemplateElement psuedoVarRecipient,
LocPathIterator lpi, boolean isGlobal)
throws org.w3c.dom.DOMException
{
QName uniquePseudoVarName = new QName (PSUEDOVARNAMESPACE, "#"+getPseudoVarID());
if(isGlobal)
{
return createGlobalPseudoVarDecl(uniquePseudoVarName,
(StylesheetRoot)psuedoVarRecipient, lpi);
}
else
return createLocalPseudoVarDecl(uniquePseudoVarName, psuedoVarRecipient, lpi);
} | [
"protected",
"ElemVariable",
"createPseudoVarDecl",
"(",
"ElemTemplateElement",
"psuedoVarRecipient",
",",
"LocPathIterator",
"lpi",
",",
"boolean",
"isGlobal",
")",
"throws",
"org",
".",
"w3c",
".",
"dom",
".",
"DOMException",
"{",
"QName",
"uniquePseudoVarName",
"="... | Create a psuedo variable reference that will represent the
shared redundent XPath, and add it to the stylesheet.
@param psuedoVarRecipient The broadest scope of where the variable
should be inserted, usually an xsl:template or xsl:for-each.
@param lpi The LocationPathIterator that the variable should represent.
@param isGlobal true if the paths are global.
@return The new psuedo var element. | [
"Create",
"a",
"psuedo",
"variable",
"reference",
"that",
"will",
"represent",
"the",
"shared",
"redundent",
"XPath",
"and",
"add",
"it",
"to",
"the",
"stylesheet",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L816-L830 |
33,832 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.addVarDeclToElem | protected ElemVariable addVarDeclToElem(
ElemTemplateElement psuedoVarRecipient,
LocPathIterator lpi,
ElemVariable psuedoVar)
throws org.w3c.dom.DOMException
{
// Create psuedo variable element
ElemTemplateElement ete = psuedoVarRecipient.getFirstChildElem();
lpi.callVisitors(null, m_varNameCollector);
// If the location path contains variables, we have to insert the
// psuedo variable after the reference. (Otherwise, we want to
// insert it as close as possible to the top, so we'll be sure
// it is in scope for any other vars.
if (m_varNameCollector.getVarCount() > 0)
{
ElemTemplateElement baseElem = getElemFromExpression(lpi);
ElemVariable varElem = getPrevVariableElem(baseElem);
while (null != varElem)
{
if (m_varNameCollector.doesOccur(varElem.getName()))
{
psuedoVarRecipient = varElem.getParentElem();
ete = varElem.getNextSiblingElem();
break;
}
varElem = getPrevVariableElem(varElem);
}
}
if ((null != ete) && (Constants.ELEMNAME_PARAMVARIABLE == ete.getXSLToken()))
{
// Can't stick something in front of a param, so abandon! (see variable13.xsl)
if(isParam(lpi))
return null;
while (null != ete)
{
ete = ete.getNextSiblingElem();
if ((null != ete) && Constants.ELEMNAME_PARAMVARIABLE != ete.getXSLToken())
break;
}
}
psuedoVarRecipient.insertBefore(psuedoVar, ete);
m_varNameCollector.reset();
return psuedoVar;
} | java | protected ElemVariable addVarDeclToElem(
ElemTemplateElement psuedoVarRecipient,
LocPathIterator lpi,
ElemVariable psuedoVar)
throws org.w3c.dom.DOMException
{
// Create psuedo variable element
ElemTemplateElement ete = psuedoVarRecipient.getFirstChildElem();
lpi.callVisitors(null, m_varNameCollector);
// If the location path contains variables, we have to insert the
// psuedo variable after the reference. (Otherwise, we want to
// insert it as close as possible to the top, so we'll be sure
// it is in scope for any other vars.
if (m_varNameCollector.getVarCount() > 0)
{
ElemTemplateElement baseElem = getElemFromExpression(lpi);
ElemVariable varElem = getPrevVariableElem(baseElem);
while (null != varElem)
{
if (m_varNameCollector.doesOccur(varElem.getName()))
{
psuedoVarRecipient = varElem.getParentElem();
ete = varElem.getNextSiblingElem();
break;
}
varElem = getPrevVariableElem(varElem);
}
}
if ((null != ete) && (Constants.ELEMNAME_PARAMVARIABLE == ete.getXSLToken()))
{
// Can't stick something in front of a param, so abandon! (see variable13.xsl)
if(isParam(lpi))
return null;
while (null != ete)
{
ete = ete.getNextSiblingElem();
if ((null != ete) && Constants.ELEMNAME_PARAMVARIABLE != ete.getXSLToken())
break;
}
}
psuedoVarRecipient.insertBefore(psuedoVar, ete);
m_varNameCollector.reset();
return psuedoVar;
} | [
"protected",
"ElemVariable",
"addVarDeclToElem",
"(",
"ElemTemplateElement",
"psuedoVarRecipient",
",",
"LocPathIterator",
"lpi",
",",
"ElemVariable",
"psuedoVar",
")",
"throws",
"org",
".",
"w3c",
".",
"dom",
".",
"DOMException",
"{",
"// Create psuedo variable element",... | Add the given variable to the psuedoVarRecipient. | [
"Add",
"the",
"given",
"variable",
"to",
"the",
"psuedoVarRecipient",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L895-L942 |
33,833 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.getElemFromExpression | protected ElemTemplateElement getElemFromExpression(Expression expr)
{
ExpressionNode parent = expr.exprGetParent();
while(null != parent)
{
if(parent instanceof ElemTemplateElement)
return (ElemTemplateElement)parent;
parent = parent.exprGetParent();
}
throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_ASSERT_NO_TEMPLATE_PARENT, null));
// "Programmer's error! expr has no ElemTemplateElement parent!");
} | java | protected ElemTemplateElement getElemFromExpression(Expression expr)
{
ExpressionNode parent = expr.exprGetParent();
while(null != parent)
{
if(parent instanceof ElemTemplateElement)
return (ElemTemplateElement)parent;
parent = parent.exprGetParent();
}
throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_ASSERT_NO_TEMPLATE_PARENT, null));
// "Programmer's error! expr has no ElemTemplateElement parent!");
} | [
"protected",
"ElemTemplateElement",
"getElemFromExpression",
"(",
"Expression",
"expr",
")",
"{",
"ExpressionNode",
"parent",
"=",
"expr",
".",
"exprGetParent",
"(",
")",
";",
"while",
"(",
"null",
"!=",
"parent",
")",
"{",
"if",
"(",
"parent",
"instanceof",
"... | From an XPath expression component, get the ElemTemplateElement
owner.
@param expr Should be static expression with proper parentage.
@return Valid ElemTemplateElement, or throw a runtime exception
if it is not found. | [
"From",
"an",
"XPath",
"expression",
"component",
"get",
"the",
"ElemTemplateElement",
"owner",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L1036-L1047 |
33,834 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.isAbsolute | public boolean isAbsolute(LocPathIterator path)
{
int analysis = path.getAnalysisBits();
boolean isAbs = (WalkerFactory.isSet(analysis, WalkerFactory.BIT_ROOT) ||
WalkerFactory.isSet(analysis, WalkerFactory.BIT_ANY_DESCENDANT_FROM_ROOT));
if(isAbs)
{
isAbs = m_absPathChecker.checkAbsolute(path);
}
return isAbs;
} | java | public boolean isAbsolute(LocPathIterator path)
{
int analysis = path.getAnalysisBits();
boolean isAbs = (WalkerFactory.isSet(analysis, WalkerFactory.BIT_ROOT) ||
WalkerFactory.isSet(analysis, WalkerFactory.BIT_ANY_DESCENDANT_FROM_ROOT));
if(isAbs)
{
isAbs = m_absPathChecker.checkAbsolute(path);
}
return isAbs;
} | [
"public",
"boolean",
"isAbsolute",
"(",
"LocPathIterator",
"path",
")",
"{",
"int",
"analysis",
"=",
"path",
".",
"getAnalysisBits",
"(",
")",
";",
"boolean",
"isAbs",
"=",
"(",
"WalkerFactory",
".",
"isSet",
"(",
"analysis",
",",
"WalkerFactory",
".",
"BIT_... | Tell if the given LocPathIterator is relative to an absolute path, i.e.
in not dependent on the context.
@return true if the LocPathIterator is not dependent on the context node. | [
"Tell",
"if",
"the",
"given",
"LocPathIterator",
"is",
"relative",
"to",
"an",
"absolute",
"path",
"i",
".",
"e",
".",
"in",
"not",
"dependent",
"on",
"the",
"context",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L1055-L1065 |
33,835 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.visitLocationPath | public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
// Don't optimize "." or single step variable paths.
// Both of these cases could use some further optimization by themselves.
if(path instanceof SelfIteratorNoPredicate)
{
return true;
}
else if(path instanceof WalkingIterator)
{
WalkingIterator wi = (WalkingIterator)path;
AxesWalker aw = wi.getFirstWalker();
if((aw instanceof FilterExprWalker) && (null == aw.getNextWalker()))
{
FilterExprWalker few = (FilterExprWalker)aw;
Expression exp = few.getInnerExpression();
if(exp instanceof Variable)
return true;
}
}
if (isAbsolute(path) && (null != m_absPaths))
{
if(DEBUG)
validateNewAddition(m_absPaths, owner, path);
m_absPaths.addElement(owner);
}
else if (m_isSameContext && (null != m_paths))
{
if(DEBUG)
validateNewAddition(m_paths, owner, path);
m_paths.addElement(owner);
}
return true;
} | java | public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
// Don't optimize "." or single step variable paths.
// Both of these cases could use some further optimization by themselves.
if(path instanceof SelfIteratorNoPredicate)
{
return true;
}
else if(path instanceof WalkingIterator)
{
WalkingIterator wi = (WalkingIterator)path;
AxesWalker aw = wi.getFirstWalker();
if((aw instanceof FilterExprWalker) && (null == aw.getNextWalker()))
{
FilterExprWalker few = (FilterExprWalker)aw;
Expression exp = few.getInnerExpression();
if(exp instanceof Variable)
return true;
}
}
if (isAbsolute(path) && (null != m_absPaths))
{
if(DEBUG)
validateNewAddition(m_absPaths, owner, path);
m_absPaths.addElement(owner);
}
else if (m_isSameContext && (null != m_paths))
{
if(DEBUG)
validateNewAddition(m_paths, owner, path);
m_paths.addElement(owner);
}
return true;
} | [
"public",
"boolean",
"visitLocationPath",
"(",
"ExpressionOwner",
"owner",
",",
"LocPathIterator",
"path",
")",
"{",
"// Don't optimize \".\" or single step variable paths.",
"// Both of these cases could use some further optimization by themselves.",
"if",
"(",
"path",
"instanceof",... | Visit a LocationPath.
@param owner The owner of the expression, to which the expression can
be reset if rewriting takes place.
@param path The LocationPath object.
@return true if the sub expressions should be traversed. | [
"Visit",
"a",
"LocationPath",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L1075-L1110 |
33,836 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.visitTopLevelInstruction | public boolean visitTopLevelInstruction(ElemTemplateElement elem)
{
int type = elem.getXSLToken();
switch(type)
{
case Constants.ELEMNAME_TEMPLATE :
return visitInstruction(elem);
default:
return true;
}
} | java | public boolean visitTopLevelInstruction(ElemTemplateElement elem)
{
int type = elem.getXSLToken();
switch(type)
{
case Constants.ELEMNAME_TEMPLATE :
return visitInstruction(elem);
default:
return true;
}
} | [
"public",
"boolean",
"visitTopLevelInstruction",
"(",
"ElemTemplateElement",
"elem",
")",
"{",
"int",
"type",
"=",
"elem",
".",
"getXSLToken",
"(",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"Constants",
".",
"ELEMNAME_TEMPLATE",
":",
"return",
"visitI... | Visit an XSLT top-level instruction.
@param elem The xsl instruction element object.
@return true if the sub expressions should be traversed. | [
"Visit",
"an",
"XSLT",
"top",
"-",
"level",
"instruction",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L1143-L1153 |
33,837 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.visitInstruction | public boolean visitInstruction(ElemTemplateElement elem)
{
int type = elem.getXSLToken();
switch (type)
{
case Constants.ELEMNAME_CALLTEMPLATE :
case Constants.ELEMNAME_TEMPLATE :
case Constants.ELEMNAME_FOREACH :
{
// Just get the select value.
if(type == Constants.ELEMNAME_FOREACH)
{
ElemForEach efe = (ElemForEach) elem;
Expression select = efe.getSelect();
select.callVisitors(efe, this);
}
Vector savedPaths = m_paths;
m_paths = new Vector();
// Visit children. Call the superclass callChildVisitors, because
// we don't want to visit the xsl:for-each select attribute, or, for
// that matter, the xsl:template's match attribute.
elem.callChildVisitors(this, false);
eleminateRedundentLocals(elem);
m_paths = savedPaths;
// select.callVisitors(efe, this);
return false;
}
case Constants.ELEMNAME_NUMBER :
case Constants.ELEMNAME_SORT :
// Just collect absolute paths until and unless we can fully
// analyze these cases.
boolean savedIsSame = m_isSameContext;
m_isSameContext = false;
elem.callChildVisitors(this);
m_isSameContext = savedIsSame;
return false;
default :
return true;
}
} | java | public boolean visitInstruction(ElemTemplateElement elem)
{
int type = elem.getXSLToken();
switch (type)
{
case Constants.ELEMNAME_CALLTEMPLATE :
case Constants.ELEMNAME_TEMPLATE :
case Constants.ELEMNAME_FOREACH :
{
// Just get the select value.
if(type == Constants.ELEMNAME_FOREACH)
{
ElemForEach efe = (ElemForEach) elem;
Expression select = efe.getSelect();
select.callVisitors(efe, this);
}
Vector savedPaths = m_paths;
m_paths = new Vector();
// Visit children. Call the superclass callChildVisitors, because
// we don't want to visit the xsl:for-each select attribute, or, for
// that matter, the xsl:template's match attribute.
elem.callChildVisitors(this, false);
eleminateRedundentLocals(elem);
m_paths = savedPaths;
// select.callVisitors(efe, this);
return false;
}
case Constants.ELEMNAME_NUMBER :
case Constants.ELEMNAME_SORT :
// Just collect absolute paths until and unless we can fully
// analyze these cases.
boolean savedIsSame = m_isSameContext;
m_isSameContext = false;
elem.callChildVisitors(this);
m_isSameContext = savedIsSame;
return false;
default :
return true;
}
} | [
"public",
"boolean",
"visitInstruction",
"(",
"ElemTemplateElement",
"elem",
")",
"{",
"int",
"type",
"=",
"elem",
".",
"getXSLToken",
"(",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"Constants",
".",
"ELEMNAME_CALLTEMPLATE",
":",
"case",
"Constants",
... | Visit an XSLT instruction. Any element that isn't called by one
of the other visit methods, will be called by this method.
@param elem The xsl instruction element object.
@return true if the sub expressions should be traversed. | [
"Visit",
"an",
"XSLT",
"instruction",
".",
"Any",
"element",
"that",
"isn",
"t",
"called",
"by",
"one",
"of",
"the",
"other",
"visit",
"methods",
"will",
"be",
"called",
"by",
"this",
"method",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L1163-L1209 |
33,838 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.diagnoseNumPaths | protected void diagnoseNumPaths(Vector paths, int numPathsEliminated,
int numUniquePathsEliminated)
{
if (numPathsEliminated > 0)
{
if(paths == m_paths)
{
System.err.println("Eliminated " + numPathsEliminated + " total paths!");
System.err.println(
"Consolodated " + numUniquePathsEliminated + " redundent paths!");
}
else
{
System.err.println("Eliminated " + numPathsEliminated + " total global paths!");
System.err.println(
"Consolodated " + numUniquePathsEliminated + " redundent global paths!");
}
}
} | java | protected void diagnoseNumPaths(Vector paths, int numPathsEliminated,
int numUniquePathsEliminated)
{
if (numPathsEliminated > 0)
{
if(paths == m_paths)
{
System.err.println("Eliminated " + numPathsEliminated + " total paths!");
System.err.println(
"Consolodated " + numUniquePathsEliminated + " redundent paths!");
}
else
{
System.err.println("Eliminated " + numPathsEliminated + " total global paths!");
System.err.println(
"Consolodated " + numUniquePathsEliminated + " redundent global paths!");
}
}
} | [
"protected",
"void",
"diagnoseNumPaths",
"(",
"Vector",
"paths",
",",
"int",
"numPathsEliminated",
",",
"int",
"numUniquePathsEliminated",
")",
"{",
"if",
"(",
"numPathsEliminated",
">",
"0",
")",
"{",
"if",
"(",
"paths",
"==",
"m_paths",
")",
"{",
"System",
... | Print out to std err the number of paths reduced. | [
"Print",
"out",
"to",
"std",
"err",
"the",
"number",
"of",
"paths",
"reduced",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L1216-L1234 |
33,839 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.assertIsLocPathIterator | private final void assertIsLocPathIterator(Expression expr1, ExpressionOwner eo)
throws RuntimeException
{
if(!(expr1 instanceof LocPathIterator))
{
String errMsg;
if(expr1 instanceof Variable)
{
errMsg = "Programmer's assertion: expr1 not an iterator: "+
((Variable)expr1).getQName();
}
else
{
errMsg = "Programmer's assertion: expr1 not an iterator: "+
expr1.getClass().getName();
}
throw new RuntimeException(errMsg + ", "+
eo.getClass().getName()+" "+
expr1.exprGetParent());
}
} | java | private final void assertIsLocPathIterator(Expression expr1, ExpressionOwner eo)
throws RuntimeException
{
if(!(expr1 instanceof LocPathIterator))
{
String errMsg;
if(expr1 instanceof Variable)
{
errMsg = "Programmer's assertion: expr1 not an iterator: "+
((Variable)expr1).getQName();
}
else
{
errMsg = "Programmer's assertion: expr1 not an iterator: "+
expr1.getClass().getName();
}
throw new RuntimeException(errMsg + ", "+
eo.getClass().getName()+" "+
expr1.exprGetParent());
}
} | [
"private",
"final",
"void",
"assertIsLocPathIterator",
"(",
"Expression",
"expr1",
",",
"ExpressionOwner",
"eo",
")",
"throws",
"RuntimeException",
"{",
"if",
"(",
"!",
"(",
"expr1",
"instanceof",
"LocPathIterator",
")",
")",
"{",
"String",
"errMsg",
";",
"if",
... | Assert that the expression is a LocPathIterator, and, if
not, try to give some diagnostic info. | [
"Assert",
"that",
"the",
"expression",
"is",
"a",
"LocPathIterator",
"and",
"if",
"not",
"try",
"to",
"give",
"some",
"diagnostic",
"info",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L1241-L1261 |
33,840 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.validateNewAddition | private static void validateNewAddition(Vector paths, ExpressionOwner owner,
LocPathIterator path)
throws RuntimeException
{
assertion(owner.getExpression() == path, "owner.getExpression() != path!!!");
int n = paths.size();
// There should never be any duplicates in the list!
for(int i = 0; i < n; i++)
{
ExpressionOwner ew = (ExpressionOwner)paths.elementAt(i);
assertion(ew != owner, "duplicate owner on the list!!!");
assertion(ew.getExpression() != path, "duplicate expression on the list!!!");
}
} | java | private static void validateNewAddition(Vector paths, ExpressionOwner owner,
LocPathIterator path)
throws RuntimeException
{
assertion(owner.getExpression() == path, "owner.getExpression() != path!!!");
int n = paths.size();
// There should never be any duplicates in the list!
for(int i = 0; i < n; i++)
{
ExpressionOwner ew = (ExpressionOwner)paths.elementAt(i);
assertion(ew != owner, "duplicate owner on the list!!!");
assertion(ew.getExpression() != path, "duplicate expression on the list!!!");
}
} | [
"private",
"static",
"void",
"validateNewAddition",
"(",
"Vector",
"paths",
",",
"ExpressionOwner",
"owner",
",",
"LocPathIterator",
"path",
")",
"throws",
"RuntimeException",
"{",
"assertion",
"(",
"owner",
".",
"getExpression",
"(",
")",
"==",
"path",
",",
"\"... | Validate some assumptions about the new LocPathIterator and it's
owner and the state of the list. | [
"Validate",
"some",
"assumptions",
"about",
"the",
"new",
"LocPathIterator",
"and",
"it",
"s",
"owner",
"and",
"the",
"state",
"of",
"the",
"list",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L1268-L1281 |
33,841 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.assertion | protected static void assertion(boolean b, String msg)
{
if(!b)
{
throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, new Object[]{msg}));
// "Programmer's assertion in RundundentExprEliminator: "+msg);
}
} | java | protected static void assertion(boolean b, String msg)
{
if(!b)
{
throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR, new Object[]{msg}));
// "Programmer's assertion in RundundentExprEliminator: "+msg);
}
} | [
"protected",
"static",
"void",
"assertion",
"(",
"boolean",
"b",
",",
"String",
"msg",
")",
"{",
"if",
"(",
"!",
"b",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createMessage",
"(",
"XSLTErrorResources",
".",
"ER_ASSERT_REDUNDENT_E... | Simple assertion. | [
"Simple",
"assertion",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L1286-L1293 |
33,842 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinTask.java | ForkJoinTask.expungeStaleExceptions | private static void expungeStaleExceptions() {
for (Object x; (x = exceptionTableRefQueue.poll()) != null;) {
if (x instanceof ExceptionNode) {
int hashCode = ((ExceptionNode)x).hashCode;
ExceptionNode[] t = exceptionTable;
int i = hashCode & (t.length - 1);
ExceptionNode e = t[i];
ExceptionNode pred = null;
while (e != null) {
ExceptionNode next = e.next;
if (e == x) {
if (pred == null)
t[i] = next;
else
pred.next = next;
break;
}
pred = e;
e = next;
}
}
}
} | java | private static void expungeStaleExceptions() {
for (Object x; (x = exceptionTableRefQueue.poll()) != null;) {
if (x instanceof ExceptionNode) {
int hashCode = ((ExceptionNode)x).hashCode;
ExceptionNode[] t = exceptionTable;
int i = hashCode & (t.length - 1);
ExceptionNode e = t[i];
ExceptionNode pred = null;
while (e != null) {
ExceptionNode next = e.next;
if (e == x) {
if (pred == null)
t[i] = next;
else
pred.next = next;
break;
}
pred = e;
e = next;
}
}
}
} | [
"private",
"static",
"void",
"expungeStaleExceptions",
"(",
")",
"{",
"for",
"(",
"Object",
"x",
";",
"(",
"x",
"=",
"exceptionTableRefQueue",
".",
"poll",
"(",
")",
")",
"!=",
"null",
";",
")",
"{",
"if",
"(",
"x",
"instanceof",
"ExceptionNode",
")",
... | Polls stale refs and removes them. Call only while holding lock. | [
"Polls",
"stale",
"refs",
"and",
"removes",
"them",
".",
"Call",
"only",
"while",
"holding",
"lock",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinTask.java#L609-L631 |
33,843 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/extensions/ExtensionNamespaceSupport.java | ExtensionNamespaceSupport.launch | public ExtensionHandler launch()
throws TransformerException
{
ExtensionHandler handler = null;
try
{
Class cl = ExtensionHandler.getClassForName(m_handlerClass);
Constructor con = null;
//System.out.println("class " + cl + " " + m_args + " " + m_args.length + " " + m_sig);
if (m_sig != null)
con = cl.getConstructor(m_sig);
else // Pick the constructor based on number of args.
{
Constructor[] cons = cl.getConstructors();
for (int i = 0; i < cons.length; i ++)
{
if (cons[i].getParameterTypes().length == m_args.length)
{
con = cons[i];
break;
}
}
}
// System.out.println("constructor " + con);
if (con != null)
handler = (ExtensionHandler)con.newInstance(m_args);
else
throw new TransformerException("ExtensionHandler constructor not found");
}
catch (Exception e)
{
throw new TransformerException(e);
}
return handler;
} | java | public ExtensionHandler launch()
throws TransformerException
{
ExtensionHandler handler = null;
try
{
Class cl = ExtensionHandler.getClassForName(m_handlerClass);
Constructor con = null;
//System.out.println("class " + cl + " " + m_args + " " + m_args.length + " " + m_sig);
if (m_sig != null)
con = cl.getConstructor(m_sig);
else // Pick the constructor based on number of args.
{
Constructor[] cons = cl.getConstructors();
for (int i = 0; i < cons.length; i ++)
{
if (cons[i].getParameterTypes().length == m_args.length)
{
con = cons[i];
break;
}
}
}
// System.out.println("constructor " + con);
if (con != null)
handler = (ExtensionHandler)con.newInstance(m_args);
else
throw new TransformerException("ExtensionHandler constructor not found");
}
catch (Exception e)
{
throw new TransformerException(e);
}
return handler;
} | [
"public",
"ExtensionHandler",
"launch",
"(",
")",
"throws",
"TransformerException",
"{",
"ExtensionHandler",
"handler",
"=",
"null",
";",
"try",
"{",
"Class",
"cl",
"=",
"ExtensionHandler",
".",
"getClassForName",
"(",
"m_handlerClass",
")",
";",
"Constructor",
"c... | Launch the ExtensionHandler that this ExtensionNamespaceSupport object defines. | [
"Launch",
"the",
"ExtensionHandler",
"that",
"this",
"ExtensionNamespaceSupport",
"object",
"defines",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/extensions/ExtensionNamespaceSupport.java#L70-L104 |
33,844 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/SerializationHandleMap.java | SerializationHandleMap.findIndex | private int findIndex(Object key, Object[] array) {
int length = array.length;
int index = getModuloHash(key, length);
int last = (index + length - 1) % length;
while (index != last) {
if (array[index] == key || array[index] == null) {
/*
* Found the key, or the next empty spot (which means key is not
* in the table)
*/
break;
}
index = (index + 1) % length;
}
return index;
} | java | private int findIndex(Object key, Object[] array) {
int length = array.length;
int index = getModuloHash(key, length);
int last = (index + length - 1) % length;
while (index != last) {
if (array[index] == key || array[index] == null) {
/*
* Found the key, or the next empty spot (which means key is not
* in the table)
*/
break;
}
index = (index + 1) % length;
}
return index;
} | [
"private",
"int",
"findIndex",
"(",
"Object",
"key",
",",
"Object",
"[",
"]",
"array",
")",
"{",
"int",
"length",
"=",
"array",
".",
"length",
";",
"int",
"index",
"=",
"getModuloHash",
"(",
"key",
",",
"length",
")",
";",
"int",
"last",
"=",
"(",
... | Returns the index where the key is found at, or the index of the next
empty spot if the key is not found in this table. | [
"Returns",
"the",
"index",
"where",
"the",
"key",
"is",
"found",
"at",
"or",
"the",
"index",
"of",
"the",
"next",
"empty",
"spot",
"if",
"the",
"key",
"is",
"not",
"found",
"in",
"this",
"table",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/SerializationHandleMap.java#L74-L89 |
33,845 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScriptRun.java | UScriptRun.reset | @Deprecated
public final void reset()
{
// empty any old parenStack contents.
// NOTE: this is not the most efficient way
// to do this, but it's the easiest to write...
while (stackIsNotEmpty()) {
pop();
}
scriptStart = textStart;
scriptLimit = textStart;
scriptCode = UScript.INVALID_CODE;
parenSP = -1;
pushCount = 0;
fixupCount = 0;
textIndex = textStart;
} | java | @Deprecated
public final void reset()
{
// empty any old parenStack contents.
// NOTE: this is not the most efficient way
// to do this, but it's the easiest to write...
while (stackIsNotEmpty()) {
pop();
}
scriptStart = textStart;
scriptLimit = textStart;
scriptCode = UScript.INVALID_CODE;
parenSP = -1;
pushCount = 0;
fixupCount = 0;
textIndex = textStart;
} | [
"@",
"Deprecated",
"public",
"final",
"void",
"reset",
"(",
")",
"{",
"// empty any old parenStack contents.",
"// NOTE: this is not the most efficient way",
"// to do this, but it's the easiest to write...",
"while",
"(",
"stackIsNotEmpty",
"(",
")",
")",
"{",
"pop",
"(",
... | Reset the iterator to the start of the text.
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Reset",
"the",
"iterator",
"to",
"the",
"start",
"of",
"the",
"text",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScriptRun.java#L145-L163 |
33,846 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScriptRun.java | UScriptRun.reset | @Deprecated
public final void reset(int start, int count)
throws IllegalArgumentException
{
int len = 0;
if (text != null) {
len = text.length;
}
if (start < 0 || count < 0 || start > len - count) {
throw new IllegalArgumentException();
}
textStart = start;
textLimit = start + count;
reset();
} | java | @Deprecated
public final void reset(int start, int count)
throws IllegalArgumentException
{
int len = 0;
if (text != null) {
len = text.length;
}
if (start < 0 || count < 0 || start > len - count) {
throw new IllegalArgumentException();
}
textStart = start;
textLimit = start + count;
reset();
} | [
"@",
"Deprecated",
"public",
"final",
"void",
"reset",
"(",
"int",
"start",
",",
"int",
"count",
")",
"throws",
"IllegalArgumentException",
"{",
"int",
"len",
"=",
"0",
";",
"if",
"(",
"text",
"!=",
"null",
")",
"{",
"len",
"=",
"text",
".",
"length",
... | Reset the iterator to iterate over the given range of the text. Throws
IllegalArgumentException if the range is outside of the bounds of the
character array.
@param start the index of the new first character over which to iterate
@param count the new number of characters over which to iterate.
@exception IllegalArgumentException If invalid arguments are passed.
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Reset",
"the",
"iterator",
"to",
"iterate",
"over",
"the",
"given",
"range",
"of",
"the",
"text",
".",
"Throws",
"IllegalArgumentException",
"if",
"the",
"range",
"is",
"outside",
"of",
"the",
"bounds",
"of",
"the",
"character",
"array",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScriptRun.java#L177-L195 |
33,847 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScriptRun.java | UScriptRun.sameScript | private static boolean sameScript(int scriptOne, int scriptTwo)
{
return scriptOne <= UScript.INHERITED || scriptTwo <= UScript.INHERITED || scriptOne == scriptTwo;
} | java | private static boolean sameScript(int scriptOne, int scriptTwo)
{
return scriptOne <= UScript.INHERITED || scriptTwo <= UScript.INHERITED || scriptOne == scriptTwo;
} | [
"private",
"static",
"boolean",
"sameScript",
"(",
"int",
"scriptOne",
",",
"int",
"scriptTwo",
")",
"{",
"return",
"scriptOne",
"<=",
"UScript",
".",
"INHERITED",
"||",
"scriptTwo",
"<=",
"UScript",
".",
"INHERITED",
"||",
"scriptOne",
"==",
"scriptTwo",
";",... | Compare two script codes to see if they are in the same script. If one script is
a strong script, and the other is INHERITED or COMMON, it will compare equal.
@param scriptOne one of the script codes.
@param scriptTwo the other script code.
@return <code>true</code> if the two scripts are the same.
@see android.icu.lang.UScript | [
"Compare",
"two",
"script",
"codes",
"to",
"see",
"if",
"they",
"are",
"in",
"the",
"same",
"script",
".",
"If",
"one",
"script",
"is",
"a",
"strong",
"script",
"and",
"the",
"other",
"is",
"INHERITED",
"or",
"COMMON",
"it",
"will",
"compare",
"equal",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScriptRun.java#L418-L421 |
33,848 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScriptRun.java | UScriptRun.getPairIndex | private static int getPairIndex(int ch)
{
int probe = pairedCharPower;
int index = 0;
if (ch >= pairedChars[pairedCharExtra]) {
index = pairedCharExtra;
}
while (probe > (1 << 0)) {
probe >>= 1;
if (ch >= pairedChars[index + probe]) {
index += probe;
}
}
if (pairedChars[index] != ch) {
index = -1;
}
return index;
} | java | private static int getPairIndex(int ch)
{
int probe = pairedCharPower;
int index = 0;
if (ch >= pairedChars[pairedCharExtra]) {
index = pairedCharExtra;
}
while (probe > (1 << 0)) {
probe >>= 1;
if (ch >= pairedChars[index + probe]) {
index += probe;
}
}
if (pairedChars[index] != ch) {
index = -1;
}
return index;
} | [
"private",
"static",
"int",
"getPairIndex",
"(",
"int",
"ch",
")",
"{",
"int",
"probe",
"=",
"pairedCharPower",
";",
"int",
"index",
"=",
"0",
";",
"if",
"(",
"ch",
">=",
"pairedChars",
"[",
"pairedCharExtra",
"]",
")",
"{",
"index",
"=",
"pairedCharExtr... | Search the pairedChars array for the given character.
@param ch the character for which to search.
@return the index of the character in the table, or -1 if it's not there. | [
"Search",
"the",
"pairedChars",
"array",
"for",
"the",
"given",
"character",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScriptRun.java#L601-L623 |
33,849 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.advanceRunState | private void advanceRunState(int targetState) {
// assert targetState == SHUTDOWN || targetState == STOP;
for (;;) {
int c = ctl.get();
if (runStateAtLeast(c, targetState) ||
ctl.compareAndSet(c, ctlOf(targetState, workerCountOf(c))))
break;
}
} | java | private void advanceRunState(int targetState) {
// assert targetState == SHUTDOWN || targetState == STOP;
for (;;) {
int c = ctl.get();
if (runStateAtLeast(c, targetState) ||
ctl.compareAndSet(c, ctlOf(targetState, workerCountOf(c))))
break;
}
} | [
"private",
"void",
"advanceRunState",
"(",
"int",
"targetState",
")",
"{",
"// assert targetState == SHUTDOWN || targetState == STOP;",
"for",
"(",
";",
";",
")",
"{",
"int",
"c",
"=",
"ctl",
".",
"get",
"(",
")",
";",
"if",
"(",
"runStateAtLeast",
"(",
"c",
... | Transitions runState to given target, or leaves it alone if
already at least the given target.
@param targetState the desired state, either SHUTDOWN or STOP
(but not TIDYING or TERMINATED -- use tryTerminate for that) | [
"Transitions",
"runState",
"to",
"given",
"target",
"or",
"leaves",
"it",
"alone",
"if",
"already",
"at",
"least",
"the",
"given",
"target",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L404-L412 |
33,850 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.isRunningOrShutdown | final boolean isRunningOrShutdown(boolean shutdownOK) {
int rs = runStateOf(ctl.get());
return rs == RUNNING || (rs == SHUTDOWN && shutdownOK);
} | java | final boolean isRunningOrShutdown(boolean shutdownOK) {
int rs = runStateOf(ctl.get());
return rs == RUNNING || (rs == SHUTDOWN && shutdownOK);
} | [
"final",
"boolean",
"isRunningOrShutdown",
"(",
"boolean",
"shutdownOK",
")",
"{",
"int",
"rs",
"=",
"runStateOf",
"(",
"ctl",
".",
"get",
"(",
")",
")",
";",
"return",
"rs",
"==",
"RUNNING",
"||",
"(",
"rs",
"==",
"SHUTDOWN",
"&&",
"shutdownOK",
")",
... | State check needed by ScheduledThreadPoolExecutor to
enable running tasks during shutdown.
@param shutdownOK true if should return true if SHUTDOWN | [
"State",
"check",
"needed",
"by",
"ScheduledThreadPoolExecutor",
"to",
"enable",
"running",
"tasks",
"during",
"shutdown",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L575-L578 |
33,851 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.drainQueue | private List<Runnable> drainQueue() {
BlockingQueue<Runnable> q = workQueue;
ArrayList<Runnable> taskList = new ArrayList<>();
q.drainTo(taskList);
if (!q.isEmpty()) {
for (Runnable r : q.toArray(new Runnable[0])) {
if (q.remove(r))
taskList.add(r);
}
}
return taskList;
} | java | private List<Runnable> drainQueue() {
BlockingQueue<Runnable> q = workQueue;
ArrayList<Runnable> taskList = new ArrayList<>();
q.drainTo(taskList);
if (!q.isEmpty()) {
for (Runnable r : q.toArray(new Runnable[0])) {
if (q.remove(r))
taskList.add(r);
}
}
return taskList;
} | [
"private",
"List",
"<",
"Runnable",
">",
"drainQueue",
"(",
")",
"{",
"BlockingQueue",
"<",
"Runnable",
">",
"q",
"=",
"workQueue",
";",
"ArrayList",
"<",
"Runnable",
">",
"taskList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"q",
".",
"drainTo",
"... | Drains the task queue into a new list, normally using
drainTo. But if the queue is a DelayQueue or any other kind of
queue for which poll or drainTo may fail to remove some
elements, it deletes them one by one. | [
"Drains",
"the",
"task",
"queue",
"into",
"a",
"new",
"list",
"normally",
"using",
"drainTo",
".",
"But",
"if",
"the",
"queue",
"is",
"a",
"DelayQueue",
"or",
"any",
"other",
"kind",
"of",
"queue",
"for",
"which",
"poll",
"or",
"drainTo",
"may",
"fail",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L586-L597 |
33,852 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.addWorkerFailed | private void addWorkerFailed(Worker w) {
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
if (w != null)
workers.remove(w);
decrementWorkerCount();
tryTerminate();
} finally {
mainLock.unlock();
}
} | java | private void addWorkerFailed(Worker w) {
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
if (w != null)
workers.remove(w);
decrementWorkerCount();
tryTerminate();
} finally {
mainLock.unlock();
}
} | [
"private",
"void",
"addWorkerFailed",
"(",
"Worker",
"w",
")",
"{",
"final",
"ReentrantLock",
"mainLock",
"=",
"this",
".",
"mainLock",
";",
"mainLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"w",
"!=",
"null",
")",
"workers",
".",
"remove"... | Rolls back the worker thread creation.
- removes worker from workers, if present
- decrements worker count
- rechecks for termination, in case the existence of this
worker was holding up termination | [
"Rolls",
"back",
"the",
"worker",
"thread",
"creation",
".",
"-",
"removes",
"worker",
"from",
"workers",
"if",
"present",
"-",
"decrements",
"worker",
"count",
"-",
"rechecks",
"for",
"termination",
"in",
"case",
"the",
"existence",
"of",
"this",
"worker",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L703-L714 |
33,853 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.processWorkerExit | private void processWorkerExit(Worker w, boolean completedAbruptly) {
if (completedAbruptly) // If abrupt, then workerCount wasn't adjusted
decrementWorkerCount();
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
completedTaskCount += w.completedTasks;
workers.remove(w);
} finally {
mainLock.unlock();
}
tryTerminate();
int c = ctl.get();
if (runStateLessThan(c, STOP)) {
if (!completedAbruptly) {
int min = allowCoreThreadTimeOut ? 0 : corePoolSize;
if (min == 0 && ! workQueue.isEmpty())
min = 1;
if (workerCountOf(c) >= min)
return; // replacement not needed
}
addWorker(null, false);
}
} | java | private void processWorkerExit(Worker w, boolean completedAbruptly) {
if (completedAbruptly) // If abrupt, then workerCount wasn't adjusted
decrementWorkerCount();
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
completedTaskCount += w.completedTasks;
workers.remove(w);
} finally {
mainLock.unlock();
}
tryTerminate();
int c = ctl.get();
if (runStateLessThan(c, STOP)) {
if (!completedAbruptly) {
int min = allowCoreThreadTimeOut ? 0 : corePoolSize;
if (min == 0 && ! workQueue.isEmpty())
min = 1;
if (workerCountOf(c) >= min)
return; // replacement not needed
}
addWorker(null, false);
}
} | [
"private",
"void",
"processWorkerExit",
"(",
"Worker",
"w",
",",
"boolean",
"completedAbruptly",
")",
"{",
"if",
"(",
"completedAbruptly",
")",
"// If abrupt, then workerCount wasn't adjusted",
"decrementWorkerCount",
"(",
")",
";",
"final",
"ReentrantLock",
"mainLock",
... | Performs cleanup and bookkeeping for a dying worker. Called
only from worker threads. Unless completedAbruptly is set,
assumes that workerCount has already been adjusted to account
for exit. This method removes thread from worker set, and
possibly terminates the pool or replaces the worker if either
it exited due to user task exception or if fewer than
corePoolSize workers are running or queue is non-empty but
there are no workers.
@param w the worker
@param completedAbruptly if the worker died due to user exception | [
"Performs",
"cleanup",
"and",
"bookkeeping",
"for",
"a",
"dying",
"worker",
".",
"Called",
"only",
"from",
"worker",
"threads",
".",
"Unless",
"completedAbruptly",
"is",
"set",
"assumes",
"that",
"workerCount",
"has",
"already",
"been",
"adjusted",
"to",
"accoun... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L729-L755 |
33,854 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.runTask | @AutoreleasePool
private boolean runTask(boolean isFirstRun, Thread wt, Worker w) {
Runnable task = null;
if (isFirstRun) {
task = w.firstTask;
w.firstTask = null;
}
if (task == null && (task = getTask()) == null) {
return true;
}
w.lock();
// If pool is stopping, ensure thread is interrupted;
// if not, ensure thread is not interrupted. This
// requires a recheck in second case to deal with
// shutdownNow race while clearing interrupt
if ((runStateAtLeast(ctl.get(), STOP) ||
(Thread.interrupted() &&
runStateAtLeast(ctl.get(), STOP))) &&
!wt.isInterrupted())
wt.interrupt();
try {
beforeExecute(wt, task);
Throwable thrown = null;
try {
task.run();
} catch (RuntimeException x) {
thrown = x; throw x;
} catch (Error x) {
thrown = x; throw x;
} catch (Throwable x) {
thrown = x; throw new Error(x);
} finally {
afterExecute(task, thrown);
}
} finally {
task = null;
w.completedTasks++;
w.unlock();
}
return false;
} | java | @AutoreleasePool
private boolean runTask(boolean isFirstRun, Thread wt, Worker w) {
Runnable task = null;
if (isFirstRun) {
task = w.firstTask;
w.firstTask = null;
}
if (task == null && (task = getTask()) == null) {
return true;
}
w.lock();
// If pool is stopping, ensure thread is interrupted;
// if not, ensure thread is not interrupted. This
// requires a recheck in second case to deal with
// shutdownNow race while clearing interrupt
if ((runStateAtLeast(ctl.get(), STOP) ||
(Thread.interrupted() &&
runStateAtLeast(ctl.get(), STOP))) &&
!wt.isInterrupted())
wt.interrupt();
try {
beforeExecute(wt, task);
Throwable thrown = null;
try {
task.run();
} catch (RuntimeException x) {
thrown = x; throw x;
} catch (Error x) {
thrown = x; throw x;
} catch (Throwable x) {
thrown = x; throw new Error(x);
} finally {
afterExecute(task, thrown);
}
} finally {
task = null;
w.completedTasks++;
w.unlock();
}
return false;
} | [
"@",
"AutoreleasePool",
"private",
"boolean",
"runTask",
"(",
"boolean",
"isFirstRun",
",",
"Thread",
"wt",
",",
"Worker",
"w",
")",
"{",
"Runnable",
"task",
"=",
"null",
";",
"if",
"(",
"isFirstRun",
")",
"{",
"task",
"=",
"w",
".",
"firstTask",
";",
... | Runs a single scheduled and ready task.
@param isFirstRun Whether this is the first scheduled task to be run
@param wt Worker thread
@param w Worker
@return true if there are no more tasks left ready for execution | [
"Runs",
"a",
"single",
"scheduled",
"and",
"ready",
"task",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L881-L921 |
33,855 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.execute | public void execute(Runnable command) {
if (command == null)
throw new NullPointerException();
/*
* Proceed in 3 steps:
*
* 1. If fewer than corePoolSize threads are running, try to
* start a new thread with the given command as its first
* task. The call to addWorker atomically checks runState and
* workerCount, and so prevents false alarms that would add
* threads when it shouldn't, by returning false.
*
* 2. If a task can be successfully queued, then we still need
* to double-check whether we should have added a thread
* (because existing ones died since last checking) or that
* the pool shut down since entry into this method. So we
* recheck state and if necessary roll back the enqueuing if
* stopped, or start a new thread if there are none.
*
* 3. If we cannot queue task, then we try to add a new
* thread. If it fails, we know we are shut down or saturated
* and so reject the task.
*/
int c = ctl.get();
if (workerCountOf(c) < corePoolSize) {
if (addWorker(command, true))
return;
c = ctl.get();
}
if (isRunning(c) && workQueue.offer(command)) {
int recheck = ctl.get();
if (! isRunning(recheck) && remove(command))
reject(command);
else if (workerCountOf(recheck) == 0)
addWorker(null, false);
}
else if (!addWorker(command, false))
reject(command);
} | java | public void execute(Runnable command) {
if (command == null)
throw new NullPointerException();
/*
* Proceed in 3 steps:
*
* 1. If fewer than corePoolSize threads are running, try to
* start a new thread with the given command as its first
* task. The call to addWorker atomically checks runState and
* workerCount, and so prevents false alarms that would add
* threads when it shouldn't, by returning false.
*
* 2. If a task can be successfully queued, then we still need
* to double-check whether we should have added a thread
* (because existing ones died since last checking) or that
* the pool shut down since entry into this method. So we
* recheck state and if necessary roll back the enqueuing if
* stopped, or start a new thread if there are none.
*
* 3. If we cannot queue task, then we try to add a new
* thread. If it fails, we know we are shut down or saturated
* and so reject the task.
*/
int c = ctl.get();
if (workerCountOf(c) < corePoolSize) {
if (addWorker(command, true))
return;
c = ctl.get();
}
if (isRunning(c) && workQueue.offer(command)) {
int recheck = ctl.get();
if (! isRunning(recheck) && remove(command))
reject(command);
else if (workerCountOf(recheck) == 0)
addWorker(null, false);
}
else if (!addWorker(command, false))
reject(command);
} | [
"public",
"void",
"execute",
"(",
"Runnable",
"command",
")",
"{",
"if",
"(",
"command",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"/*\n * Proceed in 3 steps:\n *\n * 1. If fewer than corePoolSize threads are running, tr... | Executes the given task sometime in the future. The task
may execute in a new thread or in an existing pooled thread.
If the task cannot be submitted for execution, either because this
executor has been shutdown or because its capacity has been reached,
the task is handled by the current {@code RejectedExecutionHandler}.
@param command the task to execute
@throws RejectedExecutionException at discretion of
{@code RejectedExecutionHandler}, if the task
cannot be accepted for execution
@throws NullPointerException if {@code command} is null | [
"Executes",
"the",
"given",
"task",
"sometime",
"in",
"the",
"future",
".",
"The",
"task",
"may",
"execute",
"in",
"a",
"new",
"thread",
"or",
"in",
"an",
"existing",
"pooled",
"thread",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L1091-L1129 |
33,856 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.ensurePrestart | void ensurePrestart() {
int wc = workerCountOf(ctl.get());
if (wc < corePoolSize)
addWorker(null, true);
else if (wc == 0)
addWorker(null, false);
} | java | void ensurePrestart() {
int wc = workerCountOf(ctl.get());
if (wc < corePoolSize)
addWorker(null, true);
else if (wc == 0)
addWorker(null, false);
} | [
"void",
"ensurePrestart",
"(",
")",
"{",
"int",
"wc",
"=",
"workerCountOf",
"(",
"ctl",
".",
"get",
"(",
")",
")",
";",
"if",
"(",
"wc",
"<",
"corePoolSize",
")",
"addWorker",
"(",
"null",
",",
"true",
")",
";",
"else",
"if",
"(",
"wc",
"==",
"0"... | Same as prestartCoreThread except arranges that at least one
thread is started even if corePoolSize is 0. | [
"Same",
"as",
"prestartCoreThread",
"except",
"arranges",
"that",
"at",
"least",
"one",
"thread",
"is",
"started",
"even",
"if",
"corePoolSize",
"is",
"0",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L1351-L1357 |
33,857 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.setMaximumPoolSize | public void setMaximumPoolSize(int maximumPoolSize) {
if (maximumPoolSize <= 0 || maximumPoolSize < corePoolSize)
throw new IllegalArgumentException();
this.maximumPoolSize = maximumPoolSize;
if (workerCountOf(ctl.get()) > maximumPoolSize)
interruptIdleWorkers();
} | java | public void setMaximumPoolSize(int maximumPoolSize) {
if (maximumPoolSize <= 0 || maximumPoolSize < corePoolSize)
throw new IllegalArgumentException();
this.maximumPoolSize = maximumPoolSize;
if (workerCountOf(ctl.get()) > maximumPoolSize)
interruptIdleWorkers();
} | [
"public",
"void",
"setMaximumPoolSize",
"(",
"int",
"maximumPoolSize",
")",
"{",
"if",
"(",
"maximumPoolSize",
"<=",
"0",
"||",
"maximumPoolSize",
"<",
"corePoolSize",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"this",
".",
"maximumPoolSize",
... | Sets the maximum allowed number of threads. This overrides any
value set in the constructor. If the new value is smaller than
the current value, excess existing threads will be
terminated when they next become idle.
@param maximumPoolSize the new maximum
@throws IllegalArgumentException if the new maximum is
less than or equal to zero, or
less than the {@linkplain #getCorePoolSize core pool size}
@see #getMaximumPoolSize | [
"Sets",
"the",
"maximum",
"allowed",
"number",
"of",
"threads",
".",
"This",
"overrides",
"any",
"value",
"set",
"in",
"the",
"constructor",
".",
"If",
"the",
"new",
"value",
"is",
"smaller",
"than",
"the",
"current",
"value",
"excess",
"existing",
"threads"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L1429-L1435 |
33,858 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.getPoolSize | public int getPoolSize() {
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
// Remove rare and surprising possibility of
// isTerminated() && getPoolSize() > 0
return runStateAtLeast(ctl.get(), TIDYING) ? 0
: workers.size();
} finally {
mainLock.unlock();
}
} | java | public int getPoolSize() {
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
// Remove rare and surprising possibility of
// isTerminated() && getPoolSize() > 0
return runStateAtLeast(ctl.get(), TIDYING) ? 0
: workers.size();
} finally {
mainLock.unlock();
}
} | [
"public",
"int",
"getPoolSize",
"(",
")",
"{",
"final",
"ReentrantLock",
"mainLock",
"=",
"this",
".",
"mainLock",
";",
"mainLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"// Remove rare and surprising possibility of",
"// isTerminated() && getPoolSize() > 0",
"retur... | Returns the current number of threads in the pool.
@return the number of threads | [
"Returns",
"the",
"current",
"number",
"of",
"threads",
"in",
"the",
"pool",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L1565-L1576 |
33,859 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.getActiveCount | public int getActiveCount() {
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
int n = 0;
for (Worker w : workers)
if (w.isLocked())
++n;
return n;
} finally {
mainLock.unlock();
}
} | java | public int getActiveCount() {
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
int n = 0;
for (Worker w : workers)
if (w.isLocked())
++n;
return n;
} finally {
mainLock.unlock();
}
} | [
"public",
"int",
"getActiveCount",
"(",
")",
"{",
"final",
"ReentrantLock",
"mainLock",
"=",
"this",
".",
"mainLock",
";",
"mainLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"int",
"n",
"=",
"0",
";",
"for",
"(",
"Worker",
"w",
":",
"workers",
")",
... | Returns the approximate number of threads that are actively
executing tasks.
@return the number of threads | [
"Returns",
"the",
"approximate",
"number",
"of",
"threads",
"that",
"are",
"actively",
"executing",
"tasks",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L1584-L1596 |
33,860 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.getTaskCount | public long getTaskCount() {
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
long n = completedTaskCount;
for (Worker w : workers) {
n += w.completedTasks;
if (w.isLocked())
++n;
}
return n + workQueue.size();
} finally {
mainLock.unlock();
}
} | java | public long getTaskCount() {
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
long n = completedTaskCount;
for (Worker w : workers) {
n += w.completedTasks;
if (w.isLocked())
++n;
}
return n + workQueue.size();
} finally {
mainLock.unlock();
}
} | [
"public",
"long",
"getTaskCount",
"(",
")",
"{",
"final",
"ReentrantLock",
"mainLock",
"=",
"this",
".",
"mainLock",
";",
"mainLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"long",
"n",
"=",
"completedTaskCount",
";",
"for",
"(",
"Worker",
"w",
":",
"... | Returns the approximate total number of tasks that have ever been
scheduled for execution. Because the states of tasks and
threads may change dynamically during computation, the returned
value is only an approximation.
@return the number of tasks | [
"Returns",
"the",
"approximate",
"total",
"number",
"of",
"tasks",
"that",
"have",
"ever",
"been",
"scheduled",
"for",
"execution",
".",
"Because",
"the",
"states",
"of",
"tasks",
"and",
"threads",
"may",
"change",
"dynamically",
"during",
"computation",
"the",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L1622-L1636 |
33,861 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java | ThreadPoolExecutor.getCompletedTaskCount | public long getCompletedTaskCount() {
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
long n = completedTaskCount;
for (Worker w : workers)
n += w.completedTasks;
return n;
} finally {
mainLock.unlock();
}
} | java | public long getCompletedTaskCount() {
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
long n = completedTaskCount;
for (Worker w : workers)
n += w.completedTasks;
return n;
} finally {
mainLock.unlock();
}
} | [
"public",
"long",
"getCompletedTaskCount",
"(",
")",
"{",
"final",
"ReentrantLock",
"mainLock",
"=",
"this",
".",
"mainLock",
";",
"mainLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"long",
"n",
"=",
"completedTaskCount",
";",
"for",
"(",
"Worker",
"w",
... | Returns the approximate total number of tasks that have
completed execution. Because the states of tasks and threads
may change dynamically during computation, the returned value
is only an approximation, but one that does not ever decrease
across successive calls.
@return the number of tasks | [
"Returns",
"the",
"approximate",
"total",
"number",
"of",
"tasks",
"that",
"have",
"completed",
"execution",
".",
"Because",
"the",
"states",
"of",
"tasks",
"and",
"threads",
"may",
"change",
"dynamically",
"during",
"computation",
"the",
"returned",
"value",
"i... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadPoolExecutor.java#L1647-L1658 |
33,862 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java | SimpleFormatterImpl.formatCompiledPattern | public static String formatCompiledPattern(String compiledPattern, CharSequence... values) {
return formatAndAppend(compiledPattern, new StringBuilder(), null, values).toString();
} | java | public static String formatCompiledPattern(String compiledPattern, CharSequence... values) {
return formatAndAppend(compiledPattern, new StringBuilder(), null, values).toString();
} | [
"public",
"static",
"String",
"formatCompiledPattern",
"(",
"String",
"compiledPattern",
",",
"CharSequence",
"...",
"values",
")",
"{",
"return",
"formatAndAppend",
"(",
"compiledPattern",
",",
"new",
"StringBuilder",
"(",
")",
",",
"null",
",",
"values",
")",
... | Formats the given values.
@param compiledPattern Compiled form of a pattern string. | [
"Formats",
"the",
"given",
"values",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java#L189-L191 |
33,863 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java | SimpleFormatterImpl.getTextWithNoArguments | public static String getTextWithNoArguments(String compiledPattern) {
int capacity = compiledPattern.length() - 1 - getArgumentLimit(compiledPattern);
StringBuilder sb = new StringBuilder(capacity);
for (int i = 1; i < compiledPattern.length();) {
int segmentLength = compiledPattern.charAt(i++) - ARG_NUM_LIMIT;
if (segmentLength > 0) {
int limit = i + segmentLength;
sb.append(compiledPattern, i, limit);
i = limit;
}
}
return sb.toString();
} | java | public static String getTextWithNoArguments(String compiledPattern) {
int capacity = compiledPattern.length() - 1 - getArgumentLimit(compiledPattern);
StringBuilder sb = new StringBuilder(capacity);
for (int i = 1; i < compiledPattern.length();) {
int segmentLength = compiledPattern.charAt(i++) - ARG_NUM_LIMIT;
if (segmentLength > 0) {
int limit = i + segmentLength;
sb.append(compiledPattern, i, limit);
i = limit;
}
}
return sb.toString();
} | [
"public",
"static",
"String",
"getTextWithNoArguments",
"(",
"String",
"compiledPattern",
")",
"{",
"int",
"capacity",
"=",
"compiledPattern",
".",
"length",
"(",
")",
"-",
"1",
"-",
"getArgumentLimit",
"(",
"compiledPattern",
")",
";",
"StringBuilder",
"sb",
"=... | Returns the pattern text with none of the arguments.
Like formatting with all-empty string values.
@param compiledPattern Compiled form of a pattern string. | [
"Returns",
"the",
"pattern",
"text",
"with",
"none",
"of",
"the",
"arguments",
".",
"Like",
"formatting",
"with",
"all",
"-",
"empty",
"string",
"values",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java#L294-L306 |
33,864 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Debug.java | Debug.getInstance | public static Debug getInstance(String option, String prefix)
{
if (isOn(option)) {
Debug d = new Debug(prefix);
return d;
} else {
return null;
}
} | java | public static Debug getInstance(String option, String prefix)
{
if (isOn(option)) {
Debug d = new Debug(prefix);
return d;
} else {
return null;
}
} | [
"public",
"static",
"Debug",
"getInstance",
"(",
"String",
"option",
",",
"String",
"prefix",
")",
"{",
"if",
"(",
"isOn",
"(",
"option",
")",
")",
"{",
"Debug",
"d",
"=",
"new",
"Debug",
"(",
"prefix",
")",
";",
"return",
"d",
";",
"}",
"else",
"{... | Get a Debug object corresponding to whether or not the given
option is set. Set the prefix to be prefix. | [
"Get",
"a",
"Debug",
"object",
"corresponding",
"to",
"whether",
"or",
"not",
"the",
"given",
"option",
"is",
"set",
".",
"Set",
"the",
"prefix",
"to",
"be",
"prefix",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Debug.java#L117-L125 |
33,865 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Debug.java | Debug.isOn | public static boolean isOn(String option)
{
if (args == null)
return false;
else {
if (args.indexOf("all") != -1)
return true;
else
return (args.indexOf(option) != -1);
}
} | java | public static boolean isOn(String option)
{
if (args == null)
return false;
else {
if (args.indexOf("all") != -1)
return true;
else
return (args.indexOf(option) != -1);
}
} | [
"public",
"static",
"boolean",
"isOn",
"(",
"String",
"option",
")",
"{",
"if",
"(",
"args",
"==",
"null",
")",
"return",
"false",
";",
"else",
"{",
"if",
"(",
"args",
".",
"indexOf",
"(",
"\"all\"",
")",
"!=",
"-",
"1",
")",
"return",
"true",
";",... | True if the system property "security.debug" contains the
string "option". | [
"True",
"if",
"the",
"system",
"property",
"security",
".",
"debug",
"contains",
"the",
"string",
"option",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Debug.java#L131-L141 |
33,866 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Debug.java | Debug.marshal | private static String marshal(String args) {
if (args != null) {
StringBuffer target = new StringBuffer();
StringBuffer source = new StringBuffer(args);
// obtain the "permission=<classname>" options
// the syntax of classname: IDENTIFIER.IDENTIFIER
// the regular express to match a class name:
// "[a-zA-Z_$][a-zA-Z0-9_$]*([.][a-zA-Z_$][a-zA-Z0-9_$]*)*"
String keyReg = "[Pp][Ee][Rr][Mm][Ii][Ss][Ss][Ii][Oo][Nn]=";
String keyStr = "permission=";
String reg = keyReg +
"[a-zA-Z_$][a-zA-Z0-9_$]*([.][a-zA-Z_$][a-zA-Z0-9_$]*)*";
Pattern pattern = Pattern.compile(reg);
Matcher matcher = pattern.matcher(source);
StringBuffer left = new StringBuffer();
while (matcher.find()) {
String matched = matcher.group();
target.append(matched.replaceFirst(keyReg, keyStr));
target.append(" ");
// delete the matched sequence
matcher.appendReplacement(left, "");
}
matcher.appendTail(left);
source = left;
// obtain the "codebase=<URL>" options
// the syntax of URL is too flexible, and here assumes that the
// URL contains no space, comma(','), and semicolon(';'). That
// also means those characters also could be used as separator
// after codebase option.
// However, the assumption is incorrect in some special situation
// when the URL contains comma or semicolon
keyReg = "[Cc][Oo][Dd][Ee][Bb][Aa][Ss][Ee]=";
keyStr = "codebase=";
reg = keyReg + "[^, ;]*";
pattern = Pattern.compile(reg);
matcher = pattern.matcher(source);
left = new StringBuffer();
while (matcher.find()) {
String matched = matcher.group();
target.append(matched.replaceFirst(keyReg, keyStr));
target.append(" ");
// delete the matched sequence
matcher.appendReplacement(left, "");
}
matcher.appendTail(left);
source = left;
// convert the rest to lower-case characters
target.append(source.toString().toLowerCase(Locale.ENGLISH));
return target.toString();
}
return null;
} | java | private static String marshal(String args) {
if (args != null) {
StringBuffer target = new StringBuffer();
StringBuffer source = new StringBuffer(args);
// obtain the "permission=<classname>" options
// the syntax of classname: IDENTIFIER.IDENTIFIER
// the regular express to match a class name:
// "[a-zA-Z_$][a-zA-Z0-9_$]*([.][a-zA-Z_$][a-zA-Z0-9_$]*)*"
String keyReg = "[Pp][Ee][Rr][Mm][Ii][Ss][Ss][Ii][Oo][Nn]=";
String keyStr = "permission=";
String reg = keyReg +
"[a-zA-Z_$][a-zA-Z0-9_$]*([.][a-zA-Z_$][a-zA-Z0-9_$]*)*";
Pattern pattern = Pattern.compile(reg);
Matcher matcher = pattern.matcher(source);
StringBuffer left = new StringBuffer();
while (matcher.find()) {
String matched = matcher.group();
target.append(matched.replaceFirst(keyReg, keyStr));
target.append(" ");
// delete the matched sequence
matcher.appendReplacement(left, "");
}
matcher.appendTail(left);
source = left;
// obtain the "codebase=<URL>" options
// the syntax of URL is too flexible, and here assumes that the
// URL contains no space, comma(','), and semicolon(';'). That
// also means those characters also could be used as separator
// after codebase option.
// However, the assumption is incorrect in some special situation
// when the URL contains comma or semicolon
keyReg = "[Cc][Oo][Dd][Ee][Bb][Aa][Ss][Ee]=";
keyStr = "codebase=";
reg = keyReg + "[^, ;]*";
pattern = Pattern.compile(reg);
matcher = pattern.matcher(source);
left = new StringBuffer();
while (matcher.find()) {
String matched = matcher.group();
target.append(matched.replaceFirst(keyReg, keyStr));
target.append(" ");
// delete the matched sequence
matcher.appendReplacement(left, "");
}
matcher.appendTail(left);
source = left;
// convert the rest to lower-case characters
target.append(source.toString().toLowerCase(Locale.ENGLISH));
return target.toString();
}
return null;
} | [
"private",
"static",
"String",
"marshal",
"(",
"String",
"args",
")",
"{",
"if",
"(",
"args",
"!=",
"null",
")",
"{",
"StringBuffer",
"target",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"StringBuffer",
"source",
"=",
"new",
"StringBuffer",
"(",
"args",
... | change a string into lower case except permission classes and URLs. | [
"change",
"a",
"string",
"into",
"lower",
"case",
"except",
"permission",
"classes",
"and",
"URLs",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Debug.java#L202-L260 |
33,867 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/IcuZoneRulesProvider.java | IcuZoneRulesProvider.verify | private static void verify(boolean check, String zoneId, String message) {
if (!check) {
throw new ZoneRulesException(
String.format("Failed verification of zone %s: %s", zoneId, message));
}
} | java | private static void verify(boolean check, String zoneId, String message) {
if (!check) {
throw new ZoneRulesException(
String.format("Failed verification of zone %s: %s", zoneId, message));
}
} | [
"private",
"static",
"void",
"verify",
"(",
"boolean",
"check",
",",
"String",
"zoneId",
",",
"String",
"message",
")",
"{",
"if",
"(",
"!",
"check",
")",
"{",
"throw",
"new",
"ZoneRulesException",
"(",
"String",
".",
"format",
"(",
"\"Failed verification of... | Verify an assumption about the zone rules.
@param check
{@code true} if the assumption holds, {@code false} otherwise.
@param zoneId
Zone ID for which to check.
@param message
Error description of a failed check.
@throws ZoneRulesException
If and only if {@code check} is {@code false}. | [
"Verify",
"an",
"assumption",
"about",
"the",
"zone",
"rules",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/IcuZoneRulesProvider.java#L209-L214 |
33,868 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/libcore/io/DeleteOnExit.java | DeleteOnExit.getInstance | public static synchronized DeleteOnExit getInstance() {
if (instance == null) {
instance = new DeleteOnExit();
Runtime.getRuntime().addShutdownHook(instance);
}
return instance;
} | java | public static synchronized DeleteOnExit getInstance() {
if (instance == null) {
instance = new DeleteOnExit();
Runtime.getRuntime().addShutdownHook(instance);
}
return instance;
} | [
"public",
"static",
"synchronized",
"DeleteOnExit",
"getInstance",
"(",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"instance",
"=",
"new",
"DeleteOnExit",
"(",
")",
";",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"addShutdownHook",
"(",
"in... | Returns our singleton instance, creating it if necessary. | [
"Returns",
"our",
"singleton",
"instance",
"creating",
"it",
"if",
"necessary",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/io/DeleteOnExit.java#L39-L46 |
33,869 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/libcore/io/DeleteOnExit.java | DeleteOnExit.addFile | public void addFile(String filename) {
synchronized (files) {
if (!files.contains(filename)) {
files.add(filename);
}
}
} | java | public void addFile(String filename) {
synchronized (files) {
if (!files.contains(filename)) {
files.add(filename);
}
}
} | [
"public",
"void",
"addFile",
"(",
"String",
"filename",
")",
"{",
"synchronized",
"(",
"files",
")",
"{",
"if",
"(",
"!",
"files",
".",
"contains",
"(",
"filename",
")",
")",
"{",
"files",
".",
"add",
"(",
"filename",
")",
";",
"}",
"}",
"}"
] | Schedules a file for deletion.
@param filename The file to delete. | [
"Schedules",
"a",
"file",
"for",
"deletion",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/io/DeleteOnExit.java#L62-L68 |
33,870 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/util/SparseLongArray.java | SparseLongArray.removeAt | public void removeAt(int index) {
System.arraycopy(mKeys, index + 1, mKeys, index, mSize - (index + 1));
System.arraycopy(mValues, index + 1, mValues, index, mSize - (index + 1));
mSize--;
} | java | public void removeAt(int index) {
System.arraycopy(mKeys, index + 1, mKeys, index, mSize - (index + 1));
System.arraycopy(mValues, index + 1, mValues, index, mSize - (index + 1));
mSize--;
} | [
"public",
"void",
"removeAt",
"(",
"int",
"index",
")",
"{",
"System",
".",
"arraycopy",
"(",
"mKeys",
",",
"index",
"+",
"1",
",",
"mKeys",
",",
"index",
",",
"mSize",
"-",
"(",
"index",
"+",
"1",
")",
")",
";",
"System",
".",
"arraycopy",
"(",
... | Removes the mapping at the given index. | [
"Removes",
"the",
"mapping",
"at",
"the",
"given",
"index",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/SparseLongArray.java#L122-L126 |
33,871 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PrintStream.java | PrintStream.close | public void close() {
synchronized (this) {
if (! closing) {
closing = true;
try {
// Android-changed: Lazily initialized.
if (textOut != null) {
textOut.close();
}
out.close();
}
catch (IOException x) {
trouble = true;
}
textOut = null;
charOut = null;
out = null;
}
}
} | java | public void close() {
synchronized (this) {
if (! closing) {
closing = true;
try {
// Android-changed: Lazily initialized.
if (textOut != null) {
textOut.close();
}
out.close();
}
catch (IOException x) {
trouble = true;
}
textOut = null;
charOut = null;
out = null;
}
}
} | [
"public",
"void",
"close",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"!",
"closing",
")",
"{",
"closing",
"=",
"true",
";",
"try",
"{",
"// Android-changed: Lazily initialized.",
"if",
"(",
"textOut",
"!=",
"null",
")",
"{",
"textO... | Closes the stream. This is done by flushing the stream and then closing
the underlying output stream.
@see java.io.OutputStream#close() | [
"Closes",
"the",
"stream",
".",
"This",
"is",
"done",
"by",
"flushing",
"the",
"stream",
"and",
"then",
"closing",
"the",
"underlying",
"output",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PrintStream.java#L365-L384 |
33,872 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PrintStream.java | PrintStream.format | public PrintStream format(String format, Object ... args) {
try {
synchronized (this) {
ensureOpen();
if ((formatter == null)
|| (formatter.locale() != Locale.getDefault()))
formatter = new Formatter((Appendable) WeakProxy.forObject(this));
formatter.format(Locale.getDefault(), format, args);
}
} catch (InterruptedIOException x) {
Thread.currentThread().interrupt();
} catch (IOException x) {
trouble = true;
}
return this;
} | java | public PrintStream format(String format, Object ... args) {
try {
synchronized (this) {
ensureOpen();
if ((formatter == null)
|| (formatter.locale() != Locale.getDefault()))
formatter = new Formatter((Appendable) WeakProxy.forObject(this));
formatter.format(Locale.getDefault(), format, args);
}
} catch (InterruptedIOException x) {
Thread.currentThread().interrupt();
} catch (IOException x) {
trouble = true;
}
return this;
} | [
"public",
"PrintStream",
"format",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"synchronized",
"(",
"this",
")",
"{",
"ensureOpen",
"(",
")",
";",
"if",
"(",
"(",
"formatter",
"==",
"null",
")",
"||",
"(",
"formatter",
... | Writes a formatted string to this output stream using the specified
format string and arguments.
<p> The locale always used is the one returned by {@link
java.util.Locale#getDefault() Locale.getDefault()}, regardless of any
previous invocations of other formatting methods on this object.
@param format
A format string as described in <a
href="../util/Formatter.html#syntax">Format string syntax</a>
@param args
Arguments referenced by the format specifiers in the format
string. If there are more arguments than format specifiers, the
extra arguments are ignored. The number of arguments is
variable and may be zero. The maximum number of arguments is
limited by the maximum dimension of a Java array as defined by
<cite>The Java™ Virtual Machine Specification</cite>.
The behaviour on a
<tt>null</tt> argument depends on the <a
href="../util/Formatter.html#syntax">conversion</a>.
@throws java.util.IllegalFormatException
If a format string contains an illegal syntax, a format
specifier that is incompatible with the given arguments,
insufficient arguments given the format string, or other
illegal conditions. For specification of all possible
formatting errors, see the <a
href="../util/Formatter.html#detail">Details</a> section of the
formatter class specification.
@throws NullPointerException
If the <tt>format</tt> is <tt>null</tt>
@return This output stream
@since 1.5 | [
"Writes",
"a",
"formatted",
"string",
"to",
"this",
"output",
"stream",
"using",
"the",
"specified",
"format",
"string",
"and",
"arguments",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PrintStream.java#L983-L998 |
33,873 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PrintStream.java | PrintStream.append | public PrintStream append(CharSequence csq) {
if (csq == null)
print("null");
else
print(csq.toString());
return this;
} | java | public PrintStream append(CharSequence csq) {
if (csq == null)
print("null");
else
print(csq.toString());
return this;
} | [
"public",
"PrintStream",
"append",
"(",
"CharSequence",
"csq",
")",
"{",
"if",
"(",
"csq",
"==",
"null",
")",
"print",
"(",
"\"null\"",
")",
";",
"else",
"print",
"(",
"csq",
".",
"toString",
"(",
")",
")",
";",
"return",
"this",
";",
"}"
] | Appends the specified character sequence to this output stream.
<p> An invocation of this method of the form <tt>out.append(csq)</tt>
behaves in exactly the same way as the invocation
<pre>
out.print(csq.toString()) </pre>
<p> Depending on the specification of <tt>toString</tt> for the
character sequence <tt>csq</tt>, the entire sequence may not be
appended. For instance, invoking then <tt>toString</tt> method of a
character buffer will return a subsequence whose content depends upon
the buffer's position and limit.
@param csq
The character sequence to append. If <tt>csq</tt> is
<tt>null</tt>, then the four characters <tt>"null"</tt> are
appended to this output stream.
@return This output stream
@since 1.5 | [
"Appends",
"the",
"specified",
"character",
"sequence",
"to",
"this",
"output",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PrintStream.java#L1081-L1087 |
33,874 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetRecog_mbcs.java | CharsetRecog_mbcs.match | int match(CharsetDetector det, int [] commonChars) {
@SuppressWarnings("unused")
int singleByteCharCount = 0; //TODO Do we really need this?
int doubleByteCharCount = 0;
int commonCharCount = 0;
int badCharCount = 0;
int totalCharCount = 0;
int confidence = 0;
iteratedChar iter = new iteratedChar();
detectBlock: {
for (iter.reset(); nextChar(iter, det);) {
totalCharCount++;
if (iter.error) {
badCharCount++;
} else {
long cv = iter.charValue & 0xFFFFFFFFL;
if (cv <= 0xff) {
singleByteCharCount++;
} else {
doubleByteCharCount++;
if (commonChars != null) {
// NOTE: This assumes that there are no 4-byte common chars.
if (Arrays.binarySearch(commonChars, (int) cv) >= 0) {
commonCharCount++;
}
}
}
}
if (badCharCount >= 2 && badCharCount*5 >= doubleByteCharCount) {
// Bail out early if the byte data is not matching the encoding scheme.
break detectBlock;
}
}
if (doubleByteCharCount <= 10 && badCharCount== 0) {
// Not many multi-byte chars.
if (doubleByteCharCount == 0 && totalCharCount < 10) {
// There weren't any multibyte sequences, and there was a low density of non-ASCII single bytes.
// We don't have enough data to have any confidence.
// Statistical analysis of single byte non-ASCII charcters would probably help here.
confidence = 0;
}
else {
// ASCII or ISO file? It's probably not our encoding,
// but is not incompatible with our encoding, so don't give it a zero.
confidence = 10;
}
break detectBlock;
}
//
// No match if there are too many characters that don't fit the encoding scheme.
// (should we have zero tolerance for these?)
//
if (doubleByteCharCount < 20*badCharCount) {
confidence = 0;
break detectBlock;
}
if (commonChars == null) {
// We have no statistics on frequently occuring characters.
// Assess confidence purely on having a reasonable number of
// multi-byte characters (the more the better
confidence = 30 + doubleByteCharCount - 20*badCharCount;
if (confidence > 100) {
confidence = 100;
}
}else {
//
// Frequency of occurence statistics exist.
//
double maxVal = Math.log((float)doubleByteCharCount / 4);
double scaleFactor = 90.0 / maxVal;
confidence = (int)(Math.log(commonCharCount+1) * scaleFactor + 10);
confidence = Math.min(confidence, 100);
}
} // end of detectBlock:
return confidence;
} | java | int match(CharsetDetector det, int [] commonChars) {
@SuppressWarnings("unused")
int singleByteCharCount = 0; //TODO Do we really need this?
int doubleByteCharCount = 0;
int commonCharCount = 0;
int badCharCount = 0;
int totalCharCount = 0;
int confidence = 0;
iteratedChar iter = new iteratedChar();
detectBlock: {
for (iter.reset(); nextChar(iter, det);) {
totalCharCount++;
if (iter.error) {
badCharCount++;
} else {
long cv = iter.charValue & 0xFFFFFFFFL;
if (cv <= 0xff) {
singleByteCharCount++;
} else {
doubleByteCharCount++;
if (commonChars != null) {
// NOTE: This assumes that there are no 4-byte common chars.
if (Arrays.binarySearch(commonChars, (int) cv) >= 0) {
commonCharCount++;
}
}
}
}
if (badCharCount >= 2 && badCharCount*5 >= doubleByteCharCount) {
// Bail out early if the byte data is not matching the encoding scheme.
break detectBlock;
}
}
if (doubleByteCharCount <= 10 && badCharCount== 0) {
// Not many multi-byte chars.
if (doubleByteCharCount == 0 && totalCharCount < 10) {
// There weren't any multibyte sequences, and there was a low density of non-ASCII single bytes.
// We don't have enough data to have any confidence.
// Statistical analysis of single byte non-ASCII charcters would probably help here.
confidence = 0;
}
else {
// ASCII or ISO file? It's probably not our encoding,
// but is not incompatible with our encoding, so don't give it a zero.
confidence = 10;
}
break detectBlock;
}
//
// No match if there are too many characters that don't fit the encoding scheme.
// (should we have zero tolerance for these?)
//
if (doubleByteCharCount < 20*badCharCount) {
confidence = 0;
break detectBlock;
}
if (commonChars == null) {
// We have no statistics on frequently occuring characters.
// Assess confidence purely on having a reasonable number of
// multi-byte characters (the more the better
confidence = 30 + doubleByteCharCount - 20*badCharCount;
if (confidence > 100) {
confidence = 100;
}
}else {
//
// Frequency of occurence statistics exist.
//
double maxVal = Math.log((float)doubleByteCharCount / 4);
double scaleFactor = 90.0 / maxVal;
confidence = (int)(Math.log(commonCharCount+1) * scaleFactor + 10);
confidence = Math.min(confidence, 100);
}
} // end of detectBlock:
return confidence;
} | [
"int",
"match",
"(",
"CharsetDetector",
"det",
",",
"int",
"[",
"]",
"commonChars",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"int",
"singleByteCharCount",
"=",
"0",
";",
"//TODO Do we really need this?",
"int",
"doubleByteCharCount",
"=",
"0",
... | Test the match of this charset with the input text data
which is obtained via the CharsetDetector object.
@param det The CharsetDetector, which contains the input text
to be checked for being in this charset.
@return Two values packed into one int (Damn java, anyhow)
<br/>
bits 0-7: the match confidence, ranging from 0-100
<br/>
bits 8-15: The match reason, an enum-like value. | [
"Test",
"the",
"match",
"of",
"this",
"charset",
"with",
"the",
"input",
"text",
"data",
"which",
"is",
"obtained",
"via",
"the",
"CharsetDetector",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetRecog_mbcs.java#L49-L131 |
33,875 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePatternUtil.java | MessagePatternUtil.buildMessageNode | public static MessageNode buildMessageNode(MessagePattern pattern) {
int limit = pattern.countParts() - 1;
if (limit < 0) {
throw new IllegalArgumentException("The MessagePattern is empty");
} else if (pattern.getPartType(0) != MessagePattern.Part.Type.MSG_START) {
throw new IllegalArgumentException(
"The MessagePattern does not represent a MessageFormat pattern");
}
return buildMessageNode(pattern, 0, limit);
} | java | public static MessageNode buildMessageNode(MessagePattern pattern) {
int limit = pattern.countParts() - 1;
if (limit < 0) {
throw new IllegalArgumentException("The MessagePattern is empty");
} else if (pattern.getPartType(0) != MessagePattern.Part.Type.MSG_START) {
throw new IllegalArgumentException(
"The MessagePattern does not represent a MessageFormat pattern");
}
return buildMessageNode(pattern, 0, limit);
} | [
"public",
"static",
"MessageNode",
"buildMessageNode",
"(",
"MessagePattern",
"pattern",
")",
"{",
"int",
"limit",
"=",
"pattern",
".",
"countParts",
"(",
")",
"-",
"1",
";",
"if",
"(",
"limit",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",... | Factory method, builds and returns a MessageNode from a MessagePattern.
@param pattern a parsed MessageFormat pattern string
@return a MessageNode or a ComplexArgStyleNode
@throws IllegalArgumentException if the MessagePattern is empty
or does not represent a MessageFormat pattern | [
"Factory",
"method",
"builds",
"and",
"returns",
"a",
"MessageNode",
"from",
"a",
"MessagePattern",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePatternUtil.java#L55-L64 |
33,876 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java | XPathContext.reset | public void reset()
{
releaseDTMXRTreeFrags();
// These couldn't be disposed of earlier (see comments in release()); zap them now.
if(m_rtfdtm_stack!=null)
for (java.util.Enumeration e = m_rtfdtm_stack.elements() ; e.hasMoreElements() ;)
m_dtmManager.release((DTM)e.nextElement(), true);
m_rtfdtm_stack=null; // drop our references too
m_which_rtfdtm=-1;
if(m_global_rtfdtm!=null)
m_dtmManager.release(m_global_rtfdtm,true);
m_global_rtfdtm=null;
m_dtmManager = DTMManager.newInstance(
org.apache.xpath.objects.XMLStringFactoryImpl.getFactory());
m_saxLocations.removeAllElements();
m_axesIteratorStack.removeAllElements();
m_contextNodeLists.removeAllElements();
m_currentExpressionNodes.removeAllElements();
m_currentNodes.removeAllElements();
m_iteratorRoots.RemoveAllNoClear();
m_predicatePos.removeAllElements();
m_predicateRoots.RemoveAllNoClear();
m_prefixResolvers.removeAllElements();
m_prefixResolvers.push(null);
m_currentNodes.push(DTM.NULL);
m_currentExpressionNodes.push(DTM.NULL);
m_saxLocations.push(null);
} | java | public void reset()
{
releaseDTMXRTreeFrags();
// These couldn't be disposed of earlier (see comments in release()); zap them now.
if(m_rtfdtm_stack!=null)
for (java.util.Enumeration e = m_rtfdtm_stack.elements() ; e.hasMoreElements() ;)
m_dtmManager.release((DTM)e.nextElement(), true);
m_rtfdtm_stack=null; // drop our references too
m_which_rtfdtm=-1;
if(m_global_rtfdtm!=null)
m_dtmManager.release(m_global_rtfdtm,true);
m_global_rtfdtm=null;
m_dtmManager = DTMManager.newInstance(
org.apache.xpath.objects.XMLStringFactoryImpl.getFactory());
m_saxLocations.removeAllElements();
m_axesIteratorStack.removeAllElements();
m_contextNodeLists.removeAllElements();
m_currentExpressionNodes.removeAllElements();
m_currentNodes.removeAllElements();
m_iteratorRoots.RemoveAllNoClear();
m_predicatePos.removeAllElements();
m_predicateRoots.RemoveAllNoClear();
m_prefixResolvers.removeAllElements();
m_prefixResolvers.push(null);
m_currentNodes.push(DTM.NULL);
m_currentExpressionNodes.push(DTM.NULL);
m_saxLocations.push(null);
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"releaseDTMXRTreeFrags",
"(",
")",
";",
"// These couldn't be disposed of earlier (see comments in release()); zap them now.",
"if",
"(",
"m_rtfdtm_stack",
"!=",
"null",
")",
"for",
"(",
"java",
".",
"util",
".",
"Enumeration",
... | Reset for new run. | [
"Reset",
"for",
"new",
"run",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java#L360-L393 |
33,877 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java | XPathContext.getErrorListener | public final ErrorListener getErrorListener()
{
if (null != m_errorListener)
return m_errorListener;
ErrorListener retval = null;
try {
if (null != m_ownerGetErrorListener)
retval = (ErrorListener) m_ownerGetErrorListener.invoke(m_owner, new Object[] {});
}
catch (Exception e) {}
if (null == retval)
{
if (null == m_defaultErrorListener)
m_defaultErrorListener = new org.apache.xml.utils.DefaultErrorHandler();
retval = m_defaultErrorListener;
}
return retval;
} | java | public final ErrorListener getErrorListener()
{
if (null != m_errorListener)
return m_errorListener;
ErrorListener retval = null;
try {
if (null != m_ownerGetErrorListener)
retval = (ErrorListener) m_ownerGetErrorListener.invoke(m_owner, new Object[] {});
}
catch (Exception e) {}
if (null == retval)
{
if (null == m_defaultErrorListener)
m_defaultErrorListener = new org.apache.xml.utils.DefaultErrorHandler();
retval = m_defaultErrorListener;
}
return retval;
} | [
"public",
"final",
"ErrorListener",
"getErrorListener",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"m_errorListener",
")",
"return",
"m_errorListener",
";",
"ErrorListener",
"retval",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"null",
"!=",
"m_ownerGetErrorListener",... | Get the ErrorListener where errors and warnings are to be reported.
@return A non-null ErrorListener reference. | [
"Get",
"the",
"ErrorListener",
"where",
"errors",
"and",
"warnings",
"are",
"to",
"be",
"reported",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java#L540-L562 |
33,878 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java | XPathContext.setErrorListener | public void setErrorListener(ErrorListener listener) throws IllegalArgumentException
{
if (listener == null)
throw new IllegalArgumentException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, null)); //"Null error handler");
m_errorListener = listener;
} | java | public void setErrorListener(ErrorListener listener) throws IllegalArgumentException
{
if (listener == null)
throw new IllegalArgumentException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, null)); //"Null error handler");
m_errorListener = listener;
} | [
"public",
"void",
"setErrorListener",
"(",
"ErrorListener",
"listener",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErro... | Set the ErrorListener where errors and warnings are to be reported.
@param listener A non-null ErrorListener reference. | [
"Set",
"the",
"ErrorListener",
"where",
"errors",
"and",
"warnings",
"are",
"to",
"be",
"reported",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java#L569-L574 |
33,879 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java | XPathContext.pushExpressionState | public final void pushExpressionState(int cn, int en, PrefixResolver nc)
{
m_currentNodes.push(cn);
m_currentExpressionNodes.push(cn);
m_prefixResolvers.push(nc);
} | java | public final void pushExpressionState(int cn, int en, PrefixResolver nc)
{
m_currentNodes.push(cn);
m_currentExpressionNodes.push(cn);
m_prefixResolvers.push(nc);
} | [
"public",
"final",
"void",
"pushExpressionState",
"(",
"int",
"cn",
",",
"int",
"en",
",",
"PrefixResolver",
"nc",
")",
"{",
"m_currentNodes",
".",
"push",
"(",
"cn",
")",
";",
"m_currentExpressionNodes",
".",
"push",
"(",
"cn",
")",
";",
"m_prefixResolvers"... | Push the current context node, expression node, and prefix resolver.
@param cn the <a href="http://www.w3.org/TR/xslt#dt-current-node">current node</a>.
@param en the sub-expression context node.
@param nc the namespace context (prefix resolver. | [
"Push",
"the",
"current",
"context",
"node",
"expression",
"node",
"and",
"prefix",
"resolver",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java#L767-L772 |
33,880 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java | XPathContext.popRTFContext | public void popRTFContext()
{
int previous=m_last_pushed_rtfdtm.pop();
if(null==m_rtfdtm_stack)
return;
if(m_which_rtfdtm==previous)
{
if(previous>=0) // guard against none-active
{
boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(previous))).popRewindMark();
}
}
else while(m_which_rtfdtm!=previous)
{
// Empty each DTM before popping, so it's ready for reuse
// _DON'T_ pop the previous, since it's still open (which is why we
// stacked up more of these) and did not receive a mark.
boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(m_which_rtfdtm))).popRewindMark();
--m_which_rtfdtm;
}
} | java | public void popRTFContext()
{
int previous=m_last_pushed_rtfdtm.pop();
if(null==m_rtfdtm_stack)
return;
if(m_which_rtfdtm==previous)
{
if(previous>=0) // guard against none-active
{
boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(previous))).popRewindMark();
}
}
else while(m_which_rtfdtm!=previous)
{
// Empty each DTM before popping, so it's ready for reuse
// _DON'T_ pop the previous, since it's still open (which is why we
// stacked up more of these) and did not receive a mark.
boolean isEmpty=((SAX2RTFDTM)(m_rtfdtm_stack.elementAt(m_which_rtfdtm))).popRewindMark();
--m_which_rtfdtm;
}
} | [
"public",
"void",
"popRTFContext",
"(",
")",
"{",
"int",
"previous",
"=",
"m_last_pushed_rtfdtm",
".",
"pop",
"(",
")",
";",
"if",
"(",
"null",
"==",
"m_rtfdtm_stack",
")",
"return",
";",
"if",
"(",
"m_which_rtfdtm",
"==",
"previous",
")",
"{",
"if",
"("... | Pop the RTFDTM's context mark. This discards any RTFs added after the last
mark was set.
If there is no RTF DTM, there's nothing to pop so this
becomes a no-op. If pushes were issued before this was called, we count on
the fact that popRewindMark is defined such that overpopping just resets
to empty.
Complicating factor: We need to handle the case of popping back to a previous
RTF DTM, if one of the weird produce-an-RTF-to-build-an-RTF cases arose.
Basically: If pop says this DTM is now empty, then return to the previous
if one exists, in whatever state we left it in. UGLY, but hopefully the
situation which forces us to consider this will arise exceedingly rarely. | [
"Pop",
"the",
"RTFDTM",
"s",
"context",
"mark",
".",
"This",
"discards",
"any",
"RTFs",
"added",
"after",
"the",
"last",
"mark",
"was",
"set",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java#L1292-L1313 |
33,881 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java | XPathContext.getDTMXRTreeFrag | public DTMXRTreeFrag getDTMXRTreeFrag(int dtmIdentity){
if(m_DTMXRTreeFrags == null){
m_DTMXRTreeFrags = new HashMap();
}
if(m_DTMXRTreeFrags.containsKey(new Integer(dtmIdentity))){
return (DTMXRTreeFrag)m_DTMXRTreeFrags.get(new Integer(dtmIdentity));
}else{
final DTMXRTreeFrag frag = new DTMXRTreeFrag(dtmIdentity,this);
m_DTMXRTreeFrags.put(new Integer(dtmIdentity),frag);
return frag ;
}
} | java | public DTMXRTreeFrag getDTMXRTreeFrag(int dtmIdentity){
if(m_DTMXRTreeFrags == null){
m_DTMXRTreeFrags = new HashMap();
}
if(m_DTMXRTreeFrags.containsKey(new Integer(dtmIdentity))){
return (DTMXRTreeFrag)m_DTMXRTreeFrags.get(new Integer(dtmIdentity));
}else{
final DTMXRTreeFrag frag = new DTMXRTreeFrag(dtmIdentity,this);
m_DTMXRTreeFrags.put(new Integer(dtmIdentity),frag);
return frag ;
}
} | [
"public",
"DTMXRTreeFrag",
"getDTMXRTreeFrag",
"(",
"int",
"dtmIdentity",
")",
"{",
"if",
"(",
"m_DTMXRTreeFrags",
"==",
"null",
")",
"{",
"m_DTMXRTreeFrags",
"=",
"new",
"HashMap",
"(",
")",
";",
"}",
"if",
"(",
"m_DTMXRTreeFrags",
".",
"containsKey",
"(",
... | Gets DTMXRTreeFrag object if one has already been created.
Creates new DTMXRTreeFrag object and adds to m_DTMXRTreeFrags HashMap,
otherwise.
@param dtmIdentity
@return DTMXRTreeFrag | [
"Gets",
"DTMXRTreeFrag",
"object",
"if",
"one",
"has",
"already",
"been",
"created",
".",
"Creates",
"new",
"DTMXRTreeFrag",
"object",
"and",
"adds",
"to",
"m_DTMXRTreeFrags",
"HashMap",
"otherwise",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java#L1322-L1334 |
33,882 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java | XPathContext.releaseDTMXRTreeFrags | private final void releaseDTMXRTreeFrags(){
if(m_DTMXRTreeFrags == null){
return;
}
final Iterator iter = (m_DTMXRTreeFrags.values()).iterator();
while(iter.hasNext()){
DTMXRTreeFrag frag = (DTMXRTreeFrag)iter.next();
frag.destruct();
iter.remove();
}
m_DTMXRTreeFrags = null;
} | java | private final void releaseDTMXRTreeFrags(){
if(m_DTMXRTreeFrags == null){
return;
}
final Iterator iter = (m_DTMXRTreeFrags.values()).iterator();
while(iter.hasNext()){
DTMXRTreeFrag frag = (DTMXRTreeFrag)iter.next();
frag.destruct();
iter.remove();
}
m_DTMXRTreeFrags = null;
} | [
"private",
"final",
"void",
"releaseDTMXRTreeFrags",
"(",
")",
"{",
"if",
"(",
"m_DTMXRTreeFrags",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"Iterator",
"iter",
"=",
"(",
"m_DTMXRTreeFrags",
".",
"values",
"(",
")",
")",
".",
"iterator",
"(",
... | Cleans DTMXRTreeFrag objects by removing references
to DTM and XPathContext objects. | [
"Cleans",
"DTMXRTreeFrag",
"objects",
"by",
"removing",
"references",
"to",
"DTM",
"and",
"XPathContext",
"objects",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPathContext.java#L1340-L1351 |
33,883 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemValueOf.java | ElemValueOf.setSelect | public void setSelect(XPath v)
{
if (null != v)
{
String s = v.getPatternString();
m_isDot = (null != s) && s.equals(".");
}
m_selectExpression = v;
} | java | public void setSelect(XPath v)
{
if (null != v)
{
String s = v.getPatternString();
m_isDot = (null != s) && s.equals(".");
}
m_selectExpression = v;
} | [
"public",
"void",
"setSelect",
"(",
"XPath",
"v",
")",
"{",
"if",
"(",
"null",
"!=",
"v",
")",
"{",
"String",
"s",
"=",
"v",
".",
"getPatternString",
"(",
")",
";",
"m_isDot",
"=",
"(",
"null",
"!=",
"s",
")",
"&&",
"s",
".",
"equals",
"(",
"\"... | Set the "select" attribute.
The required select attribute is an expression; this expression
is evaluated and the resulting object is converted to a
string as if by a call to the string function.
@param v The value to set for the "select" attribute. | [
"Set",
"the",
"select",
"attribute",
".",
"The",
"required",
"select",
"attribute",
"is",
"an",
"expression",
";",
"this",
"expression",
"is",
"evaluated",
"and",
"the",
"resulting",
"object",
"is",
"converted",
"to",
"a",
"string",
"as",
"if",
"by",
"a",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemValueOf.java#L71-L82 |
33,884 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.ensureSizeOfIndex | protected void ensureSizeOfIndex(int namespaceID, int LocalNameID)
{
if (null == m_elemIndexes)
{
m_elemIndexes = new int[namespaceID + 20][][];
}
else if (m_elemIndexes.length <= namespaceID)
{
int[][][] indexes = m_elemIndexes;
m_elemIndexes = new int[namespaceID + 20][][];
System.arraycopy(indexes, 0, m_elemIndexes, 0, indexes.length);
}
int[][] localNameIndex = m_elemIndexes[namespaceID];
if (null == localNameIndex)
{
localNameIndex = new int[LocalNameID + 100][];
m_elemIndexes[namespaceID] = localNameIndex;
}
else if (localNameIndex.length <= LocalNameID)
{
int[][] indexes = localNameIndex;
localNameIndex = new int[LocalNameID + 100][];
System.arraycopy(indexes, 0, localNameIndex, 0, indexes.length);
m_elemIndexes[namespaceID] = localNameIndex;
}
int[] elemHandles = localNameIndex[LocalNameID];
if (null == elemHandles)
{
elemHandles = new int[128];
localNameIndex[LocalNameID] = elemHandles;
elemHandles[0] = 1;
}
else if (elemHandles.length <= elemHandles[0] + 1)
{
int[] indexes = elemHandles;
elemHandles = new int[elemHandles[0] + 1024];
System.arraycopy(indexes, 0, elemHandles, 0, indexes.length);
localNameIndex[LocalNameID] = elemHandles;
}
} | java | protected void ensureSizeOfIndex(int namespaceID, int LocalNameID)
{
if (null == m_elemIndexes)
{
m_elemIndexes = new int[namespaceID + 20][][];
}
else if (m_elemIndexes.length <= namespaceID)
{
int[][][] indexes = m_elemIndexes;
m_elemIndexes = new int[namespaceID + 20][][];
System.arraycopy(indexes, 0, m_elemIndexes, 0, indexes.length);
}
int[][] localNameIndex = m_elemIndexes[namespaceID];
if (null == localNameIndex)
{
localNameIndex = new int[LocalNameID + 100][];
m_elemIndexes[namespaceID] = localNameIndex;
}
else if (localNameIndex.length <= LocalNameID)
{
int[][] indexes = localNameIndex;
localNameIndex = new int[LocalNameID + 100][];
System.arraycopy(indexes, 0, localNameIndex, 0, indexes.length);
m_elemIndexes[namespaceID] = localNameIndex;
}
int[] elemHandles = localNameIndex[LocalNameID];
if (null == elemHandles)
{
elemHandles = new int[128];
localNameIndex[LocalNameID] = elemHandles;
elemHandles[0] = 1;
}
else if (elemHandles.length <= elemHandles[0] + 1)
{
int[] indexes = elemHandles;
elemHandles = new int[elemHandles[0] + 1024];
System.arraycopy(indexes, 0, elemHandles, 0, indexes.length);
localNameIndex[LocalNameID] = elemHandles;
}
} | [
"protected",
"void",
"ensureSizeOfIndex",
"(",
"int",
"namespaceID",
",",
"int",
"LocalNameID",
")",
"{",
"if",
"(",
"null",
"==",
"m_elemIndexes",
")",
"{",
"m_elemIndexes",
"=",
"new",
"int",
"[",
"namespaceID",
"+",
"20",
"]",
"[",
"",
"]",
"[",
"",
... | Ensure that the size of the element indexes can hold the information.
@param namespaceID Namespace ID index.
@param LocalNameID Local name ID. | [
"Ensure",
"that",
"the",
"size",
"of",
"the",
"element",
"indexes",
"can",
"hold",
"the",
"information",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L256-L308 |
33,885 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.indexNode | protected void indexNode(int expandedTypeID, int identity)
{
ExpandedNameTable ent = m_expandedNameTable;
short type = ent.getType(expandedTypeID);
if (DTM.ELEMENT_NODE == type)
{
int namespaceID = ent.getNamespaceID(expandedTypeID);
int localNameID = ent.getLocalNameID(expandedTypeID);
ensureSizeOfIndex(namespaceID, localNameID);
int[] index = m_elemIndexes[namespaceID][localNameID];
index[index[0]] = identity;
index[0]++;
}
} | java | protected void indexNode(int expandedTypeID, int identity)
{
ExpandedNameTable ent = m_expandedNameTable;
short type = ent.getType(expandedTypeID);
if (DTM.ELEMENT_NODE == type)
{
int namespaceID = ent.getNamespaceID(expandedTypeID);
int localNameID = ent.getLocalNameID(expandedTypeID);
ensureSizeOfIndex(namespaceID, localNameID);
int[] index = m_elemIndexes[namespaceID][localNameID];
index[index[0]] = identity;
index[0]++;
}
} | [
"protected",
"void",
"indexNode",
"(",
"int",
"expandedTypeID",
",",
"int",
"identity",
")",
"{",
"ExpandedNameTable",
"ent",
"=",
"m_expandedNameTable",
";",
"short",
"type",
"=",
"ent",
".",
"getType",
"(",
"expandedTypeID",
")",
";",
"if",
"(",
"DTM",
"."... | Add a node to the element indexes. The node will not be added unless
it's an element.
@param expandedTypeID The expanded type ID of the node.
@param identity The node identity index. | [
"Add",
"a",
"node",
"to",
"the",
"element",
"indexes",
".",
"The",
"node",
"will",
"not",
"be",
"added",
"unless",
"it",
"s",
"an",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L317-L336 |
33,886 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.findGTE | protected int findGTE(int[] list, int start, int len, int value)
{
int low = start;
int high = start + (len - 1);
int end = high;
while (low <= high)
{
int mid = (low + high) / 2;
int c = list[mid];
if (c > value)
high = mid - 1;
else if (c < value)
low = mid + 1;
else
return mid;
}
return (low <= end && list[low] > value) ? low : -1;
} | java | protected int findGTE(int[] list, int start, int len, int value)
{
int low = start;
int high = start + (len - 1);
int end = high;
while (low <= high)
{
int mid = (low + high) / 2;
int c = list[mid];
if (c > value)
high = mid - 1;
else if (c < value)
low = mid + 1;
else
return mid;
}
return (low <= end && list[low] > value) ? low : -1;
} | [
"protected",
"int",
"findGTE",
"(",
"int",
"[",
"]",
"list",
",",
"int",
"start",
",",
"int",
"len",
",",
"int",
"value",
")",
"{",
"int",
"low",
"=",
"start",
";",
"int",
"high",
"=",
"start",
"+",
"(",
"len",
"-",
"1",
")",
";",
"int",
"end",... | Find the first index that occurs in the list that is greater than or
equal to the given value.
@param list A list of integers.
@param start The start index to begin the search.
@param len The number of items to search.
@param value Find the slot that has a value that is greater than or
identical to this argument.
@return The index in the list of the slot that is higher or identical
to the identity argument, or -1 if no node is higher or equal. | [
"Find",
"the",
"first",
"index",
"that",
"occurs",
"in",
"the",
"list",
"that",
"is",
"greater",
"than",
"or",
"equal",
"to",
"the",
"given",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L351-L372 |
33,887 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.findElementFromIndex | int findElementFromIndex(int nsIndex, int lnIndex, int firstPotential)
{
int[][][] indexes = m_elemIndexes;
if (null != indexes && nsIndex < indexes.length)
{
int[][] lnIndexs = indexes[nsIndex];
if (null != lnIndexs && lnIndex < lnIndexs.length)
{
int[] elems = lnIndexs[lnIndex];
if (null != elems)
{
int pos = findGTE(elems, 1, elems[0], firstPotential);
if (pos > -1)
{
return elems[pos];
}
}
}
}
return NOTPROCESSED;
} | java | int findElementFromIndex(int nsIndex, int lnIndex, int firstPotential)
{
int[][][] indexes = m_elemIndexes;
if (null != indexes && nsIndex < indexes.length)
{
int[][] lnIndexs = indexes[nsIndex];
if (null != lnIndexs && lnIndex < lnIndexs.length)
{
int[] elems = lnIndexs[lnIndex];
if (null != elems)
{
int pos = findGTE(elems, 1, elems[0], firstPotential);
if (pos > -1)
{
return elems[pos];
}
}
}
}
return NOTPROCESSED;
} | [
"int",
"findElementFromIndex",
"(",
"int",
"nsIndex",
",",
"int",
"lnIndex",
",",
"int",
"firstPotential",
")",
"{",
"int",
"[",
"]",
"[",
"]",
"[",
"]",
"indexes",
"=",
"m_elemIndexes",
";",
"if",
"(",
"null",
"!=",
"indexes",
"&&",
"nsIndex",
"<",
"i... | Find the first matching element from the index at or after the
given node.
@param nsIndex The namespace index lookup.
@param lnIndex The local name index lookup.
@param firstPotential The first potential match that is worth looking at.
@return The first node that is greater than or equal to the
firstPotential argument, or DTM.NOTPROCESSED if not found. | [
"Find",
"the",
"first",
"matching",
"element",
"from",
"the",
"index",
"at",
"or",
"after",
"the",
"given",
"node",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L385-L411 |
33,888 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase._type | protected short _type(int identity)
{
int info = _exptype(identity);
if (NULL != info)
return m_expandedNameTable.getType(info);
else
return NULL;
} | java | protected short _type(int identity)
{
int info = _exptype(identity);
if (NULL != info)
return m_expandedNameTable.getType(info);
else
return NULL;
} | [
"protected",
"short",
"_type",
"(",
"int",
"identity",
")",
"{",
"int",
"info",
"=",
"_exptype",
"(",
"identity",
")",
";",
"if",
"(",
"NULL",
"!=",
"info",
")",
"return",
"m_expandedNameTable",
".",
"getType",
"(",
"info",
")",
";",
"else",
"return",
... | Get the simple type ID for the given node identity.
@param identity The node identity.
@return The simple type ID, or DTM.NULL. | [
"Get",
"the",
"simple",
"type",
"ID",
"for",
"the",
"given",
"node",
"identity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L459-L468 |
33,889 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase._exptype | protected int _exptype(int identity)
{
if (identity == DTM.NULL)
return NULL;
// Reorganized test and loop into single flow
// Tiny performance improvement, saves a few bytes of code, clearer.
// %OPT% Other internal getters could be treated simliarly
while (identity>=m_size)
{
if (!nextNode() && identity >= m_size)
return NULL;
}
return m_exptype.elementAt(identity);
} | java | protected int _exptype(int identity)
{
if (identity == DTM.NULL)
return NULL;
// Reorganized test and loop into single flow
// Tiny performance improvement, saves a few bytes of code, clearer.
// %OPT% Other internal getters could be treated simliarly
while (identity>=m_size)
{
if (!nextNode() && identity >= m_size)
return NULL;
}
return m_exptype.elementAt(identity);
} | [
"protected",
"int",
"_exptype",
"(",
"int",
"identity",
")",
"{",
"if",
"(",
"identity",
"==",
"DTM",
".",
"NULL",
")",
"return",
"NULL",
";",
"// Reorganized test and loop into single flow",
"// Tiny performance improvement, saves a few bytes of code, clearer.",
"// %OPT% ... | Get the expanded type ID for the given node identity.
@param identity The node identity.
@return The expanded type ID, or DTM.NULL. | [
"Get",
"the",
"expanded",
"type",
"ID",
"for",
"the",
"given",
"node",
"identity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L477-L491 |
33,890 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase._level | protected int _level(int identity)
{
while (identity>=m_size)
{
boolean isMore = nextNode();
if (!isMore && identity >= m_size)
return NULL;
}
int i=0;
while(NULL != (identity=_parent(identity)))
++i;
return i;
} | java | protected int _level(int identity)
{
while (identity>=m_size)
{
boolean isMore = nextNode();
if (!isMore && identity >= m_size)
return NULL;
}
int i=0;
while(NULL != (identity=_parent(identity)))
++i;
return i;
} | [
"protected",
"int",
"_level",
"(",
"int",
"identity",
")",
"{",
"while",
"(",
"identity",
">=",
"m_size",
")",
"{",
"boolean",
"isMore",
"=",
"nextNode",
"(",
")",
";",
"if",
"(",
"!",
"isMore",
"&&",
"identity",
">=",
"m_size",
")",
"return",
"NULL",
... | Get the level in the tree for the given node identity.
@param identity The node identity.
@return The tree level, or DTM.NULL. | [
"Get",
"the",
"level",
"in",
"the",
"tree",
"for",
"the",
"given",
"node",
"identity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L500-L513 |
33,891 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase._firstch | protected int _firstch(int identity)
{
// Boiler-plate code for each of the _xxx functions, except for the array.
int info = (identity >= m_size) ? NOTPROCESSED : m_firstch.elementAt(identity);
// Check to see if the information requested has been processed, and,
// if not, advance the iterator until we the information has been
// processed.
while (info == NOTPROCESSED)
{
boolean isMore = nextNode();
if (identity >= m_size &&!isMore)
return NULL;
else
{
info = m_firstch.elementAt(identity);
if(info == NOTPROCESSED && !isMore)
return NULL;
}
}
return info;
} | java | protected int _firstch(int identity)
{
// Boiler-plate code for each of the _xxx functions, except for the array.
int info = (identity >= m_size) ? NOTPROCESSED : m_firstch.elementAt(identity);
// Check to see if the information requested has been processed, and,
// if not, advance the iterator until we the information has been
// processed.
while (info == NOTPROCESSED)
{
boolean isMore = nextNode();
if (identity >= m_size &&!isMore)
return NULL;
else
{
info = m_firstch.elementAt(identity);
if(info == NOTPROCESSED && !isMore)
return NULL;
}
}
return info;
} | [
"protected",
"int",
"_firstch",
"(",
"int",
"identity",
")",
"{",
"// Boiler-plate code for each of the _xxx functions, except for the array.",
"int",
"info",
"=",
"(",
"identity",
">=",
"m_size",
")",
"?",
"NOTPROCESSED",
":",
"m_firstch",
".",
"elementAt",
"(",
"ide... | Get the first child for the given node identity.
@param identity The node identity.
@return The first child identity, or DTM.NULL. | [
"Get",
"the",
"first",
"child",
"for",
"the",
"given",
"node",
"identity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L522-L546 |
33,892 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase._nextsib | protected int _nextsib(int identity)
{
// Boiler-plate code for each of the _xxx functions, except for the array.
int info = (identity >= m_size) ? NOTPROCESSED : m_nextsib.elementAt(identity);
// Check to see if the information requested has been processed, and,
// if not, advance the iterator until we the information has been
// processed.
while (info == NOTPROCESSED)
{
boolean isMore = nextNode();
if (identity >= m_size &&!isMore)
return NULL;
else
{
info = m_nextsib.elementAt(identity);
if(info == NOTPROCESSED && !isMore)
return NULL;
}
}
return info;
} | java | protected int _nextsib(int identity)
{
// Boiler-plate code for each of the _xxx functions, except for the array.
int info = (identity >= m_size) ? NOTPROCESSED : m_nextsib.elementAt(identity);
// Check to see if the information requested has been processed, and,
// if not, advance the iterator until we the information has been
// processed.
while (info == NOTPROCESSED)
{
boolean isMore = nextNode();
if (identity >= m_size &&!isMore)
return NULL;
else
{
info = m_nextsib.elementAt(identity);
if(info == NOTPROCESSED && !isMore)
return NULL;
}
}
return info;
} | [
"protected",
"int",
"_nextsib",
"(",
"int",
"identity",
")",
"{",
"// Boiler-plate code for each of the _xxx functions, except for the array.",
"int",
"info",
"=",
"(",
"identity",
">=",
"m_size",
")",
"?",
"NOTPROCESSED",
":",
"m_nextsib",
".",
"elementAt",
"(",
"ide... | Get the next sibling for the given node identity.
@param identity The node identity.
@return The next sibling identity, or DTM.NULL. | [
"Get",
"the",
"next",
"sibling",
"for",
"the",
"given",
"node",
"identity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L555-L578 |
33,893 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase._prevsib | protected int _prevsib(int identity)
{
if (identity < m_size)
return m_prevsib.elementAt(identity);
// Check to see if the information requested has been processed, and,
// if not, advance the iterator until we the information has been
// processed.
while (true)
{
boolean isMore = nextNode();
if (identity >= m_size && !isMore)
return NULL;
else if (identity < m_size)
return m_prevsib.elementAt(identity);
}
} | java | protected int _prevsib(int identity)
{
if (identity < m_size)
return m_prevsib.elementAt(identity);
// Check to see if the information requested has been processed, and,
// if not, advance the iterator until we the information has been
// processed.
while (true)
{
boolean isMore = nextNode();
if (identity >= m_size && !isMore)
return NULL;
else if (identity < m_size)
return m_prevsib.elementAt(identity);
}
} | [
"protected",
"int",
"_prevsib",
"(",
"int",
"identity",
")",
"{",
"if",
"(",
"identity",
"<",
"m_size",
")",
"return",
"m_prevsib",
".",
"elementAt",
"(",
"identity",
")",
";",
"// Check to see if the information requested has been processed, and,",
"// if not, advance ... | Get the previous sibling for the given node identity.
@param identity The node identity.
@return The previous sibling identity, or DTM.NULL. | [
"Get",
"the",
"previous",
"sibling",
"for",
"the",
"given",
"node",
"identity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L587-L605 |
33,894 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase._parent | protected int _parent(int identity)
{
if (identity < m_size)
return m_parent.elementAt(identity);
// Check to see if the information requested has been processed, and,
// if not, advance the iterator until we the information has been
// processed.
while (true)
{
boolean isMore = nextNode();
if (identity >= m_size && !isMore)
return NULL;
else if (identity < m_size)
return m_parent.elementAt(identity);
}
} | java | protected int _parent(int identity)
{
if (identity < m_size)
return m_parent.elementAt(identity);
// Check to see if the information requested has been processed, and,
// if not, advance the iterator until we the information has been
// processed.
while (true)
{
boolean isMore = nextNode();
if (identity >= m_size && !isMore)
return NULL;
else if (identity < m_size)
return m_parent.elementAt(identity);
}
} | [
"protected",
"int",
"_parent",
"(",
"int",
"identity",
")",
"{",
"if",
"(",
"identity",
"<",
"m_size",
")",
"return",
"m_parent",
".",
"elementAt",
"(",
"identity",
")",
";",
"// Check to see if the information requested has been processed, and,",
"// if not, advance th... | Get the parent for the given node identity.
@param identity The node identity.
@return The parent identity, or DTM.NULL. | [
"Get",
"the",
"parent",
"for",
"the",
"given",
"node",
"identity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L614-L632 |
33,895 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.dumpNode | public String dumpNode(int nodeHandle)
{
if(nodeHandle==DTM.NULL)
return "[null]";
String typestring;
switch (getNodeType(nodeHandle))
{
case DTM.ATTRIBUTE_NODE :
typestring = "ATTR";
break;
case DTM.CDATA_SECTION_NODE :
typestring = "CDATA";
break;
case DTM.COMMENT_NODE :
typestring = "COMMENT";
break;
case DTM.DOCUMENT_FRAGMENT_NODE :
typestring = "DOC_FRAG";
break;
case DTM.DOCUMENT_NODE :
typestring = "DOC";
break;
case DTM.DOCUMENT_TYPE_NODE :
typestring = "DOC_TYPE";
break;
case DTM.ELEMENT_NODE :
typestring = "ELEMENT";
break;
case DTM.ENTITY_NODE :
typestring = "ENTITY";
break;
case DTM.ENTITY_REFERENCE_NODE :
typestring = "ENT_REF";
break;
case DTM.NAMESPACE_NODE :
typestring = "NAMESPACE";
break;
case DTM.NOTATION_NODE :
typestring = "NOTATION";
break;
case DTM.NULL :
typestring = "null";
break;
case DTM.PROCESSING_INSTRUCTION_NODE :
typestring = "PI";
break;
case DTM.TEXT_NODE :
typestring = "TEXT";
break;
default :
typestring = "Unknown!";
break;
}
StringBuffer sb=new StringBuffer();
sb.append("["+nodeHandle+": "+typestring+
"(0x"+Integer.toHexString(getExpandedTypeID(nodeHandle))+") "+
getNodeNameX(nodeHandle)+" {"+getNamespaceURI(nodeHandle)+"}"+
"=\""+ getNodeValue(nodeHandle)+"\"]");
return sb.toString();
} | java | public String dumpNode(int nodeHandle)
{
if(nodeHandle==DTM.NULL)
return "[null]";
String typestring;
switch (getNodeType(nodeHandle))
{
case DTM.ATTRIBUTE_NODE :
typestring = "ATTR";
break;
case DTM.CDATA_SECTION_NODE :
typestring = "CDATA";
break;
case DTM.COMMENT_NODE :
typestring = "COMMENT";
break;
case DTM.DOCUMENT_FRAGMENT_NODE :
typestring = "DOC_FRAG";
break;
case DTM.DOCUMENT_NODE :
typestring = "DOC";
break;
case DTM.DOCUMENT_TYPE_NODE :
typestring = "DOC_TYPE";
break;
case DTM.ELEMENT_NODE :
typestring = "ELEMENT";
break;
case DTM.ENTITY_NODE :
typestring = "ENTITY";
break;
case DTM.ENTITY_REFERENCE_NODE :
typestring = "ENT_REF";
break;
case DTM.NAMESPACE_NODE :
typestring = "NAMESPACE";
break;
case DTM.NOTATION_NODE :
typestring = "NOTATION";
break;
case DTM.NULL :
typestring = "null";
break;
case DTM.PROCESSING_INSTRUCTION_NODE :
typestring = "PI";
break;
case DTM.TEXT_NODE :
typestring = "TEXT";
break;
default :
typestring = "Unknown!";
break;
}
StringBuffer sb=new StringBuffer();
sb.append("["+nodeHandle+": "+typestring+
"(0x"+Integer.toHexString(getExpandedTypeID(nodeHandle))+") "+
getNodeNameX(nodeHandle)+" {"+getNamespaceURI(nodeHandle)+"}"+
"=\""+ getNodeValue(nodeHandle)+"\"]");
return sb.toString();
} | [
"public",
"String",
"dumpNode",
"(",
"int",
"nodeHandle",
")",
"{",
"if",
"(",
"nodeHandle",
"==",
"DTM",
".",
"NULL",
")",
"return",
"\"[null]\"",
";",
"String",
"typestring",
";",
"switch",
"(",
"getNodeType",
"(",
"nodeHandle",
")",
")",
"{",
"case",
... | Diagnostics function to dump a single node.
%REVIEW% KNOWN GLITCH: If you pass it a node index rather than a
node handle, it works just fine... but the displayed identity
number before the colon is different, which complicates comparing
it with nodes printed the other way. We could always OR the DTM ID
into the value, to suppress that distinction...
%REVIEW% This might want to be moved up to DTMDefaultBase, or possibly
DTM itself, since it's a useful diagnostic and uses only DTM's public
APIs. | [
"Diagnostics",
"function",
"to",
"dump",
"a",
"single",
"node",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L790-L851 |
33,896 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.getFirstAttributeIdentity | protected int getFirstAttributeIdentity(int identity) {
int type = _type(identity);
if (DTM.ELEMENT_NODE == type)
{
// Assume that attributes and namespaces immediately follow the element.
while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
{
// Assume this can not be null.
type = _type(identity);
if (type == DTM.ATTRIBUTE_NODE)
{
return identity;
}
else if (DTM.NAMESPACE_NODE != type)
{
break;
}
}
}
return DTM.NULL;
} | java | protected int getFirstAttributeIdentity(int identity) {
int type = _type(identity);
if (DTM.ELEMENT_NODE == type)
{
// Assume that attributes and namespaces immediately follow the element.
while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
{
// Assume this can not be null.
type = _type(identity);
if (type == DTM.ATTRIBUTE_NODE)
{
return identity;
}
else if (DTM.NAMESPACE_NODE != type)
{
break;
}
}
}
return DTM.NULL;
} | [
"protected",
"int",
"getFirstAttributeIdentity",
"(",
"int",
"identity",
")",
"{",
"int",
"type",
"=",
"_type",
"(",
"identity",
")",
";",
"if",
"(",
"DTM",
".",
"ELEMENT_NODE",
"==",
"type",
")",
"{",
"// Assume that attributes and namespaces immediately follow the... | Given a node identity, get the index of the node's first attribute.
@param identity int identity of the node.
@return Identity of first attribute, or DTM.NULL to indicate none exists. | [
"Given",
"a",
"node",
"identity",
"get",
"the",
"index",
"of",
"the",
"node",
"s",
"first",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1072-L1096 |
33,897 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.getTypedAttribute | protected int getTypedAttribute(int nodeHandle, int attType) {
int type = getNodeType(nodeHandle);
if (DTM.ELEMENT_NODE == type) {
int identity = makeNodeIdentity(nodeHandle);
while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
{
type = _type(identity);
if (type == DTM.ATTRIBUTE_NODE)
{
if (_exptype(identity) == attType) return makeNodeHandle(identity);
}
else if (DTM.NAMESPACE_NODE != type)
{
break;
}
}
}
return DTM.NULL;
} | java | protected int getTypedAttribute(int nodeHandle, int attType) {
int type = getNodeType(nodeHandle);
if (DTM.ELEMENT_NODE == type) {
int identity = makeNodeIdentity(nodeHandle);
while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
{
type = _type(identity);
if (type == DTM.ATTRIBUTE_NODE)
{
if (_exptype(identity) == attType) return makeNodeHandle(identity);
}
else if (DTM.NAMESPACE_NODE != type)
{
break;
}
}
}
return DTM.NULL;
} | [
"protected",
"int",
"getTypedAttribute",
"(",
"int",
"nodeHandle",
",",
"int",
"attType",
")",
"{",
"int",
"type",
"=",
"getNodeType",
"(",
"nodeHandle",
")",
";",
"if",
"(",
"DTM",
".",
"ELEMENT_NODE",
"==",
"type",
")",
"{",
"int",
"identity",
"=",
"ma... | Given a node handle and an expanded type ID, get the index of the node's
attribute of that type, if any.
@param nodeHandle int Handle of the node.
@param attType int expanded type ID of the required attribute.
@return Handle of attribute of the required type, or DTM.NULL to indicate
none exists. | [
"Given",
"a",
"node",
"handle",
"and",
"an",
"expanded",
"type",
"ID",
"get",
"the",
"index",
"of",
"the",
"node",
"s",
"attribute",
"of",
"that",
"type",
"if",
"any",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1107-L1128 |
33,898 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.getNextAttribute | public int getNextAttribute(int nodeHandle) {
int nodeID = makeNodeIdentity(nodeHandle);
if (_type(nodeID) == DTM.ATTRIBUTE_NODE) {
return makeNodeHandle(getNextAttributeIdentity(nodeID));
}
return DTM.NULL;
} | java | public int getNextAttribute(int nodeHandle) {
int nodeID = makeNodeIdentity(nodeHandle);
if (_type(nodeID) == DTM.ATTRIBUTE_NODE) {
return makeNodeHandle(getNextAttributeIdentity(nodeID));
}
return DTM.NULL;
} | [
"public",
"int",
"getNextAttribute",
"(",
"int",
"nodeHandle",
")",
"{",
"int",
"nodeID",
"=",
"makeNodeIdentity",
"(",
"nodeHandle",
")",
";",
"if",
"(",
"_type",
"(",
"nodeID",
")",
"==",
"DTM",
".",
"ATTRIBUTE_NODE",
")",
"{",
"return",
"makeNodeHandle",
... | Given a node handle, advance to the next attribute.
If an attr, we advance to
the next attr on the same node. If not an attribute, we return NULL.
@param nodeHandle int Handle of the node.
@return int DTM node-number of the resolved attr,
or DTM.NULL to indicate none exists. | [
"Given",
"a",
"node",
"handle",
"advance",
"to",
"the",
"next",
"attribute",
".",
"If",
"an",
"attr",
"we",
"advance",
"to",
"the",
"next",
"attr",
"on",
"the",
"same",
"node",
".",
"If",
"not",
"an",
"attribute",
"we",
"return",
"NULL",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1210-L1218 |
33,899 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.getNextAttributeIdentity | protected int getNextAttributeIdentity(int identity) {
// Assume that attributes and namespace nodes immediately follow the element
while (DTM.NULL != (identity = getNextNodeIdentity(identity))) {
int type = _type(identity);
if (type == DTM.ATTRIBUTE_NODE) {
return identity;
} else if (type != DTM.NAMESPACE_NODE) {
break;
}
}
return DTM.NULL;
} | java | protected int getNextAttributeIdentity(int identity) {
// Assume that attributes and namespace nodes immediately follow the element
while (DTM.NULL != (identity = getNextNodeIdentity(identity))) {
int type = _type(identity);
if (type == DTM.ATTRIBUTE_NODE) {
return identity;
} else if (type != DTM.NAMESPACE_NODE) {
break;
}
}
return DTM.NULL;
} | [
"protected",
"int",
"getNextAttributeIdentity",
"(",
"int",
"identity",
")",
"{",
"// Assume that attributes and namespace nodes immediately follow the element",
"while",
"(",
"DTM",
".",
"NULL",
"!=",
"(",
"identity",
"=",
"getNextNodeIdentity",
"(",
"identity",
")",
")"... | Given a node identity for an attribute, advance to the next attribute.
@param identity int identity of the attribute node. This
<strong>must</strong> be an attribute node.
@return int DTM node-identity of the resolved attr,
or DTM.NULL to indicate none exists. | [
"Given",
"a",
"node",
"identity",
"for",
"an",
"attribute",
"advance",
"to",
"the",
"next",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1230-L1243 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.