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
34,900
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java
Net.inet6AsByteArray
static byte[] inet6AsByteArray(InetAddress ia) { if (ia instanceof Inet6Address) { return ia.getAddress(); } // need to construct IPv4-mapped address if (ia instanceof Inet4Address) { byte[] ip4address = ia.getAddress(); byte[] address = new byte[16]; address[10] = (byte)0xff; address[11] = (byte)0xff; address[12] = ip4address[0]; address[13] = ip4address[1]; address[14] = ip4address[2]; address[15] = ip4address[3]; return address; } throw new AssertionError("Should not reach here"); }
java
static byte[] inet6AsByteArray(InetAddress ia) { if (ia instanceof Inet6Address) { return ia.getAddress(); } // need to construct IPv4-mapped address if (ia instanceof Inet4Address) { byte[] ip4address = ia.getAddress(); byte[] address = new byte[16]; address[10] = (byte)0xff; address[11] = (byte)0xff; address[12] = ip4address[0]; address[13] = ip4address[1]; address[14] = ip4address[2]; address[15] = ip4address[3]; return address; } throw new AssertionError("Should not reach here"); }
[ "static", "byte", "[", "]", "inet6AsByteArray", "(", "InetAddress", "ia", ")", "{", "if", "(", "ia", "instanceof", "Inet6Address", ")", "{", "return", "ia", ".", "getAddress", "(", ")", ";", "}", "// need to construct IPv4-mapped address", "if", "(", "ia", "...
Returns an IPv6 address as a byte array
[ "Returns", "an", "IPv6", "address", "as", "a", "byte", "array" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java#L308-L327
34,901
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java
Net.join4
static int join4(FileDescriptor fd, int group, int interf, int source) throws IOException { return joinOrDrop4(true, fd, group, interf, source); }
java
static int join4(FileDescriptor fd, int group, int interf, int source) throws IOException { return joinOrDrop4(true, fd, group, interf, source); }
[ "static", "int", "join4", "(", "FileDescriptor", "fd", ",", "int", "group", ",", "int", "interf", ",", "int", "source", ")", "throws", "IOException", "{", "return", "joinOrDrop4", "(", "true", ",", "fd", ",", "group", ",", "interf", ",", "source", ")", ...
Join IPv4 multicast group
[ "Join", "IPv4", "multicast", "group" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java#L533-L537
34,902
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java
Net.drop4
static void drop4(FileDescriptor fd, int group, int interf, int source) throws IOException { joinOrDrop4(false, fd, group, interf, source); }
java
static void drop4(FileDescriptor fd, int group, int interf, int source) throws IOException { joinOrDrop4(false, fd, group, interf, source); }
[ "static", "void", "drop4", "(", "FileDescriptor", "fd", ",", "int", "group", ",", "int", "interf", ",", "int", "source", ")", "throws", "IOException", "{", "joinOrDrop4", "(", "false", ",", "fd", ",", "group", ",", "interf", ",", "source", ")", ";", "}...
Drop membership of IPv4 multicast group
[ "Drop", "membership", "of", "IPv4", "multicast", "group" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java#L542-L546
34,903
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java
Net.block4
static int block4(FileDescriptor fd, int group, int interf, int source) throws IOException { return blockOrUnblock4(true, fd, group, interf, source); }
java
static int block4(FileDescriptor fd, int group, int interf, int source) throws IOException { return blockOrUnblock4(true, fd, group, interf, source); }
[ "static", "int", "block4", "(", "FileDescriptor", "fd", ",", "int", "group", ",", "int", "interf", ",", "int", "source", ")", "throws", "IOException", "{", "return", "blockOrUnblock4", "(", "true", ",", "fd", ",", "group", ",", "interf", ",", "source", "...
Block IPv4 source
[ "Block", "IPv4", "source" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java#L554-L558
34,904
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java
Net.join6
static int join6(FileDescriptor fd, byte[] group, int index, byte[] source) throws IOException { return joinOrDrop6(true, fd, group, index, source); }
java
static int join6(FileDescriptor fd, byte[] group, int index, byte[] source) throws IOException { return joinOrDrop6(true, fd, group, index, source); }
[ "static", "int", "join6", "(", "FileDescriptor", "fd", ",", "byte", "[", "]", "group", ",", "int", "index", ",", "byte", "[", "]", "source", ")", "throws", "IOException", "{", "return", "joinOrDrop6", "(", "true", ",", "fd", ",", "group", ",", "index",...
Join IPv6 multicast group
[ "Join", "IPv6", "multicast", "group" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java#L576-L580
34,905
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java
Net.drop6
static void drop6(FileDescriptor fd, byte[] group, int index, byte[] source) throws IOException { joinOrDrop6(false, fd, group, index, source); }
java
static void drop6(FileDescriptor fd, byte[] group, int index, byte[] source) throws IOException { joinOrDrop6(false, fd, group, index, source); }
[ "static", "void", "drop6", "(", "FileDescriptor", "fd", ",", "byte", "[", "]", "group", ",", "int", "index", ",", "byte", "[", "]", "source", ")", "throws", "IOException", "{", "joinOrDrop6", "(", "false", ",", "fd", ",", "group", ",", "index", ",", ...
Drop membership of IPv6 multicast group
[ "Drop", "membership", "of", "IPv6", "multicast", "group" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java#L585-L589
34,906
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java
Net.block6
static int block6(FileDescriptor fd, byte[] group, int index, byte[] source) throws IOException { return blockOrUnblock6(true, fd, group, index, source); }
java
static int block6(FileDescriptor fd, byte[] group, int index, byte[] source) throws IOException { return blockOrUnblock6(true, fd, group, index, source); }
[ "static", "int", "block6", "(", "FileDescriptor", "fd", ",", "byte", "[", "]", "group", ",", "int", "index", ",", "byte", "[", "]", "source", ")", "throws", "IOException", "{", "return", "blockOrUnblock6", "(", "true", ",", "fd", ",", "group", ",", "in...
Block IPv6 source
[ "Block", "IPv6", "source" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java#L597-L601
34,907
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerIndefLenConverter.java
DerIndefLenConverter.writeTag
private void writeTag() { if (dataPos == dataSize) return; int tag = data[dataPos++]; if (isEOC(tag) && (data[dataPos] == 0)) { dataPos++; // skip length writeTag(); } else newData[newDataPos++] = (byte)tag; }
java
private void writeTag() { if (dataPos == dataSize) return; int tag = data[dataPos++]; if (isEOC(tag) && (data[dataPos] == 0)) { dataPos++; // skip length writeTag(); } else newData[newDataPos++] = (byte)tag; }
[ "private", "void", "writeTag", "(", ")", "{", "if", "(", "dataPos", "==", "dataSize", ")", "return", ";", "int", "tag", "=", "data", "[", "dataPos", "++", "]", ";", "if", "(", "isEOC", "(", "tag", ")", "&&", "(", "data", "[", "dataPos", "]", "=="...
Write the tag and if it is an end-of-contents tag then skip the tag and its 1 byte length of zero.
[ "Write", "the", "tag", "and", "if", "it", "is", "an", "end", "-", "of", "-", "contents", "tag", "then", "skip", "the", "tag", "and", "its", "1", "byte", "length", "of", "zero", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerIndefLenConverter.java#L132-L141
34,908
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerIndefLenConverter.java
DerIndefLenConverter.writeLengthAndValue
private void writeLengthAndValue() throws IOException { if (dataPos == dataSize) return; int curLen = 0; int lenByte = data[dataPos++] & 0xff; if (isIndefinite(lenByte)) { byte[] lenBytes = (byte[])ndefsList.get(index++); System.arraycopy(lenBytes, 0, newData, newDataPos, lenBytes.length); newDataPos += lenBytes.length; return; } if (isLongForm(lenByte)) { lenByte &= LEN_MASK; for (int i = 0; i < lenByte; i++) { curLen = (curLen << 8) + (data[dataPos++] & 0xff); } if (curLen < 0) { throw new IOException("Invalid length bytes"); } } else { curLen = (lenByte & LEN_MASK); } writeLength(curLen); writeValue(curLen); }
java
private void writeLengthAndValue() throws IOException { if (dataPos == dataSize) return; int curLen = 0; int lenByte = data[dataPos++] & 0xff; if (isIndefinite(lenByte)) { byte[] lenBytes = (byte[])ndefsList.get(index++); System.arraycopy(lenBytes, 0, newData, newDataPos, lenBytes.length); newDataPos += lenBytes.length; return; } if (isLongForm(lenByte)) { lenByte &= LEN_MASK; for (int i = 0; i < lenByte; i++) { curLen = (curLen << 8) + (data[dataPos++] & 0xff); } if (curLen < 0) { throw new IOException("Invalid length bytes"); } } else { curLen = (lenByte & LEN_MASK); } writeLength(curLen); writeValue(curLen); }
[ "private", "void", "writeLengthAndValue", "(", ")", "throws", "IOException", "{", "if", "(", "dataPos", "==", "dataSize", ")", "return", ";", "int", "curLen", "=", "0", ";", "int", "lenByte", "=", "data", "[", "dataPos", "++", "]", "&", "0xff", ";", "i...
Write the length and if it is an indefinite length then calculate the definite length from the positions of the indefinite length and its matching EOC terminator. Then, write the value.
[ "Write", "the", "length", "and", "if", "it", "is", "an", "indefinite", "length", "then", "calculate", "the", "definite", "length", "from", "the", "positions", "of", "the", "indefinite", "length", "and", "its", "matching", "EOC", "terminator", ".", "Then", "w...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerIndefLenConverter.java#L183-L208
34,909
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerIndefLenConverter.java
DerIndefLenConverter.getNumOfLenBytes
private int getNumOfLenBytes(int len) { int numOfLenBytes = 0; if (len < 128) { numOfLenBytes = 1; } else if (len < (1 << 8)) { numOfLenBytes = 2; } else if (len < (1 << 16)) { numOfLenBytes = 3; } else if (len < (1 << 24)) { numOfLenBytes = 4; } else { numOfLenBytes = 5; } return numOfLenBytes; }
java
private int getNumOfLenBytes(int len) { int numOfLenBytes = 0; if (len < 128) { numOfLenBytes = 1; } else if (len < (1 << 8)) { numOfLenBytes = 2; } else if (len < (1 << 16)) { numOfLenBytes = 3; } else if (len < (1 << 24)) { numOfLenBytes = 4; } else { numOfLenBytes = 5; } return numOfLenBytes; }
[ "private", "int", "getNumOfLenBytes", "(", "int", "len", ")", "{", "int", "numOfLenBytes", "=", "0", ";", "if", "(", "len", "<", "128", ")", "{", "numOfLenBytes", "=", "1", ";", "}", "else", "if", "(", "len", "<", "(", "1", "<<", "8", ")", ")", ...
in ASN.1 notation
[ "in", "ASN", ".", "1", "notation" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerIndefLenConverter.java#L278-L293
34,910
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerIndefLenConverter.java
DerIndefLenConverter.writeValue
private void writeValue(int curLen) { for (int i=0; i < curLen; i++) newData[newDataPos++] = data[dataPos++]; }
java
private void writeValue(int curLen) { for (int i=0; i < curLen; i++) newData[newDataPos++] = data[dataPos++]; }
[ "private", "void", "writeValue", "(", "int", "curLen", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "curLen", ";", "i", "++", ")", "newData", "[", "newDataPos", "++", "]", "=", "data", "[", "dataPos", "++", "]", ";", "}" ]
Write the value;
[ "Write", "the", "value", ";" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerIndefLenConverter.java#L305-L308
34,911
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerIndefLenConverter.java
DerIndefLenConverter.convert
byte[] convert(byte[] indefData) throws IOException { data = indefData; dataPos=0; index=0; dataSize = data.length; int len=0; int unused = 0; // parse and set up the vectors of all the indefinite-lengths while (dataPos < dataSize) { parseTag(); len = parseLength(); parseValue(len); if (unresolved == 0) { unused = dataSize - dataPos; dataSize = dataPos; break; } } if (unresolved != 0) { throw new IOException("not all indef len BER resolved"); } newData = new byte[dataSize + numOfTotalLenBytes + unused]; dataPos=0; newDataPos=0; index=0; // write out the new byte array replacing all the indefinite-lengths // and EOCs while (dataPos < dataSize) { writeTag(); writeLengthAndValue(); } System.arraycopy(indefData, dataSize, newData, dataSize + numOfTotalLenBytes, unused); return newData; }
java
byte[] convert(byte[] indefData) throws IOException { data = indefData; dataPos=0; index=0; dataSize = data.length; int len=0; int unused = 0; // parse and set up the vectors of all the indefinite-lengths while (dataPos < dataSize) { parseTag(); len = parseLength(); parseValue(len); if (unresolved == 0) { unused = dataSize - dataPos; dataSize = dataPos; break; } } if (unresolved != 0) { throw new IOException("not all indef len BER resolved"); } newData = new byte[dataSize + numOfTotalLenBytes + unused]; dataPos=0; newDataPos=0; index=0; // write out the new byte array replacing all the indefinite-lengths // and EOCs while (dataPos < dataSize) { writeTag(); writeLengthAndValue(); } System.arraycopy(indefData, dataSize, newData, dataSize + numOfTotalLenBytes, unused); return newData; }
[ "byte", "[", "]", "convert", "(", "byte", "[", "]", "indefData", ")", "throws", "IOException", "{", "data", "=", "indefData", ";", "dataPos", "=", "0", ";", "index", "=", "0", ";", "dataSize", "=", "data", ".", "length", ";", "int", "len", "=", "0"...
Converts a indefinite length DER encoded byte array to a definte length DER encoding. @param indefData the byte array holding the indefinite length encoding. @return the byte array containing the definite length DER encoding. @exception IOException on parsing or re-writing errors.
[ "Converts", "a", "indefinite", "length", "DER", "encoded", "byte", "array", "to", "a", "definte", "length", "DER", "encoding", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerIndefLenConverter.java#L320-L356
34,912
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ContentHandler.java
ContentHandler.getContent
@SuppressWarnings("rawtypes") public Object getContent(URLConnection urlc, Class[] classes) throws IOException { Object obj = getContent(urlc); for (int i = 0; i < classes.length; i++) { if (classes[i].isInstance(obj)) { return obj; } } return null; }
java
@SuppressWarnings("rawtypes") public Object getContent(URLConnection urlc, Class[] classes) throws IOException { Object obj = getContent(urlc); for (int i = 0; i < classes.length; i++) { if (classes[i].isInstance(obj)) { return obj; } } return null; }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "Object", "getContent", "(", "URLConnection", "urlc", ",", "Class", "[", "]", "classes", ")", "throws", "IOException", "{", "Object", "obj", "=", "getContent", "(", "urlc", ")", ";", "for", "(", ...
Given a URL connect stream positioned at the beginning of the representation of an object, this method reads that stream and creates an object that matches one of the types specified. The default implementation of this method should call getContent() and screen the return type for a match of the suggested types. @param urlc a URL connection. @param classes an array of types requested @return the object read by the {@code ContentHandler} that is the first match of the suggested types. null if none of the requested are supported. @exception IOException if an I/O error occurs while reading the object. @since 1.3
[ "Given", "a", "URL", "connect", "stream", "positioned", "at", "the", "beginning", "of", "the", "representation", "of", "an", "object", "this", "method", "reads", "that", "stream", "and", "creates", "an", "object", "that", "matches", "one", "of", "the", "type...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ContentHandler.java#L99-L109
34,913
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneOffset.java
ZoneOffset.parseNumber
private static int parseNumber(CharSequence offsetId, int pos, boolean precededByColon) { if (precededByColon && offsetId.charAt(pos - 1) != ':') { throw new DateTimeException("Invalid ID for ZoneOffset, colon not found when expected: " + offsetId); } char ch1 = offsetId.charAt(pos); char ch2 = offsetId.charAt(pos + 1); if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') { throw new DateTimeException("Invalid ID for ZoneOffset, non numeric characters found: " + offsetId); } return (ch1 - 48) * 10 + (ch2 - 48); }
java
private static int parseNumber(CharSequence offsetId, int pos, boolean precededByColon) { if (precededByColon && offsetId.charAt(pos - 1) != ':') { throw new DateTimeException("Invalid ID for ZoneOffset, colon not found when expected: " + offsetId); } char ch1 = offsetId.charAt(pos); char ch2 = offsetId.charAt(pos + 1); if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') { throw new DateTimeException("Invalid ID for ZoneOffset, non numeric characters found: " + offsetId); } return (ch1 - 48) * 10 + (ch2 - 48); }
[ "private", "static", "int", "parseNumber", "(", "CharSequence", "offsetId", ",", "int", "pos", ",", "boolean", "precededByColon", ")", "{", "if", "(", "precededByColon", "&&", "offsetId", ".", "charAt", "(", "pos", "-", "1", ")", "!=", "'", "'", ")", "{"...
Parse a two digit zero-prefixed number. @param offsetId the offset ID, not null @param pos the position to parse, valid @param precededByColon should this number be prefixed by a precededByColon @return the parsed number, from 0 to 99
[ "Parse", "a", "two", "digit", "zero", "-", "prefixed", "number", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneOffset.java#L256-L266
34,914
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneOffset.java
ZoneOffset.validate
private static void validate(int hours, int minutes, int seconds) { if (hours < -18 || hours > 18) { throw new DateTimeException("Zone offset hours not in valid range: value " + hours + " is not in the range -18 to 18"); } if (hours > 0) { if (minutes < 0 || seconds < 0) { throw new DateTimeException("Zone offset minutes and seconds must be positive because hours is positive"); } } else if (hours < 0) { if (minutes > 0 || seconds > 0) { throw new DateTimeException("Zone offset minutes and seconds must be negative because hours is negative"); } } else if ((minutes > 0 && seconds < 0) || (minutes < 0 && seconds > 0)) { throw new DateTimeException("Zone offset minutes and seconds must have the same sign"); } if (Math.abs(minutes) > 59) { throw new DateTimeException("Zone offset minutes not in valid range: abs(value) " + Math.abs(minutes) + " is not in the range 0 to 59"); } if (Math.abs(seconds) > 59) { throw new DateTimeException("Zone offset seconds not in valid range: abs(value) " + Math.abs(seconds) + " is not in the range 0 to 59"); } if (Math.abs(hours) == 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) { throw new DateTimeException("Zone offset not in valid range: -18:00 to +18:00"); } }
java
private static void validate(int hours, int minutes, int seconds) { if (hours < -18 || hours > 18) { throw new DateTimeException("Zone offset hours not in valid range: value " + hours + " is not in the range -18 to 18"); } if (hours > 0) { if (minutes < 0 || seconds < 0) { throw new DateTimeException("Zone offset minutes and seconds must be positive because hours is positive"); } } else if (hours < 0) { if (minutes > 0 || seconds > 0) { throw new DateTimeException("Zone offset minutes and seconds must be negative because hours is negative"); } } else if ((minutes > 0 && seconds < 0) || (minutes < 0 && seconds > 0)) { throw new DateTimeException("Zone offset minutes and seconds must have the same sign"); } if (Math.abs(minutes) > 59) { throw new DateTimeException("Zone offset minutes not in valid range: abs(value) " + Math.abs(minutes) + " is not in the range 0 to 59"); } if (Math.abs(seconds) > 59) { throw new DateTimeException("Zone offset seconds not in valid range: abs(value) " + Math.abs(seconds) + " is not in the range 0 to 59"); } if (Math.abs(hours) == 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) { throw new DateTimeException("Zone offset not in valid range: -18:00 to +18:00"); } }
[ "private", "static", "void", "validate", "(", "int", "hours", ",", "int", "minutes", ",", "int", "seconds", ")", "{", "if", "(", "hours", "<", "-", "18", "||", "hours", ">", "18", ")", "{", "throw", "new", "DateTimeException", "(", "\"Zone offset hours n...
Validates the offset fields. @param hours the time-zone offset in hours, from -18 to +18 @param minutes the time-zone offset in minutes, from 0 to &plusmn;59 @param seconds the time-zone offset in seconds, from 0 to &plusmn;59 @throws DateTimeException if the offset is not in the required range
[ "Validates", "the", "offset", "fields", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneOffset.java#L356-L383
34,915
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
ToXMLSAXHandler.namespaceAfterStartElement
public void namespaceAfterStartElement( final String prefix, final String uri) throws SAXException { startPrefixMapping(prefix,uri,false); }
java
public void namespaceAfterStartElement( final String prefix, final String uri) throws SAXException { startPrefixMapping(prefix,uri,false); }
[ "public", "void", "namespaceAfterStartElement", "(", "final", "String", "prefix", ",", "final", "String", "uri", ")", "throws", "SAXException", "{", "startPrefixMapping", "(", "prefix", ",", "uri", ",", "false", ")", ";", "}" ]
Send a namespace declaration in the output document. The namespace declaration will not be include if the namespace is already in scope with the same prefix.
[ "Send", "a", "namespace", "declaration", "in", "the", "output", "document", ".", "The", "namespace", "declaration", "will", "not", "be", "include", "if", "the", "namespace", "is", "already", "in", "scope", "with", "the", "same", "prefix", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java#L564-L570
34,916
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java
ToXMLSAXHandler.popNamespace
protected boolean popNamespace(String prefix) { try { if (m_prefixMap.popNamespace(prefix)) { m_saxHandler.endPrefixMapping(prefix); return true; } } catch (SAXException e) { // falls through } return false; }
java
protected boolean popNamespace(String prefix) { try { if (m_prefixMap.popNamespace(prefix)) { m_saxHandler.endPrefixMapping(prefix); return true; } } catch (SAXException e) { // falls through } return false; }
[ "protected", "boolean", "popNamespace", "(", "String", "prefix", ")", "{", "try", "{", "if", "(", "m_prefixMap", ".", "popNamespace", "(", "prefix", ")", ")", "{", "m_saxHandler", ".", "endPrefixMapping", "(", "prefix", ")", ";", "return", "true", ";", "}"...
Undeclare the namespace that is currently pointed to by a given prefix. Inform SAX handler if prefix was previously mapped.
[ "Undeclare", "the", "namespace", "that", "is", "currently", "pointed", "to", "by", "a", "given", "prefix", ".", "Inform", "SAX", "handler", "if", "prefix", "was", "previously", "mapped", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLSAXHandler.java#L595-L610
34,917
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprIterator.java
FilterExprIterator.getNextNode
protected int getNextNode() { if (null != m_exprObj) { m_lastFetched = m_exprObj.nextNode(); } else m_lastFetched = DTM.NULL; return m_lastFetched; }
java
protected int getNextNode() { if (null != m_exprObj) { m_lastFetched = m_exprObj.nextNode(); } else m_lastFetched = DTM.NULL; return m_lastFetched; }
[ "protected", "int", "getNextNode", "(", ")", "{", "if", "(", "null", "!=", "m_exprObj", ")", "{", "m_lastFetched", "=", "m_exprObj", ".", "nextNode", "(", ")", ";", "}", "else", "m_lastFetched", "=", "DTM", ".", "NULL", ";", "return", "m_lastFetched", ";...
Get the next node via getNextXXX. Bottlenecked for derived class override. @return The next node on the axis, or DTM.NULL.
[ "Get", "the", "next", "node", "via", "getNextXXX", ".", "Bottlenecked", "for", "derived", "class", "override", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprIterator.java#L82-L92
34,918
google/j2objc
jre_emul/android/frameworks/base/core/java/android/text/SpanSet.java
SpanSet.hasSpansIntersecting
public boolean hasSpansIntersecting(int start, int end) { for (int i = 0; i < numberOfSpans; i++) { // equal test is valid since both intervals are not empty by construction if (spanStarts[i] >= end || spanEnds[i] <= start) continue; return true; } return false; }
java
public boolean hasSpansIntersecting(int start, int end) { for (int i = 0; i < numberOfSpans; i++) { // equal test is valid since both intervals are not empty by construction if (spanStarts[i] >= end || spanEnds[i] <= start) continue; return true; } return false; }
[ "public", "boolean", "hasSpansIntersecting", "(", "int", "start", ",", "int", "end", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numberOfSpans", ";", "i", "++", ")", "{", "// equal test is valid since both intervals are not empty by construction", ...
Returns true if there are spans intersecting the given interval. @param end must be strictly greater than start
[ "Returns", "true", "if", "there", "are", "spans", "intersecting", "the", "given", "interval", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpanSet.java#L80-L87
34,919
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/CookieManager.java
CookieManager.shouldAcceptInternal
private boolean shouldAcceptInternal(URI uri, HttpCookie cookie) { try { return policyCallback.shouldAccept(uri, cookie); } catch (Exception ignored) { // pretect against malicious callback return false; } }
java
private boolean shouldAcceptInternal(URI uri, HttpCookie cookie) { try { return policyCallback.shouldAccept(uri, cookie); } catch (Exception ignored) { // pretect against malicious callback return false; } }
[ "private", "boolean", "shouldAcceptInternal", "(", "URI", "uri", ",", "HttpCookie", "cookie", ")", "{", "try", "{", "return", "policyCallback", ".", "shouldAccept", "(", "uri", ",", "cookie", ")", ";", "}", "catch", "(", "Exception", "ignored", ")", "{", "...
to determine whether or not accept this cookie
[ "to", "determine", "whether", "or", "not", "accept", "this", "cookie" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/CookieManager.java#L356-L362
34,920
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/XMLReaderManager.java
XMLReaderManager.releaseXMLReader
public synchronized void releaseXMLReader(XMLReader reader) { // If the reader that's being released is the cached reader // for this thread, remove it from the m_isUse list. if (m_readers.get() == reader && reader != null) { m_inUse.remove(reader); } }
java
public synchronized void releaseXMLReader(XMLReader reader) { // If the reader that's being released is the cached reader // for this thread, remove it from the m_isUse list. if (m_readers.get() == reader && reader != null) { m_inUse.remove(reader); } }
[ "public", "synchronized", "void", "releaseXMLReader", "(", "XMLReader", "reader", ")", "{", "// If the reader that's being released is the cached reader", "// for this thread, remove it from the m_isUse list.", "if", "(", "m_readers", ".", "get", "(", ")", "==", "reader", "&&...
Mark the cached XMLReader as available. If the reader was not actually in the cache, do nothing. @param reader The XMLReader that's being released.
[ "Mark", "the", "cached", "XMLReader", "as", "available", ".", "If", "the", "reader", "was", "not", "actually", "in", "the", "cache", "do", "nothing", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/XMLReaderManager.java#L154-L160
34,921
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternTokenizer.java
PatternTokenizer.setExtraQuotingCharacters
public PatternTokenizer setExtraQuotingCharacters(UnicodeSet syntaxCharacters) { this.extraQuotingCharacters = (UnicodeSet) syntaxCharacters.clone(); needingQuoteCharacters = null; return this; }
java
public PatternTokenizer setExtraQuotingCharacters(UnicodeSet syntaxCharacters) { this.extraQuotingCharacters = (UnicodeSet) syntaxCharacters.clone(); needingQuoteCharacters = null; return this; }
[ "public", "PatternTokenizer", "setExtraQuotingCharacters", "(", "UnicodeSet", "syntaxCharacters", ")", "{", "this", ".", "extraQuotingCharacters", "=", "(", "UnicodeSet", ")", "syntaxCharacters", ".", "clone", "(", ")", ";", "needingQuoteCharacters", "=", "null", ";",...
Sets the extra characters to be quoted in literals @param syntaxCharacters Characters to be set as extra quoting characters. @return A PatternTokenizer object in which characters are specified as extra quoting characters.
[ "Sets", "the", "extra", "characters", "to", "be", "quoted", "in", "literals" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternTokenizer.java#L77-L81
34,922
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternTokenizer.java
PatternTokenizer.quoteLiteral
public String quoteLiteral(String string) { if (needingQuoteCharacters == null) { needingQuoteCharacters = new UnicodeSet().addAll(syntaxCharacters).addAll(ignorableCharacters).addAll(extraQuotingCharacters); // .addAll(quoteCharacters) if (usingSlash) needingQuoteCharacters.add(BACK_SLASH); if (usingQuote) needingQuoteCharacters.add(SINGLE_QUOTE); } StringBuffer result = new StringBuffer(); int quotedChar = NO_QUOTE; int cp; for (int i = 0; i < string.length(); i += UTF16.getCharCount(cp)) { cp = UTF16.charAt(string, i); if (escapeCharacters.contains(cp)) { // we may have to fix up previous characters if (quotedChar == IN_QUOTE) { result.append(SINGLE_QUOTE); quotedChar = NO_QUOTE; } appendEscaped(result, cp); continue; } if (needingQuoteCharacters.contains(cp)) { // if we have already started a quote if (quotedChar == IN_QUOTE) { UTF16.append(result, cp); if (usingQuote && cp == SINGLE_QUOTE) { // double it result.append(SINGLE_QUOTE); } continue; } // otherwise not already in quote if (usingSlash) { result.append(BACK_SLASH); UTF16.append(result, cp); continue; } if (usingQuote) { if (cp == SINGLE_QUOTE) { // double it and continue result.append(SINGLE_QUOTE); result.append(SINGLE_QUOTE); continue; } result.append(SINGLE_QUOTE); UTF16.append(result, cp); quotedChar = IN_QUOTE; continue; } // we have no choice but to use \\u or \\U appendEscaped(result, cp); continue; } // otherwise cp doesn't need quoting // we may have to fix up previous characters if (quotedChar == IN_QUOTE) { result.append(SINGLE_QUOTE); quotedChar = NO_QUOTE; } UTF16.append(result, cp); } // all done. // we may have to fix up previous characters if (quotedChar == IN_QUOTE) { result.append(SINGLE_QUOTE); } return result.toString(); }
java
public String quoteLiteral(String string) { if (needingQuoteCharacters == null) { needingQuoteCharacters = new UnicodeSet().addAll(syntaxCharacters).addAll(ignorableCharacters).addAll(extraQuotingCharacters); // .addAll(quoteCharacters) if (usingSlash) needingQuoteCharacters.add(BACK_SLASH); if (usingQuote) needingQuoteCharacters.add(SINGLE_QUOTE); } StringBuffer result = new StringBuffer(); int quotedChar = NO_QUOTE; int cp; for (int i = 0; i < string.length(); i += UTF16.getCharCount(cp)) { cp = UTF16.charAt(string, i); if (escapeCharacters.contains(cp)) { // we may have to fix up previous characters if (quotedChar == IN_QUOTE) { result.append(SINGLE_QUOTE); quotedChar = NO_QUOTE; } appendEscaped(result, cp); continue; } if (needingQuoteCharacters.contains(cp)) { // if we have already started a quote if (quotedChar == IN_QUOTE) { UTF16.append(result, cp); if (usingQuote && cp == SINGLE_QUOTE) { // double it result.append(SINGLE_QUOTE); } continue; } // otherwise not already in quote if (usingSlash) { result.append(BACK_SLASH); UTF16.append(result, cp); continue; } if (usingQuote) { if (cp == SINGLE_QUOTE) { // double it and continue result.append(SINGLE_QUOTE); result.append(SINGLE_QUOTE); continue; } result.append(SINGLE_QUOTE); UTF16.append(result, cp); quotedChar = IN_QUOTE; continue; } // we have no choice but to use \\u or \\U appendEscaped(result, cp); continue; } // otherwise cp doesn't need quoting // we may have to fix up previous characters if (quotedChar == IN_QUOTE) { result.append(SINGLE_QUOTE); quotedChar = NO_QUOTE; } UTF16.append(result, cp); } // all done. // we may have to fix up previous characters if (quotedChar == IN_QUOTE) { result.append(SINGLE_QUOTE); } return result.toString(); }
[ "public", "String", "quoteLiteral", "(", "String", "string", ")", "{", "if", "(", "needingQuoteCharacters", "==", "null", ")", "{", "needingQuoteCharacters", "=", "new", "UnicodeSet", "(", ")", ".", "addAll", "(", "syntaxCharacters", ")", ".", "addAll", "(", ...
Quote a literal string, using the available settings. Thus syntax characters, quote characters, and ignorable characters will be put into quotes. @param string String passed to quote a literal string. @return A string using the available settings will place syntax, quote, or ignorable characters into quotes.
[ "Quote", "a", "literal", "string", "using", "the", "available", "settings", ".", "Thus", "syntax", "characters", "quote", "characters", "and", "ignorable", "characters", "will", "be", "put", "into", "quotes", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternTokenizer.java#L161-L226
34,923
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeRegex.java
UnicodeRegex.appendLines
public static List<String> appendLines(List<String> result, String file, String encoding) throws IOException { InputStream is = new FileInputStream(file); try { return appendLines(result, is, encoding); } finally { is.close(); } }
java
public static List<String> appendLines(List<String> result, String file, String encoding) throws IOException { InputStream is = new FileInputStream(file); try { return appendLines(result, is, encoding); } finally { is.close(); } }
[ "public", "static", "List", "<", "String", ">", "appendLines", "(", "List", "<", "String", ">", "result", ",", "String", "file", ",", "String", "encoding", ")", "throws", "IOException", "{", "InputStream", "is", "=", "new", "FileInputStream", "(", "file", ...
Utility for loading lines from a file. @param result The result of the appended lines. @param file The file to have an input stream. @param encoding if null, then UTF-8 @return filled list @throws IOException If there were problems opening the file for input stream.
[ "Utility", "for", "loading", "lines", "from", "a", "file", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeRegex.java#L279-L286
34,924
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeRegex.java
UnicodeRegex.appendLines
public static List<String> appendLines(List<String> result, InputStream inputStream, String encoding) throws UnsupportedEncodingException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, encoding == null ? "UTF-8" : encoding)); while (true) { String line = in.readLine(); if (line == null) break; result.add(line); } return result; }
java
public static List<String> appendLines(List<String> result, InputStream inputStream, String encoding) throws UnsupportedEncodingException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, encoding == null ? "UTF-8" : encoding)); while (true) { String line = in.readLine(); if (line == null) break; result.add(line); } return result; }
[ "public", "static", "List", "<", "String", ">", "appendLines", "(", "List", "<", "String", ">", "result", ",", "InputStream", "inputStream", ",", "String", "encoding", ")", "throws", "UnsupportedEncodingException", ",", "IOException", "{", "BufferedReader", "in", ...
Utility for loading lines from a UTF8 file. @param result The result of the appended lines. @param inputStream The input stream. @param encoding if null, then UTF-8 @return filled list @throws IOException If there were problems opening the input stream for reading.
[ "Utility", "for", "loading", "lines", "from", "a", "UTF8", "file", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UnicodeRegex.java#L296-L305
34,925
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Util.java
Util.getTemporaryDirectBuffer
static ByteBuffer getTemporaryDirectBuffer(int size) { BufferCache cache = bufferCache.get(); ByteBuffer buf = cache.get(size); if (buf != null) { return buf; } else { // No suitable buffer in the cache so we need to allocate a new // one. To avoid the cache growing then we remove the first // buffer from the cache and free it. if (!cache.isEmpty()) { buf = cache.removeFirst(); free(buf); } return ByteBuffer.allocateDirect(size); } }
java
static ByteBuffer getTemporaryDirectBuffer(int size) { BufferCache cache = bufferCache.get(); ByteBuffer buf = cache.get(size); if (buf != null) { return buf; } else { // No suitable buffer in the cache so we need to allocate a new // one. To avoid the cache growing then we remove the first // buffer from the cache and free it. if (!cache.isEmpty()) { buf = cache.removeFirst(); free(buf); } return ByteBuffer.allocateDirect(size); } }
[ "static", "ByteBuffer", "getTemporaryDirectBuffer", "(", "int", "size", ")", "{", "BufferCache", "cache", "=", "bufferCache", ".", "get", "(", ")", ";", "ByteBuffer", "buf", "=", "cache", ".", "get", "(", "size", ")", ";", "if", "(", "buf", "!=", "null",...
Returns a temporary buffer of at least the given size
[ "Returns", "a", "temporary", "buffer", "of", "at", "least", "the", "given", "size" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Util.java#L159-L174
34,926
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Util.java
Util.offerFirstTemporaryDirectBuffer
static void offerFirstTemporaryDirectBuffer(ByteBuffer buf) { assert buf != null; BufferCache cache = bufferCache.get(); if (!cache.offerFirst(buf)) { // cache is full free(buf); } }
java
static void offerFirstTemporaryDirectBuffer(ByteBuffer buf) { assert buf != null; BufferCache cache = bufferCache.get(); if (!cache.offerFirst(buf)) { // cache is full free(buf); } }
[ "static", "void", "offerFirstTemporaryDirectBuffer", "(", "ByteBuffer", "buf", ")", "{", "assert", "buf", "!=", "null", ";", "BufferCache", "cache", "=", "bufferCache", ".", "get", "(", ")", ";", "if", "(", "!", "cache", ".", "offerFirst", "(", "buf", ")",...
Releases a temporary buffer by returning to the cache or freeing it. If returning to the cache then insert it at the start so that it is likely to be returned by a subsequent call to getTemporaryDirectBuffer.
[ "Releases", "a", "temporary", "buffer", "by", "returning", "to", "the", "cache", "or", "freeing", "it", ".", "If", "returning", "to", "the", "cache", "then", "insert", "it", "at", "the", "start", "so", "that", "it", "is", "likely", "to", "be", "returned"...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Util.java#L188-L195
34,927
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Util.java
Util.free
private static void free(ByteBuffer buf) { Cleaner cleaner = ((DirectBuffer)buf).cleaner(); if (cleaner != null) { cleaner.clean(); } }
java
private static void free(ByteBuffer buf) { Cleaner cleaner = ((DirectBuffer)buf).cleaner(); if (cleaner != null) { cleaner.clean(); } }
[ "private", "static", "void", "free", "(", "ByteBuffer", "buf", ")", "{", "Cleaner", "cleaner", "=", "(", "(", "DirectBuffer", ")", "buf", ")", ".", "cleaner", "(", ")", ";", "if", "(", "cleaner", "!=", "null", ")", "{", "cleaner", ".", "clean", "(", ...
Frees the memory for the given direct buffer
[ "Frees", "the", "memory", "for", "the", "given", "direct", "buffer" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Util.java#L215-L220
34,928
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java
PeriodFormatterData.appendPrefix
public boolean appendPrefix(int tl, int td, StringBuffer sb) { if (dr.scopeData != null) { int ix = tl * 3 + td; ScopeData sd = dr.scopeData[ix]; if (sd != null) { String prefix = sd.prefix; if (prefix != null) { sb.append(prefix); return sd.requiresDigitPrefix; } } } return false; }
java
public boolean appendPrefix(int tl, int td, StringBuffer sb) { if (dr.scopeData != null) { int ix = tl * 3 + td; ScopeData sd = dr.scopeData[ix]; if (sd != null) { String prefix = sd.prefix; if (prefix != null) { sb.append(prefix); return sd.requiresDigitPrefix; } } } return false; }
[ "public", "boolean", "appendPrefix", "(", "int", "tl", ",", "int", "td", ",", "StringBuffer", "sb", ")", "{", "if", "(", "dr", ".", "scopeData", "!=", "null", ")", "{", "int", "ix", "=", "tl", "*", "3", "+", "td", ";", "ScopeData", "sd", "=", "dr...
Append the appropriate prefix to the string builder, depending on whether and how a limit and direction are to be displayed. @param tl how and whether to display the time limit @param td how and whether to display the time direction @param sb the string builder to which to append the text @return true if a following digit will require a digit prefix
[ "Append", "the", "appropriate", "prefix", "to", "the", "string", "builder", "depending", "on", "whether", "and", "how", "a", "limit", "and", "direction", "are", "to", "be", "displayed", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java#L98-L111
34,929
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java
PeriodFormatterData.appendSuffix
public void appendSuffix(int tl, int td, StringBuffer sb) { if (dr.scopeData != null) { int ix = tl * 3 + td; ScopeData sd = dr.scopeData[ix]; if (sd != null) { String suffix = sd.suffix; if (suffix != null) { if (trace) { System.out.println("appendSuffix '" + suffix + "'"); } sb.append(suffix); } } } }
java
public void appendSuffix(int tl, int td, StringBuffer sb) { if (dr.scopeData != null) { int ix = tl * 3 + td; ScopeData sd = dr.scopeData[ix]; if (sd != null) { String suffix = sd.suffix; if (suffix != null) { if (trace) { System.out.println("appendSuffix '" + suffix + "'"); } sb.append(suffix); } } } }
[ "public", "void", "appendSuffix", "(", "int", "tl", ",", "int", "td", ",", "StringBuffer", "sb", ")", "{", "if", "(", "dr", ".", "scopeData", "!=", "null", ")", "{", "int", "ix", "=", "tl", "*", "3", "+", "td", ";", "ScopeData", "sd", "=", "dr", ...
Append the appropriate suffix to the string builder, depending on whether and how a limit and direction are to be displayed. @param tl how and whether to display the time limit @param td how and whether to display the time direction @param sb the string builder to which to append the text
[ "Append", "the", "appropriate", "suffix", "to", "the", "string", "builder", "depending", "on", "whether", "and", "how", "a", "limit", "and", "direction", "are", "to", "be", "displayed", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java#L121-L135
34,930
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java
PeriodFormatterData.appendCountValue
public void appendCountValue(int count, int integralDigits, int decimalDigits, StringBuffer sb) { int ival = count / 1000; if (decimalDigits == 0) { appendInteger(ival, integralDigits, 10, sb); return; } if (dr.requiresDigitSeparator && sb.length() > 0) { sb.append(' '); } appendDigits(ival, integralDigits, 10, sb); int dval = count % 1000; if (decimalDigits == 1) { dval /= 100; } else if (decimalDigits == 2) { dval /= 10; } sb.append(dr.decimalSep); appendDigits(dval, decimalDigits, decimalDigits, sb); if (dr.requiresDigitSeparator) { sb.append(' '); } }
java
public void appendCountValue(int count, int integralDigits, int decimalDigits, StringBuffer sb) { int ival = count / 1000; if (decimalDigits == 0) { appendInteger(ival, integralDigits, 10, sb); return; } if (dr.requiresDigitSeparator && sb.length() > 0) { sb.append(' '); } appendDigits(ival, integralDigits, 10, sb); int dval = count % 1000; if (decimalDigits == 1) { dval /= 100; } else if (decimalDigits == 2) { dval /= 10; } sb.append(dr.decimalSep); appendDigits(dval, decimalDigits, decimalDigits, sb); if (dr.requiresDigitSeparator) { sb.append(' '); } }
[ "public", "void", "appendCountValue", "(", "int", "count", ",", "int", "integralDigits", ",", "int", "decimalDigits", ",", "StringBuffer", "sb", ")", "{", "int", "ival", "=", "count", "/", "1000", ";", "if", "(", "decimalDigits", "==", "0", ")", "{", "ap...
Append a count value to the builder. @param count the count @param integralDigits the number of integer digits to display @param decimalDigits the number of decimal digits to display, <= 3 @param sb the string builder to which to append the text
[ "Append", "a", "count", "value", "to", "the", "builder", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java#L390-L413
34,931
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java
PeriodFormatterData.appendDigits
public void appendDigits(long num, int mindigits, int maxdigits, StringBuffer sb) { char[] buf = new char[maxdigits]; int ix = maxdigits; while (ix > 0 && num > 0) { buf[--ix] = (char)(dr.zero + (num % 10)); num /= 10; } for (int e = maxdigits - mindigits; ix > e;) { buf[--ix] = dr.zero; } sb.append(buf, ix, maxdigits - ix); }
java
public void appendDigits(long num, int mindigits, int maxdigits, StringBuffer sb) { char[] buf = new char[maxdigits]; int ix = maxdigits; while (ix > 0 && num > 0) { buf[--ix] = (char)(dr.zero + (num % 10)); num /= 10; } for (int e = maxdigits - mindigits; ix > e;) { buf[--ix] = dr.zero; } sb.append(buf, ix, maxdigits - ix); }
[ "public", "void", "appendDigits", "(", "long", "num", ",", "int", "mindigits", ",", "int", "maxdigits", ",", "StringBuffer", "sb", ")", "{", "char", "[", "]", "buf", "=", "new", "char", "[", "maxdigits", "]", ";", "int", "ix", "=", "maxdigits", ";", ...
Append digits to the string builder, using this.zero for '0' etc. @param num the integer to append @param mindigits the minimum number of digits to append @param maxdigits the maximum number of digits to append @param sb the string builder to which to append the text
[ "Append", "digits", "to", "the", "string", "builder", "using", "this", ".", "zero", "for", "0", "etc", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java#L450-L462
34,932
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java
PeriodFormatterData.appendSkippedUnit
public void appendSkippedUnit(StringBuffer sb) { if (dr.skippedUnitMarker != null) { sb.append(dr.skippedUnitMarker); } }
java
public void appendSkippedUnit(StringBuffer sb) { if (dr.skippedUnitMarker != null) { sb.append(dr.skippedUnitMarker); } }
[ "public", "void", "appendSkippedUnit", "(", "StringBuffer", "sb", ")", "{", "if", "(", "dr", ".", "skippedUnitMarker", "!=", "null", ")", "{", "sb", ".", "append", "(", "dr", ".", "skippedUnitMarker", ")", ";", "}", "}" ]
Append a marker for skipped units internal to a string. @param sb the string builder to which to append the text
[ "Append", "a", "marker", "for", "skipped", "units", "internal", "to", "a", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java#L468-L472
34,933
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java
PeriodFormatterData.appendUnitSeparator
public boolean appendUnitSeparator(TimeUnit unit, boolean longSep, boolean afterFirst, boolean beforeLast, StringBuffer sb) { // long seps // false, false "...b', '...d" // false, true "...', and 'c" // true, false - "a', '...c" // true, true - "a' and 'b" if ((longSep && dr.unitSep != null) || dr.shortUnitSep != null) { if (longSep && dr.unitSep != null) { int ix = (afterFirst ? 2 : 0) + (beforeLast ? 1 : 0); sb.append(dr.unitSep[ix]); return dr.unitSepRequiresDP != null && dr.unitSepRequiresDP[ix]; } sb.append(dr.shortUnitSep); // todo: investigate whether DP is required } return false; }
java
public boolean appendUnitSeparator(TimeUnit unit, boolean longSep, boolean afterFirst, boolean beforeLast, StringBuffer sb) { // long seps // false, false "...b', '...d" // false, true "...', and 'c" // true, false - "a', '...c" // true, true - "a' and 'b" if ((longSep && dr.unitSep != null) || dr.shortUnitSep != null) { if (longSep && dr.unitSep != null) { int ix = (afterFirst ? 2 : 0) + (beforeLast ? 1 : 0); sb.append(dr.unitSep[ix]); return dr.unitSepRequiresDP != null && dr.unitSepRequiresDP[ix]; } sb.append(dr.shortUnitSep); // todo: investigate whether DP is required } return false; }
[ "public", "boolean", "appendUnitSeparator", "(", "TimeUnit", "unit", ",", "boolean", "longSep", ",", "boolean", "afterFirst", ",", "boolean", "beforeLast", ",", "StringBuffer", "sb", ")", "{", "// long seps", "// false, false \"...b', '...d\"", "// false, true \"...', an...
Append the appropriate separator between units @param unit the unit to which to append the separator @param afterFirst true if this is the first unit formatted @param beforeLast true if this is the next-to-last unit to be formatted @param sb the string builder to which to append the text @return true if a prefix will be required before a following unit
[ "Append", "the", "appropriate", "separator", "between", "units" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java#L483-L500
34,934
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/UniqueIdentity.java
UniqueIdentity.encode
public void encode(DerOutputStream out, byte tag) throws IOException { byte[] bytes = id.toByteArray(); int excessBits = bytes.length*8 - id.length(); out.write(tag); out.putLength(bytes.length + 1); out.write(excessBits); out.write(bytes); }
java
public void encode(DerOutputStream out, byte tag) throws IOException { byte[] bytes = id.toByteArray(); int excessBits = bytes.length*8 - id.length(); out.write(tag); out.putLength(bytes.length + 1); out.write(excessBits); out.write(bytes); }
[ "public", "void", "encode", "(", "DerOutputStream", "out", ",", "byte", "tag", ")", "throws", "IOException", "{", "byte", "[", "]", "bytes", "=", "id", ".", "toByteArray", "(", ")", ";", "int", "excessBits", "=", "bytes", ".", "length", "*", "8", "-", ...
Encode the UniqueIdentity in DER form to the stream. @param out the DerOutputStream to marshal the contents to. @param tag enocode it under the following tag. @exception IOException on errors.
[ "Encode", "the", "UniqueIdentity", "in", "DER", "form", "to", "the", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/UniqueIdentity.java#L97-L106
34,935
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TreeWalker2Result.java
TreeWalker2Result.startNode
protected void startNode(int node) throws org.xml.sax.SAXException { XPathContext xcntxt = m_transformer.getXPathContext(); try { if (DTM.ELEMENT_NODE == m_dtm.getNodeType(node)) { xcntxt.pushCurrentNode(node); if(m_startNode != node) { super.startNode(node); } else { String elemName = m_dtm.getNodeName(node); String localName = m_dtm.getLocalName(node); String namespace = m_dtm.getNamespaceURI(node); //xcntxt.pushCurrentNode(node); // SAX-like call to allow adding attributes afterwards m_handler.startElement(namespace, localName, elemName); boolean hasNSDecls = false; DTM dtm = m_dtm; for (int ns = dtm.getFirstNamespaceNode(node, true); DTM.NULL != ns; ns = dtm.getNextNamespaceNode(node, ns, true)) { SerializerUtils.ensureNamespaceDeclDeclared(m_handler,dtm, ns); } for (int attr = dtm.getFirstAttribute(node); DTM.NULL != attr; attr = dtm.getNextAttribute(attr)) { SerializerUtils.addAttribute(m_handler, attr); } } } else { xcntxt.pushCurrentNode(node); super.startNode(node); xcntxt.popCurrentNode(); } } catch(javax.xml.transform.TransformerException te) { throw new org.xml.sax.SAXException(te); } }
java
protected void startNode(int node) throws org.xml.sax.SAXException { XPathContext xcntxt = m_transformer.getXPathContext(); try { if (DTM.ELEMENT_NODE == m_dtm.getNodeType(node)) { xcntxt.pushCurrentNode(node); if(m_startNode != node) { super.startNode(node); } else { String elemName = m_dtm.getNodeName(node); String localName = m_dtm.getLocalName(node); String namespace = m_dtm.getNamespaceURI(node); //xcntxt.pushCurrentNode(node); // SAX-like call to allow adding attributes afterwards m_handler.startElement(namespace, localName, elemName); boolean hasNSDecls = false; DTM dtm = m_dtm; for (int ns = dtm.getFirstNamespaceNode(node, true); DTM.NULL != ns; ns = dtm.getNextNamespaceNode(node, ns, true)) { SerializerUtils.ensureNamespaceDeclDeclared(m_handler,dtm, ns); } for (int attr = dtm.getFirstAttribute(node); DTM.NULL != attr; attr = dtm.getNextAttribute(attr)) { SerializerUtils.addAttribute(m_handler, attr); } } } else { xcntxt.pushCurrentNode(node); super.startNode(node); xcntxt.popCurrentNode(); } } catch(javax.xml.transform.TransformerException te) { throw new org.xml.sax.SAXException(te); } }
[ "protected", "void", "startNode", "(", "int", "node", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "XPathContext", "xcntxt", "=", "m_transformer", ".", "getXPathContext", "(", ")", ";", "try", "{", "if", "(", "DTM", ".", "ELEME...
Start traversal of the tree at the given node @param node Starting node for traversal @throws TransformerException
[ "Start", "traversal", "of", "the", "tree", "at", "the", "given", "node" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TreeWalker2Result.java#L102-L154
34,936
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CRLExtensions.java
CRLExtensions.encode
public void encode(OutputStream out, boolean isExplicit) throws CRLException { try { DerOutputStream extOut = new DerOutputStream(); Collection<Extension> allExts = map.values(); Object[] objs = allExts.toArray(); for (int i = 0; i < objs.length; i++) { if (objs[i] instanceof CertAttrSet) ((CertAttrSet)objs[i]).encode(extOut); else if (objs[i] instanceof Extension) ((Extension)objs[i]).encode(extOut); else throw new CRLException("Illegal extension object"); } DerOutputStream seq = new DerOutputStream(); seq.write(DerValue.tag_Sequence, extOut); DerOutputStream tmp = new DerOutputStream(); if (isExplicit) tmp.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0), seq); else tmp = seq; out.write(tmp.toByteArray()); } catch (IOException e) { throw new CRLException("Encoding error: " + e.toString()); } catch (CertificateException e) { throw new CRLException("Encoding error: " + e.toString()); } }
java
public void encode(OutputStream out, boolean isExplicit) throws CRLException { try { DerOutputStream extOut = new DerOutputStream(); Collection<Extension> allExts = map.values(); Object[] objs = allExts.toArray(); for (int i = 0; i < objs.length; i++) { if (objs[i] instanceof CertAttrSet) ((CertAttrSet)objs[i]).encode(extOut); else if (objs[i] instanceof Extension) ((Extension)objs[i]).encode(extOut); else throw new CRLException("Illegal extension object"); } DerOutputStream seq = new DerOutputStream(); seq.write(DerValue.tag_Sequence, extOut); DerOutputStream tmp = new DerOutputStream(); if (isExplicit) tmp.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0), seq); else tmp = seq; out.write(tmp.toByteArray()); } catch (IOException e) { throw new CRLException("Encoding error: " + e.toString()); } catch (CertificateException e) { throw new CRLException("Encoding error: " + e.toString()); } }
[ "public", "void", "encode", "(", "OutputStream", "out", ",", "boolean", "isExplicit", ")", "throws", "CRLException", "{", "try", "{", "DerOutputStream", "extOut", "=", "new", "DerOutputStream", "(", ")", ";", "Collection", "<", "Extension", ">", "allExts", "="...
Encode the extensions in DER form to the stream. @param out the DerOutputStream to marshal the contents to. @param isExplicit the tag indicating whether this is an entry extension (false) or a CRL extension (true). @exception CRLException on encoding errors.
[ "Encode", "the", "extensions", "in", "DER", "form", "to", "the", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CRLExtensions.java#L144-L176
34,937
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CRLExtensions.java
CRLExtensions.get
public Extension get(String alias) { X509AttributeName attr = new X509AttributeName(alias); String name; String id = attr.getPrefix(); if (id.equalsIgnoreCase(X509CertImpl.NAME)) { // fully qualified int index = alias.lastIndexOf("."); name = alias.substring(index + 1); } else name = alias; return map.get(name); }
java
public Extension get(String alias) { X509AttributeName attr = new X509AttributeName(alias); String name; String id = attr.getPrefix(); if (id.equalsIgnoreCase(X509CertImpl.NAME)) { // fully qualified int index = alias.lastIndexOf("."); name = alias.substring(index + 1); } else name = alias; return map.get(name); }
[ "public", "Extension", "get", "(", "String", "alias", ")", "{", "X509AttributeName", "attr", "=", "new", "X509AttributeName", "(", "alias", ")", ";", "String", "name", ";", "String", "id", "=", "attr", ".", "getPrefix", "(", ")", ";", "if", "(", "id", ...
Get the extension with this alias. @param alias the identifier string for the extension to retrieve.
[ "Get", "the", "extension", "with", "this", "alias", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CRLExtensions.java#L183-L193
34,938
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CRLExtensions.java
CRLExtensions.set
public void set(String alias, Object obj) { map.put(alias, (Extension)obj); }
java
public void set(String alias, Object obj) { map.put(alias, (Extension)obj); }
[ "public", "void", "set", "(", "String", "alias", ",", "Object", "obj", ")", "{", "map", ".", "put", "(", "alias", ",", "(", "Extension", ")", "obj", ")", ";", "}" ]
Set the extension value with this alias. @param alias the identifier string for the extension to set. @param obj the Object to set the extension identified by the alias.
[ "Set", "the", "extension", "value", "with", "this", "alias", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CRLExtensions.java#L202-L204
34,939
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/text/RbnfScannerProviderImpl.java
RbnfScannerProviderImpl.get
@Deprecated public RbnfLenientScanner get(ULocale locale, String extras) { RbnfLenientScanner result = null; String key = locale.toString() + "/" + extras; synchronized(cache) { result = cache.get(key); if (result != null) { return result; } } result = createScanner(locale, extras); synchronized(cache) { cache.put(key, result); } return result; }
java
@Deprecated public RbnfLenientScanner get(ULocale locale, String extras) { RbnfLenientScanner result = null; String key = locale.toString() + "/" + extras; synchronized(cache) { result = cache.get(key); if (result != null) { return result; } } result = createScanner(locale, extras); synchronized(cache) { cache.put(key, result); } return result; }
[ "@", "Deprecated", "public", "RbnfLenientScanner", "get", "(", "ULocale", "locale", ",", "String", "extras", ")", "{", "RbnfLenientScanner", "result", "=", "null", ";", "String", "key", "=", "locale", ".", "toString", "(", ")", "+", "\"/\"", "+", "extras", ...
Returns a collation-based scanner. Only primary differences are treated as significant. This means that case differences, accent differences, alternate spellings of the same letter (e.g., ae and a-umlaut in German), ignorable characters, etc. are ignored in matching the text. In many cases, numerals will be accepted in place of words or phrases as well. For example, all of the following will correctly parse as 255 in English in lenient-parse mode: <br>"two hundred fifty-five" <br>"two hundred fifty five" <br>"TWO HUNDRED FIFTY-FIVE" <br>"twohundredfiftyfive" <br>"2 hundred fifty-5" The Collator used is determined by the locale that was passed to this object on construction. The description passed to this object on construction may supply additional collation rules that are appended to the end of the default collator for the locale, enabling additional equivalences (such as adding more ignorable characters or permitting spelled-out version of symbols; see the demo program for examples). It's important to emphasize that even strict parsing is relatively lenient: it will accept some text that it won't produce as output. In English, for example, it will correctly parse "two hundred zero" and "fifteen hundred". @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "Returns", "a", "collation", "-", "based", "scanner", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/text/RbnfScannerProviderImpl.java#L76-L91
34,940
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.compileOperation
private Expression compileOperation(Operation operation, int opPos) throws TransformerException { int leftPos = getFirstChildPos(opPos); int rightPos = getNextOpPos(leftPos); operation.setLeftRight(compile(leftPos), compile(rightPos)); return operation; }
java
private Expression compileOperation(Operation operation, int opPos) throws TransformerException { int leftPos = getFirstChildPos(opPos); int rightPos = getNextOpPos(leftPos); operation.setLeftRight(compile(leftPos), compile(rightPos)); return operation; }
[ "private", "Expression", "compileOperation", "(", "Operation", "operation", ",", "int", "opPos", ")", "throws", "TransformerException", "{", "int", "leftPos", "=", "getFirstChildPos", "(", "opPos", ")", ";", "int", "rightPos", "=", "getNextOpPos", "(", "leftPos", ...
Bottle-neck compilation of an operation with left and right operands. @param operation non-null reference to parent operation. @param opPos The op map position of the parent operation. @return reference to {@link org.apache.xpath.operations.Operation} instance. @throws TransformerException if there is a syntax or other error.
[ "Bottle", "-", "neck", "compilation", "of", "an", "operation", "with", "left", "and", "right", "operands", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L209-L219
34,941
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.compileUnary
private Expression compileUnary(UnaryOperation unary, int opPos) throws TransformerException { int rightPos = getFirstChildPos(opPos); unary.setRight(compile(rightPos)); return unary; }
java
private Expression compileUnary(UnaryOperation unary, int opPos) throws TransformerException { int rightPos = getFirstChildPos(opPos); unary.setRight(compile(rightPos)); return unary; }
[ "private", "Expression", "compileUnary", "(", "UnaryOperation", "unary", ",", "int", "opPos", ")", "throws", "TransformerException", "{", "int", "rightPos", "=", "getFirstChildPos", "(", "opPos", ")", ";", "unary", ".", "setRight", "(", "compile", "(", "rightPos...
Bottle-neck compilation of a unary operation. @param unary The parent unary operation. @param opPos The position in the op map of the parent operation. @return The unary argument. @throws TransformerException if syntax or other error occurs.
[ "Bottle", "-", "neck", "compilation", "of", "a", "unary", "operation", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L231-L240
34,942
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.literal
protected Expression literal(int opPos) { opPos = getFirstChildPos(opPos); return (XString) getTokenQueue().elementAt(getOp(opPos)); }
java
protected Expression literal(int opPos) { opPos = getFirstChildPos(opPos); return (XString) getTokenQueue().elementAt(getOp(opPos)); }
[ "protected", "Expression", "literal", "(", "int", "opPos", ")", "{", "opPos", "=", "getFirstChildPos", "(", "opPos", ")", ";", "return", "(", "XString", ")", "getTokenQueue", "(", ")", ".", "elementAt", "(", "getOp", "(", "opPos", ")", ")", ";", "}" ]
Compile a literal string value. @param opPos The current position in the m_opMap array. @return reference to {@link org.apache.xpath.objects.XString} instance. @throws TransformerException if a error occurs creating the Expression.
[ "Compile", "a", "literal", "string", "value", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L503-L509
34,943
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.numberlit
protected Expression numberlit(int opPos) { opPos = getFirstChildPos(opPos); return (XNumber) getTokenQueue().elementAt(getOp(opPos)); }
java
protected Expression numberlit(int opPos) { opPos = getFirstChildPos(opPos); return (XNumber) getTokenQueue().elementAt(getOp(opPos)); }
[ "protected", "Expression", "numberlit", "(", "int", "opPos", ")", "{", "opPos", "=", "getFirstChildPos", "(", "opPos", ")", ";", "return", "(", "XNumber", ")", "getTokenQueue", "(", ")", ".", "elementAt", "(", "getOp", "(", "opPos", ")", ")", ";", "}" ]
Compile a literal number value. @param opPos The current position in the m_opMap array. @return reference to {@link org.apache.xpath.objects.XNumber} instance. @throws TransformerException if a error occurs creating the Expression.
[ "Compile", "a", "literal", "number", "value", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L520-L526
34,944
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.variable
protected Expression variable(int opPos) throws TransformerException { Variable var = new Variable(); opPos = getFirstChildPos(opPos); int nsPos = getOp(opPos); java.lang.String namespace = (OpCodes.EMPTY == nsPos) ? null : (java.lang.String) getTokenQueue().elementAt(nsPos); java.lang.String localname = (java.lang.String) getTokenQueue().elementAt(getOp(opPos+1)); QName qname = new QName(namespace, localname); var.setQName(qname); return var; }
java
protected Expression variable(int opPos) throws TransformerException { Variable var = new Variable(); opPos = getFirstChildPos(opPos); int nsPos = getOp(opPos); java.lang.String namespace = (OpCodes.EMPTY == nsPos) ? null : (java.lang.String) getTokenQueue().elementAt(nsPos); java.lang.String localname = (java.lang.String) getTokenQueue().elementAt(getOp(opPos+1)); QName qname = new QName(namespace, localname); var.setQName(qname); return var; }
[ "protected", "Expression", "variable", "(", "int", "opPos", ")", "throws", "TransformerException", "{", "Variable", "var", "=", "new", "Variable", "(", ")", ";", "opPos", "=", "getFirstChildPos", "(", "opPos", ")", ";", "int", "nsPos", "=", "getOp", "(", "...
Compile a variable reference. @param opPos The current position in the m_opMap array. @return reference to {@link org.apache.xpath.operations.Variable} instance. @throws TransformerException if a error occurs creating the Expression.
[ "Compile", "a", "variable", "reference", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L537-L555
34,945
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.matchPattern
protected Expression matchPattern(int opPos) throws TransformerException { locPathDepth++; try { // First, count... int nextOpPos = opPos; int i; for (i = 0; getOp(nextOpPos) == OpCodes.OP_LOCATIONPATHPATTERN; i++) { nextOpPos = getNextOpPos(nextOpPos); } if (i == 1) return compile(opPos); UnionPattern up = new UnionPattern(); StepPattern[] patterns = new StepPattern[i]; for (i = 0; getOp(opPos) == OpCodes.OP_LOCATIONPATHPATTERN; i++) { nextOpPos = getNextOpPos(opPos); patterns[i] = (StepPattern) compile(opPos); opPos = nextOpPos; } up.setPatterns(patterns); return up; } finally { locPathDepth--; } }
java
protected Expression matchPattern(int opPos) throws TransformerException { locPathDepth++; try { // First, count... int nextOpPos = opPos; int i; for (i = 0; getOp(nextOpPos) == OpCodes.OP_LOCATIONPATHPATTERN; i++) { nextOpPos = getNextOpPos(nextOpPos); } if (i == 1) return compile(opPos); UnionPattern up = new UnionPattern(); StepPattern[] patterns = new StepPattern[i]; for (i = 0; getOp(opPos) == OpCodes.OP_LOCATIONPATHPATTERN; i++) { nextOpPos = getNextOpPos(opPos); patterns[i] = (StepPattern) compile(opPos); opPos = nextOpPos; } up.setPatterns(patterns); return up; } finally { locPathDepth--; } }
[ "protected", "Expression", "matchPattern", "(", "int", "opPos", ")", "throws", "TransformerException", "{", "locPathDepth", "++", ";", "try", "{", "// First, count...", "int", "nextOpPos", "=", "opPos", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", ...
Compile an entire match pattern expression. @param opPos The current position in the m_opMap array. @return reference to {@link org.apache.xpath.patterns.UnionPattern} instance. @throws TransformerException if a error occurs creating the Expression.
[ "Compile", "an", "entire", "match", "pattern", "expression", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L678-L713
34,946
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.locationPathPattern
public Expression locationPathPattern(int opPos) throws TransformerException { opPos = getFirstChildPos(opPos); return stepPattern(opPos, 0, null); }
java
public Expression locationPathPattern(int opPos) throws TransformerException { opPos = getFirstChildPos(opPos); return stepPattern(opPos, 0, null); }
[ "public", "Expression", "locationPathPattern", "(", "int", "opPos", ")", "throws", "TransformerException", "{", "opPos", "=", "getFirstChildPos", "(", "opPos", ")", ";", "return", "stepPattern", "(", "opPos", ",", "0", ",", "null", ")", ";", "}" ]
Compile a location match pattern unit expression. @param opPos The current position in the m_opMap array. @return reference to {@link org.apache.xpath.patterns.StepPattern} instance. @throws TransformerException if a error occurs creating the Expression.
[ "Compile", "a", "location", "match", "pattern", "unit", "expression", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L724-L731
34,947
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.stepPattern
protected StepPattern stepPattern( int opPos, int stepCount, StepPattern ancestorPattern) throws TransformerException { int startOpPos = opPos; int stepType = getOp(opPos); if (OpCodes.ENDOP == stepType) { return null; } boolean addMagicSelf = true; int endStep = getNextOpPos(opPos); // int nextStepType = getOpMap()[endStep]; StepPattern pattern; // boolean isSimple = ((OpCodes.ENDOP == nextStepType) && (stepCount == 0)); int argLen; switch (stepType) { case OpCodes.OP_FUNCTION : if(DEBUG) System.out.println("MATCH_FUNCTION: "+m_currentPattern); addMagicSelf = false; argLen = getOp(opPos + OpMap.MAPINDEX_LENGTH); pattern = new FunctionPattern(compileFunction(opPos), Axis.PARENT, Axis.CHILD); break; case OpCodes.FROM_ROOT : if(DEBUG) System.out.println("FROM_ROOT, "+m_currentPattern); addMagicSelf = false; argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); pattern = new StepPattern(DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT, Axis.PARENT, Axis.CHILD); break; case OpCodes.MATCH_ATTRIBUTE : if(DEBUG) System.out.println("MATCH_ATTRIBUTE: "+getStepLocalName(startOpPos)+", "+m_currentPattern); argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); pattern = new StepPattern(DTMFilter.SHOW_ATTRIBUTE, getStepNS(startOpPos), getStepLocalName(startOpPos), Axis.PARENT, Axis.ATTRIBUTE); break; case OpCodes.MATCH_ANY_ANCESTOR : if(DEBUG) System.out.println("MATCH_ANY_ANCESTOR: "+getStepLocalName(startOpPos)+", "+m_currentPattern); argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); int what = getWhatToShow(startOpPos); // bit-o-hackery, but this code is due for the morgue anyway... if(0x00000500 == what) addMagicSelf = false; pattern = new StepPattern(getWhatToShow(startOpPos), getStepNS(startOpPos), getStepLocalName(startOpPos), Axis.ANCESTOR, Axis.CHILD); break; case OpCodes.MATCH_IMMEDIATE_ANCESTOR : if(DEBUG) System.out.println("MATCH_IMMEDIATE_ANCESTOR: "+getStepLocalName(startOpPos)+", "+m_currentPattern); argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); pattern = new StepPattern(getWhatToShow(startOpPos), getStepNS(startOpPos), getStepLocalName(startOpPos), Axis.PARENT, Axis.CHILD); break; default : error(XPATHErrorResources.ER_UNKNOWN_MATCH_OPERATION, null); //"unknown match operation!"); return null; } pattern.setPredicates(getCompiledPredicates(opPos + argLen)); if(null == ancestorPattern) { // This is the magic and invisible "." at the head of every // match pattern, and corresponds to the current node in the context // list, from where predicates are counted. // So, in order to calculate "foo[3]", it has to count from the // current node in the context list, so, from that current node, // the full pattern is really "self::node()/child::foo[3]". If you // translate this to a select pattern from the node being tested, // which is really how we're treating match patterns, it works out to // self::foo/parent::node[child::foo[3]]", or close enough. /* if(addMagicSelf && pattern.getPredicateCount() > 0) { StepPattern selfPattern = new StepPattern(DTMFilter.SHOW_ALL, Axis.PARENT, Axis.CHILD); // We need to keep the new nodetest from affecting the score... XNumber score = pattern.getStaticScore(); pattern.setRelativePathPattern(selfPattern); pattern.setStaticScore(score); selfPattern.setStaticScore(score); }*/ } else { // System.out.println("Setting "+ancestorPattern+" as relative to "+pattern); pattern.setRelativePathPattern(ancestorPattern); } StepPattern relativePathPattern = stepPattern(endStep, stepCount + 1, pattern); return (null != relativePathPattern) ? relativePathPattern : pattern; }
java
protected StepPattern stepPattern( int opPos, int stepCount, StepPattern ancestorPattern) throws TransformerException { int startOpPos = opPos; int stepType = getOp(opPos); if (OpCodes.ENDOP == stepType) { return null; } boolean addMagicSelf = true; int endStep = getNextOpPos(opPos); // int nextStepType = getOpMap()[endStep]; StepPattern pattern; // boolean isSimple = ((OpCodes.ENDOP == nextStepType) && (stepCount == 0)); int argLen; switch (stepType) { case OpCodes.OP_FUNCTION : if(DEBUG) System.out.println("MATCH_FUNCTION: "+m_currentPattern); addMagicSelf = false; argLen = getOp(opPos + OpMap.MAPINDEX_LENGTH); pattern = new FunctionPattern(compileFunction(opPos), Axis.PARENT, Axis.CHILD); break; case OpCodes.FROM_ROOT : if(DEBUG) System.out.println("FROM_ROOT, "+m_currentPattern); addMagicSelf = false; argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); pattern = new StepPattern(DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT, Axis.PARENT, Axis.CHILD); break; case OpCodes.MATCH_ATTRIBUTE : if(DEBUG) System.out.println("MATCH_ATTRIBUTE: "+getStepLocalName(startOpPos)+", "+m_currentPattern); argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); pattern = new StepPattern(DTMFilter.SHOW_ATTRIBUTE, getStepNS(startOpPos), getStepLocalName(startOpPos), Axis.PARENT, Axis.ATTRIBUTE); break; case OpCodes.MATCH_ANY_ANCESTOR : if(DEBUG) System.out.println("MATCH_ANY_ANCESTOR: "+getStepLocalName(startOpPos)+", "+m_currentPattern); argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); int what = getWhatToShow(startOpPos); // bit-o-hackery, but this code is due for the morgue anyway... if(0x00000500 == what) addMagicSelf = false; pattern = new StepPattern(getWhatToShow(startOpPos), getStepNS(startOpPos), getStepLocalName(startOpPos), Axis.ANCESTOR, Axis.CHILD); break; case OpCodes.MATCH_IMMEDIATE_ANCESTOR : if(DEBUG) System.out.println("MATCH_IMMEDIATE_ANCESTOR: "+getStepLocalName(startOpPos)+", "+m_currentPattern); argLen = getArgLengthOfStep(opPos); opPos = getFirstChildPosOfStep(opPos); pattern = new StepPattern(getWhatToShow(startOpPos), getStepNS(startOpPos), getStepLocalName(startOpPos), Axis.PARENT, Axis.CHILD); break; default : error(XPATHErrorResources.ER_UNKNOWN_MATCH_OPERATION, null); //"unknown match operation!"); return null; } pattern.setPredicates(getCompiledPredicates(opPos + argLen)); if(null == ancestorPattern) { // This is the magic and invisible "." at the head of every // match pattern, and corresponds to the current node in the context // list, from where predicates are counted. // So, in order to calculate "foo[3]", it has to count from the // current node in the context list, so, from that current node, // the full pattern is really "self::node()/child::foo[3]". If you // translate this to a select pattern from the node being tested, // which is really how we're treating match patterns, it works out to // self::foo/parent::node[child::foo[3]]", or close enough. /* if(addMagicSelf && pattern.getPredicateCount() > 0) { StepPattern selfPattern = new StepPattern(DTMFilter.SHOW_ALL, Axis.PARENT, Axis.CHILD); // We need to keep the new nodetest from affecting the score... XNumber score = pattern.getStaticScore(); pattern.setRelativePathPattern(selfPattern); pattern.setStaticScore(score); selfPattern.setStaticScore(score); }*/ } else { // System.out.println("Setting "+ancestorPattern+" as relative to "+pattern); pattern.setRelativePathPattern(ancestorPattern); } StepPattern relativePathPattern = stepPattern(endStep, stepCount + 1, pattern); return (null != relativePathPattern) ? relativePathPattern : pattern; }
[ "protected", "StepPattern", "stepPattern", "(", "int", "opPos", ",", "int", "stepCount", ",", "StepPattern", "ancestorPattern", ")", "throws", "TransformerException", "{", "int", "startOpPos", "=", "opPos", ";", "int", "stepType", "=", "getOp", "(", "opPos", ")"...
Compile a step pattern unit expression, used for both location paths and match patterns. @param opPos The current position in the m_opMap array. @param stepCount The number of steps to expect. @param ancestorPattern The owning StepPattern, which may be null. @return reference to {@link org.apache.xpath.patterns.StepPattern} instance. @throws TransformerException if a error occurs creating the Expression.
[ "Compile", "a", "step", "pattern", "unit", "expression", "used", "for", "both", "location", "paths", "and", "match", "patterns", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L821-L936
34,948
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.getCompiledPredicates
public Expression[] getCompiledPredicates(int opPos) throws TransformerException { int count = countPredicates(opPos); if (count > 0) { Expression[] predicates = new Expression[count]; compilePredicates(opPos, predicates); return predicates; } return null; }
java
public Expression[] getCompiledPredicates(int opPos) throws TransformerException { int count = countPredicates(opPos); if (count > 0) { Expression[] predicates = new Expression[count]; compilePredicates(opPos, predicates); return predicates; } return null; }
[ "public", "Expression", "[", "]", "getCompiledPredicates", "(", "int", "opPos", ")", "throws", "TransformerException", "{", "int", "count", "=", "countPredicates", "(", "opPos", ")", ";", "if", "(", "count", ">", "0", ")", "{", "Expression", "[", "]", "pre...
Compile a zero or more predicates for a given match pattern. @param opPos The position of the first predicate the m_opMap array. @return reference to array of {@link org.apache.xpath.Expression} instances. @throws TransformerException if a error occurs creating the Expression.
[ "Compile", "a", "zero", "or", "more", "predicates", "for", "a", "given", "match", "pattern", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L947-L963
34,949
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.countPredicates
public int countPredicates(int opPos) throws TransformerException { int count = 0; while (OpCodes.OP_PREDICATE == getOp(opPos)) { count++; opPos = getNextOpPos(opPos); } return count; }
java
public int countPredicates(int opPos) throws TransformerException { int count = 0; while (OpCodes.OP_PREDICATE == getOp(opPos)) { count++; opPos = getNextOpPos(opPos); } return count; }
[ "public", "int", "countPredicates", "(", "int", "opPos", ")", "throws", "TransformerException", "{", "int", "count", "=", "0", ";", "while", "(", "OpCodes", ".", "OP_PREDICATE", "==", "getOp", "(", "opPos", ")", ")", "{", "count", "++", ";", "opPos", "="...
Count the number of predicates in the step. @param opPos The position of the first predicate the m_opMap array. @return The number of predicates for this step. @throws TransformerException if a error occurs creating the Expression.
[ "Count", "the", "number", "of", "predicates", "in", "the", "step", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L974-L987
34,950
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.compilePredicates
private void compilePredicates(int opPos, Expression[] predicates) throws TransformerException { for (int i = 0; OpCodes.OP_PREDICATE == getOp(opPos); i++) { predicates[i] = predicate(opPos); opPos = getNextOpPos(opPos); } }
java
private void compilePredicates(int opPos, Expression[] predicates) throws TransformerException { for (int i = 0; OpCodes.OP_PREDICATE == getOp(opPos); i++) { predicates[i] = predicate(opPos); opPos = getNextOpPos(opPos); } }
[ "private", "void", "compilePredicates", "(", "int", "opPos", ",", "Expression", "[", "]", "predicates", ")", "throws", "TransformerException", "{", "for", "(", "int", "i", "=", "0", ";", "OpCodes", ".", "OP_PREDICATE", "==", "getOp", "(", "opPos", ")", ";"...
Compiles predicates in the step. @param opPos The position of the first predicate the m_opMap array. @param predicates An empty pre-determined array of {@link org.apache.xpath.Expression}s, that will be filled in. @throws TransformerException
[ "Compiles", "predicates", "in", "the", "step", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L998-L1007
34,951
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.compileFunction
Expression compileFunction(int opPos) throws TransformerException { int endFunc = opPos + getOp(opPos + 1) - 1; opPos = getFirstChildPos(opPos); int funcID = getOp(opPos); opPos++; if (-1 != funcID) { Function func = m_functionTable.getFunction(funcID); /** * It is a trick for function-available. Since the function table is an * instance field, insert this table at compilation time for later usage */ if (func instanceof FuncExtFunctionAvailable) ((FuncExtFunctionAvailable) func).setFunctionTable(m_functionTable); func.postCompileStep(this); try { int i = 0; for (int p = opPos; p < endFunc; p = getNextOpPos(p), i++) { // System.out.println("argPos: "+ p); // System.out.println("argCode: "+ m_opMap[p]); func.setArg(compile(p), i); } func.checkNumberArgs(i); } catch (WrongNumberArgsException wnae) { java.lang.String name = m_functionTable.getFunctionName(funcID); m_errorHandler.fatalError( new TransformerException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_ONLY_ALLOWS, new Object[]{name, wnae.getMessage()}), m_locator)); //"name + " only allows " + wnae.getMessage() + " arguments", m_locator)); } return func; } else { error(XPATHErrorResources.ER_FUNCTION_TOKEN_NOT_FOUND, null); //"function token not found."); return null; } }
java
Expression compileFunction(int opPos) throws TransformerException { int endFunc = opPos + getOp(opPos + 1) - 1; opPos = getFirstChildPos(opPos); int funcID = getOp(opPos); opPos++; if (-1 != funcID) { Function func = m_functionTable.getFunction(funcID); /** * It is a trick for function-available. Since the function table is an * instance field, insert this table at compilation time for later usage */ if (func instanceof FuncExtFunctionAvailable) ((FuncExtFunctionAvailable) func).setFunctionTable(m_functionTable); func.postCompileStep(this); try { int i = 0; for (int p = opPos; p < endFunc; p = getNextOpPos(p), i++) { // System.out.println("argPos: "+ p); // System.out.println("argCode: "+ m_opMap[p]); func.setArg(compile(p), i); } func.checkNumberArgs(i); } catch (WrongNumberArgsException wnae) { java.lang.String name = m_functionTable.getFunctionName(funcID); m_errorHandler.fatalError( new TransformerException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_ONLY_ALLOWS, new Object[]{name, wnae.getMessage()}), m_locator)); //"name + " only allows " + wnae.getMessage() + " arguments", m_locator)); } return func; } else { error(XPATHErrorResources.ER_FUNCTION_TOKEN_NOT_FOUND, null); //"function token not found."); return null; } }
[ "Expression", "compileFunction", "(", "int", "opPos", ")", "throws", "TransformerException", "{", "int", "endFunc", "=", "opPos", "+", "getOp", "(", "opPos", "+", "1", ")", "-", "1", ";", "opPos", "=", "getFirstChildPos", "(", "opPos", ")", ";", "int", "...
Compile a built-in XPath function. @param opPos The current position in the m_opMap array. @return reference to {@link org.apache.xpath.functions.Function} instance. @throws TransformerException if a error occurs creating the Expression.
[ "Compile", "a", "built", "-", "in", "XPath", "function", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L1018-L1075
34,952
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java
Compiler.compileExtension
private Expression compileExtension(int opPos) throws TransformerException { int endExtFunc = opPos + getOp(opPos + 1) - 1; opPos = getFirstChildPos(opPos); java.lang.String ns = (java.lang.String) getTokenQueue().elementAt(getOp(opPos)); opPos++; java.lang.String funcName = (java.lang.String) getTokenQueue().elementAt(getOp(opPos)); opPos++; // We create a method key to uniquely identify this function so that we // can cache the object needed to invoke it. This way, we only pay the // reflection overhead on the first call. Function extension = new FuncExtFunction(ns, funcName, String.valueOf(getNextMethodId())); try { int i = 0; while (opPos < endExtFunc) { int nextOpPos = getNextOpPos(opPos); extension.setArg(this.compile(opPos), i); opPos = nextOpPos; i++; } } catch (WrongNumberArgsException wnae) { ; // should never happen } return extension; }
java
private Expression compileExtension(int opPos) throws TransformerException { int endExtFunc = opPos + getOp(opPos + 1) - 1; opPos = getFirstChildPos(opPos); java.lang.String ns = (java.lang.String) getTokenQueue().elementAt(getOp(opPos)); opPos++; java.lang.String funcName = (java.lang.String) getTokenQueue().elementAt(getOp(opPos)); opPos++; // We create a method key to uniquely identify this function so that we // can cache the object needed to invoke it. This way, we only pay the // reflection overhead on the first call. Function extension = new FuncExtFunction(ns, funcName, String.valueOf(getNextMethodId())); try { int i = 0; while (opPos < endExtFunc) { int nextOpPos = getNextOpPos(opPos); extension.setArg(this.compile(opPos), i); opPos = nextOpPos; i++; } } catch (WrongNumberArgsException wnae) { ; // should never happen } return extension; }
[ "private", "Expression", "compileExtension", "(", "int", "opPos", ")", "throws", "TransformerException", "{", "int", "endExtFunc", "=", "opPos", "+", "getOp", "(", "opPos", "+", "1", ")", "-", "1", ";", "opPos", "=", "getFirstChildPos", "(", "opPos", ")", ...
Compile an extension function. @param opPos The current position in the m_opMap array. @return reference to {@link org.apache.xpath.functions.FuncExtFunction} instance. @throws TransformerException if a error occurs creating the Expression.
[ "Compile", "an", "extension", "function", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Compiler.java#L1100-L1144
34,953
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Observable.java
Observable.addObserver
public synchronized void addObserver(Observer o) { if (o == null) throw new NullPointerException(); if (!observers.contains(o)) { observers.add(o); } }
java
public synchronized void addObserver(Observer o) { if (o == null) throw new NullPointerException(); if (!observers.contains(o)) { observers.add(o); } }
[ "public", "synchronized", "void", "addObserver", "(", "Observer", "o", ")", "{", "if", "(", "o", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "if", "(", "!", "observers", ".", "contains", "(", "o", ")", ")", "{", "observers...
Adds an observer to the set of observers for this object, provided that it is not the same as some observer already in the set. The order in which notifications will be delivered to multiple observers is not specified. See the class comment. @param o an observer to be added. @throws NullPointerException if the parameter o is null.
[ "Adds", "an", "observer", "to", "the", "set", "of", "observers", "for", "this", "object", "provided", "that", "it", "is", "not", "the", "same", "as", "some", "observer", "already", "in", "the", "set", ".", "The", "order", "in", "which", "notifications", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Observable.java#L81-L87
34,954
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/Collation.java
Collation.incTwoBytePrimaryByOffset
public static long incTwoBytePrimaryByOffset(long basePrimary, boolean isCompressible, int offset) { // Extract the second byte, minus the minimum byte value, // plus the offset, modulo the number of usable byte values, plus the minimum. // Reserve the PRIMARY_COMPRESSION_LOW_BYTE and high byte if necessary. long primary; if(isCompressible) { offset += ((int)(basePrimary >> 16) & 0xff) - 4; primary = ((offset % 251) + 4) << 16; offset /= 251; } else { offset += ((int)(basePrimary >> 16) & 0xff) - 2; primary = ((offset % 254) + 2) << 16; offset /= 254; } // First byte, assume no further overflow. return primary | ((basePrimary & 0xff000000L) + ((long)offset << 24)); }
java
public static long incTwoBytePrimaryByOffset(long basePrimary, boolean isCompressible, int offset) { // Extract the second byte, minus the minimum byte value, // plus the offset, modulo the number of usable byte values, plus the minimum. // Reserve the PRIMARY_COMPRESSION_LOW_BYTE and high byte if necessary. long primary; if(isCompressible) { offset += ((int)(basePrimary >> 16) & 0xff) - 4; primary = ((offset % 251) + 4) << 16; offset /= 251; } else { offset += ((int)(basePrimary >> 16) & 0xff) - 2; primary = ((offset % 254) + 2) << 16; offset /= 254; } // First byte, assume no further overflow. return primary | ((basePrimary & 0xff000000L) + ((long)offset << 24)); }
[ "public", "static", "long", "incTwoBytePrimaryByOffset", "(", "long", "basePrimary", ",", "boolean", "isCompressible", ",", "int", "offset", ")", "{", "// Extract the second byte, minus the minimum byte value,", "// plus the offset, modulo the number of usable byte values, plus the m...
Increments a 2-byte primary by a code point offset.
[ "Increments", "a", "2", "-", "byte", "primary", "by", "a", "code", "point", "offset", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/Collation.java#L463-L480
34,955
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/Collation.java
Collation.incThreeBytePrimaryByOffset
public static long incThreeBytePrimaryByOffset(long basePrimary, boolean isCompressible, int offset) { // Extract the third byte, minus the minimum byte value, // plus the offset, modulo the number of usable byte values, plus the minimum. offset += ((int)(basePrimary >> 8) & 0xff) - 2; long primary = ((offset % 254) + 2) << 8; offset /= 254; // Same with the second byte, // but reserve the PRIMARY_COMPRESSION_LOW_BYTE and high byte if necessary. if(isCompressible) { offset += ((int)(basePrimary >> 16) & 0xff) - 4; primary |= ((offset % 251) + 4) << 16; offset /= 251; } else { offset += ((int)(basePrimary >> 16) & 0xff) - 2; primary |= ((offset % 254) + 2) << 16; offset /= 254; } // First byte, assume no further overflow. return primary | ((basePrimary & 0xff000000L) + ((long)offset << 24)); }
java
public static long incThreeBytePrimaryByOffset(long basePrimary, boolean isCompressible, int offset) { // Extract the third byte, minus the minimum byte value, // plus the offset, modulo the number of usable byte values, plus the minimum. offset += ((int)(basePrimary >> 8) & 0xff) - 2; long primary = ((offset % 254) + 2) << 8; offset /= 254; // Same with the second byte, // but reserve the PRIMARY_COMPRESSION_LOW_BYTE and high byte if necessary. if(isCompressible) { offset += ((int)(basePrimary >> 16) & 0xff) - 4; primary |= ((offset % 251) + 4) << 16; offset /= 251; } else { offset += ((int)(basePrimary >> 16) & 0xff) - 2; primary |= ((offset % 254) + 2) << 16; offset /= 254; } // First byte, assume no further overflow. return primary | ((basePrimary & 0xff000000L) + ((long)offset << 24)); }
[ "public", "static", "long", "incThreeBytePrimaryByOffset", "(", "long", "basePrimary", ",", "boolean", "isCompressible", ",", "int", "offset", ")", "{", "// Extract the third byte, minus the minimum byte value,", "// plus the offset, modulo the number of usable byte values, plus the ...
Increments a 3-byte primary by a code point offset.
[ "Increments", "a", "3", "-", "byte", "primary", "by", "a", "code", "point", "offset", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/Collation.java#L485-L505
34,956
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/Collation.java
Collation.getThreeBytePrimaryForOffsetData
static long getThreeBytePrimaryForOffsetData(int c, long dataCE) { long p = dataCE >>> 32; // three-byte primary pppppp00 int lower32 = (int)dataCE; // base code point b & step s: bbbbbbss (bit 7: isCompressible) int offset = (c - (lower32 >> 8)) * (lower32 & 0x7f); // delta * increment boolean isCompressible = (lower32 & 0x80) != 0; return Collation.incThreeBytePrimaryByOffset(p, isCompressible, offset); }
java
static long getThreeBytePrimaryForOffsetData(int c, long dataCE) { long p = dataCE >>> 32; // three-byte primary pppppp00 int lower32 = (int)dataCE; // base code point b & step s: bbbbbbss (bit 7: isCompressible) int offset = (c - (lower32 >> 8)) * (lower32 & 0x7f); // delta * increment boolean isCompressible = (lower32 & 0x80) != 0; return Collation.incThreeBytePrimaryByOffset(p, isCompressible, offset); }
[ "static", "long", "getThreeBytePrimaryForOffsetData", "(", "int", "c", ",", "long", "dataCE", ")", "{", "long", "p", "=", "dataCE", ">>>", "32", ";", "// three-byte primary pppppp00", "int", "lower32", "=", "(", "int", ")", "dataCE", ";", "// base code point b &...
Computes a 3-byte primary for c's OFFSET_TAG data "CE".
[ "Computes", "a", "3", "-", "byte", "primary", "for", "c", "s", "OFFSET_TAG", "data", "CE", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/Collation.java#L564-L570
34,957
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/Collation.java
Collation.unassignedPrimaryFromCodePoint
static long unassignedPrimaryFromCodePoint(int c) { // Create a gap before U+0000. Use c=-1 for [first unassigned]. ++c; // Fourth byte: 18 values, every 14th byte value (gap of 13). long primary = 2 + (c % 18) * 14; c /= 18; // Third byte: 254 values. primary |= (2 + (c % 254)) << 8; c /= 254; // Second byte: 251 values 04..FE excluding the primary compression bytes. primary |= (4 + (c % 251)) << 16; // One lead byte covers all code points (c < 0x1182B4 = 1*251*254*18). return primary | ((long)UNASSIGNED_IMPLICIT_BYTE << 24); }
java
static long unassignedPrimaryFromCodePoint(int c) { // Create a gap before U+0000. Use c=-1 for [first unassigned]. ++c; // Fourth byte: 18 values, every 14th byte value (gap of 13). long primary = 2 + (c % 18) * 14; c /= 18; // Third byte: 254 values. primary |= (2 + (c % 254)) << 8; c /= 254; // Second byte: 251 values 04..FE excluding the primary compression bytes. primary |= (4 + (c % 251)) << 16; // One lead byte covers all code points (c < 0x1182B4 = 1*251*254*18). return primary | ((long)UNASSIGNED_IMPLICIT_BYTE << 24); }
[ "static", "long", "unassignedPrimaryFromCodePoint", "(", "int", "c", ")", "{", "// Create a gap before U+0000. Use c=-1 for [first unassigned].", "++", "c", ";", "// Fourth byte: 18 values, every 14th byte value (gap of 13).", "long", "primary", "=", "2", "+", "(", "c", "%", ...
Returns the unassigned-character implicit primary weight for any valid code point c.
[ "Returns", "the", "unassigned", "-", "character", "implicit", "primary", "weight", "for", "any", "valid", "code", "point", "c", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/Collation.java#L575-L588
34,958
google/j2objc
examples/protobuf/AddPerson.java
AddPerson.PromptForAddress
static Person PromptForAddress(BufferedReader stdin, PrintStream stdout) throws IOException { Person.Builder person = Person.newBuilder(); stdout.print("Enter person ID: "); person.setId(Integer.valueOf(stdin.readLine())); stdout.print("Enter name: "); person.setName(stdin.readLine()); stdout.print("Enter email address (blank for none): "); String email = stdin.readLine(); if (email.length() > 0) { person.setEmail(email); } while (true) { stdout.print("Enter a phone number (or leave blank to finish): "); String number = stdin.readLine(); if (number.length() == 0) { break; } Person.PhoneNumber.Builder phoneNumber = Person.PhoneNumber.newBuilder().setNumber(number); stdout.print("Is this a mobile, home, or work phone? "); String type = stdin.readLine(); if (type.equals("mobile")) { phoneNumber.setType(Person.PhoneType.MOBILE); } else if (type.equals("home")) { phoneNumber.setType(Person.PhoneType.HOME); } else if (type.equals("work")) { phoneNumber.setType(Person.PhoneType.WORK); } else { stdout.println("Unknown phone type. Using default."); } person.addPhones(phoneNumber); } return person.build(); }
java
static Person PromptForAddress(BufferedReader stdin, PrintStream stdout) throws IOException { Person.Builder person = Person.newBuilder(); stdout.print("Enter person ID: "); person.setId(Integer.valueOf(stdin.readLine())); stdout.print("Enter name: "); person.setName(stdin.readLine()); stdout.print("Enter email address (blank for none): "); String email = stdin.readLine(); if (email.length() > 0) { person.setEmail(email); } while (true) { stdout.print("Enter a phone number (or leave blank to finish): "); String number = stdin.readLine(); if (number.length() == 0) { break; } Person.PhoneNumber.Builder phoneNumber = Person.PhoneNumber.newBuilder().setNumber(number); stdout.print("Is this a mobile, home, or work phone? "); String type = stdin.readLine(); if (type.equals("mobile")) { phoneNumber.setType(Person.PhoneType.MOBILE); } else if (type.equals("home")) { phoneNumber.setType(Person.PhoneType.HOME); } else if (type.equals("work")) { phoneNumber.setType(Person.PhoneType.WORK); } else { stdout.println("Unknown phone type. Using default."); } person.addPhones(phoneNumber); } return person.build(); }
[ "static", "Person", "PromptForAddress", "(", "BufferedReader", "stdin", ",", "PrintStream", "stdout", ")", "throws", "IOException", "{", "Person", ".", "Builder", "person", "=", "Person", ".", "newBuilder", "(", ")", ";", "stdout", ".", "print", "(", "\"Enter ...
This function fills in a Person message based on user input.
[ "This", "function", "fills", "in", "a", "Person", "message", "based", "on", "user", "input", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/examples/protobuf/AddPerson.java#L15-L57
34,959
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/security/auth/x500/X500Principal.java
X500Principal.writeObject
private void writeObject(java.io.ObjectOutputStream s) throws IOException { s.writeObject(thisX500Name.getEncodedInternal()); }
java
private void writeObject(java.io.ObjectOutputStream s) throws IOException { s.writeObject(thisX500Name.getEncodedInternal()); }
[ "private", "void", "writeObject", "(", "java", ".", "io", ".", "ObjectOutputStream", "s", ")", "throws", "IOException", "{", "s", ".", "writeObject", "(", "thisX500Name", ".", "getEncodedInternal", "(", ")", ")", ";", "}" ]
Save the X500Principal object to a stream. @serialData this {@code X500Principal} is serialized by writing out its DER-encoded form (the value of {@code getEncoded} is serialized).
[ "Save", "the", "X500Principal", "object", "to", "a", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/security/auth/x500/X500Principal.java#L499-L502
34,960
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/IntVector.java
IntVector.addElements
public final void addElements(int value, int numberOfElements) { if ((m_firstFree + numberOfElements) >= m_mapSize) { m_mapSize += (m_blocksize+numberOfElements); int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } for (int i = 0; i < numberOfElements; i++) { m_map[m_firstFree] = value; m_firstFree++; } }
java
public final void addElements(int value, int numberOfElements) { if ((m_firstFree + numberOfElements) >= m_mapSize) { m_mapSize += (m_blocksize+numberOfElements); int newMap[] = new int[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } for (int i = 0; i < numberOfElements; i++) { m_map[m_firstFree] = value; m_firstFree++; } }
[ "public", "final", "void", "addElements", "(", "int", "value", ",", "int", "numberOfElements", ")", "{", "if", "(", "(", "m_firstFree", "+", "numberOfElements", ")", ">=", "m_mapSize", ")", "{", "m_mapSize", "+=", "(", "m_blocksize", "+", "numberOfElements", ...
Append several int values onto the vector. @param value Int to add to the list
[ "Append", "several", "int", "values", "onto", "the", "vector", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/IntVector.java#L150-L169
34,961
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Number.java
Number.num
public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException { return m_right.num(xctxt); }
java
public double num(XPathContext xctxt) throws javax.xml.transform.TransformerException { return m_right.num(xctxt); }
[ "public", "double", "num", "(", "XPathContext", "xctxt", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "return", "m_right", ".", "num", "(", "xctxt", ")", ";", "}" ]
Evaluate this operation directly to a double. @param xctxt The runtime execution context. @return The result of the operation as a double. @throws javax.xml.transform.TransformerException
[ "Evaluate", "this", "operation", "directly", "to", "a", "double", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Number.java#L62-L67
34,962
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/util/PackageInfoLookup.java
PackageInfoLookup.hasAnnotation
private static boolean hasAnnotation(String pkgInfo, String annotation) { if (!annotation.contains(".")) { ErrorUtil.warning(annotation + " is not a fully qualified name"); } if (pkgInfo.contains("@" + annotation)) { return true; } int idx = annotation.lastIndexOf("."); String annotationPackageName = annotation.substring(0, idx); String annotationSimpleName = annotation.substring(idx + 1); if (pkgInfo.contains("@" + annotationSimpleName)) { String importRegex = "import\\s*" + annotationPackageName + "(\\.\\*|\\." + annotationSimpleName + ")"; Pattern p = Pattern.compile(importRegex); Matcher m = p.matcher(pkgInfo); if (m.find()) { return true; } } return false; }
java
private static boolean hasAnnotation(String pkgInfo, String annotation) { if (!annotation.contains(".")) { ErrorUtil.warning(annotation + " is not a fully qualified name"); } if (pkgInfo.contains("@" + annotation)) { return true; } int idx = annotation.lastIndexOf("."); String annotationPackageName = annotation.substring(0, idx); String annotationSimpleName = annotation.substring(idx + 1); if (pkgInfo.contains("@" + annotationSimpleName)) { String importRegex = "import\\s*" + annotationPackageName + "(\\.\\*|\\." + annotationSimpleName + ")"; Pattern p = Pattern.compile(importRegex); Matcher m = p.matcher(pkgInfo); if (m.find()) { return true; } } return false; }
[ "private", "static", "boolean", "hasAnnotation", "(", "String", "pkgInfo", ",", "String", "annotation", ")", "{", "if", "(", "!", "annotation", ".", "contains", "(", "\".\"", ")", ")", "{", "ErrorUtil", ".", "warning", "(", "annotation", "+", "\" is not a fu...
Return true if pkgInfo has the specified annotation. @param pkgInfo package-info source code @param annotation fully qualified name of the annotation
[ "Return", "true", "if", "pkgInfo", "has", "the", "specified", "annotation", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/PackageInfoLookup.java#L134-L154
34,963
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/Buffer.java
Buffer.limit
public final Buffer limit(int newLimit) { if ((newLimit > capacity) || (newLimit < 0)) throw new IllegalArgumentException(); limit = newLimit; if (position > limit) position = limit; if (mark > limit) mark = -1; return this; }
java
public final Buffer limit(int newLimit) { if ((newLimit > capacity) || (newLimit < 0)) throw new IllegalArgumentException(); limit = newLimit; if (position > limit) position = limit; if (mark > limit) mark = -1; return this; }
[ "public", "final", "Buffer", "limit", "(", "int", "newLimit", ")", "{", "if", "(", "(", "newLimit", ">", "capacity", ")", "||", "(", "newLimit", "<", "0", ")", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "limit", "=", "newLimit", ";...
Sets this buffer's limit. If the position is larger than the new limit then it is set to the new limit. If the mark is defined and larger than the new limit then it is discarded. @param newLimit The new limit value; must be non-negative and no larger than this buffer's capacity @return This buffer @throws IllegalArgumentException If the preconditions on <tt>newLimit</tt> do not hold
[ "Sets", "this", "buffer", "s", "limit", ".", "If", "the", "position", "is", "larger", "than", "the", "new", "limit", "then", "it", "is", "set", "to", "the", "new", "limit", ".", "If", "the", "mark", "is", "defined", "and", "larger", "than", "the", "n...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/Buffer.java#L274-L281
34,964
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNamedNodeMap.java
DTMNamedNodeMap.getLength
public int getLength() { if (m_count == -1) { short count = 0; for (int n = dtm.getFirstAttribute(element); n != -1; n = dtm.getNextAttribute(n)) { ++count; } m_count = count; } return (int) m_count; }
java
public int getLength() { if (m_count == -1) { short count = 0; for (int n = dtm.getFirstAttribute(element); n != -1; n = dtm.getNextAttribute(n)) { ++count; } m_count = count; } return (int) m_count; }
[ "public", "int", "getLength", "(", ")", "{", "if", "(", "m_count", "==", "-", "1", ")", "{", "short", "count", "=", "0", ";", "for", "(", "int", "n", "=", "dtm", ".", "getFirstAttribute", "(", "element", ")", ";", "n", "!=", "-", "1", ";", "n",...
Return the number of Attributes on this Element @return The number of nodes in this map.
[ "Return", "the", "number", "of", "Attributes", "on", "this", "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/DTMNamedNodeMap.java#L73-L90
34,965
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNamedNodeMap.java
DTMNamedNodeMap.getNamedItem
public Node getNamedItem(String name) { for (int n = dtm.getFirstAttribute(element); n != DTM.NULL; n = dtm.getNextAttribute(n)) { if (dtm.getNodeName(n).equals(name)) return dtm.getNode(n); } return null; }
java
public Node getNamedItem(String name) { for (int n = dtm.getFirstAttribute(element); n != DTM.NULL; n = dtm.getNextAttribute(n)) { if (dtm.getNodeName(n).equals(name)) return dtm.getNode(n); } return null; }
[ "public", "Node", "getNamedItem", "(", "String", "name", ")", "{", "for", "(", "int", "n", "=", "dtm", ".", "getFirstAttribute", "(", "element", ")", ";", "n", "!=", "DTM", ".", "NULL", ";", "n", "=", "dtm", ".", "getNextAttribute", "(", "n", ")", ...
Retrieves a node specified by name. @param name The <code>nodeName</code> of a node to retrieve. @return A <code>Node</code> (of any type) with the specified <code>nodeName</code>, or <code>null</code> if it does not identify any node in this map.
[ "Retrieves", "a", "node", "specified", "by", "name", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNamedNodeMap.java#L99-L110
34,966
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java
Calendar.setTimeInMillis
public void setTimeInMillis(long millis) { // If we don't need to recalculate the calendar field values, // do nothing. // BEGIN Android-changed: Removed ZoneInfo support // if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet // && (zone instanceof ZoneInfo) && !((ZoneInfo)zone).isDirty()) { if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet) { // END Android-changed: Removed ZoneInfo support return; } time = millis; isTimeSet = true; areFieldsSet = false; computeFields(); areAllFieldsSet = areFieldsSet = true; }
java
public void setTimeInMillis(long millis) { // If we don't need to recalculate the calendar field values, // do nothing. // BEGIN Android-changed: Removed ZoneInfo support // if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet // && (zone instanceof ZoneInfo) && !((ZoneInfo)zone).isDirty()) { if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet) { // END Android-changed: Removed ZoneInfo support return; } time = millis; isTimeSet = true; areFieldsSet = false; computeFields(); areAllFieldsSet = areFieldsSet = true; }
[ "public", "void", "setTimeInMillis", "(", "long", "millis", ")", "{", "// If we don't need to recalculate the calendar field values,", "// do nothing.", "// BEGIN Android-changed: Removed ZoneInfo support", "// if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet", "// ...
Sets this Calendar's current time from the given long value. @param millis the new time in UTC milliseconds from the epoch. @see #setTime(Date) @see #getTimeInMillis()
[ "Sets", "this", "Calendar", "s", "current", "time", "from", "the", "given", "long", "value", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java#L1765-L1781
34,967
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java
Calendar.set
public void set(int field, int value) { // If the fields are partially normalized, calculate all the // fields before changing any fields. if (areFieldsSet && !areAllFieldsSet) { computeFields(); } internalSet(field, value); isTimeSet = false; areFieldsSet = false; isSet[field] = true; stamp[field] = nextStamp++; if (nextStamp == Integer.MAX_VALUE) { adjustStamp(); } }
java
public void set(int field, int value) { // If the fields are partially normalized, calculate all the // fields before changing any fields. if (areFieldsSet && !areAllFieldsSet) { computeFields(); } internalSet(field, value); isTimeSet = false; areFieldsSet = false; isSet[field] = true; stamp[field] = nextStamp++; if (nextStamp == Integer.MAX_VALUE) { adjustStamp(); } }
[ "public", "void", "set", "(", "int", "field", ",", "int", "value", ")", "{", "// If the fields are partially normalized, calculate all the", "// fields before changing any fields.", "if", "(", "areFieldsSet", "&&", "!", "areAllFieldsSet", ")", "{", "computeFields", "(", ...
Sets the given calendar field to the given value. The value is not interpreted by this method regardless of the leniency mode. @param field the given calendar field. @param value the value to be set for the given calendar field. @throws ArrayIndexOutOfBoundsException if the specified field is out of range (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>). in non-lenient mode. @see #set(int,int,int) @see #set(int,int,int,int,int) @see #set(int,int,int,int,int,int) @see #get(int)
[ "Sets", "the", "given", "calendar", "field", "to", "the", "given", "value", ".", "The", "value", "is", "not", "interpreted", "by", "this", "method", "regardless", "of", "the", "leniency", "mode", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java#L1849-L1864
34,968
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java
Calendar.aggregateStamp
private static int aggregateStamp(int stamp_a, int stamp_b) { if (stamp_a == UNSET || stamp_b == UNSET) { return UNSET; } return (stamp_a > stamp_b) ? stamp_a : stamp_b; }
java
private static int aggregateStamp(int stamp_a, int stamp_b) { if (stamp_a == UNSET || stamp_b == UNSET) { return UNSET; } return (stamp_a > stamp_b) ? stamp_a : stamp_b; }
[ "private", "static", "int", "aggregateStamp", "(", "int", "stamp_a", ",", "int", "stamp_b", ")", "{", "if", "(", "stamp_a", "==", "UNSET", "||", "stamp_b", "==", "UNSET", ")", "{", "return", "UNSET", ";", "}", "return", "(", "stamp_a", ">", "stamp_b", ...
Returns the pseudo-time-stamp for two fields, given their individual pseudo-time-stamps. If either of the fields is unset, then the aggregate is unset. Otherwise, the aggregate is the later of the two stamps.
[ "Returns", "the", "pseudo", "-", "time", "-", "stamp", "for", "two", "fields", "given", "their", "individual", "pseudo", "-", "time", "-", "stamps", ".", "If", "either", "of", "the", "fields", "is", "unset", "then", "the", "aggregate", "is", "unset", "."...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java#L2525-L2530
34,969
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java
Calendar.setTimeZone
public void setTimeZone(TimeZone value) { zone = value; sharedZone = false; /* Recompute the fields from the time using the new zone. This also * works if isTimeSet is false (after a call to set()). In that case * the time will be computed from the fields using the new zone, then * the fields will get recomputed from that. Consider the sequence of * calls: cal.setTimeZone(EST); cal.set(HOUR, 1); cal.setTimeZone(PST). * Is cal set to 1 o'clock EST or 1 o'clock PST? Answer: PST. More * generally, a call to setTimeZone() affects calls to set() BEFORE AND * AFTER it up to the next call to complete(). */ areAllFieldsSet = areFieldsSet = false; }
java
public void setTimeZone(TimeZone value) { zone = value; sharedZone = false; /* Recompute the fields from the time using the new zone. This also * works if isTimeSet is false (after a call to set()). In that case * the time will be computed from the fields using the new zone, then * the fields will get recomputed from that. Consider the sequence of * calls: cal.setTimeZone(EST); cal.set(HOUR, 1); cal.setTimeZone(PST). * Is cal set to 1 o'clock EST or 1 o'clock PST? Answer: PST. More * generally, a call to setTimeZone() affects calls to set() BEFORE AND * AFTER it up to the next call to complete(). */ areAllFieldsSet = areFieldsSet = false; }
[ "public", "void", "setTimeZone", "(", "TimeZone", "value", ")", "{", "zone", "=", "value", ";", "sharedZone", "=", "false", ";", "/* Recompute the fields from the time using the new zone. This also\n * works if isTimeSet is false (after a call to set()). In that case\n ...
Sets the time zone with the given time zone value. @param value the given time zone.
[ "Sets", "the", "time", "zone", "with", "the", "given", "time", "zone", "value", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java#L2783-L2797
34,970
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java
Calendar.getTimeZone
public TimeZone getTimeZone() { // If the TimeZone object is shared by other Calendar instances, then // create a clone. if (sharedZone) { zone = (TimeZone) zone.clone(); sharedZone = false; } return zone; }
java
public TimeZone getTimeZone() { // If the TimeZone object is shared by other Calendar instances, then // create a clone. if (sharedZone) { zone = (TimeZone) zone.clone(); sharedZone = false; } return zone; }
[ "public", "TimeZone", "getTimeZone", "(", ")", "{", "// If the TimeZone object is shared by other Calendar instances, then", "// create a clone.", "if", "(", "sharedZone", ")", "{", "zone", "=", "(", "TimeZone", ")", "zone", ".", "clone", "(", ")", ";", "sharedZone", ...
Gets the time zone. @return the time zone object associated with this calendar.
[ "Gets", "the", "time", "zone", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java#L2804-L2813
34,971
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java
Calendar.setWeekCountData
private void setWeekCountData(Locale desiredLocale) { /* try to get the Locale data from the cache */ int[] data = cachedLocaleData.get(desiredLocale); if (data == null) { /* cache miss */ data = new int[2]; // BEGIN Android-changed: Use ICU4C to get week data. // data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale); // data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale); LocaleData localeData = LocaleData.get(desiredLocale); data[0] = localeData.firstDayOfWeek.intValue(); data[1] = localeData.minimalDaysInFirstWeek.intValue(); // END Android-changed: Use ICU4C to get week data. cachedLocaleData.putIfAbsent(desiredLocale, data); } firstDayOfWeek = data[0]; minimalDaysInFirstWeek = data[1]; }
java
private void setWeekCountData(Locale desiredLocale) { /* try to get the Locale data from the cache */ int[] data = cachedLocaleData.get(desiredLocale); if (data == null) { /* cache miss */ data = new int[2]; // BEGIN Android-changed: Use ICU4C to get week data. // data[0] = CalendarDataUtility.retrieveFirstDayOfWeek(desiredLocale); // data[1] = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(desiredLocale); LocaleData localeData = LocaleData.get(desiredLocale); data[0] = localeData.firstDayOfWeek.intValue(); data[1] = localeData.minimalDaysInFirstWeek.intValue(); // END Android-changed: Use ICU4C to get week data. cachedLocaleData.putIfAbsent(desiredLocale, data); } firstDayOfWeek = data[0]; minimalDaysInFirstWeek = data[1]; }
[ "private", "void", "setWeekCountData", "(", "Locale", "desiredLocale", ")", "{", "/* try to get the Locale data from the cache */", "int", "[", "]", "data", "=", "cachedLocaleData", ".", "get", "(", "desiredLocale", ")", ";", "if", "(", "data", "==", "null", ")", ...
Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent. They are used to figure out the week count for a specific date for a given locale. These must be set when a Calendar is constructed. @param desiredLocale the given locale.
[ "Both", "firstDayOfWeek", "and", "minimalDaysInFirstWeek", "are", "locale", "-", "dependent", ".", "They", "are", "used", "to", "figure", "out", "the", "week", "count", "for", "a", "specific", "date", "for", "a", "given", "locale", ".", "These", "must", "be"...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java#L3298-L3315
34,972
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java
Calendar.invalidateWeekFields
private void invalidateWeekFields() { if (stamp[WEEK_OF_MONTH] != COMPUTED && stamp[WEEK_OF_YEAR] != COMPUTED) { return; } // We have to check the new values of these fields after changing // firstDayOfWeek and/or minimalDaysInFirstWeek. If the field values // have been changed, then set the new values. (4822110) Calendar cal = (Calendar) clone(); cal.setLenient(true); cal.clear(WEEK_OF_MONTH); cal.clear(WEEK_OF_YEAR); if (stamp[WEEK_OF_MONTH] == COMPUTED) { int weekOfMonth = cal.get(WEEK_OF_MONTH); if (fields[WEEK_OF_MONTH] != weekOfMonth) { fields[WEEK_OF_MONTH] = weekOfMonth; } } if (stamp[WEEK_OF_YEAR] == COMPUTED) { int weekOfYear = cal.get(WEEK_OF_YEAR); if (fields[WEEK_OF_YEAR] != weekOfYear) { fields[WEEK_OF_YEAR] = weekOfYear; } } }
java
private void invalidateWeekFields() { if (stamp[WEEK_OF_MONTH] != COMPUTED && stamp[WEEK_OF_YEAR] != COMPUTED) { return; } // We have to check the new values of these fields after changing // firstDayOfWeek and/or minimalDaysInFirstWeek. If the field values // have been changed, then set the new values. (4822110) Calendar cal = (Calendar) clone(); cal.setLenient(true); cal.clear(WEEK_OF_MONTH); cal.clear(WEEK_OF_YEAR); if (stamp[WEEK_OF_MONTH] == COMPUTED) { int weekOfMonth = cal.get(WEEK_OF_MONTH); if (fields[WEEK_OF_MONTH] != weekOfMonth) { fields[WEEK_OF_MONTH] = weekOfMonth; } } if (stamp[WEEK_OF_YEAR] == COMPUTED) { int weekOfYear = cal.get(WEEK_OF_YEAR); if (fields[WEEK_OF_YEAR] != weekOfYear) { fields[WEEK_OF_YEAR] = weekOfYear; } } }
[ "private", "void", "invalidateWeekFields", "(", ")", "{", "if", "(", "stamp", "[", "WEEK_OF_MONTH", "]", "!=", "COMPUTED", "&&", "stamp", "[", "WEEK_OF_YEAR", "]", "!=", "COMPUTED", ")", "{", "return", ";", "}", "// We have to check the new values of these fields ...
Sets the WEEK_OF_MONTH and WEEK_OF_YEAR fields to new values with the new parameter value if they have been calculated internally.
[ "Sets", "the", "WEEK_OF_MONTH", "and", "WEEK_OF_YEAR", "fields", "to", "new", "values", "with", "the", "new", "parameter", "value", "if", "they", "have", "been", "calculated", "internally", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java#L3382-L3410
34,973
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java
DOMHelper.isNodeTheSame
public static boolean isNodeTheSame(Node node1, Node node2) { if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy) return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2); else return (node1 == node2); }
java
public static boolean isNodeTheSame(Node node1, Node node2) { if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy) return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2); else return (node1 == node2); }
[ "public", "static", "boolean", "isNodeTheSame", "(", "Node", "node1", ",", "Node", "node2", ")", "{", "if", "(", "node1", "instanceof", "DTMNodeProxy", "&&", "node2", "instanceof", "DTMNodeProxy", ")", "return", "(", "(", "DTMNodeProxy", ")", "node1", ")", "...
Use DTMNodeProxy to determine whether two nodes are the same. @param node1 The first DOM node to compare. @param node2 The second DOM node to compare. @return true if the two nodes are the same.
[ "Use", "DTMNodeProxy", "to", "determine", "whether", "two", "nodes", "are", "the", "same", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java#L339-L345
34,974
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java
DOMHelper.getNamespaceForPrefix
public String getNamespaceForPrefix(String prefix, Element namespaceContext) { int type; Node parent = namespaceContext; String namespace = null; if (prefix.equals("xml")) { namespace = QName.S_XMLNAMESPACEURI; // Hardcoded, per Namespace spec } else if(prefix.equals("xmlns")) { // Hardcoded in the DOM spec, expected to be adopted by // Namespace spec. NOTE: Namespace declarations _must_ use // the xmlns: prefix; other prefixes declared as belonging // to this namespace will not be recognized and should // probably be rejected by parsers as erroneous declarations. namespace = "http://www.w3.org/2000/xmlns/"; } else { // Attribute name for this prefix's declaration String declname=(prefix=="") ? "xmlns" : "xmlns:"+prefix; // Scan until we run out of Elements or have resolved the namespace while ((null != parent) && (null == namespace) && (((type = parent.getNodeType()) == Node.ELEMENT_NODE) || (type == Node.ENTITY_REFERENCE_NODE))) { if (type == Node.ELEMENT_NODE) { // Look for the appropriate Namespace Declaration attribute, // either "xmlns:prefix" or (if prefix is "") "xmlns". // TODO: This does not handle "implicit declarations" // which may be created when the DOM is edited. DOM Level // 3 will define how those should be interpreted. But // this issue won't arise in freshly-parsed DOMs. // NOTE: declname is set earlier, outside the loop. Attr attr=((Element)parent).getAttributeNode(declname); if(attr!=null) { namespace = attr.getNodeValue(); break; } } parent = getParentOfNode(parent); } } return namespace; }
java
public String getNamespaceForPrefix(String prefix, Element namespaceContext) { int type; Node parent = namespaceContext; String namespace = null; if (prefix.equals("xml")) { namespace = QName.S_XMLNAMESPACEURI; // Hardcoded, per Namespace spec } else if(prefix.equals("xmlns")) { // Hardcoded in the DOM spec, expected to be adopted by // Namespace spec. NOTE: Namespace declarations _must_ use // the xmlns: prefix; other prefixes declared as belonging // to this namespace will not be recognized and should // probably be rejected by parsers as erroneous declarations. namespace = "http://www.w3.org/2000/xmlns/"; } else { // Attribute name for this prefix's declaration String declname=(prefix=="") ? "xmlns" : "xmlns:"+prefix; // Scan until we run out of Elements or have resolved the namespace while ((null != parent) && (null == namespace) && (((type = parent.getNodeType()) == Node.ELEMENT_NODE) || (type == Node.ENTITY_REFERENCE_NODE))) { if (type == Node.ELEMENT_NODE) { // Look for the appropriate Namespace Declaration attribute, // either "xmlns:prefix" or (if prefix is "") "xmlns". // TODO: This does not handle "implicit declarations" // which may be created when the DOM is edited. DOM Level // 3 will define how those should be interpreted. But // this issue won't arise in freshly-parsed DOMs. // NOTE: declname is set earlier, outside the loop. Attr attr=((Element)parent).getAttributeNode(declname); if(attr!=null) { namespace = attr.getNodeValue(); break; } } parent = getParentOfNode(parent); } } return namespace; }
[ "public", "String", "getNamespaceForPrefix", "(", "String", "prefix", ",", "Element", "namespaceContext", ")", "{", "int", "type", ";", "Node", "parent", "=", "namespaceContext", ";", "String", "namespace", "=", "null", ";", "if", "(", "prefix", ".", "equals",...
Given an XML Namespace prefix and a context in which the prefix is to be evaluated, return the Namespace Name this prefix was bound to. Note that DOM Level 3 is expected to provide a version of this which deals with the DOM's "early binding" behavior. Default handling: @param prefix String containing namespace prefix to be resolved, without the ':' which separates it from the localname when used in a Node Name. The empty sting signifies the default namespace at this point in the document. @param namespaceContext Element which provides context for resolution. (We could extend this to work for other nodes by first seeking their nearest Element ancestor.) @return a String containing the Namespace URI which this prefix represents in the specified context.
[ "Given", "an", "XML", "Namespace", "prefix", "and", "a", "context", "in", "which", "the", "prefix", "is", "to", "be", "evaluated", "return", "the", "Namespace", "Name", "this", "prefix", "was", "bound", "to", ".", "Note", "that", "DOM", "Level", "3", "is...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java#L512-L568
34,975
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java
DOMHelper.getLocalNameOfNode
public String getLocalNameOfNode(Node n) { String qname = n.getNodeName(); int index = qname.indexOf(':'); return (index < 0) ? qname : qname.substring(index + 1); }
java
public String getLocalNameOfNode(Node n) { String qname = n.getNodeName(); int index = qname.indexOf(':'); return (index < 0) ? qname : qname.substring(index + 1); }
[ "public", "String", "getLocalNameOfNode", "(", "Node", "n", ")", "{", "String", "qname", "=", "n", ".", "getNodeName", "(", ")", ";", "int", "index", "=", "qname", ".", "indexOf", "(", "'", "'", ")", ";", "return", "(", "index", "<", "0", ")", "?",...
Returns the local name of the given node. If the node's name begins with a namespace prefix, this is the part after the colon; otherwise it's the full node name. @param n the node to be examined. @return String containing the Local Name
[ "Returns", "the", "local", "name", "of", "the", "given", "node", ".", "If", "the", "node", "s", "name", "begins", "with", "a", "namespace", "prefix", "this", "is", "the", "part", "after", "the", "colon", ";", "otherwise", "it", "s", "the", "full", "nod...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java#L828-L835
34,976
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java
DOMHelper.isNamespaceNode
public boolean isNamespaceNode(Node n) { if (Node.ATTRIBUTE_NODE == n.getNodeType()) { String attrName = n.getNodeName(); return (attrName.startsWith("xmlns:") || attrName.equals("xmlns")); } return false; }
java
public boolean isNamespaceNode(Node n) { if (Node.ATTRIBUTE_NODE == n.getNodeType()) { String attrName = n.getNodeName(); return (attrName.startsWith("xmlns:") || attrName.equals("xmlns")); } return false; }
[ "public", "boolean", "isNamespaceNode", "(", "Node", "n", ")", "{", "if", "(", "Node", ".", "ATTRIBUTE_NODE", "==", "n", ".", "getNodeType", "(", ")", ")", "{", "String", "attrName", "=", "n", ".", "getNodeName", "(", ")", ";", "return", "(", "attrName...
Test whether the given node is a namespace decl node. In DOM Level 2 this can be done in a namespace-aware manner, but in Level 1 DOMs it has to be done by testing the node name. @param n Node to be examined. @return boolean -- true iff the node is an Attr whose name is "xmlns" or has the "xmlns:" prefix.
[ "Test", "whether", "the", "given", "node", "is", "a", "namespace", "decl", "node", ".", "In", "DOM", "Level", "2", "this", "can", "be", "done", "in", "a", "namespace", "-", "aware", "manner", "but", "in", "Level", "1", "DOMs", "it", "has", "to", "be"...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java#L971-L982
34,977
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/chrono/IsoChronology.java
IsoChronology.dateYearDay
@Override // override with covariant return type public LocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
java
@Override // override with covariant return type public LocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
[ "@", "Override", "// override with covariant return type", "public", "LocalDate", "dateYearDay", "(", "Era", "era", ",", "int", "yearOfEra", ",", "int", "dayOfYear", ")", "{", "return", "dateYearDay", "(", "prolepticYear", "(", "era", ",", "yearOfEra", ")", ",", ...
Obtains an ISO local date from the era, year-of-era and day-of-year fields. @param era the ISO era, not null @param yearOfEra the ISO year-of-era @param dayOfYear the ISO day-of-year @return the ISO local date, not null @throws DateTimeException if unable to create the date
[ "Obtains", "an", "ISO", "local", "date", "from", "the", "era", "year", "-", "of", "-", "era", "and", "day", "-", "of", "-", "year", "fields", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/chrono/IsoChronology.java#L217-L220
34,978
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/transform/TransformerException.java
TransformerException.getMessageAndLocation
public String getMessageAndLocation() { StringBuilder sbuffer = new StringBuilder(); String message = super.getMessage(); if (null != message) { sbuffer.append(message); } if (null != locator) { String systemID = locator.getSystemId(); int line = locator.getLineNumber(); int column = locator.getColumnNumber(); if (null != systemID) { sbuffer.append("; SystemID: "); sbuffer.append(systemID); } if (0 != line) { sbuffer.append("; Line#: "); sbuffer.append(line); } if (0 != column) { sbuffer.append("; Column#: "); sbuffer.append(column); } } return sbuffer.toString(); }
java
public String getMessageAndLocation() { StringBuilder sbuffer = new StringBuilder(); String message = super.getMessage(); if (null != message) { sbuffer.append(message); } if (null != locator) { String systemID = locator.getSystemId(); int line = locator.getLineNumber(); int column = locator.getColumnNumber(); if (null != systemID) { sbuffer.append("; SystemID: "); sbuffer.append(systemID); } if (0 != line) { sbuffer.append("; Line#: "); sbuffer.append(line); } if (0 != column) { sbuffer.append("; Column#: "); sbuffer.append(column); } } return sbuffer.toString(); }
[ "public", "String", "getMessageAndLocation", "(", ")", "{", "StringBuilder", "sbuffer", "=", "new", "StringBuilder", "(", ")", ";", "String", "message", "=", "super", ".", "getMessage", "(", ")", ";", "if", "(", "null", "!=", "message", ")", "{", "sbuffer"...
Get the error message with location information appended. @return A <code>String</code> representing the error message with location information appended.
[ "Get", "the", "error", "message", "with", "location", "information", "appended", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/transform/TransformerException.java#L207-L238
34,979
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/transform/TransformerException.java
TransformerException.getLocationAsString
public String getLocationAsString() { if (null != locator) { StringBuilder sbuffer = new StringBuilder(); String systemID = locator.getSystemId(); int line = locator.getLineNumber(); int column = locator.getColumnNumber(); if (null != systemID) { sbuffer.append("; SystemID: "); sbuffer.append(systemID); } if (0 != line) { sbuffer.append("; Line#: "); sbuffer.append(line); } if (0 != column) { sbuffer.append("; Column#: "); sbuffer.append(column); } return sbuffer.toString(); } else { return null; } }
java
public String getLocationAsString() { if (null != locator) { StringBuilder sbuffer = new StringBuilder(); String systemID = locator.getSystemId(); int line = locator.getLineNumber(); int column = locator.getColumnNumber(); if (null != systemID) { sbuffer.append("; SystemID: "); sbuffer.append(systemID); } if (0 != line) { sbuffer.append("; Line#: "); sbuffer.append(line); } if (0 != column) { sbuffer.append("; Column#: "); sbuffer.append(column); } return sbuffer.toString(); } else { return null; } }
[ "public", "String", "getLocationAsString", "(", ")", "{", "if", "(", "null", "!=", "locator", ")", "{", "StringBuilder", "sbuffer", "=", "new", "StringBuilder", "(", ")", ";", "String", "systemID", "=", "locator", ".", "getSystemId", "(", ")", ";", "int", ...
Get the location information as a string. @return A string with location info, or null if there is no location information.
[ "Get", "the", "location", "information", "as", "a", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/transform/TransformerException.java#L246-L273
34,980
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java
IncrementalSAXSource_Filter.setXMLReader
public void setXMLReader(XMLReader eventsource) { fXMLReader=eventsource; eventsource.setContentHandler(this); eventsource.setDTDHandler(this); eventsource.setErrorHandler(this); // to report fatal errors in filtering mode // Not supported by all SAX2 filters: try { eventsource. setProperty("http://xml.org/sax/properties/lexical-handler", this); } catch(SAXNotRecognizedException e) { // Nothing we can do about it } catch(SAXNotSupportedException e) { // Nothing we can do about it } // Should we also bind as other varieties of handler? // (DTDHandler and so on) }
java
public void setXMLReader(XMLReader eventsource) { fXMLReader=eventsource; eventsource.setContentHandler(this); eventsource.setDTDHandler(this); eventsource.setErrorHandler(this); // to report fatal errors in filtering mode // Not supported by all SAX2 filters: try { eventsource. setProperty("http://xml.org/sax/properties/lexical-handler", this); } catch(SAXNotRecognizedException e) { // Nothing we can do about it } catch(SAXNotSupportedException e) { // Nothing we can do about it } // Should we also bind as other varieties of handler? // (DTDHandler and so on) }
[ "public", "void", "setXMLReader", "(", "XMLReader", "eventsource", ")", "{", "fXMLReader", "=", "eventsource", ";", "eventsource", ".", "setContentHandler", "(", "this", ")", ";", "eventsource", ".", "setDTDHandler", "(", "this", ")", ";", "eventsource", ".", ...
Bind our input streams to an XMLReader. Just a convenience routine; obviously you can explicitly register this as a listener with the same effect.
[ "Bind", "our", "input", "streams", "to", "an", "XMLReader", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java#L142-L167
34,981
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java
IncrementalSAXSource_Filter.notationDecl
public void notationDecl(String a, String b, String c) throws SAXException { if(null!=clientDTDHandler) clientDTDHandler.notationDecl(a,b,c); }
java
public void notationDecl(String a, String b, String c) throws SAXException { if(null!=clientDTDHandler) clientDTDHandler.notationDecl(a,b,c); }
[ "public", "void", "notationDecl", "(", "String", "a", ",", "String", "b", ",", "String", "c", ")", "throws", "SAXException", "{", "if", "(", "null", "!=", "clientDTDHandler", ")", "clientDTDHandler", ".", "notationDecl", "(", "a", ",", "b", ",", "c", ")"...
DTDHandler support.
[ "DTDHandler", "support", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java#L404-L408
34,982
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java
IncrementalSAXSource_Filter.co_yield
private void co_yield(boolean moreRemains) throws SAXException { // Horrendous kluge to run filter to completion. See below. if(fNoMoreEvents) return; try // Coroutine manager might throw no-such. { Object arg=Boolean.FALSE; if(moreRemains) { // Yield control, resume parsing when done arg = fCoroutineManager.co_resume(Boolean.TRUE, fSourceCoroutineID, fControllerCoroutineID); } // If we're at end of document or were told to stop early if(arg==Boolean.FALSE) { fNoMoreEvents=true; if(fXMLReader!=null) // Running under startParseThread() throw new StopException(); // We'll co_exit from there. // Yield control. We do NOT expect anyone to ever ask us again. fCoroutineManager.co_exit_to(Boolean.FALSE, fSourceCoroutineID, fControllerCoroutineID); } } catch(NoSuchMethodException e) { // Shouldn't happen unless we've miscoded our coroutine logic // "Shut down the garbage smashers on the detention level!" fNoMoreEvents=true; fCoroutineManager.co_exit(fSourceCoroutineID); throw new SAXException(e); } }
java
private void co_yield(boolean moreRemains) throws SAXException { // Horrendous kluge to run filter to completion. See below. if(fNoMoreEvents) return; try // Coroutine manager might throw no-such. { Object arg=Boolean.FALSE; if(moreRemains) { // Yield control, resume parsing when done arg = fCoroutineManager.co_resume(Boolean.TRUE, fSourceCoroutineID, fControllerCoroutineID); } // If we're at end of document or were told to stop early if(arg==Boolean.FALSE) { fNoMoreEvents=true; if(fXMLReader!=null) // Running under startParseThread() throw new StopException(); // We'll co_exit from there. // Yield control. We do NOT expect anyone to ever ask us again. fCoroutineManager.co_exit_to(Boolean.FALSE, fSourceCoroutineID, fControllerCoroutineID); } } catch(NoSuchMethodException e) { // Shouldn't happen unless we've miscoded our coroutine logic // "Shut down the garbage smashers on the detention level!" fNoMoreEvents=true; fCoroutineManager.co_exit(fSourceCoroutineID); throw new SAXException(e); } }
[ "private", "void", "co_yield", "(", "boolean", "moreRemains", ")", "throws", "SAXException", "{", "// Horrendous kluge to run filter to completion. See below.", "if", "(", "fNoMoreEvents", ")", "return", ";", "try", "// Coroutine manager might throw no-such.", "{", "Object", ...
Co_Yield handles coroutine interactions while a parse is in progress. When moreRemains==true, we are pausing after delivering events, to ask if more are needed. We will resume the controller thread with co_resume(Boolean.TRUE, ...) When control is passed back it may indicate Boolean.TRUE indication to continue delivering events Boolean.FALSE indication to discontinue events and shut down. When moreRemains==false, we shut down immediately without asking the controller's permission. Normally this means end of document has been reached. Shutting down a IncrementalSAXSource_Filter requires terminating the incoming SAX event stream. If we are in control of that stream (if it came from an XMLReader passed to our startReader() method), we can do so very quickly by throwing a reserved exception to it. If the stream is coming from another source, we can't do that because its caller may not be prepared for this "normal abnormal exit", and instead we put ourselves in a "spin" mode where events are discarded.
[ "Co_Yield", "handles", "coroutine", "interactions", "while", "a", "parse", "is", "in", "progress", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java#L550-L588
34,983
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
LSSerializerImpl.initializeSerializerProps
public void initializeSerializerProps () { // canonical-form fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CANONICAL_FORM, DOMConstants.DOM3_DEFAULT_FALSE); // cdata-sections fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_DEFAULT_TRUE); // "check-character-normalization" fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CHECK_CHAR_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); // comments fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_DEFAULT_TRUE); // datatype-normalization fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); // element-content-whitespace fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_DEFAULT_TRUE); // entities fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_TRUE); // preserve entities fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_TRUE); // error-handler // Should we set our default ErrorHandler /* * if (fDOMConfig.getParameter(Constants.DOM_ERROR_HANDLER) != null) { * fDOMErrorHandler = * (DOMErrorHandler)fDOMConfig.getParameter(Constants.DOM_ERROR_HANDLER); } */ // infoset if ((fFeatures & INFOSET) != 0) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_FALSE); // preserve entities fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); } // namespaces fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_DEFAULT_TRUE); // namespace-declarations fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_DEFAULT_TRUE); // normalize-characters /* fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NORMALIZE_CHARACTERS, DOMConstants.DOM3_DEFAULT_FALSE); */ // split-cdata-sections fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_SPLIT_CDATA, DOMConstants.DOM3_DEFAULT_TRUE); // validate fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE, DOMConstants.DOM3_DEFAULT_FALSE); // validate-if-schema fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_DEFAULT_FALSE); // well-formed fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_DEFAULT_TRUE); // pretty-print fDOMConfigProperties.setProperty( DOMConstants.S_XSL_OUTPUT_INDENT, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty( OutputPropertiesFactory.S_KEY_INDENT_AMOUNT, Integer.toString(3)); // // discard-default-content fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, DOMConstants.DOM3_DEFAULT_TRUE); // xml-declaration fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, "no"); }
java
public void initializeSerializerProps () { // canonical-form fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CANONICAL_FORM, DOMConstants.DOM3_DEFAULT_FALSE); // cdata-sections fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_DEFAULT_TRUE); // "check-character-normalization" fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CHECK_CHAR_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); // comments fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_DEFAULT_TRUE); // datatype-normalization fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); // element-content-whitespace fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_DEFAULT_TRUE); // entities fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_TRUE); // preserve entities fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_TRUE); // error-handler // Should we set our default ErrorHandler /* * if (fDOMConfig.getParameter(Constants.DOM_ERROR_HANDLER) != null) { * fDOMErrorHandler = * (DOMErrorHandler)fDOMConfig.getParameter(Constants.DOM_ERROR_HANDLER); } */ // infoset if ((fFeatures & INFOSET) != 0) { fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_COMMENTS, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_FALSE); // preserve entities fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_CDATA_SECTIONS, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_DEFAULT_FALSE); fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DATATYPE_NORMALIZATION, DOMConstants.DOM3_DEFAULT_FALSE); } // namespaces fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACES, DOMConstants.DOM3_DEFAULT_TRUE); // namespace-declarations fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NAMESPACE_DECLARATIONS, DOMConstants.DOM3_DEFAULT_TRUE); // normalize-characters /* fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_NORMALIZE_CHARACTERS, DOMConstants.DOM3_DEFAULT_FALSE); */ // split-cdata-sections fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_SPLIT_CDATA, DOMConstants.DOM3_DEFAULT_TRUE); // validate fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE, DOMConstants.DOM3_DEFAULT_FALSE); // validate-if-schema fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_VALIDATE_IF_SCHEMA, DOMConstants.DOM3_DEFAULT_FALSE); // well-formed fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_WELLFORMED, DOMConstants.DOM3_DEFAULT_TRUE); // pretty-print fDOMConfigProperties.setProperty( DOMConstants.S_XSL_OUTPUT_INDENT, DOMConstants.DOM3_DEFAULT_TRUE); fDOMConfigProperties.setProperty( OutputPropertiesFactory.S_KEY_INDENT_AMOUNT, Integer.toString(3)); // // discard-default-content fDOMConfigProperties.setProperty(DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_DISCARD_DEFAULT_CONTENT, DOMConstants.DOM3_DEFAULT_TRUE); // xml-declaration fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, "no"); }
[ "public", "void", "initializeSerializerProps", "(", ")", "{", "// canonical-form", "fDOMConfigProperties", ".", "setProperty", "(", "DOMConstants", ".", "S_DOM3_PROPERTIES_NS", "+", "DOMConstants", ".", "DOM_CANONICAL_FORM", ",", "DOMConstants", ".", "DOM3_DEFAULT_FALSE", ...
Initializes the underlying serializer's configuration depending on the default DOMConfiguration parameters. This method must be called before a node is to be serialized. @xsl.usage internal
[ "Initializes", "the", "underlying", "serializer", "s", "configuration", "depending", "on", "the", "default", "DOMConfiguration", "parameters", ".", "This", "method", "must", "be", "called", "before", "a", "node", "is", "to", "be", "serialized", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java#L253-L376
34,984
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
LSSerializerImpl.canSetParameter
public boolean canSetParameter(String name, Object value) { if (value instanceof Boolean){ if ( name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS) || name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS) || name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES) || name.equalsIgnoreCase(DOMConstants.DOM_INFOSET) || name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS) || name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA) || name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED) || name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT) || name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT) || name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)){ // both values supported return true; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) ) { // true is not supported return !((Boolean)value).booleanValue(); } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { // false is not supported return ((Boolean)value).booleanValue(); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER) && value == null || value instanceof DOMErrorHandler){ return true; } return false; }
java
public boolean canSetParameter(String name, Object value) { if (value instanceof Boolean){ if ( name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS) || name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS) || name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES) || name.equalsIgnoreCase(DOMConstants.DOM_INFOSET) || name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS) || name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA) || name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED) || name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT) || name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT) || name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)){ // both values supported return true; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) ) { // true is not supported return !((Boolean)value).booleanValue(); } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { // false is not supported return ((Boolean)value).booleanValue(); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER) && value == null || value instanceof DOMErrorHandler){ return true; } return false; }
[ "public", "boolean", "canSetParameter", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "Boolean", ")", "{", "if", "(", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_CDATA_SECTIONS", ")", "||", "na...
Checks if setting a parameter to a specific value is supported. @see org.w3c.dom.DOMConfiguration#canSetParameter(java.lang.String, java.lang.Object) @since DOM Level 3 @param name A String containing the DOMConfiguration parameter name. @param value An Object specifying the value of the corresponding parameter.
[ "Checks", "if", "setting", "a", "parameter", "to", "a", "specific", "value", "is", "supported", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java#L390-L427
34,985
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
LSSerializerImpl.writeToString
public String writeToString(Node nodeArg) throws DOMException, LSException { // return null is nodeArg is null. Should an Exception be thrown instead? if (nodeArg == null) { return null; } // Should we reset the serializer configuration before each write operation? // Obtain a reference to the serializer to use Serializer serializer = fXMLSerializer; serializer.reset(); if (nodeArg != fVisitedNode){ // Determine the XML Document version of the Node String xmlVersion = getXMLVersion(nodeArg); serializer.getOutputFormat().setProperty("version", xmlVersion); // Set the output encoding and xml version properties fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.S_XML_VERSION, xmlVersion); fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_ENCODING, "UTF-16"); // If the node to be serialized is not a Document, Element, or Entity // node // then the XML declaration, or text declaration, should be never be // serialized. if ((nodeArg.getNodeType() != Node.DOCUMENT_NODE || nodeArg.getNodeType() != Node.ELEMENT_NODE || nodeArg.getNodeType() != Node.ENTITY_NODE) && ((fFeatures & XMLDECL) != 0)) { fDOMConfigProperties.setProperty( DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, DOMConstants.DOM3_DEFAULT_FALSE); } fVisitedNode = nodeArg; } // Update the serializer properties fXMLSerializer.setOutputFormat(fDOMConfigProperties); // StringWriter to Output to StringWriter output = new StringWriter(); // try { // Set the Serializer's Writer to a StringWriter serializer.setWriter(output); // Get a reference to the serializer then lets you serilize a DOM // Use this hack till Xalan support JAXP1.3 if (fDOMSerializer == null) { fDOMSerializer = (DOM3Serializer)serializer.asDOM3Serializer(); } // Set the error handler on the DOM3Serializer interface implementation if (fDOMErrorHandler != null) { fDOMSerializer.setErrorHandler(fDOMErrorHandler); } // Set the filter on the DOM3Serializer interface implementation if (fSerializerFilter != null) { fDOMSerializer.setNodeFilter(fSerializerFilter); } // Set the NewLine character to be used fDOMSerializer.setNewLine(fEndOfLine.toCharArray()); // Serializer your DOM, where node is an org.w3c.dom.Node fDOMSerializer.serializeDOM3(nodeArg); } catch (LSException lse) { // Rethrow LSException. throw lse; } catch (RuntimeException e) { throw (LSException) createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace(); } catch (Exception e) { if (fDOMErrorHandler != null) { fDOMErrorHandler.handleError(new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, e.getMessage(), null, e)); } throw (LSException) createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace(); } // return the serialized string return output.toString(); }
java
public String writeToString(Node nodeArg) throws DOMException, LSException { // return null is nodeArg is null. Should an Exception be thrown instead? if (nodeArg == null) { return null; } // Should we reset the serializer configuration before each write operation? // Obtain a reference to the serializer to use Serializer serializer = fXMLSerializer; serializer.reset(); if (nodeArg != fVisitedNode){ // Determine the XML Document version of the Node String xmlVersion = getXMLVersion(nodeArg); serializer.getOutputFormat().setProperty("version", xmlVersion); // Set the output encoding and xml version properties fDOMConfigProperties.setProperty(DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.S_XML_VERSION, xmlVersion); fDOMConfigProperties.setProperty(DOMConstants.S_XSL_OUTPUT_ENCODING, "UTF-16"); // If the node to be serialized is not a Document, Element, or Entity // node // then the XML declaration, or text declaration, should be never be // serialized. if ((nodeArg.getNodeType() != Node.DOCUMENT_NODE || nodeArg.getNodeType() != Node.ELEMENT_NODE || nodeArg.getNodeType() != Node.ENTITY_NODE) && ((fFeatures & XMLDECL) != 0)) { fDOMConfigProperties.setProperty( DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL, DOMConstants.DOM3_DEFAULT_FALSE); } fVisitedNode = nodeArg; } // Update the serializer properties fXMLSerializer.setOutputFormat(fDOMConfigProperties); // StringWriter to Output to StringWriter output = new StringWriter(); // try { // Set the Serializer's Writer to a StringWriter serializer.setWriter(output); // Get a reference to the serializer then lets you serilize a DOM // Use this hack till Xalan support JAXP1.3 if (fDOMSerializer == null) { fDOMSerializer = (DOM3Serializer)serializer.asDOM3Serializer(); } // Set the error handler on the DOM3Serializer interface implementation if (fDOMErrorHandler != null) { fDOMSerializer.setErrorHandler(fDOMErrorHandler); } // Set the filter on the DOM3Serializer interface implementation if (fSerializerFilter != null) { fDOMSerializer.setNodeFilter(fSerializerFilter); } // Set the NewLine character to be used fDOMSerializer.setNewLine(fEndOfLine.toCharArray()); // Serializer your DOM, where node is an org.w3c.dom.Node fDOMSerializer.serializeDOM3(nodeArg); } catch (LSException lse) { // Rethrow LSException. throw lse; } catch (RuntimeException e) { throw (LSException) createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace(); } catch (Exception e) { if (fDOMErrorHandler != null) { fDOMErrorHandler.handleError(new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, e.getMessage(), null, e)); } throw (LSException) createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace(); } // return the serialized string return output.toString(); }
[ "public", "String", "writeToString", "(", "Node", "nodeArg", ")", "throws", "DOMException", ",", "LSException", "{", "// return null is nodeArg is null. Should an Exception be thrown instead?", "if", "(", "nodeArg", "==", "null", ")", "{", "return", "null", ";", "}", ...
Serializes the specified node and returns a String with the serialized data to the caller. @see org.w3c.dom.ls.LSSerializer#writeToString(org.w3c.dom.Node) @since DOM Level 3 @param nodeArg The Node to serialize. @throws org.w3c.dom.ls.LSException SERIALIZE_ERR: Raised if the LSSerializer was unable to serialize the node.
[ "Serializes", "the", "specified", "node", "and", "returns", "a", "String", "with", "the", "serialized", "data", "to", "the", "caller", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java#L1110-L1195
34,986
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
LSSerializerImpl.getXMLEncoding
protected String getXMLEncoding(Node nodeArg) { Document doc = null; // Determine the XML Encoding of the document if (nodeArg != null) { if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) { // The Document node is the Node argument doc = (Document)nodeArg; } else { // The Document node is the Node argument's ownerDocument doc = nodeArg.getOwnerDocument(); } // Determine the XML Version. if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) { return doc.getXmlEncoding(); } } // The default encoding is UTF-8 except for the writeToString method return "UTF-8"; }
java
protected String getXMLEncoding(Node nodeArg) { Document doc = null; // Determine the XML Encoding of the document if (nodeArg != null) { if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) { // The Document node is the Node argument doc = (Document)nodeArg; } else { // The Document node is the Node argument's ownerDocument doc = nodeArg.getOwnerDocument(); } // Determine the XML Version. if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) { return doc.getXmlEncoding(); } } // The default encoding is UTF-8 except for the writeToString method return "UTF-8"; }
[ "protected", "String", "getXMLEncoding", "(", "Node", "nodeArg", ")", "{", "Document", "doc", "=", "null", ";", "// Determine the XML Encoding of the document", "if", "(", "nodeArg", "!=", "null", ")", "{", "if", "(", "nodeArg", ".", "getNodeType", "(", ")", "...
Determines the XML Encoding of the Document Node to serialize. If the Document Node is not a DOM Level 3 Node, then the default encoding "UTF-8" is returned. @param nodeArg The Node to serialize @return A String containing the encoding pseudo-attribute of the XMLDecl. @throws Throwable if the DOM implementation does not implement Document.getXmlEncoding()
[ "Determines", "the", "XML", "Encoding", "of", "the", "Document", "Node", "to", "serialize", ".", "If", "the", "Document", "Node", "is", "not", "a", "DOM", "Level", "3", "Node", "then", "the", "default", "encoding", "UTF", "-", "8", "is", "returned", "." ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java#L1401-L1421
34,987
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
LSSerializerImpl.getInputEncoding
protected String getInputEncoding(Node nodeArg) { Document doc = null; // Determine the Input Encoding of the document if (nodeArg != null) { if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) { // The Document node is the Node argument doc = (Document)nodeArg; } else { // The Document node is the Node argument's ownerDocument doc = nodeArg.getOwnerDocument(); } // Determine the DOM Version. if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) { return doc.getInputEncoding(); } } // The default encoding returned is null return null; }
java
protected String getInputEncoding(Node nodeArg) { Document doc = null; // Determine the Input Encoding of the document if (nodeArg != null) { if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) { // The Document node is the Node argument doc = (Document)nodeArg; } else { // The Document node is the Node argument's ownerDocument doc = nodeArg.getOwnerDocument(); } // Determine the DOM Version. if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) { return doc.getInputEncoding(); } } // The default encoding returned is null return null; }
[ "protected", "String", "getInputEncoding", "(", "Node", "nodeArg", ")", "{", "Document", "doc", "=", "null", ";", "// Determine the Input Encoding of the document", "if", "(", "nodeArg", "!=", "null", ")", "{", "if", "(", "nodeArg", ".", "getNodeType", "(", ")",...
Determines the Input Encoding of the Document Node to serialize. If the Document Node is not a DOM Level 3 Node, then null is returned. @param nodeArg The Node to serialize @return A String containing the input encoding.
[ "Determines", "the", "Input", "Encoding", "of", "the", "Document", "Node", "to", "serialize", ".", "If", "the", "Document", "Node", "is", "not", "a", "DOM", "Level", "3", "Node", "then", "null", "is", "returned", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java#L1430-L1450
34,988
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
LSSerializerImpl.getPathWithoutEscapes
private static String getPathWithoutEscapes(String origPath) { if (origPath != null && origPath.length() != 0 && origPath.indexOf('%') != -1) { // Locate the escape characters StringTokenizer tokenizer = new StringTokenizer(origPath, "%"); StringBuffer result = new StringBuffer(origPath.length()); int size = tokenizer.countTokens(); result.append(tokenizer.nextToken()); for(int i = 1; i < size; ++i) { String token = tokenizer.nextToken(); if (token.length() >= 2 && isHexDigit(token.charAt(0)) && isHexDigit(token.charAt(1))) { // Decode the 2 digit hexadecimal number following % in '%nn' result.append((char)Integer.valueOf(token.substring(0, 2), 16).intValue()); token = token.substring(2); } result.append(token); } return result.toString(); } return origPath; }
java
private static String getPathWithoutEscapes(String origPath) { if (origPath != null && origPath.length() != 0 && origPath.indexOf('%') != -1) { // Locate the escape characters StringTokenizer tokenizer = new StringTokenizer(origPath, "%"); StringBuffer result = new StringBuffer(origPath.length()); int size = tokenizer.countTokens(); result.append(tokenizer.nextToken()); for(int i = 1; i < size; ++i) { String token = tokenizer.nextToken(); if (token.length() >= 2 && isHexDigit(token.charAt(0)) && isHexDigit(token.charAt(1))) { // Decode the 2 digit hexadecimal number following % in '%nn' result.append((char)Integer.valueOf(token.substring(0, 2), 16).intValue()); token = token.substring(2); } result.append(token); } return result.toString(); } return origPath; }
[ "private", "static", "String", "getPathWithoutEscapes", "(", "String", "origPath", ")", "{", "if", "(", "origPath", "!=", "null", "&&", "origPath", ".", "length", "(", ")", "!=", "0", "&&", "origPath", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1"...
Replaces all escape sequences in the given path with their literal characters.
[ "Replaces", "all", "escape", "sequences", "in", "the", "given", "path", "with", "their", "literal", "characters", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java#L1464-L1484
34,989
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
LSSerializerImpl.createLSException
private static LSException createLSException(short code, Throwable cause) { LSException lse = new LSException(code, cause != null ? cause.getMessage() : null); if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) { try { ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause}); } // Something went wrong. There's not much we can do about it. catch (Exception e) {} } return lse; }
java
private static LSException createLSException(short code, Throwable cause) { LSException lse = new LSException(code, cause != null ? cause.getMessage() : null); if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) { try { ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause}); } // Something went wrong. There's not much we can do about it. catch (Exception e) {} } return lse; }
[ "private", "static", "LSException", "createLSException", "(", "short", "code", ",", "Throwable", "cause", ")", "{", "LSException", "lse", "=", "new", "LSException", "(", "code", ",", "cause", "!=", "null", "?", "cause", ".", "getMessage", "(", ")", ":", "n...
Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
[ "Creates", "an", "LSException", ".", "On", "J2SE", "1", ".", "4", "and", "above", "the", "cause", "for", "the", "exception", "will", "be", "set", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java#L1498-L1508
34,990
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/NameConstraintsExtension.java
NameConstraintsExtension.calcMinMax
private void calcMinMax() throws IOException { hasMin = false; hasMax = false; if (excluded != null) { for (int i = 0; i < excluded.size(); i++) { GeneralSubtree subtree = excluded.get(i); if (subtree.getMinimum() != 0) hasMin = true; if (subtree.getMaximum() != -1) hasMax = true; } } if (permitted != null) { for (int i = 0; i < permitted.size(); i++) { GeneralSubtree subtree = permitted.get(i); if (subtree.getMinimum() != 0) hasMin = true; if (subtree.getMaximum() != -1) hasMax = true; } } minMaxValid = true; }
java
private void calcMinMax() throws IOException { hasMin = false; hasMax = false; if (excluded != null) { for (int i = 0; i < excluded.size(); i++) { GeneralSubtree subtree = excluded.get(i); if (subtree.getMinimum() != 0) hasMin = true; if (subtree.getMaximum() != -1) hasMax = true; } } if (permitted != null) { for (int i = 0; i < permitted.size(); i++) { GeneralSubtree subtree = permitted.get(i); if (subtree.getMinimum() != 0) hasMin = true; if (subtree.getMaximum() != -1) hasMax = true; } } minMaxValid = true; }
[ "private", "void", "calcMinMax", "(", ")", "throws", "IOException", "{", "hasMin", "=", "false", ";", "hasMax", "=", "false", ";", "if", "(", "excluded", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "excluded", ".", "siz...
Recalculate hasMin and hasMax flags.
[ "Recalculate", "hasMin", "and", "hasMax", "flags", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/NameConstraintsExtension.java#L89-L112
34,991
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/NameConstraintsExtension.java
NameConstraintsExtension.verify
public boolean verify(GeneralNameInterface name) throws IOException { if (name == null) { throw new IOException("name is null"); } // Verify that the name is consistent with the excluded subtrees if (excluded != null && excluded.size() > 0) { for (int i = 0; i < excluded.size(); i++) { GeneralSubtree gs = excluded.get(i); if (gs == null) continue; GeneralName gn = gs.getName(); if (gn == null) continue; GeneralNameInterface exName = gn.getName(); if (exName == null) continue; // if name matches or narrows any excluded subtree, // return false switch (exName.constrains(name)) { case GeneralNameInterface.NAME_DIFF_TYPE: case GeneralNameInterface.NAME_WIDENS: // name widens excluded case GeneralNameInterface.NAME_SAME_TYPE: break; case GeneralNameInterface.NAME_MATCH: case GeneralNameInterface.NAME_NARROWS: // subject name excluded return false; } } } // Verify that the name is consistent with the permitted subtrees if (permitted != null && permitted.size() > 0) { boolean sameType = false; for (int i = 0; i < permitted.size(); i++) { GeneralSubtree gs = permitted.get(i); if (gs == null) continue; GeneralName gn = gs.getName(); if (gn == null) continue; GeneralNameInterface perName = gn.getName(); if (perName == null) continue; // if Name matches any type in permitted, // and Name does not match or narrow some permitted subtree, // return false switch (perName.constrains(name)) { case GeneralNameInterface.NAME_DIFF_TYPE: continue; // continue checking other permitted names case GeneralNameInterface.NAME_WIDENS: // name widens permitted case GeneralNameInterface.NAME_SAME_TYPE: sameType = true; continue; // continue to look for a match or narrow case GeneralNameInterface.NAME_MATCH: case GeneralNameInterface.NAME_NARROWS: // name narrows permitted return true; // name is definitely OK, so break out of loop } } if (sameType) { return false; } } return true; }
java
public boolean verify(GeneralNameInterface name) throws IOException { if (name == null) { throw new IOException("name is null"); } // Verify that the name is consistent with the excluded subtrees if (excluded != null && excluded.size() > 0) { for (int i = 0; i < excluded.size(); i++) { GeneralSubtree gs = excluded.get(i); if (gs == null) continue; GeneralName gn = gs.getName(); if (gn == null) continue; GeneralNameInterface exName = gn.getName(); if (exName == null) continue; // if name matches or narrows any excluded subtree, // return false switch (exName.constrains(name)) { case GeneralNameInterface.NAME_DIFF_TYPE: case GeneralNameInterface.NAME_WIDENS: // name widens excluded case GeneralNameInterface.NAME_SAME_TYPE: break; case GeneralNameInterface.NAME_MATCH: case GeneralNameInterface.NAME_NARROWS: // subject name excluded return false; } } } // Verify that the name is consistent with the permitted subtrees if (permitted != null && permitted.size() > 0) { boolean sameType = false; for (int i = 0; i < permitted.size(); i++) { GeneralSubtree gs = permitted.get(i); if (gs == null) continue; GeneralName gn = gs.getName(); if (gn == null) continue; GeneralNameInterface perName = gn.getName(); if (perName == null) continue; // if Name matches any type in permitted, // and Name does not match or narrow some permitted subtree, // return false switch (perName.constrains(name)) { case GeneralNameInterface.NAME_DIFF_TYPE: continue; // continue checking other permitted names case GeneralNameInterface.NAME_WIDENS: // name widens permitted case GeneralNameInterface.NAME_SAME_TYPE: sameType = true; continue; // continue to look for a match or narrow case GeneralNameInterface.NAME_MATCH: case GeneralNameInterface.NAME_NARROWS: // name narrows permitted return true; // name is definitely OK, so break out of loop } } if (sameType) { return false; } } return true; }
[ "public", "boolean", "verify", "(", "GeneralNameInterface", "name", ")", "throws", "IOException", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"name is null\"", ")", ";", "}", "// Verify that the name is consistent with the e...
check whether a name conforms to these NameConstraints. This involves verifying that the name is consistent with the permitted and excluded subtrees variables. @param name GeneralNameInterface name to be verified @returns true if certificate verifies successfully @throws IOException on error
[ "check", "whether", "a", "name", "conforms", "to", "these", "NameConstraints", ".", "This", "involves", "verifying", "that", "the", "name", "is", "consistent", "with", "the", "permitted", "and", "excluded", "subtrees", "variables", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/NameConstraintsExtension.java#L490-L560
34,992
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/NameConstraintsExtension.java
NameConstraintsExtension.verifyRFC822SpecialCase
public boolean verifyRFC822SpecialCase(X500Name subject) throws IOException { for (AVA ava : subject.allAvas()) { ObjectIdentifier attrOID = ava.getObjectIdentifier(); if (attrOID.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID)) { String attrValue = ava.getValueString(); if (attrValue != null) { RFC822Name emailName; try { emailName = new RFC822Name(attrValue); } catch (IOException ioe) { continue; } if (!verify(emailName)) { return(false); } } } } return true; }
java
public boolean verifyRFC822SpecialCase(X500Name subject) throws IOException { for (AVA ava : subject.allAvas()) { ObjectIdentifier attrOID = ava.getObjectIdentifier(); if (attrOID.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID)) { String attrValue = ava.getValueString(); if (attrValue != null) { RFC822Name emailName; try { emailName = new RFC822Name(attrValue); } catch (IOException ioe) { continue; } if (!verify(emailName)) { return(false); } } } } return true; }
[ "public", "boolean", "verifyRFC822SpecialCase", "(", "X500Name", "subject", ")", "throws", "IOException", "{", "for", "(", "AVA", "ava", ":", "subject", ".", "allAvas", "(", ")", ")", "{", "ObjectIdentifier", "attrOID", "=", "ava", ".", "getObjectIdentifier", ...
Perform the RFC 822 special case check. We have a certificate that does not contain any subject alternative names. Check that any EMAILADDRESS attributes in its subject name conform to these NameConstraints. @param subject the certificate's subject name @returns true if certificate verifies successfully @throws IOException on error
[ "Perform", "the", "RFC", "822", "special", "case", "check", ".", "We", "have", "a", "certificate", "that", "does", "not", "contain", "any", "subject", "alternative", "names", ".", "Check", "that", "any", "EMAILADDRESS", "attributes", "in", "its", "subject", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/NameConstraintsExtension.java#L572-L591
34,993
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyRep.java
KeyRep.readResolve
protected Object readResolve() throws ObjectStreamException { try { if (type == Type.SECRET && RAW.equals(format)) { return new SecretKeySpec(encoded, algorithm); } else if (type == Type.PUBLIC && X509.equals(format)) { KeyFactory f = KeyFactory.getInstance(algorithm); return f.generatePublic(new X509EncodedKeySpec(encoded)); } else if (type == Type.PRIVATE && PKCS8.equals(format)) { KeyFactory f = KeyFactory.getInstance(algorithm); return f.generatePrivate(new PKCS8EncodedKeySpec(encoded)); } else { throw new NotSerializableException ("unrecognized type/format combination: " + type + "/" + format); } } catch (NotSerializableException nse) { throw nse; } catch (Exception e) { NotSerializableException nse = new NotSerializableException ("java.security.Key: " + "[" + type + "] " + "[" + algorithm + "] " + "[" + format + "]"); nse.initCause(e); throw nse; } }
java
protected Object readResolve() throws ObjectStreamException { try { if (type == Type.SECRET && RAW.equals(format)) { return new SecretKeySpec(encoded, algorithm); } else if (type == Type.PUBLIC && X509.equals(format)) { KeyFactory f = KeyFactory.getInstance(algorithm); return f.generatePublic(new X509EncodedKeySpec(encoded)); } else if (type == Type.PRIVATE && PKCS8.equals(format)) { KeyFactory f = KeyFactory.getInstance(algorithm); return f.generatePrivate(new PKCS8EncodedKeySpec(encoded)); } else { throw new NotSerializableException ("unrecognized type/format combination: " + type + "/" + format); } } catch (NotSerializableException nse) { throw nse; } catch (Exception e) { NotSerializableException nse = new NotSerializableException ("java.security.Key: " + "[" + type + "] " + "[" + algorithm + "] " + "[" + format + "]"); nse.initCause(e); throw nse; } }
[ "protected", "Object", "readResolve", "(", ")", "throws", "ObjectStreamException", "{", "try", "{", "if", "(", "type", "==", "Type", ".", "SECRET", "&&", "RAW", ".", "equals", "(", "format", ")", ")", "{", "return", "new", "SecretKeySpec", "(", "encoded", ...
Resolve the Key object. <p> This method supports three Type/format combinations: <ul> <li> Type.SECRET/"RAW" - returns a SecretKeySpec object constructed using encoded key bytes and algorithm <li> Type.PUBLIC/"X.509" - gets a KeyFactory instance for the key algorithm, constructs an X509EncodedKeySpec with the encoded key bytes, and generates a public key from the spec <li> Type.PRIVATE/"PKCS#8" - gets a KeyFactory instance for the key algorithm, constructs a PKCS8EncodedKeySpec with the encoded key bytes, and generates a private key from the spec </ul> <p> @return the resolved Key object @exception ObjectStreamException if the Type/format combination is unrecognized, if the algorithm, key format, or encoded key bytes are unrecognized/invalid, of if the resolution of the key fails for any reason
[ "Resolve", "the", "Key", "object", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyRep.java#L169-L195
34,994
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/InflaterInputStream.java
InflaterInputStream.skip
public long skip(long n) throws IOException { if (n < 0) { throw new IllegalArgumentException("negative skip length"); } ensureOpen(); int max = (int)Math.min(n, Integer.MAX_VALUE); int total = 0; while (total < max) { int len = max - total; if (len > b.length) { len = b.length; } len = read(b, 0, len); if (len == -1) { reachEOF = true; break; } total += len; } return total; }
java
public long skip(long n) throws IOException { if (n < 0) { throw new IllegalArgumentException("negative skip length"); } ensureOpen(); int max = (int)Math.min(n, Integer.MAX_VALUE); int total = 0; while (total < max) { int len = max - total; if (len > b.length) { len = b.length; } len = read(b, 0, len); if (len == -1) { reachEOF = true; break; } total += len; } return total; }
[ "public", "long", "skip", "(", "long", "n", ")", "throws", "IOException", "{", "if", "(", "n", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"negative skip length\"", ")", ";", "}", "ensureOpen", "(", ")", ";", "int", "max", "=",...
Skips specified number of bytes of uncompressed data. @param n the number of bytes to skip @return the actual number of bytes skipped. @exception IOException if an I/O error has occurred @exception IllegalArgumentException if {@code n < 0}
[ "Skips", "specified", "number", "of", "bytes", "of", "uncompressed", "data", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/InflaterInputStream.java#L207-L227
34,995
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/InflaterInputStream.java
InflaterInputStream.fill
protected void fill() throws IOException { ensureOpen(); len = in.read(buf, 0, buf.length); if (len == -1) { throw new EOFException("Unexpected end of ZLIB input stream"); } inf.setInput(buf, 0, len); }
java
protected void fill() throws IOException { ensureOpen(); len = in.read(buf, 0, buf.length); if (len == -1) { throw new EOFException("Unexpected end of ZLIB input stream"); } inf.setInput(buf, 0, len); }
[ "protected", "void", "fill", "(", ")", "throws", "IOException", "{", "ensureOpen", "(", ")", ";", "len", "=", "in", ".", "read", "(", "buf", ",", "0", ",", "buf", ".", "length", ")", ";", "if", "(", "len", "==", "-", "1", ")", "{", "throw", "ne...
Fills input buffer with more data to decompress. @exception IOException if an I/O error has occurred
[ "Fills", "input", "buffer", "with", "more", "data", "to", "decompress", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/InflaterInputStream.java#L248-L255
34,996
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/StreamTokenizer.java
StreamTokenizer.parseNumbers
public void parseNumbers() { for (int i = '0'; i <= '9'; i++) { tokenTypes[i] |= TOKEN_DIGIT; } tokenTypes['.'] |= TOKEN_DIGIT; tokenTypes['-'] |= TOKEN_DIGIT; }
java
public void parseNumbers() { for (int i = '0'; i <= '9'; i++) { tokenTypes[i] |= TOKEN_DIGIT; } tokenTypes['.'] |= TOKEN_DIGIT; tokenTypes['-'] |= TOKEN_DIGIT; }
[ "public", "void", "parseNumbers", "(", ")", "{", "for", "(", "int", "i", "=", "'", "'", ";", "i", "<=", "'", "'", ";", "i", "++", ")", "{", "tokenTypes", "[", "i", "]", "|=", "TOKEN_DIGIT", ";", "}", "tokenTypes", "[", "'", "'", "]", "|=", "T...
Specifies that this tokenizer shall parse numbers.
[ "Specifies", "that", "this", "tokenizer", "shall", "parse", "numbers", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/StreamTokenizer.java#L524-L530
34,997
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/ReverseAxesWalker.java
ReverseAxesWalker.getLastPos
public int getLastPos(XPathContext xctxt) { int count = 0; AxesWalker savedWalker = wi().getLastUsedWalker(); try { ReverseAxesWalker clone = (ReverseAxesWalker) this.clone(); clone.setRoot(this.getRoot()); clone.setPredicateCount(m_predicateIndex); clone.setPrevWalker(null); clone.setNextWalker(null); wi().setLastUsedWalker(clone); // Count 'em all // count = 1; int next; while (DTM.NULL != (next = clone.nextNode())) { count++; } } catch (CloneNotSupportedException cnse) { // can't happen } finally { wi().setLastUsedWalker(savedWalker); } return count; }
java
public int getLastPos(XPathContext xctxt) { int count = 0; AxesWalker savedWalker = wi().getLastUsedWalker(); try { ReverseAxesWalker clone = (ReverseAxesWalker) this.clone(); clone.setRoot(this.getRoot()); clone.setPredicateCount(m_predicateIndex); clone.setPrevWalker(null); clone.setNextWalker(null); wi().setLastUsedWalker(clone); // Count 'em all // count = 1; int next; while (DTM.NULL != (next = clone.nextNode())) { count++; } } catch (CloneNotSupportedException cnse) { // can't happen } finally { wi().setLastUsedWalker(savedWalker); } return count; }
[ "public", "int", "getLastPos", "(", "XPathContext", "xctxt", ")", "{", "int", "count", "=", "0", ";", "AxesWalker", "savedWalker", "=", "wi", "(", ")", ".", "getLastUsedWalker", "(", ")", ";", "try", "{", "ReverseAxesWalker", "clone", "=", "(", "ReverseAxe...
Get the number of nodes in this node list. The function is probably ill named? @param xctxt The XPath runtime context. @return the number of nodes in this node list.
[ "Get", "the", "number", "of", "nodes", "in", "this", "node", "list", ".", "The", "function", "is", "probably", "ill", "named?" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/ReverseAxesWalker.java#L193-L231
34,998
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/ConstraintsChecker.java
ConstraintsChecker.check
@Override public void check(Certificate cert, Collection<String> unresCritExts) throws CertPathValidatorException { X509Certificate currCert = (X509Certificate)cert; i++; // MUST run NC check second, since it depends on BC check to // update remainingCerts checkBasicConstraints(currCert); verifyNameConstraints(currCert); if (unresCritExts != null && !unresCritExts.isEmpty()) { unresCritExts.remove(BasicConstraints_Id.toString()); unresCritExts.remove(NameConstraints_Id.toString()); } }
java
@Override public void check(Certificate cert, Collection<String> unresCritExts) throws CertPathValidatorException { X509Certificate currCert = (X509Certificate)cert; i++; // MUST run NC check second, since it depends on BC check to // update remainingCerts checkBasicConstraints(currCert); verifyNameConstraints(currCert); if (unresCritExts != null && !unresCritExts.isEmpty()) { unresCritExts.remove(BasicConstraints_Id.toString()); unresCritExts.remove(NameConstraints_Id.toString()); } }
[ "@", "Override", "public", "void", "check", "(", "Certificate", "cert", ",", "Collection", "<", "String", ">", "unresCritExts", ")", "throws", "CertPathValidatorException", "{", "X509Certificate", "currCert", "=", "(", "X509Certificate", ")", "cert", ";", "i", "...
Performs the basic constraints and name constraints checks on the certificate using its internal state. @param cert the <code>Certificate</code> to be checked @param unresCritExts a <code>Collection</code> of OID strings representing the current set of unresolved critical extensions @throws CertPathValidatorException if the specified certificate does not pass the check
[ "Performs", "the", "basic", "constraints", "and", "name", "constraints", "checks", "on", "the", "certificate", "using", "its", "internal", "state", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/ConstraintsChecker.java#L113-L129
34,999
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/ConstraintsChecker.java
ConstraintsChecker.verifyNameConstraints
private void verifyNameConstraints(X509Certificate currCert) throws CertPathValidatorException { String msg = "name constraints"; if (debug != null) { debug.println("---checking " + msg + "..."); } // check name constraints only if there is a previous name constraint // and either the currCert is the final cert or the currCert is not // self-issued if (prevNC != null && ((i == certPathLength) || !X509CertImpl.isSelfIssued(currCert))) { if (debug != null) { debug.println("prevNC = " + prevNC + ", currDN = " + currCert.getSubjectX500Principal()); } try { if (!prevNC.verify(currCert)) { throw new CertPathValidatorException(msg + " check failed", null, null, -1, PKIXReason.INVALID_NAME); } } catch (IOException ioe) { throw new CertPathValidatorException(ioe); } } // merge name constraints regardless of whether cert is self-issued prevNC = mergeNameConstraints(currCert, prevNC); if (debug != null) debug.println(msg + " verified."); }
java
private void verifyNameConstraints(X509Certificate currCert) throws CertPathValidatorException { String msg = "name constraints"; if (debug != null) { debug.println("---checking " + msg + "..."); } // check name constraints only if there is a previous name constraint // and either the currCert is the final cert or the currCert is not // self-issued if (prevNC != null && ((i == certPathLength) || !X509CertImpl.isSelfIssued(currCert))) { if (debug != null) { debug.println("prevNC = " + prevNC + ", currDN = " + currCert.getSubjectX500Principal()); } try { if (!prevNC.verify(currCert)) { throw new CertPathValidatorException(msg + " check failed", null, null, -1, PKIXReason.INVALID_NAME); } } catch (IOException ioe) { throw new CertPathValidatorException(ioe); } } // merge name constraints regardless of whether cert is self-issued prevNC = mergeNameConstraints(currCert, prevNC); if (debug != null) debug.println(msg + " verified."); }
[ "private", "void", "verifyNameConstraints", "(", "X509Certificate", "currCert", ")", "throws", "CertPathValidatorException", "{", "String", "msg", "=", "\"name constraints\"", ";", "if", "(", "debug", "!=", "null", ")", "{", "debug", ".", "println", "(", "\"---che...
Internal method to check the name constraints against a cert
[ "Internal", "method", "to", "check", "the", "name", "constraints", "against", "a", "cert" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/ConstraintsChecker.java#L134-L167