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
154,500
tvesalainen/util
util/src/main/java/org/vesalainen/nio/IntArray.java
IntArray.forEach
public void forEach(IntBiConsumer consumer) { int len = length(); for (int ii=0;ii<len;ii++) { consumer.accept(ii, get(ii)); } }
java
public void forEach(IntBiConsumer consumer) { int len = length(); for (int ii=0;ii<len;ii++) { consumer.accept(ii, get(ii)); } }
[ "public", "void", "forEach", "(", "IntBiConsumer", "consumer", ")", "{", "int", "len", "=", "length", "(", ")", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "len", ";", "ii", "++", ")", "{", "consumer", ".", "accept", "(", "ii", ",", ...
Calls consumer for each index and value @param consumer
[ "Calls", "consumer", "for", "each", "index", "and", "value" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/IntArray.java#L274-L281
154,501
etnetera/seb
src/main/java/cz/etnetera/seb/element/SebElement.java
SebElement.getClasses
public List<String> getClasses() { String classAttr = getAttribute("class"); return Stream.of((classAttr == null ? "" : classAttr).trim().split("\\s+")).distinct().sorted().collect(Collectors.toList()); }
java
public List<String> getClasses() { String classAttr = getAttribute("class"); return Stream.of((classAttr == null ? "" : classAttr).trim().split("\\s+")).distinct().sorted().collect(Collectors.toList()); }
[ "public", "List", "<", "String", ">", "getClasses", "(", ")", "{", "String", "classAttr", "=", "getAttribute", "(", "\"class\"", ")", ";", "return", "Stream", ".", "of", "(", "(", "classAttr", "==", "null", "?", "\"\"", ":", "classAttr", ")", ".", "tri...
Returns the class names present on element. The result is a unique set and is in alphabetical order. @return the class names present on element.
[ "Returns", "the", "class", "names", "present", "on", "element", ".", "The", "result", "is", "a", "unique", "set", "and", "is", "in", "alphabetical", "order", "." ]
6aed29c7726db12f440c60cfd253de229064ed04
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/element/SebElement.java#L290-L293
154,502
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/utils/ProcessorUtilities.java
ProcessorUtilities.getAndValidateKeyValuePair
public static Pair<String, String> getAndValidateKeyValuePair(final String keyValueString) throws InvalidKeyValueException { String tempInput[] = StringUtilities.split(keyValueString, '=', 2); // Remove the whitespace from each value in the split array tempInput = CollectionUtilities.trimStringArray(tempInput); if (tempInput.length >= 2) { final String value = tempInput[1]; return new Pair<String, String>(tempInput[0], replaceEscapeChars(cleanXMLCharacterReferences(value))); } else if (tempInput.length >= 1 && keyValueString.contains("=")) { return new Pair<String, String>(tempInput[0], ""); } else { throw new InvalidKeyValueException(); } }
java
public static Pair<String, String> getAndValidateKeyValuePair(final String keyValueString) throws InvalidKeyValueException { String tempInput[] = StringUtilities.split(keyValueString, '=', 2); // Remove the whitespace from each value in the split array tempInput = CollectionUtilities.trimStringArray(tempInput); if (tempInput.length >= 2) { final String value = tempInput[1]; return new Pair<String, String>(tempInput[0], replaceEscapeChars(cleanXMLCharacterReferences(value))); } else if (tempInput.length >= 1 && keyValueString.contains("=")) { return new Pair<String, String>(tempInput[0], ""); } else { throw new InvalidKeyValueException(); } }
[ "public", "static", "Pair", "<", "String", ",", "String", ">", "getAndValidateKeyValuePair", "(", "final", "String", "keyValueString", ")", "throws", "InvalidKeyValueException", "{", "String", "tempInput", "[", "]", "=", "StringUtilities", ".", "split", "(", "keyV...
Validates a KeyValue pair for a content specification and then returns the processed key and value.. @param keyValueString The string to be broken down and validated. @return A Pair where the first value is the key and the second is the value. @throws InvalidKeyValueException
[ "Validates", "a", "KeyValue", "pair", "for", "a", "content", "specification", "and", "then", "returns", "the", "processed", "key", "and", "value", ".." ]
85ffac047c4ede0f972364ab1f03f7d61a4de5f1
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/utils/ProcessorUtilities.java#L133-L145
154,503
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/utils/ProcessorUtilities.java
ProcessorUtilities.cloneTopicProperty
public static PropertyTagInTopicWrapper cloneTopicProperty(final TopicWrapper topic, final PropertyTagProvider propertyTagProvider, final PropertyTagInTopicWrapper originalProperty) { final PropertyTagWrapper propertyTag = propertyTagProvider.getPropertyTag(originalProperty.getId()); final PropertyTagInTopicWrapper newPropertyTag = propertyTagProvider.newPropertyTagInTopic(propertyTag, topic); newPropertyTag.setName(originalProperty.getName()); newPropertyTag.setValue(originalProperty.getValue()); return newPropertyTag; }
java
public static PropertyTagInTopicWrapper cloneTopicProperty(final TopicWrapper topic, final PropertyTagProvider propertyTagProvider, final PropertyTagInTopicWrapper originalProperty) { final PropertyTagWrapper propertyTag = propertyTagProvider.getPropertyTag(originalProperty.getId()); final PropertyTagInTopicWrapper newPropertyTag = propertyTagProvider.newPropertyTagInTopic(propertyTag, topic); newPropertyTag.setName(originalProperty.getName()); newPropertyTag.setValue(originalProperty.getValue()); return newPropertyTag; }
[ "public", "static", "PropertyTagInTopicWrapper", "cloneTopicProperty", "(", "final", "TopicWrapper", "topic", ",", "final", "PropertyTagProvider", "propertyTagProvider", ",", "final", "PropertyTagInTopicWrapper", "originalProperty", ")", "{", "final", "PropertyTagWrapper", "p...
Clones a Topic Property Tag. @param topic @param propertyTagProvider The property tag provider to lookup additional details. @param originalProperty The PropertyTag to be cloned. @return The cloned property tag.
[ "Clones", "a", "Topic", "Property", "Tag", "." ]
85ffac047c4ede0f972364ab1f03f7d61a4de5f1
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/utils/ProcessorUtilities.java#L259-L268
154,504
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/utils/ProcessorUtilities.java
ProcessorUtilities.cloneTopicSourceUrl
public static TopicSourceURLWrapper cloneTopicSourceUrl(final TopicSourceURLProvider topicSourceUrlProvider, final TopicSourceURLWrapper originalSourceUrl, final TopicWrapper parent) { final TopicSourceURLWrapper sourceUrl = topicSourceUrlProvider.newTopicSourceURL(parent); sourceUrl.setTitle(originalSourceUrl.getTitle()); sourceUrl.setDescription(originalSourceUrl.getDescription()); sourceUrl.setUrl(originalSourceUrl.getUrl()); return sourceUrl; }
java
public static TopicSourceURLWrapper cloneTopicSourceUrl(final TopicSourceURLProvider topicSourceUrlProvider, final TopicSourceURLWrapper originalSourceUrl, final TopicWrapper parent) { final TopicSourceURLWrapper sourceUrl = topicSourceUrlProvider.newTopicSourceURL(parent); sourceUrl.setTitle(originalSourceUrl.getTitle()); sourceUrl.setDescription(originalSourceUrl.getDescription()); sourceUrl.setUrl(originalSourceUrl.getUrl()); return sourceUrl; }
[ "public", "static", "TopicSourceURLWrapper", "cloneTopicSourceUrl", "(", "final", "TopicSourceURLProvider", "topicSourceUrlProvider", ",", "final", "TopicSourceURLWrapper", "originalSourceUrl", ",", "final", "TopicWrapper", "parent", ")", "{", "final", "TopicSourceURLWrapper", ...
Clones a Topic Source URL @param topicSourceUrlProvider The Topic Source URL provider to lookup additional details. @param originalSourceUrl The Source URL to be cloned. @param parent The parent to the new topic source url. @return The cloned topic source url.
[ "Clones", "a", "Topic", "Source", "URL" ]
85ffac047c4ede0f972364ab1f03f7d61a4de5f1
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/utils/ProcessorUtilities.java#L278-L287
154,505
krotscheck/jersey2-toolkit
jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/context/SearchIndexContextListener.java
SearchIndexContextListener.createSessionFactory
protected SessionFactory createSessionFactory() { // Set up a service registry. StandardServiceRegistryBuilder b = new StandardServiceRegistryBuilder(); // configures settings from hibernate.cfg.xml ServiceRegistry registry = b.configure().build(); // Build the session factory. return new MetadataSources(registry) .buildMetadata() .buildSessionFactory(); }
java
protected SessionFactory createSessionFactory() { // Set up a service registry. StandardServiceRegistryBuilder b = new StandardServiceRegistryBuilder(); // configures settings from hibernate.cfg.xml ServiceRegistry registry = b.configure().build(); // Build the session factory. return new MetadataSources(registry) .buildMetadata() .buildSessionFactory(); }
[ "protected", "SessionFactory", "createSessionFactory", "(", ")", "{", "// Set up a service registry.", "StandardServiceRegistryBuilder", "b", "=", "new", "StandardServiceRegistryBuilder", "(", ")", ";", "// configures settings from hibernate.cfg.xml", "ServiceRegistry", "registry",...
Create a session factory given the current configuration method. @return A constructed session factory.
[ "Create", "a", "session", "factory", "given", "the", "current", "configuration", "method", "." ]
11d757bd222dc82ada462caf6730ba4ff85dae04
https://github.com/krotscheck/jersey2-toolkit/blob/11d757bd222dc82ada462caf6730ba4ff85dae04/jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/context/SearchIndexContextListener.java#L56-L67
154,506
krotscheck/jersey2-toolkit
jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/context/SearchIndexContextListener.java
SearchIndexContextListener.contextInitialized
@Override public void contextInitialized( final ServletContextEvent servletContextEvent) { logger.info("Rebuilding Search Index..."); // Build the session factory. SessionFactory factory = createSessionFactory(); // Build the hibernate session. Session session = factory.openSession(); // Create the fulltext session. FullTextSession fullTextSession = Search.getFullTextSession(session); try { fullTextSession .createIndexer() .startAndWait(); } catch (InterruptedException e) { logger.warn("Search reindex interrupted. Good luck!"); logger.trace("Error:", e); } finally { // Close everything and release the lock file. session.close(); factory.close(); } }
java
@Override public void contextInitialized( final ServletContextEvent servletContextEvent) { logger.info("Rebuilding Search Index..."); // Build the session factory. SessionFactory factory = createSessionFactory(); // Build the hibernate session. Session session = factory.openSession(); // Create the fulltext session. FullTextSession fullTextSession = Search.getFullTextSession(session); try { fullTextSession .createIndexer() .startAndWait(); } catch (InterruptedException e) { logger.warn("Search reindex interrupted. Good luck!"); logger.trace("Error:", e); } finally { // Close everything and release the lock file. session.close(); factory.close(); } }
[ "@", "Override", "public", "void", "contextInitialized", "(", "final", "ServletContextEvent", "servletContextEvent", ")", "{", "logger", ".", "info", "(", "\"Rebuilding Search Index...\"", ")", ";", "// Build the session factory.", "SessionFactory", "factory", "=", "creat...
Rebuild the search index during context initialization. @param servletContextEvent The context event (not really used).
[ "Rebuild", "the", "search", "index", "during", "context", "initialization", "." ]
11d757bd222dc82ada462caf6730ba4ff85dae04
https://github.com/krotscheck/jersey2-toolkit/blob/11d757bd222dc82ada462caf6730ba4ff85dae04/jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/context/SearchIndexContextListener.java#L74-L100
154,507
carewebframework/carewebframework-vista
org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.notification/src/main/java/org/carewebframework/vista/plugin/notification/PriorityRenderer.java
PriorityRenderer.getImage
public static String getImage(Priority priority) { String image = getLabel("icon", priority); return image == null ? null : IconUtil.getIconPath(image); }
java
public static String getImage(Priority priority) { String image = getLabel("icon", priority); return image == null ? null : IconUtil.getIconPath(image); }
[ "public", "static", "String", "getImage", "(", "Priority", "priority", ")", "{", "String", "image", "=", "getLabel", "(", "\"icon\"", ",", "priority", ")", ";", "return", "image", "==", "null", "?", "null", ":", "IconUtil", ".", "getIconPath", "(", "image"...
Returns the url of the graphical representation of the priority. @param priority Priority value @return An image url.
[ "Returns", "the", "url", "of", "the", "graphical", "representation", "of", "the", "priority", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.notification/src/main/java/org/carewebframework/vista/plugin/notification/PriorityRenderer.java#L44-L47
154,508
carewebframework/carewebframework-vista
org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.notification/src/main/java/org/carewebframework/vista/plugin/notification/PriorityRenderer.java
PriorityRenderer.getLabel
private static String getLabel(String name, Priority priority) { return priority == null ? null : Labels.getLabel("vistanotification.priority." + name + "." + priority.name()); }
java
private static String getLabel(String name, Priority priority) { return priority == null ? null : Labels.getLabel("vistanotification.priority." + name + "." + priority.name()); }
[ "private", "static", "String", "getLabel", "(", "String", "name", ",", "Priority", "priority", ")", "{", "return", "priority", "==", "null", "?", "null", ":", "Labels", ".", "getLabel", "(", "\"vistanotification.priority.\"", "+", "name", "+", "\".\"", "+", ...
Returns the label property for the specified attribute name and priority. @param name The attribute name. @param priority Priority value @return The label value.
[ "Returns", "the", "label", "property", "for", "the", "specified", "attribute", "name", "and", "priority", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.notification/src/main/java/org/carewebframework/vista/plugin/notification/PriorityRenderer.java#L76-L78
154,509
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/io/ReceiverQueue.java
ReceiverQueue.onReceive
public void onReceive(Object object) { if (!closed && object != null) { synchronized (queue) { queue.addLast(object); if (limit > 0 && queue.size() > limit && !queue.isEmpty()) { queue.removeFirst(); } } } }
java
public void onReceive(Object object) { if (!closed && object != null) { synchronized (queue) { queue.addLast(object); if (limit > 0 && queue.size() > limit && !queue.isEmpty()) { queue.removeFirst(); } } } }
[ "public", "void", "onReceive", "(", "Object", "object", ")", "{", "if", "(", "!", "closed", "&&", "object", "!=", "null", ")", "{", "synchronized", "(", "queue", ")", "{", "queue", ".", "addLast", "(", "object", ")", ";", "if", "(", "limit", ">", "...
Receives an object from a channel. @param object
[ "Receives", "an", "object", "from", "a", "channel", "." ]
971eb022115247b1e34dc26dd02e7e621e29e910
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/ReceiverQueue.java#L55-L64
154,510
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldTable.java
FieldTable.getString
public String getString(String string) { if (this.getRecord() != null) if (this.getRecord().getTask() != null) string = this.getRecord().getTask().getString(string); return string; }
java
public String getString(String string) { if (this.getRecord() != null) if (this.getRecord().getTask() != null) string = this.getRecord().getTask().getString(string); return string; }
[ "public", "String", "getString", "(", "String", "string", ")", "{", "if", "(", "this", ".", "getRecord", "(", ")", "!=", "null", ")", "if", "(", "this", ".", "getRecord", "(", ")", ".", "getTask", "(", ")", "!=", "null", ")", "string", "=", "this",...
Look up this string in the resource table. This is a convience method - calls getString in the task. @param string The string key. @return The local string (or the key if the string doesn't exist).
[ "Look", "up", "this", "string", "in", "the", "resource", "table", ".", "This", "is", "a", "convience", "method", "-", "calls", "getString", "in", "the", "task", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldTable.java#L548-L554
154,511
tvesalainen/util
util/src/main/java/org/vesalainen/util/OrMatcher.java
OrMatcher.add
public void add(Matcher matcher, T attachment) { add(matcher); map.add(matcher, attachment); }
java
public void add(Matcher matcher, T attachment) { add(matcher); map.add(matcher, attachment); }
[ "public", "void", "add", "(", "Matcher", "matcher", ",", "T", "attachment", ")", "{", "add", "(", "matcher", ")", ";", "map", ".", "add", "(", "matcher", ",", "attachment", ")", ";", "}" ]
Add matcher with attachment. If matcher exist only attachment is stored. @param matcher @param attachment
[ "Add", "matcher", "with", "attachment", ".", "If", "matcher", "exist", "only", "attachment", "is", "stored", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/OrMatcher.java#L54-L58
154,512
tvesalainen/util
util/src/main/java/org/vesalainen/util/OrMatcher.java
OrMatcher.match
@Override public Status match(int cc) { int highest = -1; Iterator<Matcher> iterator = active.iterator(); while (iterator.hasNext()) { Matcher matcher = iterator.next(); Status s = matcher.match(cc); highest = Math.max(highest, s.ordinal()); switch (s) { case Match: lastMatched = matcher; clear(); return s; case WillMatch: lastMatched = matcher; return s; case Error: iterator.remove(); break; } } if (active.isEmpty()) { clear(); return Status.Error; } return Status.values()[highest]; }
java
@Override public Status match(int cc) { int highest = -1; Iterator<Matcher> iterator = active.iterator(); while (iterator.hasNext()) { Matcher matcher = iterator.next(); Status s = matcher.match(cc); highest = Math.max(highest, s.ordinal()); switch (s) { case Match: lastMatched = matcher; clear(); return s; case WillMatch: lastMatched = matcher; return s; case Error: iterator.remove(); break; } } if (active.isEmpty()) { clear(); return Status.Error; } return Status.values()[highest]; }
[ "@", "Override", "public", "Status", "match", "(", "int", "cc", ")", "{", "int", "highest", "=", "-", "1", ";", "Iterator", "<", "Matcher", ">", "iterator", "=", "active", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(",...
If one matches returns Match. If all return Error returns error. Otherwise returns Ok. @param cc @return
[ "If", "one", "matches", "returns", "Match", ".", "If", "all", "return", "Error", "returns", "error", ".", "Otherwise", "returns", "Ok", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/OrMatcher.java#L73-L103
154,513
tvesalainen/util
util/src/main/java/org/vesalainen/math/BestFitLine.java
BestFitLine.add
public void add(double x, double y, int k) { sx +=x*k; sy +=y*k; sxy += x*y*k; sx2 += x*x*k; n+=k; if (n < 1) { throw new IllegalArgumentException("negative count"); } }
java
public void add(double x, double y, int k) { sx +=x*k; sy +=y*k; sxy += x*y*k; sx2 += x*x*k; n+=k; if (n < 1) { throw new IllegalArgumentException("negative count"); } }
[ "public", "void", "add", "(", "double", "x", ",", "double", "y", ",", "int", "k", ")", "{", "sx", "+=", "x", "*", "k", ";", "sy", "+=", "y", "*", "k", ";", "sxy", "+=", "x", "*", "y", "*", "k", ";", "sx2", "+=", "x", "*", "x", "*", "k",...
Adds a point k times. k can be negative. @param x @param y @param k
[ "Adds", "a", "point", "k", "times", ".", "k", "can", "be", "negative", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/BestFitLine.java#L79-L90
154,514
tvesalainen/util
util/src/main/java/org/vesalainen/math/BestFitLine.java
BestFitLine.getY
@Override public double getY(double x) { double slope = getSlope(); double a = getYIntercept(slope); if (!Double.isInfinite(slope)) { return slope*x + a; } else { if (x == a) { return Double.POSITIVE_INFINITY; } else { return Double.NaN; } } }
java
@Override public double getY(double x) { double slope = getSlope(); double a = getYIntercept(slope); if (!Double.isInfinite(slope)) { return slope*x + a; } else { if (x == a) { return Double.POSITIVE_INFINITY; } else { return Double.NaN; } } }
[ "@", "Override", "public", "double", "getY", "(", "double", "x", ")", "{", "double", "slope", "=", "getSlope", "(", ")", ";", "double", "a", "=", "getYIntercept", "(", "slope", ")", ";", "if", "(", "!", "Double", ".", "isInfinite", "(", "slope", ")",...
Returns y-value for x @param x @return
[ "Returns", "y", "-", "value", "for", "x" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/BestFitLine.java#L113-L133
154,515
tvesalainen/util
util/src/main/java/org/vesalainen/math/BestFitLine.java
BestFitLine.getLine
public AbstractLine getLine() { double slope = getSlope(); double yIntercept = getYIntercept(slope); return new AbstractLine(slope, 0, yIntercept); }
java
public AbstractLine getLine() { double slope = getSlope(); double yIntercept = getYIntercept(slope); return new AbstractLine(slope, 0, yIntercept); }
[ "public", "AbstractLine", "getLine", "(", ")", "{", "double", "slope", "=", "getSlope", "(", ")", ";", "double", "yIntercept", "=", "getYIntercept", "(", "slope", ")", ";", "return", "new", "AbstractLine", "(", "slope", ",", "0", ",", "yIntercept", ")", ...
Returns best-fit-line @return
[ "Returns", "best", "-", "fit", "-", "line" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/BestFitLine.java#L147-L152
154,516
rometools/rome-certiorem
src/main/java/com/rometools/certiorem/hub/Hub.java
Hub.sendNotification
public void sendNotification(final String requestHost, final String topic) { // FIXME assert should not be used for validation because it can be disabled assert validTopics.isEmpty() || validTopics.contains(topic) : "That topic is not supported by this hub. " + topic; LOG.debug("Sending notification for {}", topic); try { final List<? extends Subscriber> subscribers = dao.subscribersForTopic(topic); if (subscribers.isEmpty()) { LOG.debug("No subscribers to notify for {}", topic); return; } final List<? extends SubscriptionSummary> summaries = dao.summariesForTopic(topic); int total = 0; final StringBuilder hosts = new StringBuilder(); for (final SubscriptionSummary s : summaries) { if (s.getSubscribers() > 0) { total += s.getSubscribers(); hosts.append(" (").append(s.getHost()).append("; ").append(s.getSubscribers()).append(" subscribers)"); } } final StringBuilder userAgent = new StringBuilder("ROME-Certiorem (+http://").append(requestHost).append("; ").append(total) .append(" subscribers)").append(hosts); final SyndFeed feed = fetcher.retrieveFeed(userAgent.toString(), new URL(topic)); LOG.debug("Got feed for {} Sending to {} subscribers.", topic, subscribers.size()); notifier.notifySubscribers(subscribers, feed, new SubscriptionSummaryCallback() { @Override public void onSummaryInfo(final SubscriptionSummary summary) { dao.handleSummary(topic, summary); } }); } catch (final Exception ex) { LOG.debug("Exception getting " + topic, ex); throw new HttpStatusCodeException(500, ex.getMessage(), ex); } }
java
public void sendNotification(final String requestHost, final String topic) { // FIXME assert should not be used for validation because it can be disabled assert validTopics.isEmpty() || validTopics.contains(topic) : "That topic is not supported by this hub. " + topic; LOG.debug("Sending notification for {}", topic); try { final List<? extends Subscriber> subscribers = dao.subscribersForTopic(topic); if (subscribers.isEmpty()) { LOG.debug("No subscribers to notify for {}", topic); return; } final List<? extends SubscriptionSummary> summaries = dao.summariesForTopic(topic); int total = 0; final StringBuilder hosts = new StringBuilder(); for (final SubscriptionSummary s : summaries) { if (s.getSubscribers() > 0) { total += s.getSubscribers(); hosts.append(" (").append(s.getHost()).append("; ").append(s.getSubscribers()).append(" subscribers)"); } } final StringBuilder userAgent = new StringBuilder("ROME-Certiorem (+http://").append(requestHost).append("; ").append(total) .append(" subscribers)").append(hosts); final SyndFeed feed = fetcher.retrieveFeed(userAgent.toString(), new URL(topic)); LOG.debug("Got feed for {} Sending to {} subscribers.", topic, subscribers.size()); notifier.notifySubscribers(subscribers, feed, new SubscriptionSummaryCallback() { @Override public void onSummaryInfo(final SubscriptionSummary summary) { dao.handleSummary(topic, summary); } }); } catch (final Exception ex) { LOG.debug("Exception getting " + topic, ex); throw new HttpStatusCodeException(500, ex.getMessage(), ex); } }
[ "public", "void", "sendNotification", "(", "final", "String", "requestHost", ",", "final", "String", "topic", ")", "{", "// FIXME assert should not be used for validation because it can be disabled", "assert", "validTopics", ".", "isEmpty", "(", ")", "||", "validTopics", ...
Sends a notification to the subscribers @param requestHost the host name the hub is running on. (Used for the user agent) @param topic the URL of the topic that was updated. @throws HttpStatusCodeException a wrapper exception with a recommended status code for the request.
[ "Sends", "a", "notification", "to", "the", "subscribers" ]
e5a003193dd2abd748e77961c0f216a7f5690712
https://github.com/rometools/rome-certiorem/blob/e5a003193dd2abd748e77961c0f216a7f5690712/src/main/java/com/rometools/certiorem/hub/Hub.java#L125-L162
154,517
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/read/ReadFileExtensions.java
ReadFileExtensions.toByteArray
public static byte[] toByteArray(final File tmpFile) throws IOException { byte[] data = null; if (tmpFile.exists() && !tmpFile.isDirectory()) { try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(tmpFile)); ByteArrayOutputStream bos = new ByteArrayOutputStream(FileConst.KILOBYTE);) { StreamExtensions.writeInputStreamToOutputStream(bis, bos); data = bos.toByteArray(); } } return data; }
java
public static byte[] toByteArray(final File tmpFile) throws IOException { byte[] data = null; if (tmpFile.exists() && !tmpFile.isDirectory()) { try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(tmpFile)); ByteArrayOutputStream bos = new ByteArrayOutputStream(FileConst.KILOBYTE);) { StreamExtensions.writeInputStreamToOutputStream(bis, bos); data = bos.toByteArray(); } } return data; }
[ "public", "static", "byte", "[", "]", "toByteArray", "(", "final", "File", "tmpFile", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "null", ";", "if", "(", "tmpFile", ".", "exists", "(", ")", "&&", "!", "tmpFile", ".", "isDirectory"...
Get a byte array from the given file. @param tmpFile The file. @return Returns a byte array or null. @throws IOException Signals that an I/O exception has occurred.
[ "Get", "a", "byte", "array", "from", "the", "given", "file", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/read/ReadFileExtensions.java#L396-L409
154,518
aequologica/geppaequo
geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/servlet/ImportServlet.java
ImportServlet.trustAllHosts
private static void trustAllHosts() { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { @Override public java.security.cert.X509Certificate[] getAcceptedIssuers() { return new java.security.cert.X509Certificate[] {}; } @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } @Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } } }; // Install the all-trusting trust manager try { SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } catch (Exception e) { e.printStackTrace(); } }
java
private static void trustAllHosts() { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { @Override public java.security.cert.X509Certificate[] getAcceptedIssuers() { return new java.security.cert.X509Certificate[] {}; } @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } @Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } } }; // Install the all-trusting trust manager try { SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } catch (Exception e) { e.printStackTrace(); } }
[ "private", "static", "void", "trustAllHosts", "(", ")", "{", "// Create a trust manager that does not validate certificate chains\r", "TrustManager", "[", "]", "trustAllCerts", "=", "new", "TrustManager", "[", "]", "{", "new", "X509TrustManager", "(", ")", "{", "@", "...
Trust every server - dont check for any certificate
[ "Trust", "every", "server", "-", "dont", "check", "for", "any", "certificate" ]
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/servlet/ImportServlet.java#L91-L116
154,519
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/DataConverters.java
DataConverters.initGlobals
public static void initGlobals() { if (gDateFormat == null) { // NOTE: You MUST synchronize before using any of these // For dates and times, synchronize on the gCalendar gCalendar = Calendar.getInstance(); gDateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); gTimeFormat = DateFormat.getTimeInstance(DateFormat.SHORT); gLongTimeFormat = DateFormat.getTimeInstance(DateFormat.MEDIUM); gDateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT); gLongDateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); gDateShortFormat = DateFormat.getDateInstance(DateFormat.SHORT); gDateShortTimeFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); gGMTDateTimeFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); gDateSqlFormat = gDateShortFormat; // By default use these formats - Change if different gTimeSqlFormat = gTimeFormat; gDateTimeSqlFormat = gDateShortTimeFormat; // For all of these, synchronize on the object you are using gIntegerFormat = NumberFormat.getInstance(); gIntegerFormat.setParseIntegerOnly(true); gCurrencyFormat = NumberFormat.getCurrencyInstance(); gNumberFormat = NumberFormat.getInstance(); gNumberFormat.setParseIntegerOnly(false); gNumberFormat.setMinimumFractionDigits(2); gNumberFormat.setMaximumFractionDigits(2); if (gNumberFormat instanceof DecimalFormat) { gchDot = ((DecimalFormat)gNumberFormat).getDecimalFormatSymbols().getDecimalSeparator(); gchMinus = ((DecimalFormat)gNumberFormat).getDecimalFormatSymbols().getMinusSign(); } gPercentFormat = NumberFormat.getPercentInstance(); } }
java
public static void initGlobals() { if (gDateFormat == null) { // NOTE: You MUST synchronize before using any of these // For dates and times, synchronize on the gCalendar gCalendar = Calendar.getInstance(); gDateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); gTimeFormat = DateFormat.getTimeInstance(DateFormat.SHORT); gLongTimeFormat = DateFormat.getTimeInstance(DateFormat.MEDIUM); gDateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT); gLongDateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); gDateShortFormat = DateFormat.getDateInstance(DateFormat.SHORT); gDateShortTimeFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); gGMTDateTimeFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); gDateSqlFormat = gDateShortFormat; // By default use these formats - Change if different gTimeSqlFormat = gTimeFormat; gDateTimeSqlFormat = gDateShortTimeFormat; // For all of these, synchronize on the object you are using gIntegerFormat = NumberFormat.getInstance(); gIntegerFormat.setParseIntegerOnly(true); gCurrencyFormat = NumberFormat.getCurrencyInstance(); gNumberFormat = NumberFormat.getInstance(); gNumberFormat.setParseIntegerOnly(false); gNumberFormat.setMinimumFractionDigits(2); gNumberFormat.setMaximumFractionDigits(2); if (gNumberFormat instanceof DecimalFormat) { gchDot = ((DecimalFormat)gNumberFormat).getDecimalFormatSymbols().getDecimalSeparator(); gchMinus = ((DecimalFormat)gNumberFormat).getDecimalFormatSymbols().getMinusSign(); } gPercentFormat = NumberFormat.getPercentInstance(); } }
[ "public", "static", "void", "initGlobals", "(", ")", "{", "if", "(", "gDateFormat", "==", "null", ")", "{", "// NOTE: You MUST synchronize before using any of these", "// For dates and times, synchronize on the gCalendar", "gCalendar", "=", "Calendar", ".", "getInstance", "...
Initialize the global text format classes.
[ "Initialize", "the", "global", "text", "format", "classes", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/DataConverters.java#L60-L97
154,520
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/DataConverters.java
DataConverters.stripNonNumber
public static String stripNonNumber(String string) { if (string == null) return null; for (int i = 0; i < string.length(); i++) { char ch = string.charAt(i); if (!(Character.isDigit(ch))) if (ch != gchDot) if (ch != gchMinus) { string = string.substring(0, i) + string.substring(i + 1); i--; } } return string; }
java
public static String stripNonNumber(String string) { if (string == null) return null; for (int i = 0; i < string.length(); i++) { char ch = string.charAt(i); if (!(Character.isDigit(ch))) if (ch != gchDot) if (ch != gchMinus) { string = string.substring(0, i) + string.substring(i + 1); i--; } } return string; }
[ "public", "static", "String", "stripNonNumber", "(", "String", "string", ")", "{", "if", "(", "string", "==", "null", ")", "return", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "string", ".", "length", "(", ")", ";", "i", "++", ...
Utility to strip all the non-numeric characters from this string. @param string input string. @return The result string.
[ "Utility", "to", "strip", "all", "the", "non", "-", "numeric", "characters", "from", "this", "string", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/DataConverters.java#L103-L119
154,521
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/DataConverters.java
DataConverters.stringToShort
public static Short stringToShort(String strString) throws Exception { Number objData; initGlobals(); // Make sure you have the utilities if ((strString == null) || (strString.equals(Constant.BLANK))) return null; strString = DataConverters.stripNonNumber(strString); try { synchronized (gIntegerFormat) { objData = gIntegerFormat.parse(strString); } if (!(objData instanceof Short)) { if (objData instanceof Number) objData = new Short(objData.shortValue()); else objData = null; } } catch (ParseException ex) { objData = null; } if (objData == null) { try { objData = new Short(strString); } catch (NumberFormatException ex) { throw ex; } } return (Short)objData; }
java
public static Short stringToShort(String strString) throws Exception { Number objData; initGlobals(); // Make sure you have the utilities if ((strString == null) || (strString.equals(Constant.BLANK))) return null; strString = DataConverters.stripNonNumber(strString); try { synchronized (gIntegerFormat) { objData = gIntegerFormat.parse(strString); } if (!(objData instanceof Short)) { if (objData instanceof Number) objData = new Short(objData.shortValue()); else objData = null; } } catch (ParseException ex) { objData = null; } if (objData == null) { try { objData = new Short(strString); } catch (NumberFormatException ex) { throw ex; } } return (Short)objData; }
[ "public", "static", "Short", "stringToShort", "(", "String", "strString", ")", "throws", "Exception", "{", "Number", "objData", ";", "initGlobals", "(", ")", ";", "// Make sure you have the utilities", "if", "(", "(", "strString", "==", "null", ")", "||", "(", ...
Convert this string to a Short. @param strString string to convert. @return Short value. @throws Exception NumberFormatException.
[ "Convert", "this", "string", "to", "a", "Short", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/DataConverters.java#L318-L349
154,522
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/DataConverters.java
DataConverters.stringToInteger
public static Integer stringToInteger(String strString) throws Exception { Number objData; initGlobals(); // Make sure you have the utilities if ((strString == null) || (strString.equals(Constant.BLANK))) return null; strString = DataConverters.stripNonNumber(strString); try { synchronized (gIntegerFormat) { objData = gIntegerFormat.parse(strString); } if (!(objData instanceof Integer)) { if (objData instanceof Number) objData = new Integer(objData.intValue()); else objData = null; } } catch (ParseException ex) { objData = null; } if (objData == null) if (strString != null) if (strString.length() > 0) { try { objData = new Integer(strString); } catch (NumberFormatException ex) { throw ex; } } return (Integer)objData; }
java
public static Integer stringToInteger(String strString) throws Exception { Number objData; initGlobals(); // Make sure you have the utilities if ((strString == null) || (strString.equals(Constant.BLANK))) return null; strString = DataConverters.stripNonNumber(strString); try { synchronized (gIntegerFormat) { objData = gIntegerFormat.parse(strString); } if (!(objData instanceof Integer)) { if (objData instanceof Number) objData = new Integer(objData.intValue()); else objData = null; } } catch (ParseException ex) { objData = null; } if (objData == null) if (strString != null) if (strString.length() > 0) { try { objData = new Integer(strString); } catch (NumberFormatException ex) { throw ex; } } return (Integer)objData; }
[ "public", "static", "Integer", "stringToInteger", "(", "String", "strString", ")", "throws", "Exception", "{", "Number", "objData", ";", "initGlobals", "(", ")", ";", "// Make sure you have the utilities", "if", "(", "(", "strString", "==", "null", ")", "||", "(...
Convert this string to a Integer. @param strString string to convert. @return Integer value. @throws Exception NumberFormatException.
[ "Convert", "this", "string", "to", "a", "Integer", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/DataConverters.java#L356-L389
154,523
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/DataConverters.java
DataConverters.stringToFloat
public static Float stringToFloat(String strString, int ibScale) throws Exception { Number objData; initGlobals(); // Make sure you have the utilities if ((strString == null) || (strString.equals(Constant.BLANK))) return null; strString = DataConverters.stripNonNumber(strString); try { synchronized (gNumberFormat) { objData = gNumberFormat.parse(strString); } if (!(objData instanceof Float)) { if (objData instanceof Number) objData = new Float(objData.floatValue()); else objData = null; } } catch (ParseException ex) { objData = null; } if (objData == null) { try { objData = new Float(strString); } catch (NumberFormatException ex) { throw ex; } } if (ibScale != -1) objData = new Float(Math.floor(((Float)objData).floatValue() * Math.pow(10, ibScale) + 0.5) / Math.pow(10, ibScale)); return (Float)objData; }
java
public static Float stringToFloat(String strString, int ibScale) throws Exception { Number objData; initGlobals(); // Make sure you have the utilities if ((strString == null) || (strString.equals(Constant.BLANK))) return null; strString = DataConverters.stripNonNumber(strString); try { synchronized (gNumberFormat) { objData = gNumberFormat.parse(strString); } if (!(objData instanceof Float)) { if (objData instanceof Number) objData = new Float(objData.floatValue()); else objData = null; } } catch (ParseException ex) { objData = null; } if (objData == null) { try { objData = new Float(strString); } catch (NumberFormatException ex) { throw ex; } } if (ibScale != -1) objData = new Float(Math.floor(((Float)objData).floatValue() * Math.pow(10, ibScale) + 0.5) / Math.pow(10, ibScale)); return (Float)objData; }
[ "public", "static", "Float", "stringToFloat", "(", "String", "strString", ",", "int", "ibScale", ")", "throws", "Exception", "{", "Number", "objData", ";", "initGlobals", "(", ")", ";", "// Make sure you have the utilities", "if", "(", "(", "strString", "==", "n...
Convert this string to a Float. @param strString string to convert. @return Float value. @throws Exception NumberFormatException.
[ "Convert", "this", "string", "to", "a", "Float", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/DataConverters.java#L396-L429
154,524
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/DataConverters.java
DataConverters.stringToDouble
public static Double stringToDouble(String strString, int ibScale) throws Exception { Number objData; initGlobals(); // Make sure you have the utilities if ((strString == null) || (strString.equals(Constant.BLANK))) return null; strString = DataConverters.stripNonNumber(strString); try { synchronized (gNumberFormat) { objData = gNumberFormat.parse(strString); } if (!(objData instanceof Double)) { if (objData instanceof Number) objData = new Double(objData.doubleValue()); else objData = null; } } catch (ParseException ex) { objData = null; } if (objData == null) { try { objData = new Double(strString); } catch (NumberFormatException ex) { throw ex; } } if (ibScale != -1) objData = new Double(Math.floor(((Double)objData).doubleValue() * Math.pow(10, ibScale) + 0.5) / Math.pow(10, ibScale)); return (Double)objData; }
java
public static Double stringToDouble(String strString, int ibScale) throws Exception { Number objData; initGlobals(); // Make sure you have the utilities if ((strString == null) || (strString.equals(Constant.BLANK))) return null; strString = DataConverters.stripNonNumber(strString); try { synchronized (gNumberFormat) { objData = gNumberFormat.parse(strString); } if (!(objData instanceof Double)) { if (objData instanceof Number) objData = new Double(objData.doubleValue()); else objData = null; } } catch (ParseException ex) { objData = null; } if (objData == null) { try { objData = new Double(strString); } catch (NumberFormatException ex) { throw ex; } } if (ibScale != -1) objData = new Double(Math.floor(((Double)objData).doubleValue() * Math.pow(10, ibScale) + 0.5) / Math.pow(10, ibScale)); return (Double)objData; }
[ "public", "static", "Double", "stringToDouble", "(", "String", "strString", ",", "int", "ibScale", ")", "throws", "Exception", "{", "Number", "objData", ";", "initGlobals", "(", ")", ";", "// Make sure you have the utilities", "if", "(", "(", "strString", "==", ...
Convert this string to a Double. @param strString string to convert. @return Double value. @throws Exception NumberFormatException.
[ "Convert", "this", "string", "to", "a", "Double", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/DataConverters.java#L436-L469
154,525
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/search/PathFinder.java
PathFinder.getAbsolutePath
public static String getAbsolutePath(final File file, final boolean removeLastChar) { String absolutePath = file.getAbsolutePath(); if (removeLastChar) { absolutePath = absolutePath.substring(0, absolutePath.length() - 1); } return absolutePath; }
java
public static String getAbsolutePath(final File file, final boolean removeLastChar) { String absolutePath = file.getAbsolutePath(); if (removeLastChar) { absolutePath = absolutePath.substring(0, absolutePath.length() - 1); } return absolutePath; }
[ "public", "static", "String", "getAbsolutePath", "(", "final", "File", "file", ",", "final", "boolean", "removeLastChar", ")", "{", "String", "absolutePath", "=", "file", ".", "getAbsolutePath", "(", ")", ";", "if", "(", "removeLastChar", ")", "{", "absolutePa...
Gets the absolute path. @param file the file @param removeLastChar the remove last char @return the absolute path
[ "Gets", "the", "absolute", "path", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/PathFinder.java#L79-L87
154,526
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/search/PathFinder.java
PathFinder.getProjectDirectory
public static File getProjectDirectory(final File currentDir) { final String projectPath = PathFinder.getAbsolutePath(currentDir, true); final File projectFile = new File(projectPath); return projectFile; }
java
public static File getProjectDirectory(final File currentDir) { final String projectPath = PathFinder.getAbsolutePath(currentDir, true); final File projectFile = new File(projectPath); return projectFile; }
[ "public", "static", "File", "getProjectDirectory", "(", "final", "File", "currentDir", ")", "{", "final", "String", "projectPath", "=", "PathFinder", ".", "getAbsolutePath", "(", "currentDir", ",", "true", ")", ";", "final", "File", "projectFile", "=", "new", ...
Gets the project directory. @param currentDir the current dir @return the project directory
[ "Gets", "the", "project", "directory", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/PathFinder.java#L106-L111
154,527
js-lib-com/commons
src/main/java/js/converter/EnumsConverter.java
EnumsConverter.asObject
@SuppressWarnings("rawtypes") @Override public <T> T asObject(String string, Class<T> valueType) throws IllegalArgumentException { if(string.isEmpty()) { return null; } // at this point value type is guaranteed to be enumeration if(Types.isKindOf(valueType, OrdinalEnum.class)) { return valueType.getEnumConstants()[Integer.parseInt(string)]; } return (T)Enum.valueOf((Class)valueType, string); }
java
@SuppressWarnings("rawtypes") @Override public <T> T asObject(String string, Class<T> valueType) throws IllegalArgumentException { if(string.isEmpty()) { return null; } // at this point value type is guaranteed to be enumeration if(Types.isKindOf(valueType, OrdinalEnum.class)) { return valueType.getEnumConstants()[Integer.parseInt(string)]; } return (T)Enum.valueOf((Class)valueType, string); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "@", "Override", "public", "<", "T", ">", "T", "asObject", "(", "String", "string", ",", "Class", "<", "T", ">", "valueType", ")", "throws", "IllegalArgumentException", "{", "if", "(", "string", ".", "isEm...
Create enumeration constant for given string and enumeration type. @throws IllegalArgumentException string argument is not a valid constant for given enumeration type. @throws NumberFormatException if string argument is not a valid numeric value and value type implements {@link OrdinalEnum}. @throws IndexOutOfBoundsException if value type implements {@link OrdinalEnum}, string argument is a valid number but is not in the range accepted by target enumeration.
[ "Create", "enumeration", "constant", "for", "given", "string", "and", "enumeration", "type", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/EnumsConverter.java#L34-L46
154,528
js-lib-com/commons
src/main/java/js/converter/EnumsConverter.java
EnumsConverter.asString
@Override public String asString(Object object) { // at this point object is guaranteed to be enumeration Enum<?> e = (Enum<?>)object; if(object instanceof OrdinalEnum) { return Integer.toString(e.ordinal()); } return e.name(); }
java
@Override public String asString(Object object) { // at this point object is guaranteed to be enumeration Enum<?> e = (Enum<?>)object; if(object instanceof OrdinalEnum) { return Integer.toString(e.ordinal()); } return e.name(); }
[ "@", "Override", "public", "String", "asString", "(", "Object", "object", ")", "{", "// at this point object is guaranteed to be enumeration\r", "Enum", "<", "?", ">", "e", "=", "(", "Enum", "<", "?", ">", ")", "object", ";", "if", "(", "object", "instanceof",...
Get enumeration constant name.
[ "Get", "enumeration", "constant", "name", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/EnumsConverter.java#L49-L58
154,529
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageReceiver.java
RemoteMessageReceiver.receiveMessage
public Message receiveMessage() { Message message = null; try { message = m_receiveQueue.receiveRemoteMessage(); // Hang until a message comes through } catch (RemoteException ex) { ex.printStackTrace(); return null; // Remote exception = I'm done! } if (message instanceof BaseMessage) ((BaseMessage)message).setProcessedByServer(true); // Don't send the message back down. return message; }
java
public Message receiveMessage() { Message message = null; try { message = m_receiveQueue.receiveRemoteMessage(); // Hang until a message comes through } catch (RemoteException ex) { ex.printStackTrace(); return null; // Remote exception = I'm done! } if (message instanceof BaseMessage) ((BaseMessage)message).setProcessedByServer(true); // Don't send the message back down. return message; }
[ "public", "Message", "receiveMessage", "(", ")", "{", "Message", "message", "=", "null", ";", "try", "{", "message", "=", "m_receiveQueue", ".", "receiveRemoteMessage", "(", ")", ";", "// Hang until a message comes through", "}", "catch", "(", "RemoteException", "...
Block until a message is received. Hangs on the remote receive message call. @return The next message.
[ "Block", "until", "a", "message", "is", "received", ".", "Hangs", "on", "the", "remote", "receive", "message", "call", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageReceiver.java#L89-L101
154,530
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageReceiver.java
RemoteMessageReceiver.removeMessageFilter
public boolean removeMessageFilter(MessageFilter messageFilter, boolean bFreeFilter) { boolean bSuccess = false; try { if (((BaseMessageFilter)messageFilter).getRemoteFilterID() == null) bSuccess = true; // No remote filter to remove else bSuccess = m_receiveQueue.removeRemoteMessageFilter((BaseMessageFilter)messageFilter, bFreeFilter); } catch (RemoteException ex) { ex.printStackTrace(); } if (!bSuccess) Util.getLogger().warning("Remote listener not removed"); // Never return super.removeMessageFilter(messageFilter, bFreeFilter); }
java
public boolean removeMessageFilter(MessageFilter messageFilter, boolean bFreeFilter) { boolean bSuccess = false; try { if (((BaseMessageFilter)messageFilter).getRemoteFilterID() == null) bSuccess = true; // No remote filter to remove else bSuccess = m_receiveQueue.removeRemoteMessageFilter((BaseMessageFilter)messageFilter, bFreeFilter); } catch (RemoteException ex) { ex.printStackTrace(); } if (!bSuccess) Util.getLogger().warning("Remote listener not removed"); // Never return super.removeMessageFilter(messageFilter, bFreeFilter); }
[ "public", "boolean", "removeMessageFilter", "(", "MessageFilter", "messageFilter", ",", "boolean", "bFreeFilter", ")", "{", "boolean", "bSuccess", "=", "false", ";", "try", "{", "if", "(", "(", "(", "BaseMessageFilter", ")", "messageFilter", ")", ".", "getRemote...
Remove this message filter from this queue. Also remove the remote message filter. @param messageFilter The message filter to remove. @param bFreeFilter If true, free this filter. @return True if successful.
[ "Remove", "this", "message", "filter", "from", "this", "queue", ".", "Also", "remove", "the", "remote", "message", "filter", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageReceiver.java#L130-L144
154,531
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageReceiver.java
RemoteMessageReceiver.isSendRemoteMessage
public boolean isSendRemoteMessage(BaseMessage message) { Iterator<BaseMessageFilter> iterator = this.getMessageFilterList().getFilterList(null); // ALL The filters (not just matches). while (iterator.hasNext()) { BaseMessageFilter filter = iterator.next(); if (!filter.isRemoteFilter()) // Always send down when filter is a remote copy if (filter.isSendRemoteMessage(message) == false) return false; // Don't send this message down } return true; }
java
public boolean isSendRemoteMessage(BaseMessage message) { Iterator<BaseMessageFilter> iterator = this.getMessageFilterList().getFilterList(null); // ALL The filters (not just matches). while (iterator.hasNext()) { BaseMessageFilter filter = iterator.next(); if (!filter.isRemoteFilter()) // Always send down when filter is a remote copy if (filter.isSendRemoteMessage(message) == false) return false; // Don't send this message down } return true; }
[ "public", "boolean", "isSendRemoteMessage", "(", "BaseMessage", "message", ")", "{", "Iterator", "<", "BaseMessageFilter", ">", "iterator", "=", "this", ".", "getMessageFilterList", "(", ")", ".", "getFilterList", "(", "null", ")", ";", "// ALL The filters (not just...
Do I send this message to the remote server? Remember to check for the filter match. @return true If I do (default).
[ "Do", "I", "send", "this", "message", "to", "the", "remote", "server?", "Remember", "to", "check", "for", "the", "filter", "match", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageReceiver.java#L167-L178
154,532
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/lock/LockSession.java
LockSession.getLockTable
public LockTable getLockTable(String strDatabaseName, String strRecordName) { String strKey = strDatabaseName + ':' + strRecordName; LockTable lockTable = (LockTable)m_htLockTables.get(strKey); if (lockTable == null) { synchronized (m_htLockTables) { if ((lockTable = (LockTable)m_htLockTables.get(strKey)) == null) m_htLockTables.put(strKey, lockTable = new LockTable()); } m_hsMyLockTables.add(lockTable); // Keep track of the lock tables that I used } return lockTable; }
java
public LockTable getLockTable(String strDatabaseName, String strRecordName) { String strKey = strDatabaseName + ':' + strRecordName; LockTable lockTable = (LockTable)m_htLockTables.get(strKey); if (lockTable == null) { synchronized (m_htLockTables) { if ((lockTable = (LockTable)m_htLockTables.get(strKey)) == null) m_htLockTables.put(strKey, lockTable = new LockTable()); } m_hsMyLockTables.add(lockTable); // Keep track of the lock tables that I used } return lockTable; }
[ "public", "LockTable", "getLockTable", "(", "String", "strDatabaseName", ",", "String", "strRecordName", ")", "{", "String", "strKey", "=", "strDatabaseName", "+", "'", "'", "+", "strRecordName", ";", "LockTable", "lockTable", "=", "(", "LockTable", ")", "m_htLo...
Get the lock table for this record. @param strRecordName The record to look up. @return The lock table for this record (create if it doesn't exist).
[ "Get", "the", "lock", "table", "for", "this", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/lock/LockSession.java#L181-L195
154,533
oglimmer/utils
src/main/java/de/oglimmer/utils/random/RandomName.java
RandomName.getName
public static String getName(final int parts) { final StringBuilder buff = new StringBuilder(); for (int i = 0; i < parts; i++) { if (buff.length() != 0) { buff.append('-'); } buff.append(NATOALPHABET[(int) (Math.random() * NATOALPHABET.length)]); } return buff.toString(); }
java
public static String getName(final int parts) { final StringBuilder buff = new StringBuilder(); for (int i = 0; i < parts; i++) { if (buff.length() != 0) { buff.append('-'); } buff.append(NATOALPHABET[(int) (Math.random() * NATOALPHABET.length)]); } return buff.toString(); }
[ "public", "static", "String", "getName", "(", "final", "int", "parts", ")", "{", "final", "StringBuilder", "buff", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parts", ";", "i", "++", ")", "{", "if",...
Creates a random name. @param parts number of words in this name @return the generated name
[ "Creates", "a", "random", "name", "." ]
bc46c57a24e60c9dbda4c73a810c163b0ce407ea
https://github.com/oglimmer/utils/blob/bc46c57a24e60c9dbda4c73a810c163b0ce407ea/src/main/java/de/oglimmer/utils/random/RandomName.java#L27-L36
154,534
jeroenvanmaanen/bridge-pattern
src/main/java/org/leialearns/bridge/FactoryInjector.java
FactoryInjector.setRegistry
public void setRegistry(BridgeHeadTypeRegistry registry) { this.registry.set(registry); for (FactoryAccessor<?> accessor : accessors) { registry.injectInto(accessor); } }
java
public void setRegistry(BridgeHeadTypeRegistry registry) { this.registry.set(registry); for (FactoryAccessor<?> accessor : accessors) { registry.injectInto(accessor); } }
[ "public", "void", "setRegistry", "(", "BridgeHeadTypeRegistry", "registry", ")", "{", "this", ".", "registry", ".", "set", "(", "registry", ")", ";", "for", "(", "FactoryAccessor", "<", "?", ">", "accessor", ":", "accessors", ")", "{", "registry", ".", "in...
Sets the registry that maps types to bridge factories. @param registry The registry to use
[ "Sets", "the", "registry", "that", "maps", "types", "to", "bridge", "factories", "." ]
55bd2de8cff800a1a97e26e97d3600e6dfb00b59
https://github.com/jeroenvanmaanen/bridge-pattern/blob/55bd2de8cff800a1a97e26e97d3600e6dfb00b59/src/main/java/org/leialearns/bridge/FactoryInjector.java#L75-L80
154,535
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.formatKommaSeperatedFileToList
public static List<String> formatKommaSeperatedFileToList(final File input, final String encoding) throws IOException { // The List where the data from every line from the File to put. final List<String> output = new ArrayList<>(); try (BufferedReader reader = (BufferedReader)StreamExtensions.getReader(input, encoding, false)) { // the line. String line = null; // read all lines from the file do { line = reader.readLine(); // if null break the loop if (line == null) { break; } // Split the line final String[] splittedData = line.split(","); // Iterate throuh the array for (final String element : splittedData) { // add the line to the list output.add(element.trim()); } } while (true); } // return the list with all lines from the file. return output; }
java
public static List<String> formatKommaSeperatedFileToList(final File input, final String encoding) throws IOException { // The List where the data from every line from the File to put. final List<String> output = new ArrayList<>(); try (BufferedReader reader = (BufferedReader)StreamExtensions.getReader(input, encoding, false)) { // the line. String line = null; // read all lines from the file do { line = reader.readLine(); // if null break the loop if (line == null) { break; } // Split the line final String[] splittedData = line.split(","); // Iterate throuh the array for (final String element : splittedData) { // add the line to the list output.add(element.trim()); } } while (true); } // return the list with all lines from the file. return output; }
[ "public", "static", "List", "<", "String", ">", "formatKommaSeperatedFileToList", "(", "final", "File", "input", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "// The List where the data from every line from the File to put.", "final", "List", "<"...
Reads every line from the File splits the data through a comma and puts them to the List. @param input The File from where the input comes. @param encoding The encoding from the file. @return The List with all lines from the file. @throws IOException Signals that an I/O exception has occurred.
[ "Reads", "every", "line", "from", "the", "File", "splits", "the", "data", "through", "a", "comma", "and", "puts", "them", "to", "the", "List", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L68-L101
154,536
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.formatListToString
private static String formatListToString(final List<String> list) { int lineLength = 0; final StringBuffer sb = new StringBuffer(); for (final String str : list) { final int length = str.length(); lineLength = length + lineLength; sb.append(str); sb.append(", "); if (100 < lineLength) { sb.append("\n"); lineLength = 0; } } return sb.toString().trim(); }
java
private static String formatListToString(final List<String> list) { int lineLength = 0; final StringBuffer sb = new StringBuffer(); for (final String str : list) { final int length = str.length(); lineLength = length + lineLength; sb.append(str); sb.append(", "); if (100 < lineLength) { sb.append("\n"); lineLength = 0; } } return sb.toString().trim(); }
[ "private", "static", "String", "formatListToString", "(", "final", "List", "<", "String", ">", "list", ")", "{", "int", "lineLength", "=", "0", ";", "final", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "final", "String", ...
Formats the List that contains String-object to a csv-file wich is plus-minus 100 characters in every line. @param list The List with the Strings. @return The String produced from the List.
[ "Formats", "the", "List", "that", "contains", "String", "-", "object", "to", "a", "csv", "-", "file", "wich", "is", "plus", "-", "minus", "100", "characters", "in", "every", "line", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L111-L128
154,537
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.formatToCSV
public static void formatToCSV(final File input, final File output, final String encoding) throws IOException { final List<String> list = readLinesInList(input, "UTF-8"); final String sb = formatListToString(list); WriteFileExtensions.writeStringToFile(output, sb, encoding); }
java
public static void formatToCSV(final File input, final File output, final String encoding) throws IOException { final List<String> list = readLinesInList(input, "UTF-8"); final String sb = formatListToString(list); WriteFileExtensions.writeStringToFile(output, sb, encoding); }
[ "public", "static", "void", "formatToCSV", "(", "final", "File", "input", ",", "final", "File", "output", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "final", "List", "<", "String", ">", "list", "=", "readLinesInList", "(", "input"...
Formats a file that has in every line one input-data into a csv-file. @param input The input-file to format. The current format from the file is every data in a line. @param output The file where the formatted data should be inserted. @param encoding the encoding @throws IOException When an io error occurs.
[ "Formats", "a", "file", "that", "has", "in", "every", "line", "one", "input", "-", "data", "into", "a", "csv", "-", "file", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L143-L149
154,538
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.readFilelistToProperties
public static Properties readFilelistToProperties(final File input) throws IOException { final List<String> list = readLinesInList(input, null); final Properties prop = new Properties(); for (int i = 0; i < list.size(); i++) { final String element = list.get(i); prop.put(i + "", element); } return prop; }
java
public static Properties readFilelistToProperties(final File input) throws IOException { final List<String> list = readLinesInList(input, null); final Properties prop = new Properties(); for (int i = 0; i < list.size(); i++) { final String element = list.get(i); prop.put(i + "", element); } return prop; }
[ "public", "static", "Properties", "readFilelistToProperties", "(", "final", "File", "input", ")", "throws", "IOException", "{", "final", "List", "<", "String", ">", "list", "=", "readLinesInList", "(", "input", ",", "null", ")", ";", "final", "Properties", "pr...
Read filelist to properties. @param input the input @return the properties @throws IOException Signals that an I/O exception has occurred.
[ "Read", "filelist", "to", "properties", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L350-L360
154,539
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.readFileToList
public static List<String> readFileToList(final File file, final String encoding) throws IOException { final List<String> fn = new ArrayList<>(); try (BufferedReader reader = (BufferedReader)StreamExtensions.getReader(file, encoding, false)) { // the line. String line = null; // read all lines from the file do { line = reader.readLine(); // if null break the loop if (line == null) { break; } fn.add(line); } while (true); } catch (final IOException e) { throw e; } return fn; }
java
public static List<String> readFileToList(final File file, final String encoding) throws IOException { final List<String> fn = new ArrayList<>(); try (BufferedReader reader = (BufferedReader)StreamExtensions.getReader(file, encoding, false)) { // the line. String line = null; // read all lines from the file do { line = reader.readLine(); // if null break the loop if (line == null) { break; } fn.add(line); } while (true); } catch (final IOException e) { throw e; } return fn; }
[ "public", "static", "List", "<", "String", ">", "readFileToList", "(", "final", "File", "file", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "final", "List", "<", "String", ">", "fn", "=", "new", "ArrayList", "<>", "(", ")", ";"...
Reads every line from the given File into a List and returns the List. @param file The file from where to read. @param encoding The encoding to read. @return The List with all lines from the File. @throws IOException When a io-problem occurs.
[ "Reads", "every", "line", "from", "the", "given", "File", "into", "a", "List", "and", "returns", "the", "List", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L388-L418
154,540
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.sortData
public static String[] sortData(final File csvData, final String encoding) throws FileNotFoundException, IOException { final List<String> fn = new ArrayList<>(); try (BufferedReader reader = (BufferedReader)StreamExtensions.getReader(csvData, encoding, false)) { // the line. String line = null; int index, last; // read all lines from the file do { line = reader.readLine(); // if null break the loop if (line == null) { break; } // initialize the last last = 0; // get the index from the comma index = line.indexOf(','); while (index != -1) { // get the next firstname and remove the whitespaces. final String firstname = line.substring(last, index).trim(); // added to the list fn.add(firstname); // set last to the next position last = index + 1; // get the next index from the comma in the line index = line.indexOf(',', last); } } while (true); } catch (final IOException e) { throw e; } // convert the list to a String array. final String data[] = fn.toArray(new String[fn.size()]); // and sort the array. Arrays.sort(data); return data; }
java
public static String[] sortData(final File csvData, final String encoding) throws FileNotFoundException, IOException { final List<String> fn = new ArrayList<>(); try (BufferedReader reader = (BufferedReader)StreamExtensions.getReader(csvData, encoding, false)) { // the line. String line = null; int index, last; // read all lines from the file do { line = reader.readLine(); // if null break the loop if (line == null) { break; } // initialize the last last = 0; // get the index from the comma index = line.indexOf(','); while (index != -1) { // get the next firstname and remove the whitespaces. final String firstname = line.substring(last, index).trim(); // added to the list fn.add(firstname); // set last to the next position last = index + 1; // get the next index from the comma in the line index = line.indexOf(',', last); } } while (true); } catch (final IOException e) { throw e; } // convert the list to a String array. final String data[] = fn.toArray(new String[fn.size()]); // and sort the array. Arrays.sort(data); return data; }
[ "public", "static", "String", "[", "]", "sortData", "(", "final", "File", "csvData", ",", "final", "String", "encoding", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "final", "List", "<", "String", ">", "fn", "=", "new", "ArrayList", "<>"...
Read an csv-file and puts them in a String-array. @param csvData The csv-file with the data. @param encoding The encoding to read. @return The data from the csv-file as a String-array. @throws FileNotFoundException the file not found exception @throws IOException When an io-error occurs.
[ "Read", "an", "csv", "-", "file", "and", "puts", "them", "in", "a", "String", "-", "array", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L523-L570
154,541
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.storeFilelistToProperties
public static void storeFilelistToProperties(final File output, final File input, final String comments) throws IOException { final Properties prop = readFilelistToProperties(input); try (final OutputStream out = StreamExtensions.getOutputStream(output, true)) { prop.store(out, comments); } final OutputStream out = StreamExtensions.getOutputStream(output, true); prop.store(out, comments); }
java
public static void storeFilelistToProperties(final File output, final File input, final String comments) throws IOException { final Properties prop = readFilelistToProperties(input); try (final OutputStream out = StreamExtensions.getOutputStream(output, true)) { prop.store(out, comments); } final OutputStream out = StreamExtensions.getOutputStream(output, true); prop.store(out, comments); }
[ "public", "static", "void", "storeFilelistToProperties", "(", "final", "File", "output", ",", "final", "File", "input", ",", "final", "String", "comments", ")", "throws", "IOException", "{", "final", "Properties", "prop", "=", "readFilelistToProperties", "(", "inp...
Stores a komma seperated file to a properties object. As key is the number from the counter. @param output the output @param input the input @param comments the comments @throws IOException Signals that an I/O exception has occurred.
[ "Stores", "a", "komma", "seperated", "file", "to", "a", "properties", "object", ".", "As", "key", "is", "the", "number", "from", "the", "counter", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L584-L594
154,542
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.writeLinesToFile
public static void writeLinesToFile(final Collection<String> collection, final File output, final String encoding) throws IOException { final StringBuffer sb = new StringBuffer(); for (final String element : collection) { sb.append(element); sb.append("\n"); } WriteFileExtensions.writeStringToFile(output, sb.toString(), encoding); }
java
public static void writeLinesToFile(final Collection<String> collection, final File output, final String encoding) throws IOException { final StringBuffer sb = new StringBuffer(); for (final String element : collection) { sb.append(element); sb.append("\n"); } WriteFileExtensions.writeStringToFile(output, sb.toString(), encoding); }
[ "public", "static", "void", "writeLinesToFile", "(", "final", "Collection", "<", "String", ">", "collection", ",", "final", "File", "output", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "final", "StringBuffer", "sb", "=", "new", "Str...
Writes all the String-object in the collection into the given file. @param collection The collection with the String-object. @param output The file where the String-object will be writing. @param encoding The encoding from the file. @throws IOException Signals that an I/O exception has occurred.
[ "Writes", "all", "the", "String", "-", "object", "in", "the", "collection", "into", "the", "given", "file", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L627-L637
154,543
DependencyWatcher/agent
src/main/java/com/dependencywatcher/client/DependencyWatcherClient.java
DependencyWatcherClient.uploadRepository
public void uploadRepository(String name, File archive) throws ClientException { HttpPut putMethod = new HttpPut(baseUri + "/repository/" + encodeURIComponent(name)); HttpEntity httpEntity = MultipartEntityBuilder .create() .addBinaryBody("file", archive, ContentType.create("application/zip"), archive.getName()).build(); putMethod.setEntity(httpEntity); try { CloseableHttpResponse result = httpClient.execute(putMethod); try { StatusLine status = result.getStatusLine(); if (status.getStatusCode() != HttpStatus.SC_CREATED) { throw new APICallException(EntityUtils.toString(result .getEntity()), status.getStatusCode()); } } finally { result.close(); } } catch (HttpResponseException e) { throw new APICallException(e.getMessage(), e.getStatusCode()); } catch (IOException e) { throw new NotAvailableException(e); } }
java
public void uploadRepository(String name, File archive) throws ClientException { HttpPut putMethod = new HttpPut(baseUri + "/repository/" + encodeURIComponent(name)); HttpEntity httpEntity = MultipartEntityBuilder .create() .addBinaryBody("file", archive, ContentType.create("application/zip"), archive.getName()).build(); putMethod.setEntity(httpEntity); try { CloseableHttpResponse result = httpClient.execute(putMethod); try { StatusLine status = result.getStatusLine(); if (status.getStatusCode() != HttpStatus.SC_CREATED) { throw new APICallException(EntityUtils.toString(result .getEntity()), status.getStatusCode()); } } finally { result.close(); } } catch (HttpResponseException e) { throw new APICallException(e.getMessage(), e.getStatusCode()); } catch (IOException e) { throw new NotAvailableException(e); } }
[ "public", "void", "uploadRepository", "(", "String", "name", ",", "File", "archive", ")", "throws", "ClientException", "{", "HttpPut", "putMethod", "=", "new", "HttpPut", "(", "baseUri", "+", "\"/repository/\"", "+", "encodeURIComponent", "(", "name", ")", ")", ...
Creates or updates repository by the given name @param name Repository name @param archive Archive containing repository data @throws ClientException
[ "Creates", "or", "updates", "repository", "by", "the", "given", "name" ]
6a082650275f9555993f5607d1f0bbe7aceceee1
https://github.com/DependencyWatcher/agent/blob/6a082650275f9555993f5607d1f0bbe7aceceee1/src/main/java/com/dependencywatcher/client/DependencyWatcherClient.java#L76-L107
154,544
jbundle/jbundle
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/message/trx/transport/html/MessageServlet.java
MessageServlet.initServletSession
public void initServletSession(Task servletTask) { String strTrxID = servletTask.getProperty(TrxMessageHeader.LOG_TRX_ID); if (strTrxID != null) { // Good, they are referencing a transaction (access the transaction properties). MessageLogModel recMessageLog = (MessageLogModel)Record.makeRecordFromClassName(MessageLog.THICK_CLASS, (RecordOwner)servletTask.getApplication().getSystemRecordOwner()); try { recMessageLog = recMessageLog.getMessageLog(strTrxID); if (recMessageLog != null) { servletTask.setProperty(TrxMessageHeader.LOG_TRX_ID, strTrxID); String strHTMLScreen = recMessageLog.getProperty("screen" /*ScreenMessageTransport.SCREEN_SCREEN */); if (strHTMLScreen != null) // Special case, html screen is different from java screen. servletTask.setProperty(DBParams.SCREEN, strHTMLScreen); } } finally { recMessageLog.free(); } } }
java
public void initServletSession(Task servletTask) { String strTrxID = servletTask.getProperty(TrxMessageHeader.LOG_TRX_ID); if (strTrxID != null) { // Good, they are referencing a transaction (access the transaction properties). MessageLogModel recMessageLog = (MessageLogModel)Record.makeRecordFromClassName(MessageLog.THICK_CLASS, (RecordOwner)servletTask.getApplication().getSystemRecordOwner()); try { recMessageLog = recMessageLog.getMessageLog(strTrxID); if (recMessageLog != null) { servletTask.setProperty(TrxMessageHeader.LOG_TRX_ID, strTrxID); String strHTMLScreen = recMessageLog.getProperty("screen" /*ScreenMessageTransport.SCREEN_SCREEN */); if (strHTMLScreen != null) // Special case, html screen is different from java screen. servletTask.setProperty(DBParams.SCREEN, strHTMLScreen); } } finally { recMessageLog.free(); } } }
[ "public", "void", "initServletSession", "(", "Task", "servletTask", ")", "{", "String", "strTrxID", "=", "servletTask", ".", "getProperty", "(", "TrxMessageHeader", ".", "LOG_TRX_ID", ")", ";", "if", "(", "strTrxID", "!=", "null", ")", "{", "// Good, they are re...
Do any of the initial servlet stuff. @param servletTask The calling servlet task.
[ "Do", "any", "of", "the", "initial", "servlet", "stuff", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/message/trx/transport/html/MessageServlet.java#L71-L90
154,545
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.add
public void add(int i, int j, double v) { consumer.set(i, j, supplier.get(i, j) + v); }
java
public void add(int i, int j, double v) { consumer.set(i, j, supplier.get(i, j) + v); }
[ "public", "void", "add", "(", "int", "i", ",", "int", "j", ",", "double", "v", ")", "{", "consumer", ".", "set", "(", "i", ",", "j", ",", "supplier", ".", "get", "(", "i", ",", "j", ")", "+", "v", ")", ";", "}" ]
Aij += v @param i @param j @param v
[ "Aij", "+", "=", "v" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L218-L221
154,546
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.sub
public void sub(int i, int j, double v) { consumer.set(i, j, supplier.get(i, j) - v); }
java
public void sub(int i, int j, double v) { consumer.set(i, j, supplier.get(i, j) - v); }
[ "public", "void", "sub", "(", "int", "i", ",", "int", "j", ",", "double", "v", ")", "{", "consumer", ".", "set", "(", "i", ",", "j", ",", "supplier", ".", "get", "(", "i", ",", "j", ")", "-", "v", ")", ";", "}" ]
Aij -= v @param i @param j @param v
[ "Aij", "-", "=", "v" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L228-L231
154,547
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.scalarMultiply
public void scalarMultiply(double c) { int m = rows; int n = cols; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { consumer.set(i, j, c * supplier.get(i, j)); } } }
java
public void scalarMultiply(double c) { int m = rows; int n = cols; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { consumer.set(i, j, c * supplier.get(i, j)); } } }
[ "public", "void", "scalarMultiply", "(", "double", "c", ")", "{", "int", "m", "=", "rows", ";", "int", "n", "=", "cols", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ...
Scalar multiplies each item with c @param c
[ "Scalar", "multiplies", "each", "item", "with", "c" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L256-L267
154,548
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.multiply
public DoubleMatrix multiply(double c) { DoubleMatrix clone = clone(); clone.scalarMultiply(c); return clone; }
java
public DoubleMatrix multiply(double c) { DoubleMatrix clone = clone(); clone.scalarMultiply(c); return clone; }
[ "public", "DoubleMatrix", "multiply", "(", "double", "c", ")", "{", "DoubleMatrix", "clone", "=", "clone", "(", ")", ";", "clone", ".", "scalarMultiply", "(", "c", ")", ";", "return", "clone", ";", "}" ]
Return new DoubleMatrix which is copy of this DoubleMatrix with each item scalar multiplied with c. @param c @return
[ "Return", "new", "DoubleMatrix", "which", "is", "copy", "of", "this", "DoubleMatrix", "with", "each", "item", "scalar", "multiplied", "with", "c", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L274-L279
154,549
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.swapRows
public void swapRows(int r1, int r2) { int n = columns(); ItemSupplier s = supplier; ItemConsumer c = consumer; for (int j = 0; j < n; j++) { double v = s.get(r1, j); c.set(r1, j, s.get(r2, j)); c.set(r2, j, v); } }
java
public void swapRows(int r1, int r2) { int n = columns(); ItemSupplier s = supplier; ItemConsumer c = consumer; for (int j = 0; j < n; j++) { double v = s.get(r1, j); c.set(r1, j, s.get(r2, j)); c.set(r2, j, v); } }
[ "public", "void", "swapRows", "(", "int", "r1", ",", "int", "r2", ")", "{", "int", "n", "=", "columns", "(", ")", ";", "ItemSupplier", "s", "=", "supplier", ";", "ItemConsumer", "c", "=", "consumer", ";", "for", "(", "int", "j", "=", "0", ";", "j...
Swaps row r1 and r2 @param r1 @param r2
[ "Swaps", "row", "r1", "and", "r2" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L327-L338
154,550
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.permutationDeterminant
public double permutationDeterminant() { int sign = 1; double sum = 0; PermutationMatrix pm = PermutationMatrix.getInstance(rows); int perms = pm.rows; for (int p=0;p<perms;p++) { double mul = 1; for (int i=0;i<rows;i++) { mul *= get(i, pm.get(p, i)); } sum += sign*mul; sign = -sign; } return sum; }
java
public double permutationDeterminant() { int sign = 1; double sum = 0; PermutationMatrix pm = PermutationMatrix.getInstance(rows); int perms = pm.rows; for (int p=0;p<perms;p++) { double mul = 1; for (int i=0;i<rows;i++) { mul *= get(i, pm.get(p, i)); } sum += sign*mul; sign = -sign; } return sum; }
[ "public", "double", "permutationDeterminant", "(", ")", "{", "int", "sign", "=", "1", ";", "double", "sum", "=", "0", ";", "PermutationMatrix", "pm", "=", "PermutationMatrix", ".", "getInstance", "(", "rows", ")", ";", "int", "perms", "=", "pm", ".", "ro...
Calculates determinant by using permutations @return
[ "Calculates", "determinant", "by", "using", "permutations" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L355-L372
154,551
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.solve
public DoubleMatrix solve(DoubleMatrix b) { DoubleMatrix x = getInstance(b.rows(), b.columns()); solve(b, x); return x; }
java
public DoubleMatrix solve(DoubleMatrix b) { DoubleMatrix x = getInstance(b.rows(), b.columns()); solve(b, x); return x; }
[ "public", "DoubleMatrix", "solve", "(", "DoubleMatrix", "b", ")", "{", "DoubleMatrix", "x", "=", "getInstance", "(", "b", ".", "rows", "(", ")", ",", "b", ".", "columns", "(", ")", ")", ";", "solve", "(", "b", ",", "x", ")", ";", "return", "x", "...
Solve linear equation Ax = b returning x @param b @return
[ "Solve", "linear", "equation", "Ax", "=", "b", "returning", "x" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L378-L383
154,552
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.solve
public void solve(DoubleMatrix b, DoubleMatrix x) { if (A == null) { throw new IllegalArgumentException("decompose() not called"); } lupSolve(A, P, b, x); }
java
public void solve(DoubleMatrix b, DoubleMatrix x) { if (A == null) { throw new IllegalArgumentException("decompose() not called"); } lupSolve(A, P, b, x); }
[ "public", "void", "solve", "(", "DoubleMatrix", "b", ",", "DoubleMatrix", "x", ")", "{", "if", "(", "A", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"decompose() not called\"", ")", ";", "}", "lupSolve", "(", "A", ",", "P", ...
Solve linear equation Ax = b @param b @param x
[ "Solve", "linear", "equation", "Ax", "=", "b" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L389-L396
154,553
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.getInstance
public static DoubleMatrix getInstance(int rows, int cols, ItemSupplier s) { DoubleMatrix m = new DoubleMatrix(rows, cols); ItemConsumer c = m.consumer; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { c.set(i, j, s.get(i, j)); } } return m; }
java
public static DoubleMatrix getInstance(int rows, int cols, ItemSupplier s) { DoubleMatrix m = new DoubleMatrix(rows, cols); ItemConsumer c = m.consumer; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { c.set(i, j, s.get(i, j)); } } return m; }
[ "public", "static", "DoubleMatrix", "getInstance", "(", "int", "rows", ",", "int", "cols", ",", "ItemSupplier", "s", ")", "{", "DoubleMatrix", "m", "=", "new", "DoubleMatrix", "(", "rows", ",", "cols", ")", ";", "ItemConsumer", "c", "=", "m", ".", "consu...
Returns new DoubleMatrix initialized by function @param rows @param cols @param s @return
[ "Returns", "new", "DoubleMatrix", "initialized", "by", "function" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L657-L669
154,554
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.multiply
public static DoubleMatrix multiply(DoubleMatrix m1, DoubleMatrix m2) { if (m1.cols != m2.rows) { throw new IllegalArgumentException("Matrices not comfortable"); } int m = m1.rows; int n = m1.cols; int p = m2.cols; ItemSupplier s1 = m1.supplier; ItemSupplier s2 = m2.supplier; DoubleMatrix mr = DoubleMatrix.getInstance(m, p); ItemConsumer c = mr.consumer; for (int i = 0; i < m; i++) { for (int j = 0; j < p; j++) { double s = 0; for (int r = 0; r < n; r++) { s += s1.get(i, r) * s2.get(r, j); } c.set(i, j, s); } } return mr; }
java
public static DoubleMatrix multiply(DoubleMatrix m1, DoubleMatrix m2) { if (m1.cols != m2.rows) { throw new IllegalArgumentException("Matrices not comfortable"); } int m = m1.rows; int n = m1.cols; int p = m2.cols; ItemSupplier s1 = m1.supplier; ItemSupplier s2 = m2.supplier; DoubleMatrix mr = DoubleMatrix.getInstance(m, p); ItemConsumer c = mr.consumer; for (int i = 0; i < m; i++) { for (int j = 0; j < p; j++) { double s = 0; for (int r = 0; r < n; r++) { s += s1.get(i, r) * s2.get(r, j); } c.set(i, j, s); } } return mr; }
[ "public", "static", "DoubleMatrix", "multiply", "(", "DoubleMatrix", "m1", ",", "DoubleMatrix", "m2", ")", "{", "if", "(", "m1", ".", "cols", "!=", "m2", ".", "rows", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Matrices not comfortable\"", ")...
Returns new DoubleMatrix which is m1 multiplied with m2. @param m1 @param m2 @return
[ "Returns", "new", "DoubleMatrix", "which", "is", "m1", "multiplied", "with", "m2", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L713-L739
154,555
tvesalainen/util
util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java
DoubleMatrix.identity
public static DoubleMatrix identity(int n) { return getInstance(n ,n, (i, j) -> i == j ? 1 : 0); }
java
public static DoubleMatrix identity(int n) { return getInstance(n ,n, (i, j) -> i == j ? 1 : 0); }
[ "public", "static", "DoubleMatrix", "identity", "(", "int", "n", ")", "{", "return", "getInstance", "(", "n", ",", "n", ",", "(", "i", ",", "j", ")", "->", "i", "==", "j", "?", "1", ":", "0", ")", ";", "}" ]
Returns new identity matrix. @param n @return
[ "Returns", "new", "identity", "matrix", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/DoubleMatrix.java#L745-L748
154,556
js-lib-com/commons
src/main/java/js/lang/ConfigBuilder.java
ConfigBuilder.build
public Config build() throws ConfigException { if (properties != null) { Config config = new Config("properties"); config.setProperties(properties); return config; } try { Loader loader = new Loader(); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setContentHandler(loader); reader.parse(new InputSource(xmlStream)); return loader.getConfig(); } catch (Exception e) { throw new ConfigException(e); } }
java
public Config build() throws ConfigException { if (properties != null) { Config config = new Config("properties"); config.setProperties(properties); return config; } try { Loader loader = new Loader(); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setContentHandler(loader); reader.parse(new InputSource(xmlStream)); return loader.getConfig(); } catch (Exception e) { throw new ConfigException(e); } }
[ "public", "Config", "build", "(", ")", "throws", "ConfigException", "{", "if", "(", "properties", "!=", "null", ")", "{", "Config", "config", "=", "new", "Config", "(", "\"properties\"", ")", ";", "config", ".", "setProperties", "(", "properties", ")", ";"...
Build configuration object. Configuration object is not reusable so this factory creates a new instance for every call. @return newly created configuration object. @throws ConfigException if XML stream read operation fails or is not well formed.
[ "Build", "configuration", "object", ".", "Configuration", "object", "is", "not", "reusable", "so", "this", "factory", "creates", "a", "new", "instance", "for", "every", "call", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/ConfigBuilder.java#L89-L109
154,557
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/MoveOnChangeHandler.java
MoveOnChangeHandler.fieldChanged
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { int iErrorCode = this.moveIt(bDisplayOption, iMoveMode); if (iErrorCode != DBConstants.NORMAL_RETURN) if (this.getOwner() != m_fldSource) if (this.getOwner() != m_fldDest) iErrorCode = DBConstants.NORMAL_RETURN; // If the source and dest are unrelated this this, don't return an error (and revert this field) if (iErrorCode == DBConstants.NORMAL_RETURN) iErrorCode = super.fieldChanged(bDisplayOption, iMoveMode); return iErrorCode; }
java
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { int iErrorCode = this.moveIt(bDisplayOption, iMoveMode); if (iErrorCode != DBConstants.NORMAL_RETURN) if (this.getOwner() != m_fldSource) if (this.getOwner() != m_fldDest) iErrorCode = DBConstants.NORMAL_RETURN; // If the source and dest are unrelated this this, don't return an error (and revert this field) if (iErrorCode == DBConstants.NORMAL_RETURN) iErrorCode = super.fieldChanged(bDisplayOption, iMoveMode); return iErrorCode; }
[ "public", "int", "fieldChanged", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "int", "iErrorCode", "=", "this", ".", "moveIt", "(", "bDisplayOption", ",", "iMoveMode", ")", ";", "if", "(", "iErrorCode", "!=", "DBConstants", ".", "NORM...
The Field has Changed. Move the source field to the destination field. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "The", "Field", "has", "Changed", ".", "Move", "the", "source", "field", "to", "the", "destination", "field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/MoveOnChangeHandler.java#L160-L170
154,558
huangp/entityunit
src/main/java/com/github/huangp/entityunit/maker/ScalarValueMakerFactory.java
ScalarValueMakerFactory.from
public Maker from(Settable settable) { Optional<Maker<?>> makerOptional = context.getPreferredValueMakers().getMaker(settable); if (makerOptional.isPresent()) { return makerOptional.get(); } Type type = settable.getType(); Class<?> rawType = ClassUtil.getRawType(type); if (ClassUtil.isPrimitive(type)) { return new PrimitiveMaker(type); } if (type == String.class) { return StringMaker.from(settable); } if (type == Date.class) { return new DateMaker(); } if (Number.class.isAssignableFrom(rawType)) { return NumberMaker.from(settable); } if (ClassUtil.isArray(type)) { log.trace("array type: {}", rawType.getComponentType()); return new NullMaker(); } if (ClassUtil.isEnum(type)) { log.trace("enum type: {}", type); return new EnumMaker(rawType.getEnumConstants()); } if (ClassUtil.isCollection(type)) { log.trace("collection: {}", type); return new NullMaker(); } if (ClassUtil.isMap(type)) { log.trace("map: {}", type); return new NullMaker<Object>(); } if (ClassUtil.isEntity(type)) { log.trace("{} is entity type", type); // we don't want to make unnecessary entities // @see EntityMakerBuilder return new ReuseOrNullMaker(context.getBeanValueHolder(), rawType); } log.debug("guessing this is a bean {}", type); return new BeanMaker(rawType, context); }
java
public Maker from(Settable settable) { Optional<Maker<?>> makerOptional = context.getPreferredValueMakers().getMaker(settable); if (makerOptional.isPresent()) { return makerOptional.get(); } Type type = settable.getType(); Class<?> rawType = ClassUtil.getRawType(type); if (ClassUtil.isPrimitive(type)) { return new PrimitiveMaker(type); } if (type == String.class) { return StringMaker.from(settable); } if (type == Date.class) { return new DateMaker(); } if (Number.class.isAssignableFrom(rawType)) { return NumberMaker.from(settable); } if (ClassUtil.isArray(type)) { log.trace("array type: {}", rawType.getComponentType()); return new NullMaker(); } if (ClassUtil.isEnum(type)) { log.trace("enum type: {}", type); return new EnumMaker(rawType.getEnumConstants()); } if (ClassUtil.isCollection(type)) { log.trace("collection: {}", type); return new NullMaker(); } if (ClassUtil.isMap(type)) { log.trace("map: {}", type); return new NullMaker<Object>(); } if (ClassUtil.isEntity(type)) { log.trace("{} is entity type", type); // we don't want to make unnecessary entities // @see EntityMakerBuilder return new ReuseOrNullMaker(context.getBeanValueHolder(), rawType); } log.debug("guessing this is a bean {}", type); return new BeanMaker(rawType, context); }
[ "public", "Maker", "from", "(", "Settable", "settable", ")", "{", "Optional", "<", "Maker", "<", "?", ">", ">", "makerOptional", "=", "context", ".", "getPreferredValueMakers", "(", ")", ".", "getMaker", "(", "settable", ")", ";", "if", "(", "makerOptional...
produce a maker for given settable @param settable settable @return maker
[ "produce", "a", "maker", "for", "given", "settable" ]
1a09b530149d707dbff7ff46f5428d9db709a4b4
https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/maker/ScalarValueMakerFactory.java#L50-L95
154,559
dfoerderreuther/console-builder
console-builder/src/main/java/de/eleon/console/builder/ConsoleBuilder.java
ConsoleBuilder.print
public static void print(final CharSequence line) { print(new Applyable<ConsoleReaderWrapper>() { public void apply(ConsoleReaderWrapper consoleReaderWrapper) { consoleReaderWrapper.print(line); } }); }
java
public static void print(final CharSequence line) { print(new Applyable<ConsoleReaderWrapper>() { public void apply(ConsoleReaderWrapper consoleReaderWrapper) { consoleReaderWrapper.print(line); } }); }
[ "public", "static", "void", "print", "(", "final", "CharSequence", "line", ")", "{", "print", "(", "new", "Applyable", "<", "ConsoleReaderWrapper", ">", "(", ")", "{", "public", "void", "apply", "(", "ConsoleReaderWrapper", "consoleReaderWrapper", ")", "{", "c...
Print line to console @param line CharSequence to print
[ "Print", "line", "to", "console" ]
814bee4a1a812a3a39a9b239e5eccb525b944e65
https://github.com/dfoerderreuther/console-builder/blob/814bee4a1a812a3a39a9b239e5eccb525b944e65/console-builder/src/main/java/de/eleon/console/builder/ConsoleBuilder.java#L40-L46
154,560
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/filter/MethodFilterBuilder.java
MethodFilterBuilder.isDefault
public MethodFilterBuilder isDefault() { add(new NegationMethodFilter(new ModifierMethodFilter(Modifier.PUBLIC & Modifier.PROTECTED & Modifier.PRIVATE))); return this; }
java
public MethodFilterBuilder isDefault() { add(new NegationMethodFilter(new ModifierMethodFilter(Modifier.PUBLIC & Modifier.PROTECTED & Modifier.PRIVATE))); return this; }
[ "public", "MethodFilterBuilder", "isDefault", "(", ")", "{", "add", "(", "new", "NegationMethodFilter", "(", "new", "ModifierMethodFilter", "(", "Modifier", ".", "PUBLIC", "&", "Modifier", ".", "PROTECTED", "&", "Modifier", ".", "PRIVATE", ")", ")", ")", ";", ...
Adds a filter for default access methods only. @return The builder to support method chaining.
[ "Adds", "a", "filter", "for", "default", "access", "methods", "only", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/filter/MethodFilterBuilder.java#L151-L154
154,561
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/filter/MethodFilterBuilder.java
MethodFilterBuilder.build
public MethodFilter build() { if(filters.isEmpty()) { throw new IllegalStateException("No filter specified."); } if(filters.size() == 1) { return filters.get(0); } MethodFilter[] methodFilters = new MethodFilter[filters.size()]; filters.toArray(methodFilters); return new MethodFilterList(methodFilters); }
java
public MethodFilter build() { if(filters.isEmpty()) { throw new IllegalStateException("No filter specified."); } if(filters.size() == 1) { return filters.get(0); } MethodFilter[] methodFilters = new MethodFilter[filters.size()]; filters.toArray(methodFilters); return new MethodFilterList(methodFilters); }
[ "public", "MethodFilter", "build", "(", ")", "{", "if", "(", "filters", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"No filter specified.\"", ")", ";", "}", "if", "(", "filters", ".", "size", "(", ")", "==", "1", ...
Returns the MethodFilter built. @return the MethodFilter built. @throws IllegalStateException if no filter was specified before calling build()
[ "Returns", "the", "MethodFilter", "built", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/filter/MethodFilterBuilder.java#L369-L379
154,562
tvesalainen/util
util/src/main/java/org/vesalainen/navi/LocalLongitude.java
LocalLongitude.getInstance
public static LocalLongitude getInstance(double longitude, double latitude) { if (Math.abs(longitude) < 179) { return new LocalLongitude(latitude); } else { return new PacificLongitude(latitude); } }
java
public static LocalLongitude getInstance(double longitude, double latitude) { if (Math.abs(longitude) < 179) { return new LocalLongitude(latitude); } else { return new PacificLongitude(latitude); } }
[ "public", "static", "LocalLongitude", "getInstance", "(", "double", "longitude", ",", "double", "latitude", ")", "{", "if", "(", "Math", ".", "abs", "(", "longitude", ")", "<", "179", ")", "{", "return", "new", "LocalLongitude", "(", "latitude", ")", ";", ...
Returns LocalLongitude instance which is usable about 60 NM around starting point. @param longitude @param latitude @return
[ "Returns", "LocalLongitude", "instance", "which", "is", "usable", "about", "60", "NM", "around", "starting", "point", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/LocalLongitude.java#L46-L56
154,563
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/KeyAreaInfo.java
KeyAreaInfo.addKeyField
public void addKeyField(Field field, boolean bKeyOrder) { // Get the field with this seq if (m_vKeyFieldList.size() == 0) m_bKeyOrder = bKeyOrder; m_vKeyFieldList.add(field); // init the key field seq }
java
public void addKeyField(Field field, boolean bKeyOrder) { // Get the field with this seq if (m_vKeyFieldList.size() == 0) m_bKeyOrder = bKeyOrder; m_vKeyFieldList.add(field); // init the key field seq }
[ "public", "void", "addKeyField", "(", "Field", "field", ",", "boolean", "bKeyOrder", ")", "{", "// Get the field with this seq", "if", "(", "m_vKeyFieldList", ".", "size", "(", ")", "==", "0", ")", "m_bKeyOrder", "=", "bKeyOrder", ";", "m_vKeyFieldList", ".", ...
Add this field to this Key Area. @param field The field to add. @param bKeyArea The order (ascending/descending).
[ "Add", "this", "field", "to", "this", "Key", "Area", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/KeyAreaInfo.java#L146-L151
154,564
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/KeyAreaInfo.java
KeyAreaInfo.getField
public FieldInfo getField(int iKeyFieldSeq) { if (iKeyFieldSeq >= m_vKeyFieldList.size()) return null; return (FieldInfo)m_vKeyFieldList.elementAt(iKeyFieldSeq); }
java
public FieldInfo getField(int iKeyFieldSeq) { if (iKeyFieldSeq >= m_vKeyFieldList.size()) return null; return (FieldInfo)m_vKeyFieldList.elementAt(iKeyFieldSeq); }
[ "public", "FieldInfo", "getField", "(", "int", "iKeyFieldSeq", ")", "{", "if", "(", "iKeyFieldSeq", ">=", "m_vKeyFieldList", ".", "size", "(", ")", ")", "return", "null", ";", "return", "(", "FieldInfo", ")", "m_vKeyFieldList", ".", "elementAt", "(", "iKeyFi...
Get the Field in this KeyField. @param iKeyFieldSeq The position of this field in the key area. @return The field.
[ "Get", "the", "Field", "in", "this", "KeyField", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/KeyAreaInfo.java#L157-L162
154,565
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/KeyAreaInfo.java
KeyAreaInfo.reverseKeyBuffer
public void reverseKeyBuffer(BaseBuffer bufferSource, int iAreaDesc) // Move these keys back to the record { int iKeyFields = this.getKeyFields(); for (int iKeyFieldSeq = Constants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFields + Constants.MAIN_KEY_FIELD; iKeyFieldSeq++) { this.getField(iKeyFieldSeq).setData(m_rgobjTempData != null ? m_rgobjTempData[iKeyFieldSeq] : null); } }
java
public void reverseKeyBuffer(BaseBuffer bufferSource, int iAreaDesc) // Move these keys back to the record { int iKeyFields = this.getKeyFields(); for (int iKeyFieldSeq = Constants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFields + Constants.MAIN_KEY_FIELD; iKeyFieldSeq++) { this.getField(iKeyFieldSeq).setData(m_rgobjTempData != null ? m_rgobjTempData[iKeyFieldSeq] : null); } }
[ "public", "void", "reverseKeyBuffer", "(", "BaseBuffer", "bufferSource", ",", "int", "iAreaDesc", ")", "// Move these keys back to the record", "{", "int", "iKeyFields", "=", "this", ".", "getKeyFields", "(", ")", ";", "for", "(", "int", "iKeyFieldSeq", "=", "Cons...
Move the key area to the record. @param destBuffer A BaseBuffer to fill with data (ignored for thin). @param iAreaDesc The (optional) temporary area to copy the current fields to ().
[ "Move", "the", "key", "area", "to", "the", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/KeyAreaInfo.java#L221-L228
154,566
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.getGBConstraints
public GridBagConstraints getGBConstraints() { if (m_gbconstraints == null) { m_gbconstraints = new GridBagConstraints(); m_gbconstraints.insets = new Insets(2, 2, 2, 2); m_gbconstraints.ipadx = 2; m_gbconstraints.ipady = 2; } return m_gbconstraints; }
java
public GridBagConstraints getGBConstraints() { if (m_gbconstraints == null) { m_gbconstraints = new GridBagConstraints(); m_gbconstraints.insets = new Insets(2, 2, 2, 2); m_gbconstraints.ipadx = 2; m_gbconstraints.ipady = 2; } return m_gbconstraints; }
[ "public", "GridBagConstraints", "getGBConstraints", "(", ")", "{", "if", "(", "m_gbconstraints", "==", "null", ")", "{", "m_gbconstraints", "=", "new", "GridBagConstraints", "(", ")", ";", "m_gbconstraints", ".", "insets", "=", "new", "Insets", "(", "2", ",", ...
Get the GridBagConstraints. @return The gridbag constraints object.
[ "Get", "the", "GridBagConstraints", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L182-L192
154,567
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.setComponentConstraints
public void setComponentConstraints(JComponent component) { GridBagConstraints c = this.getGBConstraints(); GridBagLayout gridbag = (GridBagLayout)this.getScreenLayout(); gridbag.setConstraints(component, c); Application application = BaseApplet.getSharedInstance().getApplication(); MuffinManager muffinManager = application.getMuffinManager(); if (component instanceof JTextComponent) if (muffinManager != null) { muffinManager.replaceClipboardAction(component, "cut"); muffinManager.replaceClipboardAction(component, "copy"); muffinManager.replaceClipboardAction(component, "paste"); } }
java
public void setComponentConstraints(JComponent component) { GridBagConstraints c = this.getGBConstraints(); GridBagLayout gridbag = (GridBagLayout)this.getScreenLayout(); gridbag.setConstraints(component, c); Application application = BaseApplet.getSharedInstance().getApplication(); MuffinManager muffinManager = application.getMuffinManager(); if (component instanceof JTextComponent) if (muffinManager != null) { muffinManager.replaceClipboardAction(component, "cut"); muffinManager.replaceClipboardAction(component, "copy"); muffinManager.replaceClipboardAction(component, "paste"); } }
[ "public", "void", "setComponentConstraints", "(", "JComponent", "component", ")", "{", "GridBagConstraints", "c", "=", "this", ".", "getGBConstraints", "(", ")", ";", "GridBagLayout", "gridbag", "=", "(", "GridBagLayout", ")", "this", ".", "getScreenLayout", "(", ...
Set the constraints for this component. If you aren't using gridbag, override this. @param component The component to set the constraints for.
[ "Set", "the", "constraints", "for", "this", "component", ".", "If", "you", "aren", "t", "using", "gridbag", "override", "this", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L198-L213
154,568
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.addScreenLabels
public void addScreenLabels(Container parent) { GridBagConstraints c = this.getGBConstraints(); c.weightx = 0.0; // Minimum width to hold labels c.anchor = GridBagConstraints.NORTHEAST; // Labels right justified c.gridx = 0; // Column 0 c.gridy = GridBagConstraints.RELATIVE; // Bump Row each time for (int iIndex = 0; ; iIndex++) { Converter converter = this.getFieldForScreen(iIndex); if (converter == SKIP_THIS_FIELD) continue; if (converter == null) break; this.addScreenLabel(parent, converter); } }
java
public void addScreenLabels(Container parent) { GridBagConstraints c = this.getGBConstraints(); c.weightx = 0.0; // Minimum width to hold labels c.anchor = GridBagConstraints.NORTHEAST; // Labels right justified c.gridx = 0; // Column 0 c.gridy = GridBagConstraints.RELATIVE; // Bump Row each time for (int iIndex = 0; ; iIndex++) { Converter converter = this.getFieldForScreen(iIndex); if (converter == SKIP_THIS_FIELD) continue; if (converter == null) break; this.addScreenLabel(parent, converter); } }
[ "public", "void", "addScreenLabels", "(", "Container", "parent", ")", "{", "GridBagConstraints", "c", "=", "this", ".", "getGBConstraints", "(", ")", ";", "c", ".", "weightx", "=", "0.0", ";", "// Minimum width to hold labels", "c", ".", "anchor", "=", "GridBa...
Add the description labels to the first column of the grid. @param parent The container to add the control(s) to. @param gridbag The screen layout. @param c The constraint to use.
[ "Add", "the", "description", "labels", "to", "the", "first", "column", "of", "the", "grid", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L220-L236
154,569
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.addScreenLabel
public JComponent addScreenLabel(Container parent, Converter fieldInfo) { JComponent label = new JLabel(fieldInfo.getFieldDesc()); this.setComponentConstraints(label); parent.add(label); fieldInfo.addComponent(label); return label; }
java
public JComponent addScreenLabel(Container parent, Converter fieldInfo) { JComponent label = new JLabel(fieldInfo.getFieldDesc()); this.setComponentConstraints(label); parent.add(label); fieldInfo.addComponent(label); return label; }
[ "public", "JComponent", "addScreenLabel", "(", "Container", "parent", ",", "Converter", "fieldInfo", ")", "{", "JComponent", "label", "=", "new", "JLabel", "(", "fieldInfo", ".", "getFieldDesc", "(", ")", ")", ";", "this", ".", "setComponentConstraints", "(", ...
Add this label to the first column of the grid. @param parent The container to add the control(s) to. @param fieldInfo The field to add a label to. @param gridbag The screen layout. @param c The constraint to use.
[ "Add", "this", "label", "to", "the", "first", "column", "of", "the", "grid", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L244-L251
154,570
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.createScreenComponent
public JComponent createScreenComponent(Converter fieldInfo) { int iRows = 1; int iColumns = fieldInfo.getMaxLength(); if (iColumns > 40) { iRows = 3; iColumns = 30; } String strDefault = fieldInfo.toString(); if (strDefault == null) strDefault = Constants.BLANK; JComponent component = null; if (iRows <= 1) { component = new JTextField(strDefault, iColumns); if (fieldInfo instanceof FieldInfo) if (Number.class.isAssignableFrom(((FieldInfo)fieldInfo).getDataClass())) ((JTextField)component).setHorizontalAlignment(JTextField.RIGHT); } else { component = new JTextArea(strDefault, iRows, iColumns); component.setBorder(m_borderLine); } return component; }
java
public JComponent createScreenComponent(Converter fieldInfo) { int iRows = 1; int iColumns = fieldInfo.getMaxLength(); if (iColumns > 40) { iRows = 3; iColumns = 30; } String strDefault = fieldInfo.toString(); if (strDefault == null) strDefault = Constants.BLANK; JComponent component = null; if (iRows <= 1) { component = new JTextField(strDefault, iColumns); if (fieldInfo instanceof FieldInfo) if (Number.class.isAssignableFrom(((FieldInfo)fieldInfo).getDataClass())) ((JTextField)component).setHorizontalAlignment(JTextField.RIGHT); } else { component = new JTextArea(strDefault, iRows, iColumns); component.setBorder(m_borderLine); } return component; }
[ "public", "JComponent", "createScreenComponent", "(", "Converter", "fieldInfo", ")", "{", "int", "iRows", "=", "1", ";", "int", "iColumns", "=", "fieldInfo", ".", "getMaxLength", "(", ")", ";", "if", "(", "iColumns", ">", "40", ")", "{", "iRows", "=", "3...
Add the screen controls to the second column of the grid. Create a default component for this fieldInfo. @param fieldInfo the field to create a control for. @return The component.
[ "Add", "the", "screen", "controls", "to", "the", "second", "column", "of", "the", "grid", ".", "Create", "a", "default", "component", "for", "this", "fieldInfo", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L298-L325
154,571
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.addScreenButtons
public void addScreenButtons(Container parent) { GridBagLayout gridbag = (GridBagLayout)this.getScreenLayout(); GridBagConstraints c = this.getGBConstraints(); c.gridheight = GridBagConstraints.REMAINDER; // end row c.anchor = GridBagConstraints.NORTH; c.gridwidth = 1; // end column ImageIcon icon = BaseApplet.getSharedInstance().loadImageIcon(Constants.SUBMIT); JButton button = new JButton(Constants.SUBMIT, icon); button.setOpaque(false); button.setName(Constants.SUBMIT); gridbag.setConstraints(button, c); parent.add(button); button.addActionListener(this); c.gridx = 3; // Column 1 c.gridheight = GridBagConstraints.REMAINDER; // end row c.anchor = GridBagConstraints.NORTH; icon = BaseApplet.getSharedInstance().loadImageIcon(Constants.RESET); button = new JButton(Constants.RESET, icon); button.setOpaque(false); button.setName(Constants.RESET); gridbag.setConstraints(button, c); parent.add(button); c.gridheight = 1; //Set back button.addActionListener(this); }
java
public void addScreenButtons(Container parent) { GridBagLayout gridbag = (GridBagLayout)this.getScreenLayout(); GridBagConstraints c = this.getGBConstraints(); c.gridheight = GridBagConstraints.REMAINDER; // end row c.anchor = GridBagConstraints.NORTH; c.gridwidth = 1; // end column ImageIcon icon = BaseApplet.getSharedInstance().loadImageIcon(Constants.SUBMIT); JButton button = new JButton(Constants.SUBMIT, icon); button.setOpaque(false); button.setName(Constants.SUBMIT); gridbag.setConstraints(button, c); parent.add(button); button.addActionListener(this); c.gridx = 3; // Column 1 c.gridheight = GridBagConstraints.REMAINDER; // end row c.anchor = GridBagConstraints.NORTH; icon = BaseApplet.getSharedInstance().loadImageIcon(Constants.RESET); button = new JButton(Constants.RESET, icon); button.setOpaque(false); button.setName(Constants.RESET); gridbag.setConstraints(button, c); parent.add(button); c.gridheight = 1; //Set back button.addActionListener(this); }
[ "public", "void", "addScreenButtons", "(", "Container", "parent", ")", "{", "GridBagLayout", "gridbag", "=", "(", "GridBagLayout", ")", "this", ".", "getScreenLayout", "(", ")", ";", "GridBagConstraints", "c", "=", "this", ".", "getGBConstraints", "(", ")", ";...
Add a submit and reset buttons to the bottom of the grid. @param gridbag The screen layout. @param c The constraint to use.
[ "Add", "a", "submit", "and", "reset", "buttons", "to", "the", "bottom", "of", "the", "grid", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L350-L375
154,572
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.focusGained
public void focusGained(FocusEvent e) { if (m_componentNextFocus != null) { m_componentNextFocus.requestFocus(); return; } Component component = (Component)e.getSource(); String string = component.getName(); if (this.getFieldList() != null) { FieldInfo field = this.getFieldList().getField(string); // Get the fieldInfo for this component if (field != null) this.getBaseApplet().setStatusText(field.getFieldTip(), Constants.INFORMATION); } String strLastError = BaseApplet.getSharedInstance().getLastError(0); if ((strLastError != null) && (strLastError.length() > 0)) this.getBaseApplet().setStatusText(strLastError, Constants.WARNING); }
java
public void focusGained(FocusEvent e) { if (m_componentNextFocus != null) { m_componentNextFocus.requestFocus(); return; } Component component = (Component)e.getSource(); String string = component.getName(); if (this.getFieldList() != null) { FieldInfo field = this.getFieldList().getField(string); // Get the fieldInfo for this component if (field != null) this.getBaseApplet().setStatusText(field.getFieldTip(), Constants.INFORMATION); } String strLastError = BaseApplet.getSharedInstance().getLastError(0); if ((strLastError != null) && (strLastError.length() > 0)) this.getBaseApplet().setStatusText(strLastError, Constants.WARNING); }
[ "public", "void", "focusGained", "(", "FocusEvent", "e", ")", "{", "if", "(", "m_componentNextFocus", "!=", "null", ")", "{", "m_componentNextFocus", ".", "requestFocus", "(", ")", ";", "return", ";", "}", "Component", "component", "=", "(", "Component", ")"...
Required as part of the FocusListener interface. @param e The focus event.
[ "Required", "as", "part", "of", "the", "FocusListener", "interface", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L451-L469
154,573
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.focusLost
public void focusLost(FocusEvent e) { m_componentNextFocus = null; Component component = (Component)e.getSource(); String string = component.getName(); FieldInfo field = null; if (this.getFieldList() != null) field = this.getFieldList().getField(string); // Get the fieldInfo for this component if (field != null) { int iErrorCode = Constants.NORMAL_RETURN; if (component instanceof FieldComponent) iErrorCode = field.setData(((FieldComponent)component).getControlValue(), Constants.DISPLAY, Constants.SCREEN_MOVE); else if (component instanceof JTextComponent) iErrorCode = field.setString(((JTextComponent)component).getText(), Constants.DISPLAY, Constants.SCREEN_MOVE); if (iErrorCode != Constants.NORMAL_RETURN) { field.displayField(); // Redisplay the old field value m_componentNextFocus = component; // Next focus to this component } } }
java
public void focusLost(FocusEvent e) { m_componentNextFocus = null; Component component = (Component)e.getSource(); String string = component.getName(); FieldInfo field = null; if (this.getFieldList() != null) field = this.getFieldList().getField(string); // Get the fieldInfo for this component if (field != null) { int iErrorCode = Constants.NORMAL_RETURN; if (component instanceof FieldComponent) iErrorCode = field.setData(((FieldComponent)component).getControlValue(), Constants.DISPLAY, Constants.SCREEN_MOVE); else if (component instanceof JTextComponent) iErrorCode = field.setString(((JTextComponent)component).getText(), Constants.DISPLAY, Constants.SCREEN_MOVE); if (iErrorCode != Constants.NORMAL_RETURN) { field.displayField(); // Redisplay the old field value m_componentNextFocus = component; // Next focus to this component } } }
[ "public", "void", "focusLost", "(", "FocusEvent", "e", ")", "{", "m_componentNextFocus", "=", "null", ";", "Component", "component", "=", "(", "Component", ")", "e", ".", "getSource", "(", ")", ";", "String", "string", "=", "component", ".", "getName", "("...
When a control loses focus, move the field to the data area. @param e The focus event.
[ "When", "a", "control", "loses", "focus", "move", "the", "field", "to", "the", "data", "area", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L474-L495
154,574
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.resetFocus
public void resetFocus() { for (int i = 0; ; i++) { Converter converter = this.getFieldForScreen(i); if (converter == SKIP_THIS_FIELD) continue; if (converter == null) break; if (converter instanceof FieldInfo) if (((FieldInfo)converter).getComponent(CONTROL) != null) { ((Component)((FieldInfo)converter).getComponent(CONTROL)).requestFocus(); return; } } }
java
public void resetFocus() { for (int i = 0; ; i++) { Converter converter = this.getFieldForScreen(i); if (converter == SKIP_THIS_FIELD) continue; if (converter == null) break; if (converter instanceof FieldInfo) if (((FieldInfo)converter).getComponent(CONTROL) != null) { ((Component)((FieldInfo)converter).getComponent(CONTROL)).requestFocus(); return; } } }
[ "public", "void", "resetFocus", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", ";", "i", "++", ")", "{", "Converter", "converter", "=", "this", ".", "getFieldForScreen", "(", "i", ")", ";", "if", "(", "converter", "==", "SKIP_THIS_FIELD", ")",...
Focus to the first field.
[ "Focus", "to", "the", "first", "field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L499-L515
154,575
FitLayout/tools
src/main/java/org/fit/layout/tools/io/HTMLOutputOperator.java
HTMLOutputOperator.dumpTo
public void dumpTo(AreaTree tree, PrintWriter out) { if (produceHeader) { out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>" + tree.getRoot().getPage().getTitle() + "</title>"); out.println("<meta charset=\"utf-8\">"); out.println("<meta name=\"generator\" content=\"FITLayout - area tree dump\">"); out.println("</head>"); out.println("<body>"); } recursiveDumpArea(tree.getRoot(), 1, out); if (produceHeader) { out.println("</body>"); out.println("</html>"); } }
java
public void dumpTo(AreaTree tree, PrintWriter out) { if (produceHeader) { out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>" + tree.getRoot().getPage().getTitle() + "</title>"); out.println("<meta charset=\"utf-8\">"); out.println("<meta name=\"generator\" content=\"FITLayout - area tree dump\">"); out.println("</head>"); out.println("<body>"); } recursiveDumpArea(tree.getRoot(), 1, out); if (produceHeader) { out.println("</body>"); out.println("</html>"); } }
[ "public", "void", "dumpTo", "(", "AreaTree", "tree", ",", "PrintWriter", "out", ")", "{", "if", "(", "produceHeader", ")", "{", "out", ".", "println", "(", "\"<!DOCTYPE html>\"", ")", ";", "out", ".", "println", "(", "\"<html>\"", ")", ";", "out", ".", ...
Formats the complete area tree to an output stream. @param tree the area tree to be printed @param out a writer to be used for output
[ "Formats", "the", "complete", "area", "tree", "to", "an", "output", "stream", "." ]
43a8e3f4ddf21a031d3ab7247b8d37310bda4856
https://github.com/FitLayout/tools/blob/43a8e3f4ddf21a031d3ab7247b8d37310bda4856/src/main/java/org/fit/layout/tools/io/HTMLOutputOperator.java#L158-L177
154,576
FitLayout/tools
src/main/java/org/fit/layout/tools/io/HTMLOutputOperator.java
HTMLOutputOperator.dumpTo
public void dumpTo(Page page, PrintWriter out) { if (produceHeader) { out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>" + page.getTitle() + "</title>"); out.println("<meta charset=\"utf-8\">"); out.println("<meta name=\"generator\" content=\"FITLayout - box tree dump\">"); out.println("</head>"); out.println("<body>"); } recursiveDumpBoxes(page.getRoot(), 1, out); if (produceHeader) { out.println("</body>"); out.println("</html>"); } }
java
public void dumpTo(Page page, PrintWriter out) { if (produceHeader) { out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>" + page.getTitle() + "</title>"); out.println("<meta charset=\"utf-8\">"); out.println("<meta name=\"generator\" content=\"FITLayout - box tree dump\">"); out.println("</head>"); out.println("<body>"); } recursiveDumpBoxes(page.getRoot(), 1, out); if (produceHeader) { out.println("</body>"); out.println("</html>"); } }
[ "public", "void", "dumpTo", "(", "Page", "page", ",", "PrintWriter", "out", ")", "{", "if", "(", "produceHeader", ")", "{", "out", ".", "println", "(", "\"<!DOCTYPE html>\"", ")", ";", "out", ".", "println", "(", "\"<html>\"", ")", ";", "out", ".", "pr...
Formats the complete box tree to an output stream. @param tree the area tree to be printed @param out a writer to be used for output
[ "Formats", "the", "complete", "box", "tree", "to", "an", "output", "stream", "." ]
43a8e3f4ddf21a031d3ab7247b8d37310bda4856
https://github.com/FitLayout/tools/blob/43a8e3f4ddf21a031d3ab7247b8d37310bda4856/src/main/java/org/fit/layout/tools/io/HTMLOutputOperator.java#L184-L203
154,577
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getImages
public Set<de.uniulm.omi.cloudiator.flexiant.client.domain.Image> getImages( @Nullable final String locationUUID) throws FlexiantException { return this.getResources(ResourceType.IMAGE, Image.class, locationUUID).stream() .map(de.uniulm.omi.cloudiator.flexiant.client.domain.Image::new) .collect(Collectors.toSet()); }
java
public Set<de.uniulm.omi.cloudiator.flexiant.client.domain.Image> getImages( @Nullable final String locationUUID) throws FlexiantException { return this.getResources(ResourceType.IMAGE, Image.class, locationUUID).stream() .map(de.uniulm.omi.cloudiator.flexiant.client.domain.Image::new) .collect(Collectors.toSet()); }
[ "public", "Set", "<", "de", ".", "uniulm", ".", "omi", ".", "cloudiator", ".", "flexiant", ".", "client", ".", "domain", ".", "Image", ">", "getImages", "(", "@", "Nullable", "final", "String", "locationUUID", ")", "throws", "FlexiantException", "{", "retu...
Returns all images. @param locationUUID optional location of the image, if null it will be ignored. @return all images. @throws FlexiantException
[ "Returns", "all", "images", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L102-L107
154,578
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getLocations
public Set<Location> getLocations() throws FlexiantException { Set<Location> locations = new HashSet<Location>(); for (Vdc vdc : this.getResources(ResourceType.VDC, Vdc.class, null)) { locations.add(Location.from(vdc, this.getResource((vdc).getClusterUUID(), ResourceType.CLUSTER, Cluster.class))); } locations.addAll(this.getResources(ResourceType.CLUSTER, Cluster.class, null).stream() .map(Location::from).collect(Collectors.toList())); return locations; }
java
public Set<Location> getLocations() throws FlexiantException { Set<Location> locations = new HashSet<Location>(); for (Vdc vdc : this.getResources(ResourceType.VDC, Vdc.class, null)) { locations.add(Location.from(vdc, this.getResource((vdc).getClusterUUID(), ResourceType.CLUSTER, Cluster.class))); } locations.addAll(this.getResources(ResourceType.CLUSTER, Cluster.class, null).stream() .map(Location::from).collect(Collectors.toList())); return locations; }
[ "public", "Set", "<", "Location", ">", "getLocations", "(", ")", "throws", "FlexiantException", "{", "Set", "<", "Location", ">", "locations", "=", "new", "HashSet", "<", "Location", ">", "(", ")", ";", "for", "(", "Vdc", "vdc", ":", "this", ".", "getR...
Returns all locations. @return all locations. @throws FlexiantException
[ "Returns", "all", "locations", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L115-L124
154,579
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getHardwareFlavors
public Set<Hardware> getHardwareFlavors(@Nullable final String locationUUID) throws FlexiantException { //noinspection unchecked return Hardware .from(this.getResources(ResourceType.PRODUCTOFFER, ProductOffer.class, locationUUID), this.getResources(ResourceType.CLUSTER, Cluster.class, null)); }
java
public Set<Hardware> getHardwareFlavors(@Nullable final String locationUUID) throws FlexiantException { //noinspection unchecked return Hardware .from(this.getResources(ResourceType.PRODUCTOFFER, ProductOffer.class, locationUUID), this.getResources(ResourceType.CLUSTER, Cluster.class, null)); }
[ "public", "Set", "<", "Hardware", ">", "getHardwareFlavors", "(", "@", "Nullable", "final", "String", "locationUUID", ")", "throws", "FlexiantException", "{", "//noinspection unchecked", "return", "Hardware", ".", "from", "(", "this", ".", "getResources", "(", "Re...
Returns all hardware. @param locationUUID optional location of the hardware flavor, if null it will be ignored. @return all hardware. @throws FlexiantException
[ "Returns", "all", "hardware", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L133-L139
154,580
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getNetworks
public Set<de.uniulm.omi.cloudiator.flexiant.client.domain.Network> getNetworks( @Nullable final String locationUUID) throws FlexiantException { return this.getResources(ResourceType.NETWORK, Network.class, locationUUID).stream() .map(de.uniulm.omi.cloudiator.flexiant.client.domain.Network::new) .collect(Collectors.toSet()); }
java
public Set<de.uniulm.omi.cloudiator.flexiant.client.domain.Network> getNetworks( @Nullable final String locationUUID) throws FlexiantException { return this.getResources(ResourceType.NETWORK, Network.class, locationUUID).stream() .map(de.uniulm.omi.cloudiator.flexiant.client.domain.Network::new) .collect(Collectors.toSet()); }
[ "public", "Set", "<", "de", ".", "uniulm", ".", "omi", ".", "cloudiator", ".", "flexiant", ".", "client", ".", "domain", ".", "Network", ">", "getNetworks", "(", "@", "Nullable", "final", "String", "locationUUID", ")", "throws", "FlexiantException", "{", "...
Returns all networks. @param locationUUID optional location of the network, if null it will be ignored. @return a set of all networks. @throws FlexiantException
[ "Returns", "all", "networks", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L148-L154
154,581
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.searchByIp
@Nullable protected de.uniulm.omi.cloudiator.flexiant.client.domain.Server searchByIp( Set<de.uniulm.omi.cloudiator.flexiant.client.domain.Server> servers, String ip) { for (de.uniulm.omi.cloudiator.flexiant.client.domain.Server server : servers) { if (server.getPublicIpAddress() != null && server.getPublicIpAddress().equals(ip)) { return server; } if (server.getPrivateIpAddress() != null && server.getPrivateIpAddress().equals(ip)) { return server; } } return null; }
java
@Nullable protected de.uniulm.omi.cloudiator.flexiant.client.domain.Server searchByIp( Set<de.uniulm.omi.cloudiator.flexiant.client.domain.Server> servers, String ip) { for (de.uniulm.omi.cloudiator.flexiant.client.domain.Server server : servers) { if (server.getPublicIpAddress() != null && server.getPublicIpAddress().equals(ip)) { return server; } if (server.getPrivateIpAddress() != null && server.getPrivateIpAddress().equals(ip)) { return server; } } return null; }
[ "@", "Nullable", "protected", "de", ".", "uniulm", ".", "omi", ".", "cloudiator", ".", "flexiant", ".", "client", ".", "domain", ".", "Server", "searchByIp", "(", "Set", "<", "de", ".", "uniulm", ".", "omi", ".", "cloudiator", ".", "flexiant", ".", "cl...
Searches for the given ip, in the given list of servers. @param servers list of servers to search in. @param ip ip to search for. @return the server matching the ip or null
[ "Searches", "for", "the", "given", "ip", "in", "the", "given", "list", "of", "servers", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L196-L207
154,582
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.createServer
public de.uniulm.omi.cloudiator.flexiant.client.domain.Server createServer( final ServerTemplate serverTemplate) throws FlexiantException { checkNotNull(serverTemplate); io.github.cloudiator.flexiant.extility.Server server = new io.github.cloudiator.flexiant.extility.Server(); server.setResourceName(serverTemplate.getServerName()); server.setCustomerUUID(this.getCustomerUUID()); server.setProductOfferUUID(serverTemplate.getServerProductOffer()); server.setVdcUUID(serverTemplate.getVdc()); server.setImageUUID(serverTemplate.getImage()); Disk disk = new Disk(); disk.setProductOfferUUID(serverTemplate.getDiskProductOffer()); disk.setIndex(0); server.getDisks().add(disk); final Set<String> networks = new HashSet<String>(); if (serverTemplate.getTemplateOptions().getNetworks().isEmpty()) { //no network configured, find it out by ourselves. if (this.getNetworks(serverTemplate.getVdc()).size() == 1) { networks.add(this.getNetworks(serverTemplate.getVdc()).iterator().next().getId()); } else { throw new FlexiantException("Could not uniquely identify network."); } } else { networks.addAll(serverTemplate.getTemplateOptions().getNetworks()); } //assign the networks for (String network : networks) { Nic nic = new Nic(); nic.setNetworkUUID(network); server.getNics().add(nic); } try { Job serverJob = this.getService().createServer(server, null, null, null); this.waitForJob(serverJob); final de.uniulm.omi.cloudiator.flexiant.client.domain.Server createdServer = this.getServer(serverJob.getItemUUID()); checkState(createdServer != null, String.format( "Execution of job %s for server %s was returned as successful, but the server could not be queried.", serverJob.getResourceUUID(), serverJob.getItemUUID())); this.startServer(createdServer); return createdServer; } catch (ExtilityException e) { throw new FlexiantException("Could not create server", e); } }
java
public de.uniulm.omi.cloudiator.flexiant.client.domain.Server createServer( final ServerTemplate serverTemplate) throws FlexiantException { checkNotNull(serverTemplate); io.github.cloudiator.flexiant.extility.Server server = new io.github.cloudiator.flexiant.extility.Server(); server.setResourceName(serverTemplate.getServerName()); server.setCustomerUUID(this.getCustomerUUID()); server.setProductOfferUUID(serverTemplate.getServerProductOffer()); server.setVdcUUID(serverTemplate.getVdc()); server.setImageUUID(serverTemplate.getImage()); Disk disk = new Disk(); disk.setProductOfferUUID(serverTemplate.getDiskProductOffer()); disk.setIndex(0); server.getDisks().add(disk); final Set<String> networks = new HashSet<String>(); if (serverTemplate.getTemplateOptions().getNetworks().isEmpty()) { //no network configured, find it out by ourselves. if (this.getNetworks(serverTemplate.getVdc()).size() == 1) { networks.add(this.getNetworks(serverTemplate.getVdc()).iterator().next().getId()); } else { throw new FlexiantException("Could not uniquely identify network."); } } else { networks.addAll(serverTemplate.getTemplateOptions().getNetworks()); } //assign the networks for (String network : networks) { Nic nic = new Nic(); nic.setNetworkUUID(network); server.getNics().add(nic); } try { Job serverJob = this.getService().createServer(server, null, null, null); this.waitForJob(serverJob); final de.uniulm.omi.cloudiator.flexiant.client.domain.Server createdServer = this.getServer(serverJob.getItemUUID()); checkState(createdServer != null, String.format( "Execution of job %s for server %s was returned as successful, but the server could not be queried.", serverJob.getResourceUUID(), serverJob.getItemUUID())); this.startServer(createdServer); return createdServer; } catch (ExtilityException e) { throw new FlexiantException("Could not create server", e); } }
[ "public", "de", ".", "uniulm", ".", "omi", ".", "cloudiator", ".", "flexiant", ".", "client", ".", "domain", ".", "Server", "createServer", "(", "final", "ServerTemplate", "serverTemplate", ")", "throws", "FlexiantException", "{", "checkNotNull", "(", "serverTem...
Creates a server with the given properties. @param serverTemplate A template describing the server which should be started. @return the created server. @throws FlexiantException
[ "Creates", "a", "server", "with", "the", "given", "properties", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L216-L266
154,583
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.startServer
public void startServer(de.uniulm.omi.cloudiator.flexiant.client.domain.Server server) throws FlexiantException { if (server == null) { throw new IllegalArgumentException("The given server must not be null."); } this.startServer(server.getId()); }
java
public void startServer(de.uniulm.omi.cloudiator.flexiant.client.domain.Server server) throws FlexiantException { if (server == null) { throw new IllegalArgumentException("The given server must not be null."); } this.startServer(server.getId()); }
[ "public", "void", "startServer", "(", "de", ".", "uniulm", ".", "omi", ".", "cloudiator", ".", "flexiant", ".", "client", ".", "domain", ".", "Server", "server", ")", "throws", "FlexiantException", "{", "if", "(", "server", "==", "null", ")", "{", "throw...
Starts the given server @param server the server to start. @throws FlexiantException @see FlexiantComputeClient#startServer(String)
[ "Starts", "the", "given", "server" ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L300-L307
154,584
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.deleteServer
public void deleteServer(final de.uniulm.omi.cloudiator.flexiant.client.domain.Server server) throws FlexiantException { this.deleteServer(server.getId()); }
java
public void deleteServer(final de.uniulm.omi.cloudiator.flexiant.client.domain.Server server) throws FlexiantException { this.deleteServer(server.getId()); }
[ "public", "void", "deleteServer", "(", "final", "de", ".", "uniulm", ".", "omi", ".", "cloudiator", ".", "flexiant", ".", "client", ".", "domain", ".", "Server", "server", ")", "throws", "FlexiantException", "{", "this", ".", "deleteServer", "(", "server", ...
Deletes the given server. @param server the server to be deleted. @throws FlexiantException
[ "Deletes", "the", "given", "server", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L341-L344
154,585
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.changeServerStatus
protected void changeServerStatus(String serverUUID, ServerStatus status) throws FlexiantException { try { Job job = this.getService().changeServerStatus(serverUUID, status, true, null, null); this.waitForJob(job); } catch (ExtilityException e) { throw new FlexiantException("Could not start server", e); } }
java
protected void changeServerStatus(String serverUUID, ServerStatus status) throws FlexiantException { try { Job job = this.getService().changeServerStatus(serverUUID, status, true, null, null); this.waitForJob(job); } catch (ExtilityException e) { throw new FlexiantException("Could not start server", e); } }
[ "protected", "void", "changeServerStatus", "(", "String", "serverUUID", ",", "ServerStatus", "status", ")", "throws", "FlexiantException", "{", "try", "{", "Job", "job", "=", "this", ".", "getService", "(", ")", ".", "changeServerStatus", "(", "serverUUID", ",",...
Changes the server status to the given status. @param serverUUID the id of the server. @param status the status the server should change to. @throws FlexiantException
[ "Changes", "the", "server", "status", "to", "the", "given", "status", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L378-L386
154,586
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getServer
@Nullable public de.uniulm.omi.cloudiator.flexiant.client.domain.Server getServer( final String serverUUID) throws FlexiantException { final io.github.cloudiator.flexiant.extility.Server server = this.getResource(serverUUID, ResourceType.SERVER, io.github.cloudiator.flexiant.extility.Server.class); if (server == null) { return null; } return new de.uniulm.omi.cloudiator.flexiant.client.domain.Server(server); }
java
@Nullable public de.uniulm.omi.cloudiator.flexiant.client.domain.Server getServer( final String serverUUID) throws FlexiantException { final io.github.cloudiator.flexiant.extility.Server server = this.getResource(serverUUID, ResourceType.SERVER, io.github.cloudiator.flexiant.extility.Server.class); if (server == null) { return null; } return new de.uniulm.omi.cloudiator.flexiant.client.domain.Server(server); }
[ "@", "Nullable", "public", "de", ".", "uniulm", ".", "omi", ".", "cloudiator", ".", "flexiant", ".", "client", ".", "domain", ".", "Server", "getServer", "(", "final", "String", "serverUUID", ")", "throws", "FlexiantException", "{", "final", "io", ".", "gi...
Returns information about the given server. @param serverUUID the id of the server. @return a server object containing the information about the server if any, otherwise null. @throws FlexiantException
[ "Returns", "information", "about", "the", "given", "server", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L395-L404
154,587
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getImage
@Nullable public de.uniulm.omi.cloudiator.flexiant.client.domain.Image getImage( final String imageUUID) throws FlexiantException { final io.github.cloudiator.flexiant.extility.Image image = this.getResource(imageUUID, ResourceType.IMAGE, io.github.cloudiator.flexiant.extility.Image.class); if (image == null) { return null; } return new de.uniulm.omi.cloudiator.flexiant.client.domain.Image(image); }
java
@Nullable public de.uniulm.omi.cloudiator.flexiant.client.domain.Image getImage( final String imageUUID) throws FlexiantException { final io.github.cloudiator.flexiant.extility.Image image = this.getResource(imageUUID, ResourceType.IMAGE, io.github.cloudiator.flexiant.extility.Image.class); if (image == null) { return null; } return new de.uniulm.omi.cloudiator.flexiant.client.domain.Image(image); }
[ "@", "Nullable", "public", "de", ".", "uniulm", ".", "omi", ".", "cloudiator", ".", "flexiant", ".", "client", ".", "domain", ".", "Image", "getImage", "(", "final", "String", "imageUUID", ")", "throws", "FlexiantException", "{", "final", "io", ".", "githu...
Retrieves the image identified by the given uuid. @param imageUUID the id of the image @return information about the image if any, otherwise null. @throws FlexiantException
[ "Retrieves", "the", "image", "identified", "by", "the", "given", "uuid", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L413-L422
154,588
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getHardware
@Nullable public Hardware getHardware(final String hardwareUUID, final String locationUUID) throws FlexiantException { checkNotNull(hardwareUUID); String[] parts = hardwareUUID.split(":"); checkArgument(parts.length == 2, "Expected hardwareUUID to contain :"); final ProductOffer machineOffer = this.getResource(parts[0], ResourceType.PRODUCTOFFER, ProductOffer.class); final ProductOffer diskOffer = this.getResource(parts[1], ResourceType.PRODUCTOFFER, ProductOffer.class); if (machineOffer == null || diskOffer == null) { return null; } return Hardware.from(machineOffer, diskOffer, locationUUID); }
java
@Nullable public Hardware getHardware(final String hardwareUUID, final String locationUUID) throws FlexiantException { checkNotNull(hardwareUUID); String[] parts = hardwareUUID.split(":"); checkArgument(parts.length == 2, "Expected hardwareUUID to contain :"); final ProductOffer machineOffer = this.getResource(parts[0], ResourceType.PRODUCTOFFER, ProductOffer.class); final ProductOffer diskOffer = this.getResource(parts[1], ResourceType.PRODUCTOFFER, ProductOffer.class); if (machineOffer == null || diskOffer == null) { return null; } return Hardware.from(machineOffer, diskOffer, locationUUID); }
[ "@", "Nullable", "public", "Hardware", "getHardware", "(", "final", "String", "hardwareUUID", ",", "final", "String", "locationUUID", ")", "throws", "FlexiantException", "{", "checkNotNull", "(", "hardwareUUID", ")", ";", "String", "[", "]", "parts", "=", "hardw...
Retrieves the hardware identified by the given uuid. @param hardwareUUID the id of the hardware @param locationUUID the id of the location @return information about the hardware if any, otherwise null. @throws FlexiantException
[ "Retrieves", "the", "hardware", "identified", "by", "the", "given", "uuid", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L432-L451
154,589
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getLocation
@Nullable public Location getLocation(final String locationUUID) throws FlexiantException { final Cluster cluster = this.getCluster(locationUUID); if (cluster != null) { return Location.from(cluster); } final Vdc vdc = this.getVdc(locationUUID); if (vdc != null) { final Cluster clusterofVDC = this.getCluster(vdc.getClusterUUID()); checkState(clusterofVDC != null, String.format( "Error while retrieving cluster of vdc %s. VDC is in cluster %s, but this cluster " + "does not exist. Looks like the vdc is corrupted.", vdc, vdc.getClusterUUID())); return Location.from(vdc, clusterofVDC); } return null; }
java
@Nullable public Location getLocation(final String locationUUID) throws FlexiantException { final Cluster cluster = this.getCluster(locationUUID); if (cluster != null) { return Location.from(cluster); } final Vdc vdc = this.getVdc(locationUUID); if (vdc != null) { final Cluster clusterofVDC = this.getCluster(vdc.getClusterUUID()); checkState(clusterofVDC != null, String.format( "Error while retrieving cluster of vdc %s. VDC is in cluster %s, but this cluster " + "does not exist. Looks like the vdc is corrupted.", vdc, vdc.getClusterUUID())); return Location.from(vdc, clusterofVDC); } return null; }
[ "@", "Nullable", "public", "Location", "getLocation", "(", "final", "String", "locationUUID", ")", "throws", "FlexiantException", "{", "final", "Cluster", "cluster", "=", "this", ".", "getCluster", "(", "locationUUID", ")", ";", "if", "(", "cluster", "!=", "nu...
Retrieves the location identified by the given uuid. @param locationUUID the id of the location. @return an object representing the location if any, otherwise null. @throws FlexiantException
[ "Retrieves", "the", "location", "identified", "by", "the", "given", "uuid", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L460-L476
154,590
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getCluster
@Nullable protected Cluster getCluster(final String clusterUUID) throws FlexiantException { return this.getResource(clusterUUID, ResourceType.CLUSTER, Cluster.class); }
java
@Nullable protected Cluster getCluster(final String clusterUUID) throws FlexiantException { return this.getResource(clusterUUID, ResourceType.CLUSTER, Cluster.class); }
[ "@", "Nullable", "protected", "Cluster", "getCluster", "(", "final", "String", "clusterUUID", ")", "throws", "FlexiantException", "{", "return", "this", ".", "getResource", "(", "clusterUUID", ",", "ResourceType", ".", "CLUSTER", ",", "Cluster", ".", "class", ")...
Loads the cluster with the given uuid. @param clusterUUID the uuid of the cluster. @return the cluster identified by the uuid or null. @throws FlexiantException
[ "Loads", "the", "cluster", "with", "the", "given", "uuid", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L485-L487
154,591
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getVdc
@Nullable protected Vdc getVdc(final String vdcUUID) throws FlexiantException { return this.getResource(vdcUUID, ResourceType.VDC, Vdc.class); }
java
@Nullable protected Vdc getVdc(final String vdcUUID) throws FlexiantException { return this.getResource(vdcUUID, ResourceType.VDC, Vdc.class); }
[ "@", "Nullable", "protected", "Vdc", "getVdc", "(", "final", "String", "vdcUUID", ")", "throws", "FlexiantException", "{", "return", "this", ".", "getResource", "(", "vdcUUID", ",", "ResourceType", ".", "VDC", ",", "Vdc", ".", "class", ")", ";", "}" ]
Loads the vdc with the given uuid. @param vdcUUID the uuid of the vdc. @return the vdc identified by the uuid or null. @throws FlexiantException
[ "Loads", "the", "vdc", "with", "the", "given", "uuid", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L496-L498
154,592
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getResource
@Nullable protected <T> T getResource(final String resourceUUID, final ResourceType resourceType, final Class<T> type) throws FlexiantException { SearchFilter sf = new SearchFilter(); FilterCondition fc = new FilterCondition(); fc.setCondition(Condition.IS_EQUAL_TO); fc.setField("resourceUUID"); fc.getValue().add(resourceUUID); sf.getFilterConditions().add(fc); //noinspection unchecked return this.getSingleResource(sf, resourceType, type); }
java
@Nullable protected <T> T getResource(final String resourceUUID, final ResourceType resourceType, final Class<T> type) throws FlexiantException { SearchFilter sf = new SearchFilter(); FilterCondition fc = new FilterCondition(); fc.setCondition(Condition.IS_EQUAL_TO); fc.setField("resourceUUID"); fc.getValue().add(resourceUUID); sf.getFilterConditions().add(fc); //noinspection unchecked return this.getSingleResource(sf, resourceType, type); }
[ "@", "Nullable", "protected", "<", "T", ">", "T", "getResource", "(", "final", "String", "resourceUUID", ",", "final", "ResourceType", "resourceType", ",", "final", "Class", "<", "T", ">", "type", ")", "throws", "FlexiantException", "{", "SearchFilter", "sf", ...
Retrieves a resource @param resourceUUID the uuid of the resource @param resourceType the type of the resource @param type the type of the resulting class @param <T> the type of the resulting class @return the retrieved resource or null if not found @throws FlexiantException
[ "Retrieves", "a", "resource" ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L510-L523
154,593
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getSingleResource
@Nullable protected <T> T getSingleResource(final SearchFilter sf, final ResourceType resourceType, final Class<T> type) throws FlexiantException { try { ListResult result = this.getService().listResources(sf, null, resourceType); if (result.getList().size() > 1) { throw new FlexiantException("Found multiple resources, single resource expected."); } if (result.getList().isEmpty()) { return null; } //noinspection unchecked return (T) result.getList().get(0); } catch (ExtilityException e) { throw new FlexiantException("Error while retrieving resources", e); } }
java
@Nullable protected <T> T getSingleResource(final SearchFilter sf, final ResourceType resourceType, final Class<T> type) throws FlexiantException { try { ListResult result = this.getService().listResources(sf, null, resourceType); if (result.getList().size() > 1) { throw new FlexiantException("Found multiple resources, single resource expected."); } if (result.getList().isEmpty()) { return null; } //noinspection unchecked return (T) result.getList().get(0); } catch (ExtilityException e) { throw new FlexiantException("Error while retrieving resources", e); } }
[ "@", "Nullable", "protected", "<", "T", ">", "T", "getSingleResource", "(", "final", "SearchFilter", "sf", ",", "final", "ResourceType", "resourceType", ",", "final", "Class", "<", "T", ">", "type", ")", "throws", "FlexiantException", "{", "try", "{", "ListR...
Retrieves a single resource using the given search filter and the given resource type. @param sf the search filter. @param resourceType the resource type. @param type the type of the resulting class. @return the resource or null if not found. @throws FlexiantException if multiple resources are returned or an error occurs while contacting the api.
[ "Retrieves", "a", "single", "resource", "using", "the", "given", "search", "filter", "and", "the", "given", "resource", "type", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L535-L554
154,594
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getResources
protected <T> List<T> getResources(final String prefix, final String attribute, final ResourceType resourceType, final Class<T> type, @Nullable final String locationUUID) throws FlexiantException { SearchFilter sf = new SearchFilter(); FilterCondition fc = new FilterCondition(); fc.setCondition(Condition.STARTS_WITH); fc.setField(attribute); fc.getValue().add(prefix); sf.getFilterConditions().add(fc); if (locationUUID != null) { FilterCondition fcLocation = new FilterCondition(); fcLocation.setCondition(Condition.IS_EQUAL_TO); fcLocation.setField("vdcUUID"); fcLocation.getValue().add(locationUUID); sf.getFilterConditions().add(fcLocation); } try { //noinspection unchecked return (List<T>) this.getService().listResources(sf, null, resourceType).getList(); } catch (ExtilityException e) { throw new FlexiantException(String.format( "Error while retrieving resource with prefix %s on attribute %s of resourceType %s", prefix, attribute, resourceType), e); } }
java
protected <T> List<T> getResources(final String prefix, final String attribute, final ResourceType resourceType, final Class<T> type, @Nullable final String locationUUID) throws FlexiantException { SearchFilter sf = new SearchFilter(); FilterCondition fc = new FilterCondition(); fc.setCondition(Condition.STARTS_WITH); fc.setField(attribute); fc.getValue().add(prefix); sf.getFilterConditions().add(fc); if (locationUUID != null) { FilterCondition fcLocation = new FilterCondition(); fcLocation.setCondition(Condition.IS_EQUAL_TO); fcLocation.setField("vdcUUID"); fcLocation.getValue().add(locationUUID); sf.getFilterConditions().add(fcLocation); } try { //noinspection unchecked return (List<T>) this.getService().listResources(sf, null, resourceType).getList(); } catch (ExtilityException e) { throw new FlexiantException(String.format( "Error while retrieving resource with prefix %s on attribute %s of resourceType %s", prefix, attribute, resourceType), e); } }
[ "protected", "<", "T", ">", "List", "<", "T", ">", "getResources", "(", "final", "String", "prefix", ",", "final", "String", "attribute", ",", "final", "ResourceType", "resourceType", ",", "final", "Class", "<", "T", ">", "type", ",", "@", "Nullable", "f...
Retrieves a list of resources matching the given prefix on the given attribute which are of the given type. @param prefix the prefix to match. @param attribute the attribute where the prefix should match. @param resourceType the type of the resource. @param type the type of the resulting class. @param locationUUID optional location of the type, if null it will be ignored. @return a list containing all resources matching the request. @throws FlexiantException if an error occurs while contacting the api.
[ "Retrieves", "a", "list", "of", "resources", "matching", "the", "given", "prefix", "on", "the", "given", "attribute", "which", "are", "of", "the", "given", "type", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L569-L599
154,595
cloudiator/flexiant-client
src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java
FlexiantComputeClient.getResources
protected <T> List<T> getResources(final ResourceType resourceType, final Class<T> type, @Nullable final String locationUUID) throws FlexiantException { SearchFilter sf = new SearchFilter(); if (locationUUID != null) { FilterCondition fcLocation = new FilterCondition(); fcLocation.setCondition(Condition.IS_EQUAL_TO); fcLocation.setField("vdcUUID"); fcLocation.getValue().add(locationUUID); sf.getFilterConditions().add(fcLocation); } try { //noinspection unchecked return (List<T>) this.getService().listResources(sf, null, resourceType).getList(); } catch (ExtilityException e) { throw new FlexiantException( String.format("Error while retrieving resources of resourceType %s.", resourceType), e); } }
java
protected <T> List<T> getResources(final ResourceType resourceType, final Class<T> type, @Nullable final String locationUUID) throws FlexiantException { SearchFilter sf = new SearchFilter(); if (locationUUID != null) { FilterCondition fcLocation = new FilterCondition(); fcLocation.setCondition(Condition.IS_EQUAL_TO); fcLocation.setField("vdcUUID"); fcLocation.getValue().add(locationUUID); sf.getFilterConditions().add(fcLocation); } try { //noinspection unchecked return (List<T>) this.getService().listResources(sf, null, resourceType).getList(); } catch (ExtilityException e) { throw new FlexiantException( String.format("Error while retrieving resources of resourceType %s.", resourceType), e); } }
[ "protected", "<", "T", ">", "List", "<", "T", ">", "getResources", "(", "final", "ResourceType", "resourceType", ",", "final", "Class", "<", "T", ">", "type", ",", "@", "Nullable", "final", "String", "locationUUID", ")", "throws", "FlexiantException", "{", ...
Returns all resources of the given type. @param resourceType the resource type. @param locationUUID optional location of the type, if null it will be ignored @param type the type of the resulting class. @return a list of all resources of the given type. @throws FlexiantException
[ "Returns", "all", "resources", "of", "the", "given", "type", "." ]
30024501a6ae034ea3646f71ec0761c8bc5daa69
https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L610-L631
154,596
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/comp/LoginDialog.java
LoginDialog.getPassword
public String getPassword() { if ((password != null) && (password.length() > 0)) return password; // External override char[] rgchPassword = passwordField.getPassword(); return new String(rgchPassword); }
java
public String getPassword() { if ((password != null) && (password.length() > 0)) return password; // External override char[] rgchPassword = passwordField.getPassword(); return new String(rgchPassword); }
[ "public", "String", "getPassword", "(", ")", "{", "if", "(", "(", "password", "!=", "null", ")", "&&", "(", "password", ".", "length", "(", ")", ">", "0", ")", ")", "return", "password", ";", "// External override", "char", "[", "]", "rgchPassword", "=...
Get the password that was typed in.
[ "Get", "the", "password", "that", "was", "typed", "in", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/comp/LoginDialog.java#L53-L59
154,597
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java
CachedRemoteTable.freeRemoteSession
public void freeRemoteSession() throws RemoteException { if (m_tableRemote != null) m_tableRemote.freeRemoteSession(); m_tableRemote = null; m_mapCache = null; m_htCache = null; }
java
public void freeRemoteSession() throws RemoteException { if (m_tableRemote != null) m_tableRemote.freeRemoteSession(); m_tableRemote = null; m_mapCache = null; m_htCache = null; }
[ "public", "void", "freeRemoteSession", "(", ")", "throws", "RemoteException", "{", "if", "(", "m_tableRemote", "!=", "null", ")", "m_tableRemote", ".", "freeRemoteSession", "(", ")", ";", "m_tableRemote", "=", "null", ";", "m_mapCache", "=", "null", ";", "m_ht...
Free the remote table.
[ "Free", "the", "remote", "table", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java#L143-L150
154,598
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java
CachedRemoteTable.add
public Object add(Object data, int iOpenMode) throws DBException, RemoteException { m_objCurrentPhysicalRecord = NONE; m_objCurrentLockedRecord = NONE; m_objCurrentCacheRecord = NONE; Object bookmark = m_tableRemote.add(data, iOpenMode); if (m_iPhysicalLastRecordPlusOne != -1) if ((cacheMode == CacheMode.CACHE_ON_WRITE) || (cacheMode == CacheMode.PASSIVE_CACHE)) { if (m_mapCache != null) { m_mapCache.set(m_iPhysicalLastRecordPlusOne, data); m_iPhysicalLastRecordPlusOne++; } } return bookmark; }
java
public Object add(Object data, int iOpenMode) throws DBException, RemoteException { m_objCurrentPhysicalRecord = NONE; m_objCurrentLockedRecord = NONE; m_objCurrentCacheRecord = NONE; Object bookmark = m_tableRemote.add(data, iOpenMode); if (m_iPhysicalLastRecordPlusOne != -1) if ((cacheMode == CacheMode.CACHE_ON_WRITE) || (cacheMode == CacheMode.PASSIVE_CACHE)) { if (m_mapCache != null) { m_mapCache.set(m_iPhysicalLastRecordPlusOne, data); m_iPhysicalLastRecordPlusOne++; } } return bookmark; }
[ "public", "Object", "add", "(", "Object", "data", ",", "int", "iOpenMode", ")", "throws", "DBException", ",", "RemoteException", "{", "m_objCurrentPhysicalRecord", "=", "NONE", ";", "m_objCurrentLockedRecord", "=", "NONE", ";", "m_objCurrentCacheRecord", "=", "NONE"...
Add - add this data to the file. @param data A vector object containing the raw data for the record. @exception Exception File exception.
[ "Add", "-", "add", "this", "data", "to", "the", "file", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java#L195-L211
154,599
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java
CachedRemoteTable.cacheGetMove
public Object cacheGetMove(int iRowOrRelative, int iRowCount, int iAbsoluteRow, boolean bGet) throws DBException, RemoteException { m_bhtGet = bGet; m_objCurrentPhysicalRecord = NONE; m_objCurrentCacheRecord = NONE; m_iCurrentLogicalPosition = iAbsoluteRow; if ((m_iPhysicalLastRecordPlusOne != -1) && (m_iCurrentLogicalPosition >= m_iPhysicalLastRecordPlusOne)) return FieldTable.EOF_RECORD; try { Object objData = null; if ((m_mapCache == null) && (m_htCache == null)) m_mapCache = new ArrayCache(); if (m_mapCache != null) if (iAbsoluteRow != -1) objData = m_mapCache.get(iAbsoluteRow); // Try to find this in the cache if (objData == NONE) { objData = FieldTable.DELETED_RECORD; // Deleted record } else if (objData != null) { m_objCurrentCacheRecord = new Integer(iAbsoluteRow); } else if (objData == null) { m_objCurrentLockedRecord = NONE; // You lose your lock on physical move. if (m_mapCache != null) if (iAbsoluteRow == m_mapCache.getEndIndex() + 1) iRowCount = MULTIPLE_READ_COUNT; // If you are adding to the end of the cache, try reading a bunch at once. if (bGet) objData = m_tableRemote.get(iRowOrRelative, iRowCount); else objData = m_tableRemote.doMove(iRowOrRelative, iRowCount); if (objData instanceof Vector) if (((Vector)objData).size() > 1) if (!(((Vector)objData).get(0) instanceof Vector)) iRowCount = 1; // Multiple read not supported (This vector is a record). if (objData instanceof Vector) { if (m_mapCache != null) { m_objCurrentCacheRecord = new Integer(m_iCurrentLogicalPosition); if (iRowCount == 1) { m_mapCache.set(m_iCurrentLogicalPosition, objData); m_objCurrentPhysicalRecord = m_objCurrentCacheRecord; } else { Vector<Object> objectVector = (Vector)objData; for (int i = objectVector.size() - 1; i >= 0; i--) { // I go in reverse, so the objData object will be the object at the iAbsoluteRow. objData = objectVector.get(i); if (objData instanceof Vector) { if (iAbsoluteRow != -1) { m_mapCache.set(iAbsoluteRow + i, objData); if (i == objectVector.size() - 1) m_objCurrentPhysicalRecord = new Integer(iAbsoluteRow + i); } } else if ((m_iPhysicalLastRecordPlusOne == -1) || (m_iPhysicalLastRecordPlusOne <= m_iCurrentLogicalPosition + i)) m_iPhysicalLastRecordPlusOne = m_iCurrentLogicalPosition + i; // Recordstatus = EOF else objData = FieldTable.DELETED_RECORD; // Deleted record } } } } else { if ((m_iPhysicalLastRecordPlusOne == -1) || (m_iPhysicalLastRecordPlusOne <= m_iCurrentLogicalPosition)) m_iPhysicalLastRecordPlusOne = m_iCurrentLogicalPosition; else { if ((!FieldTable.DELETED_RECORD.equals(objData)) && (!FieldTable.EOF_RECORD.equals(objData))) objData = FieldTable.DELETED_RECORD; // Deleted record (if not one that I recognize) } } } return objData; } catch (RemoteException ex) { throw ex; } }
java
public Object cacheGetMove(int iRowOrRelative, int iRowCount, int iAbsoluteRow, boolean bGet) throws DBException, RemoteException { m_bhtGet = bGet; m_objCurrentPhysicalRecord = NONE; m_objCurrentCacheRecord = NONE; m_iCurrentLogicalPosition = iAbsoluteRow; if ((m_iPhysicalLastRecordPlusOne != -1) && (m_iCurrentLogicalPosition >= m_iPhysicalLastRecordPlusOne)) return FieldTable.EOF_RECORD; try { Object objData = null; if ((m_mapCache == null) && (m_htCache == null)) m_mapCache = new ArrayCache(); if (m_mapCache != null) if (iAbsoluteRow != -1) objData = m_mapCache.get(iAbsoluteRow); // Try to find this in the cache if (objData == NONE) { objData = FieldTable.DELETED_RECORD; // Deleted record } else if (objData != null) { m_objCurrentCacheRecord = new Integer(iAbsoluteRow); } else if (objData == null) { m_objCurrentLockedRecord = NONE; // You lose your lock on physical move. if (m_mapCache != null) if (iAbsoluteRow == m_mapCache.getEndIndex() + 1) iRowCount = MULTIPLE_READ_COUNT; // If you are adding to the end of the cache, try reading a bunch at once. if (bGet) objData = m_tableRemote.get(iRowOrRelative, iRowCount); else objData = m_tableRemote.doMove(iRowOrRelative, iRowCount); if (objData instanceof Vector) if (((Vector)objData).size() > 1) if (!(((Vector)objData).get(0) instanceof Vector)) iRowCount = 1; // Multiple read not supported (This vector is a record). if (objData instanceof Vector) { if (m_mapCache != null) { m_objCurrentCacheRecord = new Integer(m_iCurrentLogicalPosition); if (iRowCount == 1) { m_mapCache.set(m_iCurrentLogicalPosition, objData); m_objCurrentPhysicalRecord = m_objCurrentCacheRecord; } else { Vector<Object> objectVector = (Vector)objData; for (int i = objectVector.size() - 1; i >= 0; i--) { // I go in reverse, so the objData object will be the object at the iAbsoluteRow. objData = objectVector.get(i); if (objData instanceof Vector) { if (iAbsoluteRow != -1) { m_mapCache.set(iAbsoluteRow + i, objData); if (i == objectVector.size() - 1) m_objCurrentPhysicalRecord = new Integer(iAbsoluteRow + i); } } else if ((m_iPhysicalLastRecordPlusOne == -1) || (m_iPhysicalLastRecordPlusOne <= m_iCurrentLogicalPosition + i)) m_iPhysicalLastRecordPlusOne = m_iCurrentLogicalPosition + i; // Recordstatus = EOF else objData = FieldTable.DELETED_RECORD; // Deleted record } } } } else { if ((m_iPhysicalLastRecordPlusOne == -1) || (m_iPhysicalLastRecordPlusOne <= m_iCurrentLogicalPosition)) m_iPhysicalLastRecordPlusOne = m_iCurrentLogicalPosition; else { if ((!FieldTable.DELETED_RECORD.equals(objData)) && (!FieldTable.EOF_RECORD.equals(objData))) objData = FieldTable.DELETED_RECORD; // Deleted record (if not one that I recognize) } } } return objData; } catch (RemoteException ex) { throw ex; } }
[ "public", "Object", "cacheGetMove", "(", "int", "iRowOrRelative", ",", "int", "iRowCount", ",", "int", "iAbsoluteRow", ",", "boolean", "bGet", ")", "throws", "DBException", ",", "RemoteException", "{", "m_bhtGet", "=", "bGet", ";", "m_objCurrentPhysicalRecord", "=...
Move or get this record and cache multiple records if possible. @param iRowOrRelative For get the row to retrieve, for move the relative row to retrieve. @param iRowCount The number of rows to retrieve (Used only by EjbCachedTable). @param iAbsoluteRow The absolute row of the first row to retrieve (or -1 if unknown). @param bGet If true get, if false move. @return The record or an error code as an Integer. @exception Exception File exception. @exception RemoteException RMI exception.
[ "Move", "or", "get", "this", "record", "and", "cache", "multiple", "records", "if", "possible", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java#L326-L411