id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
150,200
jtrfp/javamod
src/main/java/de/quippy/ogg/jorbis/VorbisFile.java
VorbisFile.prefetch_all_headers
void prefetch_all_headers(Info first_i, Comment first_c, int dataoffset) throws JOrbisException{ Page og=new Page(); int ret; vi=new Info[links]; vc=new Comment[links]; dataoffsets=new long[links]; pcmlengths=new long[links]; serialnos=new int[links]; for(int i=0; i<links; i++){ if(first_i!=null&&first_c!=null&&i==0){ // we already grabbed the initial header earlier. This just // saves the waste of grabbing it again vi[i]=first_i; vc[i]=first_c; dataoffsets[i]=dataoffset; } else{ // seek to the location of the initial header seek_helper(offsets[i]); //!!! vi[i]=new Info(); vc[i]=new Comment(); if(fetch_headers(vi[i], vc[i], null, null)==-1){ dataoffsets[i]=-1; } else{ dataoffsets[i]=offset; os.clear(); } } // get the serial number and PCM length of this link. To do this, // get the last page of the stream { long end=offsets[i+1]; //!!! seek_helper(end); while(true){ ret=get_prev_page(og); if(ret==-1){ // this should not be possible vi[i].clear(); vc[i].clear(); break; } if(og.granulepos()!=-1){ serialnos[i]=og.serialno(); pcmlengths[i]=og.granulepos(); break; } } } } }
java
void prefetch_all_headers(Info first_i, Comment first_c, int dataoffset) throws JOrbisException{ Page og=new Page(); int ret; vi=new Info[links]; vc=new Comment[links]; dataoffsets=new long[links]; pcmlengths=new long[links]; serialnos=new int[links]; for(int i=0; i<links; i++){ if(first_i!=null&&first_c!=null&&i==0){ // we already grabbed the initial header earlier. This just // saves the waste of grabbing it again vi[i]=first_i; vc[i]=first_c; dataoffsets[i]=dataoffset; } else{ // seek to the location of the initial header seek_helper(offsets[i]); //!!! vi[i]=new Info(); vc[i]=new Comment(); if(fetch_headers(vi[i], vc[i], null, null)==-1){ dataoffsets[i]=-1; } else{ dataoffsets[i]=offset; os.clear(); } } // get the serial number and PCM length of this link. To do this, // get the last page of the stream { long end=offsets[i+1]; //!!! seek_helper(end); while(true){ ret=get_prev_page(og); if(ret==-1){ // this should not be possible vi[i].clear(); vc[i].clear(); break; } if(og.granulepos()!=-1){ serialnos[i]=og.serialno(); pcmlengths[i]=og.granulepos(); break; } } } } }
[ "void", "prefetch_all_headers", "(", "Info", "first_i", ",", "Comment", "first_c", ",", "int", "dataoffset", ")", "throws", "JOrbisException", "{", "Page", "og", "=", "new", "Page", "(", ")", ";", "int", "ret", ";", "vi", "=", "new", "Info", "[", "links", "]", ";", "vc", "=", "new", "Comment", "[", "links", "]", ";", "dataoffsets", "=", "new", "long", "[", "links", "]", ";", "pcmlengths", "=", "new", "long", "[", "links", "]", ";", "serialnos", "=", "new", "int", "[", "links", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "links", ";", "i", "++", ")", "{", "if", "(", "first_i", "!=", "null", "&&", "first_c", "!=", "null", "&&", "i", "==", "0", ")", "{", "// we already grabbed the initial header earlier. This just", "// saves the waste of grabbing it again", "vi", "[", "i", "]", "=", "first_i", ";", "vc", "[", "i", "]", "=", "first_c", ";", "dataoffsets", "[", "i", "]", "=", "dataoffset", ";", "}", "else", "{", "// seek to the location of the initial header", "seek_helper", "(", "offsets", "[", "i", "]", ")", ";", "//!!!", "vi", "[", "i", "]", "=", "new", "Info", "(", ")", ";", "vc", "[", "i", "]", "=", "new", "Comment", "(", ")", ";", "if", "(", "fetch_headers", "(", "vi", "[", "i", "]", ",", "vc", "[", "i", "]", ",", "null", ",", "null", ")", "==", "-", "1", ")", "{", "dataoffsets", "[", "i", "]", "=", "-", "1", ";", "}", "else", "{", "dataoffsets", "[", "i", "]", "=", "offset", ";", "os", ".", "clear", "(", ")", ";", "}", "}", "// get the serial number and PCM length of this link. To do this,", "// get the last page of the stream", "{", "long", "end", "=", "offsets", "[", "i", "+", "1", "]", ";", "//!!!", "seek_helper", "(", "end", ")", ";", "while", "(", "true", ")", "{", "ret", "=", "get_prev_page", "(", "og", ")", ";", "if", "(", "ret", "==", "-", "1", ")", "{", "// this should not be possible", "vi", "[", "i", "]", ".", "clear", "(", ")", ";", "vc", "[", "i", "]", ".", "clear", "(", ")", ";", "break", ";", "}", "if", "(", "og", ".", "granulepos", "(", ")", "!=", "-", "1", ")", "{", "serialnos", "[", "i", "]", "=", "og", ".", "serialno", "(", ")", ";", "pcmlengths", "[", "i", "]", "=", "og", ".", "granulepos", "(", ")", ";", "break", ";", "}", "}", "}", "}", "}" ]
attention to how that's done)
[ "attention", "to", "how", "that", "s", "done", ")" ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/ogg/jorbis/VorbisFile.java#L319-L374
150,201
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/util/Properties.java
Properties.getInt
public Integer getInt(String name, Integer def) { final String s = getProperty(name); try { return Integer.parseInt(s); } catch (Exception e) { return def; } }
java
public Integer getInt(String name, Integer def) { final String s = getProperty(name); try { return Integer.parseInt(s); } catch (Exception e) { return def; } }
[ "public", "Integer", "getInt", "(", "String", "name", ",", "Integer", "def", ")", "{", "final", "String", "s", "=", "getProperty", "(", "name", ")", ";", "try", "{", "return", "Integer", ".", "parseInt", "(", "s", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "def", ";", "}", "}" ]
Returns the property assuming its an int. If it isn't or if its not defined, returns default value @param name Property name @param def Default value @return Property value or def
[ "Returns", "the", "property", "assuming", "its", "an", "int", ".", "If", "it", "isn", "t", "or", "if", "its", "not", "defined", "returns", "default", "value" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/util/Properties.java#L48-L55
150,202
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/util/Properties.java
Properties.getBool
public boolean getBool(String name, boolean def) { final String s = getProperty(name); if (s == null) { return def; } try { return s != null && s.equalsIgnoreCase("true"); } catch (Exception e) { return def; } }
java
public boolean getBool(String name, boolean def) { final String s = getProperty(name); if (s == null) { return def; } try { return s != null && s.equalsIgnoreCase("true"); } catch (Exception e) { return def; } }
[ "public", "boolean", "getBool", "(", "String", "name", ",", "boolean", "def", ")", "{", "final", "String", "s", "=", "getProperty", "(", "name", ")", ";", "if", "(", "s", "==", "null", ")", "{", "return", "def", ";", "}", "try", "{", "return", "s", "!=", "null", "&&", "s", ".", "equalsIgnoreCase", "(", "\"true\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "def", ";", "}", "}" ]
Returns the property assuming its a boolean. If it isn't or if its not defined, returns default value. @param name Property name @param def Default value @return Property value or def
[ "Returns", "the", "property", "assuming", "its", "a", "boolean", ".", "If", "it", "isn", "t", "or", "if", "its", "not", "defined", "returns", "default", "value", "." ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/util/Properties.java#L66-L76
150,203
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/util/Properties.java
Properties.getAll
public List<String> getAll(String name) { if (properties == null) { return null; } final List<String> all = new ArrayList<String>(); for (Property property : properties) { if (property.getName().equals(name)) { all.add(property.getValue()); } } return all; }
java
public List<String> getAll(String name) { if (properties == null) { return null; } final List<String> all = new ArrayList<String>(); for (Property property : properties) { if (property.getName().equals(name)) { all.add(property.getValue()); } } return all; }
[ "public", "List", "<", "String", ">", "getAll", "(", "String", "name", ")", "{", "if", "(", "properties", "==", "null", ")", "{", "return", "null", ";", "}", "final", "List", "<", "String", ">", "all", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "Property", "property", ":", "properties", ")", "{", "if", "(", "property", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", ")", "{", "all", ".", "add", "(", "property", ".", "getValue", "(", ")", ")", ";", "}", "}", "return", "all", ";", "}" ]
Return all values for the given name
[ "Return", "all", "values", "for", "the", "given", "name" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/util/Properties.java#L81-L92
150,204
actorapp/droidkit-actors
actors/src/main/java/com/droidkit/actors/dispatch/SimpleDispatchQueue.java
SimpleDispatchQueue.removeFromQueue
public void removeFromQueue(T t) { synchronized (messages) { for (Map.Entry<Long, Message> messageEntry : messages.entrySet()) { if (messageEntry.getValue().equals(t)) { Message message = messages.remove(messageEntry.getKey()); recycle(message); notifyQueueChanged(); return; } } } }
java
public void removeFromQueue(T t) { synchronized (messages) { for (Map.Entry<Long, Message> messageEntry : messages.entrySet()) { if (messageEntry.getValue().equals(t)) { Message message = messages.remove(messageEntry.getKey()); recycle(message); notifyQueueChanged(); return; } } } }
[ "public", "void", "removeFromQueue", "(", "T", "t", ")", "{", "synchronized", "(", "messages", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Long", ",", "Message", ">", "messageEntry", ":", "messages", ".", "entrySet", "(", ")", ")", "{", "if", "(", "messageEntry", ".", "getValue", "(", ")", ".", "equals", "(", "t", ")", ")", "{", "Message", "message", "=", "messages", ".", "remove", "(", "messageEntry", ".", "getKey", "(", ")", ")", ";", "recycle", "(", "message", ")", ";", "notifyQueueChanged", "(", ")", ";", "return", ";", "}", "}", "}", "}" ]
Removing message from queue @param t message
[ "Removing", "message", "from", "queue" ]
fdb72fcfdd1c5e54a970f203a33a71fa54344217
https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/dispatch/SimpleDispatchQueue.java#L23-L34
150,205
actorapp/droidkit-actors
actors/src/main/java/com/droidkit/actors/mailbox/Mailbox.java
Mailbox.scheduleOnce
public void scheduleOnce(Envelope envelope, long time) { if (envelope.getMailbox() != this) { throw new RuntimeException("envelope.mailbox != this mailbox"); } envelopes.putEnvelopeOnce(envelope, time, comparator); }
java
public void scheduleOnce(Envelope envelope, long time) { if (envelope.getMailbox() != this) { throw new RuntimeException("envelope.mailbox != this mailbox"); } envelopes.putEnvelopeOnce(envelope, time, comparator); }
[ "public", "void", "scheduleOnce", "(", "Envelope", "envelope", ",", "long", "time", ")", "{", "if", "(", "envelope", ".", "getMailbox", "(", ")", "!=", "this", ")", "{", "throw", "new", "RuntimeException", "(", "\"envelope.mailbox != this mailbox\"", ")", ";", "}", "envelopes", ".", "putEnvelopeOnce", "(", "envelope", ",", "time", ",", "comparator", ")", ";", "}" ]
Send envelope once at time @param envelope envelope @param time time
[ "Send", "envelope", "once", "at", "time" ]
fdb72fcfdd1c5e54a970f203a33a71fa54344217
https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/mailbox/Mailbox.java#L50-L56
150,206
actorapp/droidkit-actors
actors/src/main/java/com/droidkit/actors/mailbox/Mailbox.java
Mailbox.isEqualEnvelope
protected boolean isEqualEnvelope(Envelope a, Envelope b) { return a.getMessage().getClass() == b.getMessage().getClass(); }
java
protected boolean isEqualEnvelope(Envelope a, Envelope b) { return a.getMessage().getClass() == b.getMessage().getClass(); }
[ "protected", "boolean", "isEqualEnvelope", "(", "Envelope", "a", ",", "Envelope", "b", ")", "{", "return", "a", ".", "getMessage", "(", ")", ".", "getClass", "(", ")", "==", "b", ".", "getMessage", "(", ")", ".", "getClass", "(", ")", ";", "}" ]
Override this if you need to change filtering for scheduleOnce behaviour. By default it check equality only of class names. @param a @param b @return is equal
[ "Override", "this", "if", "you", "need", "to", "change", "filtering", "for", "scheduleOnce", "behaviour", ".", "By", "default", "it", "check", "equality", "only", "of", "class", "names", "." ]
fdb72fcfdd1c5e54a970f203a33a71fa54344217
https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/mailbox/Mailbox.java#L91-L93
150,207
PureSolTechnologies/graphs
trees/src/main/java/com/puresoltechnologies/graphs/trees/TreeUtils.java
TreeUtils.countNodes
public static <N extends TreeNode<N>> int countNodes(N tree) { int result = 0; if (tree == null) { return result; } List<N> children = tree.getChildren(); for (N node : children) { result += countNodes(node); } return result + 1; // + 1 for self! }
java
public static <N extends TreeNode<N>> int countNodes(N tree) { int result = 0; if (tree == null) { return result; } List<N> children = tree.getChildren(); for (N node : children) { result += countNodes(node); } return result + 1; // + 1 for self! }
[ "public", "static", "<", "N", "extends", "TreeNode", "<", "N", ">", ">", "int", "countNodes", "(", "N", "tree", ")", "{", "int", "result", "=", "0", ";", "if", "(", "tree", "==", "null", ")", "{", "return", "result", ";", "}", "List", "<", "N", ">", "children", "=", "tree", ".", "getChildren", "(", ")", ";", "for", "(", "N", "node", ":", "children", ")", "{", "result", "+=", "countNodes", "(", "node", ")", ";", "}", "return", "result", "+", "1", ";", "// + 1 for self!", "}" ]
This method counts all nodes within a tree. @param tree is a {@link TreeNode} object which nodes are to be calculated. @param <N> is the actual tree implementation. @return An integer is returned containing the number of nodes. If tree is <code>null</code> 0 is returned.
[ "This", "method", "counts", "all", "nodes", "within", "a", "tree", "." ]
35dbbd11ccaacbbc6321dcdcd4d31e9a1090d6f1
https://github.com/PureSolTechnologies/graphs/blob/35dbbd11ccaacbbc6321dcdcd4d31e9a1090d6f1/trees/src/main/java/com/puresoltechnologies/graphs/trees/TreeUtils.java#L23-L33
150,208
PureSolTechnologies/graphs
trees/src/main/java/com/puresoltechnologies/graphs/trees/TreeUtils.java
TreeUtils.equalsWithoutOrder
public static <N extends TreeNode<N>> boolean equalsWithoutOrder(N tree1, N tree2) { if (!tree1.getName().equals(tree2.getName())) { return false; } List<N> children1 = tree1.getChildren(); List<N> children2 = tree2.getChildren(); if (children1.size() != children2.size()) { return false; } for (N child1 : children1) { for (N child2 : children2) { if (child1.equals(child2)) { boolean equals = equalsWithoutOrder(child1, child2); if (!equals) { return false; } } } } return true; }
java
public static <N extends TreeNode<N>> boolean equalsWithoutOrder(N tree1, N tree2) { if (!tree1.getName().equals(tree2.getName())) { return false; } List<N> children1 = tree1.getChildren(); List<N> children2 = tree2.getChildren(); if (children1.size() != children2.size()) { return false; } for (N child1 : children1) { for (N child2 : children2) { if (child1.equals(child2)) { boolean equals = equalsWithoutOrder(child1, child2); if (!equals) { return false; } } } } return true; }
[ "public", "static", "<", "N", "extends", "TreeNode", "<", "N", ">", ">", "boolean", "equalsWithoutOrder", "(", "N", "tree1", ",", "N", "tree2", ")", "{", "if", "(", "!", "tree1", ".", "getName", "(", ")", ".", "equals", "(", "tree2", ".", "getName", "(", ")", ")", ")", "{", "return", "false", ";", "}", "List", "<", "N", ">", "children1", "=", "tree1", ".", "getChildren", "(", ")", ";", "List", "<", "N", ">", "children2", "=", "tree2", ".", "getChildren", "(", ")", ";", "if", "(", "children1", ".", "size", "(", ")", "!=", "children2", ".", "size", "(", ")", ")", "{", "return", "false", ";", "}", "for", "(", "N", "child1", ":", "children1", ")", "{", "for", "(", "N", "child2", ":", "children2", ")", "{", "if", "(", "child1", ".", "equals", "(", "child2", ")", ")", "{", "boolean", "equals", "=", "equalsWithoutOrder", "(", "child1", ",", "child2", ")", ";", "if", "(", "!", "equals", ")", "{", "return", "false", ";", "}", "}", "}", "}", "return", "true", ";", "}" ]
This method checks to trees for equality. Equality is only checked on name basis and the order of the children is neglected. @param tree1 is the first tree to be compared to the second. @param tree2 is the second tree to be compared to the first. @param <N> is the actual tree implementation. @return <code>true</code> is returned if the trees are equals. <code>false</code> is returned otherwise.
[ "This", "method", "checks", "to", "trees", "for", "equality", ".", "Equality", "is", "only", "checked", "on", "name", "basis", "and", "the", "order", "of", "the", "children", "is", "neglected", "." ]
35dbbd11ccaacbbc6321dcdcd4d31e9a1090d6f1
https://github.com/PureSolTechnologies/graphs/blob/35dbbd11ccaacbbc6321dcdcd4d31e9a1090d6f1/trees/src/main/java/com/puresoltechnologies/graphs/trees/TreeUtils.java#L48-L69
150,209
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/api/DRUMSReader.java
DRUMSReader.closeFiles
public void closeFiles() { filesAreOpened = false; for (HeaderIndexFile<Data> file : files) { if (file != null) { file.close(); } } }
java
public void closeFiles() { filesAreOpened = false; for (HeaderIndexFile<Data> file : files) { if (file != null) { file.close(); } } }
[ "public", "void", "closeFiles", "(", ")", "{", "filesAreOpened", "=", "false", ";", "for", "(", "HeaderIndexFile", "<", "Data", ">", "file", ":", "files", ")", "{", "if", "(", "file", "!=", "null", ")", "{", "file", ".", "close", "(", ")", ";", "}", "}", "}" ]
Closes all files
[ "Closes", "all", "files" ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/api/DRUMSReader.java#L243-L250
150,210
GerdHolz/TOVAL
src/de/invation/code/toval/misc/FormatUtils.java
FormatUtils.format
public static String format(Object o, int precision) { return String.format(getFormat(o, precision), o); }
java
public static String format(Object o, int precision) { return String.format(getFormat(o, precision), o); }
[ "public", "static", "String", "format", "(", "Object", "o", ",", "int", "precision", ")", "{", "return", "String", ".", "format", "(", "getFormat", "(", "o", ",", "precision", ")", ",", "o", ")", ";", "}" ]
Returns a String representation of the given object using an appropriate format and the specified precision in case the object is a non-integer number. @param o Object for which a String representation is desired. @param precision Desired precision @return String representation of the given object using an appropriate format
[ "Returns", "a", "String", "representation", "of", "the", "given", "object", "using", "an", "appropriate", "format", "and", "the", "specified", "precision", "in", "case", "the", "object", "is", "a", "non", "-", "integer", "number", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/FormatUtils.java#L72-L74
150,211
GerdHolz/TOVAL
src/de/invation/code/toval/misc/FormatUtils.java
FormatUtils.formatTrimmed
public static String formatTrimmed(Object o, int precision, int length) { return String.format(getTrimmedFormat(getFormat(o, precision), length), o); }
java
public static String formatTrimmed(Object o, int precision, int length) { return String.format(getTrimmedFormat(getFormat(o, precision), length), o); }
[ "public", "static", "String", "formatTrimmed", "(", "Object", "o", ",", "int", "precision", ",", "int", "length", ")", "{", "return", "String", ".", "format", "(", "getTrimmedFormat", "(", "getFormat", "(", "o", ",", "precision", ")", ",", "length", ")", ",", "o", ")", ";", "}" ]
Returns a String representation of the given object using an appropriate format and the specified precision in case the object is a non-integer number, trimmed to the specified length. @param o Object for which a String representation is desired. @param precision Desired precision @param length Length of the trimmed string. @return String representation of the given object using an appropriate format
[ "Returns", "a", "String", "representation", "of", "the", "given", "object", "using", "an", "appropriate", "format", "and", "the", "specified", "precision", "in", "case", "the", "object", "is", "a", "non", "-", "integer", "number", "trimmed", "to", "the", "specified", "length", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/FormatUtils.java#L107-L109
150,212
GerdHolz/TOVAL
src/de/invation/code/toval/misc/FormatUtils.java
FormatUtils.getIndexedFormat
public static String getIndexedFormat(int index, String format) { if (index < 1) throw new IllegalArgumentException(); if (format == null) throw new NullPointerException(); if (format.length() == 0) throw new IllegalArgumentException(); return String.format(INDEXED_FORMAT, index, format); }
java
public static String getIndexedFormat(int index, String format) { if (index < 1) throw new IllegalArgumentException(); if (format == null) throw new NullPointerException(); if (format.length() == 0) throw new IllegalArgumentException(); return String.format(INDEXED_FORMAT, index, format); }
[ "public", "static", "String", "getIndexedFormat", "(", "int", "index", ",", "String", "format", ")", "{", "if", "(", "index", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "if", "(", "format", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "if", "(", "format", ".", "length", "(", ")", "==", "0", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "return", "String", ".", "format", "(", "INDEXED_FORMAT", ",", "index", ",", "format", ")", ";", "}" ]
Returns an indexed format by placing the specified index before the given format. @param index Desired index for the given format @param format Format to be indexed @return The format <code>format</code> indexed with <code>index</code>
[ "Returns", "an", "indexed", "format", "by", "placing", "the", "specified", "index", "before", "the", "given", "format", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/FormatUtils.java#L184-L192
150,213
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frames.java
ID3v2Frames.getLength
public int getLength() { int length = 0; Iterator<V> it = this.values().iterator(); while (it.hasNext()) { length += ((ID3v2Frame) it.next()).getFrameLength(); } return length; }
java
public int getLength() { int length = 0; Iterator<V> it = this.values().iterator(); while (it.hasNext()) { length += ((ID3v2Frame) it.next()).getFrameLength(); } return length; }
[ "public", "int", "getLength", "(", ")", "{", "int", "length", "=", "0", ";", "Iterator", "<", "V", ">", "it", "=", "this", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "length", "+=", "(", "(", "ID3v2Frame", ")", "it", ".", "next", "(", ")", ")", ".", "getFrameLength", "(", ")", ";", "}", "return", "length", ";", "}" ]
Returns the length in bytes of all the frames contained in this object. @return the length of all the frames contained in this object.
[ "Returns", "the", "length", "in", "bytes", "of", "all", "the", "frames", "contained", "in", "this", "object", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frames.java#L148-L159
150,214
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frames.java
ID3v2Frames.getBytes
public byte[] getBytes() { byte b[] = new byte[getLength()]; int bytesCopied = 0; Iterator<V> it = this.values().iterator(); while (it.hasNext()) { ID3v2Frame frame = (ID3v2Frame) it.next(); System.arraycopy(frame.getFrameBytes(), 0, b, bytesCopied, frame.getFrameLength()); bytesCopied += frame.getFrameLength(); } return b; }
java
public byte[] getBytes() { byte b[] = new byte[getLength()]; int bytesCopied = 0; Iterator<V> it = this.values().iterator(); while (it.hasNext()) { ID3v2Frame frame = (ID3v2Frame) it.next(); System.arraycopy(frame.getFrameBytes(), 0, b, bytesCopied, frame.getFrameLength()); bytesCopied += frame.getFrameLength(); } return b; }
[ "public", "byte", "[", "]", "getBytes", "(", ")", "{", "byte", "b", "[", "]", "=", "new", "byte", "[", "getLength", "(", ")", "]", ";", "int", "bytesCopied", "=", "0", ";", "Iterator", "<", "V", ">", "it", "=", "this", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "ID3v2Frame", "frame", "=", "(", "ID3v2Frame", ")", "it", ".", "next", "(", ")", ";", "System", ".", "arraycopy", "(", "frame", ".", "getFrameBytes", "(", ")", ",", "0", ",", "b", ",", "bytesCopied", ",", "frame", ".", "getFrameLength", "(", ")", ")", ";", "bytesCopied", "+=", "frame", ".", "getFrameLength", "(", ")", ";", "}", "return", "b", ";", "}" ]
Return an array bytes containing all frames contained in this object. This can be used to easily write the frames to a file. @return an array of bytes contain all frames contained in this object
[ "Return", "an", "array", "bytes", "containing", "all", "frames", "contained", "in", "this", "object", ".", "This", "can", "be", "used", "to", "easily", "write", "the", "frames", "to", "a", "file", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Frames.java#L167-L181
150,215
mazerty/torii
src/main/java/fr/mazerty/torii/vaadin/MyLoginForm.java
MyLoginForm.refreshCaptions
void refreshCaptions() { email.setCaption(lp.l("user.email.caption")); password.setCaption(lp.l("user.password.caption")); login.setCaption(lp.l("loginform.button.caption")); }
java
void refreshCaptions() { email.setCaption(lp.l("user.email.caption")); password.setCaption(lp.l("user.password.caption")); login.setCaption(lp.l("loginform.button.caption")); }
[ "void", "refreshCaptions", "(", ")", "{", "email", ".", "setCaption", "(", "lp", ".", "l", "(", "\"user.email.caption\"", ")", ")", ";", "password", ".", "setCaption", "(", "lp", ".", "l", "(", "\"user.password.caption\"", ")", ")", ";", "login", ".", "setCaption", "(", "lp", ".", "l", "(", "\"loginform.button.caption\"", ")", ")", ";", "}" ]
Since the language can be changed while this form is displayed, we need a method to refresh the captions
[ "Since", "the", "language", "can", "be", "changed", "while", "this", "form", "is", "displayed", "we", "need", "a", "method", "to", "refresh", "the", "captions" ]
d162dff0a50b9c2b0a6415f6d359562461bf0cf1
https://github.com/mazerty/torii/blob/d162dff0a50b9c2b0a6415f6d359562461bf0cf1/src/main/java/fr/mazerty/torii/vaadin/MyLoginForm.java#L60-L64
150,216
diegossilveira/jcors
src/main/java/org/jcors/web/ActualRequestHandler.java
ActualRequestHandler.checkOriginHeader
private String checkOriginHeader(HttpServletRequest request, JCorsConfig config) { String originHeader = request.getHeader(CorsHeaders.ORIGIN_HEADER); Constraint.ensureNotEmpty(originHeader, "Cross-Origin requests must specify an Origin Header"); String[] origins = originHeader.split(" "); for (String origin : origins) { Constraint.ensureTrue(config.isOriginAllowed(origin), String.format("The specified origin is not allowed: '%s'", origin)); } return originHeader; }
java
private String checkOriginHeader(HttpServletRequest request, JCorsConfig config) { String originHeader = request.getHeader(CorsHeaders.ORIGIN_HEADER); Constraint.ensureNotEmpty(originHeader, "Cross-Origin requests must specify an Origin Header"); String[] origins = originHeader.split(" "); for (String origin : origins) { Constraint.ensureTrue(config.isOriginAllowed(origin), String.format("The specified origin is not allowed: '%s'", origin)); } return originHeader; }
[ "private", "String", "checkOriginHeader", "(", "HttpServletRequest", "request", ",", "JCorsConfig", "config", ")", "{", "String", "originHeader", "=", "request", ".", "getHeader", "(", "CorsHeaders", ".", "ORIGIN_HEADER", ")", ";", "Constraint", ".", "ensureNotEmpty", "(", "originHeader", ",", "\"Cross-Origin requests must specify an Origin Header\"", ")", ";", "String", "[", "]", "origins", "=", "originHeader", ".", "split", "(", "\" \"", ")", ";", "for", "(", "String", "origin", ":", "origins", ")", "{", "Constraint", ".", "ensureTrue", "(", "config", ".", "isOriginAllowed", "(", "origin", ")", ",", "String", ".", "format", "(", "\"The specified origin is not allowed: '%s'\"", ",", "origin", ")", ")", ";", "}", "return", "originHeader", ";", "}" ]
Checks if the origin is allowed @param request @param config
[ "Checks", "if", "the", "origin", "is", "allowed" ]
cd56a9e2055d629baa42f93b27dd5615ced9632f
https://github.com/diegossilveira/jcors/blob/cd56a9e2055d629baa42f93b27dd5615ced9632f/src/main/java/org/jcors/web/ActualRequestHandler.java#L49-L61
150,217
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/api/DRUMSInstantiator.java
DRUMSInstantiator.openTable
public static <Data extends AbstractKVStorable> DRUMS<Data> openTable(AccessMode accessMode, DRUMSParameterSet<Data> gp) throws IOException { AbstractHashFunction hashFunction; try { hashFunction = readHashFunction(gp); } catch (ClassNotFoundException e) { throw new IOException("Could not load HashFunction from " + gp.DATABASE_DIRECTORY, e); } return new DRUMS<Data>(hashFunction, accessMode, gp); }
java
public static <Data extends AbstractKVStorable> DRUMS<Data> openTable(AccessMode accessMode, DRUMSParameterSet<Data> gp) throws IOException { AbstractHashFunction hashFunction; try { hashFunction = readHashFunction(gp); } catch (ClassNotFoundException e) { throw new IOException("Could not load HashFunction from " + gp.DATABASE_DIRECTORY, e); } return new DRUMS<Data>(hashFunction, accessMode, gp); }
[ "public", "static", "<", "Data", "extends", "AbstractKVStorable", ">", "DRUMS", "<", "Data", ">", "openTable", "(", "AccessMode", "accessMode", ",", "DRUMSParameterSet", "<", "Data", ">", "gp", ")", "throws", "IOException", "{", "AbstractHashFunction", "hashFunction", ";", "try", "{", "hashFunction", "=", "readHashFunction", "(", "gp", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "IOException", "(", "\"Could not load HashFunction from \"", "+", "gp", ".", "DATABASE_DIRECTORY", ",", "e", ")", ";", "}", "return", "new", "DRUMS", "<", "Data", ">", "(", "hashFunction", ",", "accessMode", ",", "gp", ")", ";", "}" ]
Opens an existing table. @param accessMode the AccessMode, how to access the DRUMS @param gp pointer to the {@link DRUMSParameterSet} used by the {@link DRUMS} to open @return the table @throws IOException
[ "Opens", "an", "existing", "table", "." ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/api/DRUMSInstantiator.java#L103-L112
150,218
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/api/DRUMSInstantiator.java
DRUMSInstantiator.createOrOpenTable
public static <Data extends AbstractKVStorable> DRUMS<Data> createOrOpenTable(AbstractHashFunction hashFunction, DRUMSParameterSet<Data> gp) throws IOException { File databaseDirectoryFile = new File(gp.DATABASE_DIRECTORY); DRUMS<Data> drums = null; if (databaseDirectoryFile.exists()) { drums = openTable(AccessMode.READ_WRITE, gp); } else { drums = createTable(hashFunction, gp); } return drums; }
java
public static <Data extends AbstractKVStorable> DRUMS<Data> createOrOpenTable(AbstractHashFunction hashFunction, DRUMSParameterSet<Data> gp) throws IOException { File databaseDirectoryFile = new File(gp.DATABASE_DIRECTORY); DRUMS<Data> drums = null; if (databaseDirectoryFile.exists()) { drums = openTable(AccessMode.READ_WRITE, gp); } else { drums = createTable(hashFunction, gp); } return drums; }
[ "public", "static", "<", "Data", "extends", "AbstractKVStorable", ">", "DRUMS", "<", "Data", ">", "createOrOpenTable", "(", "AbstractHashFunction", "hashFunction", ",", "DRUMSParameterSet", "<", "Data", ">", "gp", ")", "throws", "IOException", "{", "File", "databaseDirectoryFile", "=", "new", "File", "(", "gp", ".", "DATABASE_DIRECTORY", ")", ";", "DRUMS", "<", "Data", ">", "drums", "=", "null", ";", "if", "(", "databaseDirectoryFile", ".", "exists", "(", ")", ")", "{", "drums", "=", "openTable", "(", "AccessMode", ".", "READ_WRITE", ",", "gp", ")", ";", "}", "else", "{", "drums", "=", "createTable", "(", "hashFunction", ",", "gp", ")", ";", "}", "return", "drums", ";", "}" ]
Creates or opens the table. If the directory doesn't exists it will be created. @param hashFunction the hash function, decides where to store/search elements @param gp pointer to the {@link DRUMSParameterSet} used by the {@link DRUMS} to open @see #openTable(AccessMode, DRUMSParameterSet) @see #createTable(AbstractHashFunction, DRUMSParameterSet) @return a DRUMS instance @throws IOException
[ "Creates", "or", "opens", "the", "table", ".", "If", "the", "directory", "doesn", "t", "exists", "it", "will", "be", "created", "." ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/api/DRUMSInstantiator.java#L129-L140
150,219
jtrfp/javamod
src/main/java/de/quippy/javamod/main/gui/tools/FileChooserFilter.java
FileChooserFilter.accept
@Override public boolean accept(final File f) { if (f.isDirectory()) return true; int len = extensions.size(); if (len == 0) return true; for (int i=0; i<len; i++) { String suffix = extensions.get(i); if (suffix.equals("*")) return true; if (f.getName().toLowerCase().endsWith('.' + suffix)) return true; if (f.getName().toLowerCase().startsWith(suffix + '.')) return true; // Amiga Mods *start* with suffix, e.g. "mod.songname" } return false; }
java
@Override public boolean accept(final File f) { if (f.isDirectory()) return true; int len = extensions.size(); if (len == 0) return true; for (int i=0; i<len; i++) { String suffix = extensions.get(i); if (suffix.equals("*")) return true; if (f.getName().toLowerCase().endsWith('.' + suffix)) return true; if (f.getName().toLowerCase().startsWith(suffix + '.')) return true; // Amiga Mods *start* with suffix, e.g. "mod.songname" } return false; }
[ "@", "Override", "public", "boolean", "accept", "(", "final", "File", "f", ")", "{", "if", "(", "f", ".", "isDirectory", "(", ")", ")", "return", "true", ";", "int", "len", "=", "extensions", ".", "size", "(", ")", ";", "if", "(", "len", "==", "0", ")", "return", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "String", "suffix", "=", "extensions", ".", "get", "(", "i", ")", ";", "if", "(", "suffix", ".", "equals", "(", "\"*\"", ")", ")", "return", "true", ";", "if", "(", "f", ".", "getName", "(", ")", ".", "toLowerCase", "(", ")", ".", "endsWith", "(", "'", "'", "+", "suffix", ")", ")", "return", "true", ";", "if", "(", "f", ".", "getName", "(", ")", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "suffix", "+", "'", "'", ")", ")", "return", "true", ";", "// Amiga Mods *start* with suffix, e.g. \"mod.songname\"", "}", "return", "false", ";", "}" ]
Whether the given file is accepted by this filter. @param f java.io.File @return boolean
[ "Whether", "the", "given", "file", "is", "accepted", "by", "this", "filter", "." ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/tools/FileChooserFilter.java#L100-L114
150,220
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java
Ci_ScRun.interpretInfo
protected int interpretInfo(LineParser lp, MessageMgr mm){ String fileName = this.getFileName(lp); String content = this.getContent(fileName, mm); if(content==null){ return 1; } String[] lines = StringUtils.split(content, "\n"); String info = null; for(String s : lines){ if(s.startsWith("//**")){ info = StringUtils.substringAfter(s, "//**"); break; } } if(info!=null){ mm.report(MessageMgr.createInfoMessage("script {} - info: {}", new Object[]{fileName, info})); // Skb_Console.conInfo("{}: script {} - info: {}", new Object[]{shell.getPromptName(), fileName, info}); } return 0; }
java
protected int interpretInfo(LineParser lp, MessageMgr mm){ String fileName = this.getFileName(lp); String content = this.getContent(fileName, mm); if(content==null){ return 1; } String[] lines = StringUtils.split(content, "\n"); String info = null; for(String s : lines){ if(s.startsWith("//**")){ info = StringUtils.substringAfter(s, "//**"); break; } } if(info!=null){ mm.report(MessageMgr.createInfoMessage("script {} - info: {}", new Object[]{fileName, info})); // Skb_Console.conInfo("{}: script {} - info: {}", new Object[]{shell.getPromptName(), fileName, info}); } return 0; }
[ "protected", "int", "interpretInfo", "(", "LineParser", "lp", ",", "MessageMgr", "mm", ")", "{", "String", "fileName", "=", "this", ".", "getFileName", "(", "lp", ")", ";", "String", "content", "=", "this", ".", "getContent", "(", "fileName", ",", "mm", ")", ";", "if", "(", "content", "==", "null", ")", "{", "return", "1", ";", "}", "String", "[", "]", "lines", "=", "StringUtils", ".", "split", "(", "content", ",", "\"\\n\"", ")", ";", "String", "info", "=", "null", ";", "for", "(", "String", "s", ":", "lines", ")", "{", "if", "(", "s", ".", "startsWith", "(", "\"//**\"", ")", ")", "{", "info", "=", "StringUtils", ".", "substringAfter", "(", "s", ",", "\"//**\"", ")", ";", "break", ";", "}", "}", "if", "(", "info", "!=", "null", ")", "{", "mm", ".", "report", "(", "MessageMgr", ".", "createInfoMessage", "(", "\"script {} - info: {}\"", ",", "new", "Object", "[", "]", "{", "fileName", ",", "info", "}", ")", ")", ";", "//\t\t\tSkb_Console.conInfo(\"{}: script {} - info: {}\", new Object[]{shell.getPromptName(), fileName, info});", "}", "return", "0", ";", "}" ]
Interprets the actual info command @param lp line parser @param mm the message manager to use for reporting errors, warnings, and infos @return 0 for success, non-zero otherwise
[ "Interprets", "the", "actual", "info", "command" ]
6d845bcc482aa9344d016e80c0c3455aeae13a13
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java#L134-L154
150,221
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java
Ci_ScRun.interpretLs
protected int interpretLs(LineParser lp, MessageMgr mm){ String directory = lp.getArgs(); IOFileFilter fileFilter = new WildcardFileFilter(new String[]{ "*.ssc" }); DirectoryLoader dl = new CommonsDirectoryWalker(directory, DirectoryFileFilter.INSTANCE, fileFilter); if(dl.getLoadErrors().hasErrors()){ mm.report(dl.getLoadErrors()); return 1; } FileSourceList fsl = dl.load(); if(dl.getLoadErrors().hasErrors()){ mm.report(dl.getLoadErrors()); return 1; } for(FileSource fs : fsl.getSource()){ //TODO need to adapt to new source return mm.report(MessageMgr.createInfoMessage("script file - dir <{}> file <{}>", directory, fs.getBaseFileName())); } return 0; }
java
protected int interpretLs(LineParser lp, MessageMgr mm){ String directory = lp.getArgs(); IOFileFilter fileFilter = new WildcardFileFilter(new String[]{ "*.ssc" }); DirectoryLoader dl = new CommonsDirectoryWalker(directory, DirectoryFileFilter.INSTANCE, fileFilter); if(dl.getLoadErrors().hasErrors()){ mm.report(dl.getLoadErrors()); return 1; } FileSourceList fsl = dl.load(); if(dl.getLoadErrors().hasErrors()){ mm.report(dl.getLoadErrors()); return 1; } for(FileSource fs : fsl.getSource()){ //TODO need to adapt to new source return mm.report(MessageMgr.createInfoMessage("script file - dir <{}> file <{}>", directory, fs.getBaseFileName())); } return 0; }
[ "protected", "int", "interpretLs", "(", "LineParser", "lp", ",", "MessageMgr", "mm", ")", "{", "String", "directory", "=", "lp", ".", "getArgs", "(", ")", ";", "IOFileFilter", "fileFilter", "=", "new", "WildcardFileFilter", "(", "new", "String", "[", "]", "{", "\"*.ssc\"", "}", ")", ";", "DirectoryLoader", "dl", "=", "new", "CommonsDirectoryWalker", "(", "directory", ",", "DirectoryFileFilter", ".", "INSTANCE", ",", "fileFilter", ")", ";", "if", "(", "dl", ".", "getLoadErrors", "(", ")", ".", "hasErrors", "(", ")", ")", "{", "mm", ".", "report", "(", "dl", ".", "getLoadErrors", "(", ")", ")", ";", "return", "1", ";", "}", "FileSourceList", "fsl", "=", "dl", ".", "load", "(", ")", ";", "if", "(", "dl", ".", "getLoadErrors", "(", ")", ".", "hasErrors", "(", ")", ")", "{", "mm", ".", "report", "(", "dl", ".", "getLoadErrors", "(", ")", ")", ";", "return", "1", ";", "}", "for", "(", "FileSource", "fs", ":", "fsl", ".", "getSource", "(", ")", ")", "{", "//TODO need to adapt to new source return", "mm", ".", "report", "(", "MessageMgr", ".", "createInfoMessage", "(", "\"script file - dir <{}> file <{}>\"", ",", "directory", ",", "fs", ".", "getBaseFileName", "(", ")", ")", ")", ";", "}", "return", "0", ";", "}" ]
Interprets the actual ls command @param lp line parser @param mm the message manager to use for reporting errors, warnings, and infos @return 0 for success, non-zero otherwise
[ "Interprets", "the", "actual", "ls", "command" ]
6d845bcc482aa9344d016e80c0c3455aeae13a13
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java#L162-L182
150,222
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java
Ci_ScRun.interpretRun
protected int interpretRun(LineParser lp, MessageMgr mm){ String fileName = this.getFileName(lp); String content = this.getContent(fileName, mm); if(content==null){ return 1; } mm.report(MessageMgr.createInfoMessage("")); mm.report(MessageMgr.createInfoMessage("running file {}", fileName)); for(String s : StringUtils.split(content, '\n')){ if(this.printProgress==true && MessageConsole.PRINT_MESSAGES){ System.out.print("."); } this.skbShell.parseLine(s); } this.lastScript = fileName; return 0; }
java
protected int interpretRun(LineParser lp, MessageMgr mm){ String fileName = this.getFileName(lp); String content = this.getContent(fileName, mm); if(content==null){ return 1; } mm.report(MessageMgr.createInfoMessage("")); mm.report(MessageMgr.createInfoMessage("running file {}", fileName)); for(String s : StringUtils.split(content, '\n')){ if(this.printProgress==true && MessageConsole.PRINT_MESSAGES){ System.out.print("."); } this.skbShell.parseLine(s); } this.lastScript = fileName; return 0; }
[ "protected", "int", "interpretRun", "(", "LineParser", "lp", ",", "MessageMgr", "mm", ")", "{", "String", "fileName", "=", "this", ".", "getFileName", "(", "lp", ")", ";", "String", "content", "=", "this", ".", "getContent", "(", "fileName", ",", "mm", ")", ";", "if", "(", "content", "==", "null", ")", "{", "return", "1", ";", "}", "mm", ".", "report", "(", "MessageMgr", ".", "createInfoMessage", "(", "\"\"", ")", ")", ";", "mm", ".", "report", "(", "MessageMgr", ".", "createInfoMessage", "(", "\"running file {}\"", ",", "fileName", ")", ")", ";", "for", "(", "String", "s", ":", "StringUtils", ".", "split", "(", "content", ",", "'", "'", ")", ")", "{", "if", "(", "this", ".", "printProgress", "==", "true", "&&", "MessageConsole", ".", "PRINT_MESSAGES", ")", "{", "System", ".", "out", ".", "print", "(", "\".\"", ")", ";", "}", "this", ".", "skbShell", ".", "parseLine", "(", "s", ")", ";", "}", "this", ".", "lastScript", "=", "fileName", ";", "return", "0", ";", "}" ]
Interprets the actual run command @param lp line parser @param mm the message manager to use for reporting errors, warnings, and infos @return 0 for success, non-zero otherwise
[ "Interprets", "the", "actual", "run", "command" ]
6d845bcc482aa9344d016e80c0c3455aeae13a13
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java#L190-L209
150,223
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java
Ci_ScRun.getFileName
protected String getFileName(LineParser lp){ String fileName = lp.getArgs(); if(fileName==null){ fileName = this.lastScript; } else if(!fileName.endsWith("." + SCRIPT_FILE_EXTENSION)){ fileName += "." + SCRIPT_FILE_EXTENSION; } return fileName; }
java
protected String getFileName(LineParser lp){ String fileName = lp.getArgs(); if(fileName==null){ fileName = this.lastScript; } else if(!fileName.endsWith("." + SCRIPT_FILE_EXTENSION)){ fileName += "." + SCRIPT_FILE_EXTENSION; } return fileName; }
[ "protected", "String", "getFileName", "(", "LineParser", "lp", ")", "{", "String", "fileName", "=", "lp", ".", "getArgs", "(", ")", ";", "if", "(", "fileName", "==", "null", ")", "{", "fileName", "=", "this", ".", "lastScript", ";", "}", "else", "if", "(", "!", "fileName", ".", "endsWith", "(", "\".\"", "+", "SCRIPT_FILE_EXTENSION", ")", ")", "{", "fileName", "+=", "\".\"", "+", "SCRIPT_FILE_EXTENSION", ";", "}", "return", "fileName", ";", "}" ]
Returns a file name taken as argument from the line parser with fixed extension @param lp line parser @return file name, null if none found
[ "Returns", "a", "file", "name", "taken", "as", "argument", "from", "the", "line", "parser", "with", "fixed", "extension" ]
6d845bcc482aa9344d016e80c0c3455aeae13a13
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java#L216-L225
150,224
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java
Ci_ScRun.getContent
protected String getContent(String fileName, MessageMgr mm){ StringFileLoader sfl = new StringFileLoader(fileName); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } String content = sfl.load(); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } if(content==null){ mm.report(MessageMgr.createErrorMessage("run: unexpected problem with run script, content was null")); return null; } return content; }
java
protected String getContent(String fileName, MessageMgr mm){ StringFileLoader sfl = new StringFileLoader(fileName); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } String content = sfl.load(); if(sfl.getLoadErrors().hasErrors()){ mm.report(sfl.getLoadErrors()); return null; } if(content==null){ mm.report(MessageMgr.createErrorMessage("run: unexpected problem with run script, content was null")); return null; } return content; }
[ "protected", "String", "getContent", "(", "String", "fileName", ",", "MessageMgr", "mm", ")", "{", "StringFileLoader", "sfl", "=", "new", "StringFileLoader", "(", "fileName", ")", ";", "if", "(", "sfl", ".", "getLoadErrors", "(", ")", ".", "hasErrors", "(", ")", ")", "{", "mm", ".", "report", "(", "sfl", ".", "getLoadErrors", "(", ")", ")", ";", "return", "null", ";", "}", "String", "content", "=", "sfl", ".", "load", "(", ")", ";", "if", "(", "sfl", ".", "getLoadErrors", "(", ")", ".", "hasErrors", "(", ")", ")", "{", "mm", ".", "report", "(", "sfl", ".", "getLoadErrors", "(", ")", ")", ";", "return", "null", ";", "}", "if", "(", "content", "==", "null", ")", "{", "mm", ".", "report", "(", "MessageMgr", ".", "createErrorMessage", "(", "\"run: unexpected problem with run script, content was null\"", ")", ")", ";", "return", "null", ";", "}", "return", "content", ";", "}" ]
Returns the content of a string read from a file. @param fileName name of file to read from @param mm the message manager to use for reporting errors, warnings, and infos @return null if no content could be found (error), content in string otherwise
[ "Returns", "the", "content", "of", "a", "string", "read", "from", "a", "file", "." ]
6d845bcc482aa9344d016e80c0c3455aeae13a13
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/Ci_ScRun.java#L233-L250
150,225
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java
TraversalContext.proceedTo
<T extends Entity<?, ?>> Builder<BE, T> proceedTo(Relationships.WellKnown over, Class<T> entityType) { return new Builder<>(this, hop(), Query.filter(), entityType).hop(Related.by(over), type(entityType)); }
java
<T extends Entity<?, ?>> Builder<BE, T> proceedTo(Relationships.WellKnown over, Class<T> entityType) { return new Builder<>(this, hop(), Query.filter(), entityType).hop(Related.by(over), type(entityType)); }
[ "<", "T", "extends", "Entity", "<", "?", ",", "?", ">", ">", "Builder", "<", "BE", ",", "T", ">", "proceedTo", "(", "Relationships", ".", "WellKnown", "over", ",", "Class", "<", "T", ">", "entityType", ")", "{", "return", "new", "Builder", "<>", "(", "this", ",", "hop", "(", ")", ",", "Query", ".", "filter", "(", ")", ",", "entityType", ")", ".", "hop", "(", "Related", ".", "by", "(", "over", ")", ",", "type", "(", "entityType", ")", ")", ";", "}" ]
The new context will have the source path composed by appending current select candidates to the current source path and its select candidates will filter for entities related by the provided relationship to the new sources and will have the provided type. @param over the relationship with which the select candidates will be related to the entities on the source path @param entityType the type of the entities related to the entities on the source path @param <T> the type of the "target" entities @return a context builder with the modified source path, select candidates and type
[ "The", "new", "context", "will", "have", "the", "source", "path", "composed", "by", "appending", "current", "select", "candidates", "to", "the", "current", "source", "path", "and", "its", "select", "candidates", "will", "filter", "for", "entities", "related", "by", "the", "provided", "relationship", "to", "the", "new", "sources", "and", "will", "have", "the", "provided", "type", "." ]
f56dc10323dca21777feb5b609a9e9cc70ffaf62
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java#L160-L162
150,226
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java
TraversalContext.proceedWithParents
<T extends Entity<?, ?>, P extends Enum<P> & Parents> TraversalContext<BE, T> proceedWithParents(Class<T> nextEntityType, Class<P> parentsType, P currentParent, P[] parents, BiConsumer<P, Query.SymmetricExtender> hopBuilder) { EnumSet<P> ps = ParentsUtil.convert(parentsType, currentParent, parents); TraversalContext.Builder<BE, E> bld = proceed(); for (P p : ps) { Query.Builder qb = bld.rawQueryBuilder(); qb = qb.branch(); Query.SymmetricExtender extender = qb.symmetricExtender(); hopBuilder.accept(p, extender); qb.done(); } return bld.getting(nextEntityType); }
java
<T extends Entity<?, ?>, P extends Enum<P> & Parents> TraversalContext<BE, T> proceedWithParents(Class<T> nextEntityType, Class<P> parentsType, P currentParent, P[] parents, BiConsumer<P, Query.SymmetricExtender> hopBuilder) { EnumSet<P> ps = ParentsUtil.convert(parentsType, currentParent, parents); TraversalContext.Builder<BE, E> bld = proceed(); for (P p : ps) { Query.Builder qb = bld.rawQueryBuilder(); qb = qb.branch(); Query.SymmetricExtender extender = qb.symmetricExtender(); hopBuilder.accept(p, extender); qb.done(); } return bld.getting(nextEntityType); }
[ "<", "T", "extends", "Entity", "<", "?", ",", "?", ">", ",", "P", "extends", "Enum", "<", "P", ">", "&", "Parents", ">", "TraversalContext", "<", "BE", ",", "T", ">", "proceedWithParents", "(", "Class", "<", "T", ">", "nextEntityType", ",", "Class", "<", "P", ">", "parentsType", ",", "P", "currentParent", ",", "P", "[", "]", "parents", ",", "BiConsumer", "<", "P", ",", "Query", ".", "SymmetricExtender", ">", "hopBuilder", ")", "{", "EnumSet", "<", "P", ">", "ps", "=", "ParentsUtil", ".", "convert", "(", "parentsType", ",", "currentParent", ",", "parents", ")", ";", "TraversalContext", ".", "Builder", "<", "BE", ",", "E", ">", "bld", "=", "proceed", "(", ")", ";", "for", "(", "P", "p", ":", "ps", ")", "{", "Query", ".", "Builder", "qb", "=", "bld", ".", "rawQueryBuilder", "(", ")", ";", "qb", "=", "qb", ".", "branch", "(", ")", ";", "Query", ".", "SymmetricExtender", "extender", "=", "qb", ".", "symmetricExtender", "(", ")", ";", "hopBuilder", ".", "accept", "(", "p", ",", "extender", ")", ";", "qb", ".", "done", "(", ")", ";", "}", "return", "bld", ".", "getting", "(", "nextEntityType", ")", ";", "}" ]
Proceeds the traversal to the next entities taking into account what parents the next entities should have. @param nextEntityType the type of the entities the new context will target @param parentsType the type of the enum containing the possible parent types @param currentParent the parent type representing the current position in the traversal @param parents the parents to proceed to target entities over @param hopBuilder the producer function that will convert the parent into a filter path to apply to the traversal @param <T> the type of the next entity @param <P> the type of the enum of the possible parents of the target entity @return a new traversal context
[ "Proceeds", "the", "traversal", "to", "the", "next", "entities", "taking", "into", "account", "what", "parents", "the", "next", "entities", "should", "have", "." ]
f56dc10323dca21777feb5b609a9e9cc70ffaf62
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java#L191-L207
150,227
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java
TraversalContext.proceedToRelationships
Builder<BE, Relationship> proceedToRelationships(Relationships.Direction direction) { return new Builder<>(this, hop(), Query.filter(), Relationship.class) .hop(new SwitchElementType(direction, false)); }
java
Builder<BE, Relationship> proceedToRelationships(Relationships.Direction direction) { return new Builder<>(this, hop(), Query.filter(), Relationship.class) .hop(new SwitchElementType(direction, false)); }
[ "Builder", "<", "BE", ",", "Relationship", ">", "proceedToRelationships", "(", "Relationships", ".", "Direction", "direction", ")", "{", "return", "new", "Builder", "<>", "(", "this", ",", "hop", "(", ")", ",", "Query", ".", "filter", "(", ")", ",", "Relationship", ".", "class", ")", ".", "hop", "(", "new", "SwitchElementType", "(", "direction", ",", "false", ")", ")", ";", "}" ]
The new context will have the source path composed by appending current select candidates to the current source path. The new context will have select candidates such that it will select the relationships in given direction stemming from the entities on the new source path. @param direction the direction of the relationships to look for @return a context builder with the modified source path, select candidates and type
[ "The", "new", "context", "will", "have", "the", "source", "path", "composed", "by", "appending", "current", "select", "candidates", "to", "the", "current", "source", "path", ".", "The", "new", "context", "will", "have", "select", "candidates", "such", "that", "it", "will", "select", "the", "relationships", "in", "given", "direction", "stemming", "from", "the", "entities", "on", "the", "new", "source", "path", "." ]
f56dc10323dca21777feb5b609a9e9cc70ffaf62
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java#L217-L220
150,228
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java
TraversalContext.replacePath
TraversalContext<BE, E> replacePath(Query path) { return new TraversalContext<>(inventory, path, Query.empty(), backend, entityClass, configuration, observableContext, transactionRetries, this, null, transactionConstructor); }
java
TraversalContext<BE, E> replacePath(Query path) { return new TraversalContext<>(inventory, path, Query.empty(), backend, entityClass, configuration, observableContext, transactionRetries, this, null, transactionConstructor); }
[ "TraversalContext", "<", "BE", ",", "E", ">", "replacePath", "(", "Query", "path", ")", "{", "return", "new", "TraversalContext", "<>", "(", "inventory", ",", "path", ",", "Query", ".", "empty", "(", ")", ",", "backend", ",", "entityClass", ",", "configuration", ",", "observableContext", ",", "transactionRetries", ",", "this", ",", "null", ",", "transactionConstructor", ")", ";", "}" ]
Constructs a new traversal context by replacing the source path with the provided query and clearing out the selected candidates. @param path the source path of the new context @return a new traversal context with the provided source path and empty select candidates, but otherwise identical to this one.
[ "Constructs", "a", "new", "traversal", "context", "by", "replacing", "the", "source", "path", "with", "the", "provided", "query", "and", "clearing", "out", "the", "selected", "candidates", "." ]
f56dc10323dca21777feb5b609a9e9cc70ffaf62
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java#L260-L263
150,229
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/FileMonitorSource.java
FileMonitorSource.getLinesFrom
@Override public List<MonitorLine> getLinesFrom(Object actual) throws Exception { //TODO Enhance line retrieve to get last lines directly String line; Integer currentLineNo = 0; final List<MonitorLine> result = new ArrayList<MonitorLine>(); BufferedReader in = null; try { in = new BufferedReader(new FileReader(getFilename())); Integer startLine = (actual == null) ? 0 : (Integer) actual; //read to startLine while (currentLineNo < startLine + 1) { if (in.readLine() == null) { throw new IOException("File too small"); } currentLineNo++; } //read until endLine line = in.readLine(); while (line != null) { result.add(new MonitorLine(currentLineNo, line)); currentLineNo++; line = in.readLine(); } } finally { try { if (in != null) { in.close(); } } catch (IOException ignore) { } } return result; }
java
@Override public List<MonitorLine> getLinesFrom(Object actual) throws Exception { //TODO Enhance line retrieve to get last lines directly String line; Integer currentLineNo = 0; final List<MonitorLine> result = new ArrayList<MonitorLine>(); BufferedReader in = null; try { in = new BufferedReader(new FileReader(getFilename())); Integer startLine = (actual == null) ? 0 : (Integer) actual; //read to startLine while (currentLineNo < startLine + 1) { if (in.readLine() == null) { throw new IOException("File too small"); } currentLineNo++; } //read until endLine line = in.readLine(); while (line != null) { result.add(new MonitorLine(currentLineNo, line)); currentLineNo++; line = in.readLine(); } } finally { try { if (in != null) { in.close(); } } catch (IOException ignore) { } } return result; }
[ "@", "Override", "public", "List", "<", "MonitorLine", ">", "getLinesFrom", "(", "Object", "actual", ")", "throws", "Exception", "{", "//TODO Enhance line retrieve to get last lines directly", "String", "line", ";", "Integer", "currentLineNo", "=", "0", ";", "final", "List", "<", "MonitorLine", ">", "result", "=", "new", "ArrayList", "<", "MonitorLine", ">", "(", ")", ";", "BufferedReader", "in", "=", "null", ";", "try", "{", "in", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "getFilename", "(", ")", ")", ")", ";", "Integer", "startLine", "=", "(", "actual", "==", "null", ")", "?", "0", ":", "(", "Integer", ")", "actual", ";", "//read to startLine", "while", "(", "currentLineNo", "<", "startLine", "+", "1", ")", "{", "if", "(", "in", ".", "readLine", "(", ")", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"File too small\"", ")", ";", "}", "currentLineNo", "++", ";", "}", "//read until endLine", "line", "=", "in", ".", "readLine", "(", ")", ";", "while", "(", "line", "!=", "null", ")", "{", "result", ".", "add", "(", "new", "MonitorLine", "(", "currentLineNo", ",", "line", ")", ")", ";", "currentLineNo", "++", ";", "line", "=", "in", ".", "readLine", "(", ")", ";", "}", "}", "finally", "{", "try", "{", "if", "(", "in", "!=", "null", ")", "{", "in", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "IOException", "ignore", ")", "{", "}", "}", "return", "result", ";", "}" ]
Get the file lines since the actual until the last. @param actual Actual line identification @return The list of lines @throws Exception
[ "Get", "the", "file", "lines", "since", "the", "actual", "until", "the", "last", "." ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/FileMonitorSource.java#L26-L60
150,230
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/FileMonitorSource.java
FileMonitorSource.getLastLine
@Override public List<MonitorLine> getLastLine(Integer count) throws Exception { String line; final List<MonitorLine> result = new ArrayList<MonitorLine>(); BufferedReader in = null; try { in = new BufferedReader(new FileReader(getFilename())); int i = 0; line = in.readLine(); while (line != null) { result.add(new MonitorLine(i, line)); i++; line = in.readLine(); } } finally { try { if (in != null) { in.close(); } } catch (IOException ignore) { } } if (result.size() <= count) { return result; } else { return result.subList(result.size() - count, result.size()); } }
java
@Override public List<MonitorLine> getLastLine(Integer count) throws Exception { String line; final List<MonitorLine> result = new ArrayList<MonitorLine>(); BufferedReader in = null; try { in = new BufferedReader(new FileReader(getFilename())); int i = 0; line = in.readLine(); while (line != null) { result.add(new MonitorLine(i, line)); i++; line = in.readLine(); } } finally { try { if (in != null) { in.close(); } } catch (IOException ignore) { } } if (result.size() <= count) { return result; } else { return result.subList(result.size() - count, result.size()); } }
[ "@", "Override", "public", "List", "<", "MonitorLine", ">", "getLastLine", "(", "Integer", "count", ")", "throws", "Exception", "{", "String", "line", ";", "final", "List", "<", "MonitorLine", ">", "result", "=", "new", "ArrayList", "<", "MonitorLine", ">", "(", ")", ";", "BufferedReader", "in", "=", "null", ";", "try", "{", "in", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "getFilename", "(", ")", ")", ")", ";", "int", "i", "=", "0", ";", "line", "=", "in", ".", "readLine", "(", ")", ";", "while", "(", "line", "!=", "null", ")", "{", "result", ".", "add", "(", "new", "MonitorLine", "(", "i", ",", "line", ")", ")", ";", "i", "++", ";", "line", "=", "in", ".", "readLine", "(", ")", ";", "}", "}", "finally", "{", "try", "{", "if", "(", "in", "!=", "null", ")", "{", "in", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "IOException", "ignore", ")", "{", "}", "}", "if", "(", "result", ".", "size", "(", ")", "<=", "count", ")", "{", "return", "result", ";", "}", "else", "{", "return", "result", ".", "subList", "(", "result", ".", "size", "(", ")", "-", "count", ",", "result", ".", "size", "(", ")", ")", ";", "}", "}" ]
Return the last file line @return The line @throws Exception
[ "Return", "the", "last", "file", "line" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/FileMonitorSource.java#L68-L95
150,231
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/renderer/DefaultTableHeaderCellRenderer.java
DefaultTableHeaderCellRenderer.getIcon
@SuppressWarnings("incomplete-switch") protected Icon getIcon(JTable table, int column) { SortKey sortKey = getSortKey(table, column); if (sortKey != null && table.convertColumnIndexToView(sortKey.getColumn()) == column) { switch (sortKey.getSortOrder()) { case ASCENDING: return UIManager.getIcon("Table.ascendingSortIcon"); case DESCENDING: return UIManager.getIcon("Table.descendingSortIcon"); } } return null; }
java
@SuppressWarnings("incomplete-switch") protected Icon getIcon(JTable table, int column) { SortKey sortKey = getSortKey(table, column); if (sortKey != null && table.convertColumnIndexToView(sortKey.getColumn()) == column) { switch (sortKey.getSortOrder()) { case ASCENDING: return UIManager.getIcon("Table.ascendingSortIcon"); case DESCENDING: return UIManager.getIcon("Table.descendingSortIcon"); } } return null; }
[ "@", "SuppressWarnings", "(", "\"incomplete-switch\"", ")", "protected", "Icon", "getIcon", "(", "JTable", "table", ",", "int", "column", ")", "{", "SortKey", "sortKey", "=", "getSortKey", "(", "table", ",", "column", ")", ";", "if", "(", "sortKey", "!=", "null", "&&", "table", ".", "convertColumnIndexToView", "(", "sortKey", ".", "getColumn", "(", ")", ")", "==", "column", ")", "{", "switch", "(", "sortKey", ".", "getSortOrder", "(", ")", ")", "{", "case", "ASCENDING", ":", "return", "UIManager", ".", "getIcon", "(", "\"Table.ascendingSortIcon\"", ")", ";", "case", "DESCENDING", ":", "return", "UIManager", ".", "getIcon", "(", "\"Table.descendingSortIcon\"", ")", ";", "}", "}", "return", "null", ";", "}" ]
Overloaded to return an icon suitable to the primary sorted column, or null if the column is not the primary sort key. @param table the <code>JTable</code>. @param column the column index. @return the sort icon, or null if the column is unsorted.
[ "Overloaded", "to", "return", "an", "icon", "suitable", "to", "the", "primary", "sorted", "column", "or", "null", "if", "the", "column", "is", "not", "the", "primary", "sort", "key", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/renderer/DefaultTableHeaderCellRenderer.java#L80-L92
150,232
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/Monitor.java
Monitor.run
@Override public void run() { while (true) { if (countObservers() == 0) { try { Thread.sleep(Long.MAX_VALUE); } catch (InterruptedException e) { } } else { startWatching(); while (countObservers() > 0) { getNewLines(); try { Thread.sleep(getDelay()); } catch (InterruptedException e) { } } } } }
java
@Override public void run() { while (true) { if (countObservers() == 0) { try { Thread.sleep(Long.MAX_VALUE); } catch (InterruptedException e) { } } else { startWatching(); while (countObservers() > 0) { getNewLines(); try { Thread.sleep(getDelay()); } catch (InterruptedException e) { } } } } }
[ "@", "Override", "public", "void", "run", "(", ")", "{", "while", "(", "true", ")", "{", "if", "(", "countObservers", "(", ")", "==", "0", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "Long", ".", "MAX_VALUE", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "}", "else", "{", "startWatching", "(", ")", ";", "while", "(", "countObservers", "(", ")", ">", "0", ")", "{", "getNewLines", "(", ")", ";", "try", "{", "Thread", ".", "sleep", "(", "getDelay", "(", ")", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "}", "}", "}", "}" ]
Implemented from runnable
[ "Implemented", "from", "runnable" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/Monitor.java#L62-L81
150,233
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/Monitor.java
Monitor.startWatching
public void startWatching() { try { final List<MonitorLine> lines = getSource().getLastLine(getInitialCount()); actual = null; updateLines(lines); } catch (Exception e) { notifyObservers(e); } }
java
public void startWatching() { try { final List<MonitorLine> lines = getSource().getLastLine(getInitialCount()); actual = null; updateLines(lines); } catch (Exception e) { notifyObservers(e); } }
[ "public", "void", "startWatching", "(", ")", "{", "try", "{", "final", "List", "<", "MonitorLine", ">", "lines", "=", "getSource", "(", ")", ".", "getLastLine", "(", "getInitialCount", "(", ")", ")", ";", "actual", "=", "null", ";", "updateLines", "(", "lines", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "notifyObservers", "(", "e", ")", ";", "}", "}" ]
Start watching a monitor
[ "Start", "watching", "a", "monitor" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/Monitor.java#L86-L94
150,234
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/Monitor.java
Monitor.getNewLines
public void getNewLines() { try { List<MonitorLine> lines; if (getAll()) { lines = getSource().getLinesFrom(null); } else { lines = getSource().getLinesFrom(actual); } updateLines(lines); } catch (Exception e) { notifyObservers(e); } }
java
public void getNewLines() { try { List<MonitorLine> lines; if (getAll()) { lines = getSource().getLinesFrom(null); } else { lines = getSource().getLinesFrom(actual); } updateLines(lines); } catch (Exception e) { notifyObservers(e); } }
[ "public", "void", "getNewLines", "(", ")", "{", "try", "{", "List", "<", "MonitorLine", ">", "lines", ";", "if", "(", "getAll", "(", ")", ")", "{", "lines", "=", "getSource", "(", ")", ".", "getLinesFrom", "(", "null", ")", ";", "}", "else", "{", "lines", "=", "getSource", "(", ")", ".", "getLinesFrom", "(", "actual", ")", ";", "}", "updateLines", "(", "lines", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "notifyObservers", "(", "e", ")", ";", "}", "}" ]
Looks for new lines
[ "Looks", "for", "new", "lines" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/monitor/Monitor.java#L99-L111
150,235
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java
AbstractHeaderFile.createFile
protected void createFile() throws FileLockException, IOException { openChannel(); filledUpTo = 0; accessFile.setLength(DEFAULT_SIZE); size = DEFAULT_SIZE; filledUpTo = HEADER_SIZE; writeHeader(); }
java
protected void createFile() throws FileLockException, IOException { openChannel(); filledUpTo = 0; accessFile.setLength(DEFAULT_SIZE); size = DEFAULT_SIZE; filledUpTo = HEADER_SIZE; writeHeader(); }
[ "protected", "void", "createFile", "(", ")", "throws", "FileLockException", ",", "IOException", "{", "openChannel", "(", ")", ";", "filledUpTo", "=", "0", ";", "accessFile", ".", "setLength", "(", "DEFAULT_SIZE", ")", ";", "size", "=", "DEFAULT_SIZE", ";", "filledUpTo", "=", "HEADER_SIZE", ";", "writeHeader", "(", ")", ";", "}" ]
this method will be called to init the database-file
[ "this", "method", "will", "be", "called", "to", "init", "the", "database", "-", "file" ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java#L238-L245
150,236
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java
AbstractHeaderFile.unlock
public void unlock() throws IOException { System.runFinalization(); if (fileLock != null) { try { fileLock.release(); } catch (ClosedChannelException e) { throw new IOException("Can't close Channel in " + osFile + "."); } fileLock = null; } }
java
public void unlock() throws IOException { System.runFinalization(); if (fileLock != null) { try { fileLock.release(); } catch (ClosedChannelException e) { throw new IOException("Can't close Channel in " + osFile + "."); } fileLock = null; } }
[ "public", "void", "unlock", "(", ")", "throws", "IOException", "{", "System", ".", "runFinalization", "(", ")", ";", "if", "(", "fileLock", "!=", "null", ")", "{", "try", "{", "fileLock", ".", "release", "(", ")", ";", "}", "catch", "(", "ClosedChannelException", "e", ")", "{", "throw", "new", "IOException", "(", "\"Can't close Channel in \"", "+", "osFile", "+", "\".\"", ")", ";", "}", "fileLock", "=", "null", ";", "}", "}" ]
tries to unlock the file @throws IOException
[ "tries", "to", "unlock", "the", "file" ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java#L252-L262
150,237
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java
AbstractHeaderFile.lock
public void lock() throws FileLockException, IOException { if (mode == AccessMode.READ_ONLY) { return; } for (int retries = 0; retries < max_retries_connect; retries++) { try { fileLock = channel.lock(); break; // the lock was succesful } catch (OverlappingFileLockException e) { try { logger.debug("Can't open file '" + osFile.getAbsolutePath() + "' because it's locked. Waiting {} ms and retry {}", RETRY_CONNECT_WAITTIME, retries); System.runFinalization(); // FORCE FINALIZATION TO COLLECT ALL THE PENDING BUFFERS Thread.sleep(RETRY_CONNECT_WAITTIME); } catch (InterruptedException ex) { // will throw a FileLockException further } } } if (fileLock == null) { this.close(); throw new FileLockException("File " + osFile.getPath() + " is locked by another process, maybe the database is in use by another process."); } }
java
public void lock() throws FileLockException, IOException { if (mode == AccessMode.READ_ONLY) { return; } for (int retries = 0; retries < max_retries_connect; retries++) { try { fileLock = channel.lock(); break; // the lock was succesful } catch (OverlappingFileLockException e) { try { logger.debug("Can't open file '" + osFile.getAbsolutePath() + "' because it's locked. Waiting {} ms and retry {}", RETRY_CONNECT_WAITTIME, retries); System.runFinalization(); // FORCE FINALIZATION TO COLLECT ALL THE PENDING BUFFERS Thread.sleep(RETRY_CONNECT_WAITTIME); } catch (InterruptedException ex) { // will throw a FileLockException further } } } if (fileLock == null) { this.close(); throw new FileLockException("File " + osFile.getPath() + " is locked by another process, maybe the database is in use by another process."); } }
[ "public", "void", "lock", "(", ")", "throws", "FileLockException", ",", "IOException", "{", "if", "(", "mode", "==", "AccessMode", ".", "READ_ONLY", ")", "{", "return", ";", "}", "for", "(", "int", "retries", "=", "0", ";", "retries", "<", "max_retries_connect", ";", "retries", "++", ")", "{", "try", "{", "fileLock", "=", "channel", ".", "lock", "(", ")", ";", "break", ";", "// the lock was succesful", "}", "catch", "(", "OverlappingFileLockException", "e", ")", "{", "try", "{", "logger", ".", "debug", "(", "\"Can't open file '\"", "+", "osFile", ".", "getAbsolutePath", "(", ")", "+", "\"' because it's locked. Waiting {} ms and retry {}\"", ",", "RETRY_CONNECT_WAITTIME", ",", "retries", ")", ";", "System", ".", "runFinalization", "(", ")", ";", "// FORCE FINALIZATION TO COLLECT ALL THE PENDING BUFFERS", "Thread", ".", "sleep", "(", "RETRY_CONNECT_WAITTIME", ")", ";", "}", "catch", "(", "InterruptedException", "ex", ")", "{", "// will throw a FileLockException further", "}", "}", "}", "if", "(", "fileLock", "==", "null", ")", "{", "this", ".", "close", "(", ")", ";", "throw", "new", "FileLockException", "(", "\"File \"", "+", "osFile", ".", "getPath", "(", ")", "+", "\" is locked by another process, maybe the database is in use by another process.\"", ")", ";", "}", "}" ]
tries to lock the file @throws FileLockException @throws IOException
[ "tries", "to", "lock", "the", "file" ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java#L270-L297
150,238
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java
AbstractHeaderFile.checkRegions
protected long checkRegions(long offset, int length) throws IOException { if (offset + length > filledUpTo) throw new IOException("Can't access memory outside the file size (" + filledUpTo + " bytes). You've requested portion " + offset + "-" + (offset + length) + " bytes. File: " + osFile.getAbsolutePath() + "\n" + "actual Filesize: " + size + "\n" + "actual filledUpTo: " + filledUpTo); return offset; }
java
protected long checkRegions(long offset, int length) throws IOException { if (offset + length > filledUpTo) throw new IOException("Can't access memory outside the file size (" + filledUpTo + " bytes). You've requested portion " + offset + "-" + (offset + length) + " bytes. File: " + osFile.getAbsolutePath() + "\n" + "actual Filesize: " + size + "\n" + "actual filledUpTo: " + filledUpTo); return offset; }
[ "protected", "long", "checkRegions", "(", "long", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "if", "(", "offset", "+", "length", ">", "filledUpTo", ")", "throw", "new", "IOException", "(", "\"Can't access memory outside the file size (\"", "+", "filledUpTo", "+", "\" bytes). You've requested portion \"", "+", "offset", "+", "\"-\"", "+", "(", "offset", "+", "length", ")", "+", "\" bytes. File: \"", "+", "osFile", ".", "getAbsolutePath", "(", ")", "+", "\"\\n\"", "+", "\"actual Filesize: \"", "+", "size", "+", "\"\\n\"", "+", "\"actual filledUpTo: \"", "+", "filledUpTo", ")", ";", "return", "offset", ";", "}" ]
checks if the accessed region is accessible @param offset the byte-offset where to start @param length the length of the region to access @return the offset, if the region is accessible @throws IOException
[ "checks", "if", "the", "accessed", "region", "is", "accessible" ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java#L314-L321
150,239
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java
AbstractHeaderFile.close
public void close() { logger.debug("Try to close accessFile and channel for file: " + osFile); if (headerBuffer != null) { headerBuffer.force(); headerBuffer = null; } try { unlock(); if (channel != null && channel.isOpen()) { channel.close(); channel = null; } if (accessFile != null) { accessFile.close(); accessFile = null; } } catch (IOException e) { e.printStackTrace(); } logger.debug("Closed accessFile and channel for file: " + osFile); }
java
public void close() { logger.debug("Try to close accessFile and channel for file: " + osFile); if (headerBuffer != null) { headerBuffer.force(); headerBuffer = null; } try { unlock(); if (channel != null && channel.isOpen()) { channel.close(); channel = null; } if (accessFile != null) { accessFile.close(); accessFile = null; } } catch (IOException e) { e.printStackTrace(); } logger.debug("Closed accessFile and channel for file: " + osFile); }
[ "public", "void", "close", "(", ")", "{", "logger", ".", "debug", "(", "\"Try to close accessFile and channel for file: \"", "+", "osFile", ")", ";", "if", "(", "headerBuffer", "!=", "null", ")", "{", "headerBuffer", ".", "force", "(", ")", ";", "headerBuffer", "=", "null", ";", "}", "try", "{", "unlock", "(", ")", ";", "if", "(", "channel", "!=", "null", "&&", "channel", ".", "isOpen", "(", ")", ")", "{", "channel", ".", "close", "(", ")", ";", "channel", "=", "null", ";", "}", "if", "(", "accessFile", "!=", "null", ")", "{", "accessFile", ".", "close", "(", ")", ";", "accessFile", "=", "null", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "logger", ".", "debug", "(", "\"Closed accessFile and channel for file: \"", "+", "osFile", ")", ";", "}" ]
closes all open channels and the file
[ "closes", "all", "open", "channels", "and", "the", "file" ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java#L324-L346
150,240
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java
AbstractHeaderFile.delete
public void delete() throws IOException { close(); if (osFile != null) { boolean deleted = osFile.delete(); while (!deleted) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); logger.error("{} not deleted.", osFile); } System.gc(); deleted = osFile.delete(); } } }
java
public void delete() throws IOException { close(); if (osFile != null) { boolean deleted = osFile.delete(); while (!deleted) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); logger.error("{} not deleted.", osFile); } System.gc(); deleted = osFile.delete(); } } }
[ "public", "void", "delete", "(", ")", "throws", "IOException", "{", "close", "(", ")", ";", "if", "(", "osFile", "!=", "null", ")", "{", "boolean", "deleted", "=", "osFile", ".", "delete", "(", ")", ";", "while", "(", "!", "deleted", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "100", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "logger", ".", "error", "(", "\"{} not deleted.\"", ",", "osFile", ")", ";", "}", "System", ".", "gc", "(", ")", ";", "deleted", "=", "osFile", ".", "delete", "(", ")", ";", "}", "}", "}" ]
tries to delete the file @throws IOException
[ "tries", "to", "delete", "the", "file" ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java#L353-L368
150,241
WinRoad-NET/wrdocletbase
src/main/java/net/winroad/wrdoclet/builder/RESTDocBuilder.java
RESTDocBuilder.isInIgnoreParamList
protected boolean isInIgnoreParamList(Parameter param) { return "javax.servlet.http.HttpServletRequest".equals(param.type().qualifiedTypeName()) || "javax.servlet.http.HttpServletResponse".equals(param.type().qualifiedTypeName()) || "javax.servlet.http.HttpSession".equals(param.type().qualifiedTypeName()) || "org.springframework.web.context.request.WebRequest".equals(param.type().qualifiedTypeName()) || "java.io.OutputStream".equals(param.type().qualifiedTypeName()) || "org.springframework.http.HttpEntity<java.lang.String>".equals(param.type().qualifiedTypeName()); }
java
protected boolean isInIgnoreParamList(Parameter param) { return "javax.servlet.http.HttpServletRequest".equals(param.type().qualifiedTypeName()) || "javax.servlet.http.HttpServletResponse".equals(param.type().qualifiedTypeName()) || "javax.servlet.http.HttpSession".equals(param.type().qualifiedTypeName()) || "org.springframework.web.context.request.WebRequest".equals(param.type().qualifiedTypeName()) || "java.io.OutputStream".equals(param.type().qualifiedTypeName()) || "org.springframework.http.HttpEntity<java.lang.String>".equals(param.type().qualifiedTypeName()); }
[ "protected", "boolean", "isInIgnoreParamList", "(", "Parameter", "param", ")", "{", "return", "\"javax.servlet.http.HttpServletRequest\"", ".", "equals", "(", "param", ".", "type", "(", ")", ".", "qualifiedTypeName", "(", ")", ")", "||", "\"javax.servlet.http.HttpServletResponse\"", ".", "equals", "(", "param", ".", "type", "(", ")", ".", "qualifiedTypeName", "(", ")", ")", "||", "\"javax.servlet.http.HttpSession\"", ".", "equals", "(", "param", ".", "type", "(", ")", ".", "qualifiedTypeName", "(", ")", ")", "||", "\"org.springframework.web.context.request.WebRequest\"", ".", "equals", "(", "param", ".", "type", "(", ")", ".", "qualifiedTypeName", "(", ")", ")", "||", "\"java.io.OutputStream\"", ".", "equals", "(", "param", ".", "type", "(", ")", ".", "qualifiedTypeName", "(", ")", ")", "||", "\"org.springframework.http.HttpEntity<java.lang.String>\"", ".", "equals", "(", "param", ".", "type", "(", ")", ".", "qualifiedTypeName", "(", ")", ")", ";", "}" ]
param which will not be displayed in doc.
[ "param", "which", "will", "not", "be", "displayed", "in", "doc", "." ]
3c8386a7957a76c3f10a07d114052158976e22c7
https://github.com/WinRoad-NET/wrdocletbase/blob/3c8386a7957a76c3f10a07d114052158976e22c7/src/main/java/net/winroad/wrdoclet/builder/RESTDocBuilder.java#L393-L400
150,242
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java
HeaderIndexFile.write
@Override public void write(long offset, ByteBuffer sourceBuffer) throws IOException { offset += contentStart; sourceBuffer.position(0); long newFilePosition = offset + sourceBuffer.limit(); if (newFilePosition > contentEnd) { logger.debug("Filesize exceeded (contendEnd: {},size: {})", contentEnd, size); if (AUTO_ENLARGE) { // if the incrementSize is not large enough // if (offset + sourceBuffer.limit() > contentEnd + incrementSize) { // incrementSize = (int) (offset + sourceBuffer.limit() - contentEnd + incrementSize); // } this.enlargeFile(newFilePosition - contentEnd); } else { throw new IOException("Filesize exceeded (" + size + ") and automatic enlargement is disabled. You have to enlarge file manually."); } } if (offset + sourceBuffer.limit() > filledUpTo) { filledUpTo = offset + sourceBuffer.limit(); } channel.write(sourceBuffer, offset); writeHeader(); }
java
@Override public void write(long offset, ByteBuffer sourceBuffer) throws IOException { offset += contentStart; sourceBuffer.position(0); long newFilePosition = offset + sourceBuffer.limit(); if (newFilePosition > contentEnd) { logger.debug("Filesize exceeded (contendEnd: {},size: {})", contentEnd, size); if (AUTO_ENLARGE) { // if the incrementSize is not large enough // if (offset + sourceBuffer.limit() > contentEnd + incrementSize) { // incrementSize = (int) (offset + sourceBuffer.limit() - contentEnd + incrementSize); // } this.enlargeFile(newFilePosition - contentEnd); } else { throw new IOException("Filesize exceeded (" + size + ") and automatic enlargement is disabled. You have to enlarge file manually."); } } if (offset + sourceBuffer.limit() > filledUpTo) { filledUpTo = offset + sourceBuffer.limit(); } channel.write(sourceBuffer, offset); writeHeader(); }
[ "@", "Override", "public", "void", "write", "(", "long", "offset", ",", "ByteBuffer", "sourceBuffer", ")", "throws", "IOException", "{", "offset", "+=", "contentStart", ";", "sourceBuffer", ".", "position", "(", "0", ")", ";", "long", "newFilePosition", "=", "offset", "+", "sourceBuffer", ".", "limit", "(", ")", ";", "if", "(", "newFilePosition", ">", "contentEnd", ")", "{", "logger", ".", "debug", "(", "\"Filesize exceeded (contendEnd: {},size: {})\"", ",", "contentEnd", ",", "size", ")", ";", "if", "(", "AUTO_ENLARGE", ")", "{", "// if the incrementSize is not large enough", "// if (offset + sourceBuffer.limit() > contentEnd + incrementSize) {", "// incrementSize = (int) (offset + sourceBuffer.limit() - contentEnd + incrementSize);", "// }", "this", ".", "enlargeFile", "(", "newFilePosition", "-", "contentEnd", ")", ";", "}", "else", "{", "throw", "new", "IOException", "(", "\"Filesize exceeded (\"", "+", "size", "+", "\") and automatic enlargement is disabled. You have to enlarge file manually.\"", ")", ";", "}", "}", "if", "(", "offset", "+", "sourceBuffer", ".", "limit", "(", ")", ">", "filledUpTo", ")", "{", "filledUpTo", "=", "offset", "+", "sourceBuffer", ".", "limit", "(", ")", ";", "}", "channel", ".", "write", "(", "sourceBuffer", ",", "offset", ")", ";", "writeHeader", "(", ")", ";", "}" ]
writes the bytes from the given ByteBuffer to the file beginning at offset. The size of the HEADER will be respected automatically. @param offset @param sourceBuffer @throws IOException
[ "writes", "the", "bytes", "from", "the", "given", "ByteBuffer", "to", "the", "file", "beginning", "at", "offset", ".", "The", "size", "of", "the", "HEADER", "will", "be", "respected", "automatically", "." ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java#L218-L243
150,243
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java
HeaderIndexFile.enlargeFile
@Override public void enlargeFile(long toEnlarge) throws IOException { size += (long) Math.ceil((double) toEnlarge / incrementSize) * incrementSize; logger.debug("Enlarge filesize of {} to {}", osFile, size); contentEnd = size; accessFile.setLength(size); // TODO check buffer size // if there are more chunks than the index can contain if ((size - contentStart) / chunkSize > indexSize) { logger.error("File-Enlargement not possible. The index becomes too large."); throw new IOException("File-Enlargement not possible. The index becomes too large."); } calcIndexInformations(); }
java
@Override public void enlargeFile(long toEnlarge) throws IOException { size += (long) Math.ceil((double) toEnlarge / incrementSize) * incrementSize; logger.debug("Enlarge filesize of {} to {}", osFile, size); contentEnd = size; accessFile.setLength(size); // TODO check buffer size // if there are more chunks than the index can contain if ((size - contentStart) / chunkSize > indexSize) { logger.error("File-Enlargement not possible. The index becomes too large."); throw new IOException("File-Enlargement not possible. The index becomes too large."); } calcIndexInformations(); }
[ "@", "Override", "public", "void", "enlargeFile", "(", "long", "toEnlarge", ")", "throws", "IOException", "{", "size", "+=", "(", "long", ")", "Math", ".", "ceil", "(", "(", "double", ")", "toEnlarge", "/", "incrementSize", ")", "*", "incrementSize", ";", "logger", ".", "debug", "(", "\"Enlarge filesize of {} to {}\"", ",", "osFile", ",", "size", ")", ";", "contentEnd", "=", "size", ";", "accessFile", ".", "setLength", "(", "size", ")", ";", "// TODO check buffer size", "// if there are more chunks than the index can contain", "if", "(", "(", "size", "-", "contentStart", ")", "/", "chunkSize", ">", "indexSize", ")", "{", "logger", ".", "error", "(", "\"File-Enlargement not possible. The index becomes too large.\"", ")", ";", "throw", "new", "IOException", "(", "\"File-Enlargement not possible. The index becomes too large.\"", ")", ";", "}", "calcIndexInformations", "(", ")", ";", "}" ]
Rounds up the given size to the next full chunk, and enlarges the file by these amounts of bytes. @param toEnlarge @throws IOException
[ "Rounds", "up", "the", "given", "size", "to", "the", "next", "full", "chunk", "and", "enlarges", "the", "file", "by", "these", "amounts", "of", "bytes", "." ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java#L412-L426
150,244
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java
HeaderIndexFile.isConsistent
public boolean isConsistent() throws IOException { byte[] b = new byte[elementSize]; long offset = 0; byte[] oldKey = null; int i = 0; while (offset < this.getFilledUpFromContentStart()) { this.read(offset, ByteBuffer.wrap(b)); byte[] key = Arrays.copyOfRange(b, 0, keySize); if (oldKey != null && KeyUtils.compareKey(key, oldKey) != 1) { logger.error("File is not consistent at record {}. {} not larger than {}", new Object[] { i, KeyUtils.toStringUnsignedInt(key), KeyUtils.toStringUnsignedInt(oldKey) }); return false; } oldKey = Arrays.copyOf(key, keySize); offset += elementSize; i++; } return true; }
java
public boolean isConsistent() throws IOException { byte[] b = new byte[elementSize]; long offset = 0; byte[] oldKey = null; int i = 0; while (offset < this.getFilledUpFromContentStart()) { this.read(offset, ByteBuffer.wrap(b)); byte[] key = Arrays.copyOfRange(b, 0, keySize); if (oldKey != null && KeyUtils.compareKey(key, oldKey) != 1) { logger.error("File is not consistent at record {}. {} not larger than {}", new Object[] { i, KeyUtils.toStringUnsignedInt(key), KeyUtils.toStringUnsignedInt(oldKey) }); return false; } oldKey = Arrays.copyOf(key, keySize); offset += elementSize; i++; } return true; }
[ "public", "boolean", "isConsistent", "(", ")", "throws", "IOException", "{", "byte", "[", "]", "b", "=", "new", "byte", "[", "elementSize", "]", ";", "long", "offset", "=", "0", ";", "byte", "[", "]", "oldKey", "=", "null", ";", "int", "i", "=", "0", ";", "while", "(", "offset", "<", "this", ".", "getFilledUpFromContentStart", "(", ")", ")", "{", "this", ".", "read", "(", "offset", ",", "ByteBuffer", ".", "wrap", "(", "b", ")", ")", ";", "byte", "[", "]", "key", "=", "Arrays", ".", "copyOfRange", "(", "b", ",", "0", ",", "keySize", ")", ";", "if", "(", "oldKey", "!=", "null", "&&", "KeyUtils", ".", "compareKey", "(", "key", ",", "oldKey", ")", "!=", "1", ")", "{", "logger", ".", "error", "(", "\"File is not consistent at record {}. {} not larger than {}\"", ",", "new", "Object", "[", "]", "{", "i", ",", "KeyUtils", ".", "toStringUnsignedInt", "(", "key", ")", ",", "KeyUtils", ".", "toStringUnsignedInt", "(", "oldKey", ")", "}", ")", ";", "return", "false", ";", "}", "oldKey", "=", "Arrays", ".", "copyOf", "(", "key", ",", "keySize", ")", ";", "offset", "+=", "elementSize", ";", "i", "++", ";", "}", "return", "true", ";", "}" ]
This method checks, if the keys of all inserted elements are incrementing continuously. @return true, if the file fulfills this constraint. @throws IOException
[ "This", "method", "checks", "if", "the", "keys", "of", "all", "inserted", "elements", "are", "incrementing", "continuously", "." ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java#L441-L459
150,245
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java
HeaderIndexFile.isConsitentWithIndex
public boolean isConsitentWithIndex() throws IOException { byte[] b = new byte[keySize]; long offset = 0; int maxChunk = getChunkIndex(getFilledUpFromContentStart()); boolean isConsistent = true; for (int i = 1; i <= maxChunk; i++) { offset = i * getChunkSize() - elementSize; read(offset, ByteBuffer.wrap(b)); if (KeyUtils.compareKey(getIndex().maxKeyPerChunk[i - 1], b) != 0) { logger.error("Index is not consistent to data. Expected {}, but found {}.", Arrays.toString(getIndex().maxKeyPerChunk[i - 1]), Arrays.toString(b)); isConsistent = false; } } return isConsistent; }
java
public boolean isConsitentWithIndex() throws IOException { byte[] b = new byte[keySize]; long offset = 0; int maxChunk = getChunkIndex(getFilledUpFromContentStart()); boolean isConsistent = true; for (int i = 1; i <= maxChunk; i++) { offset = i * getChunkSize() - elementSize; read(offset, ByteBuffer.wrap(b)); if (KeyUtils.compareKey(getIndex().maxKeyPerChunk[i - 1], b) != 0) { logger.error("Index is not consistent to data. Expected {}, but found {}.", Arrays.toString(getIndex().maxKeyPerChunk[i - 1]), Arrays.toString(b)); isConsistent = false; } } return isConsistent; }
[ "public", "boolean", "isConsitentWithIndex", "(", ")", "throws", "IOException", "{", "byte", "[", "]", "b", "=", "new", "byte", "[", "keySize", "]", ";", "long", "offset", "=", "0", ";", "int", "maxChunk", "=", "getChunkIndex", "(", "getFilledUpFromContentStart", "(", ")", ")", ";", "boolean", "isConsistent", "=", "true", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "maxChunk", ";", "i", "++", ")", "{", "offset", "=", "i", "*", "getChunkSize", "(", ")", "-", "elementSize", ";", "read", "(", "offset", ",", "ByteBuffer", ".", "wrap", "(", "b", ")", ")", ";", "if", "(", "KeyUtils", ".", "compareKey", "(", "getIndex", "(", ")", ".", "maxKeyPerChunk", "[", "i", "-", "1", "]", ",", "b", ")", "!=", "0", ")", "{", "logger", ".", "error", "(", "\"Index is not consistent to data. Expected {}, but found {}.\"", ",", "Arrays", ".", "toString", "(", "getIndex", "(", ")", ".", "maxKeyPerChunk", "[", "i", "-", "1", "]", ")", ",", "Arrays", ".", "toString", "(", "b", ")", ")", ";", "isConsistent", "=", "false", ";", "}", "}", "return", "isConsistent", ";", "}" ]
This method checks, if the data is consistent with the index. @return true, if the file fulfills this constraint. @throws IOException
[ "This", "method", "checks", "if", "the", "data", "is", "consistent", "with", "the", "index", "." ]
a670f17a2186c9a15725f26617d77ce8e444e072
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/HeaderIndexFile.java#L467-L482
150,246
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Panel.java
Panel.getFields
public List<Field> getFields(Entity entity, String operationId, PMSecurityUser user) { final String[] fs = getFields().split("[ ]"); final List<Field> result = new ArrayList<Field>(); for (String string : fs) { final Field field = entity.getFieldById(string); if (field != null) { if (operationId == null || field.shouldDisplay(operationId, user)) { result.add(field); } } } return result; }
java
public List<Field> getFields(Entity entity, String operationId, PMSecurityUser user) { final String[] fs = getFields().split("[ ]"); final List<Field> result = new ArrayList<Field>(); for (String string : fs) { final Field field = entity.getFieldById(string); if (field != null) { if (operationId == null || field.shouldDisplay(operationId, user)) { result.add(field); } } } return result; }
[ "public", "List", "<", "Field", ">", "getFields", "(", "Entity", "entity", ",", "String", "operationId", ",", "PMSecurityUser", "user", ")", "{", "final", "String", "[", "]", "fs", "=", "getFields", "(", ")", ".", "split", "(", "\"[ ]\"", ")", ";", "final", "List", "<", "Field", ">", "result", "=", "new", "ArrayList", "<", "Field", ">", "(", ")", ";", "for", "(", "String", "string", ":", "fs", ")", "{", "final", "Field", "field", "=", "entity", ".", "getFieldById", "(", "string", ")", ";", "if", "(", "field", "!=", "null", ")", "{", "if", "(", "operationId", "==", "null", "||", "field", ".", "shouldDisplay", "(", "operationId", ",", "user", ")", ")", "{", "result", ".", "add", "(", "field", ")", ";", "}", "}", "}", "return", "result", ";", "}" ]
Fields contained in this panel.
[ "Fields", "contained", "in", "this", "panel", "." ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Panel.java#L45-L57
150,247
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PaginatedList.java
PaginatedList.getPageRange
public List<Integer> getPageRange() { List<Integer> r = new ArrayList<Integer>(); for (int i = 1; i <= getPages(); i++) { r.add(i); } return r; }
java
public List<Integer> getPageRange() { List<Integer> r = new ArrayList<Integer>(); for (int i = 1; i <= getPages(); i++) { r.add(i); } return r; }
[ "public", "List", "<", "Integer", ">", "getPageRange", "(", ")", "{", "List", "<", "Integer", ">", "r", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "getPages", "(", ")", ";", "i", "++", ")", "{", "r", ".", "add", "(", "i", ")", ";", "}", "return", "r", ";", "}" ]
Returns a list with the existing pages index @return
[ "Returns", "a", "list", "with", "the", "existing", "pages", "index" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PaginatedList.java#L37-L43
150,248
GerdHolz/TOVAL
src/de/invation/code/toval/os/WindowsUtils.java
WindowsUtils.registerFileExtension
@Override public boolean registerFileExtension(String fileTypeName, String fileTypeExtension, String application) throws RegistryException, OSException { if (!isApplicable()) { return false; } // sanitize file extension fileTypeExtension = sanitizeFileExtension(fileTypeExtension); // create path to linked application String applicationPath = toWindowsPath(new File(application).getAbsolutePath()); // Set registry hive WindowsRegistry.Hive hive = WindowsRegistry.Hive.HKEY_CURRENT_USER; // create programmatic identifier WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName); // create verb to open file type WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName + SHELL_OPEN_COMMAND_PATH); WindowsRegistry.writeValue(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName + SHELL_OPEN_COMMAND_PATH, WindowsRegistry.DEFAULT_KEY_NAME, "\"" + applicationPath + "\" \"%1\""); // associate with file extension WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeExtension); WindowsRegistry.writeValue(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeExtension, WindowsRegistry.DEFAULT_KEY_NAME, fileTypeName); return true; }
java
@Override public boolean registerFileExtension(String fileTypeName, String fileTypeExtension, String application) throws RegistryException, OSException { if (!isApplicable()) { return false; } // sanitize file extension fileTypeExtension = sanitizeFileExtension(fileTypeExtension); // create path to linked application String applicationPath = toWindowsPath(new File(application).getAbsolutePath()); // Set registry hive WindowsRegistry.Hive hive = WindowsRegistry.Hive.HKEY_CURRENT_USER; // create programmatic identifier WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName); // create verb to open file type WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName + SHELL_OPEN_COMMAND_PATH); WindowsRegistry.writeValue(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeName + SHELL_OPEN_COMMAND_PATH, WindowsRegistry.DEFAULT_KEY_NAME, "\"" + applicationPath + "\" \"%1\""); // associate with file extension WindowsRegistry.createKey(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeExtension); WindowsRegistry.writeValue(hive.getName() + SOFTWARE_CLASSES_PATH + fileTypeExtension, WindowsRegistry.DEFAULT_KEY_NAME, fileTypeName); return true; }
[ "@", "Override", "public", "boolean", "registerFileExtension", "(", "String", "fileTypeName", ",", "String", "fileTypeExtension", ",", "String", "application", ")", "throws", "RegistryException", ",", "OSException", "{", "if", "(", "!", "isApplicable", "(", ")", ")", "{", "return", "false", ";", "}", "// sanitize file extension", "fileTypeExtension", "=", "sanitizeFileExtension", "(", "fileTypeExtension", ")", ";", "// create path to linked application", "String", "applicationPath", "=", "toWindowsPath", "(", "new", "File", "(", "application", ")", ".", "getAbsolutePath", "(", ")", ")", ";", "// Set registry hive", "WindowsRegistry", ".", "Hive", "hive", "=", "WindowsRegistry", ".", "Hive", ".", "HKEY_CURRENT_USER", ";", "// create programmatic identifier", "WindowsRegistry", ".", "createKey", "(", "hive", ".", "getName", "(", ")", "+", "SOFTWARE_CLASSES_PATH", "+", "fileTypeName", ")", ";", "// create verb to open file type", "WindowsRegistry", ".", "createKey", "(", "hive", ".", "getName", "(", ")", "+", "SOFTWARE_CLASSES_PATH", "+", "fileTypeName", "+", "SHELL_OPEN_COMMAND_PATH", ")", ";", "WindowsRegistry", ".", "writeValue", "(", "hive", ".", "getName", "(", ")", "+", "SOFTWARE_CLASSES_PATH", "+", "fileTypeName", "+", "SHELL_OPEN_COMMAND_PATH", ",", "WindowsRegistry", ".", "DEFAULT_KEY_NAME", ",", "\"\\\"\"", "+", "applicationPath", "+", "\"\\\" \\\"%1\\\"\"", ")", ";", "// associate with file extension", "WindowsRegistry", ".", "createKey", "(", "hive", ".", "getName", "(", ")", "+", "SOFTWARE_CLASSES_PATH", "+", "fileTypeExtension", ")", ";", "WindowsRegistry", ".", "writeValue", "(", "hive", ".", "getName", "(", ")", "+", "SOFTWARE_CLASSES_PATH", "+", "fileTypeExtension", ",", "WindowsRegistry", ".", "DEFAULT_KEY_NAME", ",", "fileTypeName", ")", ";", "return", "true", ";", "}" ]
Registers a new file extension in the Windows registry. @param fileTypeName Name of the file extension. Must be atomic, e.g. <code>foocorp.fooapp.v1</code>. @param fileTypeExtension File extension with leading dot, e.g. <code>.bar</code>. @param application Path to the application, which should open the new file extension. @return <code>true</code> if registration was successful, <code>false</code> otherwise. @throws RegistryException If keys can't be created or values can't be written.
[ "Registers", "a", "new", "file", "extension", "in", "the", "Windows", "registry", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsUtils.java#L187-L213
150,249
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_fkeep.java
Scs_fkeep.cs_fkeep
public static int cs_fkeep(Scs A, Scs_ifkeep fkeep, Object other) { int j, p, nz = 0, n, Ap[], Ai[]; float Ax[]; if (!Scs_util.CS_CSC(A)) return (-1); /* check inputs */ n = A.n; Ap = A.p; Ai = A.i; Ax = A.x; for (j = 0; j < n; j++) { p = Ap[j]; /* get current location of col j */ Ap[j] = nz; /* record new location of col j */ for (; p < Ap[j + 1]; p++) { if (fkeep.fkeep(Ai[p], j, Ax != null ? Ax[p] : 1, other)) { if (Ax != null) Ax[nz] = Ax[p]; /* keep A(i,j) */ Ai[nz++] = Ai[p]; } } } Ap[n] = nz; /* finalize A */ Scs_util.cs_sprealloc(A, 0); /* remove extra space from A */ return (nz); }
java
public static int cs_fkeep(Scs A, Scs_ifkeep fkeep, Object other) { int j, p, nz = 0, n, Ap[], Ai[]; float Ax[]; if (!Scs_util.CS_CSC(A)) return (-1); /* check inputs */ n = A.n; Ap = A.p; Ai = A.i; Ax = A.x; for (j = 0; j < n; j++) { p = Ap[j]; /* get current location of col j */ Ap[j] = nz; /* record new location of col j */ for (; p < Ap[j + 1]; p++) { if (fkeep.fkeep(Ai[p], j, Ax != null ? Ax[p] : 1, other)) { if (Ax != null) Ax[nz] = Ax[p]; /* keep A(i,j) */ Ai[nz++] = Ai[p]; } } } Ap[n] = nz; /* finalize A */ Scs_util.cs_sprealloc(A, 0); /* remove extra space from A */ return (nz); }
[ "public", "static", "int", "cs_fkeep", "(", "Scs", "A", ",", "Scs_ifkeep", "fkeep", ",", "Object", "other", ")", "{", "int", "j", ",", "p", ",", "nz", "=", "0", ",", "n", ",", "Ap", "[", "]", ",", "Ai", "[", "]", ";", "float", "Ax", "[", "]", ";", "if", "(", "!", "Scs_util", ".", "CS_CSC", "(", "A", ")", ")", "return", "(", "-", "1", ")", ";", "/* check inputs */", "n", "=", "A", ".", "n", ";", "Ap", "=", "A", ".", "p", ";", "Ai", "=", "A", ".", "i", ";", "Ax", "=", "A", ".", "x", ";", "for", "(", "j", "=", "0", ";", "j", "<", "n", ";", "j", "++", ")", "{", "p", "=", "Ap", "[", "j", "]", ";", "/* get current location of col j */", "Ap", "[", "j", "]", "=", "nz", ";", "/* record new location of col j */", "for", "(", ";", "p", "<", "Ap", "[", "j", "+", "1", "]", ";", "p", "++", ")", "{", "if", "(", "fkeep", ".", "fkeep", "(", "Ai", "[", "p", "]", ",", "j", ",", "Ax", "!=", "null", "?", "Ax", "[", "p", "]", ":", "1", ",", "other", ")", ")", "{", "if", "(", "Ax", "!=", "null", ")", "Ax", "[", "nz", "]", "=", "Ax", "[", "p", "]", ";", "/* keep A(i,j) */", "Ai", "[", "nz", "++", "]", "=", "Ai", "[", "p", "]", ";", "}", "}", "}", "Ap", "[", "n", "]", "=", "nz", ";", "/* finalize A */", "Scs_util", ".", "cs_sprealloc", "(", "A", ",", "0", ")", ";", "/* remove extra space from A */", "return", "(", "nz", ")", ";", "}" ]
Srops entries from a sparse matrix; @param A column-compressed matrix @param fkeep drop aij if fkeep.fkeep(i,j,aij,other) is false @param other optional parameter to fkeep @return nz, new number of entries in A, -1 on error
[ "Srops", "entries", "from", "a", "sparse", "matrix", ";" ]
6a6f66bccce1558156a961494358952603b0ac84
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_fkeep.java#L48-L71
150,250
GerdHolz/TOVAL
src/de/invation/code/toval/math/Permutations.java
Permutations.reset
public final void reset() { for (int i = 0; i < position.length; i++) { position[i] = i; } permLeft = new BigInteger(permTotal.toString()); }
java
public final void reset() { for (int i = 0; i < position.length; i++) { position[i] = i; } permLeft = new BigInteger(permTotal.toString()); }
[ "public", "final", "void", "reset", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "position", ".", "length", ";", "i", "++", ")", "{", "position", "[", "i", "]", "=", "i", ";", "}", "permLeft", "=", "new", "BigInteger", "(", "permTotal", ".", "toString", "(", ")", ")", ";", "}" ]
Resets the permutation generator.
[ "Resets", "the", "permutation", "generator", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/math/Permutations.java#L46-L51
150,251
GerdHolz/TOVAL
src/de/invation/code/toval/math/Permutations.java
Permutations.getFactorial
private static BigInteger getFactorial(int number) { BigInteger factorial = BigInteger.ONE; for (int i = number; i > 1; i--) { factorial = factorial.multiply(new BigInteger(Integer.toString(i))); } return factorial; }
java
private static BigInteger getFactorial(int number) { BigInteger factorial = BigInteger.ONE; for (int i = number; i > 1; i--) { factorial = factorial.multiply(new BigInteger(Integer.toString(i))); } return factorial; }
[ "private", "static", "BigInteger", "getFactorial", "(", "int", "number", ")", "{", "BigInteger", "factorial", "=", "BigInteger", ".", "ONE", ";", "for", "(", "int", "i", "=", "number", ";", "i", ">", "1", ";", "i", "--", ")", "{", "factorial", "=", "factorial", ".", "multiply", "(", "new", "BigInteger", "(", "Integer", ".", "toString", "(", "i", ")", ")", ")", ";", "}", "return", "factorial", ";", "}" ]
Computes the factorial of the given number @param number jBasic number for factorial computation @return The factorial of <code>number</code>
[ "Computes", "the", "factorial", "of", "the", "given", "number" ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/math/Permutations.java#L88-L94
150,252
actorapp/droidkit-actors
actors/src/main/java/com/droidkit/actors/Props.java
Props.create
public T create() throws Exception { if (type == TYPE_DEFAULT) { if (args == null || args.length == 0) { return aClass.newInstance(); } } else if (type == TYPE_CREATOR) { return creator.create(); } throw new RuntimeException("Unsupported create method"); }
java
public T create() throws Exception { if (type == TYPE_DEFAULT) { if (args == null || args.length == 0) { return aClass.newInstance(); } } else if (type == TYPE_CREATOR) { return creator.create(); } throw new RuntimeException("Unsupported create method"); }
[ "public", "T", "create", "(", ")", "throws", "Exception", "{", "if", "(", "type", "==", "TYPE_DEFAULT", ")", "{", "if", "(", "args", "==", "null", "||", "args", ".", "length", "==", "0", ")", "{", "return", "aClass", ".", "newInstance", "(", ")", ";", "}", "}", "else", "if", "(", "type", "==", "TYPE_CREATOR", ")", "{", "return", "creator", ".", "create", "(", ")", ";", "}", "throw", "new", "RuntimeException", "(", "\"Unsupported create method\"", ")", ";", "}" ]
Creating actor from Props @return Actor @throws Exception
[ "Creating", "actor", "from", "Props" ]
fdb72fcfdd1c5e54a970f203a33a71fa54344217
https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/Props.java#L41-L51
150,253
actorapp/droidkit-actors
actors/src/main/java/com/droidkit/actors/Props.java
Props.createMailbox
public Mailbox createMailbox(MailboxesQueue queue) { if (mailboxCreator != null) { return mailboxCreator.createMailbox(queue); } else { return new Mailbox(queue); } }
java
public Mailbox createMailbox(MailboxesQueue queue) { if (mailboxCreator != null) { return mailboxCreator.createMailbox(queue); } else { return new Mailbox(queue); } }
[ "public", "Mailbox", "createMailbox", "(", "MailboxesQueue", "queue", ")", "{", "if", "(", "mailboxCreator", "!=", "null", ")", "{", "return", "mailboxCreator", ".", "createMailbox", "(", "queue", ")", ";", "}", "else", "{", "return", "new", "Mailbox", "(", "queue", ")", ";", "}", "}" ]
Creating mailbox for actor @param queue queue of mailboxes @return mailbox
[ "Creating", "mailbox", "for", "actor" ]
fdb72fcfdd1c5e54a970f203a33a71fa54344217
https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/Props.java#L59-L65
150,254
actorapp/droidkit-actors
actors/src/main/java/com/droidkit/actors/Props.java
Props.create
public static <T extends Actor> Props<T> create(Class<T> tClass) { return new Props(tClass, null, TYPE_DEFAULT, null, null, null); }
java
public static <T extends Actor> Props<T> create(Class<T> tClass) { return new Props(tClass, null, TYPE_DEFAULT, null, null, null); }
[ "public", "static", "<", "T", "extends", "Actor", ">", "Props", "<", "T", ">", "create", "(", "Class", "<", "T", ">", "tClass", ")", "{", "return", "new", "Props", "(", "tClass", ",", "null", ",", "TYPE_DEFAULT", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Create props from class @param tClass Actor class @param <T> Actor class @return Props object
[ "Create", "props", "from", "class" ]
fdb72fcfdd1c5e54a970f203a33a71fa54344217
https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/Props.java#L93-L95
150,255
actorapp/droidkit-actors
actors/src/main/java/com/droidkit/actors/Props.java
Props.create
public static <T extends Actor> Props<T> create(Class<T> clazz, ActorCreator<T> creator, MailboxCreator mailboxCreator) { return new Props<T>(clazz, null, TYPE_CREATOR, null, creator, mailboxCreator); }
java
public static <T extends Actor> Props<T> create(Class<T> clazz, ActorCreator<T> creator, MailboxCreator mailboxCreator) { return new Props<T>(clazz, null, TYPE_CREATOR, null, creator, mailboxCreator); }
[ "public", "static", "<", "T", "extends", "Actor", ">", "Props", "<", "T", ">", "create", "(", "Class", "<", "T", ">", "clazz", ",", "ActorCreator", "<", "T", ">", "creator", ",", "MailboxCreator", "mailboxCreator", ")", "{", "return", "new", "Props", "<", "T", ">", "(", "clazz", ",", "null", ",", "TYPE_CREATOR", ",", "null", ",", "creator", ",", "mailboxCreator", ")", ";", "}" ]
Create props from Actor creator with custom mailbox @param clazz Actor class @param creator Actor creator class @param <T> Actor class @return Props object
[ "Create", "props", "from", "Actor", "creator", "with", "custom", "mailbox" ]
fdb72fcfdd1c5e54a970f203a33a71fa54344217
https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/Props.java#L130-L132
150,256
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/util/GraphicUtils.java
GraphicUtils.drawCircle
public static void drawCircle(Graphics g, Point center, int diameter){ drawCircle(g, (int) center.getX(), (int) center.getY(), diameter); }
java
public static void drawCircle(Graphics g, Point center, int diameter){ drawCircle(g, (int) center.getX(), (int) center.getY(), diameter); }
[ "public", "static", "void", "drawCircle", "(", "Graphics", "g", ",", "Point", "center", ",", "int", "diameter", ")", "{", "drawCircle", "(", "g", ",", "(", "int", ")", "center", ".", "getX", "(", ")", ",", "(", "int", ")", "center", ".", "getY", "(", ")", ",", "diameter", ")", ";", "}" ]
Draws a circle with the specified diameter using the given point as center. @param g Graphics context @param center Circle center @param diameter Circle diameter
[ "Draws", "a", "circle", "with", "the", "specified", "diameter", "using", "the", "given", "point", "as", "center", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/util/GraphicUtils.java#L19-L21
150,257
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/util/GraphicUtils.java
GraphicUtils.drawCircle
public static void drawCircle(Graphics g, int centerX, int centerY, int diameter){ g.drawOval((int) (centerX-diameter/2), (int) (centerY-diameter/2), diameter, diameter); }
java
public static void drawCircle(Graphics g, int centerX, int centerY, int diameter){ g.drawOval((int) (centerX-diameter/2), (int) (centerY-diameter/2), diameter, diameter); }
[ "public", "static", "void", "drawCircle", "(", "Graphics", "g", ",", "int", "centerX", ",", "int", "centerY", ",", "int", "diameter", ")", "{", "g", ".", "drawOval", "(", "(", "int", ")", "(", "centerX", "-", "diameter", "/", "2", ")", ",", "(", "int", ")", "(", "centerY", "-", "diameter", "/", "2", ")", ",", "diameter", ",", "diameter", ")", ";", "}" ]
Draws a circle with the specified diameter using the given point coordinates as center. @param g Graphics context @param centerX X coordinate of circle center @param centerY Y coordinate of circle center @param diameter Circle diameter
[ "Draws", "a", "circle", "with", "the", "specified", "diameter", "using", "the", "given", "point", "coordinates", "as", "center", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/util/GraphicUtils.java#L30-L32
150,258
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/util/GraphicUtils.java
GraphicUtils.fillCircle
public static void fillCircle(Graphics g, Point center, int diameter){ fillCircle(g, (int) center.getX(), (int) center.getY(), diameter); }
java
public static void fillCircle(Graphics g, Point center, int diameter){ fillCircle(g, (int) center.getX(), (int) center.getY(), diameter); }
[ "public", "static", "void", "fillCircle", "(", "Graphics", "g", ",", "Point", "center", ",", "int", "diameter", ")", "{", "fillCircle", "(", "g", ",", "(", "int", ")", "center", ".", "getX", "(", ")", ",", "(", "int", ")", "center", ".", "getY", "(", ")", ",", "diameter", ")", ";", "}" ]
Draws a circle with the specified diameter using the given point as center and fills it with the current color of the graphics context. @param g Graphics context @param center Circle center @param diameter Circle diameter
[ "Draws", "a", "circle", "with", "the", "specified", "diameter", "using", "the", "given", "point", "as", "center", "and", "fills", "it", "with", "the", "current", "color", "of", "the", "graphics", "context", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/util/GraphicUtils.java#L41-L43
150,259
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/util/GraphicUtils.java
GraphicUtils.fillCircle
public static void fillCircle(Graphics g, int centerX, int centerY, int diam){ g.fillOval((int) (centerX-diam/2), (int) (centerY-diam/2), diam, diam); }
java
public static void fillCircle(Graphics g, int centerX, int centerY, int diam){ g.fillOval((int) (centerX-diam/2), (int) (centerY-diam/2), diam, diam); }
[ "public", "static", "void", "fillCircle", "(", "Graphics", "g", ",", "int", "centerX", ",", "int", "centerY", ",", "int", "diam", ")", "{", "g", ".", "fillOval", "(", "(", "int", ")", "(", "centerX", "-", "diam", "/", "2", ")", ",", "(", "int", ")", "(", "centerY", "-", "diam", "/", "2", ")", ",", "diam", ",", "diam", ")", ";", "}" ]
Draws a circle with the specified diameter using the given point coordinates as center and fills it with the current color of the graphics context. @param g Graphics context @param centerX X coordinate of circle center @param centerY Y coordinate of circle center @param diam Circle diameter
[ "Draws", "a", "circle", "with", "the", "specified", "diameter", "using", "the", "given", "point", "coordinates", "as", "center", "and", "fills", "it", "with", "the", "current", "color", "of", "the", "graphics", "context", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/util/GraphicUtils.java#L53-L55
150,260
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/util/GraphicUtils.java
GraphicUtils.fillCircle
public static void fillCircle(Graphics g, Point center, int diameter, Color color){ fillCircle(g, (int) center.x, (int) center.y, diameter, color); }
java
public static void fillCircle(Graphics g, Point center, int diameter, Color color){ fillCircle(g, (int) center.x, (int) center.y, diameter, color); }
[ "public", "static", "void", "fillCircle", "(", "Graphics", "g", ",", "Point", "center", ",", "int", "diameter", ",", "Color", "color", ")", "{", "fillCircle", "(", "g", ",", "(", "int", ")", "center", ".", "x", ",", "(", "int", ")", "center", ".", "y", ",", "diameter", ",", "color", ")", ";", "}" ]
Draws a circle with the specified diameter using the given point as center and fills it with the given color. @param g Graphics context @param center Circle center @param diameter Circle diameter
[ "Draws", "a", "circle", "with", "the", "specified", "diameter", "using", "the", "given", "point", "as", "center", "and", "fills", "it", "with", "the", "given", "color", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/util/GraphicUtils.java#L64-L66
150,261
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/util/GraphicUtils.java
GraphicUtils.fillCircle
public static void fillCircle(Graphics g, int centerX, int centerY, int diam, Color color){ Color c = g.getColor(); g.setColor(color); fillCircle(g, centerX, centerY, diam); g.setColor(c); }
java
public static void fillCircle(Graphics g, int centerX, int centerY, int diam, Color color){ Color c = g.getColor(); g.setColor(color); fillCircle(g, centerX, centerY, diam); g.setColor(c); }
[ "public", "static", "void", "fillCircle", "(", "Graphics", "g", ",", "int", "centerX", ",", "int", "centerY", ",", "int", "diam", ",", "Color", "color", ")", "{", "Color", "c", "=", "g", ".", "getColor", "(", ")", ";", "g", ".", "setColor", "(", "color", ")", ";", "fillCircle", "(", "g", ",", "centerX", ",", "centerY", ",", "diam", ")", ";", "g", ".", "setColor", "(", "c", ")", ";", "}" ]
Draws a circle with the specified diameter using the given point coordinates as center and fills it with the given color. @param g Graphics context @param centerX X coordinate of circle center @param centerY Y coordinate of circle center @param diam Circle diameter
[ "Draws", "a", "circle", "with", "the", "specified", "diameter", "using", "the", "given", "point", "coordinates", "as", "center", "and", "fills", "it", "with", "the", "given", "color", "." ]
036922cdfd710fa53b18e5dbe1e07f226f731fde
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/util/GraphicUtils.java#L76-L81
150,262
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.start
public static boolean start(final String configurationFilename) { try { if (getPm() == null) { instance = new PresentationManager(configurationFilename); } return isActive(); } catch (Exception ex) { instance = null; Logger.getRootLogger().fatal("Unable to initialize jPM", ex); return false; } }
java
public static boolean start(final String configurationFilename) { try { if (getPm() == null) { instance = new PresentationManager(configurationFilename); } return isActive(); } catch (Exception ex) { instance = null; Logger.getRootLogger().fatal("Unable to initialize jPM", ex); return false; } }
[ "public", "static", "boolean", "start", "(", "final", "String", "configurationFilename", ")", "{", "try", "{", "if", "(", "getPm", "(", ")", "==", "null", ")", "{", "instance", "=", "new", "PresentationManager", "(", "configurationFilename", ")", ";", "}", "return", "isActive", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "instance", "=", "null", ";", "Logger", ".", "getRootLogger", "(", ")", ".", "fatal", "(", "\"Unable to initialize jPM\"", ",", "ex", ")", ";", "return", "false", ";", "}", "}" ]
Initialize the Presentation Manager singleton @param configurationFilename File name for a configuration file @param log a PrintStream for logs @return true if initialization was success, false otherwies
[ "Initialize", "the", "Presentation", "Manager", "singleton" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L79-L90
150,263
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.initialize
public final boolean initialize() { notifyObservers(); try { this.cfg = (Properties) new MainParser(this).parseFile(getCfgFilename()); } catch (Exception ex) { ex.printStackTrace(); //Deep trouble error = true; return false; } logger = (JPMLogger) newInstance(getCfg().getProperty("logger-class", "jpaoletti.jpm.core.log.Log4jLogger")); logger.setName(getCfg().getProperty("logger-name", "jPM")); error = false; try { try { Class.forName(getDefaultDataAccess()); logItem("Default Data Access", getDefaultDataAccess(), "*"); } catch (Exception e) { logItem("Default Data Access", getDefaultDataAccess(), "?"); } logItem("Template", getTemplate(), "*"); logItem("Menu", getMenu(), "*"); logItem("Application version", getAppversion(), "*"); logItem("Title", getTitle(), "*"); logItem("Subtitle", getSubtitle(), "*"); logItem("Contact", getContact(), "*"); logItem("Default Converter", getDefaultConverterClass(), "*"); final String _securityConnector = getCfg().getProperty(SECURITY_CONNECTOR); if (_securityConnector != null) { try { securityConnector = (PMSecurityConnector) newInstance(_securityConnector); logItem("Security Connector", _securityConnector, "*"); } catch (Exception e) { error = true; logItem("Security Connector", _securityConnector, "?"); } } else { securityConnector = null; } persistenceManager = cfg.getProperty(PERSISTENCE_MANAGER, "jpaoletti.jpm.core.PersistenceManagerVoid"); try { newInstance(persistenceManager); logItem("Persistance Manager", persistenceManager, "*"); } catch (Exception e) { error = true; logItem("Persistance Manager", persistenceManager, "?"); } loadEntities(); loadMonitors(); loadConverters(); loadClassConverters(); loadLocations(); createSessionChecker(); customLoad(); } catch (Exception exception) { error(exception); error = true; } if (error) { error("error: One or more errors were found. Unable to start jPM"); } return !error; }
java
public final boolean initialize() { notifyObservers(); try { this.cfg = (Properties) new MainParser(this).parseFile(getCfgFilename()); } catch (Exception ex) { ex.printStackTrace(); //Deep trouble error = true; return false; } logger = (JPMLogger) newInstance(getCfg().getProperty("logger-class", "jpaoletti.jpm.core.log.Log4jLogger")); logger.setName(getCfg().getProperty("logger-name", "jPM")); error = false; try { try { Class.forName(getDefaultDataAccess()); logItem("Default Data Access", getDefaultDataAccess(), "*"); } catch (Exception e) { logItem("Default Data Access", getDefaultDataAccess(), "?"); } logItem("Template", getTemplate(), "*"); logItem("Menu", getMenu(), "*"); logItem("Application version", getAppversion(), "*"); logItem("Title", getTitle(), "*"); logItem("Subtitle", getSubtitle(), "*"); logItem("Contact", getContact(), "*"); logItem("Default Converter", getDefaultConverterClass(), "*"); final String _securityConnector = getCfg().getProperty(SECURITY_CONNECTOR); if (_securityConnector != null) { try { securityConnector = (PMSecurityConnector) newInstance(_securityConnector); logItem("Security Connector", _securityConnector, "*"); } catch (Exception e) { error = true; logItem("Security Connector", _securityConnector, "?"); } } else { securityConnector = null; } persistenceManager = cfg.getProperty(PERSISTENCE_MANAGER, "jpaoletti.jpm.core.PersistenceManagerVoid"); try { newInstance(persistenceManager); logItem("Persistance Manager", persistenceManager, "*"); } catch (Exception e) { error = true; logItem("Persistance Manager", persistenceManager, "?"); } loadEntities(); loadMonitors(); loadConverters(); loadClassConverters(); loadLocations(); createSessionChecker(); customLoad(); } catch (Exception exception) { error(exception); error = true; } if (error) { error("error: One or more errors were found. Unable to start jPM"); } return !error; }
[ "public", "final", "boolean", "initialize", "(", ")", "{", "notifyObservers", "(", ")", ";", "try", "{", "this", ".", "cfg", "=", "(", "Properties", ")", "new", "MainParser", "(", "this", ")", ".", "parseFile", "(", "getCfgFilename", "(", ")", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "//Deep trouble", "error", "=", "true", ";", "return", "false", ";", "}", "logger", "=", "(", "JPMLogger", ")", "newInstance", "(", "getCfg", "(", ")", ".", "getProperty", "(", "\"logger-class\"", ",", "\"jpaoletti.jpm.core.log.Log4jLogger\"", ")", ")", ";", "logger", ".", "setName", "(", "getCfg", "(", ")", ".", "getProperty", "(", "\"logger-name\"", ",", "\"jPM\"", ")", ")", ";", "error", "=", "false", ";", "try", "{", "try", "{", "Class", ".", "forName", "(", "getDefaultDataAccess", "(", ")", ")", ";", "logItem", "(", "\"Default Data Access\"", ",", "getDefaultDataAccess", "(", ")", ",", "\"*\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logItem", "(", "\"Default Data Access\"", ",", "getDefaultDataAccess", "(", ")", ",", "\"?\"", ")", ";", "}", "logItem", "(", "\"Template\"", ",", "getTemplate", "(", ")", ",", "\"*\"", ")", ";", "logItem", "(", "\"Menu\"", ",", "getMenu", "(", ")", ",", "\"*\"", ")", ";", "logItem", "(", "\"Application version\"", ",", "getAppversion", "(", ")", ",", "\"*\"", ")", ";", "logItem", "(", "\"Title\"", ",", "getTitle", "(", ")", ",", "\"*\"", ")", ";", "logItem", "(", "\"Subtitle\"", ",", "getSubtitle", "(", ")", ",", "\"*\"", ")", ";", "logItem", "(", "\"Contact\"", ",", "getContact", "(", ")", ",", "\"*\"", ")", ";", "logItem", "(", "\"Default Converter\"", ",", "getDefaultConverterClass", "(", ")", ",", "\"*\"", ")", ";", "final", "String", "_securityConnector", "=", "getCfg", "(", ")", ".", "getProperty", "(", "SECURITY_CONNECTOR", ")", ";", "if", "(", "_securityConnector", "!=", "null", ")", "{", "try", "{", "securityConnector", "=", "(", "PMSecurityConnector", ")", "newInstance", "(", "_securityConnector", ")", ";", "logItem", "(", "\"Security Connector\"", ",", "_securityConnector", ",", "\"*\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "error", "=", "true", ";", "logItem", "(", "\"Security Connector\"", ",", "_securityConnector", ",", "\"?\"", ")", ";", "}", "}", "else", "{", "securityConnector", "=", "null", ";", "}", "persistenceManager", "=", "cfg", ".", "getProperty", "(", "PERSISTENCE_MANAGER", ",", "\"jpaoletti.jpm.core.PersistenceManagerVoid\"", ")", ";", "try", "{", "newInstance", "(", "persistenceManager", ")", ";", "logItem", "(", "\"Persistance Manager\"", ",", "persistenceManager", ",", "\"*\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "error", "=", "true", ";", "logItem", "(", "\"Persistance Manager\"", ",", "persistenceManager", ",", "\"?\"", ")", ";", "}", "loadEntities", "(", ")", ";", "loadMonitors", "(", ")", ";", "loadConverters", "(", ")", ";", "loadClassConverters", "(", ")", ";", "loadLocations", "(", ")", ";", "createSessionChecker", "(", ")", ";", "customLoad", "(", ")", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "error", "(", "exception", ")", ";", "error", "=", "true", ";", "}", "if", "(", "error", ")", "{", "error", "(", "\"error: One or more errors were found. Unable to start jPM\"", ")", ";", "}", "return", "!", "error", ";", "}" ]
Initialize the Presentation Manager. @param log a PrintStream for logs @return true if initialization was success, false otherwies
[ "Initialize", "the", "Presentation", "Manager", "." ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L106-L170
150,264
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.logItem
public void logItem(String s1, String s2, String symbol) { info(String.format("(%s) %-25s %s", symbol, s1, (s2 != null) ? s2 : "")); }
java
public void logItem(String s1, String s2, String symbol) { info(String.format("(%s) %-25s %s", symbol, s1, (s2 != null) ? s2 : "")); }
[ "public", "void", "logItem", "(", "String", "s1", ",", "String", "s2", ",", "String", "symbol", ")", "{", "info", "(", "String", ".", "format", "(", "\"(%s) %-25s %s\"", ",", "symbol", ",", "s1", ",", "(", "s2", "!=", "null", ")", "?", "s2", ":", "\"\"", ")", ")", ";", "}" ]
Formatting helper for startup @param evt The event @param s1 Text @param s2 Extra description @param symbol Status symbol
[ "Formatting", "helper", "for", "startup" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L222-L224
150,265
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.weakEntities
public List<Entity> weakEntities(Entity e) { final List<Entity> res = new ArrayList<Entity>(); for (Entity entity : getEntities().values()) { if (entity.getOwner() != null && entity.getOwner().getEntityId().compareTo(e.getId()) == 0) { res.add(entity); } } if (res.isEmpty()) { return null; } else { return res; } }
java
public List<Entity> weakEntities(Entity e) { final List<Entity> res = new ArrayList<Entity>(); for (Entity entity : getEntities().values()) { if (entity.getOwner() != null && entity.getOwner().getEntityId().compareTo(e.getId()) == 0) { res.add(entity); } } if (res.isEmpty()) { return null; } else { return res; } }
[ "public", "List", "<", "Entity", ">", "weakEntities", "(", "Entity", "e", ")", "{", "final", "List", "<", "Entity", ">", "res", "=", "new", "ArrayList", "<", "Entity", ">", "(", ")", ";", "for", "(", "Entity", "entity", ":", "getEntities", "(", ")", ".", "values", "(", ")", ")", "{", "if", "(", "entity", ".", "getOwner", "(", ")", "!=", "null", "&&", "entity", ".", "getOwner", "(", ")", ".", "getEntityId", "(", ")", ".", "compareTo", "(", "e", ".", "getId", "(", ")", ")", "==", "0", ")", "{", "res", ".", "add", "(", "entity", ")", ";", "}", "}", "if", "(", "res", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "else", "{", "return", "res", ";", "}", "}" ]
Return the list of weak entities of the given entity. @param e The strong entity @return The list of weak entities
[ "Return", "the", "list", "of", "weak", "entities", "of", "the", "given", "entity", "." ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L287-L299
150,266
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.getEntity
public Entity getEntity(String id) { Entity e = getEntities().get(id); if (e == null) { return null; } return e; }
java
public Entity getEntity(String id) { Entity e = getEntities().get(id); if (e == null) { return null; } return e; }
[ "public", "Entity", "getEntity", "(", "String", "id", ")", "{", "Entity", "e", "=", "getEntities", "(", ")", ".", "get", "(", "id", ")", ";", "if", "(", "e", "==", "null", ")", "{", "return", "null", ";", "}", "return", "e", ";", "}" ]
Return the entity of the given id @param id Entity id @return The entity
[ "Return", "the", "entity", "of", "the", "given", "id" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L307-L313
150,267
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.newEntityContainer
public EntityContainer newEntityContainer(String id) { final Entity e = lookupEntity(id); if (e == null) { return null; } e.setWeaks(weakEntities(e)); return new EntityContainer(e); }
java
public EntityContainer newEntityContainer(String id) { final Entity e = lookupEntity(id); if (e == null) { return null; } e.setWeaks(weakEntities(e)); return new EntityContainer(e); }
[ "public", "EntityContainer", "newEntityContainer", "(", "String", "id", ")", "{", "final", "Entity", "e", "=", "lookupEntity", "(", "id", ")", ";", "if", "(", "e", "==", "null", ")", "{", "return", "null", ";", "}", "e", ".", "setWeaks", "(", "weakEntities", "(", "e", ")", ")", ";", "return", "new", "EntityContainer", "(", "e", ")", ";", "}" ]
Create and fill a new Entity Container @param id Entity id @return The container
[ "Create", "and", "fill", "a", "new", "Entity", "Container" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L341-L348
150,268
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.lookupEntity
private Entity lookupEntity(String sid) { for (Integer i = 0; i < getEntities().size(); i++) { Entity e = getEntities().get(i); if (e != null && sid.compareTo(EntityContainer.buildId(e.getId())) == 0) { return getEntity(e.getId()); } } return null; }
java
private Entity lookupEntity(String sid) { for (Integer i = 0; i < getEntities().size(); i++) { Entity e = getEntities().get(i); if (e != null && sid.compareTo(EntityContainer.buildId(e.getId())) == 0) { return getEntity(e.getId()); } } return null; }
[ "private", "Entity", "lookupEntity", "(", "String", "sid", ")", "{", "for", "(", "Integer", "i", "=", "0", ";", "i", "<", "getEntities", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Entity", "e", "=", "getEntities", "(", ")", ".", "get", "(", "i", ")", ";", "if", "(", "e", "!=", "null", "&&", "sid", ".", "compareTo", "(", "EntityContainer", ".", "buildId", "(", "e", ".", "getId", "(", ")", ")", ")", "==", "0", ")", "{", "return", "getEntity", "(", "e", ".", "getId", "(", ")", ")", ";", "}", "}", "return", "null", ";", "}" ]
Looks for an Entity with the given id
[ "Looks", "for", "an", "Entity", "with", "the", "given", "id" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L353-L361
150,269
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.debug
public void debug(Object invoquer, Object o) { if (logger.isDebugEnabled()) { logger.debug("[" + invoquer.getClass().getName() + "] " + o); } }
java
public void debug(Object invoquer, Object o) { if (logger.isDebugEnabled()) { logger.debug("[" + invoquer.getClass().getName() + "] " + o); } }
[ "public", "void", "debug", "(", "Object", "invoquer", ",", "Object", "o", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"[\"", "+", "invoquer", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"] \"", "+", "o", ")", ";", "}", "}" ]
If debug flag is active, create a debug information log @param invoquer The invoquer of the debug @param o Object to log
[ "If", "debug", "flag", "is", "active", "create", "a", "debug", "information", "log" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L448-L452
150,270
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.warn
public void warn(Object o) { if (o instanceof Throwable) { logger.warn(o, (Throwable) o); } else { logger.warn(o); } }
java
public void warn(Object o) { if (o instanceof Throwable) { logger.warn(o, (Throwable) o); } else { logger.warn(o); } }
[ "public", "void", "warn", "(", "Object", "o", ")", "{", "if", "(", "o", "instanceof", "Throwable", ")", "{", "logger", ".", "warn", "(", "o", ",", "(", "Throwable", ")", "o", ")", ";", "}", "else", "{", "logger", ".", "warn", "(", "o", ")", ";", "}", "}" ]
Generate a warn entry on the local logger @param o Object to log
[ "Generate", "a", "warn", "entry", "on", "the", "local", "logger" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L468-L474
150,271
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.error
public void error(Object o) { if (o instanceof Throwable) { logger.error(o, (Throwable) o); } else { logger.error(o); } }
java
public void error(Object o) { if (o instanceof Throwable) { logger.error(o, (Throwable) o); } else { logger.error(o); } }
[ "public", "void", "error", "(", "Object", "o", ")", "{", "if", "(", "o", "instanceof", "Throwable", ")", "{", "logger", ".", "error", "(", "o", ",", "(", "Throwable", ")", "o", ")", ";", "}", "else", "{", "logger", ".", "error", "(", "o", ")", ";", "}", "}" ]
Generate an error entry on the local logger @param o Object to log
[ "Generate", "an", "error", "entry", "on", "the", "local", "logger" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L481-L487
150,272
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.getAsString
public String getAsString(Object obj, String propertyName) { Object o = get(obj, propertyName); if (o != null) { return o.toString(); } else { return ""; } }
java
public String getAsString(Object obj, String propertyName) { Object o = get(obj, propertyName); if (o != null) { return o.toString(); } else { return ""; } }
[ "public", "String", "getAsString", "(", "Object", "obj", ",", "String", "propertyName", ")", "{", "Object", "o", "=", "get", "(", "obj", ",", "propertyName", ")", ";", "if", "(", "o", "!=", "null", ")", "{", "return", "o", ".", "toString", "(", ")", ";", "}", "else", "{", "return", "\"\"", ";", "}", "}" ]
Getter for an object property value as String @param obj The object @param propertyName The property @return The value of the property of the object as string
[ "Getter", "for", "an", "object", "property", "value", "as", "String" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L500-L507
150,273
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.get
public Object get(Object obj, String propertyName) { try { if (obj != null && propertyName != null) { return PropertyUtils.getNestedProperty(obj, propertyName); } } catch (NullPointerException e) { } catch (NestedNullException e) { } catch (Exception e) { // Now I don't like it. error(e); return "-undefined-"; } return null; }
java
public Object get(Object obj, String propertyName) { try { if (obj != null && propertyName != null) { return PropertyUtils.getNestedProperty(obj, propertyName); } } catch (NullPointerException e) { } catch (NestedNullException e) { } catch (Exception e) { // Now I don't like it. error(e); return "-undefined-"; } return null; }
[ "public", "Object", "get", "(", "Object", "obj", ",", "String", "propertyName", ")", "{", "try", "{", "if", "(", "obj", "!=", "null", "&&", "propertyName", "!=", "null", ")", "{", "return", "PropertyUtils", ".", "getNestedProperty", "(", "obj", ",", "propertyName", ")", ";", "}", "}", "catch", "(", "NullPointerException", "e", ")", "{", "}", "catch", "(", "NestedNullException", "e", ")", "{", "}", "catch", "(", "Exception", "e", ")", "{", "// Now I don't like it.", "error", "(", "e", ")", ";", "return", "\"-undefined-\"", ";", "}", "return", "null", ";", "}" ]
Getter for an object property value @param obj The object @param propertyName The property @return The value of the property of the object
[ "Getter", "for", "an", "object", "property", "value" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L517-L530
150,274
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.set
public void set(Object obj, String name, Object value) { try { PropertyUtils.setNestedProperty(obj, name, value); } catch (Exception e) { error(e); } }
java
public void set(Object obj, String name, Object value) { try { PropertyUtils.setNestedProperty(obj, name, value); } catch (Exception e) { error(e); } }
[ "public", "void", "set", "(", "Object", "obj", ",", "String", "name", ",", "Object", "value", ")", "{", "try", "{", "PropertyUtils", ".", "setNestedProperty", "(", "obj", ",", "name", ",", "value", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "error", "(", "e", ")", ";", "}", "}" ]
Setter for an object property value @param obj The object @param name The property name @param value The value to set
[ "Setter", "for", "an", "object", "property", "value" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L540-L546
150,275
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.newInstance
public Object newInstance(String clazz) { try { return Class.forName(clazz).newInstance(); } catch (Exception e) { error(e); return null; } }
java
public Object newInstance(String clazz) { try { return Class.forName(clazz).newInstance(); } catch (Exception e) { error(e); return null; } }
[ "public", "Object", "newInstance", "(", "String", "clazz", ")", "{", "try", "{", "return", "Class", ".", "forName", "(", "clazz", ")", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "error", "(", "e", ")", ";", "return", "null", ";", "}", "}" ]
Creates a new instance object of the given class. @param clazz The Class of the new Object @return The new Object or null on any error.
[ "Creates", "a", "new", "instance", "object", "of", "the", "given", "class", "." ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L554-L561
150,276
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.registerSession
public PMSession registerSession(String sessionId) { synchronized (sessions) { if (sessionId != null) { if (!sessions.containsKey(sessionId)) { sessions.put(sessionId, new PMSession(sessionId)); } return getSession(sessionId); } else { return registerSession(newSessionId()); } } }
java
public PMSession registerSession(String sessionId) { synchronized (sessions) { if (sessionId != null) { if (!sessions.containsKey(sessionId)) { sessions.put(sessionId, new PMSession(sessionId)); } return getSession(sessionId); } else { return registerSession(newSessionId()); } } }
[ "public", "PMSession", "registerSession", "(", "String", "sessionId", ")", "{", "synchronized", "(", "sessions", ")", "{", "if", "(", "sessionId", "!=", "null", ")", "{", "if", "(", "!", "sessions", ".", "containsKey", "(", "sessionId", ")", ")", "{", "sessions", ".", "put", "(", "sessionId", ",", "new", "PMSession", "(", "sessionId", ")", ")", ";", "}", "return", "getSession", "(", "sessionId", ")", ";", "}", "else", "{", "return", "registerSession", "(", "newSessionId", "(", ")", ")", ";", "}", "}", "}" ]
Creates a new session with the given id. If null is used, an automatic session id will be generated @param sessionId The new session id. Must be unique. @throws PMException on already defined session @return New session
[ "Creates", "a", "new", "session", "with", "the", "given", "id", ".", "If", "null", "is", "used", "an", "automatic", "session", "id", "will", "be", "generated" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L633-L644
150,277
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.getSession
public PMSession getSession(String sessionId) { final PMSession s = sessions.get(sessionId); if (s != null) { s.setLastAccess(new Date()); } return s; }
java
public PMSession getSession(String sessionId) { final PMSession s = sessions.get(sessionId); if (s != null) { s.setLastAccess(new Date()); } return s; }
[ "public", "PMSession", "getSession", "(", "String", "sessionId", ")", "{", "final", "PMSession", "s", "=", "sessions", ".", "get", "(", "sessionId", ")", ";", "if", "(", "s", "!=", "null", ")", "{", "s", ".", "setLastAccess", "(", "new", "Date", "(", ")", ")", ";", "}", "return", "s", ";", "}" ]
Return the session for the given id @param sessionId The id of the wanted session @return The session
[ "Return", "the", "session", "for", "the", "given", "id" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L652-L658
150,278
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.getResourceBundle
public ResourceBundle getResourceBundle() { if (bundle == null) { String lang = ""; String country = ""; final String _locale = getPm().getCfg().getProperty("locale", ""); if (_locale != null && !"".equals(_locale.trim())) { final String[] __locale = _locale.split("[_]"); lang = __locale[0]; if (__locale.length > 1) { country = __locale[1]; } } final Locale locale = new Locale(lang, country); bundle = ResourceBundle.getBundle("ApplicationResource", locale); } return bundle; }
java
public ResourceBundle getResourceBundle() { if (bundle == null) { String lang = ""; String country = ""; final String _locale = getPm().getCfg().getProperty("locale", ""); if (_locale != null && !"".equals(_locale.trim())) { final String[] __locale = _locale.split("[_]"); lang = __locale[0]; if (__locale.length > 1) { country = __locale[1]; } } final Locale locale = new Locale(lang, country); bundle = ResourceBundle.getBundle("ApplicationResource", locale); } return bundle; }
[ "public", "ResourceBundle", "getResourceBundle", "(", ")", "{", "if", "(", "bundle", "==", "null", ")", "{", "String", "lang", "=", "\"\"", ";", "String", "country", "=", "\"\"", ";", "final", "String", "_locale", "=", "getPm", "(", ")", ".", "getCfg", "(", ")", ".", "getProperty", "(", "\"locale\"", ",", "\"\"", ")", ";", "if", "(", "_locale", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "_locale", ".", "trim", "(", ")", ")", ")", "{", "final", "String", "[", "]", "__locale", "=", "_locale", ".", "split", "(", "\"[_]\"", ")", ";", "lang", "=", "__locale", "[", "0", "]", ";", "if", "(", "__locale", ".", "length", ">", "1", ")", "{", "country", "=", "__locale", "[", "1", "]", ";", "}", "}", "final", "Locale", "locale", "=", "new", "Locale", "(", "lang", ",", "country", ")", ";", "bundle", "=", "ResourceBundle", ".", "getBundle", "(", "\"ApplicationResource\"", ",", "locale", ")", ";", "}", "return", "bundle", ";", "}" ]
Returns local resource bundle for internationalization
[ "Returns", "local", "resource", "bundle", "for", "internationalization" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L791-L807
150,279
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.getExternalConverter
public Converter getExternalConverter(String id) { for (ExternalConverters ec : getExternalConverters()) { for (ConverterWrapper cw : ec.getConverters()) { if (cw.getId().equals(id)) { return cw.getConverter(); } } } return null; }
java
public Converter getExternalConverter(String id) { for (ExternalConverters ec : getExternalConverters()) { for (ConverterWrapper cw : ec.getConverters()) { if (cw.getId().equals(id)) { return cw.getConverter(); } } } return null; }
[ "public", "Converter", "getExternalConverter", "(", "String", "id", ")", "{", "for", "(", "ExternalConverters", "ec", ":", "getExternalConverters", "(", ")", ")", "{", "for", "(", "ConverterWrapper", "cw", ":", "ec", ".", "getConverters", "(", ")", ")", "{", "if", "(", "cw", ".", "getId", "(", ")", ".", "equals", "(", "id", ")", ")", "{", "return", "cw", ".", "getConverter", "(", ")", ";", "}", "}", "}", "return", "null", ";", "}" ]
Search external converter by id
[ "Search", "external", "converter", "by", "id" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L830-L839
150,280
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.getAuditService
public AuditService getAuditService() { if (auditService == null) { auditService = (AuditService) newInstance(cfg.getProperty("audit-service", "jpaoletti.jpm.core.audit.SimpleAudit")); auditService.setLevel(cfg.getInt("audit-level", -1)); } return auditService; }
java
public AuditService getAuditService() { if (auditService == null) { auditService = (AuditService) newInstance(cfg.getProperty("audit-service", "jpaoletti.jpm.core.audit.SimpleAudit")); auditService.setLevel(cfg.getInt("audit-level", -1)); } return auditService; }
[ "public", "AuditService", "getAuditService", "(", ")", "{", "if", "(", "auditService", "==", "null", ")", "{", "auditService", "=", "(", "AuditService", ")", "newInstance", "(", "cfg", ".", "getProperty", "(", "\"audit-service\"", ",", "\"jpaoletti.jpm.core.audit.SimpleAudit\"", ")", ")", ";", "auditService", ".", "setLevel", "(", "cfg", ".", "getInt", "(", "\"audit-level\"", ",", "-", "1", ")", ")", ";", "}", "return", "auditService", ";", "}" ]
Returns audit service
[ "Returns", "audit", "service" ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L844-L850
150,281
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.customLoad
private void customLoad() { final String s = getCfg().getProperty("custom-loader"); if (s != null) { try { final CustomLoader customLoader = (CustomLoader) Class.forName(s).newInstance(); logItem("Custom Loader", s, "*"); customLoader.execute(this); } catch (ClassNotFoundException e) { error = true; logItem("Custom Loader", s, "?"); } catch (Exception e) { error = true; error(e); logItem("Custom Loader Failed", s, "!"); } } }
java
private void customLoad() { final String s = getCfg().getProperty("custom-loader"); if (s != null) { try { final CustomLoader customLoader = (CustomLoader) Class.forName(s).newInstance(); logItem("Custom Loader", s, "*"); customLoader.execute(this); } catch (ClassNotFoundException e) { error = true; logItem("Custom Loader", s, "?"); } catch (Exception e) { error = true; error(e); logItem("Custom Loader Failed", s, "!"); } } }
[ "private", "void", "customLoad", "(", ")", "{", "final", "String", "s", "=", "getCfg", "(", ")", ".", "getProperty", "(", "\"custom-loader\"", ")", ";", "if", "(", "s", "!=", "null", ")", "{", "try", "{", "final", "CustomLoader", "customLoader", "=", "(", "CustomLoader", ")", "Class", ".", "forName", "(", "s", ")", ".", "newInstance", "(", ")", ";", "logItem", "(", "\"Custom Loader\"", ",", "s", ",", "\"*\"", ")", ";", "customLoader", ".", "execute", "(", "this", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "error", "=", "true", ";", "logItem", "(", "\"Custom Loader\"", ",", "s", ",", "\"?\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "error", "=", "true", ";", "error", "(", "e", ")", ";", "logItem", "(", "\"Custom Loader Failed\"", ",", "s", ",", "\"!\"", ")", ";", "}", "}", "}" ]
Executes a custom loader.
[ "Executes", "a", "custom", "loader", "." ]
d5aab55638383695db244744b4bfe27c5200e04f
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L855-L871
150,282
amlinv/amq-monitor
amq-monitor-web-impl/src/main/java/com/amlinv/activemq/monitor/web/MonitorWebController.java
MonitorWebController.startMonitoring
protected String startMonitoring() { String result; if ( ! this.started.getAndSet(true) ) { synchronized ( this.brokerPollerMap ) { for (ActiveMQBrokerPoller onePoller : this.brokerPollerMap.values()) { onePoller.start(); } } result = "started"; } else { result = "already running"; } return result; }
java
protected String startMonitoring() { String result; if ( ! this.started.getAndSet(true) ) { synchronized ( this.brokerPollerMap ) { for (ActiveMQBrokerPoller onePoller : this.brokerPollerMap.values()) { onePoller.start(); } } result = "started"; } else { result = "already running"; } return result; }
[ "protected", "String", "startMonitoring", "(", ")", "{", "String", "result", ";", "if", "(", "!", "this", ".", "started", ".", "getAndSet", "(", "true", ")", ")", "{", "synchronized", "(", "this", ".", "brokerPollerMap", ")", "{", "for", "(", "ActiveMQBrokerPoller", "onePoller", ":", "this", ".", "brokerPollerMap", ".", "values", "(", ")", ")", "{", "onePoller", ".", "start", "(", ")", ";", "}", "}", "result", "=", "\"started\"", ";", "}", "else", "{", "result", "=", "\"already running\"", ";", "}", "return", "result", ";", "}" ]
Start monitoring now. @return text describing the result.
[ "Start", "monitoring", "now", "." ]
0ae0156f56d7d3edf98bca9c30b153b770fe5bfa
https://github.com/amlinv/amq-monitor/blob/0ae0156f56d7d3edf98bca9c30b153b770fe5bfa/amq-monitor-web-impl/src/main/java/com/amlinv/activemq/monitor/web/MonitorWebController.java#L296-L310
150,283
amlinv/amq-monitor
amq-monitor-web-impl/src/main/java/com/amlinv/activemq/monitor/web/MonitorWebController.java
MonitorWebController.prepareBrokerPoller
protected String prepareBrokerPoller(String brokerName, String address) throws Exception { MBeanAccessConnectionFactory mBeanAccessConnectionFactory = this.jmxActiveMQUtil.getLocationConnectionFactory(address); if ( brokerName.equals("*") ) { String[] brokersAtLocation = this.jmxActiveMQUtil.queryBrokerNames(address); if ( brokersAtLocation == null ) { throw new Exception("unable to locate broker at " + address); } else if ( brokersAtLocation.length != 1 ) { throw new Exception("found more than one broker at " + address + "; count=" + brokersAtLocation.length); } else { brokerName = brokersAtLocation[0]; } } this.brokerRegistry.put(address, new BrokerInfo("unknown-broker-id", brokerName, "unknown-broker-url")); ActiveMQBrokerPoller brokerPoller = this.brokerPollerFactory.createPoller(brokerName, mBeanAccessConnectionFactory, this.websocketBrokerStatsFeed); brokerPoller.setQueueRegistry(this.queueRegistry); brokerPoller.setTopicRegistry(this.topicRegistry); // TBD: one automic update for brokerPollerMap and locations (is there an echo in here?) synchronized ( this.brokerPollerMap ) { if ( ! this.brokerPollerMap.containsKey(address) ) { this.brokerPollerMap.put(address, brokerPoller); } else { log.info("ignoring duplicate add of broker address {}", address); return "already exists"; } } // No need to synchronize to avoid races here; the poller will not start if either already started, or already // stopped. if ( this.started.get() ) { brokerPoller.start(); } // Add auto-discovery of Queues for this broker, if enabled if ( this.autoDiscoverQueues ) { this.prepareBrokerQueueDiscoverer(brokerName, address, mBeanAccessConnectionFactory); } return address + " = " + brokerName; }
java
protected String prepareBrokerPoller(String brokerName, String address) throws Exception { MBeanAccessConnectionFactory mBeanAccessConnectionFactory = this.jmxActiveMQUtil.getLocationConnectionFactory(address); if ( brokerName.equals("*") ) { String[] brokersAtLocation = this.jmxActiveMQUtil.queryBrokerNames(address); if ( brokersAtLocation == null ) { throw new Exception("unable to locate broker at " + address); } else if ( brokersAtLocation.length != 1 ) { throw new Exception("found more than one broker at " + address + "; count=" + brokersAtLocation.length); } else { brokerName = brokersAtLocation[0]; } } this.brokerRegistry.put(address, new BrokerInfo("unknown-broker-id", brokerName, "unknown-broker-url")); ActiveMQBrokerPoller brokerPoller = this.brokerPollerFactory.createPoller(brokerName, mBeanAccessConnectionFactory, this.websocketBrokerStatsFeed); brokerPoller.setQueueRegistry(this.queueRegistry); brokerPoller.setTopicRegistry(this.topicRegistry); // TBD: one automic update for brokerPollerMap and locations (is there an echo in here?) synchronized ( this.brokerPollerMap ) { if ( ! this.brokerPollerMap.containsKey(address) ) { this.brokerPollerMap.put(address, brokerPoller); } else { log.info("ignoring duplicate add of broker address {}", address); return "already exists"; } } // No need to synchronize to avoid races here; the poller will not start if either already started, or already // stopped. if ( this.started.get() ) { brokerPoller.start(); } // Add auto-discovery of Queues for this broker, if enabled if ( this.autoDiscoverQueues ) { this.prepareBrokerQueueDiscoverer(brokerName, address, mBeanAccessConnectionFactory); } return address + " = " + brokerName; }
[ "protected", "String", "prepareBrokerPoller", "(", "String", "brokerName", ",", "String", "address", ")", "throws", "Exception", "{", "MBeanAccessConnectionFactory", "mBeanAccessConnectionFactory", "=", "this", ".", "jmxActiveMQUtil", ".", "getLocationConnectionFactory", "(", "address", ")", ";", "if", "(", "brokerName", ".", "equals", "(", "\"*\"", ")", ")", "{", "String", "[", "]", "brokersAtLocation", "=", "this", ".", "jmxActiveMQUtil", ".", "queryBrokerNames", "(", "address", ")", ";", "if", "(", "brokersAtLocation", "==", "null", ")", "{", "throw", "new", "Exception", "(", "\"unable to locate broker at \"", "+", "address", ")", ";", "}", "else", "if", "(", "brokersAtLocation", ".", "length", "!=", "1", ")", "{", "throw", "new", "Exception", "(", "\"found more than one broker at \"", "+", "address", "+", "\"; count=\"", "+", "brokersAtLocation", ".", "length", ")", ";", "}", "else", "{", "brokerName", "=", "brokersAtLocation", "[", "0", "]", ";", "}", "}", "this", ".", "brokerRegistry", ".", "put", "(", "address", ",", "new", "BrokerInfo", "(", "\"unknown-broker-id\"", ",", "brokerName", ",", "\"unknown-broker-url\"", ")", ")", ";", "ActiveMQBrokerPoller", "brokerPoller", "=", "this", ".", "brokerPollerFactory", ".", "createPoller", "(", "brokerName", ",", "mBeanAccessConnectionFactory", ",", "this", ".", "websocketBrokerStatsFeed", ")", ";", "brokerPoller", ".", "setQueueRegistry", "(", "this", ".", "queueRegistry", ")", ";", "brokerPoller", ".", "setTopicRegistry", "(", "this", ".", "topicRegistry", ")", ";", "// TBD: one automic update for brokerPollerMap and locations (is there an echo in here?)", "synchronized", "(", "this", ".", "brokerPollerMap", ")", "{", "if", "(", "!", "this", ".", "brokerPollerMap", ".", "containsKey", "(", "address", ")", ")", "{", "this", ".", "brokerPollerMap", ".", "put", "(", "address", ",", "brokerPoller", ")", ";", "}", "else", "{", "log", ".", "info", "(", "\"ignoring duplicate add of broker address {}\"", ",", "address", ")", ";", "return", "\"already exists\"", ";", "}", "}", "// No need to synchronize to avoid races here; the poller will not start if either already started, or already", "// stopped.", "if", "(", "this", ".", "started", ".", "get", "(", ")", ")", "{", "brokerPoller", ".", "start", "(", ")", ";", "}", "// Add auto-discovery of Queues for this broker, if enabled", "if", "(", "this", ".", "autoDiscoverQueues", ")", "{", "this", ".", "prepareBrokerQueueDiscoverer", "(", "brokerName", ",", "address", ",", "mBeanAccessConnectionFactory", ")", ";", "}", "return", "address", "+", "\" = \"", "+", "brokerName", ";", "}" ]
Prepare polling for the named broker at the given polling address. @param brokerName @param address @return @throws Exception
[ "Prepare", "polling", "for", "the", "named", "broker", "at", "the", "given", "polling", "address", "." ]
0ae0156f56d7d3edf98bca9c30b153b770fe5bfa
https://github.com/amlinv/amq-monitor/blob/0ae0156f56d7d3edf98bca9c30b153b770fe5bfa/amq-monitor-web-impl/src/main/java/com/amlinv/activemq/monitor/web/MonitorWebController.java#L324-L370
150,284
jtrfp/javamod
src/main/java/de/quippy/javamod/mixer/dsp/iir/filter/IIRFilter.java
IIRFilter.doFilter
public int doFilter(final float[] ringBuffer, final int start, final int length, final int useBands) { final float internalPreAmp = 1f/useBands; final float rest = 1.0f - internalPreAmp; final int end = start + length; int index = start; while (index < end) { for (int c=0; c<channels; c++) { final int sampleIndex = (index++) % sampleBufferSize; float sample = 0; // Run the difference equation final float preAmpedSample = ringBuffer[sampleIndex] * preAmp * internalPreAmp; for (int f=0; f<useBands; f++) { IIRFilterBase filter = filters[f]; sample += filter.performFilterCalculation(preAmpedSample, c, iIndex, jIndex, kIndex) * filter.amplitudeAdj; } sample += (ringBuffer[sampleIndex] * rest); ringBuffer[sampleIndex] = (sample>1.0f)?1.0f:((sample<-1.0f)?-1.0f:sample); } // Do indices maintenance iIndex = (iIndex + 1) % IIRFilterBase.HISTORYSIZE; jIndex = (jIndex + 1) % IIRFilterBase.HISTORYSIZE; kIndex = (kIndex + 1) % IIRFilterBase.HISTORYSIZE; } return length; }
java
public int doFilter(final float[] ringBuffer, final int start, final int length, final int useBands) { final float internalPreAmp = 1f/useBands; final float rest = 1.0f - internalPreAmp; final int end = start + length; int index = start; while (index < end) { for (int c=0; c<channels; c++) { final int sampleIndex = (index++) % sampleBufferSize; float sample = 0; // Run the difference equation final float preAmpedSample = ringBuffer[sampleIndex] * preAmp * internalPreAmp; for (int f=0; f<useBands; f++) { IIRFilterBase filter = filters[f]; sample += filter.performFilterCalculation(preAmpedSample, c, iIndex, jIndex, kIndex) * filter.amplitudeAdj; } sample += (ringBuffer[sampleIndex] * rest); ringBuffer[sampleIndex] = (sample>1.0f)?1.0f:((sample<-1.0f)?-1.0f:sample); } // Do indices maintenance iIndex = (iIndex + 1) % IIRFilterBase.HISTORYSIZE; jIndex = (jIndex + 1) % IIRFilterBase.HISTORYSIZE; kIndex = (kIndex + 1) % IIRFilterBase.HISTORYSIZE; } return length; }
[ "public", "int", "doFilter", "(", "final", "float", "[", "]", "ringBuffer", ",", "final", "int", "start", ",", "final", "int", "length", ",", "final", "int", "useBands", ")", "{", "final", "float", "internalPreAmp", "=", "1f", "/", "useBands", ";", "final", "float", "rest", "=", "1.0f", "-", "internalPreAmp", ";", "final", "int", "end", "=", "start", "+", "length", ";", "int", "index", "=", "start", ";", "while", "(", "index", "<", "end", ")", "{", "for", "(", "int", "c", "=", "0", ";", "c", "<", "channels", ";", "c", "++", ")", "{", "final", "int", "sampleIndex", "=", "(", "index", "++", ")", "%", "sampleBufferSize", ";", "float", "sample", "=", "0", ";", "// Run the difference equation", "final", "float", "preAmpedSample", "=", "ringBuffer", "[", "sampleIndex", "]", "*", "preAmp", "*", "internalPreAmp", ";", "for", "(", "int", "f", "=", "0", ";", "f", "<", "useBands", ";", "f", "++", ")", "{", "IIRFilterBase", "filter", "=", "filters", "[", "f", "]", ";", "sample", "+=", "filter", ".", "performFilterCalculation", "(", "preAmpedSample", ",", "c", ",", "iIndex", ",", "jIndex", ",", "kIndex", ")", "*", "filter", ".", "amplitudeAdj", ";", "}", "sample", "+=", "(", "ringBuffer", "[", "sampleIndex", "]", "*", "rest", ")", ";", "ringBuffer", "[", "sampleIndex", "]", "=", "(", "sample", ">", "1.0f", ")", "?", "1.0f", ":", "(", "(", "sample", "<", "-", "1.0f", ")", "?", "-", "1.0f", ":", "sample", ")", ";", "}", "// Do indices maintenance", "iIndex", "=", "(", "iIndex", "+", "1", ")", "%", "IIRFilterBase", ".", "HISTORYSIZE", ";", "jIndex", "=", "(", "jIndex", "+", "1", ")", "%", "IIRFilterBase", ".", "HISTORYSIZE", ";", "kIndex", "=", "(", "kIndex", "+", "1", ")", "%", "IIRFilterBase", ".", "HISTORYSIZE", ";", "}", "return", "length", ";", "}" ]
This will perform the filter on the samples @param ringBuffer @param preAmpedResultBuffer @param start @param length @since 12.01.2012
[ "This", "will", "perform", "the", "filter", "on", "the", "samples" ]
cda4fe943a589dc49415f4413453e2eece72076a
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/mixer/dsp/iir/filter/IIRFilter.java#L110-L139
150,285
oaqa/uima-ecd
src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java
ProcessingStep.getPhaseId
public int getPhaseId() { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_phaseId == null) jcasType.jcas.throwFeatMissing("phaseId", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); return jcasType.ll_cas.ll_getIntValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_phaseId);}
java
public int getPhaseId() { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_phaseId == null) jcasType.jcas.throwFeatMissing("phaseId", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); return jcasType.ll_cas.ll_getIntValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_phaseId);}
[ "public", "int", "getPhaseId", "(", ")", "{", "if", "(", "ProcessingStep_Type", ".", "featOkTst", "&&", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeat_phaseId", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"phaseId\"", ",", "\"edu.cmu.lti.oaqa.framework.types.ProcessingStep\"", ")", ";", "return", "jcasType", ".", "ll_cas", ".", "ll_getIntValue", "(", "addr", ",", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeatCode_phaseId", ")", ";", "}" ]
getter for phaseId - gets @generated
[ "getter", "for", "phaseId", "-", "gets" ]
09a0ae26647490b43affc36ab3a01100702b989f
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java#L67-L70
150,286
oaqa/uima-ecd
src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java
ProcessingStep.setPhaseId
public void setPhaseId(int v) { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_phaseId == null) jcasType.jcas.throwFeatMissing("phaseId", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); jcasType.ll_cas.ll_setIntValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_phaseId, v);}
java
public void setPhaseId(int v) { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_phaseId == null) jcasType.jcas.throwFeatMissing("phaseId", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); jcasType.ll_cas.ll_setIntValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_phaseId, v);}
[ "public", "void", "setPhaseId", "(", "int", "v", ")", "{", "if", "(", "ProcessingStep_Type", ".", "featOkTst", "&&", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeat_phaseId", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"phaseId\"", ",", "\"edu.cmu.lti.oaqa.framework.types.ProcessingStep\"", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setIntValue", "(", "addr", ",", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeatCode_phaseId", ",", "v", ")", ";", "}" ]
setter for phaseId - sets @generated
[ "setter", "for", "phaseId", "-", "sets" ]
09a0ae26647490b43affc36ab3a01100702b989f
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java#L74-L77
150,287
oaqa/uima-ecd
src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java
ProcessingStep.getComponent
public String getComponent() { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_component == null) jcasType.jcas.throwFeatMissing("component", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); return jcasType.ll_cas.ll_getStringValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_component);}
java
public String getComponent() { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_component == null) jcasType.jcas.throwFeatMissing("component", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); return jcasType.ll_cas.ll_getStringValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_component);}
[ "public", "String", "getComponent", "(", ")", "{", "if", "(", "ProcessingStep_Type", ".", "featOkTst", "&&", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeat_component", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"component\"", ",", "\"edu.cmu.lti.oaqa.framework.types.ProcessingStep\"", ")", ";", "return", "jcasType", ".", "ll_cas", ".", "ll_getStringValue", "(", "addr", ",", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeatCode_component", ")", ";", "}" ]
getter for component - gets @generated
[ "getter", "for", "component", "-", "gets" ]
09a0ae26647490b43affc36ab3a01100702b989f
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java#L85-L88
150,288
oaqa/uima-ecd
src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java
ProcessingStep.setComponent
public void setComponent(String v) { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_component == null) jcasType.jcas.throwFeatMissing("component", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); jcasType.ll_cas.ll_setStringValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_component, v);}
java
public void setComponent(String v) { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_component == null) jcasType.jcas.throwFeatMissing("component", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); jcasType.ll_cas.ll_setStringValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_component, v);}
[ "public", "void", "setComponent", "(", "String", "v", ")", "{", "if", "(", "ProcessingStep_Type", ".", "featOkTst", "&&", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeat_component", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"component\"", ",", "\"edu.cmu.lti.oaqa.framework.types.ProcessingStep\"", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setStringValue", "(", "addr", ",", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeatCode_component", ",", "v", ")", ";", "}" ]
setter for component - sets @generated
[ "setter", "for", "component", "-", "sets" ]
09a0ae26647490b43affc36ab3a01100702b989f
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java#L92-L95
150,289
oaqa/uima-ecd
src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java
ProcessingStep.getCasId
public String getCasId() { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_casId == null) jcasType.jcas.throwFeatMissing("casId", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); return jcasType.ll_cas.ll_getStringValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_casId);}
java
public String getCasId() { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_casId == null) jcasType.jcas.throwFeatMissing("casId", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); return jcasType.ll_cas.ll_getStringValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_casId);}
[ "public", "String", "getCasId", "(", ")", "{", "if", "(", "ProcessingStep_Type", ".", "featOkTst", "&&", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeat_casId", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"casId\"", ",", "\"edu.cmu.lti.oaqa.framework.types.ProcessingStep\"", ")", ";", "return", "jcasType", ".", "ll_cas", ".", "ll_getStringValue", "(", "addr", ",", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeatCode_casId", ")", ";", "}" ]
getter for casId - gets @generated
[ "getter", "for", "casId", "-", "gets" ]
09a0ae26647490b43affc36ab3a01100702b989f
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java#L103-L106
150,290
oaqa/uima-ecd
src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java
ProcessingStep.setCasId
public void setCasId(String v) { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_casId == null) jcasType.jcas.throwFeatMissing("casId", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); jcasType.ll_cas.ll_setStringValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_casId, v);}
java
public void setCasId(String v) { if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_casId == null) jcasType.jcas.throwFeatMissing("casId", "edu.cmu.lti.oaqa.framework.types.ProcessingStep"); jcasType.ll_cas.ll_setStringValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_casId, v);}
[ "public", "void", "setCasId", "(", "String", "v", ")", "{", "if", "(", "ProcessingStep_Type", ".", "featOkTst", "&&", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeat_casId", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"casId\"", ",", "\"edu.cmu.lti.oaqa.framework.types.ProcessingStep\"", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setStringValue", "(", "addr", ",", "(", "(", "ProcessingStep_Type", ")", "jcasType", ")", ".", "casFeatCode_casId", ",", "v", ")", ";", "}" ]
setter for casId - sets @generated
[ "setter", "for", "casId", "-", "sets" ]
09a0ae26647490b43affc36ab3a01100702b989f
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/framework/types/ProcessingStep.java#L110-L113
150,291
khennig/lazy-datacontroller
lazy-datacontroller-pfadapter/src/main/java/com/tri/ui/model/adapter/PrimeFacesLazyAdapter.java
PrimeFacesLazyAdapter.load
@Override public List<V> load(final int first, final int pageSize, final List<SortMeta> multiSortMeta, final Map<String, Object> filters) { final boolean filtersChanged = handleFilters(filters); final boolean sortOrderChanged = handleSortOrder(multiSortMeta); boolean notify = false; // clear cache if (filtersChanged || sortOrderChanged) { adaptee.clearCache(); notify = filtersChanged || notifyOnSortOrderChanges; } adaptee.setPageSize(pageSize); final int size = adaptee.getSize(); adaptee.setFirst(first >= size ? Math.max(0, size - 1) : first); setRowCount(size); // notify observers if (filtersChanged && clearSelectionOnFilterChanges) { adaptee.clearSelection(); } if (notify) { adaptee.notify(ChangeEventType.DATA); } return adaptee.getData(); }
java
@Override public List<V> load(final int first, final int pageSize, final List<SortMeta> multiSortMeta, final Map<String, Object> filters) { final boolean filtersChanged = handleFilters(filters); final boolean sortOrderChanged = handleSortOrder(multiSortMeta); boolean notify = false; // clear cache if (filtersChanged || sortOrderChanged) { adaptee.clearCache(); notify = filtersChanged || notifyOnSortOrderChanges; } adaptee.setPageSize(pageSize); final int size = adaptee.getSize(); adaptee.setFirst(first >= size ? Math.max(0, size - 1) : first); setRowCount(size); // notify observers if (filtersChanged && clearSelectionOnFilterChanges) { adaptee.clearSelection(); } if (notify) { adaptee.notify(ChangeEventType.DATA); } return adaptee.getData(); }
[ "@", "Override", "public", "List", "<", "V", ">", "load", "(", "final", "int", "first", ",", "final", "int", "pageSize", ",", "final", "List", "<", "SortMeta", ">", "multiSortMeta", ",", "final", "Map", "<", "String", ",", "Object", ">", "filters", ")", "{", "final", "boolean", "filtersChanged", "=", "handleFilters", "(", "filters", ")", ";", "final", "boolean", "sortOrderChanged", "=", "handleSortOrder", "(", "multiSortMeta", ")", ";", "boolean", "notify", "=", "false", ";", "// clear cache", "if", "(", "filtersChanged", "||", "sortOrderChanged", ")", "{", "adaptee", ".", "clearCache", "(", ")", ";", "notify", "=", "filtersChanged", "||", "notifyOnSortOrderChanges", ";", "}", "adaptee", ".", "setPageSize", "(", "pageSize", ")", ";", "final", "int", "size", "=", "adaptee", ".", "getSize", "(", ")", ";", "adaptee", ".", "setFirst", "(", "first", ">=", "size", "?", "Math", ".", "max", "(", "0", ",", "size", "-", "1", ")", ":", "first", ")", ";", "setRowCount", "(", "size", ")", ";", "// notify observers", "if", "(", "filtersChanged", "&&", "clearSelectionOnFilterChanges", ")", "{", "adaptee", ".", "clearSelection", "(", ")", ";", "}", "if", "(", "notify", ")", "{", "adaptee", ".", "notify", "(", "ChangeEventType", ".", "DATA", ")", ";", "}", "return", "adaptee", ".", "getData", "(", ")", ";", "}" ]
PF load for multiple sort support
[ "PF", "load", "for", "multiple", "sort", "support" ]
a72a5fc6ced43d0e06fc839d68bd58cede10ab56
https://github.com/khennig/lazy-datacontroller/blob/a72a5fc6ced43d0e06fc839d68bd58cede10ab56/lazy-datacontroller-pfadapter/src/main/java/com/tri/ui/model/adapter/PrimeFacesLazyAdapter.java#L146-L175
150,292
khennig/lazy-datacontroller
lazy-datacontroller-pfadapter/src/main/java/com/tri/ui/model/adapter/PrimeFacesLazyAdapter.java
PrimeFacesLazyAdapter.handleFilters
boolean handleFilters(Map<String, Object> filters) { Validate.notNull(filters, "Filters required"); boolean changed = false; // clear non active filters and remove them from lastFilters for (Object filterKey : CollectionUtils.subtract(lastFilters.keySet(), filters.keySet())) { BeanProperty.clearBeanProperty(adaptee, (String) filterKey); lastFilters.remove(filterKey); changed = true; } // set changed active filters for (Entry<String, Object> entry : filters.entrySet()) { if (!lastFilters.containsKey(entry.getKey()) || !entry.getValue() .equals(lastFilters.get(entry.getKey()))) { BeanProperty.setBeanProperty(adaptee, entry.getKey(), entry.getValue()); lastFilters.put(entry.getKey(), entry.getValue()); changed = true; } } return changed; }
java
boolean handleFilters(Map<String, Object> filters) { Validate.notNull(filters, "Filters required"); boolean changed = false; // clear non active filters and remove them from lastFilters for (Object filterKey : CollectionUtils.subtract(lastFilters.keySet(), filters.keySet())) { BeanProperty.clearBeanProperty(adaptee, (String) filterKey); lastFilters.remove(filterKey); changed = true; } // set changed active filters for (Entry<String, Object> entry : filters.entrySet()) { if (!lastFilters.containsKey(entry.getKey()) || !entry.getValue() .equals(lastFilters.get(entry.getKey()))) { BeanProperty.setBeanProperty(adaptee, entry.getKey(), entry.getValue()); lastFilters.put(entry.getKey(), entry.getValue()); changed = true; } } return changed; }
[ "boolean", "handleFilters", "(", "Map", "<", "String", ",", "Object", ">", "filters", ")", "{", "Validate", ".", "notNull", "(", "filters", ",", "\"Filters required\"", ")", ";", "boolean", "changed", "=", "false", ";", "// clear non active filters and remove them from lastFilters", "for", "(", "Object", "filterKey", ":", "CollectionUtils", ".", "subtract", "(", "lastFilters", ".", "keySet", "(", ")", ",", "filters", ".", "keySet", "(", ")", ")", ")", "{", "BeanProperty", ".", "clearBeanProperty", "(", "adaptee", ",", "(", "String", ")", "filterKey", ")", ";", "lastFilters", ".", "remove", "(", "filterKey", ")", ";", "changed", "=", "true", ";", "}", "// set changed active filters", "for", "(", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "filters", ".", "entrySet", "(", ")", ")", "{", "if", "(", "!", "lastFilters", ".", "containsKey", "(", "entry", ".", "getKey", "(", ")", ")", "||", "!", "entry", ".", "getValue", "(", ")", ".", "equals", "(", "lastFilters", ".", "get", "(", "entry", ".", "getKey", "(", ")", ")", ")", ")", "{", "BeanProperty", ".", "setBeanProperty", "(", "adaptee", ",", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "lastFilters", ".", "put", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "changed", "=", "true", ";", "}", "}", "return", "changed", ";", "}" ]
Clears previously passed filters, sets new filters on adaptee. @param filters @return true if filters have changed to last call
[ "Clears", "previously", "passed", "filters", "sets", "new", "filters", "on", "adaptee", "." ]
a72a5fc6ced43d0e06fc839d68bd58cede10ab56
https://github.com/khennig/lazy-datacontroller/blob/a72a5fc6ced43d0e06fc839d68bd58cede10ab56/lazy-datacontroller-pfadapter/src/main/java/com/tri/ui/model/adapter/PrimeFacesLazyAdapter.java#L183-L208
150,293
khennig/lazy-datacontroller
lazy-datacontroller-pfadapter/src/main/java/com/tri/ui/model/adapter/PrimeFacesLazyAdapter.java
PrimeFacesLazyAdapter.handleSortOrder
boolean handleSortOrder(final List<SortMeta> sortOrder) { boolean changed = false; if (sortOrder == null) { if (multiSortBy != null) { adaptee.clearSorting(); multiSortBy = null; lastSorting = null; changed = true; } } else { final List<SortProperty> newSorting = convert2SortProperty(sortOrder); if (!newSorting.equals(lastSorting)) { adaptee.setSorting(newSorting); multiSortBy = sortOrder; lastSorting = newSorting; changed = true; } } return changed; }
java
boolean handleSortOrder(final List<SortMeta> sortOrder) { boolean changed = false; if (sortOrder == null) { if (multiSortBy != null) { adaptee.clearSorting(); multiSortBy = null; lastSorting = null; changed = true; } } else { final List<SortProperty> newSorting = convert2SortProperty(sortOrder); if (!newSorting.equals(lastSorting)) { adaptee.setSorting(newSorting); multiSortBy = sortOrder; lastSorting = newSorting; changed = true; } } return changed; }
[ "boolean", "handleSortOrder", "(", "final", "List", "<", "SortMeta", ">", "sortOrder", ")", "{", "boolean", "changed", "=", "false", ";", "if", "(", "sortOrder", "==", "null", ")", "{", "if", "(", "multiSortBy", "!=", "null", ")", "{", "adaptee", ".", "clearSorting", "(", ")", ";", "multiSortBy", "=", "null", ";", "lastSorting", "=", "null", ";", "changed", "=", "true", ";", "}", "}", "else", "{", "final", "List", "<", "SortProperty", ">", "newSorting", "=", "convert2SortProperty", "(", "sortOrder", ")", ";", "if", "(", "!", "newSorting", ".", "equals", "(", "lastSorting", ")", ")", "{", "adaptee", ".", "setSorting", "(", "newSorting", ")", ";", "multiSortBy", "=", "sortOrder", ";", "lastSorting", "=", "newSorting", ";", "changed", "=", "true", ";", "}", "}", "return", "changed", ";", "}" ]
Updates sorting on the adaptee. @param sortOrder @return true if sorting has changed to last call
[ "Updates", "sorting", "on", "the", "adaptee", "." ]
a72a5fc6ced43d0e06fc839d68bd58cede10ab56
https://github.com/khennig/lazy-datacontroller/blob/a72a5fc6ced43d0e06fc839d68bd58cede10ab56/lazy-datacontroller-pfadapter/src/main/java/com/tri/ui/model/adapter/PrimeFacesLazyAdapter.java#L216-L237
150,294
khennig/lazy-datacontroller
lazy-datacontroller-pfadapter/src/main/java/com/tri/ui/model/adapter/PrimeFacesLazyAdapter.java
PrimeFacesLazyAdapter.convert2SortProperty
List<SortProperty> convert2SortProperty(final List<SortMeta> sortMetas) { List<SortProperty> sortProperties = new ArrayList<SortProperty>( sortMetas.size()); for (SortMeta sortMeta : sortMetas) { final SortOrder order = sortMeta.getSortOrder(); if (order == SortOrder.ASCENDING || order == SortOrder.DESCENDING) { sortProperties.add(new SortProperty(sortMeta.getSortField(), convert2SortPropertyOrder(order))); } } return sortProperties; }
java
List<SortProperty> convert2SortProperty(final List<SortMeta> sortMetas) { List<SortProperty> sortProperties = new ArrayList<SortProperty>( sortMetas.size()); for (SortMeta sortMeta : sortMetas) { final SortOrder order = sortMeta.getSortOrder(); if (order == SortOrder.ASCENDING || order == SortOrder.DESCENDING) { sortProperties.add(new SortProperty(sortMeta.getSortField(), convert2SortPropertyOrder(order))); } } return sortProperties; }
[ "List", "<", "SortProperty", ">", "convert2SortProperty", "(", "final", "List", "<", "SortMeta", ">", "sortMetas", ")", "{", "List", "<", "SortProperty", ">", "sortProperties", "=", "new", "ArrayList", "<", "SortProperty", ">", "(", "sortMetas", ".", "size", "(", ")", ")", ";", "for", "(", "SortMeta", "sortMeta", ":", "sortMetas", ")", "{", "final", "SortOrder", "order", "=", "sortMeta", ".", "getSortOrder", "(", ")", ";", "if", "(", "order", "==", "SortOrder", ".", "ASCENDING", "||", "order", "==", "SortOrder", ".", "DESCENDING", ")", "{", "sortProperties", ".", "add", "(", "new", "SortProperty", "(", "sortMeta", ".", "getSortField", "(", ")", ",", "convert2SortPropertyOrder", "(", "order", ")", ")", ")", ";", "}", "}", "return", "sortProperties", ";", "}" ]
Converts a list of PrimeFaces SortMeta to a list of DC SortPropertyOrder @param sortMetas @return converted list @throws IllegalArgumentException if no conversion possible
[ "Converts", "a", "list", "of", "PrimeFaces", "SortMeta", "to", "a", "list", "of", "DC", "SortPropertyOrder" ]
a72a5fc6ced43d0e06fc839d68bd58cede10ab56
https://github.com/khennig/lazy-datacontroller/blob/a72a5fc6ced43d0e06fc839d68bd58cede10ab56/lazy-datacontroller-pfadapter/src/main/java/com/tri/ui/model/adapter/PrimeFacesLazyAdapter.java#L247-L258
150,295
khennig/lazy-datacontroller
lazy-datacontroller-pfadapter/src/main/java/com/tri/ui/model/adapter/PrimeFacesLazyAdapter.java
PrimeFacesLazyAdapter.convert2SortPropertyOrder
SortPropertyOrder convert2SortPropertyOrder(final SortOrder order) { switch (order) { case ASCENDING: return SortPropertyOrder.ASCENDING; case DESCENDING: return SortPropertyOrder.DESCENDING; default: throw new IllegalArgumentException("Unknown SortOrder: " + order); } }
java
SortPropertyOrder convert2SortPropertyOrder(final SortOrder order) { switch (order) { case ASCENDING: return SortPropertyOrder.ASCENDING; case DESCENDING: return SortPropertyOrder.DESCENDING; default: throw new IllegalArgumentException("Unknown SortOrder: " + order); } }
[ "SortPropertyOrder", "convert2SortPropertyOrder", "(", "final", "SortOrder", "order", ")", "{", "switch", "(", "order", ")", "{", "case", "ASCENDING", ":", "return", "SortPropertyOrder", ".", "ASCENDING", ";", "case", "DESCENDING", ":", "return", "SortPropertyOrder", ".", "DESCENDING", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unknown SortOrder: \"", "+", "order", ")", ";", "}", "}" ]
Converts PrimeFaces SortOrder to DC SortPropertyOrder. @param order @return converted SortOrder @throws IllegalArgumentException if no conversion possible
[ "Converts", "PrimeFaces", "SortOrder", "to", "DC", "SortPropertyOrder", "." ]
a72a5fc6ced43d0e06fc839d68bd58cede10ab56
https://github.com/khennig/lazy-datacontroller/blob/a72a5fc6ced43d0e06fc839d68bd58cede10ab56/lazy-datacontroller-pfadapter/src/main/java/com/tri/ui/model/adapter/PrimeFacesLazyAdapter.java#L268-L277
150,296
livetribe/livetribe-slp
osgi/bundle/src/main/java/org/livetribe/slp/osgi/ServiceAgentManagedServiceFactory.java
ServiceAgentManagedServiceFactory.deleted
public void deleted(String pid) { LOGGER.entering(CLASS_NAME, "deleted", pid); ServiceRegistration serviceRegistration = serviceAgents.remove(pid); if (serviceRegistration != null) { ServiceReference serviceReference = serviceRegistration.getReference(); ServiceAgent serviceAgent = (ServiceAgent)bundleContext.getService(serviceReference); serviceRegistration.unregister(); if (LOGGER.isLoggable(Level.FINER)) LOGGER.finer("Service Agent " + pid + " starting..."); serviceAgent.stop(); if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Service Agent " + pid + " stopped successfully"); } LOGGER.exiting(CLASS_NAME, "deleted"); }
java
public void deleted(String pid) { LOGGER.entering(CLASS_NAME, "deleted", pid); ServiceRegistration serviceRegistration = serviceAgents.remove(pid); if (serviceRegistration != null) { ServiceReference serviceReference = serviceRegistration.getReference(); ServiceAgent serviceAgent = (ServiceAgent)bundleContext.getService(serviceReference); serviceRegistration.unregister(); if (LOGGER.isLoggable(Level.FINER)) LOGGER.finer("Service Agent " + pid + " starting..."); serviceAgent.stop(); if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Service Agent " + pid + " stopped successfully"); } LOGGER.exiting(CLASS_NAME, "deleted"); }
[ "public", "void", "deleted", "(", "String", "pid", ")", "{", "LOGGER", ".", "entering", "(", "CLASS_NAME", ",", "\"deleted\"", ",", "pid", ")", ";", "ServiceRegistration", "serviceRegistration", "=", "serviceAgents", ".", "remove", "(", "pid", ")", ";", "if", "(", "serviceRegistration", "!=", "null", ")", "{", "ServiceReference", "serviceReference", "=", "serviceRegistration", ".", "getReference", "(", ")", ";", "ServiceAgent", "serviceAgent", "=", "(", "ServiceAgent", ")", "bundleContext", ".", "getService", "(", "serviceReference", ")", ";", "serviceRegistration", ".", "unregister", "(", ")", ";", "if", "(", "LOGGER", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "LOGGER", ".", "finer", "(", "\"Service Agent \"", "+", "pid", "+", "\" starting...\"", ")", ";", "serviceAgent", ".", "stop", "(", ")", ";", "if", "(", "LOGGER", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "LOGGER", ".", "fine", "(", "\"Service Agent \"", "+", "pid", "+", "\" stopped successfully\"", ")", ";", "}", "LOGGER", ".", "exiting", "(", "CLASS_NAME", ",", "\"deleted\"", ")", ";", "}" ]
Remove the SLP service agent identified by a pid that it was associated with when it was first created. @param pid The PID for the SLP service agent to be removed.
[ "Remove", "the", "SLP", "service", "agent", "identified", "by", "a", "pid", "that", "it", "was", "associated", "with", "when", "it", "was", "first", "created", "." ]
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/osgi/bundle/src/main/java/org/livetribe/slp/osgi/ServiceAgentManagedServiceFactory.java#L125-L145
150,297
livetribe/livetribe-slp
osgi/bundle/src/main/java/org/livetribe/slp/osgi/ServiceAgentManagedServiceFactory.java
ServiceAgentManagedServiceFactory.close
public void close() { LOGGER.entering(CLASS_NAME, "close"); for (String pid : serviceAgents.keySet()) { deleted(pid); } LOGGER.exiting(CLASS_NAME, "close"); }
java
public void close() { LOGGER.entering(CLASS_NAME, "close"); for (String pid : serviceAgents.keySet()) { deleted(pid); } LOGGER.exiting(CLASS_NAME, "close"); }
[ "public", "void", "close", "(", ")", "{", "LOGGER", ".", "entering", "(", "CLASS_NAME", ",", "\"close\"", ")", ";", "for", "(", "String", "pid", ":", "serviceAgents", ".", "keySet", "(", ")", ")", "{", "deleted", "(", "pid", ")", ";", "}", "LOGGER", ".", "exiting", "(", "CLASS_NAME", ",", "\"close\"", ")", ";", "}" ]
Close all the configured service agents.
[ "Close", "all", "the", "configured", "service", "agents", "." ]
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/osgi/bundle/src/main/java/org/livetribe/slp/osgi/ServiceAgentManagedServiceFactory.java#L150-L160
150,298
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/Interest.java
Interest.matches
public boolean matches(Action<?, ?> action, Object object) { return this.action == action && object != null && entityType.isAssignableFrom(object.getClass()); }
java
public boolean matches(Action<?, ?> action, Object object) { return this.action == action && object != null && entityType.isAssignableFrom(object.getClass()); }
[ "public", "boolean", "matches", "(", "Action", "<", "?", ",", "?", ">", "action", ",", "Object", "object", ")", "{", "return", "this", ".", "action", "==", "action", "&&", "object", "!=", "null", "&&", "entityType", ".", "isAssignableFrom", "(", "object", ".", "getClass", "(", ")", ")", ";", "}" ]
Checks whether given object is of interest to this interest instance. @param action the action to be performed on the object @param object the object to check @return true if the object is of interest to this, false otherwise
[ "Checks", "whether", "given", "object", "is", "of", "interest", "to", "this", "interest", "instance", "." ]
f56dc10323dca21777feb5b609a9e9cc70ffaf62
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/Interest.java#L56-L58
150,299
hawkular/hawkular-bus
hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java
MessageProcessor.createMessage
protected Message createMessage(ConnectionContext context, BasicMessage basicMessage, Map<String, String> headers) throws JMSException { if (context == null) { throw new IllegalArgumentException("The context is null"); } if (basicMessage == null) { throw new IllegalArgumentException("The message is null"); } Session session = context.getSession(); if (session == null) { throw new IllegalArgumentException("The context had a null session"); } TextMessage msg = session.createTextMessage(basicMessage.toJSON()); setHeaders(basicMessage, headers, msg); log.infof("Created text message [%s] with text [%s]", msg, msg.getText()); return msg; }
java
protected Message createMessage(ConnectionContext context, BasicMessage basicMessage, Map<String, String> headers) throws JMSException { if (context == null) { throw new IllegalArgumentException("The context is null"); } if (basicMessage == null) { throw new IllegalArgumentException("The message is null"); } Session session = context.getSession(); if (session == null) { throw new IllegalArgumentException("The context had a null session"); } TextMessage msg = session.createTextMessage(basicMessage.toJSON()); setHeaders(basicMessage, headers, msg); log.infof("Created text message [%s] with text [%s]", msg, msg.getText()); return msg; }
[ "protected", "Message", "createMessage", "(", "ConnectionContext", "context", ",", "BasicMessage", "basicMessage", ",", "Map", "<", "String", ",", "String", ">", "headers", ")", "throws", "JMSException", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The context is null\"", ")", ";", "}", "if", "(", "basicMessage", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The message is null\"", ")", ";", "}", "Session", "session", "=", "context", ".", "getSession", "(", ")", ";", "if", "(", "session", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The context had a null session\"", ")", ";", "}", "TextMessage", "msg", "=", "session", ".", "createTextMessage", "(", "basicMessage", ".", "toJSON", "(", ")", ")", ";", "setHeaders", "(", "basicMessage", ",", "headers", ",", "msg", ")", ";", "log", ".", "infof", "(", "\"Created text message [%s] with text [%s]\"", ",", "msg", ",", "msg", ".", "getText", "(", ")", ")", ";", "return", "msg", ";", "}" ]
Creates a text message that can be send via a producer that contains the given BasicMessage's JSON encoded data. @param context the context whose session is used to create the message @param basicMessage contains the data that will be JSON-encoded and encapsulated in the created message, with optional headers included @param headers headers for the Message that will override same-named headers in the basic message @return the message that can be produced @throws JMSException any error @throws NullPointerException if the context is null or the context's session is null
[ "Creates", "a", "text", "message", "that", "can", "be", "send", "via", "a", "producer", "that", "contains", "the", "given", "BasicMessage", "s", "JSON", "encoded", "data", "." ]
28d6b58bec81a50f8344d39f309b6971271ae627
https://github.com/hawkular/hawkular-bus/blob/28d6b58bec81a50f8344d39f309b6971271ae627/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java#L359-L379