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
151,700
jbundle/jbundle
app/program/script/src/main/java/org/jbundle/app/program/script/process/BaseProcessRecords.java
BaseProcessRecords.getFullPackageName
public String getFullPackageName(String classProjectID, String classPackageName) { if (classProjectID == null) return DBConstants.BLANK; String packageName = classProjectPackages.get(classProjectID); if (packageName == null) return null; // This class is not accessible if (packageName.startsWith(".")) packageName = Constants.ROOT_PACKAGE.substring(0, Constants.ROOT_PACKAGE.length() - 1) + packageName; if (classPackageName == null) classPackageName = DBConstants.BLANK; if (classPackageName.startsWith(".")) packageName = packageName + classPackageName; else if (classPackageName.length() > 0) packageName = classPackageName; return packageName; }
java
public String getFullPackageName(String classProjectID, String classPackageName) { if (classProjectID == null) return DBConstants.BLANK; String packageName = classProjectPackages.get(classProjectID); if (packageName == null) return null; // This class is not accessible if (packageName.startsWith(".")) packageName = Constants.ROOT_PACKAGE.substring(0, Constants.ROOT_PACKAGE.length() - 1) + packageName; if (classPackageName == null) classPackageName = DBConstants.BLANK; if (classPackageName.startsWith(".")) packageName = packageName + classPackageName; else if (classPackageName.length() > 0) packageName = classPackageName; return packageName; }
[ "public", "String", "getFullPackageName", "(", "String", "classProjectID", ",", "String", "classPackageName", ")", "{", "if", "(", "classProjectID", "==", "null", ")", "return", "DBConstants", ".", "BLANK", ";", "String", "packageName", "=", "classProjectPackages", ".", "get", "(", "classProjectID", ")", ";", "if", "(", "packageName", "==", "null", ")", "return", "null", ";", "// This class is not accessible", "if", "(", "packageName", ".", "startsWith", "(", "\".\"", ")", ")", "packageName", "=", "Constants", ".", "ROOT_PACKAGE", ".", "substring", "(", "0", ",", "Constants", ".", "ROOT_PACKAGE", ".", "length", "(", ")", "-", "1", ")", "+", "packageName", ";", "if", "(", "classPackageName", "==", "null", ")", "classPackageName", "=", "DBConstants", ".", "BLANK", ";", "if", "(", "classPackageName", ".", "startsWith", "(", "\".\"", ")", ")", "packageName", "=", "packageName", "+", "classPackageName", ";", "else", "if", "(", "classPackageName", ".", "length", "(", ")", ">", "0", ")", "packageName", "=", "classPackageName", ";", "return", "packageName", ";", "}" ]
GetFullPackageName Method.
[ "GetFullPackageName", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/process/BaseProcessRecords.java#L387-L403
151,701
hdecarne/java-default
src/main/java/de/carne/util/validation/InputValidator.java
InputValidator.check
public InputValidator<I> check(Validation<I> validation, ValidationMessage message) throws ValidationException { try { if (!validation.check(this.input)) { throw new ValidationException(message.format(this.input)); } } catch (ValidationException e) { throw e; } catch (Exception e) { throw new ValidationException(message.format(this.input), e); } return this; }
java
public InputValidator<I> check(Validation<I> validation, ValidationMessage message) throws ValidationException { try { if (!validation.check(this.input)) { throw new ValidationException(message.format(this.input)); } } catch (ValidationException e) { throw e; } catch (Exception e) { throw new ValidationException(message.format(this.input), e); } return this; }
[ "public", "InputValidator", "<", "I", ">", "check", "(", "Validation", "<", "I", ">", "validation", ",", "ValidationMessage", "message", ")", "throws", "ValidationException", "{", "try", "{", "if", "(", "!", "validation", ".", "check", "(", "this", ".", "input", ")", ")", "{", "throw", "new", "ValidationException", "(", "message", ".", "format", "(", "this", ".", "input", ")", ")", ";", "}", "}", "catch", "(", "ValidationException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ValidationException", "(", "message", ".", "format", "(", "this", ".", "input", ")", ",", "e", ")", ";", "}", "return", "this", ";", "}" ]
Checks the given validation. @param validation the {@linkplain Validation} to perform. @param message the validation message to create in case the validation fails. @return the validated {@linkplain InputValidator} instance for further validation steps. @throws ValidationException if the validation fails.
[ "Checks", "the", "given", "validation", "." ]
ca16f6fdb0436e90e9e2df3106055e320bb3c9e3
https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/validation/InputValidator.java#L77-L88
151,702
attribyte/wpdb
src/main/java/org/attribyte/wp/model/Shortcode.java
Shortcode.positionalValues
public final List<String> positionalValues() { return attributes.entrySet() .stream() .filter(kv -> kv.getKey().startsWith("$")) .map(Map.Entry::getValue) .collect(Collectors.toList()); }
java
public final List<String> positionalValues() { return attributes.entrySet() .stream() .filter(kv -> kv.getKey().startsWith("$")) .map(Map.Entry::getValue) .collect(Collectors.toList()); }
[ "public", "final", "List", "<", "String", ">", "positionalValues", "(", ")", "{", "return", "attributes", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "kv", "->", "kv", ".", "getKey", "(", ")", ".", "startsWith", "(", "\"$\"", ")", ")", ".", "map", "(", "Map", ".", "Entry", "::", "getValue", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
Gets a list of any positional values. @return The list of values.
[ "Gets", "a", "list", "of", "any", "positional", "values", "." ]
b9adf6131dfb67899ebff770c9bfeb001cc42f30
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Shortcode.java#L106-L112
151,703
attribyte/wpdb
src/main/java/org/attribyte/wp/model/Shortcode.java
Shortcode.appendAttributeValue
private StringBuilder appendAttributeValue(final String value, final StringBuilder buf) { if(value.contains("\"")) { buf.append("\'").append(escapeAttribute(value)).append("\'"); } else if(value.contains(" ") || value.contains("\'") || value.contains("=")) { buf.append("\"").append(escapeAttribute(value)).append("\""); } else { buf.append(escapeAttribute(value)); } return buf; }
java
private StringBuilder appendAttributeValue(final String value, final StringBuilder buf) { if(value.contains("\"")) { buf.append("\'").append(escapeAttribute(value)).append("\'"); } else if(value.contains(" ") || value.contains("\'") || value.contains("=")) { buf.append("\"").append(escapeAttribute(value)).append("\""); } else { buf.append(escapeAttribute(value)); } return buf; }
[ "private", "StringBuilder", "appendAttributeValue", "(", "final", "String", "value", ",", "final", "StringBuilder", "buf", ")", "{", "if", "(", "value", ".", "contains", "(", "\"\\\"\"", ")", ")", "{", "buf", ".", "append", "(", "\"\\'\"", ")", ".", "append", "(", "escapeAttribute", "(", "value", ")", ")", ".", "append", "(", "\"\\'\"", ")", ";", "}", "else", "if", "(", "value", ".", "contains", "(", "\" \"", ")", "||", "value", ".", "contains", "(", "\"\\'\"", ")", "||", "value", ".", "contains", "(", "\"=\"", ")", ")", "{", "buf", ".", "append", "(", "\"\\\"\"", ")", ".", "append", "(", "escapeAttribute", "(", "value", ")", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "}", "else", "{", "buf", ".", "append", "(", "escapeAttribute", "(", "value", ")", ")", ";", "}", "return", "buf", ";", "}" ]
Appends an attribute value with appropriate quoting. @param value The value. @param buf The buffer to append to. @return The input buffer.
[ "Appends", "an", "attribute", "value", "with", "appropriate", "quoting", "." ]
b9adf6131dfb67899ebff770c9bfeb001cc42f30
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Shortcode.java#L141-L150
151,704
attribyte/wpdb
src/main/java/org/attribyte/wp/model/Shortcode.java
Shortcode.parse
public static Shortcode parse(final String shortcode) throws ParseException { String exp = shortcode.trim(); if(exp.length() < 3) { throw new ParseException(String.format("Invalid shortcode ('%s')", exp), 0); } if(exp.charAt(0) != '[') { throw new ParseException("Expecting '['", 0); } int end = exp.indexOf(']'); if(end == -1) { throw new ParseException("Expecting ']", 0); } Shortcode startTag = ShortcodeParser.parseStart(exp.substring(0, end + 1)); end = exp.lastIndexOf("[/"); if(end > 0) { if(exp.endsWith("[/" + startTag.name + "]")) { int start = shortcode.indexOf("]"); return startTag.withContent(exp.substring(start + 1, end)); } else { throw new ParseException("Invalid shortcode end", 0); } } else { return startTag; } }
java
public static Shortcode parse(final String shortcode) throws ParseException { String exp = shortcode.trim(); if(exp.length() < 3) { throw new ParseException(String.format("Invalid shortcode ('%s')", exp), 0); } if(exp.charAt(0) != '[') { throw new ParseException("Expecting '['", 0); } int end = exp.indexOf(']'); if(end == -1) { throw new ParseException("Expecting ']", 0); } Shortcode startTag = ShortcodeParser.parseStart(exp.substring(0, end + 1)); end = exp.lastIndexOf("[/"); if(end > 0) { if(exp.endsWith("[/" + startTag.name + "]")) { int start = shortcode.indexOf("]"); return startTag.withContent(exp.substring(start + 1, end)); } else { throw new ParseException("Invalid shortcode end", 0); } } else { return startTag; } }
[ "public", "static", "Shortcode", "parse", "(", "final", "String", "shortcode", ")", "throws", "ParseException", "{", "String", "exp", "=", "shortcode", ".", "trim", "(", ")", ";", "if", "(", "exp", ".", "length", "(", ")", "<", "3", ")", "{", "throw", "new", "ParseException", "(", "String", ".", "format", "(", "\"Invalid shortcode ('%s')\"", ",", "exp", ")", ",", "0", ")", ";", "}", "if", "(", "exp", ".", "charAt", "(", "0", ")", "!=", "'", "'", ")", "{", "throw", "new", "ParseException", "(", "\"Expecting '['\"", ",", "0", ")", ";", "}", "int", "end", "=", "exp", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "end", "==", "-", "1", ")", "{", "throw", "new", "ParseException", "(", "\"Expecting ']\"", ",", "0", ")", ";", "}", "Shortcode", "startTag", "=", "ShortcodeParser", ".", "parseStart", "(", "exp", ".", "substring", "(", "0", ",", "end", "+", "1", ")", ")", ";", "end", "=", "exp", ".", "lastIndexOf", "(", "\"[/\"", ")", ";", "if", "(", "end", ">", "0", ")", "{", "if", "(", "exp", ".", "endsWith", "(", "\"[/\"", "+", "startTag", ".", "name", "+", "\"]\"", ")", ")", "{", "int", "start", "=", "shortcode", ".", "indexOf", "(", "\"]\"", ")", ";", "return", "startTag", ".", "withContent", "(", "exp", ".", "substring", "(", "start", "+", "1", ",", "end", ")", ")", ";", "}", "else", "{", "throw", "new", "ParseException", "(", "\"Invalid shortcode end\"", ",", "0", ")", ";", "}", "}", "else", "{", "return", "startTag", ";", "}", "}" ]
Parses a shortcode @param shortcode The shortcode string. @return The parsed shortcode. @throws ParseException on invalid code.
[ "Parses", "a", "shortcode" ]
b9adf6131dfb67899ebff770c9bfeb001cc42f30
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Shortcode.java#L158-L187
151,705
attribyte/wpdb
src/main/java/org/attribyte/wp/model/Shortcode.java
Shortcode.parse
public static void parse(final String str, final ShortcodeParser.Handler handler) { ShortcodeParser.parse(str, handler); }
java
public static void parse(final String str, final ShortcodeParser.Handler handler) { ShortcodeParser.parse(str, handler); }
[ "public", "static", "void", "parse", "(", "final", "String", "str", ",", "final", "ShortcodeParser", ".", "Handler", "handler", ")", "{", "ShortcodeParser", ".", "parse", "(", "str", ",", "handler", ")", ";", "}" ]
Parse an arbitrary string. @param str The string. @param handler The handler for parse events.
[ "Parse", "an", "arbitrary", "string", "." ]
b9adf6131dfb67899ebff770c9bfeb001cc42f30
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Shortcode.java#L194-L196
151,706
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java
XMLContentHandler.startDocument
@Override public void startDocument() throws SAXException { LOG.info("BEGIN ContentImport"); LOG.info("IMPORT USER: {}", this.session.getUserID()); this.startTime = System.nanoTime(); }
java
@Override public void startDocument() throws SAXException { LOG.info("BEGIN ContentImport"); LOG.info("IMPORT USER: {}", this.session.getUserID()); this.startTime = System.nanoTime(); }
[ "@", "Override", "public", "void", "startDocument", "(", ")", "throws", "SAXException", "{", "LOG", ".", "info", "(", "\"BEGIN ContentImport\"", ")", ";", "LOG", ".", "info", "(", "\"IMPORT USER: {}\"", ",", "this", ".", "session", ".", "getUserID", "(", ")", ")", ";", "this", ".", "startTime", "=", "System", ".", "nanoTime", "(", ")", ";", "}" ]
Prints out information statements and sets the startTimer.
[ "Prints", "out", "information", "statements", "and", "sets", "the", "startTimer", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java#L133-L139
151,707
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java
XMLContentHandler.endDocument
@Override public void endDocument() throws SAXException { LOG.info("Content Processing finished, saving..."); try { this.session.save(); } catch (final RepositoryException e) { throw new AssertionError("Saving failed", e); } if (LOG.isInfoEnabled()) { LOG.info("Content imported in {} ms", (System.nanoTime() - this.startTime) / 1_000_000); LOG.info("END ContentImport"); } }
java
@Override public void endDocument() throws SAXException { LOG.info("Content Processing finished, saving..."); try { this.session.save(); } catch (final RepositoryException e) { throw new AssertionError("Saving failed", e); } if (LOG.isInfoEnabled()) { LOG.info("Content imported in {} ms", (System.nanoTime() - this.startTime) / 1_000_000); LOG.info("END ContentImport"); } }
[ "@", "Override", "public", "void", "endDocument", "(", ")", "throws", "SAXException", "{", "LOG", ".", "info", "(", "\"Content Processing finished, saving...\"", ")", ";", "try", "{", "this", ".", "session", ".", "save", "(", ")", ";", "}", "catch", "(", "final", "RepositoryException", "e", ")", "{", "throw", "new", "AssertionError", "(", "\"Saving failed\"", ",", "e", ")", ";", "}", "if", "(", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "LOG", ".", "info", "(", "\"Content imported in {} ms\"", ",", "(", "System", ".", "nanoTime", "(", ")", "-", "this", ".", "startTime", ")", "/", "1_000_000", ")", ";", "LOG", ".", "info", "(", "\"END ContentImport\"", ")", ";", "}", "}" ]
Persists the changes in the repository and prints out information such as processing time.
[ "Persists", "the", "changes", "in", "the", "repository", "and", "prints", "out", "information", "such", "as", "processing", "time", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java#L144-L157
151,708
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java
XMLContentHandler.endElement
@Override public void endElement(final String uri, final String localName, final String qName) throws SAXException { LOG.trace("endElement uri={} localName={} qName={}", uri, localName, qName); if (this.isNotInkstandNamespace(uri)) { return; } switch (localName) { case "rootNode": LOG.debug("Closing rootNode"); this.nodeStack.pop(); break; case "node": LOG.debug("Closing node"); this.nodeStack.pop(); break; case "mixin": LOG.debug("Closing mixin"); break; case "property": this.endElementProperty(); break; default: break; } }
java
@Override public void endElement(final String uri, final String localName, final String qName) throws SAXException { LOG.trace("endElement uri={} localName={} qName={}", uri, localName, qName); if (this.isNotInkstandNamespace(uri)) { return; } switch (localName) { case "rootNode": LOG.debug("Closing rootNode"); this.nodeStack.pop(); break; case "node": LOG.debug("Closing node"); this.nodeStack.pop(); break; case "mixin": LOG.debug("Closing mixin"); break; case "property": this.endElementProperty(); break; default: break; } }
[ "@", "Override", "public", "void", "endElement", "(", "final", "String", "uri", ",", "final", "String", "localName", ",", "final", "String", "qName", ")", "throws", "SAXException", "{", "LOG", ".", "trace", "(", "\"endElement uri={} localName={} qName={}\"", ",", "uri", ",", "localName", ",", "qName", ")", ";", "if", "(", "this", ".", "isNotInkstandNamespace", "(", "uri", ")", ")", "{", "return", ";", "}", "switch", "(", "localName", ")", "{", "case", "\"rootNode\"", ":", "LOG", ".", "debug", "(", "\"Closing rootNode\"", ")", ";", "this", ".", "nodeStack", ".", "pop", "(", ")", ";", "break", ";", "case", "\"node\"", ":", "LOG", ".", "debug", "(", "\"Closing node\"", ")", ";", "this", ".", "nodeStack", ".", "pop", "(", ")", ";", "break", ";", "case", "\"mixin\"", ":", "LOG", ".", "debug", "(", "\"Closing mixin\"", ")", ";", "break", ";", "case", "\"property\"", ":", "this", ".", "endElementProperty", "(", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}" ]
Depending on the element, which has to be in the correct namespace, the method adds a property to the node or removes completed nodes from the node stack.
[ "Depending", "on", "the", "element", "which", "has", "to", "be", "in", "the", "correct", "namespace", "the", "method", "adds", "a", "property", "to", "the", "node", "or", "removes", "completed", "nodes", "from", "the", "node", "stack", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java#L194-L219
151,709
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java
XMLContentHandler.characters
@Override public void characters(final char[] chr, final int start, final int length) throws SAXException { final String text = new String(chr).substring(start, start + length); LOG.trace("characters; '{}'", text); final String trimmedText = text.trim(); LOG.info("text: '{}'", trimmedText); this.textStack.push(trimmedText); }
java
@Override public void characters(final char[] chr, final int start, final int length) throws SAXException { final String text = new String(chr).substring(start, start + length); LOG.trace("characters; '{}'", text); final String trimmedText = text.trim(); LOG.info("text: '{}'", trimmedText); this.textStack.push(trimmedText); }
[ "@", "Override", "public", "void", "characters", "(", "final", "char", "[", "]", "chr", ",", "final", "int", "start", ",", "final", "int", "length", ")", "throws", "SAXException", "{", "final", "String", "text", "=", "new", "String", "(", "chr", ")", ".", "substring", "(", "start", ",", "start", "+", "length", ")", ";", "LOG", ".", "trace", "(", "\"characters; '{}'\"", ",", "text", ")", ";", "final", "String", "trimmedText", "=", "text", ".", "trim", "(", ")", ";", "LOG", ".", "info", "(", "\"text: '{}'\"", ",", "trimmedText", ")", ";", "this", ".", "textStack", ".", "push", "(", "trimmedText", ")", ";", "}" ]
Detects text by trimming the effective content of the char array.
[ "Detects", "text", "by", "trimming", "the", "effective", "content", "of", "the", "char", "array", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java#L291-L299
151,710
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java
XMLContentHandler.startElementRootNode
private void startElementRootNode(final Attributes attributes) { LOG.debug("Found rootNode"); try { this.rootNode = this.newNode(null, attributes); this.nodeStack.push(this.rootNode); } catch (final RepositoryException e) { throw new AssertionError("Could not create node", e); } }
java
private void startElementRootNode(final Attributes attributes) { LOG.debug("Found rootNode"); try { this.rootNode = this.newNode(null, attributes); this.nodeStack.push(this.rootNode); } catch (final RepositoryException e) { throw new AssertionError("Could not create node", e); } }
[ "private", "void", "startElementRootNode", "(", "final", "Attributes", "attributes", ")", "{", "LOG", ".", "debug", "(", "\"Found rootNode\"", ")", ";", "try", "{", "this", ".", "rootNode", "=", "this", ".", "newNode", "(", "null", ",", "attributes", ")", ";", "this", ".", "nodeStack", ".", "push", "(", "this", ".", "rootNode", ")", ";", "}", "catch", "(", "final", "RepositoryException", "e", ")", "{", "throw", "new", "AssertionError", "(", "\"Could not create node\"", ",", "e", ")", ";", "}", "}" ]
Invoked on rootNode element. @param attributes the DOM attributes of the root node element
[ "Invoked", "on", "rootNode", "element", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java#L334-L343
151,711
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java
XMLContentHandler.startElementNode
private void startElementNode(final Attributes attributes) { LOG.debug("Found node"); try { this.nodeStack.push(this.newNode(this.nodeStack.peek(), attributes)); } catch (final RepositoryException e) { throw new AssertionError("Could not create node", e); } }
java
private void startElementNode(final Attributes attributes) { LOG.debug("Found node"); try { this.nodeStack.push(this.newNode(this.nodeStack.peek(), attributes)); } catch (final RepositoryException e) { throw new AssertionError("Could not create node", e); } }
[ "private", "void", "startElementNode", "(", "final", "Attributes", "attributes", ")", "{", "LOG", ".", "debug", "(", "\"Found node\"", ")", ";", "try", "{", "this", ".", "nodeStack", ".", "push", "(", "this", ".", "newNode", "(", "this", ".", "nodeStack", ".", "peek", "(", ")", ",", "attributes", ")", ")", ";", "}", "catch", "(", "final", "RepositoryException", "e", ")", "{", "throw", "new", "AssertionError", "(", "\"Could not create node\"", ",", "e", ")", ";", "}", "}" ]
Invoked on node element. @param attributes the DOM attributes of the node element @throws SAXException if the node for the new element can not be added
[ "Invoked", "on", "node", "element", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java#L354-L362
151,712
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java
XMLContentHandler.startElementMixin
private void startElementMixin(final Attributes attributes) { LOG.debug("Found mixin declaration"); try { this.addMixin(this.nodeStack.peek(), attributes); } catch (final RepositoryException e) { throw new AssertionError("Could not add mixin type", e); } }
java
private void startElementMixin(final Attributes attributes) { LOG.debug("Found mixin declaration"); try { this.addMixin(this.nodeStack.peek(), attributes); } catch (final RepositoryException e) { throw new AssertionError("Could not add mixin type", e); } }
[ "private", "void", "startElementMixin", "(", "final", "Attributes", "attributes", ")", "{", "LOG", ".", "debug", "(", "\"Found mixin declaration\"", ")", ";", "try", "{", "this", ".", "addMixin", "(", "this", ".", "nodeStack", ".", "peek", "(", ")", ",", "attributes", ")", ";", "}", "catch", "(", "final", "RepositoryException", "e", ")", "{", "throw", "new", "AssertionError", "(", "\"Could not add mixin type\"", ",", "e", ")", ";", "}", "}" ]
Invoked on mixin element. @param attributes the DOM attributes of the mixin element @throws SAXException if the mixin type can not be added
[ "Invoked", "on", "mixin", "element", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java#L373-L381
151,713
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java
WriteFileExtensions.storeByteArrayToFile
public static void storeByteArrayToFile(final byte[] data, final File file) throws IOException { try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos);) { bos.write(data); bos.flush(); } }
java
public static void storeByteArrayToFile(final byte[] data, final File file) throws IOException { try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos);) { bos.write(data); bos.flush(); } }
[ "public", "static", "void", "storeByteArrayToFile", "(", "final", "byte", "[", "]", "data", ",", "final", "File", "file", ")", "throws", "IOException", "{", "try", "(", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "file", ")", ";", "BufferedOutputStream", "bos", "=", "new", "BufferedOutputStream", "(", "fos", ")", ";", ")", "{", "bos", ".", "write", "(", "data", ")", ";", "bos", ".", "flush", "(", ")", ";", "}", "}" ]
Saves a byte array to the given file. @param data The byte array to be saved. @param file The file to save the byte array. @throws IOException Signals that an I/O exception has occurred.
[ "Saves", "a", "byte", "array", "to", "the", "given", "file", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L369-L377
151,714
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java
WriteFileExtensions.readSourceFileAndWriteDestFile
public static void readSourceFileAndWriteDestFile(final String srcfile, final String destFile) throws IOException { try (FileInputStream fis = new FileInputStream(srcfile); FileOutputStream fos = new FileOutputStream(destFile); BufferedInputStream bis = new BufferedInputStream(fis); BufferedOutputStream bos = new BufferedOutputStream(fos);) { final int availableLength = bis.available(); final byte[] totalBytes = new byte[availableLength]; bis.read(totalBytes, 0, availableLength); bos.write(totalBytes, 0, availableLength); } }
java
public static void readSourceFileAndWriteDestFile(final String srcfile, final String destFile) throws IOException { try (FileInputStream fis = new FileInputStream(srcfile); FileOutputStream fos = new FileOutputStream(destFile); BufferedInputStream bis = new BufferedInputStream(fis); BufferedOutputStream bos = new BufferedOutputStream(fos);) { final int availableLength = bis.available(); final byte[] totalBytes = new byte[availableLength]; bis.read(totalBytes, 0, availableLength); bos.write(totalBytes, 0, availableLength); } }
[ "public", "static", "void", "readSourceFileAndWriteDestFile", "(", "final", "String", "srcfile", ",", "final", "String", "destFile", ")", "throws", "IOException", "{", "try", "(", "FileInputStream", "fis", "=", "new", "FileInputStream", "(", "srcfile", ")", ";", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "destFile", ")", ";", "BufferedInputStream", "bis", "=", "new", "BufferedInputStream", "(", "fis", ")", ";", "BufferedOutputStream", "bos", "=", "new", "BufferedOutputStream", "(", "fos", ")", ";", ")", "{", "final", "int", "availableLength", "=", "bis", ".", "available", "(", ")", ";", "final", "byte", "[", "]", "totalBytes", "=", "new", "byte", "[", "availableLength", "]", ";", "bis", ".", "read", "(", "totalBytes", ",", "0", ",", "availableLength", ")", ";", "bos", ".", "write", "(", "totalBytes", ",", "0", ",", "availableLength", ")", ";", "}", "}" ]
Writes the source file with the best performance to the destination file. @param srcfile The source file. @param destFile The destination file. @throws IOException Signals that an I/O exception has occurred.
[ "Writes", "the", "source", "file", "with", "the", "best", "performance", "to", "the", "destination", "file", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L389-L402
151,715
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java
WriteFileExtensions.write
public static void write(final InputStream inputStream, final OutputStream outputStream) throws FileNotFoundException, IOException { int counter; final byte byteArray[] = new byte[FileConst.BLOCKSIZE]; while ((counter = inputStream.read(byteArray)) != -1) { outputStream.write(byteArray, 0, counter); } }
java
public static void write(final InputStream inputStream, final OutputStream outputStream) throws FileNotFoundException, IOException { int counter; final byte byteArray[] = new byte[FileConst.BLOCKSIZE]; while ((counter = inputStream.read(byteArray)) != -1) { outputStream.write(byteArray, 0, counter); } }
[ "public", "static", "void", "write", "(", "final", "InputStream", "inputStream", ",", "final", "OutputStream", "outputStream", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "int", "counter", ";", "final", "byte", "byteArray", "[", "]", "=", "new", "byte", "[", "FileConst", ".", "BLOCKSIZE", "]", ";", "while", "(", "(", "counter", "=", "inputStream", ".", "read", "(", "byteArray", ")", ")", "!=", "-", "1", ")", "{", "outputStream", ".", "write", "(", "byteArray", ",", "0", ",", "counter", ")", ";", "}", "}" ]
Writes the given input stream to the output stream. @param inputStream the input stream @param outputStream the output stream @throws FileNotFoundException the file not found exception @throws IOException Signals that an I/O exception has occurred.
[ "Writes", "the", "given", "input", "stream", "to", "the", "output", "stream", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L416-L425
151,716
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java
WriteFileExtensions.writeByteArrayToFile
public static void writeByteArrayToFile(final File file, final byte[] byteArray) throws IOException { try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos)) { bos.write(byteArray); } catch (final FileNotFoundException ex) { throw ex; } catch (final IOException ex) { throw ex; } }
java
public static void writeByteArrayToFile(final File file, final byte[] byteArray) throws IOException { try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos)) { bos.write(byteArray); } catch (final FileNotFoundException ex) { throw ex; } catch (final IOException ex) { throw ex; } }
[ "public", "static", "void", "writeByteArrayToFile", "(", "final", "File", "file", ",", "final", "byte", "[", "]", "byteArray", ")", "throws", "IOException", "{", "try", "(", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "file", ")", ";", "BufferedOutputStream", "bos", "=", "new", "BufferedOutputStream", "(", "fos", ")", ")", "{", "bos", ".", "write", "(", "byteArray", ")", ";", "}", "catch", "(", "final", "FileNotFoundException", "ex", ")", "{", "throw", "ex", ";", "}", "catch", "(", "final", "IOException", "ex", ")", "{", "throw", "ex", ";", "}", "}" ]
Writes the given byte array to the given file. @param file The file. @param byteArray The byte array. @throws IOException Signals that an I/O exception has occurred.
[ "Writes", "the", "given", "byte", "array", "to", "the", "given", "file", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L437-L453
151,717
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java
WriteFileExtensions.writeByteArrayToFile
public static void writeByteArrayToFile(final String filename, final byte[] byteArray) throws IOException { final File file = new File(filename); writeByteArrayToFile(file, byteArray); }
java
public static void writeByteArrayToFile(final String filename, final byte[] byteArray) throws IOException { final File file = new File(filename); writeByteArrayToFile(file, byteArray); }
[ "public", "static", "void", "writeByteArrayToFile", "(", "final", "String", "filename", ",", "final", "byte", "[", "]", "byteArray", ")", "throws", "IOException", "{", "final", "File", "file", "=", "new", "File", "(", "filename", ")", ";", "writeByteArrayToFile", "(", "file", ",", "byteArray", ")", ";", "}" ]
Writes the given byte array to a file. @param filename The filename from the file. @param byteArray The byte array. @throws IOException Signals that an I/O exception has occurred.
[ "Writes", "the", "given", "byte", "array", "to", "a", "file", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L465-L470
151,718
mbenson/therian
core/src/main/java/therian/operator/copy/BeanToMapCopier.java
BeanToMapCopier.supports
@Override public boolean supports(TherianContext context, Copy<? extends Object, ? extends Map> copy) { if (!super.supports(context, copy)) { return false; } final Type targetKeyType = getKeyType(copy.getTargetPosition()); final Position.ReadWrite<?> targetKey = Positions.readWrite(targetKeyType); return getProperties(context, copy.getSourcePosition()) .anyMatch(propertyName -> context.supports(Convert.to(targetKey, Positions.readOnly(propertyName)))); }
java
@Override public boolean supports(TherianContext context, Copy<? extends Object, ? extends Map> copy) { if (!super.supports(context, copy)) { return false; } final Type targetKeyType = getKeyType(copy.getTargetPosition()); final Position.ReadWrite<?> targetKey = Positions.readWrite(targetKeyType); return getProperties(context, copy.getSourcePosition()) .anyMatch(propertyName -> context.supports(Convert.to(targetKey, Positions.readOnly(propertyName)))); }
[ "@", "Override", "public", "boolean", "supports", "(", "TherianContext", "context", ",", "Copy", "<", "?", "extends", "Object", ",", "?", "extends", "Map", ">", "copy", ")", "{", "if", "(", "!", "super", ".", "supports", "(", "context", ",", "copy", ")", ")", "{", "return", "false", ";", "}", "final", "Type", "targetKeyType", "=", "getKeyType", "(", "copy", ".", "getTargetPosition", "(", ")", ")", ";", "final", "Position", ".", "ReadWrite", "<", "?", ">", "targetKey", "=", "Positions", ".", "readWrite", "(", "targetKeyType", ")", ";", "return", "getProperties", "(", "context", ",", "copy", ".", "getSourcePosition", "(", ")", ")", ".", "anyMatch", "(", "propertyName", "->", "context", ".", "supports", "(", "Convert", ".", "to", "(", "targetKey", ",", "Positions", ".", "readOnly", "(", "propertyName", ")", ")", ")", ")", ";", "}" ]
If at least one property name can be converted to an assignable key, say the operation is supported and we'll give it a shot.
[ "If", "at", "least", "one", "property", "name", "can", "be", "converted", "to", "an", "assignable", "key", "say", "the", "operation", "is", "supported", "and", "we", "ll", "give", "it", "a", "shot", "." ]
0653505f73e2a6f5b0abc394ea6d83af03408254
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/operator/copy/BeanToMapCopier.java#L84-L94
151,719
opendatatrentino/smatch-webapi-client
src/main/java/it/unitn/disi/smatch/webapi/client/methods/MatchMethods.java
MatchMethods.generateJSONRequest
public JSONObject generateJSONRequest(String sourceName, List<String> sourceNodes, String targetName, List<String> targetNodes) throws JSONException { Context sourceContext = new Context("SourceContext", sourceName, sourceNodes); Context targetContext = new Context("TargetContext", targetName, targetNodes); JSONObject jRequest = new JSONObject(); JSONObject jContexts = new JSONObject(); JSONArray jContextList = new JSONArray(); JSONObject jsourceContext = sourceContext.toJsonObject(); JSONObject jtargetContext = targetContext.toJsonObject(); jContextList.put(jsourceContext); jContextList.put(jtargetContext); jContexts.put("Contexts", jContextList); jRequest.put("parameters", jContexts); return jRequest; }
java
public JSONObject generateJSONRequest(String sourceName, List<String> sourceNodes, String targetName, List<String> targetNodes) throws JSONException { Context sourceContext = new Context("SourceContext", sourceName, sourceNodes); Context targetContext = new Context("TargetContext", targetName, targetNodes); JSONObject jRequest = new JSONObject(); JSONObject jContexts = new JSONObject(); JSONArray jContextList = new JSONArray(); JSONObject jsourceContext = sourceContext.toJsonObject(); JSONObject jtargetContext = targetContext.toJsonObject(); jContextList.put(jsourceContext); jContextList.put(jtargetContext); jContexts.put("Contexts", jContextList); jRequest.put("parameters", jContexts); return jRequest; }
[ "public", "JSONObject", "generateJSONRequest", "(", "String", "sourceName", ",", "List", "<", "String", ">", "sourceNodes", ",", "String", "targetName", ",", "List", "<", "String", ">", "targetNodes", ")", "throws", "JSONException", "{", "Context", "sourceContext", "=", "new", "Context", "(", "\"SourceContext\"", ",", "sourceName", ",", "sourceNodes", ")", ";", "Context", "targetContext", "=", "new", "Context", "(", "\"TargetContext\"", ",", "targetName", ",", "targetNodes", ")", ";", "JSONObject", "jRequest", "=", "new", "JSONObject", "(", ")", ";", "JSONObject", "jContexts", "=", "new", "JSONObject", "(", ")", ";", "JSONArray", "jContextList", "=", "new", "JSONArray", "(", ")", ";", "JSONObject", "jsourceContext", "=", "sourceContext", ".", "toJsonObject", "(", ")", ";", "JSONObject", "jtargetContext", "=", "targetContext", ".", "toJsonObject", "(", ")", ";", "jContextList", ".", "put", "(", "jsourceContext", ")", ";", "jContextList", ".", "put", "(", "jtargetContext", ")", ";", "jContexts", ".", "put", "(", "\"Contexts\"", ",", "jContextList", ")", ";", "jRequest", ".", "put", "(", "\"parameters\"", ",", "jContexts", ")", ";", "return", "jRequest", ";", "}" ]
Generates JSON request from input parameters @param sourceName - The name of the root node in the source tree @param sourceNodes - Names of the source nodes under the source root node @param targetName - The name of the root node in the target tree @param targetNodes -Names of the target nodes under the target root node @return JSON request to S-Match Web API Server @throws JSONException
[ "Generates", "JSON", "request", "from", "input", "parameters" ]
d74fc41ab5bdc29afafd11c9001ac25dff20f965
https://github.com/opendatatrentino/smatch-webapi-client/blob/d74fc41ab5bdc29afafd11c9001ac25dff20f965/src/main/java/it/unitn/disi/smatch/webapi/client/methods/MatchMethods.java#L89-L110
151,720
opendatatrentino/smatch-webapi-client
src/main/java/it/unitn/disi/smatch/webapi/client/methods/MatchMethods.java
MatchMethods.convert
public Correspondence convert(JSONObject jResponse) throws JSONException { Correspondence correspondence = null; if (jResponse.getJSONObject("response").has("Correspondence")) { JSONObject jResponseItem = jResponse.getJSONObject("response"); JSONArray jcorrespondenceItems = jResponseItem.getJSONArray("Correspondence"); List<CorrespondenceItem> correspondenceItems = new ArrayList<CorrespondenceItem>(); for (int i = 0; i < jcorrespondenceItems.length(); i++) { JSONObject jCorrespondenceItem = jcorrespondenceItems.getJSONObject(i); String relation = jCorrespondenceItem.optString("Relation"); String source = jCorrespondenceItem.optString("Source"); String target = jCorrespondenceItem.optString("Target"); char cRelation = relation.charAt(0); try { correspondenceItems.add(new CorrespondenceItem(source, target, cRelation)); } catch (UnknownRelationException ex) { Logger.getLogger(MatchMethods.class.getName()).log(Level.SEVERE, null, ex); } } correspondence = new Correspondence(correspondenceItems); } return correspondence; }
java
public Correspondence convert(JSONObject jResponse) throws JSONException { Correspondence correspondence = null; if (jResponse.getJSONObject("response").has("Correspondence")) { JSONObject jResponseItem = jResponse.getJSONObject("response"); JSONArray jcorrespondenceItems = jResponseItem.getJSONArray("Correspondence"); List<CorrespondenceItem> correspondenceItems = new ArrayList<CorrespondenceItem>(); for (int i = 0; i < jcorrespondenceItems.length(); i++) { JSONObject jCorrespondenceItem = jcorrespondenceItems.getJSONObject(i); String relation = jCorrespondenceItem.optString("Relation"); String source = jCorrespondenceItem.optString("Source"); String target = jCorrespondenceItem.optString("Target"); char cRelation = relation.charAt(0); try { correspondenceItems.add(new CorrespondenceItem(source, target, cRelation)); } catch (UnknownRelationException ex) { Logger.getLogger(MatchMethods.class.getName()).log(Level.SEVERE, null, ex); } } correspondence = new Correspondence(correspondenceItems); } return correspondence; }
[ "public", "Correspondence", "convert", "(", "JSONObject", "jResponse", ")", "throws", "JSONException", "{", "Correspondence", "correspondence", "=", "null", ";", "if", "(", "jResponse", ".", "getJSONObject", "(", "\"response\"", ")", ".", "has", "(", "\"Correspondence\"", ")", ")", "{", "JSONObject", "jResponseItem", "=", "jResponse", ".", "getJSONObject", "(", "\"response\"", ")", ";", "JSONArray", "jcorrespondenceItems", "=", "jResponseItem", ".", "getJSONArray", "(", "\"Correspondence\"", ")", ";", "List", "<", "CorrespondenceItem", ">", "correspondenceItems", "=", "new", "ArrayList", "<", "CorrespondenceItem", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "jcorrespondenceItems", ".", "length", "(", ")", ";", "i", "++", ")", "{", "JSONObject", "jCorrespondenceItem", "=", "jcorrespondenceItems", ".", "getJSONObject", "(", "i", ")", ";", "String", "relation", "=", "jCorrespondenceItem", ".", "optString", "(", "\"Relation\"", ")", ";", "String", "source", "=", "jCorrespondenceItem", ".", "optString", "(", "\"Source\"", ")", ";", "String", "target", "=", "jCorrespondenceItem", ".", "optString", "(", "\"Target\"", ")", ";", "char", "cRelation", "=", "relation", ".", "charAt", "(", "0", ")", ";", "try", "{", "correspondenceItems", ".", "add", "(", "new", "CorrespondenceItem", "(", "source", ",", "target", ",", "cRelation", ")", ")", ";", "}", "catch", "(", "UnknownRelationException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "MatchMethods", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "}", "correspondence", "=", "new", "Correspondence", "(", "correspondenceItems", ")", ";", "}", "return", "correspondence", ";", "}" ]
Converts from JSON Correspondence to Java Correspondence @param jResponse The JSON response with Correspondence @return the Correspondence Java object @throws JSONException
[ "Converts", "from", "JSON", "Correspondence", "to", "Java", "Correspondence" ]
d74fc41ab5bdc29afafd11c9001ac25dff20f965
https://github.com/opendatatrentino/smatch-webapi-client/blob/d74fc41ab5bdc29afafd11c9001ac25dff20f965/src/main/java/it/unitn/disi/smatch/webapi/client/methods/MatchMethods.java#L119-L147
151,721
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageSender.java
RemoteMessageSender.init
public void init(RemoteTask server, BaseMessageQueue baseMessageQueue) throws RemoteException { super.init(baseMessageQueue); m_sendQueue = server.createRemoteSendQueue(baseMessageQueue.getQueueName(), baseMessageQueue.getQueueType()); }
java
public void init(RemoteTask server, BaseMessageQueue baseMessageQueue) throws RemoteException { super.init(baseMessageQueue); m_sendQueue = server.createRemoteSendQueue(baseMessageQueue.getQueueName(), baseMessageQueue.getQueueType()); }
[ "public", "void", "init", "(", "RemoteTask", "server", ",", "BaseMessageQueue", "baseMessageQueue", ")", "throws", "RemoteException", "{", "super", ".", "init", "(", "baseMessageQueue", ")", ";", "m_sendQueue", "=", "server", ".", "createRemoteSendQueue", "(", "baseMessageQueue", ".", "getQueueName", "(", ")", ",", "baseMessageQueue", ".", "getQueueType", "(", ")", ")", ";", "}" ]
Creates new MessageSender. @param server The remote server. @param baseMessageQueue My parent message queue.
[ "Creates", "new", "MessageSender", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageSender.java#L55-L60
151,722
OwlPlatform/java-owl-solver
src/main/java/com/owlplatform/solver/rules/SubscriptionRequestRule.java
SubscriptionRequestRule.setTransmitters
public void setTransmitters(Collection<Transmitter> transmitters) { if (transmitters == null) { this.transmitters = null; return; } int size = transmitters.size(); if (size == 0) { this.transmitters = null; return; } this.transmitters = transmitters.toArray(new Transmitter[] {}); }
java
public void setTransmitters(Collection<Transmitter> transmitters) { if (transmitters == null) { this.transmitters = null; return; } int size = transmitters.size(); if (size == 0) { this.transmitters = null; return; } this.transmitters = transmitters.toArray(new Transmitter[] {}); }
[ "public", "void", "setTransmitters", "(", "Collection", "<", "Transmitter", ">", "transmitters", ")", "{", "if", "(", "transmitters", "==", "null", ")", "{", "this", ".", "transmitters", "=", "null", ";", "return", ";", "}", "int", "size", "=", "transmitters", ".", "size", "(", ")", ";", "if", "(", "size", "==", "0", ")", "{", "this", ".", "transmitters", "=", "null", ";", "return", ";", "}", "this", ".", "transmitters", "=", "transmitters", ".", "toArray", "(", "new", "Transmitter", "[", "]", "{", "}", ")", ";", "}" ]
Sets the transmitters for this rule. Any previous values are discarded. @param transmitters the new transmitters.
[ "Sets", "the", "transmitters", "for", "this", "rule", ".", "Any", "previous", "values", "are", "discarded", "." ]
53a1faabd63613c716203922cd52f871e5fedb9b
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/rules/SubscriptionRequestRule.java#L114-L126
151,723
marssa/footprint
src/main/java/org/marssa/footprint/datatypes/decimal/electrical/charge/ACharge.java
ACharge.getAh
public MDecimal getAh() { MDecimal result = new MDecimal(currentUnit.getConverterTo(AMPERE_HOUR) .convert(doubleValue())); logger.trace(MMarker.GETTER, "Converting from {} to Ampere hours : {}", currentUnit, result); return result; }
java
public MDecimal getAh() { MDecimal result = new MDecimal(currentUnit.getConverterTo(AMPERE_HOUR) .convert(doubleValue())); logger.trace(MMarker.GETTER, "Converting from {} to Ampere hours : {}", currentUnit, result); return result; }
[ "public", "MDecimal", "getAh", "(", ")", "{", "MDecimal", "result", "=", "new", "MDecimal", "(", "currentUnit", ".", "getConverterTo", "(", "AMPERE_HOUR", ")", ".", "convert", "(", "doubleValue", "(", ")", ")", ")", ";", "logger", ".", "trace", "(", "MMarker", ".", "GETTER", ",", "\"Converting from {} to Ampere hours : {}\"", ",", "currentUnit", ",", "result", ")", ";", "return", "result", ";", "}" ]
Ampere-hours @return
[ "Ampere", "-", "hours" ]
2ca953c14f46adc320927c87c5ce1c36eb6c82de
https://github.com/marssa/footprint/blob/2ca953c14f46adc320927c87c5ce1c36eb6c82de/src/main/java/org/marssa/footprint/datatypes/decimal/electrical/charge/ACharge.java#L88-L94
151,724
marssa/footprint
src/main/java/org/marssa/footprint/datatypes/decimal/electrical/charge/ACharge.java
ACharge.getmAh
public MDecimal getmAh() { MDecimal result = new MDecimal(currentUnit.getConverterTo( MILLI_AMPERE_HOUR).convert(doubleValue())); logger.trace(MMarker.GETTER, "Converting from {} to milli Ampere hours : {}", currentUnit, result); return result; }
java
public MDecimal getmAh() { MDecimal result = new MDecimal(currentUnit.getConverterTo( MILLI_AMPERE_HOUR).convert(doubleValue())); logger.trace(MMarker.GETTER, "Converting from {} to milli Ampere hours : {}", currentUnit, result); return result; }
[ "public", "MDecimal", "getmAh", "(", ")", "{", "MDecimal", "result", "=", "new", "MDecimal", "(", "currentUnit", ".", "getConverterTo", "(", "MILLI_AMPERE_HOUR", ")", ".", "convert", "(", "doubleValue", "(", ")", ")", ")", ";", "logger", ".", "trace", "(", "MMarker", ".", "GETTER", ",", "\"Converting from {} to milli Ampere hours : {}\"", ",", "currentUnit", ",", "result", ")", ";", "return", "result", ";", "}" ]
Milli Ampere-hours @return
[ "Milli", "Ampere", "-", "hours" ]
2ca953c14f46adc320927c87c5ce1c36eb6c82de
https://github.com/marssa/footprint/blob/2ca953c14f46adc320927c87c5ce1c36eb6c82de/src/main/java/org/marssa/footprint/datatypes/decimal/electrical/charge/ACharge.java#L101-L108
151,725
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/StickyValueHandler.java
StickyValueHandler.setOwner
public void setOwner(ListenerOwner owner) { if (owner == null) { this.saveValue(m_recordOwnerCache); m_recordOwnerCache = null; } super.setOwner(owner); if (owner != null) this.retrieveValue(); }
java
public void setOwner(ListenerOwner owner) { if (owner == null) { this.saveValue(m_recordOwnerCache); m_recordOwnerCache = null; } super.setOwner(owner); if (owner != null) this.retrieveValue(); }
[ "public", "void", "setOwner", "(", "ListenerOwner", "owner", ")", "{", "if", "(", "owner", "==", "null", ")", "{", "this", ".", "saveValue", "(", "m_recordOwnerCache", ")", ";", "m_recordOwnerCache", "=", "null", ";", "}", "super", ".", "setOwner", "(", "owner", ")", ";", "if", "(", "owner", "!=", "null", ")", "this", ".", "retrieveValue", "(", ")", ";", "}" ]
Set the field that owns this handler. @param owner The field this listener was added to (or null if being removed).
[ "Set", "the", "field", "that", "owns", "this", "handler", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/StickyValueHandler.java#L70-L80
151,726
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/StickyValueHandler.java
StickyValueHandler.saveValue
public void saveValue(ComponentParent recordOwner) { if (recordOwner != null) { BaseField field = this.getOwner(); String strCommand = ((ComponentParent)recordOwner).getParentScreen().popHistory(1, false); if (m_recordOwnerCache != null) if (strCommand != null) if (strCommand.indexOf(m_recordOwnerCache.getClass().getName()) != -1) { // Yes this is the command to open this window Map<String,Object> properties = new Hashtable<String,Object>(); Util.parseArgs(properties, strCommand); properties.put(field.getFieldName(), field.toString()); strCommand = Utility.propertiesToURL(null, properties); } ((ComponentParent)recordOwner).getParentScreen().pushHistory(strCommand, false); } }
java
public void saveValue(ComponentParent recordOwner) { if (recordOwner != null) { BaseField field = this.getOwner(); String strCommand = ((ComponentParent)recordOwner).getParentScreen().popHistory(1, false); if (m_recordOwnerCache != null) if (strCommand != null) if (strCommand.indexOf(m_recordOwnerCache.getClass().getName()) != -1) { // Yes this is the command to open this window Map<String,Object> properties = new Hashtable<String,Object>(); Util.parseArgs(properties, strCommand); properties.put(field.getFieldName(), field.toString()); strCommand = Utility.propertiesToURL(null, properties); } ((ComponentParent)recordOwner).getParentScreen().pushHistory(strCommand, false); } }
[ "public", "void", "saveValue", "(", "ComponentParent", "recordOwner", ")", "{", "if", "(", "recordOwner", "!=", "null", ")", "{", "BaseField", "field", "=", "this", ".", "getOwner", "(", ")", ";", "String", "strCommand", "=", "(", "(", "ComponentParent", ")", "recordOwner", ")", ".", "getParentScreen", "(", ")", ".", "popHistory", "(", "1", ",", "false", ")", ";", "if", "(", "m_recordOwnerCache", "!=", "null", ")", "if", "(", "strCommand", "!=", "null", ")", "if", "(", "strCommand", ".", "indexOf", "(", "m_recordOwnerCache", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", "!=", "-", "1", ")", "{", "// Yes this is the command to open this window", "Map", "<", "String", ",", "Object", ">", "properties", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "Util", ".", "parseArgs", "(", "properties", ",", "strCommand", ")", ";", "properties", ".", "put", "(", "field", ".", "getFieldName", "(", ")", ",", "field", ".", "toString", "(", ")", ")", ";", "strCommand", "=", "Utility", ".", "propertiesToURL", "(", "null", ",", "properties", ")", ";", "}", "(", "(", "ComponentParent", ")", "recordOwner", ")", ".", "getParentScreen", "(", ")", ".", "pushHistory", "(", "strCommand", ",", "false", ")", ";", "}", "}" ]
Save the current value of this field to the registration database. and change the URL on the push-down stack to take this into consideration.
[ "Save", "the", "current", "value", "of", "this", "field", "to", "the", "registration", "database", ".", "and", "change", "the", "URL", "on", "the", "push", "-", "down", "stack", "to", "take", "this", "into", "consideration", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/StickyValueHandler.java#L142-L159
151,727
StefanLiebenberg/kute
kute-core/src/main/java/slieb/kute/KuteIO.java
KuteIO.copyProviderToCreator
public void copyProviderToCreator(Resource.Provider provider, Resource.Creator creator) { provider.stream().forEach((ConsumerWithThrowable<Resource.Readable, IOException>) resource -> copyResourceWithStreams(resource, creator.create(resource.getPath()))); }
java
public void copyProviderToCreator(Resource.Provider provider, Resource.Creator creator) { provider.stream().forEach((ConsumerWithThrowable<Resource.Readable, IOException>) resource -> copyResourceWithStreams(resource, creator.create(resource.getPath()))); }
[ "public", "void", "copyProviderToCreator", "(", "Resource", ".", "Provider", "provider", ",", "Resource", ".", "Creator", "creator", ")", "{", "provider", ".", "stream", "(", ")", ".", "forEach", "(", "(", "ConsumerWithThrowable", "<", "Resource", ".", "Readable", ",", "IOException", ">", ")", "resource", "->", "copyResourceWithStreams", "(", "resource", ",", "creator", ".", "create", "(", "resource", ".", "getPath", "(", ")", ")", ")", ")", ";", "}" ]
Copy all resource in provider over to some creator. @param provider The resource provider, or source location. @param creator The resource creator, or destination location.
[ "Copy", "all", "resource", "in", "provider", "over", "to", "some", "creator", "." ]
1db0e8d2c76459d22c7d4b0ba99c18f74748f6fd
https://github.com/StefanLiebenberg/kute/blob/1db0e8d2c76459d22c7d4b0ba99c18f74748f6fd/kute-core/src/main/java/slieb/kute/KuteIO.java#L46-L50
151,728
StefanLiebenberg/kute
kute-core/src/main/java/slieb/kute/KuteIO.java
KuteIO.writeResource
public static void writeResource(final Resource.Writable resource, final CharSequence content) throws IOException { resource.useWriter(writer -> IOUtils.write(content.toString(), writer)); }
java
public static void writeResource(final Resource.Writable resource, final CharSequence content) throws IOException { resource.useWriter(writer -> IOUtils.write(content.toString(), writer)); }
[ "public", "static", "void", "writeResource", "(", "final", "Resource", ".", "Writable", "resource", ",", "final", "CharSequence", "content", ")", "throws", "IOException", "{", "resource", ".", "useWriter", "(", "writer", "->", "IOUtils", ".", "write", "(", "content", ".", "toString", "(", ")", ",", "writer", ")", ")", ";", "}" ]
Write content to a Writable Resource. @param resource a writable resource instance. @param content The content that will be writen to the resource. @throws IOException a IOException can occur during the write process.
[ "Write", "content", "to", "a", "Writable", "Resource", "." ]
1db0e8d2c76459d22c7d4b0ba99c18f74748f6fd
https://github.com/StefanLiebenberg/kute/blob/1db0e8d2c76459d22c7d4b0ba99c18f74748f6fd/kute-core/src/main/java/slieb/kute/KuteIO.java#L94-L97
151,729
StefanLiebenberg/kute
kute-core/src/main/java/slieb/kute/KuteIO.java
KuteIO.copyResource
public static void copyResource(Resource.Readable readable, Resource.Writable writable) throws IOException { readable.useReader(reader -> writable.useWriter(writer -> IOUtils.copy(reader, writer))); }
java
public static void copyResource(Resource.Readable readable, Resource.Writable writable) throws IOException { readable.useReader(reader -> writable.useWriter(writer -> IOUtils.copy(reader, writer))); }
[ "public", "static", "void", "copyResource", "(", "Resource", ".", "Readable", "readable", ",", "Resource", ".", "Writable", "writable", ")", "throws", "IOException", "{", "readable", ".", "useReader", "(", "reader", "->", "writable", ".", "useWriter", "(", "writer", "->", "IOUtils", ".", "copy", "(", "reader", ",", "writer", ")", ")", ")", ";", "}" ]
Copy the content of one resources to another. @param readable A readable resource instance. @param writable A writable resource instance. @throws IOException A io exception can occur during the copy process.
[ "Copy", "the", "content", "of", "one", "resources", "to", "another", "." ]
1db0e8d2c76459d22c7d4b0ba99c18f74748f6fd
https://github.com/StefanLiebenberg/kute/blob/1db0e8d2c76459d22c7d4b0ba99c18f74748f6fd/kute-core/src/main/java/slieb/kute/KuteIO.java#L118-L121
151,730
js-lib-com/commons
src/main/java/js/log/AbstractLog.java
AbstractLog.message
protected static String message(Object message) { if(message == null) { return null; } if(!(message instanceof Throwable)) { return message.toString(); } Throwable t = (Throwable)message; if(t.getCause() == null) { return t.toString(); } int nestingLevel = 0; StringBuilder sb = new StringBuilder(); for(;;) { sb.append(t.getClass().getName()); sb.append(":"); sb.append(" "); if(++nestingLevel == 8) { sb.append("..."); break; } if(t.getCause() == null) { String s = t.getMessage(); if(s == null) { t.getClass().getCanonicalName(); } sb.append(s); break; } t = t.getCause(); } return sb.toString(); }
java
protected static String message(Object message) { if(message == null) { return null; } if(!(message instanceof Throwable)) { return message.toString(); } Throwable t = (Throwable)message; if(t.getCause() == null) { return t.toString(); } int nestingLevel = 0; StringBuilder sb = new StringBuilder(); for(;;) { sb.append(t.getClass().getName()); sb.append(":"); sb.append(" "); if(++nestingLevel == 8) { sb.append("..."); break; } if(t.getCause() == null) { String s = t.getMessage(); if(s == null) { t.getClass().getCanonicalName(); } sb.append(s); break; } t = t.getCause(); } return sb.toString(); }
[ "protected", "static", "String", "message", "(", "Object", "message", ")", "{", "if", "(", "message", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "!", "(", "message", "instanceof", "Throwable", ")", ")", "{", "return", "message", ".", "toString", "(", ")", ";", "}", "Throwable", "t", "=", "(", "Throwable", ")", "message", ";", "if", "(", "t", ".", "getCause", "(", ")", "==", "null", ")", "{", "return", "t", ".", "toString", "(", ")", ";", "}", "int", "nestingLevel", "=", "0", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", ";", ";", ")", "{", "sb", ".", "append", "(", "t", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "sb", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "\" \"", ")", ";", "if", "(", "++", "nestingLevel", "==", "8", ")", "{", "sb", ".", "append", "(", "\"...\"", ")", ";", "break", ";", "}", "if", "(", "t", ".", "getCause", "(", ")", "==", "null", ")", "{", "String", "s", "=", "t", ".", "getMessage", "(", ")", ";", "if", "(", "s", "==", "null", ")", "{", "t", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ";", "}", "sb", ".", "append", "(", "s", ")", ";", "break", ";", "}", "t", "=", "t", ".", "getCause", "(", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Normalize log message. This method returns message to string; if message is a Throwable and has not null cause returns cause hierarchy formed from cause class name. @param message log message. @return normalized log message or null.
[ "Normalize", "log", "message", ".", "This", "method", "returns", "message", "to", "string", ";", "if", "message", "is", "a", "Throwable", "and", "has", "not", "null", "cause", "returns", "cause", "hierarchy", "formed", "from", "cause", "class", "name", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/log/AbstractLog.java#L161-L196
151,731
js-lib-com/commons
src/main/java/js/log/AbstractLog.java
AbstractLog.isArrayLike
private static boolean isArrayLike(Object object) { return object != null && (object.getClass().isArray() || object instanceof Collection); }
java
private static boolean isArrayLike(Object object) { return object != null && (object.getClass().isArray() || object instanceof Collection); }
[ "private", "static", "boolean", "isArrayLike", "(", "Object", "object", ")", "{", "return", "object", "!=", "null", "&&", "(", "object", ".", "getClass", "(", ")", ".", "isArray", "(", ")", "||", "object", "instanceof", "Collection", ")", ";", "}" ]
An object is array like if is an actual array or a collection. @param object object to test if array like. @return true if <code>object</code> argument is array like.
[ "An", "object", "is", "array", "like", "if", "is", "an", "actual", "array", "or", "a", "collection", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/log/AbstractLog.java#L318-L321
151,732
tvesalainen/util
util/src/main/java/org/vesalainen/util/EnumSetFlagger.java
EnumSetFlagger.getSet
public static <E extends Enum<E>> EnumSet<E> getSet(Class<E> elementType, int flag) { EnumSet<E> set = EnumSet.noneOf(elementType); E[] enumConstants = elementType.getEnumConstants(); if (enumConstants.length > Integer.SIZE) { throw new IllegalArgumentException(elementType+" contains too many enums for int"); } for (int ii=0;ii<enumConstants.length;ii++) { if ((flag & (1<<ii)) != 0) { set.add(enumConstants[ii]); } } return set; }
java
public static <E extends Enum<E>> EnumSet<E> getSet(Class<E> elementType, int flag) { EnumSet<E> set = EnumSet.noneOf(elementType); E[] enumConstants = elementType.getEnumConstants(); if (enumConstants.length > Integer.SIZE) { throw new IllegalArgumentException(elementType+" contains too many enums for int"); } for (int ii=0;ii<enumConstants.length;ii++) { if ((flag & (1<<ii)) != 0) { set.add(enumConstants[ii]); } } return set; }
[ "public", "static", "<", "E", "extends", "Enum", "<", "E", ">", ">", "EnumSet", "<", "E", ">", "getSet", "(", "Class", "<", "E", ">", "elementType", ",", "int", "flag", ")", "{", "EnumSet", "<", "E", ">", "set", "=", "EnumSet", ".", "noneOf", "(", "elementType", ")", ";", "E", "[", "]", "enumConstants", "=", "elementType", ".", "getEnumConstants", "(", ")", ";", "if", "(", "enumConstants", ".", "length", ">", "Integer", ".", "SIZE", ")", "{", "throw", "new", "IllegalArgumentException", "(", "elementType", "+", "\" contains too many enums for int\"", ")", ";", "}", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "enumConstants", ".", "length", ";", "ii", "++", ")", "{", "if", "(", "(", "flag", "&", "(", "1", "<<", "ii", ")", ")", "!=", "0", ")", "{", "set", ".", "add", "(", "enumConstants", "[", "ii", "]", ")", ";", "}", "}", "return", "set", ";", "}" ]
Returns EnumSet constructed from bit flag. Bit flags bit position is according to Enum ordinal. <p>Throws IllegalArgumentException if enum contains too many values to fit flag. @param <E> @param elementType @param flag @return
[ "Returns", "EnumSet", "constructed", "from", "bit", "flag", ".", "Bit", "flags", "bit", "position", "is", "according", "to", "Enum", "ordinal", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/EnumSetFlagger.java#L86-L102
151,733
hdecarne/java-default
src/main/java/de/carne/util/Debug.java
Debug.getCaller
public static String getCaller() { StackTraceElement[] stes = new Exception().getStackTrace(); String caller; if (stes.length > 2) { StackTraceElement callerSte = stes[2]; caller = callerSte.getClassName() + "." + callerSte.getMethodName(); } else { caller = "<unknown>"; } return caller; }
java
public static String getCaller() { StackTraceElement[] stes = new Exception().getStackTrace(); String caller; if (stes.length > 2) { StackTraceElement callerSte = stes[2]; caller = callerSte.getClassName() + "." + callerSte.getMethodName(); } else { caller = "<unknown>"; } return caller; }
[ "public", "static", "String", "getCaller", "(", ")", "{", "StackTraceElement", "[", "]", "stes", "=", "new", "Exception", "(", ")", ".", "getStackTrace", "(", ")", ";", "String", "caller", ";", "if", "(", "stes", ".", "length", ">", "2", ")", "{", "StackTraceElement", "callerSte", "=", "stes", "[", "2", "]", ";", "caller", "=", "callerSte", ".", "getClassName", "(", ")", "+", "\".\"", "+", "callerSte", ".", "getMethodName", "(", ")", ";", "}", "else", "{", "caller", "=", "\"<unknown>\"", ";", "}", "return", "caller", ";", "}" ]
Gets the calling method's name. @return the calling method's name.
[ "Gets", "the", "calling", "method", "s", "name", "." ]
ca16f6fdb0436e90e9e2df3106055e320bb3c9e3
https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/Debug.java#L35-L47
151,734
hdecarne/java-default
src/main/java/de/carne/util/Debug.java
Debug.formatUsedMemory
public static String formatUsedMemory() { Runtime runtime = Runtime.getRuntime(); long usedMemory = Math.max(0, runtime.totalMemory() - runtime.freeMemory()); return MemoryUnitFormat.getMemoryUnitInstance().format(usedMemory); }
java
public static String formatUsedMemory() { Runtime runtime = Runtime.getRuntime(); long usedMemory = Math.max(0, runtime.totalMemory() - runtime.freeMemory()); return MemoryUnitFormat.getMemoryUnitInstance().format(usedMemory); }
[ "public", "static", "String", "formatUsedMemory", "(", ")", "{", "Runtime", "runtime", "=", "Runtime", ".", "getRuntime", "(", ")", ";", "long", "usedMemory", "=", "Math", ".", "max", "(", "0", ",", "runtime", ".", "totalMemory", "(", ")", "-", "runtime", ".", "freeMemory", "(", ")", ")", ";", "return", "MemoryUnitFormat", ".", "getMemoryUnitInstance", "(", ")", ".", "format", "(", "usedMemory", ")", ";", "}" ]
Formats the currently used memory in human readable format. @return the currently used memory in human readable format.
[ "Formats", "the", "currently", "used", "memory", "in", "human", "readable", "format", "." ]
ca16f6fdb0436e90e9e2df3106055e320bb3c9e3
https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/Debug.java#L54-L59
151,735
caspervg/SC4D-LEX4J
lex4j/src/main/java/net/caspervg/lex4j/log/LEX4JLogger.java
LEX4JLogger.log
public static void log(Level level, String message) { Logger.getLogger("LEX4J").log(level, message); }
java
public static void log(Level level, String message) { Logger.getLogger("LEX4J").log(level, message); }
[ "public", "static", "void", "log", "(", "Level", "level", ",", "String", "message", ")", "{", "Logger", ".", "getLogger", "(", "\"LEX4J\"", ")", ".", "log", "(", "level", ",", "message", ")", ";", "}" ]
Convenience method for logging within the LEX4J library @param level Level of the log message @param message Log message
[ "Convenience", "method", "for", "logging", "within", "the", "LEX4J", "library" ]
3d086ec70c817119a88573c2e23af27276cdb1d6
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/log/LEX4JLogger.java#L17-L19
151,736
tvesalainen/util
util/src/main/java/org/vesalainen/math/sliding/AbstractSlidingAverage.java
AbstractSlidingAverage.accept
@Override public void accept(double value) { writeLock.lock(); try { eliminate(); int count = count(); if (count >= size) { grow(); } assign(endMod(), value); endIncr(); } finally { writeLock.unlock(); } }
java
@Override public void accept(double value) { writeLock.lock(); try { eliminate(); int count = count(); if (count >= size) { grow(); } assign(endMod(), value); endIncr(); } finally { writeLock.unlock(); } }
[ "@", "Override", "public", "void", "accept", "(", "double", "value", ")", "{", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "eliminate", "(", ")", ";", "int", "count", "=", "count", "(", ")", ";", "if", "(", "count", ">=", "size", ")", "{", "grow", "(", ")", ";", "}", "assign", "(", "endMod", "(", ")", ",", "value", ")", ";", "endIncr", "(", ")", ";", "}", "finally", "{", "writeLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Adds new value to sliding average @param value
[ "Adds", "new", "value", "to", "sliding", "average" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/sliding/AbstractSlidingAverage.java#L43-L62
151,737
tvesalainen/util
util/src/main/java/org/vesalainen/math/sliding/AbstractSlidingAverage.java
AbstractSlidingAverage.average
@Override public double average() { readLock.lock(); try { double s = 0; PrimitiveIterator.OfInt it = modIterator(); while (it.hasNext()) { s += ring[it.nextInt()]; } return s/(count()); } finally { readLock.unlock(); } }
java
@Override public double average() { readLock.lock(); try { double s = 0; PrimitiveIterator.OfInt it = modIterator(); while (it.hasNext()) { s += ring[it.nextInt()]; } return s/(count()); } finally { readLock.unlock(); } }
[ "@", "Override", "public", "double", "average", "(", ")", "{", "readLock", ".", "lock", "(", ")", ";", "try", "{", "double", "s", "=", "0", ";", "PrimitiveIterator", ".", "OfInt", "it", "=", "modIterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "s", "+=", "ring", "[", "it", ".", "nextInt", "(", ")", "]", ";", "}", "return", "s", "/", "(", "count", "(", ")", ")", ";", "}", "finally", "{", "readLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Returns average by calculating cell by cell @return
[ "Returns", "average", "by", "calculating", "cell", "by", "cell" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/sliding/AbstractSlidingAverage.java#L99-L117
151,738
inkstand-io/scribble
scribble-file/src/main/java/io/inkstand/scribble/rules/TemporaryFile.java
TemporaryFile.createTempFile
protected File createTempFile() throws IOException { final File tempFile = newFile(); if (forceContent && contentUrl == null) { throw new AssertionError("ContentUrl is not set"); } else if (contentUrl == null) { createEmptyFile(tempFile); } else { try (InputStream inputStream = contentUrl.openStream()) { Files.copy(inputStream, tempFile.toPath()); } } return tempFile; }
java
protected File createTempFile() throws IOException { final File tempFile = newFile(); if (forceContent && contentUrl == null) { throw new AssertionError("ContentUrl is not set"); } else if (contentUrl == null) { createEmptyFile(tempFile); } else { try (InputStream inputStream = contentUrl.openStream()) { Files.copy(inputStream, tempFile.toPath()); } } return tempFile; }
[ "protected", "File", "createTempFile", "(", ")", "throws", "IOException", "{", "final", "File", "tempFile", "=", "newFile", "(", ")", ";", "if", "(", "forceContent", "&&", "contentUrl", "==", "null", ")", "{", "throw", "new", "AssertionError", "(", "\"ContentUrl is not set\"", ")", ";", "}", "else", "if", "(", "contentUrl", "==", "null", ")", "{", "createEmptyFile", "(", "tempFile", ")", ";", "}", "else", "{", "try", "(", "InputStream", "inputStream", "=", "contentUrl", ".", "openStream", "(", ")", ")", "{", "Files", ".", "copy", "(", "inputStream", ",", "tempFile", ".", "toPath", "(", ")", ")", ";", "}", "}", "return", "tempFile", ";", "}" ]
Creates the file including content. Override this method to implement a custom mechanism to create the temporary file @return the file handle to the newly created file @throws IOException
[ "Creates", "the", "file", "including", "content", ".", "Override", "this", "method", "to", "implement", "a", "custom", "mechanism", "to", "create", "the", "temporary", "file" ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-file/src/main/java/io/inkstand/scribble/rules/TemporaryFile.java#L95-L108
151,739
pressgang-ccms/PressGangCCMSRESTv1Common
src/main/java/org/jboss/pressgang/ccms/rest/v1/collections/base/RESTBaseCollectionV1.java
RESTBaseCollectionV1.returnCollectionItemsWithState
@Override public List<V> returnCollectionItemsWithState(final List<Integer> states) { if (states == null) throw new IllegalArgumentException("states cannot be null"); final List<V> retValue = new ArrayList<V>(); for (final V item : getItems()) { if (states.contains(item.getState())) retValue.add(item); } return retValue; }
java
@Override public List<V> returnCollectionItemsWithState(final List<Integer> states) { if (states == null) throw new IllegalArgumentException("states cannot be null"); final List<V> retValue = new ArrayList<V>(); for (final V item : getItems()) { if (states.contains(item.getState())) retValue.add(item); } return retValue; }
[ "@", "Override", "public", "List", "<", "V", ">", "returnCollectionItemsWithState", "(", "final", "List", "<", "Integer", ">", "states", ")", "{", "if", "(", "states", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"states cannot be null\"", ")", ";", "final", "List", "<", "V", ">", "retValue", "=", "new", "ArrayList", "<", "V", ">", "(", ")", ";", "for", "(", "final", "V", "item", ":", "getItems", "(", ")", ")", "{", "if", "(", "states", ".", "contains", "(", "item", ".", "getState", "(", ")", ")", ")", "retValue", ".", "add", "(", "item", ")", ";", "}", "return", "retValue", ";", "}" ]
Get a collection of REST entities wrapped as collection items that have a particular state @param states Defines the list of states that an entity can be in to be returned @return A collection that holds all the REST entities included in the states collection
[ "Get", "a", "collection", "of", "REST", "entities", "wrapped", "as", "collection", "items", "that", "have", "a", "particular", "state" ]
0641d21b127297b47035f3b8e55fba81251b419c
https://github.com/pressgang-ccms/PressGangCCMSRESTv1Common/blob/0641d21b127297b47035f3b8e55fba81251b419c/src/main/java/org/jboss/pressgang/ccms/rest/v1/collections/base/RESTBaseCollectionV1.java#L48-L59
151,740
pressgang-ccms/PressGangCCMSRESTv1Common
src/main/java/org/jboss/pressgang/ccms/rest/v1/collections/base/RESTBaseCollectionV1.java
RESTBaseCollectionV1.returnItemsWithState
@Override public List<T> returnItemsWithState(final List<Integer> states) { if (states == null) throw new IllegalArgumentException("states cannot be null"); final List<T> retValue = new ArrayList<T>(); for (final V item : getItems()) { if (states.contains(item.getState())) retValue.add(item.getItem()); } return retValue; }
java
@Override public List<T> returnItemsWithState(final List<Integer> states) { if (states == null) throw new IllegalArgumentException("states cannot be null"); final List<T> retValue = new ArrayList<T>(); for (final V item : getItems()) { if (states.contains(item.getState())) retValue.add(item.getItem()); } return retValue; }
[ "@", "Override", "public", "List", "<", "T", ">", "returnItemsWithState", "(", "final", "List", "<", "Integer", ">", "states", ")", "{", "if", "(", "states", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"states cannot be null\"", ")", ";", "final", "List", "<", "T", ">", "retValue", "=", "new", "ArrayList", "<", "T", ">", "(", ")", ";", "for", "(", "final", "V", "item", ":", "getItems", "(", ")", ")", "{", "if", "(", "states", ".", "contains", "(", "item", ".", "getState", "(", ")", ")", ")", "retValue", ".", "add", "(", "item", ".", "getItem", "(", ")", ")", ";", "}", "return", "retValue", ";", "}" ]
Get a collection of REST entities that have a particular state @param states Defines the list of states that an entity can be in to be returned @return A collection that holds all the REST entities included in the states collection
[ "Get", "a", "collection", "of", "REST", "entities", "that", "have", "a", "particular", "state" ]
0641d21b127297b47035f3b8e55fba81251b419c
https://github.com/pressgang-ccms/PressGangCCMSRESTv1Common/blob/0641d21b127297b47035f3b8e55fba81251b419c/src/main/java/org/jboss/pressgang/ccms/rest/v1/collections/base/RESTBaseCollectionV1.java#L107-L118
151,741
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/Environment.java
Environment.retrieveUserProperties
public PropertyOwner retrieveUserProperties(String strRegistrationKey) { if (this.getDefaultApplication() != null) if (this.getDefaultApplication() != null) return this.getDefaultApplication().retrieveUserProperties(strRegistrationKey); return null; }
java
public PropertyOwner retrieveUserProperties(String strRegistrationKey) { if (this.getDefaultApplication() != null) if (this.getDefaultApplication() != null) return this.getDefaultApplication().retrieveUserProperties(strRegistrationKey); return null; }
[ "public", "PropertyOwner", "retrieveUserProperties", "(", "String", "strRegistrationKey", ")", "{", "if", "(", "this", ".", "getDefaultApplication", "(", ")", "!=", "null", ")", "if", "(", "this", ".", "getDefaultApplication", "(", ")", "!=", "null", ")", "return", "this", ".", "getDefaultApplication", "(", ")", ".", "retrieveUserProperties", "(", "strRegistrationKey", ")", ";", "return", "null", ";", "}" ]
Get the Environment properties object. @param strPropertyCode The key I'm looking for the owner to. @return The owner of this property key.
[ "Get", "the", "Environment", "properties", "object", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/Environment.java#L279-L285
151,742
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/Environment.java
Environment.setDefaultApplication
public void setDefaultApplication(App application) { m_applicationDefault = application; if (application != null) if ((!(m_applicationDefault instanceof MainApplication)) || (application == m_applicationDefault)) { // Move db access properties down if (m_args != null) Util.parseArgs(m_properties, m_args); if (m_properties.get(DBParams.LOCAL) == null) m_properties.put(DBParams.LOCAL, (application.getProperty(DBParams.LOCAL) != null) ? application.getProperty(DBParams.LOCAL) : DEFAULT_LOCAL_DB); if (m_properties.get(DBParams.REMOTE) == null) m_properties.put(DBParams.REMOTE, (application.getProperty(DBParams.REMOTE) != null) ? application.getProperty(DBParams.REMOTE) : DEFAULT_REMOTE_DB); if (m_properties.get(DBParams.TABLE) == null) m_properties.put(DBParams.TABLE, (application.getProperty(DBParams.TABLE) != null) ? application.getProperty(DBParams.TABLE) :DEFAULT_TABLE_DB); } }
java
public void setDefaultApplication(App application) { m_applicationDefault = application; if (application != null) if ((!(m_applicationDefault instanceof MainApplication)) || (application == m_applicationDefault)) { // Move db access properties down if (m_args != null) Util.parseArgs(m_properties, m_args); if (m_properties.get(DBParams.LOCAL) == null) m_properties.put(DBParams.LOCAL, (application.getProperty(DBParams.LOCAL) != null) ? application.getProperty(DBParams.LOCAL) : DEFAULT_LOCAL_DB); if (m_properties.get(DBParams.REMOTE) == null) m_properties.put(DBParams.REMOTE, (application.getProperty(DBParams.REMOTE) != null) ? application.getProperty(DBParams.REMOTE) : DEFAULT_REMOTE_DB); if (m_properties.get(DBParams.TABLE) == null) m_properties.put(DBParams.TABLE, (application.getProperty(DBParams.TABLE) != null) ? application.getProperty(DBParams.TABLE) :DEFAULT_TABLE_DB); } }
[ "public", "void", "setDefaultApplication", "(", "App", "application", ")", "{", "m_applicationDefault", "=", "application", ";", "if", "(", "application", "!=", "null", ")", "if", "(", "(", "!", "(", "m_applicationDefault", "instanceof", "MainApplication", ")", ")", "||", "(", "application", "==", "m_applicationDefault", ")", ")", "{", "// Move db access properties down", "if", "(", "m_args", "!=", "null", ")", "Util", ".", "parseArgs", "(", "m_properties", ",", "m_args", ")", ";", "if", "(", "m_properties", ".", "get", "(", "DBParams", ".", "LOCAL", ")", "==", "null", ")", "m_properties", ".", "put", "(", "DBParams", ".", "LOCAL", ",", "(", "application", ".", "getProperty", "(", "DBParams", ".", "LOCAL", ")", "!=", "null", ")", "?", "application", ".", "getProperty", "(", "DBParams", ".", "LOCAL", ")", ":", "DEFAULT_LOCAL_DB", ")", ";", "if", "(", "m_properties", ".", "get", "(", "DBParams", ".", "REMOTE", ")", "==", "null", ")", "m_properties", ".", "put", "(", "DBParams", ".", "REMOTE", ",", "(", "application", ".", "getProperty", "(", "DBParams", ".", "REMOTE", ")", "!=", "null", ")", "?", "application", ".", "getProperty", "(", "DBParams", ".", "REMOTE", ")", ":", "DEFAULT_REMOTE_DB", ")", ";", "if", "(", "m_properties", ".", "get", "(", "DBParams", ".", "TABLE", ")", "==", "null", ")", "m_properties", ".", "put", "(", "DBParams", ".", "TABLE", ",", "(", "application", ".", "getProperty", "(", "DBParams", ".", "TABLE", ")", "!=", "null", ")", "?", "application", ".", "getProperty", "(", "DBParams", ".", "TABLE", ")", ":", "DEFAULT_TABLE_DB", ")", ";", "}", "}" ]
Set the default application. @param application The default application.
[ "Set", "the", "default", "application", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/Environment.java#L298-L313
151,743
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/Environment.java
Environment.addApplication
public void addApplication(App application) { Utility.getLogger().info("addApp: " + application); m_vApplication.add(application); ((BaseApplication)application).setEnvironment(this); if ((m_applicationDefault == null) || ((!(m_applicationDefault instanceof MainApplication))) && (application instanceof MainApplication)) this.setDefaultApplication(application); // Initialization app }
java
public void addApplication(App application) { Utility.getLogger().info("addApp: " + application); m_vApplication.add(application); ((BaseApplication)application).setEnvironment(this); if ((m_applicationDefault == null) || ((!(m_applicationDefault instanceof MainApplication))) && (application instanceof MainApplication)) this.setDefaultApplication(application); // Initialization app }
[ "public", "void", "addApplication", "(", "App", "application", ")", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"addApp: \"", "+", "application", ")", ";", "m_vApplication", ".", "add", "(", "application", ")", ";", "(", "(", "BaseApplication", ")", "application", ")", ".", "setEnvironment", "(", "this", ")", ";", "if", "(", "(", "m_applicationDefault", "==", "null", ")", "||", "(", "(", "!", "(", "m_applicationDefault", "instanceof", "MainApplication", ")", ")", ")", "&&", "(", "application", "instanceof", "MainApplication", ")", ")", "this", ".", "setDefaultApplication", "(", "application", ")", ";", "// Initialization app", "}" ]
Add an Application to this environment. If there is no default application yet, this is set to the default application. @param application The application to add.
[ "Add", "an", "Application", "to", "this", "environment", ".", "If", "there", "is", "no", "default", "application", "yet", "this", "is", "set", "to", "the", "default", "application", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/Environment.java#L319-L327
151,744
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/Environment.java
Environment.removeApplication
public int removeApplication(App application) { Utility.getLogger().info("removeApp: " + application); m_vApplication.remove(application); // Add code here if (m_applicationDefault == application) m_applicationDefault = null; // Initialization app return m_vApplication.size(); }
java
public int removeApplication(App application) { Utility.getLogger().info("removeApp: " + application); m_vApplication.remove(application); // Add code here if (m_applicationDefault == application) m_applicationDefault = null; // Initialization app return m_vApplication.size(); }
[ "public", "int", "removeApplication", "(", "App", "application", ")", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"removeApp: \"", "+", "application", ")", ";", "m_vApplication", ".", "remove", "(", "application", ")", ";", "// Add code here", "if", "(", "m_applicationDefault", "==", "application", ")", "m_applicationDefault", "=", "null", ";", "// Initialization app", "return", "m_vApplication", ".", "size", "(", ")", ";", "}" ]
Remove this application from the Environment. @param application The application to remove. @return Number of remaining applications still active.
[ "Remove", "this", "application", "from", "the", "Environment", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/Environment.java#L333-L340
151,745
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/Environment.java
Environment.getMessageApplication
public MessageApp getMessageApplication(String strDBPrefix, String strSubSystem) { strSubSystem = Utility.getSystemSuffix(strSubSystem, this.getProperty(DBConstants.DEFAULT_SYSTEM_NAME)); // Normalize MessageApp messageApplication = null; for (int i = 0; i < this.getApplicationCount(); i++) { App app = this.getApplication(i); if (app instanceof MessageApp) { Map<String, Object> messageAppProperties = app.getProperties(); // Only message app's properties (not env). String strAppDBPrefix = (messageAppProperties == null) ? null : (String)messageAppProperties.get(DBConstants.DB_USER_PREFIX); String strAppSubSystem = (messageAppProperties == null) ? null : (String)messageAppProperties.get(DBConstants.SYSTEM_NAME); strAppSubSystem = Utility.getSystemSuffix(strAppSubSystem, this.getProperty(DBConstants.DEFAULT_SYSTEM_NAME)); // Normalize boolean bDBMatch = false; if ((strAppDBPrefix == null) && (strDBPrefix == null)) bDBMatch = true; if (strAppDBPrefix != null) if (strAppDBPrefix.equalsIgnoreCase(strDBPrefix)) bDBMatch = true; boolean bSubSystemMatch = false; if ((strAppSubSystem == null) && (strSubSystem == null)) bSubSystemMatch = true; if (strAppSubSystem != null) if (strAppSubSystem.equalsIgnoreCase(strSubSystem)) bSubSystemMatch = true; if ((bDBMatch) && (bSubSystemMatch)) messageApplication = (MessageApp)app; } } return messageApplication; }
java
public MessageApp getMessageApplication(String strDBPrefix, String strSubSystem) { strSubSystem = Utility.getSystemSuffix(strSubSystem, this.getProperty(DBConstants.DEFAULT_SYSTEM_NAME)); // Normalize MessageApp messageApplication = null; for (int i = 0; i < this.getApplicationCount(); i++) { App app = this.getApplication(i); if (app instanceof MessageApp) { Map<String, Object> messageAppProperties = app.getProperties(); // Only message app's properties (not env). String strAppDBPrefix = (messageAppProperties == null) ? null : (String)messageAppProperties.get(DBConstants.DB_USER_PREFIX); String strAppSubSystem = (messageAppProperties == null) ? null : (String)messageAppProperties.get(DBConstants.SYSTEM_NAME); strAppSubSystem = Utility.getSystemSuffix(strAppSubSystem, this.getProperty(DBConstants.DEFAULT_SYSTEM_NAME)); // Normalize boolean bDBMatch = false; if ((strAppDBPrefix == null) && (strDBPrefix == null)) bDBMatch = true; if (strAppDBPrefix != null) if (strAppDBPrefix.equalsIgnoreCase(strDBPrefix)) bDBMatch = true; boolean bSubSystemMatch = false; if ((strAppSubSystem == null) && (strSubSystem == null)) bSubSystemMatch = true; if (strAppSubSystem != null) if (strAppSubSystem.equalsIgnoreCase(strSubSystem)) bSubSystemMatch = true; if ((bDBMatch) && (bSubSystemMatch)) messageApplication = (MessageApp)app; } } return messageApplication; }
[ "public", "MessageApp", "getMessageApplication", "(", "String", "strDBPrefix", ",", "String", "strSubSystem", ")", "{", "strSubSystem", "=", "Utility", ".", "getSystemSuffix", "(", "strSubSystem", ",", "this", ".", "getProperty", "(", "DBConstants", ".", "DEFAULT_SYSTEM_NAME", ")", ")", ";", "// Normalize", "MessageApp", "messageApplication", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "getApplicationCount", "(", ")", ";", "i", "++", ")", "{", "App", "app", "=", "this", ".", "getApplication", "(", "i", ")", ";", "if", "(", "app", "instanceof", "MessageApp", ")", "{", "Map", "<", "String", ",", "Object", ">", "messageAppProperties", "=", "app", ".", "getProperties", "(", ")", ";", "// Only message app's properties (not env).", "String", "strAppDBPrefix", "=", "(", "messageAppProperties", "==", "null", ")", "?", "null", ":", "(", "String", ")", "messageAppProperties", ".", "get", "(", "DBConstants", ".", "DB_USER_PREFIX", ")", ";", "String", "strAppSubSystem", "=", "(", "messageAppProperties", "==", "null", ")", "?", "null", ":", "(", "String", ")", "messageAppProperties", ".", "get", "(", "DBConstants", ".", "SYSTEM_NAME", ")", ";", "strAppSubSystem", "=", "Utility", ".", "getSystemSuffix", "(", "strAppSubSystem", ",", "this", ".", "getProperty", "(", "DBConstants", ".", "DEFAULT_SYSTEM_NAME", ")", ")", ";", "// Normalize", "boolean", "bDBMatch", "=", "false", ";", "if", "(", "(", "strAppDBPrefix", "==", "null", ")", "&&", "(", "strDBPrefix", "==", "null", ")", ")", "bDBMatch", "=", "true", ";", "if", "(", "strAppDBPrefix", "!=", "null", ")", "if", "(", "strAppDBPrefix", ".", "equalsIgnoreCase", "(", "strDBPrefix", ")", ")", "bDBMatch", "=", "true", ";", "boolean", "bSubSystemMatch", "=", "false", ";", "if", "(", "(", "strAppSubSystem", "==", "null", ")", "&&", "(", "strSubSystem", "==", "null", ")", ")", "bSubSystemMatch", "=", "true", ";", "if", "(", "strAppSubSystem", "!=", "null", ")", "if", "(", "strAppSubSystem", ".", "equalsIgnoreCase", "(", "strSubSystem", ")", ")", "bSubSystemMatch", "=", "true", ";", "if", "(", "(", "bDBMatch", ")", "&&", "(", "bSubSystemMatch", ")", ")", "messageApplication", "=", "(", "MessageApp", ")", "app", ";", "}", "}", "return", "messageApplication", ";", "}" ]
Find the message application. @param strDBPrefix The database prefix. @param strDomain The domain to get the message app for (or default/best guess if null) @return The message manager or null if no match.
[ "Find", "the", "message", "application", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/Environment.java#L379-L409
151,746
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/Environment.java
Environment.cacheDatabaseProperties
public void cacheDatabaseProperties(String strDBName, Map<String,String> map) { m_mapDBProperties.put(strDBName, map); // Cache for next time }
java
public void cacheDatabaseProperties(String strDBName, Map<String,String> map) { m_mapDBProperties.put(strDBName, map); // Cache for next time }
[ "public", "void", "cacheDatabaseProperties", "(", "String", "strDBName", ",", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "m_mapDBProperties", ".", "put", "(", "strDBName", ",", "map", ")", ";", "// Cache for next time", "}" ]
Set the initial database properties.
[ "Set", "the", "initial", "database", "properties", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/Environment.java#L535-L538
151,747
jbundle/jbundle
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/datasource/MySQLDatasourceFactory.java
MySQLDatasourceFactory.getDataSource
public DataSource getDataSource(JdbcDatabase database) { com.mysql.jdbc.jdbc2.optional.MysqlDataSource dataSource = new com.mysql.jdbc.jdbc2.optional.MysqlDataSource(); this.setDatasourceParams(database, dataSource); return dataSource; }
java
public DataSource getDataSource(JdbcDatabase database) { com.mysql.jdbc.jdbc2.optional.MysqlDataSource dataSource = new com.mysql.jdbc.jdbc2.optional.MysqlDataSource(); this.setDatasourceParams(database, dataSource); return dataSource; }
[ "public", "DataSource", "getDataSource", "(", "JdbcDatabase", "database", ")", "{", "com", ".", "mysql", ".", "jdbc", ".", "jdbc2", ".", "optional", ".", "MysqlDataSource", "dataSource", "=", "new", "com", ".", "mysql", ".", "jdbc", ".", "jdbc2", ".", "optional", ".", "MysqlDataSource", "(", ")", ";", "this", ".", "setDatasourceParams", "(", "database", ",", "dataSource", ")", ";", "return", "dataSource", ";", "}" ]
Get and populate the data source object for this database. @param database The JDBC database to create a connection to. @return The datasource.
[ "Get", "and", "populate", "the", "data", "source", "object", "for", "this", "database", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/datasource/MySQLDatasourceFactory.java#L30-L35
151,748
oglimmer/utils
src/main/java/de/oglimmer/utils/VersionFromManifest.java
VersionFromManifest.init
public void init(final InputStream inputStream) { try (final InputStream is = inputStream) { final Manifest mf = new Manifest(is); final Attributes attr = mf.getMainAttributes(); commit = attr.getValue("git-commit"); gitUrl = attr.getValue("git-url"); version = attr.getValue("project-version"); final long time = Long.parseLong(attr.getValue("creation-date")); creationDate = DateFormat.getDateTimeInstance(DATEFORMAT, DATEFORMAT).format(new Date(time)); } catch (Exception e) { initBackToDefaults(); } }
java
public void init(final InputStream inputStream) { try (final InputStream is = inputStream) { final Manifest mf = new Manifest(is); final Attributes attr = mf.getMainAttributes(); commit = attr.getValue("git-commit"); gitUrl = attr.getValue("git-url"); version = attr.getValue("project-version"); final long time = Long.parseLong(attr.getValue("creation-date")); creationDate = DateFormat.getDateTimeInstance(DATEFORMAT, DATEFORMAT).format(new Date(time)); } catch (Exception e) { initBackToDefaults(); } }
[ "public", "void", "init", "(", "final", "InputStream", "inputStream", ")", "{", "try", "(", "final", "InputStream", "is", "=", "inputStream", ")", "{", "final", "Manifest", "mf", "=", "new", "Manifest", "(", "is", ")", ";", "final", "Attributes", "attr", "=", "mf", ".", "getMainAttributes", "(", ")", ";", "commit", "=", "attr", ".", "getValue", "(", "\"git-commit\"", ")", ";", "gitUrl", "=", "attr", ".", "getValue", "(", "\"git-url\"", ")", ";", "version", "=", "attr", ".", "getValue", "(", "\"project-version\"", ")", ";", "final", "long", "time", "=", "Long", ".", "parseLong", "(", "attr", ".", "getValue", "(", "\"creation-date\"", ")", ")", ";", "creationDate", "=", "DateFormat", ".", "getDateTimeInstance", "(", "DATEFORMAT", ",", "DATEFORMAT", ")", ".", "format", "(", "new", "Date", "(", "time", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "initBackToDefaults", "(", ")", ";", "}", "}" ]
Init with a given inputStream. @param inputStream to read the Manifest file from
[ "Init", "with", "a", "given", "inputStream", "." ]
bc46c57a24e60c9dbda4c73a810c163b0ce407ea
https://github.com/oglimmer/utils/blob/bc46c57a24e60c9dbda4c73a810c163b0ce407ea/src/main/java/de/oglimmer/utils/VersionFromManifest.java#L44-L56
151,749
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.search
public static <E extends Comparable<E>> int search(E[] array, E value) { int start = 0; int end = array.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value.equals(array[middle])) { return middle; } if(value.compareTo(array[middle]) < 0) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static <E extends Comparable<E>> int search(E[] array, E value) { int start = 0; int end = array.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value.equals(array[middle])) { return middle; } if(value.compareTo(array[middle]) < 0) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "<", "E", "extends", "Comparable", "<", "E", ">", ">", "int", "search", "(", "E", "[", "]", "array", ",", "E", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "array", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", ".", "equals", "(", "array", "[", "middle", "]", ")", ")", "{", "return", "middle", ";", "}", "if", "(", "value", ".", "compareTo", "(", "array", "[", "middle", "]", ")", "<", "0", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the sorted sorted array and return the index. @param <E> the type of elements in this array. @param array array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "sorted", "sorted", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L47-L69
151,750
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.search
public static int search(int[] intArray, int value) { int start = 0; int end = intArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == intArray[middle]) { return middle; } if(value < intArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int search(int[] intArray, int value) { int start = 0; int end = intArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == intArray[middle]) { return middle; } if(value < intArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "search", "(", "int", "[", "]", "intArray", ",", "int", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "intArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "intArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", "<", "intArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the sorted int array and return the index. @param intArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "sorted", "int", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L115-L137
151,751
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.search
public static int search(char[] charArray, char value) { int start = 0; int end = charArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == charArray[middle]) { return middle; } if(value < charArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int search(char[] charArray, char value) { int start = 0; int end = charArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == charArray[middle]) { return middle; } if(value < charArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "search", "(", "char", "[", "]", "charArray", ",", "char", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "charArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "charArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", "<", "charArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the sorted char array and return the index. @param charArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "sorted", "char", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L147-L169
151,752
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.search
public static int search(byte[] byteArray, byte value) { int start = 0; int end = byteArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == byteArray[middle]) { return middle; } if(value < byteArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int search(byte[] byteArray, byte value) { int start = 0; int end = byteArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == byteArray[middle]) { return middle; } if(value < byteArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "search", "(", "byte", "[", "]", "byteArray", ",", "byte", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "byteArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "byteArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", "<", "byteArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the sorted byte array and return the index. @param byteArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "sorted", "byte", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L179-L201
151,753
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.search
public static int search(short[] shortArray, short value) { int start = 0; int end = shortArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == shortArray[middle]) { return middle; } if(value < shortArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int search(short[] shortArray, short value) { int start = 0; int end = shortArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == shortArray[middle]) { return middle; } if(value < shortArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "search", "(", "short", "[", "]", "shortArray", ",", "short", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "shortArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "shortArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", "<", "shortArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the sorted short array and return the index. @param shortArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "sorted", "short", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L211-L233
151,754
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.search
public static int search(long[] longArray, long value) { int start = 0; int end = longArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == longArray[middle]) { return middle; } if(value < longArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int search(long[] longArray, long value) { int start = 0; int end = longArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == longArray[middle]) { return middle; } if(value < longArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "search", "(", "long", "[", "]", "longArray", ",", "long", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "longArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "longArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", "<", "longArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the sorted long array and return the index. @param longArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "sorted", "long", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L243-L265
151,755
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.search
public static int search(float[] floatArray, float value) { int start = 0; int end = floatArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == floatArray[middle]) { return middle; } if(value < floatArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int search(float[] floatArray, float value) { int start = 0; int end = floatArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == floatArray[middle]) { return middle; } if(value < floatArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "search", "(", "float", "[", "]", "floatArray", ",", "float", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "floatArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "floatArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", "<", "floatArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the sorted float array and return the index. @param floatArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "sorted", "float", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L275-L297
151,756
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.search
public static int search(double[] doubleArray, double value) { int start = 0; int end = doubleArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == doubleArray[middle]) { return middle; } if(value < doubleArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int search(double[] doubleArray, double value) { int start = 0; int end = doubleArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == doubleArray[middle]) { return middle; } if(value < doubleArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "search", "(", "double", "[", "]", "doubleArray", ",", "double", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "doubleArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "doubleArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", "<", "doubleArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the sorted double array and return the index. @param doubleArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "sorted", "double", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L307-L329
151,757
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.searchDescending
public static int searchDescending(int[] intArray, int value) { int start = 0; int end = intArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == intArray[middle]) { return middle; } if(value > intArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int searchDescending(int[] intArray, int value) { int start = 0; int end = intArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == intArray[middle]) { return middle; } if(value > intArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "searchDescending", "(", "int", "[", "]", "intArray", ",", "int", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "intArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "intArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", ">", "intArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the reverse sorted int array and return the index. @param intArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "reverse", "sorted", "int", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L409-L431
151,758
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.searchDescending
public static int searchDescending(char[] charArray, char value) { int start = 0; int end = charArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == charArray[middle]) { return middle; } if(value > charArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int searchDescending(char[] charArray, char value) { int start = 0; int end = charArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == charArray[middle]) { return middle; } if(value > charArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "searchDescending", "(", "char", "[", "]", "charArray", ",", "char", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "charArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "charArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", ">", "charArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the reverse sorted char array and return the index. @param charArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "reverse", "sorted", "char", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L441-L463
151,759
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.searchDescending
public static int searchDescending(byte[] byteArray, byte value) { int start = 0; int end = byteArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == byteArray[middle]) { return middle; } if(value > byteArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int searchDescending(byte[] byteArray, byte value) { int start = 0; int end = byteArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == byteArray[middle]) { return middle; } if(value > byteArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "searchDescending", "(", "byte", "[", "]", "byteArray", ",", "byte", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "byteArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "byteArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", ">", "byteArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the reverse sorted byte array and return the index. @param byteArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "reverse", "sorted", "byte", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L473-L495
151,760
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.searchDescending
public static int searchDescending(short[] shortArray, short value) { int start = 0; int end = shortArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == shortArray[middle]) { return middle; } if(value > shortArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int searchDescending(short[] shortArray, short value) { int start = 0; int end = shortArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == shortArray[middle]) { return middle; } if(value > shortArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "searchDescending", "(", "short", "[", "]", "shortArray", ",", "short", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "shortArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "shortArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", ">", "shortArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the reverse sorted short array and return the index. @param shortArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "reverse", "sorted", "short", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L505-L527
151,761
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.searchDescending
public static int searchDescending(long[] longArray, long value) { int start = 0; int end = longArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == longArray[middle]) { return middle; } if(value > longArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int searchDescending(long[] longArray, long value) { int start = 0; int end = longArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == longArray[middle]) { return middle; } if(value > longArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "searchDescending", "(", "long", "[", "]", "longArray", ",", "long", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "longArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "longArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", ">", "longArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the reverse sorted long array and return the index. @param longArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "reverse", "sorted", "long", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L537-L559
151,762
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.searchDescending
public static int searchDescending(float[] floatArray, float value) { int start = 0; int end = floatArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == floatArray[middle]) { return middle; } if(value > floatArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int searchDescending(float[] floatArray, float value) { int start = 0; int end = floatArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == floatArray[middle]) { return middle; } if(value > floatArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "searchDescending", "(", "float", "[", "]", "floatArray", ",", "float", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "floatArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "floatArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", ">", "floatArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the reverse sorted float array and return the index. @param floatArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "reverse", "sorted", "float", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L569-L591
151,763
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.searchDescending
public static int searchDescending(double[] doubleArray, double value) { int start = 0; int end = doubleArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == doubleArray[middle]) { return middle; } if(value > doubleArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int searchDescending(double[] doubleArray, double value) { int start = 0; int end = doubleArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == doubleArray[middle]) { return middle; } if(value > doubleArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "searchDescending", "(", "double", "[", "]", "doubleArray", ",", "double", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "doubleArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "doubleArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", ">", "doubleArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the reverse sorted double array and return the index. @param doubleArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "reverse", "sorted", "double", "array", "and", "return", "the", "index", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L601-L623
151,764
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/thread/SwingSyncPageWorker.java
SwingSyncPageWorker.runPageLoader
public void runPageLoader() { SwingUtilities.invokeLater(new Thread() { // Utility class to change the status in the AWT thread, then run the m_swingPageLoader. public void run() { if (m_syncPage instanceof Task) { String strWaitMessage = WAIT_MESSAGE; try { strWaitMessage = ((Task)m_syncPage).getApplication().getResources(ThinResourceConstants.ERROR_RESOURCE, true).getString(strWaitMessage); } catch (MissingResourceException ex) { } ((Task)m_syncPage).setStatusText(strWaitMessage, Constants.WAIT); } else if (m_syncPage instanceof JBasePanel) { if (((JBasePanel)m_syncPage).getBaseApplet() != null) { String strWaitMessage = WAIT_MESSAGE; try { strWaitMessage = (((JBasePanel)m_syncPage).getBaseApplet()).getApplication().getResources(ThinResourceConstants.ERROR_RESOURCE, true).getString(strWaitMessage); } catch (MissingResourceException ex) { } ((JBasePanel)m_syncPage).getBaseApplet().setStatusText(strWaitMessage, Constants.WAIT); } } Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); if (m_syncPage instanceof Component) { ((Component)m_syncPage).setCursor(waitCursor); ((Component)m_syncPage).repaint(); // Queue a repaint } if (m_swingPageLoader != null) m_swingPageLoader.run(); if (m_syncPage instanceof Component) ((Component)m_syncPage).repaint(); } }); }
java
public void runPageLoader() { SwingUtilities.invokeLater(new Thread() { // Utility class to change the status in the AWT thread, then run the m_swingPageLoader. public void run() { if (m_syncPage instanceof Task) { String strWaitMessage = WAIT_MESSAGE; try { strWaitMessage = ((Task)m_syncPage).getApplication().getResources(ThinResourceConstants.ERROR_RESOURCE, true).getString(strWaitMessage); } catch (MissingResourceException ex) { } ((Task)m_syncPage).setStatusText(strWaitMessage, Constants.WAIT); } else if (m_syncPage instanceof JBasePanel) { if (((JBasePanel)m_syncPage).getBaseApplet() != null) { String strWaitMessage = WAIT_MESSAGE; try { strWaitMessage = (((JBasePanel)m_syncPage).getBaseApplet()).getApplication().getResources(ThinResourceConstants.ERROR_RESOURCE, true).getString(strWaitMessage); } catch (MissingResourceException ex) { } ((JBasePanel)m_syncPage).getBaseApplet().setStatusText(strWaitMessage, Constants.WAIT); } } Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); if (m_syncPage instanceof Component) { ((Component)m_syncPage).setCursor(waitCursor); ((Component)m_syncPage).repaint(); // Queue a repaint } if (m_swingPageLoader != null) m_swingPageLoader.run(); if (m_syncPage instanceof Component) ((Component)m_syncPage).repaint(); } }); }
[ "public", "void", "runPageLoader", "(", ")", "{", "SwingUtilities", ".", "invokeLater", "(", "new", "Thread", "(", ")", "{", "// Utility class to change the status in the AWT thread, then run the m_swingPageLoader.", "public", "void", "run", "(", ")", "{", "if", "(", "m_syncPage", "instanceof", "Task", ")", "{", "String", "strWaitMessage", "=", "WAIT_MESSAGE", ";", "try", "{", "strWaitMessage", "=", "(", "(", "Task", ")", "m_syncPage", ")", ".", "getApplication", "(", ")", ".", "getResources", "(", "ThinResourceConstants", ".", "ERROR_RESOURCE", ",", "true", ")", ".", "getString", "(", "strWaitMessage", ")", ";", "}", "catch", "(", "MissingResourceException", "ex", ")", "{", "}", "(", "(", "Task", ")", "m_syncPage", ")", ".", "setStatusText", "(", "strWaitMessage", ",", "Constants", ".", "WAIT", ")", ";", "}", "else", "if", "(", "m_syncPage", "instanceof", "JBasePanel", ")", "{", "if", "(", "(", "(", "JBasePanel", ")", "m_syncPage", ")", ".", "getBaseApplet", "(", ")", "!=", "null", ")", "{", "String", "strWaitMessage", "=", "WAIT_MESSAGE", ";", "try", "{", "strWaitMessage", "=", "(", "(", "(", "JBasePanel", ")", "m_syncPage", ")", ".", "getBaseApplet", "(", ")", ")", ".", "getApplication", "(", ")", ".", "getResources", "(", "ThinResourceConstants", ".", "ERROR_RESOURCE", ",", "true", ")", ".", "getString", "(", "strWaitMessage", ")", ";", "}", "catch", "(", "MissingResourceException", "ex", ")", "{", "}", "(", "(", "JBasePanel", ")", "m_syncPage", ")", ".", "getBaseApplet", "(", ")", ".", "setStatusText", "(", "strWaitMessage", ",", "Constants", ".", "WAIT", ")", ";", "}", "}", "Cursor", "waitCursor", "=", "Cursor", ".", "getPredefinedCursor", "(", "Cursor", ".", "WAIT_CURSOR", ")", ";", "if", "(", "m_syncPage", "instanceof", "Component", ")", "{", "(", "(", "Component", ")", "m_syncPage", ")", ".", "setCursor", "(", "waitCursor", ")", ";", "(", "(", "Component", ")", "m_syncPage", ")", ".", "repaint", "(", ")", ";", "// Queue a repaint", "}", "if", "(", "m_swingPageLoader", "!=", "null", ")", "m_swingPageLoader", ".", "run", "(", ")", ";", "if", "(", "m_syncPage", "instanceof", "Component", ")", "(", "(", "Component", ")", "m_syncPage", ")", ".", "repaint", "(", ")", ";", "}", "}", ")", ";", "}" ]
Invoke the page loader that was passed into the constructor. If you override this, remember to invoke your code in the awt thread.
[ "Invoke", "the", "page", "loader", "that", "was", "passed", "into", "the", "constructor", ".", "If", "you", "override", "this", "remember", "to", "invoke", "your", "code", "in", "the", "awt", "thread", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/thread/SwingSyncPageWorker.java#L82-L123
151,765
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/thread/SwingSyncPageWorker.java
SwingSyncPageWorker.afterPageDisplay
public void afterPageDisplay() { SwingWorker<String,String> worker = new SwingWorker<String,String>() { public String doInBackground() { return null; } public void done() { // This should always be the awt thread SwingSyncPageWorker.this.done(); if (m_syncPage instanceof Task) { ((Task)m_syncPage).setStatusText(null, Constants.INFORMATION); } else if (m_syncPage instanceof JBasePanel) { if (((JBasePanel)m_syncPage).getBaseApplet() != null) ((JBasePanel)m_syncPage).getBaseApplet().setStatusText(null, Constants.INFORMATION); } Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); if (m_syncPage instanceof Component) { ((Component)m_syncPage).setCursor(waitCursor); ((Component)m_syncPage).repaint(); // Queue a repaint } } }; worker.execute(); }
java
public void afterPageDisplay() { SwingWorker<String,String> worker = new SwingWorker<String,String>() { public String doInBackground() { return null; } public void done() { // This should always be the awt thread SwingSyncPageWorker.this.done(); if (m_syncPage instanceof Task) { ((Task)m_syncPage).setStatusText(null, Constants.INFORMATION); } else if (m_syncPage instanceof JBasePanel) { if (((JBasePanel)m_syncPage).getBaseApplet() != null) ((JBasePanel)m_syncPage).getBaseApplet().setStatusText(null, Constants.INFORMATION); } Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); if (m_syncPage instanceof Component) { ((Component)m_syncPage).setCursor(waitCursor); ((Component)m_syncPage).repaint(); // Queue a repaint } } }; worker.execute(); }
[ "public", "void", "afterPageDisplay", "(", ")", "{", "SwingWorker", "<", "String", ",", "String", ">", "worker", "=", "new", "SwingWorker", "<", "String", ",", "String", ">", "(", ")", "{", "public", "String", "doInBackground", "(", ")", "{", "return", "null", ";", "}", "public", "void", "done", "(", ")", "{", "// This should always be the awt thread", "SwingSyncPageWorker", ".", "this", ".", "done", "(", ")", ";", "if", "(", "m_syncPage", "instanceof", "Task", ")", "{", "(", "(", "Task", ")", "m_syncPage", ")", ".", "setStatusText", "(", "null", ",", "Constants", ".", "INFORMATION", ")", ";", "}", "else", "if", "(", "m_syncPage", "instanceof", "JBasePanel", ")", "{", "if", "(", "(", "(", "JBasePanel", ")", "m_syncPage", ")", ".", "getBaseApplet", "(", ")", "!=", "null", ")", "(", "(", "JBasePanel", ")", "m_syncPage", ")", ".", "getBaseApplet", "(", ")", ".", "setStatusText", "(", "null", ",", "Constants", ".", "INFORMATION", ")", ";", "}", "Cursor", "waitCursor", "=", "Cursor", ".", "getPredefinedCursor", "(", "Cursor", ".", "DEFAULT_CURSOR", ")", ";", "if", "(", "m_syncPage", "instanceof", "Component", ")", "{", "(", "(", "Component", ")", "m_syncPage", ")", ".", "setCursor", "(", "waitCursor", ")", ";", "(", "(", "Component", ")", "m_syncPage", ")", ".", "repaint", "(", ")", ";", "// Queue a repaint", "}", "}", "}", ";", "worker", ".", "execute", "(", ")", ";", "}" ]
Do this code after the page has displayed on the screen. Override this method.
[ "Do", "this", "code", "after", "the", "page", "has", "displayed", "on", "the", "screen", ".", "Override", "this", "method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/thread/SwingSyncPageWorker.java#L128-L157
151,766
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ObjectField.java
ObjectField.setupDefaultView
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { return null; }
java
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { return null; }
[ "public", "ScreenComponent", "setupDefaultView", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "Convert", "converter", ",", "int", "iDisplayFieldDesc", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "return", "null", ";", "}" ]
Set up the default screen control for this field. You should override this method depending of the concrete display type. @param itsLocation Location of this component on screen (ie., GridBagConstraint). @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout). @param converter The converter to set the screenfield to. @param iDisplayFieldDesc Display the label? (optional). @return Return the component or ScreenField that is created for this field.
[ "Set", "up", "the", "default", "screen", "control", "for", "this", "field", ".", "You", "should", "override", "this", "method", "depending", "of", "the", "concrete", "display", "type", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ObjectField.java#L105-L108
151,767
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ObjectField.java
ObjectField.moveSQLToField
public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException { InputStream inStream = resultset.getBinaryStream(iColumn); if (resultset.wasNull()) this.setData(null, false, DBConstants.READ_MOVE); // Null value else { try { // This is kind of weird, but for some reason, the inStream will only accept read(byte[]), so I have to do this: byte rgBytes[] = new byte[2048]; ByteArrayOutputStream baOut = new ByteArrayOutputStream(); while (true) { int iRead = 0; try { iRead = inStream.read(rgBytes); } catch (EOFException ex) { iRead = 0; } if (iRead > 0) baOut.write(rgBytes, 0, iRead); if (iRead < rgBytes.length) break; // End of stream } rgBytes = baOut.toByteArray(); Object objData = null; if (rgBytes.length > 0) { String string = new String(rgBytes, BundleConstants.OBJECT_ENCODING); objData = ClassServiceUtility.getClassService().convertStringToObject(string, null); //x ByteArrayInputStream ibyStream = new ByteArrayInputStream(rgBytes); //x ObjectInputStream iStream = new ObjectInputStream(ibyStream); //x objData = iStream.readObject(); } this.setData(objData, false, DBConstants.READ_MOVE); } catch (IOException ex) { ex.printStackTrace(); // Never } catch (ClassNotFoundException ex) { ex.printStackTrace(); // Never } } }
java
public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException { InputStream inStream = resultset.getBinaryStream(iColumn); if (resultset.wasNull()) this.setData(null, false, DBConstants.READ_MOVE); // Null value else { try { // This is kind of weird, but for some reason, the inStream will only accept read(byte[]), so I have to do this: byte rgBytes[] = new byte[2048]; ByteArrayOutputStream baOut = new ByteArrayOutputStream(); while (true) { int iRead = 0; try { iRead = inStream.read(rgBytes); } catch (EOFException ex) { iRead = 0; } if (iRead > 0) baOut.write(rgBytes, 0, iRead); if (iRead < rgBytes.length) break; // End of stream } rgBytes = baOut.toByteArray(); Object objData = null; if (rgBytes.length > 0) { String string = new String(rgBytes, BundleConstants.OBJECT_ENCODING); objData = ClassServiceUtility.getClassService().convertStringToObject(string, null); //x ByteArrayInputStream ibyStream = new ByteArrayInputStream(rgBytes); //x ObjectInputStream iStream = new ObjectInputStream(ibyStream); //x objData = iStream.readObject(); } this.setData(objData, false, DBConstants.READ_MOVE); } catch (IOException ex) { ex.printStackTrace(); // Never } catch (ClassNotFoundException ex) { ex.printStackTrace(); // Never } } }
[ "public", "void", "moveSQLToField", "(", "ResultSet", "resultset", ",", "int", "iColumn", ")", "throws", "SQLException", "{", "InputStream", "inStream", "=", "resultset", ".", "getBinaryStream", "(", "iColumn", ")", ";", "if", "(", "resultset", ".", "wasNull", "(", ")", ")", "this", ".", "setData", "(", "null", ",", "false", ",", "DBConstants", ".", "READ_MOVE", ")", ";", "// Null value", "else", "{", "try", "{", "// This is kind of weird, but for some reason, the inStream will only accept read(byte[]), so I have to do this:", "byte", "rgBytes", "[", "]", "=", "new", "byte", "[", "2048", "]", ";", "ByteArrayOutputStream", "baOut", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "while", "(", "true", ")", "{", "int", "iRead", "=", "0", ";", "try", "{", "iRead", "=", "inStream", ".", "read", "(", "rgBytes", ")", ";", "}", "catch", "(", "EOFException", "ex", ")", "{", "iRead", "=", "0", ";", "}", "if", "(", "iRead", ">", "0", ")", "baOut", ".", "write", "(", "rgBytes", ",", "0", ",", "iRead", ")", ";", "if", "(", "iRead", "<", "rgBytes", ".", "length", ")", "break", ";", "// End of stream", "}", "rgBytes", "=", "baOut", ".", "toByteArray", "(", ")", ";", "Object", "objData", "=", "null", ";", "if", "(", "rgBytes", ".", "length", ">", "0", ")", "{", "String", "string", "=", "new", "String", "(", "rgBytes", ",", "BundleConstants", ".", "OBJECT_ENCODING", ")", ";", "objData", "=", "ClassServiceUtility", ".", "getClassService", "(", ")", ".", "convertStringToObject", "(", "string", ",", "null", ")", ";", "//x ByteArrayInputStream ibyStream = new ByteArrayInputStream(rgBytes);", "//x ObjectInputStream iStream = new ObjectInputStream(ibyStream);", "//x objData = iStream.readObject();", "}", "this", ".", "setData", "(", "objData", ",", "false", ",", "DBConstants", ".", "READ_MOVE", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "// Never", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "// Never", "}", "}", "}" ]
Move the physical binary data to this SQL parameter row. This method uses the getBinaryStream resultset method. @param resultset The resultset to get the SQL data from. @param iColumn the column in the resultset that has my data. @exception SQLException From SQL calls.
[ "Move", "the", "physical", "binary", "data", "to", "this", "SQL", "parameter", "row", ".", "This", "method", "uses", "the", "getBinaryStream", "resultset", "method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ObjectField.java#L141-L182
151,768
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ObjectField.java
ObjectField.getSQLFromField
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException { if (this.isNull()) statement.setNull(iParamColumn, Types.BLOB); else { Object data = this.getData(); ByteArrayOutputStream ostream = new ByteArrayOutputStream(); ObjectOutputStream p = null; try { p = new ObjectOutputStream(ostream); p.writeObject(data); p.flush(); ostream.close(); } catch (IOException ex) { ex.printStackTrace(); // Never } byte[] rgBytes = ostream.toByteArray(); InputStream iStream = new ByteArrayInputStream(rgBytes); try { statement.setBinaryStream(iParamColumn, iStream, rgBytes.length); } catch (java.lang.ArrayIndexOutOfBoundsException ex) { ex.printStackTrace(); } } }
java
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException { if (this.isNull()) statement.setNull(iParamColumn, Types.BLOB); else { Object data = this.getData(); ByteArrayOutputStream ostream = new ByteArrayOutputStream(); ObjectOutputStream p = null; try { p = new ObjectOutputStream(ostream); p.writeObject(data); p.flush(); ostream.close(); } catch (IOException ex) { ex.printStackTrace(); // Never } byte[] rgBytes = ostream.toByteArray(); InputStream iStream = new ByteArrayInputStream(rgBytes); try { statement.setBinaryStream(iParamColumn, iStream, rgBytes.length); } catch (java.lang.ArrayIndexOutOfBoundsException ex) { ex.printStackTrace(); } } }
[ "public", "void", "getSQLFromField", "(", "PreparedStatement", "statement", ",", "int", "iType", ",", "int", "iParamColumn", ")", "throws", "SQLException", "{", "if", "(", "this", ".", "isNull", "(", ")", ")", "statement", ".", "setNull", "(", "iParamColumn", ",", "Types", ".", "BLOB", ")", ";", "else", "{", "Object", "data", "=", "this", ".", "getData", "(", ")", ";", "ByteArrayOutputStream", "ostream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "ObjectOutputStream", "p", "=", "null", ";", "try", "{", "p", "=", "new", "ObjectOutputStream", "(", "ostream", ")", ";", "p", ".", "writeObject", "(", "data", ")", ";", "p", ".", "flush", "(", ")", ";", "ostream", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "// Never", "}", "byte", "[", "]", "rgBytes", "=", "ostream", ".", "toByteArray", "(", ")", ";", "InputStream", "iStream", "=", "new", "ByteArrayInputStream", "(", "rgBytes", ")", ";", "try", "{", "statement", ".", "setBinaryStream", "(", "iParamColumn", ",", "iStream", ",", "rgBytes", ".", "length", ")", ";", "}", "catch", "(", "java", ".", "lang", ".", "ArrayIndexOutOfBoundsException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}", "}" ]
Move the physical binary data to this SQL parameter row. This method uses the setBinaryStrem statement method. @param statement The SQL prepare statement. @param iType the type of SQL statement. @param iParamColumn The column in the prepared statement to set the data. @exception SQLException From SQL calls.
[ "Move", "the", "physical", "binary", "data", "to", "this", "SQL", "parameter", "row", ".", "This", "method", "uses", "the", "setBinaryStrem", "statement", "method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ObjectField.java#L191-L217
151,769
knowhowlab/org.knowhowlab.osgi.shell
knopflerfish/src/main/java/org/knowhowlab/osgi/shell/knopflerfish/Activator.java
Activator.isValidCommandMethod
private boolean isValidCommandMethod(Object service, String commandName) { try { service.getClass().getMethod(commandName, PrintWriter.class, String[].class); return true; } catch (NoSuchMethodException e) { return false; } }
java
private boolean isValidCommandMethod(Object service, String commandName) { try { service.getClass().getMethod(commandName, PrintWriter.class, String[].class); return true; } catch (NoSuchMethodException e) { return false; } }
[ "private", "boolean", "isValidCommandMethod", "(", "Object", "service", ",", "String", "commandName", ")", "{", "try", "{", "service", ".", "getClass", "(", ")", ".", "getMethod", "(", "commandName", ",", "PrintWriter", ".", "class", ",", "String", "[", "]", ".", "class", ")", ";", "return", "true", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "return", "false", ";", "}", "}" ]
Validate Command method @param service service instance @param commandName command method name @return <code>true</code> if method is peresent in service, <code>public</code> and has params <code>PrintStream</code> and <code>String[]</code>, otherwise - <code>false</code>
[ "Validate", "Command", "method" ]
5c3172b1e6b741c753f02af48ab42adc4915a6ae
https://github.com/knowhowlab/org.knowhowlab.osgi.shell/blob/5c3172b1e6b741c753f02af48ab42adc4915a6ae/knopflerfish/src/main/java/org/knowhowlab/osgi/shell/knopflerfish/Activator.java#L86-L93
151,770
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigItem.java
ESigItem.addIssue
public ESigItemIssue addIssue(ESigItemIssueSeverity severity, String description) { ESigItemIssue issue = new ESigItemIssue(severity, description); if (issues == null) { issues = new ArrayList<ESigItemIssue>(); sortIssues = false; } else { int i = issues.indexOf(issue); if (i >= 0) { return issues.get(i); } sortIssues = true; } issues.add(issue); return issue; }
java
public ESigItemIssue addIssue(ESigItemIssueSeverity severity, String description) { ESigItemIssue issue = new ESigItemIssue(severity, description); if (issues == null) { issues = new ArrayList<ESigItemIssue>(); sortIssues = false; } else { int i = issues.indexOf(issue); if (i >= 0) { return issues.get(i); } sortIssues = true; } issues.add(issue); return issue; }
[ "public", "ESigItemIssue", "addIssue", "(", "ESigItemIssueSeverity", "severity", ",", "String", "description", ")", "{", "ESigItemIssue", "issue", "=", "new", "ESigItemIssue", "(", "severity", ",", "description", ")", ";", "if", "(", "issues", "==", "null", ")", "{", "issues", "=", "new", "ArrayList", "<", "ESigItemIssue", ">", "(", ")", ";", "sortIssues", "=", "false", ";", "}", "else", "{", "int", "i", "=", "issues", ".", "indexOf", "(", "issue", ")", ";", "if", "(", "i", ">=", "0", ")", "{", "return", "issues", ".", "get", "(", "i", ")", ";", "}", "sortIssues", "=", "true", ";", "}", "issues", ".", "add", "(", "issue", ")", ";", "return", "issue", ";", "}" ]
Adds an issue to the signature item. @param severity Severity of the issue. @param description Description of the issue. @return The added issue.
[ "Adds", "an", "issue", "to", "the", "signature", "item", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigItem.java#L334-L352
151,771
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigItem.java
ESigItem.getIssues
public Iterable<ESigItemIssue> getIssues() { if (sortIssues) { sortIssues = false; Collections.sort(issues); } return issues; }
java
public Iterable<ESigItemIssue> getIssues() { if (sortIssues) { sortIssues = false; Collections.sort(issues); } return issues; }
[ "public", "Iterable", "<", "ESigItemIssue", ">", "getIssues", "(", ")", "{", "if", "(", "sortIssues", ")", "{", "sortIssues", "=", "false", ";", "Collections", ".", "sort", "(", "issues", ")", ";", "}", "return", "issues", ";", "}" ]
Returns an iterable of issues logged for this item. @return Iterable of all issues.
[ "Returns", "an", "iterable", "of", "issues", "logged", "for", "this", "item", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigItem.java#L359-L366
151,772
jbundle/jbundle
app/program/project/src/main/java/org/jbundle/app/program/project/screen/ProjectTaskCalendar.java
ProjectTaskCalendar.getCalendarItem
public CalendarItem getCalendarItem(Rec fieldList) { return new CalendarRecordItem(this, -1, 0, 1, 2, -1) { public Object getIcon(int iIconType) { Record recProjectControl = getRecord(ProjectControl.PROJECT_CONTROL_FILE); ImageField field = null; String fieldSeq = (iIconType == CalendarConstants.START_ICON) ? ProjectControl.START_PARENT_ICON : ProjectControl.END_PARENT_ICON; if (this.isParentTask()) field = (ImageField)recProjectControl.getField(fieldSeq); fieldSeq = (iIconType == CalendarConstants.START_ICON) ? ProjectControl.START_ICON : ProjectControl.END_ICON; if ((field == null) || (field.isNull())) field = (ImageField)recProjectControl.getField(fieldSeq); if (field.isNull()) return super.getIcon(iIconType); return field.getImage().getImage(); } public int getHighlightColor() { Record recProjectControl = getRecord(ProjectControl.PROJECT_CONTROL_FILE); ColorField field = null; if (this.isParentTask()) field = (ColorField)recProjectControl.getField(ProjectControl.PARENT_TASK_COLOR); if ((field == null) || (field.isNull())) field = (ColorField)recProjectControl.getField(ProjectControl.TASK_COLOR); if (field.isNull()) return super.getHighlightColor(); return field.getColor(); } public int getSelectColor() { Record recProjectControl = getRecord(ProjectControl.PROJECT_CONTROL_FILE); ColorField field = null; if (this.isParentTask()) field = (ColorField)recProjectControl.getField(ProjectControl.PARENT_TASK_SELECT_COLOR); if ((field == null) || (field.isNull())) field = (ColorField)recProjectControl.getField(ProjectControl.TASK_SELECT_COLOR); if (field.isNull()) return super.getSelectColor(); return field.getColor(); } public boolean isParentTask() { return ((ProjectTask)getMainRecord()).isParentTask(); } }; }
java
public CalendarItem getCalendarItem(Rec fieldList) { return new CalendarRecordItem(this, -1, 0, 1, 2, -1) { public Object getIcon(int iIconType) { Record recProjectControl = getRecord(ProjectControl.PROJECT_CONTROL_FILE); ImageField field = null; String fieldSeq = (iIconType == CalendarConstants.START_ICON) ? ProjectControl.START_PARENT_ICON : ProjectControl.END_PARENT_ICON; if (this.isParentTask()) field = (ImageField)recProjectControl.getField(fieldSeq); fieldSeq = (iIconType == CalendarConstants.START_ICON) ? ProjectControl.START_ICON : ProjectControl.END_ICON; if ((field == null) || (field.isNull())) field = (ImageField)recProjectControl.getField(fieldSeq); if (field.isNull()) return super.getIcon(iIconType); return field.getImage().getImage(); } public int getHighlightColor() { Record recProjectControl = getRecord(ProjectControl.PROJECT_CONTROL_FILE); ColorField field = null; if (this.isParentTask()) field = (ColorField)recProjectControl.getField(ProjectControl.PARENT_TASK_COLOR); if ((field == null) || (field.isNull())) field = (ColorField)recProjectControl.getField(ProjectControl.TASK_COLOR); if (field.isNull()) return super.getHighlightColor(); return field.getColor(); } public int getSelectColor() { Record recProjectControl = getRecord(ProjectControl.PROJECT_CONTROL_FILE); ColorField field = null; if (this.isParentTask()) field = (ColorField)recProjectControl.getField(ProjectControl.PARENT_TASK_SELECT_COLOR); if ((field == null) || (field.isNull())) field = (ColorField)recProjectControl.getField(ProjectControl.TASK_SELECT_COLOR); if (field.isNull()) return super.getSelectColor(); return field.getColor(); } public boolean isParentTask() { return ((ProjectTask)getMainRecord()).isParentTask(); } }; }
[ "public", "CalendarItem", "getCalendarItem", "(", "Rec", "fieldList", ")", "{", "return", "new", "CalendarRecordItem", "(", "this", ",", "-", "1", ",", "0", ",", "1", ",", "2", ",", "-", "1", ")", "{", "public", "Object", "getIcon", "(", "int", "iIconType", ")", "{", "Record", "recProjectControl", "=", "getRecord", "(", "ProjectControl", ".", "PROJECT_CONTROL_FILE", ")", ";", "ImageField", "field", "=", "null", ";", "String", "fieldSeq", "=", "(", "iIconType", "==", "CalendarConstants", ".", "START_ICON", ")", "?", "ProjectControl", ".", "START_PARENT_ICON", ":", "ProjectControl", ".", "END_PARENT_ICON", ";", "if", "(", "this", ".", "isParentTask", "(", ")", ")", "field", "=", "(", "ImageField", ")", "recProjectControl", ".", "getField", "(", "fieldSeq", ")", ";", "fieldSeq", "=", "(", "iIconType", "==", "CalendarConstants", ".", "START_ICON", ")", "?", "ProjectControl", ".", "START_ICON", ":", "ProjectControl", ".", "END_ICON", ";", "if", "(", "(", "field", "==", "null", ")", "||", "(", "field", ".", "isNull", "(", ")", ")", ")", "field", "=", "(", "ImageField", ")", "recProjectControl", ".", "getField", "(", "fieldSeq", ")", ";", "if", "(", "field", ".", "isNull", "(", ")", ")", "return", "super", ".", "getIcon", "(", "iIconType", ")", ";", "return", "field", ".", "getImage", "(", ")", ".", "getImage", "(", ")", ";", "}", "public", "int", "getHighlightColor", "(", ")", "{", "Record", "recProjectControl", "=", "getRecord", "(", "ProjectControl", ".", "PROJECT_CONTROL_FILE", ")", ";", "ColorField", "field", "=", "null", ";", "if", "(", "this", ".", "isParentTask", "(", ")", ")", "field", "=", "(", "ColorField", ")", "recProjectControl", ".", "getField", "(", "ProjectControl", ".", "PARENT_TASK_COLOR", ")", ";", "if", "(", "(", "field", "==", "null", ")", "||", "(", "field", ".", "isNull", "(", ")", ")", ")", "field", "=", "(", "ColorField", ")", "recProjectControl", ".", "getField", "(", "ProjectControl", ".", "TASK_COLOR", ")", ";", "if", "(", "field", ".", "isNull", "(", ")", ")", "return", "super", ".", "getHighlightColor", "(", ")", ";", "return", "field", ".", "getColor", "(", ")", ";", "}", "public", "int", "getSelectColor", "(", ")", "{", "Record", "recProjectControl", "=", "getRecord", "(", "ProjectControl", ".", "PROJECT_CONTROL_FILE", ")", ";", "ColorField", "field", "=", "null", ";", "if", "(", "this", ".", "isParentTask", "(", ")", ")", "field", "=", "(", "ColorField", ")", "recProjectControl", ".", "getField", "(", "ProjectControl", ".", "PARENT_TASK_SELECT_COLOR", ")", ";", "if", "(", "(", "field", "==", "null", ")", "||", "(", "field", ".", "isNull", "(", ")", ")", ")", "field", "=", "(", "ColorField", ")", "recProjectControl", ".", "getField", "(", "ProjectControl", ".", "TASK_SELECT_COLOR", ")", ";", "if", "(", "field", ".", "isNull", "(", ")", ")", "return", "super", ".", "getSelectColor", "(", ")", ";", "return", "field", ".", "getColor", "(", ")", ";", "}", "public", "boolean", "isParentTask", "(", ")", "{", "return", "(", "(", "ProjectTask", ")", "getMainRecord", "(", ")", ")", ".", "isParentTask", "(", ")", ";", "}", "}", ";", "}" ]
Get the CalendarItem for this record.
[ "Get", "the", "CalendarItem", "for", "this", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/project/src/main/java/org/jbundle/app/program/project/screen/ProjectTaskCalendar.java#L137-L184
151,773
DDTH/ddth-dlock
ddth-dlock-core/src/main/java/com/github/ddth/dlock/impl/AbstractDLock.java
AbstractDLock.setLockProperties
public AbstractDLock setLockProperties(Properties lockProps) { this.lockProps = lockProps != null ? new Properties(lockProps) : new Properties(); return this; }
java
public AbstractDLock setLockProperties(Properties lockProps) { this.lockProps = lockProps != null ? new Properties(lockProps) : new Properties(); return this; }
[ "public", "AbstractDLock", "setLockProperties", "(", "Properties", "lockProps", ")", "{", "this", ".", "lockProps", "=", "lockProps", "!=", "null", "?", "new", "Properties", "(", "lockProps", ")", ":", "new", "Properties", "(", ")", ";", "return", "this", ";", "}" ]
Lock's custom properties. @param lockProps @return
[ "Lock", "s", "custom", "properties", "." ]
56786c61a04fe505556a834133b3de36562c6cb6
https://github.com/DDTH/ddth-dlock/blob/56786c61a04fe505556a834133b3de36562c6cb6/ddth-dlock-core/src/main/java/com/github/ddth/dlock/impl/AbstractDLock.java#L110-L113
151,774
DDTH/ddth-dlock
ddth-dlock-core/src/main/java/com/github/ddth/dlock/impl/AbstractDLock.java
AbstractDLock.getLockProperty
protected String getLockProperty(String key) { return lockProps != null ? lockProps.getProperty(key) : null; }
java
protected String getLockProperty(String key) { return lockProps != null ? lockProps.getProperty(key) : null; }
[ "protected", "String", "getLockProperty", "(", "String", "key", ")", "{", "return", "lockProps", "!=", "null", "?", "lockProps", ".", "getProperty", "(", "key", ")", ":", "null", ";", "}" ]
Get lock's custom property. @param key @return
[ "Get", "lock", "s", "custom", "property", "." ]
56786c61a04fe505556a834133b3de36562c6cb6
https://github.com/DDTH/ddth-dlock/blob/56786c61a04fe505556a834133b3de36562c6cb6/ddth-dlock-core/src/main/java/com/github/ddth/dlock/impl/AbstractDLock.java#L130-L132
151,775
carewebframework/carewebframework-vista
org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentListRenderer.java
DocumentListRenderer.addCell
private void addCell(Listitem item, Object value) { createCell(item, value, null, null); }
java
private void addCell(Listitem item, Object value) { createCell(item, value, null, null); }
[ "private", "void", "addCell", "(", "Listitem", "item", ",", "Object", "value", ")", "{", "createCell", "(", "item", ",", "value", ",", "null", ",", "null", ")", ";", "}" ]
Add a cell to the list item containing the specified text value. @param item List item to receive new cell. @param value Text to include in the new cell.
[ "Add", "a", "cell", "to", "the", "list", "item", "containing", "the", "specified", "text", "value", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentListRenderer.java#L72-L74
151,776
tacitknowledge/discovery
src/main/java/com/tacitknowledge/util/discovery/ClasspathUtils.java
ClasspathUtils.getClasspathDirectories
public static List getClasspathDirectories() { List directories = new ArrayList(); List components = getClasspathComponents(); for (Iterator i = components.iterator(); i.hasNext();) { String possibleDir = (String) i.next(); File file = new File(possibleDir); if (file.isDirectory()) { directories.add(possibleDir); } } List tomcatPaths = getTomcatPaths(); if (tomcatPaths != null) { directories.addAll(tomcatPaths); } return directories; }
java
public static List getClasspathDirectories() { List directories = new ArrayList(); List components = getClasspathComponents(); for (Iterator i = components.iterator(); i.hasNext();) { String possibleDir = (String) i.next(); File file = new File(possibleDir); if (file.isDirectory()) { directories.add(possibleDir); } } List tomcatPaths = getTomcatPaths(); if (tomcatPaths != null) { directories.addAll(tomcatPaths); } return directories; }
[ "public", "static", "List", "getClasspathDirectories", "(", ")", "{", "List", "directories", "=", "new", "ArrayList", "(", ")", ";", "List", "components", "=", "getClasspathComponents", "(", ")", ";", "for", "(", "Iterator", "i", "=", "components", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "String", "possibleDir", "=", "(", "String", ")", "i", ".", "next", "(", ")", ";", "File", "file", "=", "new", "File", "(", "possibleDir", ")", ";", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "directories", ".", "add", "(", "possibleDir", ")", ";", "}", "}", "List", "tomcatPaths", "=", "getTomcatPaths", "(", ")", ";", "if", "(", "tomcatPaths", "!=", "null", ")", "{", "directories", ".", "addAll", "(", "tomcatPaths", ")", ";", "}", "return", "directories", ";", "}" ]
Returns the classpath as a list of directories. Any classpath component that is not a directory will be ignored. @return the classpath as a list of directories; if no directories can be found then an empty list will be returned
[ "Returns", "the", "classpath", "as", "a", "list", "of", "directories", ".", "Any", "classpath", "component", "that", "is", "not", "a", "directory", "will", "be", "ignored", "." ]
700f5492c9cb5c0146d684acb38b71fd4ef4e97a
https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ClasspathUtils.java#L57-L76
151,777
tacitknowledge/discovery
src/main/java/com/tacitknowledge/util/discovery/ClasspathUtils.java
ClasspathUtils.getClasspathArchives
public static List getClasspathArchives() { List archives = new ArrayList(); List components = getClasspathComponents(); for (Iterator i = components.iterator(); i.hasNext();) { String possibleDir = (String) i.next(); File file = new File(possibleDir); if (file.isFile() && (file.getName().endsWith(".jar") || file.getName().endsWith(".zip"))) { archives.add(possibleDir); } } return archives; }
java
public static List getClasspathArchives() { List archives = new ArrayList(); List components = getClasspathComponents(); for (Iterator i = components.iterator(); i.hasNext();) { String possibleDir = (String) i.next(); File file = new File(possibleDir); if (file.isFile() && (file.getName().endsWith(".jar") || file.getName().endsWith(".zip"))) { archives.add(possibleDir); } } return archives; }
[ "public", "static", "List", "getClasspathArchives", "(", ")", "{", "List", "archives", "=", "new", "ArrayList", "(", ")", ";", "List", "components", "=", "getClasspathComponents", "(", ")", ";", "for", "(", "Iterator", "i", "=", "components", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "String", "possibleDir", "=", "(", "String", ")", "i", ".", "next", "(", ")", ";", "File", "file", "=", "new", "File", "(", "possibleDir", ")", ";", "if", "(", "file", ".", "isFile", "(", ")", "&&", "(", "file", ".", "getName", "(", ")", ".", "endsWith", "(", "\".jar\"", ")", "||", "file", ".", "getName", "(", ")", ".", "endsWith", "(", "\".zip\"", ")", ")", ")", "{", "archives", ".", "add", "(", "possibleDir", ")", ";", "}", "}", "return", "archives", ";", "}" ]
Returns the classpath as a list of the names of archive files. Any classpath component that is not an archive will be ignored. @return the classpath as a list of archive file names; if no archives can be found then an empty list will be returned
[ "Returns", "the", "classpath", "as", "a", "list", "of", "the", "names", "of", "archive", "files", ".", "Any", "classpath", "component", "that", "is", "not", "an", "archive", "will", "be", "ignored", "." ]
700f5492c9cb5c0146d684acb38b71fd4ef4e97a
https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ClasspathUtils.java#L85-L100
151,778
tacitknowledge/discovery
src/main/java/com/tacitknowledge/util/discovery/ClasspathUtils.java
ClasspathUtils.getClasspathComponents
public static List getClasspathComponents() { List components = new LinkedList(); // walk the classloader hierarchy, trying to get all the components we can ClassLoader cl = Thread.currentThread().getContextClassLoader(); while ((null != cl) && (cl instanceof URLClassLoader)) { URLClassLoader ucl = (URLClassLoader) cl; components.addAll(getUrlClassLoaderClasspathComponents(ucl)); try { cl = ucl.getParent(); } catch (SecurityException se) { cl = null; } } // walking the hierarchy doesn't guarantee we get everything, so // lets grab the system classpath for good measure. String classpath = System.getProperty("java.class.path"); String separator = System.getProperty("path.separator"); StringTokenizer st = new StringTokenizer(classpath, separator); while (st.hasMoreTokens()) { String component = st.nextToken(); // Calling File.getPath() cleans up the path so that it's using // the proper path separators for the host OS component = getCanonicalPath(component); components.add(component); } // Set removes any duplicates, return a list for the api. return new LinkedList(new HashSet(components)); }
java
public static List getClasspathComponents() { List components = new LinkedList(); // walk the classloader hierarchy, trying to get all the components we can ClassLoader cl = Thread.currentThread().getContextClassLoader(); while ((null != cl) && (cl instanceof URLClassLoader)) { URLClassLoader ucl = (URLClassLoader) cl; components.addAll(getUrlClassLoaderClasspathComponents(ucl)); try { cl = ucl.getParent(); } catch (SecurityException se) { cl = null; } } // walking the hierarchy doesn't guarantee we get everything, so // lets grab the system classpath for good measure. String classpath = System.getProperty("java.class.path"); String separator = System.getProperty("path.separator"); StringTokenizer st = new StringTokenizer(classpath, separator); while (st.hasMoreTokens()) { String component = st.nextToken(); // Calling File.getPath() cleans up the path so that it's using // the proper path separators for the host OS component = getCanonicalPath(component); components.add(component); } // Set removes any duplicates, return a list for the api. return new LinkedList(new HashSet(components)); }
[ "public", "static", "List", "getClasspathComponents", "(", ")", "{", "List", "components", "=", "new", "LinkedList", "(", ")", ";", "// walk the classloader hierarchy, trying to get all the components we can", "ClassLoader", "cl", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "while", "(", "(", "null", "!=", "cl", ")", "&&", "(", "cl", "instanceof", "URLClassLoader", ")", ")", "{", "URLClassLoader", "ucl", "=", "(", "URLClassLoader", ")", "cl", ";", "components", ".", "addAll", "(", "getUrlClassLoaderClasspathComponents", "(", "ucl", ")", ")", ";", "try", "{", "cl", "=", "ucl", ".", "getParent", "(", ")", ";", "}", "catch", "(", "SecurityException", "se", ")", "{", "cl", "=", "null", ";", "}", "}", "// walking the hierarchy doesn't guarantee we get everything, so", "// lets grab the system classpath for good measure.", "String", "classpath", "=", "System", ".", "getProperty", "(", "\"java.class.path\"", ")", ";", "String", "separator", "=", "System", ".", "getProperty", "(", "\"path.separator\"", ")", ";", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "classpath", ",", "separator", ")", ";", "while", "(", "st", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "component", "=", "st", ".", "nextToken", "(", ")", ";", "// Calling File.getPath() cleans up the path so that it's using", "// the proper path separators for the host OS", "component", "=", "getCanonicalPath", "(", "component", ")", ";", "components", ".", "add", "(", "component", ")", ";", "}", "// Set removes any duplicates, return a list for the api.", "return", "new", "LinkedList", "(", "new", "HashSet", "(", "components", ")", ")", ";", "}" ]
Returns the classpath as a list directory and archive names. @return the classpath as a list of directory and archive file names; if no components can be found then an empty list will be returned
[ "Returns", "the", "classpath", "as", "a", "list", "directory", "and", "archive", "names", "." ]
700f5492c9cb5c0146d684acb38b71fd4ef4e97a
https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ClasspathUtils.java#L108-L146
151,779
tacitknowledge/discovery
src/main/java/com/tacitknowledge/util/discovery/ClasspathUtils.java
ClasspathUtils.getUrlClassLoaderClasspathComponents
private static List getUrlClassLoaderClasspathComponents(URLClassLoader ucl) { List components = new ArrayList(); URL[] urls = new URL[0]; // Workaround for running on JBoss with UnifiedClassLoader3 usage // We need to invoke getClasspath() method instead of getURLs() if (ucl.getClass().getName().equals("org.jboss.mx.loading.UnifiedClassLoader3")) { try { Method classPathMethod = ucl.getClass().getMethod("getClasspath", new Class[] {}); urls = (URL[]) classPathMethod.invoke(ucl, new Object[0]); } catch(Exception e) { LogFactory.getLog(ClasspathUtils.class).debug("Error invoking getClasspath on UnifiedClassLoader3: ", e); } } else { // Use regular ClassLoader method to get classpath urls = ucl.getURLs(); } for (int i = 0; i < urls.length; i++) { URL url = urls[i]; components.add(getCanonicalPath(url.getPath())); } return components; }
java
private static List getUrlClassLoaderClasspathComponents(URLClassLoader ucl) { List components = new ArrayList(); URL[] urls = new URL[0]; // Workaround for running on JBoss with UnifiedClassLoader3 usage // We need to invoke getClasspath() method instead of getURLs() if (ucl.getClass().getName().equals("org.jboss.mx.loading.UnifiedClassLoader3")) { try { Method classPathMethod = ucl.getClass().getMethod("getClasspath", new Class[] {}); urls = (URL[]) classPathMethod.invoke(ucl, new Object[0]); } catch(Exception e) { LogFactory.getLog(ClasspathUtils.class).debug("Error invoking getClasspath on UnifiedClassLoader3: ", e); } } else { // Use regular ClassLoader method to get classpath urls = ucl.getURLs(); } for (int i = 0; i < urls.length; i++) { URL url = urls[i]; components.add(getCanonicalPath(url.getPath())); } return components; }
[ "private", "static", "List", "getUrlClassLoaderClasspathComponents", "(", "URLClassLoader", "ucl", ")", "{", "List", "components", "=", "new", "ArrayList", "(", ")", ";", "URL", "[", "]", "urls", "=", "new", "URL", "[", "0", "]", ";", "// Workaround for running on JBoss with UnifiedClassLoader3 usage", "// We need to invoke getClasspath() method instead of getURLs()", "if", "(", "ucl", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "\"org.jboss.mx.loading.UnifiedClassLoader3\"", ")", ")", "{", "try", "{", "Method", "classPathMethod", "=", "ucl", ".", "getClass", "(", ")", ".", "getMethod", "(", "\"getClasspath\"", ",", "new", "Class", "[", "]", "{", "}", ")", ";", "urls", "=", "(", "URL", "[", "]", ")", "classPathMethod", ".", "invoke", "(", "ucl", ",", "new", "Object", "[", "0", "]", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LogFactory", ".", "getLog", "(", "ClasspathUtils", ".", "class", ")", ".", "debug", "(", "\"Error invoking getClasspath on UnifiedClassLoader3: \"", ",", "e", ")", ";", "}", "}", "else", "{", "// Use regular ClassLoader method to get classpath", "urls", "=", "ucl", ".", "getURLs", "(", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "urls", ".", "length", ";", "i", "++", ")", "{", "URL", "url", "=", "urls", "[", "i", "]", ";", "components", ".", "add", "(", "getCanonicalPath", "(", "url", ".", "getPath", "(", ")", ")", ")", ";", "}", "return", "components", ";", "}" ]
Get the list of classpath components @param ucl url classloader @return List of classpath components
[ "Get", "the", "list", "of", "classpath", "components" ]
700f5492c9cb5c0146d684acb38b71fd4ef4e97a
https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ClasspathUtils.java#L172-L205
151,780
krotscheck/jersey2-toolkit
jersey2-vfs2/src/main/java/net/krotscheck/jersey2/vfs2/FileSystemManagerFactory.java
FileSystemManagerFactory.provide
@Override public FileSystemManager provide() { try { return VFS.getManager(); } catch (FileSystemException fse) { logger.error("Cannot create FileSystemManager", fse); throw new RuntimeException("Cannot create FileSystemManager", fse); } }
java
@Override public FileSystemManager provide() { try { return VFS.getManager(); } catch (FileSystemException fse) { logger.error("Cannot create FileSystemManager", fse); throw new RuntimeException("Cannot create FileSystemManager", fse); } }
[ "@", "Override", "public", "FileSystemManager", "provide", "(", ")", "{", "try", "{", "return", "VFS", ".", "getManager", "(", ")", ";", "}", "catch", "(", "FileSystemException", "fse", ")", "{", "logger", ".", "error", "(", "\"Cannot create FileSystemManager\"", ",", "fse", ")", ";", "throw", "new", "RuntimeException", "(", "\"Cannot create FileSystemManager\"", ",", "fse", ")", ";", "}", "}" ]
Provide the file system manager. @return A file system manager instance.
[ "Provide", "the", "file", "system", "manager", "." ]
11d757bd222dc82ada462caf6730ba4ff85dae04
https://github.com/krotscheck/jersey2-toolkit/blob/11d757bd222dc82ada462caf6730ba4ff85dae04/jersey2-vfs2/src/main/java/net/krotscheck/jersey2/vfs2/FileSystemManagerFactory.java#L50-L58
151,781
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/util/ReportToolbar.java
ReportToolbar.setupMiddleSFields
public void setupMiddleSFields() { new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON_WITH_GAP, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.DISPLAY); new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON_WITH_GAP, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.PRINT); }
java
public void setupMiddleSFields() { new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON_WITH_GAP, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.DISPLAY); new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON_WITH_GAP, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.PRINT); }
[ "public", "void", "setupMiddleSFields", "(", ")", "{", "new", "SCannedBox", "(", "this", ".", "getNextLocation", "(", "ScreenConstants", ".", "RIGHT_OF_LAST_BUTTON_WITH_GAP", ",", "ScreenConstants", ".", "SET_ANCHOR", ")", ",", "this", ",", "null", ",", "ScreenConstants", ".", "DEFAULT_DISPLAY", ",", "MenuConstants", ".", "DISPLAY", ")", ";", "new", "SCannedBox", "(", "this", ".", "getNextLocation", "(", "ScreenConstants", ".", "RIGHT_OF_LAST_BUTTON_WITH_GAP", ",", "ScreenConstants", ".", "SET_ANCHOR", ")", ",", "this", ",", "null", ",", "ScreenConstants", ".", "DEFAULT_DISPLAY", ",", "MenuConstants", ".", "PRINT", ")", ";", "}" ]
Controls for a report screen.
[ "Controls", "for", "a", "report", "screen", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/util/ReportToolbar.java#L68-L72
151,782
js-lib-com/commons
src/main/java/js/util/Base64.java
Base64.encode
public static String encode(String string) { try { return encode(string.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new BugError("JVM with missing support for UTF-8."); } }
java
public static String encode(String string) { try { return encode(string.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new BugError("JVM with missing support for UTF-8."); } }
[ "public", "static", "String", "encode", "(", "String", "string", ")", "{", "try", "{", "return", "encode", "(", "string", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "BugError", "(", "\"JVM with missing support for UTF-8.\"", ")", ";", "}", "}" ]
Encode string value into Base64 format. @param string string to encode. @return given <code>string</code> value encoded Base64.
[ "Encode", "string", "value", "into", "Base64", "format", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Base64.java#L59-L65
151,783
js-lib-com/commons
src/main/java/js/util/Base64.java
Base64.decode
public static byte[] decode(String base64) { int iLen = base64.length(); if (iLen % 4 != 0) { throw new IllegalArgumentException("Length of Base64 encoded input string is not a multiple of 4."); } // remove trailing padding while (iLen > 0 && base64.charAt(iLen - 1) == '=') { iLen--; } int oLen = (iLen * 3) / 4; byte[] out = new byte[oLen]; int ip = 0, op = 0; while (ip < iLen) { int i0 = base64.charAt(ip++); int i1 = base64.charAt(ip++); int i2 = ip < iLen ? base64.charAt(ip++) : 'A'; int i3 = ip < iLen ? base64.charAt(ip++) : 'A'; if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127) { throw new IllegalArgumentException("Illegal character in Base64 encoded data."); } int b0 = CHARS_2_NIBLES[i0]; int b1 = CHARS_2_NIBLES[i1]; int b2 = CHARS_2_NIBLES[i2]; int b3 = CHARS_2_NIBLES[i3]; if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0) { throw new IllegalArgumentException("Illegal character in Base64 encoded data."); } int o0 = (b0 << 2) | (b1 >>> 4); int o1 = ((b1 & 0xf) << 4) | (b2 >>> 2); int o2 = ((b2 & 3) << 6) | b3; out[op++] = (byte) o0; if (op < oLen) { out[op++] = (byte) o1; } if (op < oLen) { out[op++] = (byte) o2; } } return out; }
java
public static byte[] decode(String base64) { int iLen = base64.length(); if (iLen % 4 != 0) { throw new IllegalArgumentException("Length of Base64 encoded input string is not a multiple of 4."); } // remove trailing padding while (iLen > 0 && base64.charAt(iLen - 1) == '=') { iLen--; } int oLen = (iLen * 3) / 4; byte[] out = new byte[oLen]; int ip = 0, op = 0; while (ip < iLen) { int i0 = base64.charAt(ip++); int i1 = base64.charAt(ip++); int i2 = ip < iLen ? base64.charAt(ip++) : 'A'; int i3 = ip < iLen ? base64.charAt(ip++) : 'A'; if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127) { throw new IllegalArgumentException("Illegal character in Base64 encoded data."); } int b0 = CHARS_2_NIBLES[i0]; int b1 = CHARS_2_NIBLES[i1]; int b2 = CHARS_2_NIBLES[i2]; int b3 = CHARS_2_NIBLES[i3]; if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0) { throw new IllegalArgumentException("Illegal character in Base64 encoded data."); } int o0 = (b0 << 2) | (b1 >>> 4); int o1 = ((b1 & 0xf) << 4) | (b2 >>> 2); int o2 = ((b2 & 3) << 6) | b3; out[op++] = (byte) o0; if (op < oLen) { out[op++] = (byte) o1; } if (op < oLen) { out[op++] = (byte) o2; } } return out; }
[ "public", "static", "byte", "[", "]", "decode", "(", "String", "base64", ")", "{", "int", "iLen", "=", "base64", ".", "length", "(", ")", ";", "if", "(", "iLen", "%", "4", "!=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Length of Base64 encoded input string is not a multiple of 4.\"", ")", ";", "}", "// remove trailing padding\r", "while", "(", "iLen", ">", "0", "&&", "base64", ".", "charAt", "(", "iLen", "-", "1", ")", "==", "'", "'", ")", "{", "iLen", "--", ";", "}", "int", "oLen", "=", "(", "iLen", "*", "3", ")", "/", "4", ";", "byte", "[", "]", "out", "=", "new", "byte", "[", "oLen", "]", ";", "int", "ip", "=", "0", ",", "op", "=", "0", ";", "while", "(", "ip", "<", "iLen", ")", "{", "int", "i0", "=", "base64", ".", "charAt", "(", "ip", "++", ")", ";", "int", "i1", "=", "base64", ".", "charAt", "(", "ip", "++", ")", ";", "int", "i2", "=", "ip", "<", "iLen", "?", "base64", ".", "charAt", "(", "ip", "++", ")", ":", "'", "'", ";", "int", "i3", "=", "ip", "<", "iLen", "?", "base64", ".", "charAt", "(", "ip", "++", ")", ":", "'", "'", ";", "if", "(", "i0", ">", "127", "||", "i1", ">", "127", "||", "i2", ">", "127", "||", "i3", ">", "127", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Illegal character in Base64 encoded data.\"", ")", ";", "}", "int", "b0", "=", "CHARS_2_NIBLES", "[", "i0", "]", ";", "int", "b1", "=", "CHARS_2_NIBLES", "[", "i1", "]", ";", "int", "b2", "=", "CHARS_2_NIBLES", "[", "i2", "]", ";", "int", "b3", "=", "CHARS_2_NIBLES", "[", "i3", "]", ";", "if", "(", "b0", "<", "0", "||", "b1", "<", "0", "||", "b2", "<", "0", "||", "b3", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Illegal character in Base64 encoded data.\"", ")", ";", "}", "int", "o0", "=", "(", "b0", "<<", "2", ")", "|", "(", "b1", ">>>", "4", ")", ";", "int", "o1", "=", "(", "(", "b1", "&", "0xf", ")", "<<", "4", ")", "|", "(", "b2", ">>>", "2", ")", ";", "int", "o2", "=", "(", "(", "b2", "&", "3", ")", "<<", "6", ")", "|", "b3", ";", "out", "[", "op", "++", "]", "=", "(", "byte", ")", "o0", ";", "if", "(", "op", "<", "oLen", ")", "{", "out", "[", "op", "++", "]", "=", "(", "byte", ")", "o1", ";", "}", "if", "(", "op", "<", "oLen", ")", "{", "out", "[", "op", "++", "]", "=", "(", "byte", ")", "o2", ";", "}", "}", "return", "out", ";", "}" ]
Decodes a byte array from a Base64 formated string. No blanks or line breaks are allowed within the Base64 encoded data. @param base64 a character array containing the Base64 encoded data. @return an array containing the decoded data bytes. @throws IllegalArgumentException if the input is not valid Base64 encoded data.
[ "Decodes", "a", "byte", "array", "from", "a", "Base64", "formated", "string", ".", "No", "blanks", "or", "line", "breaks", "are", "allowed", "within", "the", "Base64", "encoded", "data", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Base64.java#L106-L150
151,784
Stratio/stratio-connector-commons
connector-commons/src/main/java/com/stratio/connector/commons/connection/Connection.java
Connection.getSessionObject
public <T> T getSessionObject(Class<T> type, String name) { T value = (T) session.get(name); if (logger.isDebugEnabled()) { logger.debug("Recovering object [" + name + "] from session with value [" + value + "]"); } return value; }
java
public <T> T getSessionObject(Class<T> type, String name) { T value = (T) session.get(name); if (logger.isDebugEnabled()) { logger.debug("Recovering object [" + name + "] from session with value [" + value + "]"); } return value; }
[ "public", "<", "T", ">", "T", "getSessionObject", "(", "Class", "<", "T", ">", "type", ",", "String", "name", ")", "{", "T", "value", "=", "(", "T", ")", "session", ".", "get", "(", "name", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Recovering object [\"", "+", "name", "+", "\"] from session with value [\"", "+", "value", "+", "\"]\"", ")", ";", "}", "return", "value", ";", "}" ]
Recovered a object from the session. @param type the object type. @param name the object name. @param <T> the object type. @return the object.
[ "Recovered", "a", "object", "from", "the", "session", "." ]
d7cc66cb9591344a13055962e87a91f01c3707d1
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/connection/Connection.java#L65-L72
151,785
Stratio/stratio-connector-commons
connector-commons/src/main/java/com/stratio/connector/commons/connection/Connection.java
Connection.addObjectToSession
public void addObjectToSession(String name, Object value) { if (session == null) { session = new HashMap<>(); } if (logger.isDebugEnabled()) { logger.debug("Add object [" + name + "] to session with value [" + value + "]"); } session.put(name, value); }
java
public void addObjectToSession(String name, Object value) { if (session == null) { session = new HashMap<>(); } if (logger.isDebugEnabled()) { logger.debug("Add object [" + name + "] to session with value [" + value + "]"); } session.put(name, value); }
[ "public", "void", "addObjectToSession", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "session", "==", "null", ")", "{", "session", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Add object [\"", "+", "name", "+", "\"] to session with value [\"", "+", "value", "+", "\"]\"", ")", ";", "}", "session", ".", "put", "(", "name", ",", "value", ")", ";", "}" ]
Add a object into the session. @param name the object name. @param value the objecet value.
[ "Add", "a", "object", "into", "the", "session", "." ]
d7cc66cb9591344a13055962e87a91f01c3707d1
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/connection/Connection.java#L80-L88
151,786
Stratio/stratio-connector-commons
connector-commons/src/main/java/com/stratio/connector/commons/connection/Connection.java
Connection.setJobInProgress
public void setJobInProgress(Boolean workInProgress) { lastDateInfo = new SimpleDateFormat(FILENAME_DATE_PATTERN).format(new Date()); this.jobInProgress = workInProgress; }
java
public void setJobInProgress(Boolean workInProgress) { lastDateInfo = new SimpleDateFormat(FILENAME_DATE_PATTERN).format(new Date()); this.jobInProgress = workInProgress; }
[ "public", "void", "setJobInProgress", "(", "Boolean", "workInProgress", ")", "{", "lastDateInfo", "=", "new", "SimpleDateFormat", "(", "FILENAME_DATE_PATTERN", ")", ".", "format", "(", "new", "Date", "(", ")", ")", ";", "this", ".", "jobInProgress", "=", "workInProgress", ";", "}" ]
Set the connection status. @param workInProgress the connection work status.
[ "Set", "the", "connection", "status", "." ]
d7cc66cb9591344a13055962e87a91f01c3707d1
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/connection/Connection.java#L132-L135
151,787
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/RecordList.java
RecordList.free
public void free(RecordOwner recordOwner) { if (m_ScreenRecord != null) if ((recordOwner == null) || (m_ScreenRecord.getRecordOwner() == recordOwner)) { m_ScreenRecord.free(); // Delete the screen fields m_ScreenRecord = null; } while (this.size() > 0) { Record record = (Record)this.elementAt(0); if ((recordOwner == null) || (record.getRecordOwner() == recordOwner)) record.free(); else this.removeRecord(record); // Remove the query from this list } this.removeAllElements(); }
java
public void free(RecordOwner recordOwner) { if (m_ScreenRecord != null) if ((recordOwner == null) || (m_ScreenRecord.getRecordOwner() == recordOwner)) { m_ScreenRecord.free(); // Delete the screen fields m_ScreenRecord = null; } while (this.size() > 0) { Record record = (Record)this.elementAt(0); if ((recordOwner == null) || (record.getRecordOwner() == recordOwner)) record.free(); else this.removeRecord(record); // Remove the query from this list } this.removeAllElements(); }
[ "public", "void", "free", "(", "RecordOwner", "recordOwner", ")", "{", "if", "(", "m_ScreenRecord", "!=", "null", ")", "if", "(", "(", "recordOwner", "==", "null", ")", "||", "(", "m_ScreenRecord", ".", "getRecordOwner", "(", ")", "==", "recordOwner", ")", ")", "{", "m_ScreenRecord", ".", "free", "(", ")", ";", "// Delete the screen fields", "m_ScreenRecord", "=", "null", ";", "}", "while", "(", "this", ".", "size", "(", ")", ">", "0", ")", "{", "Record", "record", "=", "(", "Record", ")", "this", ".", "elementAt", "(", "0", ")", ";", "if", "(", "(", "recordOwner", "==", "null", ")", "||", "(", "record", ".", "getRecordOwner", "(", ")", "==", "recordOwner", ")", ")", "record", ".", "free", "(", ")", ";", "else", "this", ".", "removeRecord", "(", "record", ")", ";", "// Remove the query from this list", "}", "this", ".", "removeAllElements", "(", ")", ";", "}" ]
Free all the records in this list. @param recordOwner Free records that have this recordowner (if null, free all records).
[ "Free", "all", "the", "records", "in", "this", "list", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/RecordList.java#L70-L88
151,788
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/RecordList.java
RecordList.addRecord
public void addRecord(Rec record, boolean bMainQuery) { if (record == null) return; if (this.contains(record)) { // Don't add this twice. if (!bMainQuery) return; this.removeRecord(record); // Change order } if (bMainQuery) this.insertElementAt(record, 0); else this.addElement(record); }
java
public void addRecord(Rec record, boolean bMainQuery) { if (record == null) return; if (this.contains(record)) { // Don't add this twice. if (!bMainQuery) return; this.removeRecord(record); // Change order } if (bMainQuery) this.insertElementAt(record, 0); else this.addElement(record); }
[ "public", "void", "addRecord", "(", "Rec", "record", ",", "boolean", "bMainQuery", ")", "{", "if", "(", "record", "==", "null", ")", "return", ";", "if", "(", "this", ".", "contains", "(", "record", ")", ")", "{", "// Don't add this twice.", "if", "(", "!", "bMainQuery", ")", "return", ";", "this", ".", "removeRecord", "(", "record", ")", ";", "// Change order", "}", "if", "(", "bMainQuery", ")", "this", ".", "insertElementAt", "(", "record", ",", "0", ")", ";", "else", "this", ".", "addElement", "(", "record", ")", ";", "}" ]
Add this record to this list. @param record The record to add. @param bMainQuery If this is the main record.
[ "Add", "this", "record", "to", "this", "list", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/RecordList.java#L102-L116
151,789
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/RecordList.java
RecordList.getMainRecord
public Record getMainRecord() { Record record = null; if (this.size() > 0) { record = (Record)this.firstElement(); if (record != null) if (record == this.getScreenRecord()) { record = null; if (this.size() >= 2) record = (Record)this.elementAt(1); } } return record; }
java
public Record getMainRecord() { Record record = null; if (this.size() > 0) { record = (Record)this.firstElement(); if (record != null) if (record == this.getScreenRecord()) { record = null; if (this.size() >= 2) record = (Record)this.elementAt(1); } } return record; }
[ "public", "Record", "getMainRecord", "(", ")", "{", "Record", "record", "=", "null", ";", "if", "(", "this", ".", "size", "(", ")", ">", "0", ")", "{", "record", "=", "(", "Record", ")", "this", ".", "firstElement", "(", ")", ";", "if", "(", "record", "!=", "null", ")", "if", "(", "record", "==", "this", ".", "getScreenRecord", "(", ")", ")", "{", "record", "=", "null", ";", "if", "(", "this", ".", "size", "(", ")", ">=", "2", ")", "record", "=", "(", "Record", ")", "this", ".", "elementAt", "(", "1", ")", ";", "}", "}", "return", "record", ";", "}" ]
Get the main record for this list. @return The main record (or null if none).
[ "Get", "the", "main", "record", "for", "this", "list", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/RecordList.java#L150-L164
151,790
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/RecordList.java
RecordList.getRecordAt
public Record getRecordAt(int i) { i -= DBConstants.MAIN_FIELD; // Zero based index try { return (Record)this.elementAt(i); } catch (ArrayIndexOutOfBoundsException e) { } return null; // Not found }
java
public Record getRecordAt(int i) { i -= DBConstants.MAIN_FIELD; // Zero based index try { return (Record)this.elementAt(i); } catch (ArrayIndexOutOfBoundsException e) { } return null; // Not found }
[ "public", "Record", "getRecordAt", "(", "int", "i", ")", "{", "i", "-=", "DBConstants", ".", "MAIN_FIELD", ";", "// Zero based index", "try", "{", "return", "(", "Record", ")", "this", ".", "elementAt", "(", "i", ")", ";", "}", "catch", "(", "ArrayIndexOutOfBoundsException", "e", ")", "{", "}", "return", "null", ";", "// Not found", "}" ]
Get the record as this position in the record list. @param i Index @return The record at this location (or null).
[ "Get", "the", "record", "as", "this", "position", "in", "the", "record", "list", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/RecordList.java#L170-L178
151,791
carewebframework/carewebframework-vista
org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/common/CoverSheetBase.java
CoverSheetBase.loadData
@Override protected void loadData() { if (patient == null) { asyncAbort(); reset(); status("No patient selected."); } else { super.loadData(); } detailView.setValue(null); }
java
@Override protected void loadData() { if (patient == null) { asyncAbort(); reset(); status("No patient selected."); } else { super.loadData(); } detailView.setValue(null); }
[ "@", "Override", "protected", "void", "loadData", "(", ")", "{", "if", "(", "patient", "==", "null", ")", "{", "asyncAbort", "(", ")", ";", "reset", "(", ")", ";", "status", "(", "\"No patient selected.\"", ")", ";", "}", "else", "{", "super", ".", "loadData", "(", ")", ";", "}", "detailView", ".", "setValue", "(", "null", ")", ";", "}" ]
Override load list to clear display if no patient in context.
[ "Override", "load", "list", "to", "clear", "display", "if", "no", "patient", "in", "context", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/common/CoverSheetBase.java#L112-L123
151,792
carewebframework/carewebframework-vista
org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/common/CoverSheetBase.java
CoverSheetBase.showDetail
protected void showDetail(Listitem li) { @SuppressWarnings("unchecked") T value = li == null ? null : (T) li.getValue(); String detail = value == null ? null : getDetail(value); detailView.setValue(detail); if (!getShowDetailPane() && detail != null) { ReportBox.modal(detail, detailTitle, getAllowPrint()); } }
java
protected void showDetail(Listitem li) { @SuppressWarnings("unchecked") T value = li == null ? null : (T) li.getValue(); String detail = value == null ? null : getDetail(value); detailView.setValue(detail); if (!getShowDetailPane() && detail != null) { ReportBox.modal(detail, detailTitle, getAllowPrint()); } }
[ "protected", "void", "showDetail", "(", "Listitem", "li", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "T", "value", "=", "li", "==", "null", "?", "null", ":", "(", "T", ")", "li", ".", "getValue", "(", ")", ";", "String", "detail", "=", "value", "==", "null", "?", "null", ":", "getDetail", "(", "value", ")", ";", "detailView", ".", "setValue", "(", "detail", ")", ";", "if", "(", "!", "getShowDetailPane", "(", ")", "&&", "detail", "!=", "null", ")", "{", "ReportBox", ".", "modal", "(", "detail", ",", "detailTitle", ",", "getAllowPrint", "(", ")", ")", ";", "}", "}" ]
Show detail for specified list item. @param li The list item.
[ "Show", "detail", "for", "specified", "list", "item", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/common/CoverSheetBase.java#L135-L144
151,793
aequologica/geppaequo
geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java
MethodUtils.setMethodAccessible
private static void setMethodAccessible(Method method) { try { // // XXX Default access superclass workaround // // When a public class has a default access superclass // with public methods, these methods are accessible. // Calling them from compiled code works fine. // // Unfortunately, using reflection to invoke these methods // seems to (wrongly) to prevent access even when the method // modifer is public. // // The following workaround solves the problem but will only // work from sufficiently privilages code. // // Better workarounds would be greatfully accepted. // if (!method.isAccessible()) { method.setAccessible(true); } } catch (SecurityException se) { // log but continue just in case the method.invoke works anyway // Log log = LogFactory.getLog(MethodUtils.class); if (!loggedAccessibleWarning) { boolean vulnerableJVM = false; try { String specVersion = System.getProperty("java.specification.version"); if (specVersion.charAt(0) == '1' && (specVersion.charAt(2) == '0' || specVersion.charAt(2) == '1' || specVersion.charAt(2) == '2' || specVersion.charAt(2) == '3')) { vulnerableJVM = true; } } catch (SecurityException e) { // don't know - so display warning vulnerableJVM = true; } if (vulnerableJVM) { log.warn( "Current Security Manager restricts use of workarounds for reflection bugs " + " in pre-1.4 JVMs."); } loggedAccessibleWarning = true; } log.debug("Cannot setAccessible on method. Therefore cannot use jvm access bug workaround.", se); } }
java
private static void setMethodAccessible(Method method) { try { // // XXX Default access superclass workaround // // When a public class has a default access superclass // with public methods, these methods are accessible. // Calling them from compiled code works fine. // // Unfortunately, using reflection to invoke these methods // seems to (wrongly) to prevent access even when the method // modifer is public. // // The following workaround solves the problem but will only // work from sufficiently privilages code. // // Better workarounds would be greatfully accepted. // if (!method.isAccessible()) { method.setAccessible(true); } } catch (SecurityException se) { // log but continue just in case the method.invoke works anyway // Log log = LogFactory.getLog(MethodUtils.class); if (!loggedAccessibleWarning) { boolean vulnerableJVM = false; try { String specVersion = System.getProperty("java.specification.version"); if (specVersion.charAt(0) == '1' && (specVersion.charAt(2) == '0' || specVersion.charAt(2) == '1' || specVersion.charAt(2) == '2' || specVersion.charAt(2) == '3')) { vulnerableJVM = true; } } catch (SecurityException e) { // don't know - so display warning vulnerableJVM = true; } if (vulnerableJVM) { log.warn( "Current Security Manager restricts use of workarounds for reflection bugs " + " in pre-1.4 JVMs."); } loggedAccessibleWarning = true; } log.debug("Cannot setAccessible on method. Therefore cannot use jvm access bug workaround.", se); } }
[ "private", "static", "void", "setMethodAccessible", "(", "Method", "method", ")", "{", "try", "{", "//\r", "// XXX Default access superclass workaround\r", "//\r", "// When a public class has a default access superclass\r", "// with public methods, these methods are accessible.\r", "// Calling them from compiled code works fine.\r", "//\r", "// Unfortunately, using reflection to invoke these methods\r", "// seems to (wrongly) to prevent access even when the method\r", "// modifer is public.\r", "//\r", "// The following workaround solves the problem but will only\r", "// work from sufficiently privilages code.\r", "//\r", "// Better workarounds would be greatfully accepted.\r", "//\r", "if", "(", "!", "method", ".", "isAccessible", "(", ")", ")", "{", "method", ".", "setAccessible", "(", "true", ")", ";", "}", "}", "catch", "(", "SecurityException", "se", ")", "{", "// log but continue just in case the method.invoke works anyway\r", "// Log log = LogFactory.getLog(MethodUtils.class);\r", "if", "(", "!", "loggedAccessibleWarning", ")", "{", "boolean", "vulnerableJVM", "=", "false", ";", "try", "{", "String", "specVersion", "=", "System", ".", "getProperty", "(", "\"java.specification.version\"", ")", ";", "if", "(", "specVersion", ".", "charAt", "(", "0", ")", "==", "'", "'", "&&", "(", "specVersion", ".", "charAt", "(", "2", ")", "==", "'", "'", "||", "specVersion", ".", "charAt", "(", "2", ")", "==", "'", "'", "||", "specVersion", ".", "charAt", "(", "2", ")", "==", "'", "'", "||", "specVersion", ".", "charAt", "(", "2", ")", "==", "'", "'", ")", ")", "{", "vulnerableJVM", "=", "true", ";", "}", "}", "catch", "(", "SecurityException", "e", ")", "{", "// don't know - so display warning\r", "vulnerableJVM", "=", "true", ";", "}", "if", "(", "vulnerableJVM", ")", "{", "log", ".", "warn", "(", "\"Current Security Manager restricts use of workarounds for reflection bugs \"", "+", "\" in pre-1.4 JVMs.\"", ")", ";", "}", "loggedAccessibleWarning", "=", "true", ";", "}", "log", ".", "debug", "(", "\"Cannot setAccessible on method. Therefore cannot use jvm access bug workaround.\"", ",", "se", ")", ";", "}", "}" ]
Try to make the method accessible @param method The source arguments
[ "Try", "to", "make", "the", "method", "accessible" ]
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L1044-L1094
151,794
aequologica/geppaequo
geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java
MethodUtils.toNonPrimitiveClass
public static Class<?> toNonPrimitiveClass(Class<?> clazz) { if (clazz.isPrimitive()) { Class<?> primitiveClazz = MethodUtils.getPrimitiveWrapper(clazz); // the above method returns if (primitiveClazz != null) { return primitiveClazz; } else { return clazz; } } else { return clazz; } }
java
public static Class<?> toNonPrimitiveClass(Class<?> clazz) { if (clazz.isPrimitive()) { Class<?> primitiveClazz = MethodUtils.getPrimitiveWrapper(clazz); // the above method returns if (primitiveClazz != null) { return primitiveClazz; } else { return clazz; } } else { return clazz; } }
[ "public", "static", "Class", "<", "?", ">", "toNonPrimitiveClass", "(", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", ".", "isPrimitive", "(", ")", ")", "{", "Class", "<", "?", ">", "primitiveClazz", "=", "MethodUtils", ".", "getPrimitiveWrapper", "(", "clazz", ")", ";", "// the above method returns\r", "if", "(", "primitiveClazz", "!=", "null", ")", "{", "return", "primitiveClazz", ";", "}", "else", "{", "return", "clazz", ";", "}", "}", "else", "{", "return", "clazz", ";", "}", "}" ]
Find a non primitive representation for given primitive class. @param clazz the class to find a representation for, not null @return the original class if it not a primitive. Otherwise the wrapper class. Not null
[ "Find", "a", "non", "primitive", "representation", "for", "given", "primitive", "class", "." ]
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L1264-L1276
151,795
aequologica/geppaequo
geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java
MethodUtils.getCachedMethod
private static Method getCachedMethod(MethodDescriptor md) { if (CACHE_METHODS) { Reference<Method> methodRef = cache.get(md); if (methodRef != null) { return methodRef.get(); } } return null; }
java
private static Method getCachedMethod(MethodDescriptor md) { if (CACHE_METHODS) { Reference<Method> methodRef = cache.get(md); if (methodRef != null) { return methodRef.get(); } } return null; }
[ "private", "static", "Method", "getCachedMethod", "(", "MethodDescriptor", "md", ")", "{", "if", "(", "CACHE_METHODS", ")", "{", "Reference", "<", "Method", ">", "methodRef", "=", "cache", ".", "get", "(", "md", ")", ";", "if", "(", "methodRef", "!=", "null", ")", "{", "return", "methodRef", ".", "get", "(", ")", ";", "}", "}", "return", "null", ";", "}" ]
Return the method from the cache, if present. @param md The method descriptor @return The cached method
[ "Return", "the", "method", "from", "the", "cache", "if", "present", "." ]
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L1285-L1293
151,796
aequologica/geppaequo
geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java
MethodUtils.cacheMethod
private static void cacheMethod(MethodDescriptor md, Method method) { if (CACHE_METHODS) { if (method != null) { cache.put(md, new WeakReference<Method>(method)); } } }
java
private static void cacheMethod(MethodDescriptor md, Method method) { if (CACHE_METHODS) { if (method != null) { cache.put(md, new WeakReference<Method>(method)); } } }
[ "private", "static", "void", "cacheMethod", "(", "MethodDescriptor", "md", ",", "Method", "method", ")", "{", "if", "(", "CACHE_METHODS", ")", "{", "if", "(", "method", "!=", "null", ")", "{", "cache", ".", "put", "(", "md", ",", "new", "WeakReference", "<", "Method", ">", "(", "method", ")", ")", ";", "}", "}", "}" ]
Add a method to the cache. @param md The method descriptor @param method The method to cache
[ "Add", "a", "method", "to", "the", "cache", "." ]
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L1301-L1307
151,797
tvesalainen/util
util/src/main/java/org/vesalainen/math/Matrices.java
Matrices.findRow
public static int findRow(DenseMatrix64F m, double... row) { int cols = m.numCols; if (row.length != cols) { throw new IllegalArgumentException("illegal column count"); } double[] d = m.data; int rows = m.numRows; for (int r=0;r<rows;r++) { boolean eq=true; for (int c=0;c<cols;c++) { if (d[cols*r+c] != row[c]) { eq = false; break; } } if (eq) { return r; } } return -1; }
java
public static int findRow(DenseMatrix64F m, double... row) { int cols = m.numCols; if (row.length != cols) { throw new IllegalArgumentException("illegal column count"); } double[] d = m.data; int rows = m.numRows; for (int r=0;r<rows;r++) { boolean eq=true; for (int c=0;c<cols;c++) { if (d[cols*r+c] != row[c]) { eq = false; break; } } if (eq) { return r; } } return -1; }
[ "public", "static", "int", "findRow", "(", "DenseMatrix64F", "m", ",", "double", "...", "row", ")", "{", "int", "cols", "=", "m", ".", "numCols", ";", "if", "(", "row", ".", "length", "!=", "cols", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"illegal column count\"", ")", ";", "}", "double", "[", "]", "d", "=", "m", ".", "data", ";", "int", "rows", "=", "m", ".", "numRows", ";", "for", "(", "int", "r", "=", "0", ";", "r", "<", "rows", ";", "r", "++", ")", "{", "boolean", "eq", "=", "true", ";", "for", "(", "int", "c", "=", "0", ";", "c", "<", "cols", ";", "c", "++", ")", "{", "if", "(", "d", "[", "cols", "*", "r", "+", "c", "]", "!=", "row", "[", "c", "]", ")", "{", "eq", "=", "false", ";", "break", ";", "}", "}", "if", "(", "eq", ")", "{", "return", "r", ";", "}", "}", "return", "-", "1", ";", "}" ]
Returns found row number or -1. @param m @param row @return
[ "Returns", "found", "row", "number", "or", "-", "1", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Matrices.java#L54-L80
151,798
tvesalainen/util
util/src/main/java/org/vesalainen/math/Matrices.java
Matrices.removeEqualRows
public static void removeEqualRows(DenseMatrix64F matrix) { int rows = matrix.numRows; if (rows < 2) { return; } double[] d = matrix.data; int cols = matrix.numCols; int left = rows-1; int delta = 0; for (int i=0;i<left;i++) { int j=i; for (;j<left && eq(d, i, j+1, cols);j++); if (i != j) { int cnt = j-i; System.arraycopy(d, cols*j, d, cols*i, cols*(left-j+1)); left -= cnt; delta += cnt; } } if (eq(d, 0, rows-1, cols)) { delta++; } if (delta > 0) { matrix.reshape(rows-delta, cols, true); } }
java
public static void removeEqualRows(DenseMatrix64F matrix) { int rows = matrix.numRows; if (rows < 2) { return; } double[] d = matrix.data; int cols = matrix.numCols; int left = rows-1; int delta = 0; for (int i=0;i<left;i++) { int j=i; for (;j<left && eq(d, i, j+1, cols);j++); if (i != j) { int cnt = j-i; System.arraycopy(d, cols*j, d, cols*i, cols*(left-j+1)); left -= cnt; delta += cnt; } } if (eq(d, 0, rows-1, cols)) { delta++; } if (delta > 0) { matrix.reshape(rows-delta, cols, true); } }
[ "public", "static", "void", "removeEqualRows", "(", "DenseMatrix64F", "matrix", ")", "{", "int", "rows", "=", "matrix", ".", "numRows", ";", "if", "(", "rows", "<", "2", ")", "{", "return", ";", "}", "double", "[", "]", "d", "=", "matrix", ".", "data", ";", "int", "cols", "=", "matrix", ".", "numCols", ";", "int", "left", "=", "rows", "-", "1", ";", "int", "delta", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "left", ";", "i", "++", ")", "{", "int", "j", "=", "i", ";", "for", "(", ";", "j", "<", "left", "&&", "eq", "(", "d", ",", "i", ",", "j", "+", "1", ",", "cols", ")", ";", "j", "++", ")", ";", "if", "(", "i", "!=", "j", ")", "{", "int", "cnt", "=", "j", "-", "i", ";", "System", ".", "arraycopy", "(", "d", ",", "cols", "*", "j", ",", "d", ",", "cols", "*", "i", ",", "cols", "*", "(", "left", "-", "j", "+", "1", ")", ")", ";", "left", "-=", "cnt", ";", "delta", "+=", "cnt", ";", "}", "}", "if", "(", "eq", "(", "d", ",", "0", ",", "rows", "-", "1", ",", "cols", ")", ")", "{", "delta", "++", ";", "}", "if", "(", "delta", ">", "0", ")", "{", "matrix", ".", "reshape", "(", "rows", "-", "delta", ",", "cols", ",", "true", ")", ";", "}", "}" ]
Removes equal subsequent rows and additionally last row if it is equal to first row. @param matrix
[ "Removes", "equal", "subsequent", "rows", "and", "additionally", "last", "row", "if", "it", "is", "equal", "to", "first", "row", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Matrices.java#L135-L166
151,799
tvesalainen/util
util/src/main/java/org/vesalainen/math/Matrices.java
Matrices.sort
public static void sort(DenseMatrix64F matrix, RowComparator comparator) { int len = matrix.numCols; quickSort(matrix.data, 0, matrix.numRows-1, len, comparator, new double[len], new double[len]); }
java
public static void sort(DenseMatrix64F matrix, RowComparator comparator) { int len = matrix.numCols; quickSort(matrix.data, 0, matrix.numRows-1, len, comparator, new double[len], new double[len]); }
[ "public", "static", "void", "sort", "(", "DenseMatrix64F", "matrix", ",", "RowComparator", "comparator", ")", "{", "int", "len", "=", "matrix", ".", "numCols", ";", "quickSort", "(", "matrix", ".", "data", ",", "0", ",", "matrix", ".", "numRows", "-", "1", ",", "len", ",", "comparator", ",", "new", "double", "[", "len", "]", ",", "new", "double", "[", "len", "]", ")", ";", "}" ]
MatrixSort is able to sort matrix rows when matrix is stored in one dimensional array as in DenseMatrix64F. <p>Sort is using Quick Sort algorithm. @param matrix @param comparator
[ "MatrixSort", "is", "able", "to", "sort", "matrix", "rows", "when", "matrix", "is", "stored", "in", "one", "dimensional", "array", "as", "in", "DenseMatrix64F", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Matrices.java#L186-L190