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
sequence
docstring
stringlengths
3
16k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
105
339
100
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/io/LinePositionReader.java
LinePositionReader.createSequence
public static String createSequence(char c, int length) { if (length < 0) length = 1; StringBuffer buf = new StringBuffer(length); for (; length > 0; length--) { buf.append(c); } return buf.toString(); }
java
public static String createSequence(char c, int length) { if (length < 0) length = 1; StringBuffer buf = new StringBuffer(length); for (; length > 0; length--) { buf.append(c); } return buf.toString(); }
[ "public", "static", "String", "createSequence", "(", "char", "c", ",", "int", "length", ")", "{", "if", "(", "length", "<", "0", ")", "length", "=", "1", ";", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", "length", ")", ";", "for", "(", ";", "length", ">", "0", ";", "length", "--", ")", "{", "buf", ".", "append", "(", "c", ")", ";", "}", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Creates and returns a String containing a sequence of the specified length, repeating the given character.
[ "Creates", "and", "returns", "a", "String", "containing", "a", "sequence", "of", "the", "specified", "length", "repeating", "the", "given", "character", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/io/LinePositionReader.java#L118-L126
101
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/MethodInfo.java
MethodInfo.getRuntimeInvisibleAnnotations
public Annotation[] getRuntimeInvisibleAnnotations() { for (int i = mAttributes.size(); --i >= 0; ) { Attribute attr = mAttributes.get(i); if (attr instanceof RuntimeInvisibleAnnotationsAttr) { return ((AnnotationsAttr) attr).getAnnotations(); } } return new Annotation[0]; }
java
public Annotation[] getRuntimeInvisibleAnnotations() { for (int i = mAttributes.size(); --i >= 0; ) { Attribute attr = mAttributes.get(i); if (attr instanceof RuntimeInvisibleAnnotationsAttr) { return ((AnnotationsAttr) attr).getAnnotations(); } } return new Annotation[0]; }
[ "public", "Annotation", "[", "]", "getRuntimeInvisibleAnnotations", "(", ")", "{", "for", "(", "int", "i", "=", "mAttributes", ".", "size", "(", ")", ";", "--", "i", ">=", "0", ";", ")", "{", "Attribute", "attr", "=", "mAttributes", ".", "get", "(", "i", ")", ";", "if", "(", "attr", "instanceof", "RuntimeInvisibleAnnotationsAttr", ")", "{", "return", "(", "(", "AnnotationsAttr", ")", "attr", ")", ".", "getAnnotations", "(", ")", ";", "}", "}", "return", "new", "Annotation", "[", "0", "]", ";", "}" ]
Returns all the runtime invisible annotations defined for this class file, or an empty array if none.
[ "Returns", "all", "the", "runtime", "invisible", "annotations", "defined", "for", "this", "class", "file", "or", "an", "empty", "array", "if", "none", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/MethodInfo.java#L248-L256
102
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/MethodInfo.java
MethodInfo.getRuntimeVisibleAnnotations
public Annotation[] getRuntimeVisibleAnnotations() { for (int i = mAttributes.size(); --i >= 0; ) { Attribute attr = mAttributes.get(i); if (attr instanceof RuntimeVisibleAnnotationsAttr) { return ((AnnotationsAttr) attr).getAnnotations(); } } return new Annotation[0]; }
java
public Annotation[] getRuntimeVisibleAnnotations() { for (int i = mAttributes.size(); --i >= 0; ) { Attribute attr = mAttributes.get(i); if (attr instanceof RuntimeVisibleAnnotationsAttr) { return ((AnnotationsAttr) attr).getAnnotations(); } } return new Annotation[0]; }
[ "public", "Annotation", "[", "]", "getRuntimeVisibleAnnotations", "(", ")", "{", "for", "(", "int", "i", "=", "mAttributes", ".", "size", "(", ")", ";", "--", "i", ">=", "0", ";", ")", "{", "Attribute", "attr", "=", "mAttributes", ".", "get", "(", "i", ")", ";", "if", "(", "attr", "instanceof", "RuntimeVisibleAnnotationsAttr", ")", "{", "return", "(", "(", "AnnotationsAttr", ")", "attr", ")", ".", "getAnnotations", "(", ")", ";", "}", "}", "return", "new", "Annotation", "[", "0", "]", ";", "}" ]
Returns all the runtime visible annotations defined for this class file, or an empty array if none.
[ "Returns", "all", "the", "runtime", "visible", "annotations", "defined", "for", "this", "class", "file", "or", "an", "empty", "array", "if", "none", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/MethodInfo.java#L262-L270
103
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/MethodInfo.java
MethodInfo.addRuntimeInvisibleAnnotation
public Annotation addRuntimeInvisibleAnnotation(TypeDesc type) { AnnotationsAttr attr = null; for (int i = mAttributes.size(); --i >= 0; ) { Attribute a = mAttributes.get(i); if (a instanceof RuntimeInvisibleAnnotationsAttr) { attr = (AnnotationsAttr) a; } } if (attr == null) { attr = new RuntimeInvisibleAnnotationsAttr(mCp); addAttribute(attr); } Annotation ann = new Annotation(mCp); ann.setType(type); attr.addAnnotation(ann); return ann; }
java
public Annotation addRuntimeInvisibleAnnotation(TypeDesc type) { AnnotationsAttr attr = null; for (int i = mAttributes.size(); --i >= 0; ) { Attribute a = mAttributes.get(i); if (a instanceof RuntimeInvisibleAnnotationsAttr) { attr = (AnnotationsAttr) a; } } if (attr == null) { attr = new RuntimeInvisibleAnnotationsAttr(mCp); addAttribute(attr); } Annotation ann = new Annotation(mCp); ann.setType(type); attr.addAnnotation(ann); return ann; }
[ "public", "Annotation", "addRuntimeInvisibleAnnotation", "(", "TypeDesc", "type", ")", "{", "AnnotationsAttr", "attr", "=", "null", ";", "for", "(", "int", "i", "=", "mAttributes", ".", "size", "(", ")", ";", "--", "i", ">=", "0", ";", ")", "{", "Attribute", "a", "=", "mAttributes", ".", "get", "(", "i", ")", ";", "if", "(", "a", "instanceof", "RuntimeInvisibleAnnotationsAttr", ")", "{", "attr", "=", "(", "AnnotationsAttr", ")", "a", ";", "}", "}", "if", "(", "attr", "==", "null", ")", "{", "attr", "=", "new", "RuntimeInvisibleAnnotationsAttr", "(", "mCp", ")", ";", "addAttribute", "(", "attr", ")", ";", "}", "Annotation", "ann", "=", "new", "Annotation", "(", "mCp", ")", ";", "ann", ".", "setType", "(", "type", ")", ";", "attr", ".", "addAnnotation", "(", "ann", ")", ";", "return", "ann", ";", "}" ]
Add a runtime invisible annotation.
[ "Add", "a", "runtime", "invisible", "annotation", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/MethodInfo.java#L275-L291
104
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Syslog.java
Syslog.install
public static void install() { synchronized (log()) { if (!cInstalled) { cInstalled = true; cOriginalOut = System.out; cOriginalErr = System.err; cSystemOut = new LogEventParsingOutputStream (log(), LogEvent.INFO_TYPE) { public boolean isEnabled() { return log().isInfoEnabled(); } }; cSystemOut.addLogListener(log()); System.setOut(new PrintStream(cSystemOut, true)); cSystemErr = new LogEventParsingOutputStream (log(), LogEvent.ERROR_TYPE) { public boolean isEnabled() { return log().isErrorEnabled(); } }; cSystemErr.addLogListener(log()); System.setErr(new PrintStream(cSystemErr, true)); } } }
java
public static void install() { synchronized (log()) { if (!cInstalled) { cInstalled = true; cOriginalOut = System.out; cOriginalErr = System.err; cSystemOut = new LogEventParsingOutputStream (log(), LogEvent.INFO_TYPE) { public boolean isEnabled() { return log().isInfoEnabled(); } }; cSystemOut.addLogListener(log()); System.setOut(new PrintStream(cSystemOut, true)); cSystemErr = new LogEventParsingOutputStream (log(), LogEvent.ERROR_TYPE) { public boolean isEnabled() { return log().isErrorEnabled(); } }; cSystemErr.addLogListener(log()); System.setErr(new PrintStream(cSystemErr, true)); } } }
[ "public", "static", "void", "install", "(", ")", "{", "synchronized", "(", "log", "(", ")", ")", "{", "if", "(", "!", "cInstalled", ")", "{", "cInstalled", "=", "true", ";", "cOriginalOut", "=", "System", ".", "out", ";", "cOriginalErr", "=", "System", ".", "err", ";", "cSystemOut", "=", "new", "LogEventParsingOutputStream", "(", "log", "(", ")", ",", "LogEvent", ".", "INFO_TYPE", ")", "{", "public", "boolean", "isEnabled", "(", ")", "{", "return", "log", "(", ")", ".", "isInfoEnabled", "(", ")", ";", "}", "}", ";", "cSystemOut", ".", "addLogListener", "(", "log", "(", ")", ")", ";", "System", ".", "setOut", "(", "new", "PrintStream", "(", "cSystemOut", ",", "true", ")", ")", ";", "cSystemErr", "=", "new", "LogEventParsingOutputStream", "(", "log", "(", ")", ",", "LogEvent", ".", "ERROR_TYPE", ")", "{", "public", "boolean", "isEnabled", "(", ")", "{", "return", "log", "(", ")", ".", "isErrorEnabled", "(", ")", ";", "}", "}", ";", "cSystemErr", ".", "addLogListener", "(", "log", "(", ")", ")", ";", "System", ".", "setErr", "(", "new", "PrintStream", "(", "cSystemErr", ",", "true", ")", ")", ";", "}", "}", "}" ]
When installed, System.out and System.err are redirected to Syslog.log. System.out produces info events, and System.err produces error events.
[ "When", "installed", "System", ".", "out", "and", "System", ".", "err", "are", "redirected", "to", "Syslog", ".", "log", ".", "System", ".", "out", "produces", "info", "events", "and", "System", ".", "err", "produces", "error", "events", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Syslog.java#L107-L135
105
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Syslog.java
Syslog.uninstall
public static void uninstall() { synchronized (log()) { if (cInstalled) { cInstalled = false; System.setOut(cOriginalOut); System.setErr(cOriginalErr); cOriginalOut = null; cOriginalErr = null; cSystemOut = null; cSystemErr = null; } } }
java
public static void uninstall() { synchronized (log()) { if (cInstalled) { cInstalled = false; System.setOut(cOriginalOut); System.setErr(cOriginalErr); cOriginalOut = null; cOriginalErr = null; cSystemOut = null; cSystemErr = null; } } }
[ "public", "static", "void", "uninstall", "(", ")", "{", "synchronized", "(", "log", "(", ")", ")", "{", "if", "(", "cInstalled", ")", "{", "cInstalled", "=", "false", ";", "System", ".", "setOut", "(", "cOriginalOut", ")", ";", "System", ".", "setErr", "(", "cOriginalErr", ")", ";", "cOriginalOut", "=", "null", ";", "cOriginalErr", "=", "null", ";", "cSystemOut", "=", "null", ";", "cSystemErr", "=", "null", ";", "}", "}", "}" ]
Uninstalls by restoring System.out and System.err.
[ "Uninstalls", "by", "restoring", "System", ".", "out", "and", "System", ".", "err", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Syslog.java#L140-L152
106
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/io/SourceReader.java
SourceReader.read
public int read() throws IOException { int c; if (mFirst != 0) { c = mFirst; mFirst = 0; } else { c = super.read(); } if (c == '\n') { mLine++; } else if (c == ENTER_CODE) { mUnicodeReader.setEscapesEnabled(true); } else if (c == ENTER_TEXT) { mUnicodeReader.setEscapesEnabled(false); } return c; }
java
public int read() throws IOException { int c; if (mFirst != 0) { c = mFirst; mFirst = 0; } else { c = super.read(); } if (c == '\n') { mLine++; } else if (c == ENTER_CODE) { mUnicodeReader.setEscapesEnabled(true); } else if (c == ENTER_TEXT) { mUnicodeReader.setEscapesEnabled(false); } return c; }
[ "public", "int", "read", "(", ")", "throws", "IOException", "{", "int", "c", ";", "if", "(", "mFirst", "!=", "0", ")", "{", "c", "=", "mFirst", ";", "mFirst", "=", "0", ";", "}", "else", "{", "c", "=", "super", ".", "read", "(", ")", ";", "}", "if", "(", "c", "==", "'", "'", ")", "{", "mLine", "++", ";", "}", "else", "if", "(", "c", "==", "ENTER_CODE", ")", "{", "mUnicodeReader", ".", "setEscapesEnabled", "(", "true", ")", ";", "}", "else", "if", "(", "c", "==", "ENTER_TEXT", ")", "{", "mUnicodeReader", ".", "setEscapesEnabled", "(", "false", ")", ";", "}", "return", "c", ";", "}" ]
All newline character patterns are are converted to \n.
[ "All", "newline", "character", "patterns", "are", "are", "converted", "to", "\\", "n", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/io/SourceReader.java#L120-L142
107
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/net/LazySocketFactory.java
LazySocketFactory.getSocket
public CheckedSocket getSocket(Object session) throws ConnectException, SocketException { return CheckedSocket.check(new LazySocket(mFactory, session)); }
java
public CheckedSocket getSocket(Object session) throws ConnectException, SocketException { return CheckedSocket.check(new LazySocket(mFactory, session)); }
[ "public", "CheckedSocket", "getSocket", "(", "Object", "session", ")", "throws", "ConnectException", ",", "SocketException", "{", "return", "CheckedSocket", ".", "check", "(", "new", "LazySocket", "(", "mFactory", ",", "session", ")", ")", ";", "}" ]
Returns a socket that will lazily connect.
[ "Returns", "a", "socket", "that", "will", "lazily", "connect", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/LazySocketFactory.java#L87-L91
108
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/SortedArrayList.java
SortedArrayList.add
public boolean add(Object o) { // find the index where this item should go // add the item @ the specified index int idx = 0; if(!isEmpty()) { idx = findInsertionPoint(o); } try { super.add(idx, o); } catch(IndexOutOfBoundsException e) { return false; } return true; }
java
public boolean add(Object o) { // find the index where this item should go // add the item @ the specified index int idx = 0; if(!isEmpty()) { idx = findInsertionPoint(o); } try { super.add(idx, o); } catch(IndexOutOfBoundsException e) { return false; } return true; }
[ "public", "boolean", "add", "(", "Object", "o", ")", "{", "// find the index where this item should go", "// add the item @ the specified index", "int", "idx", "=", "0", ";", "if", "(", "!", "isEmpty", "(", ")", ")", "{", "idx", "=", "findInsertionPoint", "(", "o", ")", ";", "}", "try", "{", "super", ".", "add", "(", "idx", ",", "o", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Adds an Object to this Collection. @param o The Object to be added. @return true if this Collection is modified as a result of this call.
[ "Adds", "an", "Object", "to", "this", "Collection", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/SortedArrayList.java#L69-L84
109
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/SortedArrayList.java
SortedArrayList.compare
private int compare(Object k1, Object k2) { return (mComparator==null ? ((Comparable)k1).compareTo(k2) : mComparator.compare(k1, k2)); }
java
private int compare(Object k1, Object k2) { return (mComparator==null ? ((Comparable)k1).compareTo(k2) : mComparator.compare(k1, k2)); }
[ "private", "int", "compare", "(", "Object", "k1", ",", "Object", "k2", ")", "{", "return", "(", "mComparator", "==", "null", "?", "(", "(", "Comparable", ")", "k1", ")", ".", "compareTo", "(", "k2", ")", ":", "mComparator", ".", "compare", "(", "k1", ",", "k2", ")", ")", ";", "}" ]
Compares two keys using the correct comparison method for this Collection. @param k1 The first item to be compared. @param k2 The second item to be compared. @return a positive or negative integer if they differ, and zero if equal.
[ "Compares", "two", "keys", "using", "the", "correct", "comparison", "method", "for", "this", "Collection", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/SortedArrayList.java#L163-L166
110
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/SortedArrayList.java
SortedArrayList.findInsertionPoint
private int findInsertionPoint(Object o, int startIndex, int endIndex) { int halfPt = ((endIndex - startIndex)/2) + startIndex; int delta = compare(get(halfPt), o); if(delta < 0) { endIndex = halfPt; } else if(delta > 0) { startIndex = halfPt; } else { // System.out.println("halfPt: " + halfPt); return halfPt; } // the object in question falls between two elements if((endIndex - startIndex) <= 1) { // System.out.println("endIndex: " + endIndex); return endIndex+1; } return findInsertionPoint(o, startIndex, endIndex); }
java
private int findInsertionPoint(Object o, int startIndex, int endIndex) { int halfPt = ((endIndex - startIndex)/2) + startIndex; int delta = compare(get(halfPt), o); if(delta < 0) { endIndex = halfPt; } else if(delta > 0) { startIndex = halfPt; } else { // System.out.println("halfPt: " + halfPt); return halfPt; } // the object in question falls between two elements if((endIndex - startIndex) <= 1) { // System.out.println("endIndex: " + endIndex); return endIndex+1; } return findInsertionPoint(o, startIndex, endIndex); }
[ "private", "int", "findInsertionPoint", "(", "Object", "o", ",", "int", "startIndex", ",", "int", "endIndex", ")", "{", "int", "halfPt", "=", "(", "(", "endIndex", "-", "startIndex", ")", "/", "2", ")", "+", "startIndex", ";", "int", "delta", "=", "compare", "(", "get", "(", "halfPt", ")", ",", "o", ")", ";", "if", "(", "delta", "<", "0", ")", "{", "endIndex", "=", "halfPt", ";", "}", "else", "if", "(", "delta", ">", "0", ")", "{", "startIndex", "=", "halfPt", ";", "}", "else", "{", "// System.out.println(\"halfPt: \" + halfPt);", "return", "halfPt", ";", "}", "// the object in question falls between two elements", "if", "(", "(", "endIndex", "-", "startIndex", ")", "<=", "1", ")", "{", "// System.out.println(\"endIndex: \" + endIndex);", "return", "endIndex", "+", "1", ";", "}", "return", "findInsertionPoint", "(", "o", ",", "startIndex", ",", "endIndex", ")", ";", "}" ]
Conducts a binary search to find the index where Object o should be inserted. @param o The Object that is to be inserted. @param startIndex The starting point for the search. @param endIndex The end boundary for this search. @return The index where Object o should be inserted.
[ "Conducts", "a", "binary", "search", "to", "find", "the", "index", "where", "Object", "o", "should", "be", "inserted", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/SortedArrayList.java#L176-L199
111
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ConstantUTFInfo.java
ConstantUTFInfo.make
static ConstantUTFInfo make(ConstantPool cp, String str) { ConstantInfo ci = new ConstantUTFInfo(str); return (ConstantUTFInfo)cp.addConstant(ci); }
java
static ConstantUTFInfo make(ConstantPool cp, String str) { ConstantInfo ci = new ConstantUTFInfo(str); return (ConstantUTFInfo)cp.addConstant(ci); }
[ "static", "ConstantUTFInfo", "make", "(", "ConstantPool", "cp", ",", "String", "str", ")", "{", "ConstantInfo", "ci", "=", "new", "ConstantUTFInfo", "(", "str", ")", ";", "return", "(", "ConstantUTFInfo", ")", "cp", ".", "addConstant", "(", "ci", ")", ";", "}" ]
Will return either a new ConstantUTFInfo object or one already in the constant pool. If it is a new ConstantUTFInfo, it will be inserted into the pool.
[ "Will", "return", "either", "a", "new", "ConstantUTFInfo", "object", "or", "one", "already", "in", "the", "constant", "pool", ".", "If", "it", "is", "a", "new", "ConstantUTFInfo", "it", "will", "be", "inserted", "into", "the", "pool", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ConstantUTFInfo.java#L35-L38
112
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/FilteredMap.java
FilteredMap.entrySet
public Set<Map.Entry<K, V>> entrySet() { HashSet s = new HashSet(mBackingMap.size()); for (Map.Entry e : mBackingMap.entrySet()) { if (mFilter.accept(e)) s.add(e); } return s; }
java
public Set<Map.Entry<K, V>> entrySet() { HashSet s = new HashSet(mBackingMap.size()); for (Map.Entry e : mBackingMap.entrySet()) { if (mFilter.accept(e)) s.add(e); } return s; }
[ "public", "Set", "<", "Map", ".", "Entry", "<", "K", ",", "V", ">", ">", "entrySet", "(", ")", "{", "HashSet", "s", "=", "new", "HashSet", "(", "mBackingMap", ".", "size", "(", ")", ")", ";", "for", "(", "Map", ".", "Entry", "e", ":", "mBackingMap", ".", "entrySet", "(", ")", ")", "{", "if", "(", "mFilter", ".", "accept", "(", "e", ")", ")", "s", ".", "add", "(", "e", ")", ";", "}", "return", "s", ";", "}" ]
Return a filtered set of entries. @see Map.entryset
[ "Return", "a", "filtered", "set", "of", "entries", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/FilteredMap.java#L76-L83
113
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/apps/JMXConsoleApplication.java
JMXConsoleApplication.getAdminLinks
public AppAdminLinks getAdminLinks() { AppAdminLinks links = new AppAdminLinks(mLog.getName()); links.addAdminLink("JMX Console", "system.teaservlet.JMXConsole"); return links; }
java
public AppAdminLinks getAdminLinks() { AppAdminLinks links = new AppAdminLinks(mLog.getName()); links.addAdminLink("JMX Console", "system.teaservlet.JMXConsole"); return links; }
[ "public", "AppAdminLinks", "getAdminLinks", "(", ")", "{", "AppAdminLinks", "links", "=", "new", "AppAdminLinks", "(", "mLog", ".", "getName", "(", ")", ")", ";", "links", ".", "addAdminLink", "(", "\"JMX Console\"", ",", "\"system.teaservlet.JMXConsole\"", ")", ";", "return", "links", ";", "}" ]
Retrieves the administrative links for this application. @return The list of administration links
[ "Retrieves", "the", "administrative", "links", "for", "this", "application", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/apps/JMXConsoleApplication.java#L82-L86
114
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teaservlet/stats/Histogram.java
Histogram.getRangeForBin
public double[] getRangeForBin(int binIndex) { if (binIndex >=0 && binIndex < ranges.length) return new double[] { ranges[binIndex], ranges[binIndex + 1] }; return null; }
java
public double[] getRangeForBin(int binIndex) { if (binIndex >=0 && binIndex < ranges.length) return new double[] { ranges[binIndex], ranges[binIndex + 1] }; return null; }
[ "public", "double", "[", "]", "getRangeForBin", "(", "int", "binIndex", ")", "{", "if", "(", "binIndex", ">=", "0", "&&", "binIndex", "<", "ranges", ".", "length", ")", "return", "new", "double", "[", "]", "{", "ranges", "[", "binIndex", "]", ",", "ranges", "[", "binIndex", "+", "1", "]", "}", ";", "return", "null", ";", "}" ]
Returns the range for the bin at the specified index. @param binIndex the index of the bin. @return a double array of length 2 where [0] is the lower bound for the range and [1] is the upper bound for the range.
[ "Returns", "the", "range", "for", "the", "bin", "at", "the", "specified", "index", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teaservlet/stats/Histogram.java#L308-L312
115
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teaservlet/stats/Histogram.java
Histogram.find
public int find(double x) { if (x < xMinRangeLimit) return Integer.MIN_VALUE; else if (x >= xMaxRangeLimit) return Integer.MAX_VALUE; return findSmaller(ranges, x); }
java
public int find(double x) { if (x < xMinRangeLimit) return Integer.MIN_VALUE; else if (x >= xMaxRangeLimit) return Integer.MAX_VALUE; return findSmaller(ranges, x); }
[ "public", "int", "find", "(", "double", "x", ")", "{", "if", "(", "x", "<", "xMinRangeLimit", ")", "return", "Integer", ".", "MIN_VALUE", ";", "else", "if", "(", "x", ">=", "xMaxRangeLimit", ")", "return", "Integer", ".", "MAX_VALUE", ";", "return", "findSmaller", "(", "ranges", ",", "x", ")", ";", "}" ]
Returns the index of the bin containing the specified coordinate. @param x the coordinate data value @return the index of the bin containing the coordinate value.
[ "Returns", "the", "index", "of", "the", "bin", "containing", "the", "specified", "coordinate", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teaservlet/stats/Histogram.java#L320-L324
116
teatrove/teatrove
build-tools/teatools/src/main/java/org/teatrove/teatools/PackageDescriptor.java
PackageDescriptor.initFromPackageInfo
private static void initFromPackageInfo(PackageDescriptor pd, Class<?> packageInfoClass) throws Exception { pd.setExists(true); Class<?>[] ca = new Class[0]; Object[] oa = new Object[0]; pd.setSpecificationTitle( (String) (packageInfoClass.getMethod("getSpecificationTitle", ca)).invoke(null, oa)); pd.setSpecificationVersion( (String) (packageInfoClass.getMethod("getSpecificationVersion", ca)).invoke(null, oa)); pd.setSpecificationVendor( (String) (packageInfoClass.getMethod("getSpecificationVendor", ca)).invoke(null, oa)); pd.setImplementationTitle( (String) (packageInfoClass.getMethod("getImplementationTitle", ca)).invoke(null, oa)); pd.setImplementationVersion( (String) (packageInfoClass.getMethod("getImplementationVersion", ca)).invoke(null, oa)); pd.setImplementationVendor( (String) (packageInfoClass.getMethod("getImplementationVendor", ca)).invoke(null, oa)); pd.setBaseDirectory( (String) (packageInfoClass.getMethod("getBaseDirectory", ca)).invoke(null, oa)); pd.setRepository( (String) (packageInfoClass.getMethod("getRepository", ca)).invoke(null, oa)); pd.setUsername( (String) (packageInfoClass.getMethod("getUsername", ca)).invoke(null, oa)); pd.setBuildMachine( (String) (packageInfoClass.getMethod("getBuildMachine", ca)).invoke(null, oa)); pd.setGroup( (String) (packageInfoClass.getMethod("getGroup", ca)).invoke(null, oa)); pd.setProject( (String) (packageInfoClass.getMethod("getProject", ca)).invoke(null, oa)); pd.setBuildLocation( (String) (packageInfoClass.getMethod("getBuildLocation", ca)).invoke(null, oa)); pd.setProduct( (String) (packageInfoClass.getMethod("getProduct", ca)).invoke(null, oa)); pd.setProductVersion( (String) (packageInfoClass.getMethod("getProductVersion", ca)).invoke(null, oa)); pd.setBuildNumber( (String) (packageInfoClass.getMethod("getBuildNumber", ca)).invoke(null, oa)); pd.setBuildDate( (Date) (packageInfoClass.getMethod("getBuildDate", ca)).invoke(null, oa)); }
java
private static void initFromPackageInfo(PackageDescriptor pd, Class<?> packageInfoClass) throws Exception { pd.setExists(true); Class<?>[] ca = new Class[0]; Object[] oa = new Object[0]; pd.setSpecificationTitle( (String) (packageInfoClass.getMethod("getSpecificationTitle", ca)).invoke(null, oa)); pd.setSpecificationVersion( (String) (packageInfoClass.getMethod("getSpecificationVersion", ca)).invoke(null, oa)); pd.setSpecificationVendor( (String) (packageInfoClass.getMethod("getSpecificationVendor", ca)).invoke(null, oa)); pd.setImplementationTitle( (String) (packageInfoClass.getMethod("getImplementationTitle", ca)).invoke(null, oa)); pd.setImplementationVersion( (String) (packageInfoClass.getMethod("getImplementationVersion", ca)).invoke(null, oa)); pd.setImplementationVendor( (String) (packageInfoClass.getMethod("getImplementationVendor", ca)).invoke(null, oa)); pd.setBaseDirectory( (String) (packageInfoClass.getMethod("getBaseDirectory", ca)).invoke(null, oa)); pd.setRepository( (String) (packageInfoClass.getMethod("getRepository", ca)).invoke(null, oa)); pd.setUsername( (String) (packageInfoClass.getMethod("getUsername", ca)).invoke(null, oa)); pd.setBuildMachine( (String) (packageInfoClass.getMethod("getBuildMachine", ca)).invoke(null, oa)); pd.setGroup( (String) (packageInfoClass.getMethod("getGroup", ca)).invoke(null, oa)); pd.setProject( (String) (packageInfoClass.getMethod("getProject", ca)).invoke(null, oa)); pd.setBuildLocation( (String) (packageInfoClass.getMethod("getBuildLocation", ca)).invoke(null, oa)); pd.setProduct( (String) (packageInfoClass.getMethod("getProduct", ca)).invoke(null, oa)); pd.setProductVersion( (String) (packageInfoClass.getMethod("getProductVersion", ca)).invoke(null, oa)); pd.setBuildNumber( (String) (packageInfoClass.getMethod("getBuildNumber", ca)).invoke(null, oa)); pd.setBuildDate( (Date) (packageInfoClass.getMethod("getBuildDate", ca)).invoke(null, oa)); }
[ "private", "static", "void", "initFromPackageInfo", "(", "PackageDescriptor", "pd", ",", "Class", "<", "?", ">", "packageInfoClass", ")", "throws", "Exception", "{", "pd", ".", "setExists", "(", "true", ")", ";", "Class", "<", "?", ">", "[", "]", "ca", "=", "new", "Class", "[", "0", "]", ";", "Object", "[", "]", "oa", "=", "new", "Object", "[", "0", "]", ";", "pd", ".", "setSpecificationTitle", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getSpecificationTitle\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setSpecificationVersion", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getSpecificationVersion\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setSpecificationVendor", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getSpecificationVendor\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setImplementationTitle", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getImplementationTitle\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setImplementationVersion", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getImplementationVersion\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setImplementationVendor", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getImplementationVendor\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setBaseDirectory", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getBaseDirectory\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setRepository", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getRepository\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setUsername", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getUsername\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setBuildMachine", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getBuildMachine\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setGroup", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getGroup\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setProject", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getProject\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setBuildLocation", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getBuildLocation\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setProduct", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getProduct\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setProductVersion", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getProductVersion\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setBuildNumber", "(", "(", "String", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getBuildNumber\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "pd", ".", "setBuildDate", "(", "(", "Date", ")", "(", "packageInfoClass", ".", "getMethod", "(", "\"getBuildDate\"", ",", "ca", ")", ")", ".", "invoke", "(", "null", ",", "oa", ")", ")", ";", "}" ]
Initialize the PackageDescriptor from the PackageInfo class
[ "Initialize", "the", "PackageDescriptor", "from", "the", "PackageInfo", "class" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/teatools/src/main/java/org/teatrove/teatools/PackageDescriptor.java#L107-L186
117
teatrove/teatrove
build-tools/teatools/src/main/java/org/teatrove/teatools/PackageDescriptor.java
PackageDescriptor.initFromPackage
private static void initFromPackage(PackageDescriptor pd, Package pkg) { pd.setExists(true); String specificationTitle = pkg.getSpecificationTitle(); String specificationVersion = pkg.getSpecificationVersion(); String specificationVendor = pkg.getSpecificationVendor(); String implementationTitle = pkg.getImplementationTitle(); String implementationVersion = pkg.getImplementationVersion(); String implementationVendor = pkg.getImplementationVendor(); if (implementationTitle == null) { implementationTitle = specificationTitle; } if (implementationVersion == null) { implementationVersion = specificationVersion; } if (implementationVendor == null) { implementationVendor = specificationVendor; } pd.setSpecificationTitle(specificationTitle); pd.setSpecificationVersion(specificationVersion); pd.setSpecificationVendor(specificationVendor); pd.setImplementationTitle(implementationTitle); pd.setImplementationVersion(implementationVersion); pd.setImplementationVendor(implementationVendor); pd.setProduct(implementationTitle); pd.setProductVersion(implementationVersion); }
java
private static void initFromPackage(PackageDescriptor pd, Package pkg) { pd.setExists(true); String specificationTitle = pkg.getSpecificationTitle(); String specificationVersion = pkg.getSpecificationVersion(); String specificationVendor = pkg.getSpecificationVendor(); String implementationTitle = pkg.getImplementationTitle(); String implementationVersion = pkg.getImplementationVersion(); String implementationVendor = pkg.getImplementationVendor(); if (implementationTitle == null) { implementationTitle = specificationTitle; } if (implementationVersion == null) { implementationVersion = specificationVersion; } if (implementationVendor == null) { implementationVendor = specificationVendor; } pd.setSpecificationTitle(specificationTitle); pd.setSpecificationVersion(specificationVersion); pd.setSpecificationVendor(specificationVendor); pd.setImplementationTitle(implementationTitle); pd.setImplementationVersion(implementationVersion); pd.setImplementationVendor(implementationVendor); pd.setProduct(implementationTitle); pd.setProductVersion(implementationVersion); }
[ "private", "static", "void", "initFromPackage", "(", "PackageDescriptor", "pd", ",", "Package", "pkg", ")", "{", "pd", ".", "setExists", "(", "true", ")", ";", "String", "specificationTitle", "=", "pkg", ".", "getSpecificationTitle", "(", ")", ";", "String", "specificationVersion", "=", "pkg", ".", "getSpecificationVersion", "(", ")", ";", "String", "specificationVendor", "=", "pkg", ".", "getSpecificationVendor", "(", ")", ";", "String", "implementationTitle", "=", "pkg", ".", "getImplementationTitle", "(", ")", ";", "String", "implementationVersion", "=", "pkg", ".", "getImplementationVersion", "(", ")", ";", "String", "implementationVendor", "=", "pkg", ".", "getImplementationVendor", "(", ")", ";", "if", "(", "implementationTitle", "==", "null", ")", "{", "implementationTitle", "=", "specificationTitle", ";", "}", "if", "(", "implementationVersion", "==", "null", ")", "{", "implementationVersion", "=", "specificationVersion", ";", "}", "if", "(", "implementationVendor", "==", "null", ")", "{", "implementationVendor", "=", "specificationVendor", ";", "}", "pd", ".", "setSpecificationTitle", "(", "specificationTitle", ")", ";", "pd", ".", "setSpecificationVersion", "(", "specificationVersion", ")", ";", "pd", ".", "setSpecificationVendor", "(", "specificationVendor", ")", ";", "pd", ".", "setImplementationTitle", "(", "implementationTitle", ")", ";", "pd", ".", "setImplementationVersion", "(", "implementationVersion", ")", ";", "pd", ".", "setImplementationVendor", "(", "implementationVendor", ")", ";", "pd", ".", "setProduct", "(", "implementationTitle", ")", ";", "pd", ".", "setProductVersion", "(", "implementationVersion", ")", ";", "}" ]
Initialize the PackageDescriptor from the Package
[ "Initialize", "the", "PackageDescriptor", "from", "the", "Package" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/teatools/src/main/java/org/teatrove/teatools/PackageDescriptor.java#L189-L225
118
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/Attribute.java
Attribute.writeTo
public final void writeTo(DataOutput dout) throws IOException { dout.writeShort(mNameConstant.getIndex()); dout.writeInt(getLength()); writeDataTo(dout); }
java
public final void writeTo(DataOutput dout) throws IOException { dout.writeShort(mNameConstant.getIndex()); dout.writeInt(getLength()); writeDataTo(dout); }
[ "public", "final", "void", "writeTo", "(", "DataOutput", "dout", ")", "throws", "IOException", "{", "dout", ".", "writeShort", "(", "mNameConstant", ".", "getIndex", "(", ")", ")", ";", "dout", ".", "writeInt", "(", "getLength", "(", ")", ")", ";", "writeDataTo", "(", "dout", ")", ";", "}" ]
This method writes the 16 bit name constant index followed by the 32 bit attribute length, followed by the attribute specific data.
[ "This", "method", "writes", "the", "16", "bit", "name", "constant", "index", "followed", "by", "the", "32", "bit", "attribute", "length", "followed", "by", "the", "attribute", "specific", "data", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/Attribute.java#L93-L97
119
teatrove/teatrove
build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/BeanDocDoclet.java
BeanDocDoclet.start
public static boolean start(com.sun.javadoc.RootDoc root) { try { BeanDocDoclet doclet = new BeanDocDoclet(root); doclet.start(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
java
public static boolean start(com.sun.javadoc.RootDoc root) { try { BeanDocDoclet doclet = new BeanDocDoclet(root); doclet.start(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
[ "public", "static", "boolean", "start", "(", "com", ".", "sun", ".", "javadoc", ".", "RootDoc", "root", ")", "{", "try", "{", "BeanDocDoclet", "doclet", "=", "new", "BeanDocDoclet", "(", "root", ")", ";", "doclet", ".", "start", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}" ]
Starts the BeanDoc doclet. Called by the javadoc tool.
[ "Starts", "the", "BeanDoc", "doclet", ".", "Called", "by", "the", "javadoc", "tool", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/BeanDocDoclet.java#L49-L60
120
teatrove/teatrove
build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/BeanDocDoclet.java
BeanDocDoclet.start
public void start() { ClassDoc[] classDocs = mRootDoc.getClasses(); for (int i = 0; i < classDocs.length; i++) { ClassDoc classDoc = classDocs[i]; if (!accept(classDoc)) { continue; } try { generateBeanInfo(classDoc); } catch (RuntimeException e) { throw e; } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e.toString()); } } }
java
public void start() { ClassDoc[] classDocs = mRootDoc.getClasses(); for (int i = 0; i < classDocs.length; i++) { ClassDoc classDoc = classDocs[i]; if (!accept(classDoc)) { continue; } try { generateBeanInfo(classDoc); } catch (RuntimeException e) { throw e; } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e.toString()); } } }
[ "public", "void", "start", "(", ")", "{", "ClassDoc", "[", "]", "classDocs", "=", "mRootDoc", ".", "getClasses", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "classDocs", ".", "length", ";", "i", "++", ")", "{", "ClassDoc", "classDoc", "=", "classDocs", "[", "i", "]", ";", "if", "(", "!", "accept", "(", "classDoc", ")", ")", "{", "continue", ";", "}", "try", "{", "generateBeanInfo", "(", "classDoc", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "throw", "new", "RuntimeException", "(", "e", ".", "toString", "(", ")", ")", ";", "}", "}", "}" ]
Generates BeanInfo.java files for each of the ClassDocs in the RootDoc.
[ "Generates", "BeanInfo", ".", "java", "files", "for", "each", "of", "the", "ClassDocs", "in", "the", "RootDoc", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/BeanDocDoclet.java#L110-L132
121
teatrove/teatrove
build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/BeanDocDoclet.java
BeanDocDoclet.init
protected void init(com.sun.javadoc.RootDoc root, String dest, String templateClassName) throws Exception { mRootDoc = new RootDoc(root); mDest = new File(dest); mDest.mkdirs(); mTemplateClassName = templateClassName; if (mTemplateClassName == null) { printWarning("No template name"); return; } String[] templatePath = ClassDoc.parseClassName(mTemplateClassName); // // Load the specified template class // TemplateLoader loader = new TemplateLoader(getClass().getClassLoader(), templatePath[0]); mTemplate = loader.getTemplate(templatePath[1]); Class[] params = mTemplate.getParameterTypes(); if (params.length != 1 || params[0] != ClassDoc.class) { printError("Template has incorrect param signature"); } }
java
protected void init(com.sun.javadoc.RootDoc root, String dest, String templateClassName) throws Exception { mRootDoc = new RootDoc(root); mDest = new File(dest); mDest.mkdirs(); mTemplateClassName = templateClassName; if (mTemplateClassName == null) { printWarning("No template name"); return; } String[] templatePath = ClassDoc.parseClassName(mTemplateClassName); // // Load the specified template class // TemplateLoader loader = new TemplateLoader(getClass().getClassLoader(), templatePath[0]); mTemplate = loader.getTemplate(templatePath[1]); Class[] params = mTemplate.getParameterTypes(); if (params.length != 1 || params[0] != ClassDoc.class) { printError("Template has incorrect param signature"); } }
[ "protected", "void", "init", "(", "com", ".", "sun", ".", "javadoc", ".", "RootDoc", "root", ",", "String", "dest", ",", "String", "templateClassName", ")", "throws", "Exception", "{", "mRootDoc", "=", "new", "RootDoc", "(", "root", ")", ";", "mDest", "=", "new", "File", "(", "dest", ")", ";", "mDest", ".", "mkdirs", "(", ")", ";", "mTemplateClassName", "=", "templateClassName", ";", "if", "(", "mTemplateClassName", "==", "null", ")", "{", "printWarning", "(", "\"No template name\"", ")", ";", "return", ";", "}", "String", "[", "]", "templatePath", "=", "ClassDoc", ".", "parseClassName", "(", "mTemplateClassName", ")", ";", "//", "// Load the specified template class", "//", "TemplateLoader", "loader", "=", "new", "TemplateLoader", "(", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ",", "templatePath", "[", "0", "]", ")", ";", "mTemplate", "=", "loader", ".", "getTemplate", "(", "templatePath", "[", "1", "]", ")", ";", "Class", "[", "]", "params", "=", "mTemplate", ".", "getParameterTypes", "(", ")", ";", "if", "(", "params", ".", "length", "!=", "1", "||", "params", "[", "0", "]", "!=", "ClassDoc", ".", "class", ")", "{", "printError", "(", "\"Template has incorrect param signature\"", ")", ";", "}", "}" ]
Initializes the BeanDocDoclet instance.
[ "Initializes", "the", "BeanDocDoclet", "instance", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/BeanDocDoclet.java#L171-L202
122
teatrove/teatrove
build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/BeanDocDoclet.java
BeanDocDoclet.generateBeanInfo
private void generateBeanInfo(ClassDoc classDoc) throws Exception { String beanInfoJavaFileName = classDoc.getTypeNameForFile() + "BeanInfo.java"; String beanInfoJavaFilePath = beanInfoJavaFileName; String packageName = classDoc.getPackageName(); if (packageName != null) { // Create the file path using the package beanInfoJavaFilePath = packageName.replace('.', '/') + "/" + beanInfoJavaFileName; } File dest = null; if (mDest != null) { dest = new File(mDest, beanInfoJavaFilePath); } else { dest = new File(beanInfoJavaFilePath); } if (dest.exists()) { if (dest.canWrite()) { //printWarning("File exists: " + beanInfoJavaFileName); } else { // Attempt to overwrite the file via delete if (dest.delete()) { //printWarning("File exists: " + beanInfoJavaFileName); } else { printWarning("File exists and cannot be written: " + beanInfoJavaFileName); return; } } } BeanDocContext context = null; try { context = new BeanDocContext(this, dest); if (mTemplate != null) { printNotice("Creating BeanInfo: " + beanInfoJavaFilePath); mTemplate.execute(context, new Object[] { classDoc }); } else { printWarning("No template"); } } finally { if (context != null) { context.close(); } } }
java
private void generateBeanInfo(ClassDoc classDoc) throws Exception { String beanInfoJavaFileName = classDoc.getTypeNameForFile() + "BeanInfo.java"; String beanInfoJavaFilePath = beanInfoJavaFileName; String packageName = classDoc.getPackageName(); if (packageName != null) { // Create the file path using the package beanInfoJavaFilePath = packageName.replace('.', '/') + "/" + beanInfoJavaFileName; } File dest = null; if (mDest != null) { dest = new File(mDest, beanInfoJavaFilePath); } else { dest = new File(beanInfoJavaFilePath); } if (dest.exists()) { if (dest.canWrite()) { //printWarning("File exists: " + beanInfoJavaFileName); } else { // Attempt to overwrite the file via delete if (dest.delete()) { //printWarning("File exists: " + beanInfoJavaFileName); } else { printWarning("File exists and cannot be written: " + beanInfoJavaFileName); return; } } } BeanDocContext context = null; try { context = new BeanDocContext(this, dest); if (mTemplate != null) { printNotice("Creating BeanInfo: " + beanInfoJavaFilePath); mTemplate.execute(context, new Object[] { classDoc }); } else { printWarning("No template"); } } finally { if (context != null) { context.close(); } } }
[ "private", "void", "generateBeanInfo", "(", "ClassDoc", "classDoc", ")", "throws", "Exception", "{", "String", "beanInfoJavaFileName", "=", "classDoc", ".", "getTypeNameForFile", "(", ")", "+", "\"BeanInfo.java\"", ";", "String", "beanInfoJavaFilePath", "=", "beanInfoJavaFileName", ";", "String", "packageName", "=", "classDoc", ".", "getPackageName", "(", ")", ";", "if", "(", "packageName", "!=", "null", ")", "{", "// Create the file path using the package", "beanInfoJavaFilePath", "=", "packageName", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\"/\"", "+", "beanInfoJavaFileName", ";", "}", "File", "dest", "=", "null", ";", "if", "(", "mDest", "!=", "null", ")", "{", "dest", "=", "new", "File", "(", "mDest", ",", "beanInfoJavaFilePath", ")", ";", "}", "else", "{", "dest", "=", "new", "File", "(", "beanInfoJavaFilePath", ")", ";", "}", "if", "(", "dest", ".", "exists", "(", ")", ")", "{", "if", "(", "dest", ".", "canWrite", "(", ")", ")", "{", "//printWarning(\"File exists: \" + beanInfoJavaFileName);", "}", "else", "{", "// Attempt to overwrite the file via delete", "if", "(", "dest", ".", "delete", "(", ")", ")", "{", "//printWarning(\"File exists: \" + beanInfoJavaFileName);", "}", "else", "{", "printWarning", "(", "\"File exists and cannot be written: \"", "+", "beanInfoJavaFileName", ")", ";", "return", ";", "}", "}", "}", "BeanDocContext", "context", "=", "null", ";", "try", "{", "context", "=", "new", "BeanDocContext", "(", "this", ",", "dest", ")", ";", "if", "(", "mTemplate", "!=", "null", ")", "{", "printNotice", "(", "\"Creating BeanInfo: \"", "+", "beanInfoJavaFilePath", ")", ";", "mTemplate", ".", "execute", "(", "context", ",", "new", "Object", "[", "]", "{", "classDoc", "}", ")", ";", "}", "else", "{", "printWarning", "(", "\"No template\"", ")", ";", "}", "}", "finally", "{", "if", "(", "context", "!=", "null", ")", "{", "context", ".", "close", "(", ")", ";", "}", "}", "}" ]
Using a Tea template, generates a "BeanInfo.java" file for the specified ClassDoc.
[ "Using", "a", "Tea", "template", "generates", "a", "BeanInfo", ".", "java", "file", "for", "the", "specified", "ClassDoc", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/BeanDocDoclet.java#L217-L277
123
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/UsageMap.java
UsageMap.firstKey
public Object firstKey() throws NoSuchElementException { Entry first = (mReverse) ? mLeastRecent : mMostRecent; if (first != null) { return first.mKey; } else if (mRecentMap.size() == 0) { throw new NoSuchElementException(); } else { return null; } }
java
public Object firstKey() throws NoSuchElementException { Entry first = (mReverse) ? mLeastRecent : mMostRecent; if (first != null) { return first.mKey; } else if (mRecentMap.size() == 0) { throw new NoSuchElementException(); } else { return null; } }
[ "public", "Object", "firstKey", "(", ")", "throws", "NoSuchElementException", "{", "Entry", "first", "=", "(", "mReverse", ")", "?", "mLeastRecent", ":", "mMostRecent", ";", "if", "(", "first", "!=", "null", ")", "{", "return", "first", ".", "mKey", ";", "}", "else", "if", "(", "mRecentMap", ".", "size", "(", ")", "==", "0", ")", "{", "throw", "new", "NoSuchElementException", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Returns the first key in the map, the most recently used. If reverse order, then the least recently used is returned.
[ "Returns", "the", "first", "key", "in", "the", "map", "the", "most", "recently", "used", ".", "If", "reverse", "order", "then", "the", "least", "recently", "used", "is", "returned", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/UsageMap.java#L66-L77
124
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/UsageMap.java
UsageMap.lastKey
public Object lastKey() throws NoSuchElementException { Entry last = (mReverse) ? mMostRecent : mLeastRecent; if (last != null) { return last.mKey; } else if (mRecentMap.size() == 0) { throw new NoSuchElementException(); } else { return null; } }
java
public Object lastKey() throws NoSuchElementException { Entry last = (mReverse) ? mMostRecent : mLeastRecent; if (last != null) { return last.mKey; } else if (mRecentMap.size() == 0) { throw new NoSuchElementException(); } else { return null; } }
[ "public", "Object", "lastKey", "(", ")", "throws", "NoSuchElementException", "{", "Entry", "last", "=", "(", "mReverse", ")", "?", "mMostRecent", ":", "mLeastRecent", ";", "if", "(", "last", "!=", "null", ")", "{", "return", "last", ".", "mKey", ";", "}", "else", "if", "(", "mRecentMap", ".", "size", "(", ")", "==", "0", ")", "{", "throw", "new", "NoSuchElementException", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Returns the last key in the map, the least recently used. If reverse order, then the most recently used is returned.
[ "Returns", "the", "last", "key", "in", "the", "map", "the", "least", "recently", "used", ".", "If", "reverse", "order", "then", "the", "most", "recently", "used", "is", "returned", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/UsageMap.java#L83-L94
125
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/io/PushbackPositionReader.java
PushbackPositionReader.unread
public void unread() throws IOException { mPushback++; if (mPushback > mMaxPushback - 2) { throw new IOException(this.getClass().getName() + ": pushback exceeded " + (mMaxPushback - 2)); } if ((--mCursor) < 0) mCursor += mMaxPushback; if (mCursor > 0) { mPosition = mPositions[mCursor - 1]; } else { mPosition = mPositions[mMaxPushback - 1]; } unreadHook(mCharacters[mCursor]); }
java
public void unread() throws IOException { mPushback++; if (mPushback > mMaxPushback - 2) { throw new IOException(this.getClass().getName() + ": pushback exceeded " + (mMaxPushback - 2)); } if ((--mCursor) < 0) mCursor += mMaxPushback; if (mCursor > 0) { mPosition = mPositions[mCursor - 1]; } else { mPosition = mPositions[mMaxPushback - 1]; } unreadHook(mCharacters[mCursor]); }
[ "public", "void", "unread", "(", ")", "throws", "IOException", "{", "mPushback", "++", ";", "if", "(", "mPushback", ">", "mMaxPushback", "-", "2", ")", "{", "throw", "new", "IOException", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\": pushback exceeded \"", "+", "(", "mMaxPushback", "-", "2", ")", ")", ";", "}", "if", "(", "(", "--", "mCursor", ")", "<", "0", ")", "mCursor", "+=", "mMaxPushback", ";", "if", "(", "mCursor", ">", "0", ")", "{", "mPosition", "=", "mPositions", "[", "mCursor", "-", "1", "]", ";", "}", "else", "{", "mPosition", "=", "mPositions", "[", "mMaxPushback", "-", "1", "]", ";", "}", "unreadHook", "(", "mCharacters", "[", "mCursor", "]", ")", ";", "}" ]
Unread the last character read. <p>Unlike PushbackReader, unread does not allow arbitrary characters to to be unread. Rather, it functions like an undo operation. @see java.io.PushbackReader#unread(int)
[ "Unread", "the", "last", "character", "read", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/io/PushbackPositionReader.java#L126-L144
126
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/SetContext.java
SetContext.add
public <T> boolean add(Set<T> set, T object) { if (set == null || object == null) { return false; } return set.add(object); }
java
public <T> boolean add(Set<T> set, T object) { if (set == null || object == null) { return false; } return set.add(object); }
[ "public", "<", "T", ">", "boolean", "add", "(", "Set", "<", "T", ">", "set", ",", "T", "object", ")", "{", "if", "(", "set", "==", "null", "||", "object", "==", "null", ")", "{", "return", "false", ";", "}", "return", "set", ".", "add", "(", "object", ")", ";", "}" ]
Add the given value to the given set. @param <T> The component type of the set @param set The set to add to @param object The object to add @return <code>true</code> if the object was added and not previously contained in the set, <code>false</code> otherwise @see Set#add(Object)
[ "Add", "the", "given", "value", "to", "the", "given", "set", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/SetContext.java#L39-L45
127
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/SetContext.java
SetContext.contains
public boolean contains(Set<?> set, Object object) { if (set == null || object == null) { return false; } return set.contains(object); }
java
public boolean contains(Set<?> set, Object object) { if (set == null || object == null) { return false; } return set.contains(object); }
[ "public", "boolean", "contains", "(", "Set", "<", "?", ">", "set", ",", "Object", "object", ")", "{", "if", "(", "set", "==", "null", "||", "object", "==", "null", ")", "{", "return", "false", ";", "}", "return", "set", ".", "contains", "(", "object", ")", ";", "}" ]
Check whether the given set contains the given object instance. @param set The set to check in @param object The object to check for @return <code>true</code> if the object is contained in the list, <code>false</code> otherwise @see Set#contains(Object)
[ "Check", "whether", "the", "given", "set", "contains", "the", "given", "object", "instance", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/SetContext.java#L73-L79
128
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/SetContext.java
SetContext.remove
public boolean remove(Set<?> set, Object object) { if (set == null || object == null) { return false; } return set.remove(object); }
java
public boolean remove(Set<?> set, Object object) { if (set == null || object == null) { return false; } return set.remove(object); }
[ "public", "boolean", "remove", "(", "Set", "<", "?", ">", "set", ",", "Object", "object", ")", "{", "if", "(", "set", "==", "null", "||", "object", "==", "null", ")", "{", "return", "false", ";", "}", "return", "set", ".", "remove", "(", "object", ")", ";", "}" ]
Remove the given object from the given set. @param set The set to remove from @param object The object to remove @return <code>true</code> if the object was removed and contained in the set, <code>false</code> otherwise @see Set#remove(Object)
[ "Remove", "the", "given", "object", "from", "the", "given", "set", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/SetContext.java#L130-L136
129
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/SetContext.java
SetContext.toArray
@SuppressWarnings("unchecked") public <T> T[] toArray(Set<T> set) { if (set == null) { return null; } return (T[]) set.toArray(new Object[set.size()]); }
java
@SuppressWarnings("unchecked") public <T> T[] toArray(Set<T> set) { if (set == null) { return null; } return (T[]) set.toArray(new Object[set.size()]); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "[", "]", "toArray", "(", "Set", "<", "T", ">", "set", ")", "{", "if", "(", "set", "==", "null", ")", "{", "return", "null", ";", "}", "return", "(", "T", "[", "]", ")", "set", ".", "toArray", "(", "new", "Object", "[", "set", ".", "size", "(", ")", "]", ")", ";", "}" ]
Convert the given set to an array. @param <T> The component type of the set @param set The set to convert @return An array representing the elements in the set @see Set#toArray()
[ "Convert", "the", "given", "set", "to", "an", "array", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/SetContext.java#L166-L173
130
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/JMXContext.java
JMXContext.validateJMX
public boolean validateJMX() { if (getEdenMemoryPoolMXBean() == null || getSurvivorMemoryPoolMXBean() == null || getTenuredMemoryPoolMXBean() == null || getPermGenMemoryPoolMXBean() == null || getYoungCollectorMXBean() == null || getTenuredCollectorMXBean() == null) { return false; } return true; }
java
public boolean validateJMX() { if (getEdenMemoryPoolMXBean() == null || getSurvivorMemoryPoolMXBean() == null || getTenuredMemoryPoolMXBean() == null || getPermGenMemoryPoolMXBean() == null || getYoungCollectorMXBean() == null || getTenuredCollectorMXBean() == null) { return false; } return true; }
[ "public", "boolean", "validateJMX", "(", ")", "{", "if", "(", "getEdenMemoryPoolMXBean", "(", ")", "==", "null", "||", "getSurvivorMemoryPoolMXBean", "(", ")", "==", "null", "||", "getTenuredMemoryPoolMXBean", "(", ")", "==", "null", "||", "getPermGenMemoryPoolMXBean", "(", ")", "==", "null", "||", "getYoungCollectorMXBean", "(", ")", "==", "null", "||", "getTenuredCollectorMXBean", "(", ")", "==", "null", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Check whether or not the context is properly configured with valid memory pools and collectors, including eden, survivor, and tenured generations. @return <code>true</code> if properly configured, otherwise false
[ "Check", "whether", "or", "not", "the", "context", "is", "properly", "configured", "with", "valid", "memory", "pools", "and", "collectors", "including", "eden", "survivor", "and", "tenured", "generations", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/JMXContext.java#L152-L164
131
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ConstantFloatInfo.java
ConstantFloatInfo.make
static ConstantFloatInfo make(ConstantPool cp, float value) { ConstantInfo ci = new ConstantFloatInfo(value); return (ConstantFloatInfo)cp.addConstant(ci); }
java
static ConstantFloatInfo make(ConstantPool cp, float value) { ConstantInfo ci = new ConstantFloatInfo(value); return (ConstantFloatInfo)cp.addConstant(ci); }
[ "static", "ConstantFloatInfo", "make", "(", "ConstantPool", "cp", ",", "float", "value", ")", "{", "ConstantInfo", "ci", "=", "new", "ConstantFloatInfo", "(", "value", ")", ";", "return", "(", "ConstantFloatInfo", ")", "cp", ".", "addConstant", "(", "ci", ")", ";", "}" ]
Will return either a new ConstantFloatInfo object or one already in the constant pool. If it is a new ConstantFloatInfo, it will be inserted into the pool.
[ "Will", "return", "either", "a", "new", "ConstantFloatInfo", "object", "or", "one", "already", "in", "the", "constant", "pool", ".", "If", "it", "is", "a", "new", "ConstantFloatInfo", "it", "will", "be", "inserted", "into", "the", "pool", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ConstantFloatInfo.java#L35-L38
132
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/ClassUtils.java
ClassUtils.isDeprecated
public static boolean isDeprecated(Method method) { return isDeprecated(method.getDeclaringClass(), method.getName(), method.getParameterTypes()); }
java
public static boolean isDeprecated(Method method) { return isDeprecated(method.getDeclaringClass(), method.getName(), method.getParameterTypes()); }
[ "public", "static", "boolean", "isDeprecated", "(", "Method", "method", ")", "{", "return", "isDeprecated", "(", "method", ".", "getDeclaringClass", "(", ")", ",", "method", ".", "getName", "(", ")", ",", "method", ".", "getParameterTypes", "(", ")", ")", ";", "}" ]
Check whether the given method is deprecated. This will also recursively inspect all parent classes and parent interfaces for any other class in the hiearchy that declares the method. It will also check if the class itself is deprecated. @param method The method to inspect @return true if the method is deprecated, false otherwise
[ "Check", "whether", "the", "given", "method", "is", "deprecated", ".", "This", "will", "also", "recursively", "inspect", "all", "parent", "classes", "and", "parent", "interfaces", "for", "any", "other", "class", "in", "the", "hiearchy", "that", "declares", "the", "method", ".", "It", "will", "also", "check", "if", "the", "class", "itself", "is", "deprecated", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/ClassUtils.java#L79-L82
133
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/file/Bitlist.java
Bitlist.set
public void set(long index) throws IOException { long pos = index >> 3; try { lock().acquireUpgradableLock(); int value = mFile.read(pos); int newValue; if (value <= 0) { newValue = (0x00000080 >> (index & 7)); } else { newValue = value | (0x00000080 >> (index & 7)); } if (newValue != value) { mFile.write(pos, newValue); } } catch (InterruptedException e) { throw new InterruptedIOException(); } finally { lock().releaseLock(); } }
java
public void set(long index) throws IOException { long pos = index >> 3; try { lock().acquireUpgradableLock(); int value = mFile.read(pos); int newValue; if (value <= 0) { newValue = (0x00000080 >> (index & 7)); } else { newValue = value | (0x00000080 >> (index & 7)); } if (newValue != value) { mFile.write(pos, newValue); } } catch (InterruptedException e) { throw new InterruptedIOException(); } finally { lock().releaseLock(); } }
[ "public", "void", "set", "(", "long", "index", ")", "throws", "IOException", "{", "long", "pos", "=", "index", ">>", "3", ";", "try", "{", "lock", "(", ")", ".", "acquireUpgradableLock", "(", ")", ";", "int", "value", "=", "mFile", ".", "read", "(", "pos", ")", ";", "int", "newValue", ";", "if", "(", "value", "<=", "0", ")", "{", "newValue", "=", "(", "0x00000080", ">>", "(", "index", "&", "7", ")", ")", ";", "}", "else", "{", "newValue", "=", "value", "|", "(", "0x00000080", ">>", "(", "index", "&", "7", ")", ")", ";", "}", "if", "(", "newValue", "!=", "value", ")", "{", "mFile", ".", "write", "(", "pos", ",", "newValue", ")", ";", "}", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "InterruptedIOException", "(", ")", ";", "}", "finally", "{", "lock", "(", ")", ".", "releaseLock", "(", ")", ";", "}", "}" ]
Set the bit at the given index to one.
[ "Set", "the", "bit", "at", "the", "given", "index", "to", "one", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/file/Bitlist.java#L42-L64
134
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/file/Bitlist.java
Bitlist.findFirstSet
public long findFirstSet(long start, byte[] temp) throws IOException { long pos = start >> 3; try { lock().acquireReadLock(); while (true) { int amt = mFile.read(pos, temp, 0, temp.length); if (amt <= 0) { return -1; } for (int i=0; i<amt; i++, pos++) { byte val; if ((val = temp[i]) != 0) { long index = pos << 3; if (index < start) { // Clear the upper bits to skip check. val &= (0x000000ff >>> (start - index)); if (val == 0) { // False alarm. continue; } } return index + findSubIndex(val); } } } } catch (InterruptedException e) { throw new InterruptedIOException(); } finally { lock().releaseLock(); } }
java
public long findFirstSet(long start, byte[] temp) throws IOException { long pos = start >> 3; try { lock().acquireReadLock(); while (true) { int amt = mFile.read(pos, temp, 0, temp.length); if (amt <= 0) { return -1; } for (int i=0; i<amt; i++, pos++) { byte val; if ((val = temp[i]) != 0) { long index = pos << 3; if (index < start) { // Clear the upper bits to skip check. val &= (0x000000ff >>> (start - index)); if (val == 0) { // False alarm. continue; } } return index + findSubIndex(val); } } } } catch (InterruptedException e) { throw new InterruptedIOException(); } finally { lock().releaseLock(); } }
[ "public", "long", "findFirstSet", "(", "long", "start", ",", "byte", "[", "]", "temp", ")", "throws", "IOException", "{", "long", "pos", "=", "start", ">>", "3", ";", "try", "{", "lock", "(", ")", ".", "acquireReadLock", "(", ")", ";", "while", "(", "true", ")", "{", "int", "amt", "=", "mFile", ".", "read", "(", "pos", ",", "temp", ",", "0", ",", "temp", ".", "length", ")", ";", "if", "(", "amt", "<=", "0", ")", "{", "return", "-", "1", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "amt", ";", "i", "++", ",", "pos", "++", ")", "{", "byte", "val", ";", "if", "(", "(", "val", "=", "temp", "[", "i", "]", ")", "!=", "0", ")", "{", "long", "index", "=", "pos", "<<", "3", ";", "if", "(", "index", "<", "start", ")", "{", "// Clear the upper bits to skip check.", "val", "&=", "(", "0x000000ff", ">>>", "(", "start", "-", "index", ")", ")", ";", "if", "(", "val", "==", "0", ")", "{", "// False alarm.", "continue", ";", "}", "}", "return", "index", "+", "findSubIndex", "(", "val", ")", ";", "}", "}", "}", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "InterruptedIOException", "(", ")", ";", "}", "finally", "{", "lock", "(", ")", ".", "releaseLock", "(", ")", ";", "}", "}" ]
Searches the bitlist for the first set bit and returns the index to it. @param start first index to begin search. @param temp temporary byte array for loading bits. @return index to first set bit or -1 if not found.
[ "Searches", "the", "bitlist", "for", "the", "first", "set", "bit", "and", "returns", "the", "index", "to", "it", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/file/Bitlist.java#L127-L159
135
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/file/Bitlist.java
Bitlist.countClearBits
public long countClearBits() throws IOException { byte[] temp; long size = mFile.size(); if (size > 1024) { temp = new byte[1024]; } else { temp = new byte[(int)size]; } long pos = 0; long count = 0; try { lock().acquireReadLock(); while (true) { int amt = mFile.read(pos, temp, 0, temp.length); if (amt <= 0) { break; } for (int i=0; i<amt; i++) { byte val = temp[i]; switch (val & 15) { case 0: count += 4; break; case 1: case 2: case 4: case 8: count += 3; break; case 3: case 5: case 6: case 9: case 10: case 12: count += 2; break; case 7: case 11: case 13: case 14: count++; break; default: break; } switch ((val >> 4) & 15) { case 0: count += 4; break; case 1: case 2: case 4: case 8: count += 3; break; case 3: case 5: case 6: case 9: case 10: case 12: count += 2; break; case 7: case 11: case 13: case 14: count++; break; default: break; } } pos += amt; } } catch (InterruptedException e) { throw new InterruptedIOException(); } finally { lock().releaseLock(); } return count; }
java
public long countClearBits() throws IOException { byte[] temp; long size = mFile.size(); if (size > 1024) { temp = new byte[1024]; } else { temp = new byte[(int)size]; } long pos = 0; long count = 0; try { lock().acquireReadLock(); while (true) { int amt = mFile.read(pos, temp, 0, temp.length); if (amt <= 0) { break; } for (int i=0; i<amt; i++) { byte val = temp[i]; switch (val & 15) { case 0: count += 4; break; case 1: case 2: case 4: case 8: count += 3; break; case 3: case 5: case 6: case 9: case 10: case 12: count += 2; break; case 7: case 11: case 13: case 14: count++; break; default: break; } switch ((val >> 4) & 15) { case 0: count += 4; break; case 1: case 2: case 4: case 8: count += 3; break; case 3: case 5: case 6: case 9: case 10: case 12: count += 2; break; case 7: case 11: case 13: case 14: count++; break; default: break; } } pos += amt; } } catch (InterruptedException e) { throw new InterruptedIOException(); } finally { lock().releaseLock(); } return count; }
[ "public", "long", "countClearBits", "(", ")", "throws", "IOException", "{", "byte", "[", "]", "temp", ";", "long", "size", "=", "mFile", ".", "size", "(", ")", ";", "if", "(", "size", ">", "1024", ")", "{", "temp", "=", "new", "byte", "[", "1024", "]", ";", "}", "else", "{", "temp", "=", "new", "byte", "[", "(", "int", ")", "size", "]", ";", "}", "long", "pos", "=", "0", ";", "long", "count", "=", "0", ";", "try", "{", "lock", "(", ")", ".", "acquireReadLock", "(", ")", ";", "while", "(", "true", ")", "{", "int", "amt", "=", "mFile", ".", "read", "(", "pos", ",", "temp", ",", "0", ",", "temp", ".", "length", ")", ";", "if", "(", "amt", "<=", "0", ")", "{", "break", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "amt", ";", "i", "++", ")", "{", "byte", "val", "=", "temp", "[", "i", "]", ";", "switch", "(", "val", "&", "15", ")", "{", "case", "0", ":", "count", "+=", "4", ";", "break", ";", "case", "1", ":", "case", "2", ":", "case", "4", ":", "case", "8", ":", "count", "+=", "3", ";", "break", ";", "case", "3", ":", "case", "5", ":", "case", "6", ":", "case", "9", ":", "case", "10", ":", "case", "12", ":", "count", "+=", "2", ";", "break", ";", "case", "7", ":", "case", "11", ":", "case", "13", ":", "case", "14", ":", "count", "++", ";", "break", ";", "default", ":", "break", ";", "}", "switch", "(", "(", "val", ">>", "4", ")", "&", "15", ")", "{", "case", "0", ":", "count", "+=", "4", ";", "break", ";", "case", "1", ":", "case", "2", ":", "case", "4", ":", "case", "8", ":", "count", "+=", "3", ";", "break", ";", "case", "3", ":", "case", "5", ":", "case", "6", ":", "case", "9", ":", "case", "10", ":", "case", "12", ":", "count", "+=", "2", ";", "break", ";", "case", "7", ":", "case", "11", ":", "case", "13", ":", "case", "14", ":", "count", "++", ";", "break", ";", "default", ":", "break", ";", "}", "}", "pos", "+=", "amt", ";", "}", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "InterruptedIOException", "(", ")", ";", "}", "finally", "{", "lock", "(", ")", ".", "releaseLock", "(", ")", ";", "}", "return", "count", ";", "}" ]
Counts all the clear bits.
[ "Counts", "all", "the", "clear", "bits", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/file/Bitlist.java#L269-L317
136
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.getInterfaces
public String[] getInterfaces() { int size = mInterfaces.size(); String[] names = new String[size]; for (int i=0; i<size; i++) { names[i] = mInterfaces.get(i) .getType().getRootName(); } return names; }
java
public String[] getInterfaces() { int size = mInterfaces.size(); String[] names = new String[size]; for (int i=0; i<size; i++) { names[i] = mInterfaces.get(i) .getType().getRootName(); } return names; }
[ "public", "String", "[", "]", "getInterfaces", "(", ")", "{", "int", "size", "=", "mInterfaces", ".", "size", "(", ")", ";", "String", "[", "]", "names", "=", "new", "String", "[", "size", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "names", "[", "i", "]", "=", "mInterfaces", ".", "get", "(", "i", ")", ".", "getType", "(", ")", ".", "getRootName", "(", ")", ";", "}", "return", "names", ";", "}" ]
Returns the names of all the interfaces that this class implements.
[ "Returns", "the", "names", "of", "all", "the", "interfaces", "that", "this", "class", "implements", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L203-L213
137
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.getFields
public FieldInfo[] getFields() { FieldInfo[] fields = new FieldInfo[mFields.size()]; return mFields.toArray(fields); }
java
public FieldInfo[] getFields() { FieldInfo[] fields = new FieldInfo[mFields.size()]; return mFields.toArray(fields); }
[ "public", "FieldInfo", "[", "]", "getFields", "(", ")", "{", "FieldInfo", "[", "]", "fields", "=", "new", "FieldInfo", "[", "mFields", ".", "size", "(", ")", "]", ";", "return", "mFields", ".", "toArray", "(", "fields", ")", ";", "}" ]
Returns all the fields defined in this class.
[ "Returns", "all", "the", "fields", "defined", "in", "this", "class", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L218-L221
138
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.getMethods
public MethodInfo[] getMethods() { int size = mMethods.size(); List<MethodInfo> methodsOnly = new ArrayList<MethodInfo>(size); for (int i=0; i<size; i++) { MethodInfo method = mMethods.get(i); String name = method.getName(); if (!"<init>".equals(name) && !"<clinit>".equals(name)) { methodsOnly.add(method); } } MethodInfo[] methodsArray = new MethodInfo[methodsOnly.size()]; return methodsOnly.toArray(methodsArray); }
java
public MethodInfo[] getMethods() { int size = mMethods.size(); List<MethodInfo> methodsOnly = new ArrayList<MethodInfo>(size); for (int i=0; i<size; i++) { MethodInfo method = mMethods.get(i); String name = method.getName(); if (!"<init>".equals(name) && !"<clinit>".equals(name)) { methodsOnly.add(method); } } MethodInfo[] methodsArray = new MethodInfo[methodsOnly.size()]; return methodsOnly.toArray(methodsArray); }
[ "public", "MethodInfo", "[", "]", "getMethods", "(", ")", "{", "int", "size", "=", "mMethods", ".", "size", "(", ")", ";", "List", "<", "MethodInfo", ">", "methodsOnly", "=", "new", "ArrayList", "<", "MethodInfo", ">", "(", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "MethodInfo", "method", "=", "mMethods", ".", "get", "(", "i", ")", ";", "String", "name", "=", "method", ".", "getName", "(", ")", ";", "if", "(", "!", "\"<init>\"", ".", "equals", "(", "name", ")", "&&", "!", "\"<clinit>\"", ".", "equals", "(", "name", ")", ")", "{", "methodsOnly", ".", "add", "(", "method", ")", ";", "}", "}", "MethodInfo", "[", "]", "methodsArray", "=", "new", "MethodInfo", "[", "methodsOnly", ".", "size", "(", ")", "]", ";", "return", "methodsOnly", ".", "toArray", "(", "methodsArray", ")", ";", "}" ]
Returns all the methods defined in this class, not including constructors and static initializers.
[ "Returns", "all", "the", "methods", "defined", "in", "this", "class", "not", "including", "constructors", "and", "static", "initializers", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L227-L241
139
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.getConstructors
public MethodInfo[] getConstructors() { int size = mMethods.size(); List<MethodInfo> ctorsOnly = new ArrayList<MethodInfo>(size); for (int i=0; i<size; i++) { MethodInfo method = mMethods.get(i); if ("<init>".equals(method.getName())) { ctorsOnly.add(method); } } MethodInfo[] ctorsArray = new MethodInfo[ctorsOnly.size()]; return ctorsOnly.toArray(ctorsArray); }
java
public MethodInfo[] getConstructors() { int size = mMethods.size(); List<MethodInfo> ctorsOnly = new ArrayList<MethodInfo>(size); for (int i=0; i<size; i++) { MethodInfo method = mMethods.get(i); if ("<init>".equals(method.getName())) { ctorsOnly.add(method); } } MethodInfo[] ctorsArray = new MethodInfo[ctorsOnly.size()]; return ctorsOnly.toArray(ctorsArray); }
[ "public", "MethodInfo", "[", "]", "getConstructors", "(", ")", "{", "int", "size", "=", "mMethods", ".", "size", "(", ")", ";", "List", "<", "MethodInfo", ">", "ctorsOnly", "=", "new", "ArrayList", "<", "MethodInfo", ">", "(", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "MethodInfo", "method", "=", "mMethods", ".", "get", "(", "i", ")", ";", "if", "(", "\"<init>\"", ".", "equals", "(", "method", ".", "getName", "(", ")", ")", ")", "{", "ctorsOnly", ".", "add", "(", "method", ")", ";", "}", "}", "MethodInfo", "[", "]", "ctorsArray", "=", "new", "MethodInfo", "[", "ctorsOnly", ".", "size", "(", ")", "]", ";", "return", "ctorsOnly", ".", "toArray", "(", "ctorsArray", ")", ";", "}" ]
Returns all the constructors defined in this class.
[ "Returns", "all", "the", "constructors", "defined", "in", "this", "class", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L246-L259
140
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.getInitializer
public MethodInfo getInitializer() { int size = mMethods.size(); for (int i=0; i<size; i++) { MethodInfo method = mMethods.get(i); if ("<clinit>".equals(method.getName())) { return method; } } return null; }
java
public MethodInfo getInitializer() { int size = mMethods.size(); for (int i=0; i<size; i++) { MethodInfo method = mMethods.get(i); if ("<clinit>".equals(method.getName())) { return method; } } return null; }
[ "public", "MethodInfo", "getInitializer", "(", ")", "{", "int", "size", "=", "mMethods", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "MethodInfo", "method", "=", "mMethods", ".", "get", "(", "i", ")", ";", "if", "(", "\"<clinit>\"", ".", "equals", "(", "method", ".", "getName", "(", ")", ")", ")", "{", "return", "method", ";", "}", "}", "return", "null", ";", "}" ]
Returns the static initializer defined in this class or null if there isn't one.
[ "Returns", "the", "static", "initializer", "defined", "in", "this", "class", "or", "null", "if", "there", "isn", "t", "one", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L265-L276
141
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.getClassDepth
public int getClassDepth() { int depth = 0; ClassFile outer = mOuterClass; while (outer != null) { depth++; outer = outer.mOuterClass; } return depth; }
java
public int getClassDepth() { int depth = 0; ClassFile outer = mOuterClass; while (outer != null) { depth++; outer = outer.mOuterClass; } return depth; }
[ "public", "int", "getClassDepth", "(", ")", "{", "int", "depth", "=", "0", ";", "ClassFile", "outer", "=", "mOuterClass", ";", "while", "(", "outer", "!=", "null", ")", "{", "depth", "++", ";", "outer", "=", "outer", ".", "mOuterClass", ";", "}", "return", "depth", ";", "}" ]
Returns a value indicating how deeply nested an inner class is with respect to its outermost enclosing class. For top level classes, 0 is returned. For first level inner classes, 1 is returned, etc.
[ "Returns", "a", "value", "indicating", "how", "deeply", "nested", "an", "inner", "class", "is", "with", "respect", "to", "its", "outermost", "enclosing", "class", ".", "For", "top", "level", "classes", "0", "is", "returned", ".", "For", "first", "level", "inner", "classes", "1", "is", "returned", "etc", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L320-L330
142
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.addField
public FieldInfo addField(Modifiers modifiers, String fieldName, TypeDesc type) { FieldInfo fi = new FieldInfo(this, modifiers, fieldName, type); mFields.add(fi); return fi; }
java
public FieldInfo addField(Modifiers modifiers, String fieldName, TypeDesc type) { FieldInfo fi = new FieldInfo(this, modifiers, fieldName, type); mFields.add(fi); return fi; }
[ "public", "FieldInfo", "addField", "(", "Modifiers", "modifiers", ",", "String", "fieldName", ",", "TypeDesc", "type", ")", "{", "FieldInfo", "fi", "=", "new", "FieldInfo", "(", "this", ",", "modifiers", ",", "fieldName", ",", "type", ")", ";", "mFields", ".", "add", "(", "fi", ")", ";", "return", "fi", ";", "}" ]
Add a field to this class.
[ "Add", "a", "field", "to", "this", "class", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L396-L402
143
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.addInitializer
public MethodInfo addInitializer() { MethodDesc md = MethodDesc.forArguments(null, null, null); Modifiers af = new Modifiers(); af.setStatic(true); MethodInfo mi = new MethodInfo(this, af, "<clinit>", md, null); mMethods.add(mi); return mi; }
java
public MethodInfo addInitializer() { MethodDesc md = MethodDesc.forArguments(null, null, null); Modifiers af = new Modifiers(); af.setStatic(true); MethodInfo mi = new MethodInfo(this, af, "<clinit>", md, null); mMethods.add(mi); return mi; }
[ "public", "MethodInfo", "addInitializer", "(", ")", "{", "MethodDesc", "md", "=", "MethodDesc", ".", "forArguments", "(", "null", ",", "null", ",", "null", ")", ";", "Modifiers", "af", "=", "new", "Modifiers", "(", ")", ";", "af", ".", "setStatic", "(", "true", ")", ";", "MethodInfo", "mi", "=", "new", "MethodInfo", "(", "this", ",", "af", ",", "\"<clinit>\"", ",", "md", ",", "null", ")", ";", "mMethods", ".", "add", "(", "mi", ")", ";", "return", "mi", ";", "}" ]
Add a static initializer to this class.
[ "Add", "a", "static", "initializer", "to", "this", "class", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L668-L675
144
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.addAttribute
public void addAttribute(Attribute attr) { if (attr instanceof SourceFileAttr) { if (mSource != null) { mAttributes.remove(mSource); } mSource = (SourceFileAttr)attr; } else if (attr instanceof InnerClassesAttr) { if (mInnerClassesAttr != null) { mAttributes.remove(mInnerClassesAttr); } mInnerClassesAttr = (InnerClassesAttr)attr; } mAttributes.add(attr); }
java
public void addAttribute(Attribute attr) { if (attr instanceof SourceFileAttr) { if (mSource != null) { mAttributes.remove(mSource); } mSource = (SourceFileAttr)attr; } else if (attr instanceof InnerClassesAttr) { if (mInnerClassesAttr != null) { mAttributes.remove(mInnerClassesAttr); } mInnerClassesAttr = (InnerClassesAttr)attr; } mAttributes.add(attr); }
[ "public", "void", "addAttribute", "(", "Attribute", "attr", ")", "{", "if", "(", "attr", "instanceof", "SourceFileAttr", ")", "{", "if", "(", "mSource", "!=", "null", ")", "{", "mAttributes", ".", "remove", "(", "mSource", ")", ";", "}", "mSource", "=", "(", "SourceFileAttr", ")", "attr", ";", "}", "else", "if", "(", "attr", "instanceof", "InnerClassesAttr", ")", "{", "if", "(", "mInnerClassesAttr", "!=", "null", ")", "{", "mAttributes", ".", "remove", "(", "mInnerClassesAttr", ")", ";", "}", "mInnerClassesAttr", "=", "(", "InnerClassesAttr", ")", "attr", ";", "}", "mAttributes", ".", "add", "(", "attr", ")", ";", "}" ]
Add an attribute to this class.
[ "Add", "an", "attribute", "to", "this", "class", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L778-L793
145
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.setVersion
public void setVersion(int major, int minor) throws IllegalArgumentException { if (major != JDK1_1_MAJOR_VERSION || minor != JDK1_1_MINOR_VERSION) { throw new IllegalArgumentException("Version " + major + ", " + minor + " is not supported"); } mMajorVersion = major; mMinorVersion = minor; }
java
public void setVersion(int major, int minor) throws IllegalArgumentException { if (major != JDK1_1_MAJOR_VERSION || minor != JDK1_1_MINOR_VERSION) { throw new IllegalArgumentException("Version " + major + ", " + minor + " is not supported"); } mMajorVersion = major; mMinorVersion = minor; }
[ "public", "void", "setVersion", "(", "int", "major", ",", "int", "minor", ")", "throws", "IllegalArgumentException", "{", "if", "(", "major", "!=", "JDK1_1_MAJOR_VERSION", "||", "minor", "!=", "JDK1_1_MINOR_VERSION", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Version \"", "+", "major", "+", "\", \"", "+", "minor", "+", "\" is not supported\"", ")", ";", "}", "mMajorVersion", "=", "major", ";", "mMinorVersion", "=", "minor", ";", "}" ]
Sets the version to use when writing the generated ClassFile. Currently, only version 45, 3 is supported, and is set by default. @exception IllegalArgumentException when the version isn't supported
[ "Sets", "the", "version", "to", "use", "when", "writing", "the", "generated", "ClassFile", ".", "Currently", "only", "version", "45", "3", "is", "supported", "and", "is", "set", "by", "default", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L806-L818
146
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.writeTo
public void writeTo(OutputStream out) throws IOException { if (!(out instanceof DataOutput)) { out = new DataOutputStream(out); } writeTo((DataOutput)out); out.flush(); }
java
public void writeTo(OutputStream out) throws IOException { if (!(out instanceof DataOutput)) { out = new DataOutputStream(out); } writeTo((DataOutput)out); out.flush(); }
[ "public", "void", "writeTo", "(", "OutputStream", "out", ")", "throws", "IOException", "{", "if", "(", "!", "(", "out", "instanceof", "DataOutput", ")", ")", "{", "out", "=", "new", "DataOutputStream", "(", "out", ")", ";", "}", "writeTo", "(", "(", "DataOutput", ")", "out", ")", ";", "out", ".", "flush", "(", ")", ";", "}" ]
Writes the ClassFile to the given OutputStream. When finished, the stream is flushed, but not closed.
[ "Writes", "the", "ClassFile", "to", "the", "given", "OutputStream", ".", "When", "finished", "the", "stream", "is", "flushed", "but", "not", "closed", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L895-L903
147
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/apps/DefaultApplication.java
DefaultApplication.init
public void init(ApplicationConfig config) { PropertyMap properties = config.getProperties(); String contextClassName = properties.getString("contextClass"); if (contextClassName == null) { throw new IllegalArgumentException("contextClass"); } try { contextClass = Class.forName(contextClassName); context = contextClass.newInstance(); if (context instanceof Context) { Context castContext = (Context) context; ContextConfig contextConfig = new ContextConfig( config.getProperties(), config.getLog(), config.getName(), config.getPlugins(), config.getServletContext() ); castContext.init(contextConfig); } } catch (Exception e) { throw new RuntimeException( "Unable to create context: " + contextClassName, e); } }
java
public void init(ApplicationConfig config) { PropertyMap properties = config.getProperties(); String contextClassName = properties.getString("contextClass"); if (contextClassName == null) { throw new IllegalArgumentException("contextClass"); } try { contextClass = Class.forName(contextClassName); context = contextClass.newInstance(); if (context instanceof Context) { Context castContext = (Context) context; ContextConfig contextConfig = new ContextConfig( config.getProperties(), config.getLog(), config.getName(), config.getPlugins(), config.getServletContext() ); castContext.init(contextConfig); } } catch (Exception e) { throw new RuntimeException( "Unable to create context: " + contextClassName, e); } }
[ "public", "void", "init", "(", "ApplicationConfig", "config", ")", "{", "PropertyMap", "properties", "=", "config", ".", "getProperties", "(", ")", ";", "String", "contextClassName", "=", "properties", ".", "getString", "(", "\"contextClass\"", ")", ";", "if", "(", "contextClassName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"contextClass\"", ")", ";", "}", "try", "{", "contextClass", "=", "Class", ".", "forName", "(", "contextClassName", ")", ";", "context", "=", "contextClass", ".", "newInstance", "(", ")", ";", "if", "(", "context", "instanceof", "Context", ")", "{", "Context", "castContext", "=", "(", "Context", ")", "context", ";", "ContextConfig", "contextConfig", "=", "new", "ContextConfig", "(", "config", ".", "getProperties", "(", ")", ",", "config", ".", "getLog", "(", ")", ",", "config", ".", "getName", "(", ")", ",", "config", ".", "getPlugins", "(", ")", ",", "config", ".", "getServletContext", "(", ")", ")", ";", "castContext", ".", "init", "(", "contextConfig", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Unable to create context: \"", "+", "contextClassName", ",", "e", ")", ";", "}", "}" ]
Initialize the application. @param config The application configuration
[ "Initialize", "the", "application", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/apps/DefaultApplication.java#L52-L76
148
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/FieldInfo.java
FieldInfo.setConstantValue
public void setConstantValue(String value) { addAttribute(new ConstantValueAttr (mCp, ConstantStringInfo.make(mCp, value))); }
java
public void setConstantValue(String value) { addAttribute(new ConstantValueAttr (mCp, ConstantStringInfo.make(mCp, value))); }
[ "public", "void", "setConstantValue", "(", "String", "value", ")", "{", "addAttribute", "(", "new", "ConstantValueAttr", "(", "mCp", ",", "ConstantStringInfo", ".", "make", "(", "mCp", ",", "value", ")", ")", ")", ";", "}" ]
Set the constant value for this field as a string.
[ "Set", "the", "constant", "value", "for", "this", "field", "as", "a", "string", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/FieldInfo.java#L187-L190
149
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/compiler/TemplateCallExtractor.java
TemplateCallExtractor.getTemplateExecuteMethod
public static MethodInfo getTemplateExecuteMethod(InputStream in) throws IOException { ClassFile classFile = ClassFile.readFrom(in); MethodInfo executeMethod = null; MethodInfo[] all = classFile.getMethods(); // find the execute method on this template for (int i = 0; i < all.length; i++) { if (JavaClassGenerator.EXECUTE_METHOD_NAME.equals( all[i].getName()) && all[i].getModifiers().isStatic()) { executeMethod = all[i]; break; } } in.close(); return executeMethod; }
java
public static MethodInfo getTemplateExecuteMethod(InputStream in) throws IOException { ClassFile classFile = ClassFile.readFrom(in); MethodInfo executeMethod = null; MethodInfo[] all = classFile.getMethods(); // find the execute method on this template for (int i = 0; i < all.length; i++) { if (JavaClassGenerator.EXECUTE_METHOD_NAME.equals( all[i].getName()) && all[i].getModifiers().isStatic()) { executeMethod = all[i]; break; } } in.close(); return executeMethod; }
[ "public", "static", "MethodInfo", "getTemplateExecuteMethod", "(", "InputStream", "in", ")", "throws", "IOException", "{", "ClassFile", "classFile", "=", "ClassFile", ".", "readFrom", "(", "in", ")", ";", "MethodInfo", "executeMethod", "=", "null", ";", "MethodInfo", "[", "]", "all", "=", "classFile", ".", "getMethods", "(", ")", ";", "// find the execute method on this template", "for", "(", "int", "i", "=", "0", ";", "i", "<", "all", ".", "length", ";", "i", "++", ")", "{", "if", "(", "JavaClassGenerator", ".", "EXECUTE_METHOD_NAME", ".", "equals", "(", "all", "[", "i", "]", ".", "getName", "(", ")", ")", "&&", "all", "[", "i", "]", ".", "getModifiers", "(", ")", ".", "isStatic", "(", ")", ")", "{", "executeMethod", "=", "all", "[", "i", "]", ";", "break", ";", "}", "}", "in", ".", "close", "(", ")", ";", "return", "executeMethod", ";", "}" ]
Find the execute method on the class file input stream.
[ "Find", "the", "execute", "method", "on", "the", "class", "file", "input", "stream", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/TemplateCallExtractor.java#L48-L65
150
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/compiler/TemplateCallExtractor.java
TemplateCallExtractor.getTemplateSubstituteMethod
private static MethodInfo getTemplateSubstituteMethod(InputStream in) throws IOException { ClassFile classFile = ClassFile.readFrom(in); MethodInfo substituteMethod = null; MethodInfo[] all = classFile.getMethods(); // find the execute method on this template for (int i = 0; i < all.length; i++) { if ("substitute".equals( all[i].getName()) && all[i].getMethodDescriptor().getParameterCount() == 1) { substituteMethod = all[i]; break; } } in.close(); return substituteMethod; }
java
private static MethodInfo getTemplateSubstituteMethod(InputStream in) throws IOException { ClassFile classFile = ClassFile.readFrom(in); MethodInfo substituteMethod = null; MethodInfo[] all = classFile.getMethods(); // find the execute method on this template for (int i = 0; i < all.length; i++) { if ("substitute".equals( all[i].getName()) && all[i].getMethodDescriptor().getParameterCount() == 1) { substituteMethod = all[i]; break; } } in.close(); return substituteMethod; }
[ "private", "static", "MethodInfo", "getTemplateSubstituteMethod", "(", "InputStream", "in", ")", "throws", "IOException", "{", "ClassFile", "classFile", "=", "ClassFile", ".", "readFrom", "(", "in", ")", ";", "MethodInfo", "substituteMethod", "=", "null", ";", "MethodInfo", "[", "]", "all", "=", "classFile", ".", "getMethods", "(", ")", ";", "// find the execute method on this template", "for", "(", "int", "i", "=", "0", ";", "i", "<", "all", ".", "length", ";", "i", "++", ")", "{", "if", "(", "\"substitute\"", ".", "equals", "(", "all", "[", "i", "]", ".", "getName", "(", ")", ")", "&&", "all", "[", "i", "]", ".", "getMethodDescriptor", "(", ")", ".", "getParameterCount", "(", ")", "==", "1", ")", "{", "substituteMethod", "=", "all", "[", "i", "]", ";", "break", ";", "}", "}", "in", ".", "close", "(", ")", ";", "return", "substituteMethod", ";", "}" ]
Find the substitute method on the class file input stream.
[ "Find", "the", "substitute", "method", "on", "the", "class", "file", "input", "stream", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/TemplateCallExtractor.java#L70-L89
151
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/compiler/TemplateCallExtractor.java
TemplateCallExtractor.getTemplatesCalled
public static String[] getTemplatesCalled(String basePath, String templateName) { final HashMap<String, String> templatesCalledMap = new HashMap<String, String>(); try { File templatePath = new File(new File(basePath), templateName.replace('.', '/') + ".class"); if (!templatePath.exists() && templateName.startsWith(TEMPLATE_PACKAGE)) { templatePath = new File(new File(basePath), templateName.substring(TEMPLATE_PACKAGE.length()). replace('.','/') + ".class"); } MethodInfo executeMethod = getTemplateExecuteMethod(new FileInputStream(templatePath)); // Search for embedded execute methods. CodeDisassembler cd = new CodeDisassembler(executeMethod); cd.disassemble(new CodeAssemblerPrinter(executeMethod .getMethodDescriptor().getParameterTypes(), true, null) { public void invokeStatic(String className, String methodName, TypeDesc ret, TypeDesc[] params) { if (JavaClassGenerator.EXECUTE_METHOD_NAME.equals(methodName)) templatesCalledMap.put(className.replace('.', '/'), className); } public void println(String s) { } // Do nothing }); MethodInfo substituteMethod = getTemplateSubstituteMethod(new FileInputStream(templatePath)); if (substituteMethod == null) return (String[]) templatesCalledMap.keySet().toArray( new String[templatesCalledMap.keySet().size()]); // Search for embedded substitute methods. cd = new CodeDisassembler(substituteMethod); cd.disassemble(new CodeAssemblerPrinter(substituteMethod .getMethodDescriptor().getParameterTypes(), true, null) { public void invokeStatic(String className, String methodName, TypeDesc ret, TypeDesc[] params) { if (JavaClassGenerator.EXECUTE_METHOD_NAME.equals(methodName)) templatesCalledMap.put(className.replace('.', '/'), className); } public void println(String s) { } // Do nothing }); } catch (IOException ix) { return new String[0]; } return (String[]) templatesCalledMap.keySet().toArray( new String[templatesCalledMap.keySet().size()]); }
java
public static String[] getTemplatesCalled(String basePath, String templateName) { final HashMap<String, String> templatesCalledMap = new HashMap<String, String>(); try { File templatePath = new File(new File(basePath), templateName.replace('.', '/') + ".class"); if (!templatePath.exists() && templateName.startsWith(TEMPLATE_PACKAGE)) { templatePath = new File(new File(basePath), templateName.substring(TEMPLATE_PACKAGE.length()). replace('.','/') + ".class"); } MethodInfo executeMethod = getTemplateExecuteMethod(new FileInputStream(templatePath)); // Search for embedded execute methods. CodeDisassembler cd = new CodeDisassembler(executeMethod); cd.disassemble(new CodeAssemblerPrinter(executeMethod .getMethodDescriptor().getParameterTypes(), true, null) { public void invokeStatic(String className, String methodName, TypeDesc ret, TypeDesc[] params) { if (JavaClassGenerator.EXECUTE_METHOD_NAME.equals(methodName)) templatesCalledMap.put(className.replace('.', '/'), className); } public void println(String s) { } // Do nothing }); MethodInfo substituteMethod = getTemplateSubstituteMethod(new FileInputStream(templatePath)); if (substituteMethod == null) return (String[]) templatesCalledMap.keySet().toArray( new String[templatesCalledMap.keySet().size()]); // Search for embedded substitute methods. cd = new CodeDisassembler(substituteMethod); cd.disassemble(new CodeAssemblerPrinter(substituteMethod .getMethodDescriptor().getParameterTypes(), true, null) { public void invokeStatic(String className, String methodName, TypeDesc ret, TypeDesc[] params) { if (JavaClassGenerator.EXECUTE_METHOD_NAME.equals(methodName)) templatesCalledMap.put(className.replace('.', '/'), className); } public void println(String s) { } // Do nothing }); } catch (IOException ix) { return new String[0]; } return (String[]) templatesCalledMap.keySet().toArray( new String[templatesCalledMap.keySet().size()]); }
[ "public", "static", "String", "[", "]", "getTemplatesCalled", "(", "String", "basePath", ",", "String", "templateName", ")", "{", "final", "HashMap", "<", "String", ",", "String", ">", "templatesCalledMap", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "try", "{", "File", "templatePath", "=", "new", "File", "(", "new", "File", "(", "basePath", ")", ",", "templateName", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\".class\"", ")", ";", "if", "(", "!", "templatePath", ".", "exists", "(", ")", "&&", "templateName", ".", "startsWith", "(", "TEMPLATE_PACKAGE", ")", ")", "{", "templatePath", "=", "new", "File", "(", "new", "File", "(", "basePath", ")", ",", "templateName", ".", "substring", "(", "TEMPLATE_PACKAGE", ".", "length", "(", ")", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\".class\"", ")", ";", "}", "MethodInfo", "executeMethod", "=", "getTemplateExecuteMethod", "(", "new", "FileInputStream", "(", "templatePath", ")", ")", ";", "// Search for embedded execute methods.", "CodeDisassembler", "cd", "=", "new", "CodeDisassembler", "(", "executeMethod", ")", ";", "cd", ".", "disassemble", "(", "new", "CodeAssemblerPrinter", "(", "executeMethod", ".", "getMethodDescriptor", "(", ")", ".", "getParameterTypes", "(", ")", ",", "true", ",", "null", ")", "{", "public", "void", "invokeStatic", "(", "String", "className", ",", "String", "methodName", ",", "TypeDesc", "ret", ",", "TypeDesc", "[", "]", "params", ")", "{", "if", "(", "JavaClassGenerator", ".", "EXECUTE_METHOD_NAME", ".", "equals", "(", "methodName", ")", ")", "templatesCalledMap", ".", "put", "(", "className", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ",", "className", ")", ";", "}", "public", "void", "println", "(", "String", "s", ")", "{", "}", "// Do nothing", "}", ")", ";", "MethodInfo", "substituteMethod", "=", "getTemplateSubstituteMethod", "(", "new", "FileInputStream", "(", "templatePath", ")", ")", ";", "if", "(", "substituteMethod", "==", "null", ")", "return", "(", "String", "[", "]", ")", "templatesCalledMap", ".", "keySet", "(", ")", ".", "toArray", "(", "new", "String", "[", "templatesCalledMap", ".", "keySet", "(", ")", ".", "size", "(", ")", "]", ")", ";", "// Search for embedded substitute methods.", "cd", "=", "new", "CodeDisassembler", "(", "substituteMethod", ")", ";", "cd", ".", "disassemble", "(", "new", "CodeAssemblerPrinter", "(", "substituteMethod", ".", "getMethodDescriptor", "(", ")", ".", "getParameterTypes", "(", ")", ",", "true", ",", "null", ")", "{", "public", "void", "invokeStatic", "(", "String", "className", ",", "String", "methodName", ",", "TypeDesc", "ret", ",", "TypeDesc", "[", "]", "params", ")", "{", "if", "(", "JavaClassGenerator", ".", "EXECUTE_METHOD_NAME", ".", "equals", "(", "methodName", ")", ")", "templatesCalledMap", ".", "put", "(", "className", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ",", "className", ")", ";", "}", "public", "void", "println", "(", "String", "s", ")", "{", "}", "// Do nothing", "}", ")", ";", "}", "catch", "(", "IOException", "ix", ")", "{", "return", "new", "String", "[", "0", "]", ";", "}", "return", "(", "String", "[", "]", ")", "templatesCalledMap", ".", "keySet", "(", ")", ".", "toArray", "(", "new", "String", "[", "templatesCalledMap", ".", "keySet", "(", ")", ".", "size", "(", ")", "]", ")", ";", "}" ]
Get the names of all templates called within a template.
[ "Get", "the", "names", "of", "all", "templates", "called", "within", "a", "template", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/TemplateCallExtractor.java#L94-L152
152
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teaservlet/stats/RawData.java
RawData.set
public void set(long startTime, long stopTime, long contentLength) { this.startTime = startTime; this.endTime = stopTime; this.contentLength = contentLength; }
java
public void set(long startTime, long stopTime, long contentLength) { this.startTime = startTime; this.endTime = stopTime; this.contentLength = contentLength; }
[ "public", "void", "set", "(", "long", "startTime", ",", "long", "stopTime", ",", "long", "contentLength", ")", "{", "this", ".", "startTime", "=", "startTime", ";", "this", ".", "endTime", "=", "stopTime", ";", "this", ".", "contentLength", "=", "contentLength", ";", "}" ]
This methods sets the raw data values. @param startTime the time the template was invoked. @param stopTime the time the template completed. @param contentLength the content length of the template result.
[ "This", "methods", "sets", "the", "raw", "data", "values", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teaservlet/stats/RawData.java#L38-L42
153
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/net/DistributedSocketFactory.java
DistributedSocketFactory.selectFactoryIndex
protected int selectFactoryIndex(Object session) throws ConnectException { Random rnd; if (session != null) { return session.hashCode() & 0x7fffffff; } else if ((rnd = mRnd) != null) { return rnd.nextInt() >>> 1; } else { synchronized (mFactories) { return mFactoryIndex++ & 0x7fffffff; } } }
java
protected int selectFactoryIndex(Object session) throws ConnectException { Random rnd; if (session != null) { return session.hashCode() & 0x7fffffff; } else if ((rnd = mRnd) != null) { return rnd.nextInt() >>> 1; } else { synchronized (mFactories) { return mFactoryIndex++ & 0x7fffffff; } } }
[ "protected", "int", "selectFactoryIndex", "(", "Object", "session", ")", "throws", "ConnectException", "{", "Random", "rnd", ";", "if", "(", "session", "!=", "null", ")", "{", "return", "session", ".", "hashCode", "(", ")", "&", "0x7fffffff", ";", "}", "else", "if", "(", "(", "rnd", "=", "mRnd", ")", "!=", "null", ")", "{", "return", "rnd", ".", "nextInt", "(", ")", ">>>", "1", ";", "}", "else", "{", "synchronized", "(", "mFactories", ")", "{", "return", "mFactoryIndex", "++", "&", "0x7fffffff", ";", "}", "}", "}" ]
Returns an index which is positive, but may be out of the factory list bounds.
[ "Returns", "an", "index", "which", "is", "positive", "but", "may", "be", "out", "of", "the", "factory", "list", "bounds", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/DistributedSocketFactory.java#L267-L280
154
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/net/DistributedSocketFactory.java
DistributedSocketFactory.getFactory
private SocketFactory getFactory(int index) throws ConnectException { synchronized (mFactories) { int size = mFactories.size(); if (size <= 0) { throw new ConnectException("No SocketFactories available"); } return (SocketFactory)mFactories.get(index % size); } }
java
private SocketFactory getFactory(int index) throws ConnectException { synchronized (mFactories) { int size = mFactories.size(); if (size <= 0) { throw new ConnectException("No SocketFactories available"); } return (SocketFactory)mFactories.get(index % size); } }
[ "private", "SocketFactory", "getFactory", "(", "int", "index", ")", "throws", "ConnectException", "{", "synchronized", "(", "mFactories", ")", "{", "int", "size", "=", "mFactories", ".", "size", "(", ")", ";", "if", "(", "size", "<=", "0", ")", "{", "throw", "new", "ConnectException", "(", "\"No SocketFactories available\"", ")", ";", "}", "return", "(", "SocketFactory", ")", "mFactories", ".", "get", "(", "index", "%", "size", ")", ";", "}", "}" ]
The provided index must be positive, but it can be out of the factory list bounds.
[ "The", "provided", "index", "must", "be", "positive", "but", "it", "can", "be", "out", "of", "the", "factory", "list", "bounds", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/DistributedSocketFactory.java#L286-L294
155
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/MapContext.java
MapContext.getKeys
@SuppressWarnings("unchecked") public <K> K[] getKeys(Map<K, ?> map) { K[] result = null; Set<K> keySet = map.keySet(); if (keySet.size() > 0) { result = (K[]) keySet.toArray(new Object[keySet.size()]); } return result; }
java
@SuppressWarnings("unchecked") public <K> K[] getKeys(Map<K, ?> map) { K[] result = null; Set<K> keySet = map.keySet(); if (keySet.size() > 0) { result = (K[]) keySet.toArray(new Object[keySet.size()]); } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "K", ">", "K", "[", "]", "getKeys", "(", "Map", "<", "K", ",", "?", ">", "map", ")", "{", "K", "[", "]", "result", "=", "null", ";", "Set", "<", "K", ">", "keySet", "=", "map", ".", "keySet", "(", ")", ";", "if", "(", "keySet", ".", "size", "(", ")", ">", "0", ")", "{", "result", "=", "(", "K", "[", "]", ")", "keySet", ".", "toArray", "(", "new", "Object", "[", "keySet", ".", "size", "(", ")", "]", ")", ";", "}", "return", "result", ";", "}" ]
Get the array of all keys in the given map. @param <K> The component type of the keys @param map The map to get the keys from @return The array of all keys in the map
[ "Get", "the", "array", "of", "all", "keys", "in", "the", "given", "map", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/MapContext.java#L179-L188
156
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/MapContext.java
MapContext.getKeysAsStrings
public String[] getKeysAsStrings(Map<String, ?> map) { String[] result = null; Set<String> keySet = map.keySet(); int keySize = keySet.size(); if (keySize > 0) { result = keySet.toArray(new String[keySize]); } return result; }
java
public String[] getKeysAsStrings(Map<String, ?> map) { String[] result = null; Set<String> keySet = map.keySet(); int keySize = keySet.size(); if (keySize > 0) { result = keySet.toArray(new String[keySize]); } return result; }
[ "public", "String", "[", "]", "getKeysAsStrings", "(", "Map", "<", "String", ",", "?", ">", "map", ")", "{", "String", "[", "]", "result", "=", "null", ";", "Set", "<", "String", ">", "keySet", "=", "map", ".", "keySet", "(", ")", ";", "int", "keySize", "=", "keySet", ".", "size", "(", ")", ";", "if", "(", "keySize", ">", "0", ")", "{", "result", "=", "keySet", ".", "toArray", "(", "new", "String", "[", "keySize", "]", ")", ";", "}", "return", "result", ";", "}" ]
Get the array of all keys in the given map as strings. This assumes that each key in the given map is a String. @param map The map to get the keys from @return The array of all keys in the map as strings
[ "Get", "the", "array", "of", "all", "keys", "in", "the", "given", "map", "as", "strings", ".", "This", "assumes", "that", "each", "key", "in", "the", "given", "map", "is", "a", "String", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/MapContext.java#L198-L207
157
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/MapContext.java
MapContext.putAll
public <K, V> void putAll(Map<K, V> mapToAddTo, Map<? extends K, ? extends V> mapToAdd) { mapToAddTo.putAll(mapToAdd); }
java
public <K, V> void putAll(Map<K, V> mapToAddTo, Map<? extends K, ? extends V> mapToAdd) { mapToAddTo.putAll(mapToAdd); }
[ "public", "<", "K", ",", "V", ">", "void", "putAll", "(", "Map", "<", "K", ",", "V", ">", "mapToAddTo", ",", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "mapToAdd", ")", "{", "mapToAddTo", ".", "putAll", "(", "mapToAdd", ")", ";", "}" ]
Put all of the given key and value pairs in the given map. @param <K> The component type of the keys @param <V> The component type of the values @param mapToAddTo The map to add the key/value pairs to @param mapToAdd The key/value pairs to put in the map @see Map#putAll(Map)
[ "Put", "all", "of", "the", "given", "key", "and", "value", "pairs", "in", "the", "given", "map", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/MapContext.java#L236-L239
158
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/MapContext.java
MapContext.subMap
public <K, V> SortedMap<K, V> subMap(SortedMap<K, V> map, K fromKey, K toKey) { return map.subMap(fromKey, toKey); }
java
public <K, V> SortedMap<K, V> subMap(SortedMap<K, V> map, K fromKey, K toKey) { return map.subMap(fromKey, toKey); }
[ "public", "<", "K", ",", "V", ">", "SortedMap", "<", "K", ",", "V", ">", "subMap", "(", "SortedMap", "<", "K", ",", "V", ">", "map", ",", "K", "fromKey", ",", "K", "toKey", ")", "{", "return", "map", ".", "subMap", "(", "fromKey", ",", "toKey", ")", ";", "}" ]
Get a portion of the given sorted map from the given fromKey, inclusive, up to, but excluding, the given toKey. The keys are based on the sort algorithm of the keys in the given map. @param <K> The component type of the keys @param <V> The component type of the values @param map The map to retrieve from @param fromKey The key to start from, inclusive @param toKey The key to end at, exclusive @return The portion of the map from the from key to the end key @see SortedMap#subMap(Object, Object)
[ "Get", "a", "portion", "of", "the", "given", "sorted", "map", "from", "the", "given", "fromKey", "inclusive", "up", "to", "but", "excluding", "the", "given", "toKey", ".", "The", "keys", "are", "based", "on", "the", "sort", "algorithm", "of", "the", "keys", "in", "the", "given", "map", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/MapContext.java#L347-L350
159
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/util/StringCompilationProvider.java
StringCompilationProvider.setTemplateSource
public void setTemplateSource(String name, String source) { mTemplateSources.put(name, new TemplateSource(name, source)); }
java
public void setTemplateSource(String name, String source) { mTemplateSources.put(name, new TemplateSource(name, source)); }
[ "public", "void", "setTemplateSource", "(", "String", "name", ",", "String", "source", ")", "{", "mTemplateSources", ".", "put", "(", "name", ",", "new", "TemplateSource", "(", "name", ",", "source", ")", ")", ";", "}" ]
Add or overwrite an existing source for the given fully-qualified dot format of the given template name. @param name The name of the template @param source The source code for the template
[ "Add", "or", "overwrite", "an", "existing", "source", "for", "the", "given", "fully", "-", "qualified", "dot", "format", "of", "the", "given", "template", "name", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/util/StringCompilationProvider.java#L73-L75
160
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/net/CheckedSocket.java
CheckedSocket.check
public static CheckedSocket check(SocketFace socket) throws SocketException { if (socket instanceof CheckedSocket) { return (CheckedSocket)socket; } else { return new CheckedSocket(socket); } }
java
public static CheckedSocket check(SocketFace socket) throws SocketException { if (socket instanceof CheckedSocket) { return (CheckedSocket)socket; } else { return new CheckedSocket(socket); } }
[ "public", "static", "CheckedSocket", "check", "(", "SocketFace", "socket", ")", "throws", "SocketException", "{", "if", "(", "socket", "instanceof", "CheckedSocket", ")", "{", "return", "(", "CheckedSocket", ")", "socket", ";", "}", "else", "{", "return", "new", "CheckedSocket", "(", "socket", ")", ";", "}", "}" ]
Returns a new CheckedSocket instance only if the given socket isn't already one.
[ "Returns", "a", "new", "CheckedSocket", "instance", "only", "if", "the", "given", "socket", "isn", "t", "already", "one", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/CheckedSocket.java#L41-L50
161
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/net/CheckedSocket.java
CheckedSocket.addExceptionListener
public synchronized void addExceptionListener(ExceptionListener listener) { if (mExceptionListeners == null) { mExceptionListeners = new HashSet(); } mExceptionListeners.add(listener); }
java
public synchronized void addExceptionListener(ExceptionListener listener) { if (mExceptionListeners == null) { mExceptionListeners = new HashSet(); } mExceptionListeners.add(listener); }
[ "public", "synchronized", "void", "addExceptionListener", "(", "ExceptionListener", "listener", ")", "{", "if", "(", "mExceptionListeners", "==", "null", ")", "{", "mExceptionListeners", "=", "new", "HashSet", "(", ")", ";", "}", "mExceptionListeners", ".", "add", "(", "listener", ")", ";", "}" ]
Internally, the collection of listeners is saved in a set so that listener instances may be added multiple times without harm.
[ "Internally", "the", "collection", "of", "listeners", "is", "saved", "in", "a", "set", "so", "that", "listener", "instances", "may", "be", "added", "multiple", "times", "without", "harm", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/CheckedSocket.java#L83-L88
162
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/CodeBuilder.java
CodeBuilder.storeLocal
public void storeLocal(LocalVariable local) { if (local == null) { throw new NullPointerException("No local variable specified"); } int stackAdjust = local.getType().isDoubleWord() ? -2 : -1; mInstructions.new StoreLocalInstruction(stackAdjust, local); }
java
public void storeLocal(LocalVariable local) { if (local == null) { throw new NullPointerException("No local variable specified"); } int stackAdjust = local.getType().isDoubleWord() ? -2 : -1; mInstructions.new StoreLocalInstruction(stackAdjust, local); }
[ "public", "void", "storeLocal", "(", "LocalVariable", "local", ")", "{", "if", "(", "local", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"No local variable specified\"", ")", ";", "}", "int", "stackAdjust", "=", "local", ".", "getType", "(", ")", ".", "isDoubleWord", "(", ")", "?", "-", "2", ":", "-", "1", ";", "mInstructions", ".", "new", "StoreLocalInstruction", "(", "stackAdjust", ",", "local", ")", ";", "}" ]
store-from-stack-to-local style instructions
[ "store", "-", "from", "-", "stack", "-", "to", "-", "local", "style", "instructions" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/CodeBuilder.java#L446-L452
163
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/CodeBuilder.java
CodeBuilder.loadFromArray
public void loadFromArray(TypeDesc type) { byte op; int stackAdjust = -1; switch (type.getTypeCode()) { case TypeDesc.INT_CODE: op = Opcode.IALOAD; break; case TypeDesc.BOOLEAN_CODE: case TypeDesc.BYTE_CODE: op = Opcode.BALOAD; break; case TypeDesc.SHORT_CODE: op = Opcode.SALOAD; break; case TypeDesc.CHAR_CODE: op = Opcode.CALOAD; break; case TypeDesc.FLOAT_CODE: op = Opcode.FALOAD; break; case TypeDesc.LONG_CODE: stackAdjust = 0; op = Opcode.LALOAD; break; case TypeDesc.DOUBLE_CODE: stackAdjust = 0; op = Opcode.DALOAD; break; default: op = Opcode.AALOAD; break; } addCode(stackAdjust, op); }
java
public void loadFromArray(TypeDesc type) { byte op; int stackAdjust = -1; switch (type.getTypeCode()) { case TypeDesc.INT_CODE: op = Opcode.IALOAD; break; case TypeDesc.BOOLEAN_CODE: case TypeDesc.BYTE_CODE: op = Opcode.BALOAD; break; case TypeDesc.SHORT_CODE: op = Opcode.SALOAD; break; case TypeDesc.CHAR_CODE: op = Opcode.CALOAD; break; case TypeDesc.FLOAT_CODE: op = Opcode.FALOAD; break; case TypeDesc.LONG_CODE: stackAdjust = 0; op = Opcode.LALOAD; break; case TypeDesc.DOUBLE_CODE: stackAdjust = 0; op = Opcode.DALOAD; break; default: op = Opcode.AALOAD; break; } addCode(stackAdjust, op); }
[ "public", "void", "loadFromArray", "(", "TypeDesc", "type", ")", "{", "byte", "op", ";", "int", "stackAdjust", "=", "-", "1", ";", "switch", "(", "type", ".", "getTypeCode", "(", ")", ")", "{", "case", "TypeDesc", ".", "INT_CODE", ":", "op", "=", "Opcode", ".", "IALOAD", ";", "break", ";", "case", "TypeDesc", ".", "BOOLEAN_CODE", ":", "case", "TypeDesc", ".", "BYTE_CODE", ":", "op", "=", "Opcode", ".", "BALOAD", ";", "break", ";", "case", "TypeDesc", ".", "SHORT_CODE", ":", "op", "=", "Opcode", ".", "SALOAD", ";", "break", ";", "case", "TypeDesc", ".", "CHAR_CODE", ":", "op", "=", "Opcode", ".", "CALOAD", ";", "break", ";", "case", "TypeDesc", ".", "FLOAT_CODE", ":", "op", "=", "Opcode", ".", "FALOAD", ";", "break", ";", "case", "TypeDesc", ".", "LONG_CODE", ":", "stackAdjust", "=", "0", ";", "op", "=", "Opcode", ".", "LALOAD", ";", "break", ";", "case", "TypeDesc", ".", "DOUBLE_CODE", ":", "stackAdjust", "=", "0", ";", "op", "=", "Opcode", ".", "DALOAD", ";", "break", ";", "default", ":", "op", "=", "Opcode", ".", "AALOAD", ";", "break", ";", "}", "addCode", "(", "stackAdjust", ",", "op", ")", ";", "}" ]
load-to-stack-from-array style instructions
[ "load", "-", "to", "-", "stack", "-", "from", "-", "array", "style", "instructions" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/CodeBuilder.java#L456-L491
164
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/CodeBuilder.java
CodeBuilder.storeToArray
public void storeToArray(TypeDesc type) { byte op; int stackAdjust = -3; switch (type.getTypeCode()) { case TypeDesc.INT_CODE: op = Opcode.IASTORE; break; case TypeDesc.BOOLEAN_CODE: case TypeDesc.BYTE_CODE: op = Opcode.BASTORE; break; case TypeDesc.SHORT_CODE: op = Opcode.SASTORE; break; case TypeDesc.CHAR_CODE: op = Opcode.CASTORE; break; case TypeDesc.FLOAT_CODE: op = Opcode.FASTORE; break; case TypeDesc.LONG_CODE: stackAdjust = -4; op = Opcode.LASTORE; break; case TypeDesc.DOUBLE_CODE: stackAdjust = -4; op = Opcode.DASTORE; break; default: op = Opcode.AASTORE; break; } addCode(stackAdjust, op); }
java
public void storeToArray(TypeDesc type) { byte op; int stackAdjust = -3; switch (type.getTypeCode()) { case TypeDesc.INT_CODE: op = Opcode.IASTORE; break; case TypeDesc.BOOLEAN_CODE: case TypeDesc.BYTE_CODE: op = Opcode.BASTORE; break; case TypeDesc.SHORT_CODE: op = Opcode.SASTORE; break; case TypeDesc.CHAR_CODE: op = Opcode.CASTORE; break; case TypeDesc.FLOAT_CODE: op = Opcode.FASTORE; break; case TypeDesc.LONG_CODE: stackAdjust = -4; op = Opcode.LASTORE; break; case TypeDesc.DOUBLE_CODE: stackAdjust = -4; op = Opcode.DASTORE; break; default: op = Opcode.AASTORE; break; } addCode(stackAdjust, op); }
[ "public", "void", "storeToArray", "(", "TypeDesc", "type", ")", "{", "byte", "op", ";", "int", "stackAdjust", "=", "-", "3", ";", "switch", "(", "type", ".", "getTypeCode", "(", ")", ")", "{", "case", "TypeDesc", ".", "INT_CODE", ":", "op", "=", "Opcode", ".", "IASTORE", ";", "break", ";", "case", "TypeDesc", ".", "BOOLEAN_CODE", ":", "case", "TypeDesc", ".", "BYTE_CODE", ":", "op", "=", "Opcode", ".", "BASTORE", ";", "break", ";", "case", "TypeDesc", ".", "SHORT_CODE", ":", "op", "=", "Opcode", ".", "SASTORE", ";", "break", ";", "case", "TypeDesc", ".", "CHAR_CODE", ":", "op", "=", "Opcode", ".", "CASTORE", ";", "break", ";", "case", "TypeDesc", ".", "FLOAT_CODE", ":", "op", "=", "Opcode", ".", "FASTORE", ";", "break", ";", "case", "TypeDesc", ".", "LONG_CODE", ":", "stackAdjust", "=", "-", "4", ";", "op", "=", "Opcode", ".", "LASTORE", ";", "break", ";", "case", "TypeDesc", ".", "DOUBLE_CODE", ":", "stackAdjust", "=", "-", "4", ";", "op", "=", "Opcode", ".", "DASTORE", ";", "break", ";", "default", ":", "op", "=", "Opcode", ".", "AASTORE", ";", "break", ";", "}", "addCode", "(", "stackAdjust", ",", "op", ")", ";", "}" ]
store-to-array-from-stack style instructions
[ "store", "-", "to", "-", "array", "-", "from", "-", "stack", "style", "instructions" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/CodeBuilder.java#L495-L530
165
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/CodeBuilder.java
CodeBuilder.loadField
public void loadField(String fieldName, TypeDesc type) { getfield(0, Opcode.GETFIELD, constantField(fieldName, type), type); }
java
public void loadField(String fieldName, TypeDesc type) { getfield(0, Opcode.GETFIELD, constantField(fieldName, type), type); }
[ "public", "void", "loadField", "(", "String", "fieldName", ",", "TypeDesc", "type", ")", "{", "getfield", "(", "0", ",", "Opcode", ".", "GETFIELD", ",", "constantField", "(", "fieldName", ",", "type", ")", ",", "type", ")", ";", "}" ]
load-field-to-stack style instructions
[ "load", "-", "field", "-", "to", "-", "stack", "style", "instructions" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/CodeBuilder.java#L534-L537
166
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/CodeBuilder.java
CodeBuilder.storeField
public void storeField(String fieldName, TypeDesc type) { putfield(-1, Opcode.PUTFIELD, constantField(fieldName, type), type); }
java
public void storeField(String fieldName, TypeDesc type) { putfield(-1, Opcode.PUTFIELD, constantField(fieldName, type), type); }
[ "public", "void", "storeField", "(", "String", "fieldName", ",", "TypeDesc", "type", ")", "{", "putfield", "(", "-", "1", ",", "Opcode", ".", "PUTFIELD", ",", "constantField", "(", "fieldName", ",", "type", ")", ",", "type", ")", ";", "}" ]
store-to-field-from-stack style instructions
[ "store", "-", "to", "-", "field", "-", "from", "-", "stack", "style", "instructions" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/CodeBuilder.java#L579-L583
167
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/MergedClass.java
MergedClass.buildClassFile
public static ClassFile buildClassFile(String className, Class<?>[] classes, String[] prefixes, int observerMode) throws IllegalArgumentException { return buildClassFile(className, classes, prefixes, null, observerMode); }
java
public static ClassFile buildClassFile(String className, Class<?>[] classes, String[] prefixes, int observerMode) throws IllegalArgumentException { return buildClassFile(className, classes, prefixes, null, observerMode); }
[ "public", "static", "ClassFile", "buildClassFile", "(", "String", "className", ",", "Class", "<", "?", ">", "[", "]", "classes", ",", "String", "[", "]", "prefixes", ",", "int", "observerMode", ")", "throws", "IllegalArgumentException", "{", "return", "buildClassFile", "(", "className", ",", "classes", ",", "prefixes", ",", "null", ",", "observerMode", ")", ";", "}" ]
Just create the bytecode for the merged class, but don't load it. Since no ClassInjector is provided to resolve name conflicts, the class name must be manually provided. An optional implementation of the MethodInvocationEventObserver interface may be supplied. @param className name to give to merged class @param classes Source classes used to derive merged class @param prefixes Optional prefixes to apply to methods of each generated class to eliminate duplicate method names @param observeMethods boolean Enable function call profiling.
[ "Just", "create", "the", "bytecode", "for", "the", "merged", "class", "but", "don", "t", "load", "it", ".", "Since", "no", "ClassInjector", "is", "provided", "to", "resolve", "name", "conflicts", "the", "class", "name", "must", "be", "manually", "provided", ".", "An", "optional", "implementation", "of", "the", "MethodInvocationEventObserver", "interface", "may", "be", "supplied", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/MergedClass.java#L468-L475
168
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/MergedClass.java
MergedClass.getMergedClass
private static synchronized Class<?> getMergedClass(ClassInjector injector, ClassEntry[] classEntries, Class<?>[] interfaces, int observerMode) throws IllegalArgumentException { Map<MultiKey, String> classListMap = cMergedMap.get(injector); if (classListMap == null) { classListMap = new HashMap<MultiKey, String>(7); cMergedMap.put(injector, classListMap); } MultiKey key = generateKey(classEntries); String mergedName = classListMap.get(key); if (mergedName != null) { try { return injector.loadClass(mergedName); } catch (ClassNotFoundException e) { } } ClassFile cf; try { cf = buildClassFile(injector, null, classEntries, interfaces, observerMode); } catch (IllegalArgumentException e) { e.fillInStackTrace(); throw e; } try { OutputStream stream = injector.getStream(cf.getClassName()); cf.writeTo(stream); stream.close(); } catch (Throwable e) { String output = outputClassToFile(cf); throw new RuntimeException( "Error generating merged class, contents saved to: " + output, e ); } if (DEBUG) { String output = outputClassToFile(cf); System.out.println("Saved merged class to: " + output); } Class<?> merged; try { merged = injector.loadClass(cf.getClassName()); } catch (ClassNotFoundException e) { throw new InternalError(e.toString()); } classListMap.put(key, merged.getName()); return merged; }
java
private static synchronized Class<?> getMergedClass(ClassInjector injector, ClassEntry[] classEntries, Class<?>[] interfaces, int observerMode) throws IllegalArgumentException { Map<MultiKey, String> classListMap = cMergedMap.get(injector); if (classListMap == null) { classListMap = new HashMap<MultiKey, String>(7); cMergedMap.put(injector, classListMap); } MultiKey key = generateKey(classEntries); String mergedName = classListMap.get(key); if (mergedName != null) { try { return injector.loadClass(mergedName); } catch (ClassNotFoundException e) { } } ClassFile cf; try { cf = buildClassFile(injector, null, classEntries, interfaces, observerMode); } catch (IllegalArgumentException e) { e.fillInStackTrace(); throw e; } try { OutputStream stream = injector.getStream(cf.getClassName()); cf.writeTo(stream); stream.close(); } catch (Throwable e) { String output = outputClassToFile(cf); throw new RuntimeException( "Error generating merged class, contents saved to: " + output, e ); } if (DEBUG) { String output = outputClassToFile(cf); System.out.println("Saved merged class to: " + output); } Class<?> merged; try { merged = injector.loadClass(cf.getClassName()); } catch (ClassNotFoundException e) { throw new InternalError(e.toString()); } classListMap.put(key, merged.getName()); return merged; }
[ "private", "static", "synchronized", "Class", "<", "?", ">", "getMergedClass", "(", "ClassInjector", "injector", ",", "ClassEntry", "[", "]", "classEntries", ",", "Class", "<", "?", ">", "[", "]", "interfaces", ",", "int", "observerMode", ")", "throws", "IllegalArgumentException", "{", "Map", "<", "MultiKey", ",", "String", ">", "classListMap", "=", "cMergedMap", ".", "get", "(", "injector", ")", ";", "if", "(", "classListMap", "==", "null", ")", "{", "classListMap", "=", "new", "HashMap", "<", "MultiKey", ",", "String", ">", "(", "7", ")", ";", "cMergedMap", ".", "put", "(", "injector", ",", "classListMap", ")", ";", "}", "MultiKey", "key", "=", "generateKey", "(", "classEntries", ")", ";", "String", "mergedName", "=", "classListMap", ".", "get", "(", "key", ")", ";", "if", "(", "mergedName", "!=", "null", ")", "{", "try", "{", "return", "injector", ".", "loadClass", "(", "mergedName", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "}", "}", "ClassFile", "cf", ";", "try", "{", "cf", "=", "buildClassFile", "(", "injector", ",", "null", ",", "classEntries", ",", "interfaces", ",", "observerMode", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "e", ".", "fillInStackTrace", "(", ")", ";", "throw", "e", ";", "}", "try", "{", "OutputStream", "stream", "=", "injector", ".", "getStream", "(", "cf", ".", "getClassName", "(", ")", ")", ";", "cf", ".", "writeTo", "(", "stream", ")", ";", "stream", ".", "close", "(", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "String", "output", "=", "outputClassToFile", "(", "cf", ")", ";", "throw", "new", "RuntimeException", "(", "\"Error generating merged class, contents saved to: \"", "+", "output", ",", "e", ")", ";", "}", "if", "(", "DEBUG", ")", "{", "String", "output", "=", "outputClassToFile", "(", "cf", ")", ";", "System", ".", "out", ".", "println", "(", "\"Saved merged class to: \"", "+", "output", ")", ";", "}", "Class", "<", "?", ">", "merged", ";", "try", "{", "merged", "=", "injector", ".", "loadClass", "(", "cf", ".", "getClassName", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "InternalError", "(", "e", ".", "toString", "(", ")", ")", ";", "}", "classListMap", ".", "put", "(", "key", ",", "merged", ".", "getName", "(", ")", ")", ";", "return", "merged", ";", "}" ]
Creates a class with a public constructor whose parameter types match the given source classes. Another constructor is also created that accepts an InstanceFactory.
[ "Creates", "a", "class", "with", "a", "public", "constructor", "whose", "parameter", "types", "match", "the", "given", "source", "classes", ".", "Another", "constructor", "is", "also", "created", "that", "accepts", "an", "InstanceFactory", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/MergedClass.java#L548-L608
169
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/LogEvent.java
LogEvent.getExceptionStackTrace
public String getExceptionStackTrace() { Throwable t = getException(); if (t == null) { return null; } StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); return sw.toString(); }
java
public String getExceptionStackTrace() { Throwable t = getException(); if (t == null) { return null; } StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); return sw.toString(); }
[ "public", "String", "getExceptionStackTrace", "(", ")", "{", "Throwable", "t", "=", "getException", "(", ")", ";", "if", "(", "t", "==", "null", ")", "{", "return", "null", ";", "}", "StringWriter", "sw", "=", "new", "StringWriter", "(", ")", ";", "PrintWriter", "pw", "=", "new", "PrintWriter", "(", "sw", ")", ";", "t", ".", "printStackTrace", "(", "pw", ")", ";", "return", "sw", ".", "toString", "(", ")", ";", "}" ]
Returns null if there is no exception logged.
[ "Returns", "null", "if", "there", "is", "no", "exception", "logged", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/LogEvent.java#L169-L178
170
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/LogEvent.java
LogEvent.getThreadName
public String getThreadName() { if (mThreadName == null) { Thread t = getThread(); if (t != null) { mThreadName = t.getName(); } } return mThreadName; }
java
public String getThreadName() { if (mThreadName == null) { Thread t = getThread(); if (t != null) { mThreadName = t.getName(); } } return mThreadName; }
[ "public", "String", "getThreadName", "(", ")", "{", "if", "(", "mThreadName", "==", "null", ")", "{", "Thread", "t", "=", "getThread", "(", ")", ";", "if", "(", "t", "!=", "null", ")", "{", "mThreadName", "=", "t", ".", "getName", "(", ")", ";", "}", "}", "return", "mThreadName", ";", "}" ]
Returns the name of the thread that created this event.
[ "Returns", "the", "name", "of", "the", "thread", "that", "created", "this", "event", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/LogEvent.java#L183-L191
171
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java
FileSystemContext.deleteFile
public boolean deleteFile(String filePath) throws IOException { boolean result = false; // synchronized on an interned string makes has all the // makings for exclusive write access as far as this // process is concerned. String path = (String) Utils.intern(filePath); synchronized (path) { File file = null; try { file = new File(path); if (file.exists()) { if (file.canWrite()) { result = file.delete(); } else { String msg = "Can not delete write locked file (" + filePath + ")"; mLog.warn(msg); throw new IOException(msg); } } else { String msg = "Cannot delete non-existant file (" + filePath + ")"; mLog.warn(msg); throw new IOException(msg); } } catch (IOException e) { mLog.error("Error deleting: " + filePath); mLog.error(e); throw e; } } return result; }
java
public boolean deleteFile(String filePath) throws IOException { boolean result = false; // synchronized on an interned string makes has all the // makings for exclusive write access as far as this // process is concerned. String path = (String) Utils.intern(filePath); synchronized (path) { File file = null; try { file = new File(path); if (file.exists()) { if (file.canWrite()) { result = file.delete(); } else { String msg = "Can not delete write locked file (" + filePath + ")"; mLog.warn(msg); throw new IOException(msg); } } else { String msg = "Cannot delete non-existant file (" + filePath + ")"; mLog.warn(msg); throw new IOException(msg); } } catch (IOException e) { mLog.error("Error deleting: " + filePath); mLog.error(e); throw e; } } return result; }
[ "public", "boolean", "deleteFile", "(", "String", "filePath", ")", "throws", "IOException", "{", "boolean", "result", "=", "false", ";", "// synchronized on an interned string makes has all the", "// makings for exclusive write access as far as this", "// process is concerned.", "String", "path", "=", "(", "String", ")", "Utils", ".", "intern", "(", "filePath", ")", ";", "synchronized", "(", "path", ")", "{", "File", "file", "=", "null", ";", "try", "{", "file", "=", "new", "File", "(", "path", ")", ";", "if", "(", "file", ".", "exists", "(", ")", ")", "{", "if", "(", "file", ".", "canWrite", "(", ")", ")", "{", "result", "=", "file", ".", "delete", "(", ")", ";", "}", "else", "{", "String", "msg", "=", "\"Can not delete write locked file (\"", "+", "filePath", "+", "\")\"", ";", "mLog", ".", "warn", "(", "msg", ")", ";", "throw", "new", "IOException", "(", "msg", ")", ";", "}", "}", "else", "{", "String", "msg", "=", "\"Cannot delete non-existant file (\"", "+", "filePath", "+", "\")\"", ";", "mLog", ".", "warn", "(", "msg", ")", ";", "throw", "new", "IOException", "(", "msg", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "mLog", ".", "error", "(", "\"Error deleting: \"", "+", "filePath", ")", ";", "mLog", ".", "error", "(", "e", ")", ";", "throw", "e", ";", "}", "}", "return", "result", ";", "}" ]
Delete the file at the given path. @param filePath The path of the file to delete @return <code>true</code> if the file was deleted, <code>false</code> otherwise @throws IOException if the file does not exist, cannot be written, or if an error occurs during deletion
[ "Delete", "the", "file", "at", "the", "given", "path", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java#L63-L97
172
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java
FileSystemContext.listFiles
public File[] listFiles(String directoryPath) { File[] result = null; File directory = null; directory = new File(directoryPath); if (directory.isDirectory()) { result = directory.listFiles(); } return result; }
java
public File[] listFiles(String directoryPath) { File[] result = null; File directory = null; directory = new File(directoryPath); if (directory.isDirectory()) { result = directory.listFiles(); } return result; }
[ "public", "File", "[", "]", "listFiles", "(", "String", "directoryPath", ")", "{", "File", "[", "]", "result", "=", "null", ";", "File", "directory", "=", "null", ";", "directory", "=", "new", "File", "(", "directoryPath", ")", ";", "if", "(", "directory", ".", "isDirectory", "(", ")", ")", "{", "result", "=", "directory", ".", "listFiles", "(", ")", ";", "}", "return", "result", ";", "}" ]
Get the list of files within the given directory. This only returns the files in the immediate directory and is not recursive. @param directoryPath The path of the directory @return The list of files in the directory @see File#listFiles()
[ "Get", "the", "list", "of", "files", "within", "the", "given", "directory", ".", "This", "only", "returns", "the", "files", "in", "the", "immediate", "directory", "and", "is", "not", "recursive", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java#L203-L211
173
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java
FileSystemContext.readFileAsString
public String readFileAsString(String filePath) throws IOException { String result = null; Reader reader = new BufferedReader(new FileReader(filePath)); StringBuilder stringBuffer = new StringBuilder(4096); int charRead = -1; while ((charRead = reader.read()) >= 0) { stringBuffer.append((char) charRead); } reader.close(); result = stringBuffer.toString(); return result; }
java
public String readFileAsString(String filePath) throws IOException { String result = null; Reader reader = new BufferedReader(new FileReader(filePath)); StringBuilder stringBuffer = new StringBuilder(4096); int charRead = -1; while ((charRead = reader.read()) >= 0) { stringBuffer.append((char) charRead); } reader.close(); result = stringBuffer.toString(); return result; }
[ "public", "String", "readFileAsString", "(", "String", "filePath", ")", "throws", "IOException", "{", "String", "result", "=", "null", ";", "Reader", "reader", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "filePath", ")", ")", ";", "StringBuilder", "stringBuffer", "=", "new", "StringBuilder", "(", "4096", ")", ";", "int", "charRead", "=", "-", "1", ";", "while", "(", "(", "charRead", "=", "reader", ".", "read", "(", ")", ")", ">=", "0", ")", "{", "stringBuffer", ".", "append", "(", "(", "char", ")", "charRead", ")", ";", "}", "reader", ".", "close", "(", ")", ";", "result", "=", "stringBuffer", ".", "toString", "(", ")", ";", "return", "result", ";", "}" ]
Read the contents of the given file and return the value as a string. @param filePath The path to the file to read @return The contents of the file as a string @throws IOException if an error occurs reading the file
[ "Read", "the", "contents", "of", "the", "given", "file", "and", "return", "the", "value", "as", "a", "string", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java#L222-L237
174
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java
FileSystemContext.writeToFile
public void writeToFile(String filePath, String fileData) throws IOException { writeToFile(filePath, fileData, false); }
java
public void writeToFile(String filePath, String fileData) throws IOException { writeToFile(filePath, fileData, false); }
[ "public", "void", "writeToFile", "(", "String", "filePath", ",", "String", "fileData", ")", "throws", "IOException", "{", "writeToFile", "(", "filePath", ",", "fileData", ",", "false", ")", ";", "}" ]
Write the contents of the given file data to the file at the given path. This will replace any existing data. @param filePath The path to the file to write to @param fileData The data to write to the given file @throws IOException if an error occurs writing the data @see #writeToFile(String, String, boolean)
[ "Write", "the", "contents", "of", "the", "given", "file", "data", "to", "the", "file", "at", "the", "given", "path", ".", "This", "will", "replace", "any", "existing", "data", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java#L250-L254
175
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java
FileSystemContext.getFileBytes
public byte[] getFileBytes(String filePath) throws IOException { byte[] out = null; String path = (String) Utils.intern(filePath); RandomAccessFile raf = null; synchronized (path) { File file = null; try { file = new File(path); boolean exists = file.exists(); if (exists) { byte[] fileBytes = new byte[(int)file.length()]; raf = new RandomAccessFile(file,"r"); raf.readFully(fileBytes); out = fileBytes; } else { String msg = "File does not exist. (" + filePath + ")"; mLog.error(msg); throw new IOException(msg); } } catch (IOException e) { mLog.error("Error writing: " + filePath); mLog.error(e); throw e; } finally { if (raf != null) { raf.close(); } } } return out; }
java
public byte[] getFileBytes(String filePath) throws IOException { byte[] out = null; String path = (String) Utils.intern(filePath); RandomAccessFile raf = null; synchronized (path) { File file = null; try { file = new File(path); boolean exists = file.exists(); if (exists) { byte[] fileBytes = new byte[(int)file.length()]; raf = new RandomAccessFile(file,"r"); raf.readFully(fileBytes); out = fileBytes; } else { String msg = "File does not exist. (" + filePath + ")"; mLog.error(msg); throw new IOException(msg); } } catch (IOException e) { mLog.error("Error writing: " + filePath); mLog.error(e); throw e; } finally { if (raf != null) { raf.close(); } } } return out; }
[ "public", "byte", "[", "]", "getFileBytes", "(", "String", "filePath", ")", "throws", "IOException", "{", "byte", "[", "]", "out", "=", "null", ";", "String", "path", "=", "(", "String", ")", "Utils", ".", "intern", "(", "filePath", ")", ";", "RandomAccessFile", "raf", "=", "null", ";", "synchronized", "(", "path", ")", "{", "File", "file", "=", "null", ";", "try", "{", "file", "=", "new", "File", "(", "path", ")", ";", "boolean", "exists", "=", "file", ".", "exists", "(", ")", ";", "if", "(", "exists", ")", "{", "byte", "[", "]", "fileBytes", "=", "new", "byte", "[", "(", "int", ")", "file", ".", "length", "(", ")", "]", ";", "raf", "=", "new", "RandomAccessFile", "(", "file", ",", "\"r\"", ")", ";", "raf", ".", "readFully", "(", "fileBytes", ")", ";", "out", "=", "fileBytes", ";", "}", "else", "{", "String", "msg", "=", "\"File does not exist. (\"", "+", "filePath", "+", "\")\"", ";", "mLog", ".", "error", "(", "msg", ")", ";", "throw", "new", "IOException", "(", "msg", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "mLog", ".", "error", "(", "\"Error writing: \"", "+", "filePath", ")", ";", "mLog", ".", "error", "(", "e", ")", ";", "throw", "e", ";", "}", "finally", "{", "if", "(", "raf", "!=", "null", ")", "{", "raf", ".", "close", "(", ")", ";", "}", "}", "}", "return", "out", ";", "}" ]
Read the contents of the file at the given path and return the associated byte array. @param filePath The path to the file to read @return The contents of the file @throws IOException if an error occurs reading the file
[ "Read", "the", "contents", "of", "the", "file", "at", "the", "given", "path", "and", "return", "the", "associated", "byte", "array", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/FileSystemContext.java#L385-L418
176
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/PropertyMap.java
PropertyMap.getInteger
public Integer getInteger(String key, Integer def) { String value = getString(key); if (value == null) { return def; } else { try { return Integer.valueOf(value); } catch (NumberFormatException e) { } return def; } }
java
public Integer getInteger(String key, Integer def) { String value = getString(key); if (value == null) { return def; } else { try { return Integer.valueOf(value); } catch (NumberFormatException e) { } return def; } }
[ "public", "Integer", "getInteger", "(", "String", "key", ",", "Integer", "def", ")", "{", "String", "value", "=", "getString", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "def", ";", "}", "else", "{", "try", "{", "return", "Integer", ".", "valueOf", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "}", "return", "def", ";", "}", "}" ]
Returns the default value if the given key isn't in this PropertyMap or it isn't a valid integer. @param key Key of property to read @param def Default value
[ "Returns", "the", "default", "value", "if", "the", "given", "key", "isn", "t", "in", "this", "PropertyMap", "or", "it", "isn", "t", "a", "valid", "integer", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/PropertyMap.java#L312-L325
177
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/PropertyMap.java
PropertyMap.getNumber
public Number getNumber(String key) throws NumberFormatException { String value = getString(key); if (value == null) { return null; } else { try { return Integer.valueOf(value); } catch (NumberFormatException e) { } try { return Long.valueOf(value); } catch (NumberFormatException e) { } return Double.valueOf(value); } }
java
public Number getNumber(String key) throws NumberFormatException { String value = getString(key); if (value == null) { return null; } else { try { return Integer.valueOf(value); } catch (NumberFormatException e) { } try { return Long.valueOf(value); } catch (NumberFormatException e) { } return Double.valueOf(value); } }
[ "public", "Number", "getNumber", "(", "String", "key", ")", "throws", "NumberFormatException", "{", "String", "value", "=", "getString", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "try", "{", "return", "Integer", ".", "valueOf", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "}", "try", "{", "return", "Long", ".", "valueOf", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "}", "return", "Double", ".", "valueOf", "(", "value", ")", ";", "}", "}" ]
Returns null if the given key isn't in this PropertyMap. @param key Key of property to read
[ "Returns", "null", "if", "the", "given", "key", "isn", "t", "in", "this", "PropertyMap", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/PropertyMap.java#L332-L350
178
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/PropertyMap.java
PropertyMap.getBoolean
public boolean getBoolean(String key, boolean def) { String value = getString(key); if (value == null) { return def; } else { return "true".equalsIgnoreCase(value); } }
java
public boolean getBoolean(String key, boolean def) { String value = getString(key); if (value == null) { return def; } else { return "true".equalsIgnoreCase(value); } }
[ "public", "boolean", "getBoolean", "(", "String", "key", ",", "boolean", "def", ")", "{", "String", "value", "=", "getString", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "def", ";", "}", "else", "{", "return", "\"true\"", ".", "equalsIgnoreCase", "(", "value", ")", ";", "}", "}" ]
Returns the default value if the given key isn't in this PropertyMap or if the the value isn't equal to "true", ignoring case. @param key Key of property to read @param def Default value
[ "Returns", "the", "default", "value", "if", "the", "given", "key", "isn", "t", "in", "this", "PropertyMap", "or", "if", "the", "the", "value", "isn", "t", "equal", "to", "true", "ignoring", "case", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/PropertyMap.java#L400-L408
179
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/PropertyMap.java
PropertyMap.putDefaults
public void putDefaults(Map map) { Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry)it.next(); Object key = entry.getKey(); if (!containsKey(key)) { put(key, entry.getValue()); } } }
java
public void putDefaults(Map map) { Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry)it.next(); Object key = entry.getKey(); if (!containsKey(key)) { put(key, entry.getValue()); } } }
[ "public", "void", "putDefaults", "(", "Map", "map", ")", "{", "Iterator", "it", "=", "map", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "it", ".", "next", "(", ")", ";", "Object", "key", "=", "entry", ".", "getKey", "(", ")", ";", "if", "(", "!", "containsKey", "(", "key", ")", ")", "{", "put", "(", "key", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "}" ]
Copies the entries of the given map into this one only for keys that aren't contained in this map. Is equivalent to putAll if this map is empty.
[ "Copies", "the", "entries", "of", "the", "given", "map", "into", "this", "one", "only", "for", "keys", "that", "aren", "t", "contained", "in", "this", "map", ".", "Is", "equivalent", "to", "putAll", "if", "this", "map", "is", "empty", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/PropertyMap.java#L466-L475
180
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/IntervalLogStream.java
IntervalLogStream.startAutoRollover
public synchronized void startAutoRollover() { // TODO: If java.util.Timer class is available, use it instead of // creating a thread each time. if (mRolloverThread == null) { mRolloverThread = new Thread(new AutoRollover(this), nextName()); mRolloverThread.setDaemon(true); mRolloverThread.start(); } }
java
public synchronized void startAutoRollover() { // TODO: If java.util.Timer class is available, use it instead of // creating a thread each time. if (mRolloverThread == null) { mRolloverThread = new Thread(new AutoRollover(this), nextName()); mRolloverThread.setDaemon(true); mRolloverThread.start(); } }
[ "public", "synchronized", "void", "startAutoRollover", "(", ")", "{", "// TODO: If java.util.Timer class is available, use it instead of", "// creating a thread each time.", "if", "(", "mRolloverThread", "==", "null", ")", "{", "mRolloverThread", "=", "new", "Thread", "(", "new", "AutoRollover", "(", "this", ")", ",", "nextName", "(", ")", ")", ";", "mRolloverThread", ".", "setDaemon", "(", "true", ")", ";", "mRolloverThread", ".", "start", "(", ")", ";", "}", "}" ]
Starts up a thread that automatically rolls the underlying OutputStream at the beginning of the interval, even if no output is written.
[ "Starts", "up", "a", "thread", "that", "automatically", "rolls", "the", "underlying", "OutputStream", "at", "the", "beginning", "of", "the", "interval", "even", "if", "no", "output", "is", "written", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/IntervalLogStream.java#L55-L63
181
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/LocationRangeSet.java
LocationRangeSet.reduce
public static SortedSet reduce(SortedSet locations) { SortedSet newSet = new TreeSet(); Iterator it = locations.iterator(); while (it.hasNext()) { LocationRange next = (LocationRange)it.next(); if (newSet.size() == 0) { newSet.add(next); continue; } if (next.getStartLocation().compareTo (next.getEndLocation()) >= 0) { continue; } // Try to reduce the set by joining adjacent ranges or eliminating // overlap. LocationRange last = (LocationRange)newSet.last(); if (next.getStartLocation().compareTo (last.getEndLocation()) <= 0) { if (last.getEndLocation().compareTo (next.getEndLocation()) <= 0) { newSet.remove(last); newSet.add(new LocationRangeImpl(last, next)); } continue; } newSet.add(next); } return newSet; }
java
public static SortedSet reduce(SortedSet locations) { SortedSet newSet = new TreeSet(); Iterator it = locations.iterator(); while (it.hasNext()) { LocationRange next = (LocationRange)it.next(); if (newSet.size() == 0) { newSet.add(next); continue; } if (next.getStartLocation().compareTo (next.getEndLocation()) >= 0) { continue; } // Try to reduce the set by joining adjacent ranges or eliminating // overlap. LocationRange last = (LocationRange)newSet.last(); if (next.getStartLocation().compareTo (last.getEndLocation()) <= 0) { if (last.getEndLocation().compareTo (next.getEndLocation()) <= 0) { newSet.remove(last); newSet.add(new LocationRangeImpl(last, next)); } continue; } newSet.add(next); } return newSet; }
[ "public", "static", "SortedSet", "reduce", "(", "SortedSet", "locations", ")", "{", "SortedSet", "newSet", "=", "new", "TreeSet", "(", ")", ";", "Iterator", "it", "=", "locations", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "LocationRange", "next", "=", "(", "LocationRange", ")", "it", ".", "next", "(", ")", ";", "if", "(", "newSet", ".", "size", "(", ")", "==", "0", ")", "{", "newSet", ".", "add", "(", "next", ")", ";", "continue", ";", "}", "if", "(", "next", ".", "getStartLocation", "(", ")", ".", "compareTo", "(", "next", ".", "getEndLocation", "(", ")", ")", ">=", "0", ")", "{", "continue", ";", "}", "// Try to reduce the set by joining adjacent ranges or eliminating", "// overlap.", "LocationRange", "last", "=", "(", "LocationRange", ")", "newSet", ".", "last", "(", ")", ";", "if", "(", "next", ".", "getStartLocation", "(", ")", ".", "compareTo", "(", "last", ".", "getEndLocation", "(", ")", ")", "<=", "0", ")", "{", "if", "(", "last", ".", "getEndLocation", "(", ")", ".", "compareTo", "(", "next", ".", "getEndLocation", "(", ")", ")", "<=", "0", ")", "{", "newSet", ".", "remove", "(", "last", ")", ";", "newSet", ".", "add", "(", "new", "LocationRangeImpl", "(", "last", ",", "next", ")", ")", ";", "}", "continue", ";", "}", "newSet", ".", "add", "(", "next", ")", ";", "}", "return", "newSet", ";", "}" ]
Reduces a set of LocationRange objects.
[ "Reduces", "a", "set", "of", "LocationRange", "objects", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/LocationRangeSet.java#L31-L69
182
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.createPropertyDescriptions
public PropertyDescription[] createPropertyDescriptions( PropertyDescriptor[] pds) { if (pds == null) { return null; } PropertyDescription[] descriptions = new PropertyDescription[pds.length]; for (int i = 0; i < pds.length; i++) { descriptions[i] = new PropertyDescription(pds[i], this); } return descriptions; }
java
public PropertyDescription[] createPropertyDescriptions( PropertyDescriptor[] pds) { if (pds == null) { return null; } PropertyDescription[] descriptions = new PropertyDescription[pds.length]; for (int i = 0; i < pds.length; i++) { descriptions[i] = new PropertyDescription(pds[i], this); } return descriptions; }
[ "public", "PropertyDescription", "[", "]", "createPropertyDescriptions", "(", "PropertyDescriptor", "[", "]", "pds", ")", "{", "if", "(", "pds", "==", "null", ")", "{", "return", "null", ";", "}", "PropertyDescription", "[", "]", "descriptions", "=", "new", "PropertyDescription", "[", "pds", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pds", ".", "length", ";", "i", "++", ")", "{", "descriptions", "[", "i", "]", "=", "new", "PropertyDescription", "(", "pds", "[", "i", "]", ",", "this", ")", ";", "}", "return", "descriptions", ";", "}" ]
Returns an array of PropertyDescriptions to wrap and describe the specified PropertyDescriptors.
[ "Returns", "an", "array", "of", "PropertyDescriptions", "to", "wrap", "and", "describe", "the", "specified", "PropertyDescriptors", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L105-L120
183
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.createMethodDescriptions
public MethodDescription[] createMethodDescriptions( MethodDescriptor[] mds) { if (mds == null) { return null; } MethodDescription[] descriptions = new MethodDescription[mds.length]; for (int i = 0; i < mds.length; i++) { descriptions[i] = new MethodDescription(mds[i], this); } return descriptions; }
java
public MethodDescription[] createMethodDescriptions( MethodDescriptor[] mds) { if (mds == null) { return null; } MethodDescription[] descriptions = new MethodDescription[mds.length]; for (int i = 0; i < mds.length; i++) { descriptions[i] = new MethodDescription(mds[i], this); } return descriptions; }
[ "public", "MethodDescription", "[", "]", "createMethodDescriptions", "(", "MethodDescriptor", "[", "]", "mds", ")", "{", "if", "(", "mds", "==", "null", ")", "{", "return", "null", ";", "}", "MethodDescription", "[", "]", "descriptions", "=", "new", "MethodDescription", "[", "mds", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mds", ".", "length", ";", "i", "++", ")", "{", "descriptions", "[", "i", "]", "=", "new", "MethodDescription", "(", "mds", "[", "i", "]", ",", "this", ")", ";", "}", "return", "descriptions", ";", "}" ]
Returns an array of MethodDescriptions to wrap and describe the specified MethodDescriptors.
[ "Returns", "an", "array", "of", "MethodDescriptions", "to", "wrap", "and", "describe", "the", "specified", "MethodDescriptors", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L126-L140
184
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.createParameterDescriptions
public ParameterDescription[] createParameterDescriptions( MethodDescriptor md) { if (md == null) { return null; } Method method = md.getMethod(); Class<?>[] paramClasses = method.getParameterTypes(); int descriptionCount = paramClasses.length; if (acceptsSubstitution(md)) { descriptionCount--; } ParameterDescriptor[] pds = md.getParameterDescriptors(); ParameterDescription[] descriptions = new ParameterDescription[descriptionCount]; for (int i = 0; i < descriptions.length; i++) { TypeDescription type = createTypeDescription(paramClasses[i]); ParameterDescriptor pd = null; if (pds != null && i < pds.length) { pd = pds[i]; } descriptions[i] = new ParameterDescription(type, pd, this); } return descriptions; }
java
public ParameterDescription[] createParameterDescriptions( MethodDescriptor md) { if (md == null) { return null; } Method method = md.getMethod(); Class<?>[] paramClasses = method.getParameterTypes(); int descriptionCount = paramClasses.length; if (acceptsSubstitution(md)) { descriptionCount--; } ParameterDescriptor[] pds = md.getParameterDescriptors(); ParameterDescription[] descriptions = new ParameterDescription[descriptionCount]; for (int i = 0; i < descriptions.length; i++) { TypeDescription type = createTypeDescription(paramClasses[i]); ParameterDescriptor pd = null; if (pds != null && i < pds.length) { pd = pds[i]; } descriptions[i] = new ParameterDescription(type, pd, this); } return descriptions; }
[ "public", "ParameterDescription", "[", "]", "createParameterDescriptions", "(", "MethodDescriptor", "md", ")", "{", "if", "(", "md", "==", "null", ")", "{", "return", "null", ";", "}", "Method", "method", "=", "md", ".", "getMethod", "(", ")", ";", "Class", "<", "?", ">", "[", "]", "paramClasses", "=", "method", ".", "getParameterTypes", "(", ")", ";", "int", "descriptionCount", "=", "paramClasses", ".", "length", ";", "if", "(", "acceptsSubstitution", "(", "md", ")", ")", "{", "descriptionCount", "--", ";", "}", "ParameterDescriptor", "[", "]", "pds", "=", "md", ".", "getParameterDescriptors", "(", ")", ";", "ParameterDescription", "[", "]", "descriptions", "=", "new", "ParameterDescription", "[", "descriptionCount", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "descriptions", ".", "length", ";", "i", "++", ")", "{", "TypeDescription", "type", "=", "createTypeDescription", "(", "paramClasses", "[", "i", "]", ")", ";", "ParameterDescriptor", "pd", "=", "null", ";", "if", "(", "pds", "!=", "null", "&&", "i", "<", "pds", ".", "length", ")", "{", "pd", "=", "pds", "[", "i", "]", ";", "}", "descriptions", "[", "i", "]", "=", "new", "ParameterDescription", "(", "type", ",", "pd", ",", "this", ")", ";", "}", "return", "descriptions", ";", "}" ]
Returns an array of ParameterDescriptions to wrap and describe the parameters of the specified MethodDescriptor.
[ "Returns", "an", "array", "of", "ParameterDescriptions", "to", "wrap", "and", "describe", "the", "parameters", "of", "the", "specified", "MethodDescriptor", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L146-L175
185
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.getFullClassName
public String getFullClassName(String fullClassName) { String[] parts = parseClassName(fullClassName); String className = getInnerClassName(parts[1]); if (parts[0] != null) { // Return the package name plus the converted class name return parts[0] + '.' + className; } else { return className; } }
java
public String getFullClassName(String fullClassName) { String[] parts = parseClassName(fullClassName); String className = getInnerClassName(parts[1]); if (parts[0] != null) { // Return the package name plus the converted class name return parts[0] + '.' + className; } else { return className; } }
[ "public", "String", "getFullClassName", "(", "String", "fullClassName", ")", "{", "String", "[", "]", "parts", "=", "parseClassName", "(", "fullClassName", ")", ";", "String", "className", "=", "getInnerClassName", "(", "parts", "[", "1", "]", ")", ";", "if", "(", "parts", "[", "0", "]", "!=", "null", ")", "{", "// Return the package name plus the converted class name", "return", "parts", "[", "0", "]", "+", "'", "'", "+", "className", ";", "}", "else", "{", "return", "className", ";", "}", "}" ]
Returns the full class name of the specified class. This method provides special formatting for inner classes.
[ "Returns", "the", "full", "class", "name", "of", "the", "specified", "class", ".", "This", "method", "provides", "special", "formatting", "for", "inner", "classes", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L320-L333
186
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.getArrayClassName
public String getArrayClassName(Class<?> clazz) { if (clazz.isArray()) { return getArrayClassName(clazz.getComponentType()) + "[]"; } return clazz.getName(); }
java
public String getArrayClassName(Class<?> clazz) { if (clazz.isArray()) { return getArrayClassName(clazz.getComponentType()) + "[]"; } return clazz.getName(); }
[ "public", "String", "getArrayClassName", "(", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", ".", "isArray", "(", ")", ")", "{", "return", "getArrayClassName", "(", "clazz", ".", "getComponentType", "(", ")", ")", "+", "\"[]\"", ";", "}", "return", "clazz", ".", "getName", "(", ")", ";", "}" ]
Formats the class name with trailing square brackets.
[ "Formats", "the", "class", "name", "with", "trailing", "square", "brackets", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L478-L485
187
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.getArrayType
public Class<?> getArrayType(Class<?> clazz) { if (clazz.isArray()) { return getArrayType(clazz.getComponentType()); } return clazz; }
java
public Class<?> getArrayType(Class<?> clazz) { if (clazz.isArray()) { return getArrayType(clazz.getComponentType()); } return clazz; }
[ "public", "Class", "<", "?", ">", "getArrayType", "(", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", ".", "isArray", "(", ")", ")", "{", "return", "getArrayType", "(", "clazz", ".", "getComponentType", "(", ")", ")", ";", "}", "return", "clazz", ";", "}" ]
Returns the array type. Returns the specified class if it is not an array.
[ "Returns", "the", "array", "type", ".", "Returns", "the", "specified", "class", "if", "it", "is", "not", "an", "array", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L491-L498
188
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.getBeanInfo
public BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass) throws IntrospectionException { return Introspector.getBeanInfo(beanClass, stopClass); }
java
public BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass) throws IntrospectionException { return Introspector.getBeanInfo(beanClass, stopClass); }
[ "public", "BeanInfo", "getBeanInfo", "(", "Class", "<", "?", ">", "beanClass", ",", "Class", "<", "?", ">", "stopClass", ")", "throws", "IntrospectionException", "{", "return", "Introspector", ".", "getBeanInfo", "(", "beanClass", ",", "stopClass", ")", ";", "}" ]
Introspects a Java bean to learn all about its properties, exposed methods, below a given "stop" point. @param beanClass the bean class to be analyzed @param stopClass the base class at which to stop the analysis. Any methods/properties/events in the stopClass or in its baseclasses will be ignored in the analysis
[ "Introspects", "a", "Java", "bean", "to", "learn", "all", "about", "its", "properties", "exposed", "methods", "below", "a", "given", "stop", "point", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L619-L622
189
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.getAttributeValue
public Object getAttributeValue(FeatureDescriptor feature, String attributeName) { if (feature == null || attributeName == null) { return null; } return feature.getValue(attributeName); }
java
public Object getAttributeValue(FeatureDescriptor feature, String attributeName) { if (feature == null || attributeName == null) { return null; } return feature.getValue(attributeName); }
[ "public", "Object", "getAttributeValue", "(", "FeatureDescriptor", "feature", ",", "String", "attributeName", ")", "{", "if", "(", "feature", "==", "null", "||", "attributeName", "==", "null", ")", "{", "return", "null", ";", "}", "return", "feature", ".", "getValue", "(", "attributeName", ")", ";", "}" ]
Retrieves the value of the named FeatureDescriptor attribute. @return The value of the attribute. May be null if the attribute is unknown.
[ "Retrieves", "the", "value", "of", "the", "named", "FeatureDescriptor", "attribute", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L630-L638
190
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.createPatternString
public String createPatternString(String pattern, int length) { if (pattern == null) { return null; } int totalLength = pattern.length() * length; StringBuffer sb = new StringBuffer(totalLength); for (int i = 0; i < length; i++) { sb.append(pattern); } return sb.toString(); }
java
public String createPatternString(String pattern, int length) { if (pattern == null) { return null; } int totalLength = pattern.length() * length; StringBuffer sb = new StringBuffer(totalLength); for (int i = 0; i < length; i++) { sb.append(pattern); } return sb.toString(); }
[ "public", "String", "createPatternString", "(", "String", "pattern", ",", "int", "length", ")", "{", "if", "(", "pattern", "==", "null", ")", "{", "return", "null", ";", "}", "int", "totalLength", "=", "pattern", ".", "length", "(", ")", "*", "length", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "totalLength", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "pattern", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Creates a String with the specified pattern repeated length times.
[ "Creates", "a", "String", "with", "the", "specified", "pattern", "repeated", "length", "times", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L693-L704
191
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.getDescription
public String getDescription(FeatureDescriptor feature) { String description = feature.getShortDescription(); if (description == null || description.equals(feature.getDisplayName())) { description = ""; } return description; }
java
public String getDescription(FeatureDescriptor feature) { String description = feature.getShortDescription(); if (description == null || description.equals(feature.getDisplayName())) { description = ""; } return description; }
[ "public", "String", "getDescription", "(", "FeatureDescriptor", "feature", ")", "{", "String", "description", "=", "feature", ".", "getShortDescription", "(", ")", ";", "if", "(", "description", "==", "null", "||", "description", ".", "equals", "(", "feature", ".", "getDisplayName", "(", ")", ")", ")", "{", "description", "=", "\"\"", ";", "}", "return", "description", ";", "}" ]
Returns the FeatureDescriptor's shortDescription or "" if the shortDescription is the same as the displayName.
[ "Returns", "the", "FeatureDescriptor", "s", "shortDescription", "or", "if", "the", "shortDescription", "is", "the", "same", "as", "the", "displayName", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L717-L727
192
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.sortDescriptors
public FeatureDescriptor[] sortDescriptors(FeatureDescriptor[] fds) { /* * the variable dolly is used here in reference to the sheep cloned * a few years back by Scottish scientists. - Jonathan */ FeatureDescriptor[] dolly = fds.clone(); Arrays.sort(dolly, DESCRIPTOR_COMPARATOR); return dolly; }
java
public FeatureDescriptor[] sortDescriptors(FeatureDescriptor[] fds) { /* * the variable dolly is used here in reference to the sheep cloned * a few years back by Scottish scientists. - Jonathan */ FeatureDescriptor[] dolly = fds.clone(); Arrays.sort(dolly, DESCRIPTOR_COMPARATOR); return dolly; }
[ "public", "FeatureDescriptor", "[", "]", "sortDescriptors", "(", "FeatureDescriptor", "[", "]", "fds", ")", "{", "/*\n * the variable dolly is used here in reference to the sheep cloned\n * a few years back by Scottish scientists. - Jonathan\n */", "FeatureDescriptor", "[", "]", "dolly", "=", "fds", ".", "clone", "(", ")", ";", "Arrays", ".", "sort", "(", "dolly", ",", "DESCRIPTOR_COMPARATOR", ")", ";", "return", "dolly", ";", "}" ]
Sorts an array of FeatureDescriptors based on the method name and if these descriptors are MethodDescriptors, by param count as well. To prevent damage to the original array, a clone is made, sorted, and returned from this method.
[ "Sorts", "an", "array", "of", "FeatureDescriptors", "based", "on", "the", "method", "name", "and", "if", "these", "descriptors", "are", "MethodDescriptors", "by", "param", "count", "as", "well", ".", "To", "prevent", "damage", "to", "the", "original", "array", "a", "clone", "is", "made", "sorted", "and", "returned", "from", "this", "method", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L745-L753
193
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.loadContextClasses
public Object[] loadContextClasses(ClassLoader loader, ContextClassEntry[] contextClasses) throws Exception { if (loader == null) { throw new IllegalArgumentException("ClassLoader is null"); } if (contextClasses == null || contextClasses.length == 0) { throw new IllegalArgumentException("No Context Classes"); } Vector<Class<?>> classVector = new Vector<Class<?>>(contextClasses.length); String[] prefixNames = new String[contextClasses.length]; String className = null; for (int i = 0; i < contextClasses.length; i++) { className = contextClasses[i].getContextClassName(); Class<?> contextClass = loader.loadClass(className); classVector.addElement(contextClass); String prefixName = contextClasses[i].getPrefixName(); if (prefixName != null) { prefixNames[i] = prefixName + "$"; } else { prefixNames[i] = null; } } Class<?>[] classes = new Class<?>[classVector.size()]; classVector.copyInto(classes); return new Object[] {classes, prefixNames}; }
java
public Object[] loadContextClasses(ClassLoader loader, ContextClassEntry[] contextClasses) throws Exception { if (loader == null) { throw new IllegalArgumentException("ClassLoader is null"); } if (contextClasses == null || contextClasses.length == 0) { throw new IllegalArgumentException("No Context Classes"); } Vector<Class<?>> classVector = new Vector<Class<?>>(contextClasses.length); String[] prefixNames = new String[contextClasses.length]; String className = null; for (int i = 0; i < contextClasses.length; i++) { className = contextClasses[i].getContextClassName(); Class<?> contextClass = loader.loadClass(className); classVector.addElement(contextClass); String prefixName = contextClasses[i].getPrefixName(); if (prefixName != null) { prefixNames[i] = prefixName + "$"; } else { prefixNames[i] = null; } } Class<?>[] classes = new Class<?>[classVector.size()]; classVector.copyInto(classes); return new Object[] {classes, prefixNames}; }
[ "public", "Object", "[", "]", "loadContextClasses", "(", "ClassLoader", "loader", ",", "ContextClassEntry", "[", "]", "contextClasses", ")", "throws", "Exception", "{", "if", "(", "loader", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"ClassLoader is null\"", ")", ";", "}", "if", "(", "contextClasses", "==", "null", "||", "contextClasses", ".", "length", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"No Context Classes\"", ")", ";", "}", "Vector", "<", "Class", "<", "?", ">", ">", "classVector", "=", "new", "Vector", "<", "Class", "<", "?", ">", ">", "(", "contextClasses", ".", "length", ")", ";", "String", "[", "]", "prefixNames", "=", "new", "String", "[", "contextClasses", ".", "length", "]", ";", "String", "className", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "contextClasses", ".", "length", ";", "i", "++", ")", "{", "className", "=", "contextClasses", "[", "i", "]", ".", "getContextClassName", "(", ")", ";", "Class", "<", "?", ">", "contextClass", "=", "loader", ".", "loadClass", "(", "className", ")", ";", "classVector", ".", "addElement", "(", "contextClass", ")", ";", "String", "prefixName", "=", "contextClasses", "[", "i", "]", ".", "getPrefixName", "(", ")", ";", "if", "(", "prefixName", "!=", "null", ")", "{", "prefixNames", "[", "i", "]", "=", "prefixName", "+", "\"$\"", ";", "}", "else", "{", "prefixNames", "[", "i", "]", "=", "null", ";", "}", "}", "Class", "<", "?", ">", "[", "]", "classes", "=", "new", "Class", "<", "?", ">", "[", "classVector", ".", "size", "(", ")", "]", ";", "classVector", ".", "copyInto", "(", "classes", ")", ";", "return", "new", "Object", "[", "]", "{", "classes", ",", "prefixNames", "}", ";", "}" ]
Loads and returns the runtime context classes specified by the ContextClassEntry array. @return a 2 element Object array: <br> <pre> index [0] is the Class[] containing the context classes. index [1] is the String[] containing the context prefix names.
[ "Loads", "and", "returns", "the", "runtime", "context", "classes", "specified", "by", "the", "ContextClassEntry", "array", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L836-L871
194
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.isLikelyContextClass
public boolean isLikelyContextClass(Class<?> clazz) { return (OutputReceiver.class.isAssignableFrom(clazz) || getClassName(clazz).toLowerCase().endsWith("context")); }
java
public boolean isLikelyContextClass(Class<?> clazz) { return (OutputReceiver.class.isAssignableFrom(clazz) || getClassName(clazz).toLowerCase().endsWith("context")); }
[ "public", "boolean", "isLikelyContextClass", "(", "Class", "<", "?", ">", "clazz", ")", "{", "return", "(", "OutputReceiver", ".", "class", ".", "isAssignableFrom", "(", "clazz", ")", "||", "getClassName", "(", "clazz", ")", ".", "toLowerCase", "(", ")", ".", "endsWith", "(", "\"context\"", ")", ")", ";", "}" ]
Returns true if it is likely that the specified class serves as a Tea runtime context class.
[ "Returns", "true", "if", "it", "is", "likely", "that", "the", "specified", "class", "serves", "as", "a", "Tea", "runtime", "context", "class", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L878-L881
195
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.getTeaContextMethodDescriptors
public MethodDescriptor[] getTeaContextMethodDescriptors( Class<?> contextClass, boolean specifiedClassOnly) { Vector<MethodDescriptor> v = new Vector<MethodDescriptor>(); MethodDescriptor[] methodDescriptors = null; try { BeanInfo beanInfo = getBeanInfo(contextClass); methodDescriptors = beanInfo.getMethodDescriptors(); } catch (Throwable e) { e.printStackTrace(); } if (methodDescriptors != null) { Method[] methods = contextClass.getMethods(); if (methods.length > methodDescriptors.length) { methodDescriptors = addMissingContextMethodDescriptors( methods, methodDescriptors); } for (int i = 0; i < methodDescriptors.length; i++) { MethodDescriptor md = methodDescriptors[i]; Class<?> declaringClass = md.getMethod().getDeclaringClass(); if (declaringClass != Object.class && !md.isHidden() && (!specifiedClassOnly || declaringClass == contextClass)) { v.addElement(md); } } } methodDescriptors = new MethodDescriptor[v.size()]; v.copyInto(methodDescriptors); sortMethodDescriptors(methodDescriptors); return methodDescriptors; }
java
public MethodDescriptor[] getTeaContextMethodDescriptors( Class<?> contextClass, boolean specifiedClassOnly) { Vector<MethodDescriptor> v = new Vector<MethodDescriptor>(); MethodDescriptor[] methodDescriptors = null; try { BeanInfo beanInfo = getBeanInfo(contextClass); methodDescriptors = beanInfo.getMethodDescriptors(); } catch (Throwable e) { e.printStackTrace(); } if (methodDescriptors != null) { Method[] methods = contextClass.getMethods(); if (methods.length > methodDescriptors.length) { methodDescriptors = addMissingContextMethodDescriptors( methods, methodDescriptors); } for (int i = 0; i < methodDescriptors.length; i++) { MethodDescriptor md = methodDescriptors[i]; Class<?> declaringClass = md.getMethod().getDeclaringClass(); if (declaringClass != Object.class && !md.isHidden() && (!specifiedClassOnly || declaringClass == contextClass)) { v.addElement(md); } } } methodDescriptors = new MethodDescriptor[v.size()]; v.copyInto(methodDescriptors); sortMethodDescriptors(methodDescriptors); return methodDescriptors; }
[ "public", "MethodDescriptor", "[", "]", "getTeaContextMethodDescriptors", "(", "Class", "<", "?", ">", "contextClass", ",", "boolean", "specifiedClassOnly", ")", "{", "Vector", "<", "MethodDescriptor", ">", "v", "=", "new", "Vector", "<", "MethodDescriptor", ">", "(", ")", ";", "MethodDescriptor", "[", "]", "methodDescriptors", "=", "null", ";", "try", "{", "BeanInfo", "beanInfo", "=", "getBeanInfo", "(", "contextClass", ")", ";", "methodDescriptors", "=", "beanInfo", ".", "getMethodDescriptors", "(", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "if", "(", "methodDescriptors", "!=", "null", ")", "{", "Method", "[", "]", "methods", "=", "contextClass", ".", "getMethods", "(", ")", ";", "if", "(", "methods", ".", "length", ">", "methodDescriptors", ".", "length", ")", "{", "methodDescriptors", "=", "addMissingContextMethodDescriptors", "(", "methods", ",", "methodDescriptors", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methodDescriptors", ".", "length", ";", "i", "++", ")", "{", "MethodDescriptor", "md", "=", "methodDescriptors", "[", "i", "]", ";", "Class", "<", "?", ">", "declaringClass", "=", "md", ".", "getMethod", "(", ")", ".", "getDeclaringClass", "(", ")", ";", "if", "(", "declaringClass", "!=", "Object", ".", "class", "&&", "!", "md", ".", "isHidden", "(", ")", "&&", "(", "!", "specifiedClassOnly", "||", "declaringClass", "==", "contextClass", ")", ")", "{", "v", ".", "addElement", "(", "md", ")", ";", "}", "}", "}", "methodDescriptors", "=", "new", "MethodDescriptor", "[", "v", ".", "size", "(", ")", "]", ";", "v", ".", "copyInto", "(", "methodDescriptors", ")", ";", "sortMethodDescriptors", "(", "methodDescriptors", ")", ";", "return", "methodDescriptors", ";", "}" ]
Gets the MethodDescriptors of the specified context class @param contextClass the Tea context Class to introspect (any class will work fine) @param specifiedClassOnly true indicates that this function should only return MethodDescriptors declared by the specified Class.
[ "Gets", "the", "MethodDescriptors", "of", "the", "specified", "context", "class" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L906-L948
196
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.getTeaContextMethodDescriptors
public MethodDescriptor[] getTeaContextMethodDescriptors(Class<?>[] contextClasses) { Vector<MethodDescriptor> v = new Vector<MethodDescriptor>(); Hashtable<Method, Method> methods = new Hashtable<Method, Method>(); if (contextClasses != null) { // Combine all of the MethodDescriptors for (int i = 0; i < contextClasses.length; i++) { Class<?> c = contextClasses[i]; if (c == null) { continue; } MethodDescriptor[] mds = getTeaContextMethodDescriptors(c, false); for (int j = 0; j < mds.length; j++) { MethodDescriptor md = mds[j]; Method m = md.getMethod(); // Check uniqueness of method if (methods.get(m) == null) { methods.put(m, m); v.addElement(md); } } } } MethodDescriptor[] methodDescriptors = new MethodDescriptor[v.size()]; v.copyInto(methodDescriptors); // Sort the combined results sortMethodDescriptors(methodDescriptors); return methodDescriptors; }
java
public MethodDescriptor[] getTeaContextMethodDescriptors(Class<?>[] contextClasses) { Vector<MethodDescriptor> v = new Vector<MethodDescriptor>(); Hashtable<Method, Method> methods = new Hashtable<Method, Method>(); if (contextClasses != null) { // Combine all of the MethodDescriptors for (int i = 0; i < contextClasses.length; i++) { Class<?> c = contextClasses[i]; if (c == null) { continue; } MethodDescriptor[] mds = getTeaContextMethodDescriptors(c, false); for (int j = 0; j < mds.length; j++) { MethodDescriptor md = mds[j]; Method m = md.getMethod(); // Check uniqueness of method if (methods.get(m) == null) { methods.put(m, m); v.addElement(md); } } } } MethodDescriptor[] methodDescriptors = new MethodDescriptor[v.size()]; v.copyInto(methodDescriptors); // Sort the combined results sortMethodDescriptors(methodDescriptors); return methodDescriptors; }
[ "public", "MethodDescriptor", "[", "]", "getTeaContextMethodDescriptors", "(", "Class", "<", "?", ">", "[", "]", "contextClasses", ")", "{", "Vector", "<", "MethodDescriptor", ">", "v", "=", "new", "Vector", "<", "MethodDescriptor", ">", "(", ")", ";", "Hashtable", "<", "Method", ",", "Method", ">", "methods", "=", "new", "Hashtable", "<", "Method", ",", "Method", ">", "(", ")", ";", "if", "(", "contextClasses", "!=", "null", ")", "{", "// Combine all of the MethodDescriptors", "for", "(", "int", "i", "=", "0", ";", "i", "<", "contextClasses", ".", "length", ";", "i", "++", ")", "{", "Class", "<", "?", ">", "c", "=", "contextClasses", "[", "i", "]", ";", "if", "(", "c", "==", "null", ")", "{", "continue", ";", "}", "MethodDescriptor", "[", "]", "mds", "=", "getTeaContextMethodDescriptors", "(", "c", ",", "false", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "mds", ".", "length", ";", "j", "++", ")", "{", "MethodDescriptor", "md", "=", "mds", "[", "j", "]", ";", "Method", "m", "=", "md", ".", "getMethod", "(", ")", ";", "// Check uniqueness of method", "if", "(", "methods", ".", "get", "(", "m", ")", "==", "null", ")", "{", "methods", ".", "put", "(", "m", ",", "m", ")", ";", "v", ".", "addElement", "(", "md", ")", ";", "}", "}", "}", "}", "MethodDescriptor", "[", "]", "methodDescriptors", "=", "new", "MethodDescriptor", "[", "v", ".", "size", "(", ")", "]", ";", "v", ".", "copyInto", "(", "methodDescriptors", ")", ";", "// Sort the combined results", "sortMethodDescriptors", "(", "methodDescriptors", ")", ";", "return", "methodDescriptors", ";", "}" ]
Gets the complete, combined set of MethodDescriptors for the specified context classes. @param contextClasses the Tea context classes to introspect
[ "Gets", "the", "complete", "combined", "set", "of", "MethodDescriptors", "for", "the", "specified", "context", "classes", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L956-L994
197
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.getTeaFullClassName
public String getTeaFullClassName(Class<?> clazz) { if (isImplicitTeaImport(clazz)) { return getClassName(clazz); } return getFullClassName(clazz); }
java
public String getTeaFullClassName(Class<?> clazz) { if (isImplicitTeaImport(clazz)) { return getClassName(clazz); } return getFullClassName(clazz); }
[ "public", "String", "getTeaFullClassName", "(", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "isImplicitTeaImport", "(", "clazz", ")", ")", "{", "return", "getClassName", "(", "clazz", ")", ";", "}", "return", "getFullClassName", "(", "clazz", ")", ";", "}" ]
Returns the full class name of the specified class. This method provides special formatting for array and inner classes. If the specified class is implicitly imported by Tea, then its package is omitted in the returned name.
[ "Returns", "the", "full", "class", "name", "of", "the", "specified", "class", ".", "This", "method", "provides", "special", "formatting", "for", "array", "and", "inner", "classes", ".", "If", "the", "specified", "class", "is", "implicitly", "imported", "by", "Tea", "then", "its", "package", "is", "omitted", "in", "the", "returned", "name", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L1079-L1086
198
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.isImplicitTeaImport
public boolean isImplicitTeaImport(String classOrPackageName) { if (classOrPackageName == null) { return false; } if (cPrimativeClasses.get(classOrPackageName) != null) { return true; } for (int i = 0; i < IMPLICIT_TEA_IMPORTS.length; i++) { String prefix = IMPLICIT_TEA_IMPORTS[i]; if (classOrPackageName.startsWith(prefix)) { return true; } } return false; }
java
public boolean isImplicitTeaImport(String classOrPackageName) { if (classOrPackageName == null) { return false; } if (cPrimativeClasses.get(classOrPackageName) != null) { return true; } for (int i = 0; i < IMPLICIT_TEA_IMPORTS.length; i++) { String prefix = IMPLICIT_TEA_IMPORTS[i]; if (classOrPackageName.startsWith(prefix)) { return true; } } return false; }
[ "public", "boolean", "isImplicitTeaImport", "(", "String", "classOrPackageName", ")", "{", "if", "(", "classOrPackageName", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "cPrimativeClasses", ".", "get", "(", "classOrPackageName", ")", "!=", "null", ")", "{", "return", "true", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "IMPLICIT_TEA_IMPORTS", ".", "length", ";", "i", "++", ")", "{", "String", "prefix", "=", "IMPLICIT_TEA_IMPORTS", "[", "i", "]", ";", "if", "(", "classOrPackageName", ".", "startsWith", "(", "prefix", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Returns true if the specified class or package is implicitly imported by Tea.
[ "Returns", "true", "if", "the", "specified", "class", "or", "package", "is", "implicitly", "imported", "by", "Tea", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L1108-L1127
199
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.compareFileExtension
public boolean compareFileExtension(String fileName, String extension) { if (fileName == null || extension == null) { return false; } fileName = fileName.toLowerCase().trim(); extension = extension.toLowerCase(); return (fileName.endsWith(extension)); }
java
public boolean compareFileExtension(String fileName, String extension) { if (fileName == null || extension == null) { return false; } fileName = fileName.toLowerCase().trim(); extension = extension.toLowerCase(); return (fileName.endsWith(extension)); }
[ "public", "boolean", "compareFileExtension", "(", "String", "fileName", ",", "String", "extension", ")", "{", "if", "(", "fileName", "==", "null", "||", "extension", "==", "null", ")", "{", "return", "false", ";", "}", "fileName", "=", "fileName", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "extension", "=", "extension", ".", "toLowerCase", "(", ")", ";", "return", "(", "fileName", ".", "endsWith", "(", "extension", ")", ")", ";", "}" ]
Returns true if the specified fileName ends with the specified file extension.
[ "Returns", "true", "if", "the", "specified", "fileName", "ends", "with", "the", "specified", "file", "extension", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L1214-L1224