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
partition
stringclasses
1 value
mgormley/prim
src/main/java/edu/jhu/prim/arrays/Multinomials.java
Multinomials.normalizeLogProps
public static double normalizeLogProps(double[] logProps) { double logPropSum = DoubleArrays.logSum(logProps); if (logPropSum == Double.NEGATIVE_INFINITY) { double uniform = FastMath.log(1.0 / (double)logProps.length); for (int d = 0; d < logProps.length; d++) { logProps[d] = uniform; } } else if (logPropSum == Double.POSITIVE_INFINITY) { int count = DoubleArrays.count(logProps, Double.POSITIVE_INFINITY); if (count == 0) { throw new RuntimeException("Unable to normalize since sum is infinite but contains no infinities: " + Arrays.toString(logProps)); } double constant = FastMath.log(1.0 / (double) count); for (int d=0; d<logProps.length; d++) { if (logProps[d] == Double.POSITIVE_INFINITY) { logProps[d] = constant; } else { logProps[d] = Double.NEGATIVE_INFINITY; } } } else { for (int d = 0; d < logProps.length; d++) { logProps[d] -= logPropSum; assert(!Double.isNaN(logProps[d])); } } return logPropSum; }
java
public static double normalizeLogProps(double[] logProps) { double logPropSum = DoubleArrays.logSum(logProps); if (logPropSum == Double.NEGATIVE_INFINITY) { double uniform = FastMath.log(1.0 / (double)logProps.length); for (int d = 0; d < logProps.length; d++) { logProps[d] = uniform; } } else if (logPropSum == Double.POSITIVE_INFINITY) { int count = DoubleArrays.count(logProps, Double.POSITIVE_INFINITY); if (count == 0) { throw new RuntimeException("Unable to normalize since sum is infinite but contains no infinities: " + Arrays.toString(logProps)); } double constant = FastMath.log(1.0 / (double) count); for (int d=0; d<logProps.length; d++) { if (logProps[d] == Double.POSITIVE_INFINITY) { logProps[d] = constant; } else { logProps[d] = Double.NEGATIVE_INFINITY; } } } else { for (int d = 0; d < logProps.length; d++) { logProps[d] -= logPropSum; assert(!Double.isNaN(logProps[d])); } } return logPropSum; }
[ "public", "static", "double", "normalizeLogProps", "(", "double", "[", "]", "logProps", ")", "{", "double", "logPropSum", "=", "DoubleArrays", ".", "logSum", "(", "logProps", ")", ";", "if", "(", "logPropSum", "==", "Double", ".", "NEGATIVE_INFINITY", ")", "...
In the log-semiring, normalize the proportions and return their sum.
[ "In", "the", "log", "-", "semiring", "normalize", "the", "proportions", "and", "return", "their", "sum", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/Multinomials.java#L59-L86
train
mgormley/prim
src/main/java/edu/jhu/prim/arrays/Multinomials.java
Multinomials.klDivergence
public static double klDivergence(double[] p, double[] q) { if (p.length != q.length) { throw new IllegalStateException("The length of p and q must be the same."); } double delta = 1e-8; if (!Multinomials.isMultinomial(p, delta)) { throw new IllegalStateException("p is not a multinomial"); } if (!Multinomials.isMultinomial(q, delta)) { throw new IllegalStateException("q is not a multinomial"); } double kl = 0.0; for (int i=0; i<p.length; i++) { if (p[i] == 0.0 || q[i] == 0.0) { continue; } kl += p[i] * FastMath.log(p[i] / q[i]); } return kl; }
java
public static double klDivergence(double[] p, double[] q) { if (p.length != q.length) { throw new IllegalStateException("The length of p and q must be the same."); } double delta = 1e-8; if (!Multinomials.isMultinomial(p, delta)) { throw new IllegalStateException("p is not a multinomial"); } if (!Multinomials.isMultinomial(q, delta)) { throw new IllegalStateException("q is not a multinomial"); } double kl = 0.0; for (int i=0; i<p.length; i++) { if (p[i] == 0.0 || q[i] == 0.0) { continue; } kl += p[i] * FastMath.log(p[i] / q[i]); } return kl; }
[ "public", "static", "double", "klDivergence", "(", "double", "[", "]", "p", ",", "double", "[", "]", "q", ")", "{", "if", "(", "p", ".", "length", "!=", "q", ".", "length", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The length of p and q ...
Gets the KL divergence between two multinomial distributions p and q. @param p Array representing a multinomial distribution, p. @param q Array representing a multinomial distribution, q. @return KL(p || q)
[ "Gets", "the", "KL", "divergence", "between", "two", "multinomial", "distributions", "p", "and", "q", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/Multinomials.java#L131-L151
train
mgormley/prim
src/main/java_generated/edu/jhu/prim/vector/IntDoubleHashVector.java
IntDoubleHashVector.toNativeArray
public double[] toNativeArray() { final double[] arr = new double[getNumImplicitEntries()]; iterate(new FnIntDoubleToVoid() { @Override public void call(int idx, double val) { arr[idx] = val; } }); return arr; }
java
public double[] toNativeArray() { final double[] arr = new double[getNumImplicitEntries()]; iterate(new FnIntDoubleToVoid() { @Override public void call(int idx, double val) { arr[idx] = val; } }); return arr; }
[ "public", "double", "[", "]", "toNativeArray", "(", ")", "{", "final", "double", "[", "]", "arr", "=", "new", "double", "[", "getNumImplicitEntries", "(", ")", "]", ";", "iterate", "(", "new", "FnIntDoubleToVoid", "(", ")", "{", "@", "Override", "public"...
Gets a NEW array containing all the elements in this vector.
[ "Gets", "a", "NEW", "array", "containing", "all", "the", "elements", "in", "this", "vector", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/vector/IntDoubleHashVector.java#L132-L141
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/AboutDialog.java
AboutParams.getLabel
private String getLabel(String key) { String label = StrUtil.getLabel("cwf.shell.about." + key.toString()); return label == null ? key : label; }
java
private String getLabel(String key) { String label = StrUtil.getLabel("cwf.shell.about." + key.toString()); return label == null ? key : label; }
[ "private", "String", "getLabel", "(", "String", "key", ")", "{", "String", "label", "=", "StrUtil", ".", "getLabel", "(", "\"cwf.shell.about.\"", "+", "key", ".", "toString", "(", ")", ")", ";", "return", "label", "==", "null", "?", "key", ":", "label", ...
Returns the label value for the specified key. @param key Key for label. @return The label value, or the original key value if no label value found.
[ "Returns", "the", "label", "value", "for", "the", "specified", "key", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/AboutDialog.java#L153-L156
train
carewebframework/carewebframework-core
org.carewebframework.hibernate-parent/org.carewebframework.hibernate.h2/src/main/java/org/carewebframework/hibernate/h2/H2DataSource.java
H2DataSource.init
public H2DataSource init() throws Exception { if (dbMode == DBMode.LOCAL) { String port = getPort(); if (port.isEmpty()) { server = Server.createTcpServer(); } else { server = Server.createTcpServer("-tcpPort", port); } server.start(); } return this; }
java
public H2DataSource init() throws Exception { if (dbMode == DBMode.LOCAL) { String port = getPort(); if (port.isEmpty()) { server = Server.createTcpServer(); } else { server = Server.createTcpServer("-tcpPort", port); } server.start(); } return this; }
[ "public", "H2DataSource", "init", "(", ")", "throws", "Exception", "{", "if", "(", "dbMode", "==", "DBMode", ".", "LOCAL", ")", "{", "String", "port", "=", "getPort", "(", ")", ";", "if", "(", "port", ".", "isEmpty", "(", ")", ")", "{", "server", "...
If running H2 in local mode, starts the server. @return this (for chaining) @throws Exception Unspecified exception
[ "If", "running", "H2", "in", "local", "mode", "starts", "the", "server", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.hibernate-parent/org.carewebframework.hibernate.h2/src/main/java/org/carewebframework/hibernate/h2/H2DataSource.java#L61-L75
train
carewebframework/carewebframework-core
org.carewebframework.hibernate-parent/org.carewebframework.hibernate.h2/src/main/java/org/carewebframework/hibernate/h2/H2DataSource.java
H2DataSource.getPort
private String getPort() { String url = getUrl(); int i = url.indexOf("://") + 3; int j = url.indexOf("/", i); String s = i == 2 || j == -1 ? "" : url.substring(i, j); i = s.indexOf(":"); return i == -1 ? "" : s.substring(i + 1); }
java
private String getPort() { String url = getUrl(); int i = url.indexOf("://") + 3; int j = url.indexOf("/", i); String s = i == 2 || j == -1 ? "" : url.substring(i, j); i = s.indexOf(":"); return i == -1 ? "" : s.substring(i + 1); }
[ "private", "String", "getPort", "(", ")", "{", "String", "url", "=", "getUrl", "(", ")", ";", "int", "i", "=", "url", ".", "indexOf", "(", "\"://\"", ")", "+", "3", ";", "int", "j", "=", "url", ".", "indexOf", "(", "\"/\"", ",", "i", ")", ";", ...
Extract the TCP port from the connection URL. @return The TCP port, or empty string if none.
[ "Extract", "the", "TCP", "port", "from", "the", "connection", "URL", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.hibernate-parent/org.carewebframework.hibernate.h2/src/main/java/org/carewebframework/hibernate/h2/H2DataSource.java#L82-L89
train
tomdcc/sham
sham-core/src/main/java/org/shamdata/text/SpewGenerator.java
SpewGenerator.nextLine
public String nextLine(Map<String,Object> extraClasses) { return mainClass.render(null, preprocessExtraClasses(extraClasses)); }
java
public String nextLine(Map<String,Object> extraClasses) { return mainClass.render(null, preprocessExtraClasses(extraClasses)); }
[ "public", "String", "nextLine", "(", "Map", "<", "String", ",", "Object", ">", "extraClasses", ")", "{", "return", "mainClass", ".", "render", "(", "null", ",", "preprocessExtraClasses", "(", "extraClasses", ")", ")", ";", "}" ]
Returns a random line of text, driven by the underlying spew file and the given classes. For example, to drive a spew file but add some parameters to it, call this method with the class names as the map keys, and the Strings that you'd like substituted as the values. @param extraClasses the extra classes to use @return a random line of text
[ "Returns", "a", "random", "line", "of", "text", "driven", "by", "the", "underlying", "spew", "file", "and", "the", "given", "classes", ".", "For", "example", "to", "drive", "a", "spew", "file", "but", "add", "some", "parameters", "to", "it", "call", "thi...
33ede5e7130888736d6c84368e16a56e9e31e033
https://github.com/tomdcc/sham/blob/33ede5e7130888736d6c84368e16a56e9e31e033/sham-core/src/main/java/org/shamdata/text/SpewGenerator.java#L45-L47
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpTopic.java
HelpTopic.isDuplicate
public boolean isDuplicate(HelpTopic topic) { return ObjectUtils.equals(url, topic.url) && compareTo(topic) == 0; }
java
public boolean isDuplicate(HelpTopic topic) { return ObjectUtils.equals(url, topic.url) && compareTo(topic) == 0; }
[ "public", "boolean", "isDuplicate", "(", "HelpTopic", "topic", ")", "{", "return", "ObjectUtils", ".", "equals", "(", "url", ",", "topic", ".", "url", ")", "&&", "compareTo", "(", "topic", ")", "==", "0", ";", "}" ]
Returns true if the topic is considered a duplicate. @param topic Topic to compare. @return True if a duplicate.
[ "Returns", "true", "if", "the", "topic", "is", "considered", "a", "duplicate", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpTopic.java#L108-L110
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginStatus.java
PluginStatus.updateStatus
protected void updateStatus() { if (!plugins.isEmpty()) { boolean disabled = isDisabled(); for (ElementPlugin container : plugins) { container.setDisabled(disabled); } } }
java
protected void updateStatus() { if (!plugins.isEmpty()) { boolean disabled = isDisabled(); for (ElementPlugin container : plugins) { container.setDisabled(disabled); } } }
[ "protected", "void", "updateStatus", "(", ")", "{", "if", "(", "!", "plugins", ".", "isEmpty", "(", ")", ")", "{", "boolean", "disabled", "=", "isDisabled", "(", ")", ";", "for", "(", "ElementPlugin", "container", ":", "plugins", ")", "{", "container", ...
Updates the disabled status of all registered containers.
[ "Updates", "the", "disabled", "status", "of", "all", "registered", "containers", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginStatus.java#L126-L134
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV1_2Generator.java
PHS398FellowshipSupplementalV1_2Generator.getYesNoEnum
private Enum getYesNoEnum(String answer) { return answer.equals("Y") ? YesNoDataType.Y_YES : YesNoDataType.N_NO; }
java
private Enum getYesNoEnum(String answer) { return answer.equals("Y") ? YesNoDataType.Y_YES : YesNoDataType.N_NO; }
[ "private", "Enum", "getYesNoEnum", "(", "String", "answer", ")", "{", "return", "answer", ".", "equals", "(", "\"Y\"", ")", "?", "YesNoDataType", ".", "Y_YES", ":", "YesNoDataType", ".", "N_NO", ";", "}" ]
This method is to return YesNoDataType enum.
[ "This", "method", "is", "to", "return", "YesNoDataType", "enum", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV1_2Generator.java#L481-L483
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java
ActionUtil.createAction
public static IAction createAction(String label, String script) { return new Action(script, label, script); }
java
public static IAction createAction(String label, String script) { return new Action(script, label, script); }
[ "public", "static", "IAction", "createAction", "(", "String", "label", ",", "String", "script", ")", "{", "return", "new", "Action", "(", "script", ",", "label", ",", "script", ")", ";", "}" ]
Creates an action object from fields. @param label Action's label name. May be a label reference (prefixed with an '@' character) or the label itself. @param script Action's script. @return An action object.
[ "Creates", "an", "action", "object", "from", "fields", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java#L59-L61
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java
ActionUtil.removeAction
public static ActionListener removeAction(BaseComponent component, String eventName) { ActionListener listener = getListener(component, eventName); if (listener != null) { listener.removeAction(); } return listener; }
java
public static ActionListener removeAction(BaseComponent component, String eventName) { ActionListener listener = getListener(component, eventName); if (listener != null) { listener.removeAction(); } return listener; }
[ "public", "static", "ActionListener", "removeAction", "(", "BaseComponent", "component", ",", "String", "eventName", ")", "{", "ActionListener", "listener", "=", "getListener", "(", "component", ",", "eventName", ")", ";", "if", "(", "listener", "!=", "null", ")...
Removes any action associated with a component. @param component Component whose action is to be removed. @param eventName The event whose associated action is being removed. @return The removed deferred event listener, or null if none found.
[ "Removes", "any", "action", "associated", "with", "a", "component", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java#L146-L154
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java
ActionUtil.disableAction
public static void disableAction(BaseComponent component, String eventName, boolean disable) { ActionListener listener = getListener(component, eventName); if (listener != null) { listener.setDisabled(disable); } }
java
public static void disableAction(BaseComponent component, String eventName, boolean disable) { ActionListener listener = getListener(component, eventName); if (listener != null) { listener.setDisabled(disable); } }
[ "public", "static", "void", "disableAction", "(", "BaseComponent", "component", ",", "String", "eventName", ",", "boolean", "disable", ")", "{", "ActionListener", "listener", "=", "getListener", "(", "component", ",", "eventName", ")", ";", "if", "(", "listener"...
Enables or disables the deferred event listener associated with the component. @param component The component. @param eventName The name of the event. @param disable Disable state for listener.
[ "Enables", "or", "disables", "the", "deferred", "event", "listener", "associated", "with", "the", "component", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java#L173-L179
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java
ActionUtil.createAction
private static IAction createAction(String action) { IAction actn = null; if (!StringUtils.isEmpty(action)) { if ((actn = ActionRegistry.getRegisteredAction(action)) == null) { actn = ActionUtil.createAction(null, action); } } return actn; }
java
private static IAction createAction(String action) { IAction actn = null; if (!StringUtils.isEmpty(action)) { if ((actn = ActionRegistry.getRegisteredAction(action)) == null) { actn = ActionUtil.createAction(null, action); } } return actn; }
[ "private", "static", "IAction", "createAction", "(", "String", "action", ")", "{", "IAction", "actn", "=", "null", ";", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "action", ")", ")", "{", "if", "(", "(", "actn", "=", "ActionRegistry", ".", "ge...
Returns an IAction object given an action. @param action Action. @return Newly created IAction object, or null if action is null or empty.
[ "Returns", "an", "IAction", "object", "given", "an", "action", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java#L187-L197
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java
ActionUtil.getListener
public static ActionListener getListener(BaseComponent component, String eventName) { return (ActionListener) component.getAttribute(ActionListener.getAttrName(eventName)); }
java
public static ActionListener getListener(BaseComponent component, String eventName) { return (ActionListener) component.getAttribute(ActionListener.getAttrName(eventName)); }
[ "public", "static", "ActionListener", "getListener", "(", "BaseComponent", "component", ",", "String", "eventName", ")", "{", "return", "(", "ActionListener", ")", "component", ".", "getAttribute", "(", "ActionListener", ".", "getAttrName", "(", "eventName", ")", ...
Returns the listener associated with the given component and event. @param component The component. @param eventName The event name. @return A DeferredEventListener, or null if not found.
[ "Returns", "the", "listener", "associated", "with", "the", "given", "component", "and", "event", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java#L216-L218
train
wcm-io-caravan/caravan-commons
httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java
CertificateLoader.buildSSLContext
public static SSLContext buildSSLContext(HttpClientConfig config) throws IOException, GeneralSecurityException { KeyManagerFactory kmf = null; if (isSslKeyManagerEnabled(config)) { kmf = getKeyManagerFactory(config.getKeyStorePath(), new StoreProperties(config.getKeyStorePassword(), config.getKeyManagerType(), config.getKeyStoreType(), config.getKeyStoreProvider())); } TrustManagerFactory tmf = null; if (isSslTrustStoreEnbaled(config)) { tmf = getTrustManagerFactory(config.getTrustStorePath(), new StoreProperties(config.getTrustStorePassword(), config.getTrustManagerType(), config.getTrustStoreType(), config.getTrustStoreProvider())); } SSLContext sslContext = SSLContext.getInstance(config.getSslContextType()); sslContext.init(kmf != null ? kmf.getKeyManagers() : null, tmf != null ? tmf.getTrustManagers() : null, null); return sslContext; }
java
public static SSLContext buildSSLContext(HttpClientConfig config) throws IOException, GeneralSecurityException { KeyManagerFactory kmf = null; if (isSslKeyManagerEnabled(config)) { kmf = getKeyManagerFactory(config.getKeyStorePath(), new StoreProperties(config.getKeyStorePassword(), config.getKeyManagerType(), config.getKeyStoreType(), config.getKeyStoreProvider())); } TrustManagerFactory tmf = null; if (isSslTrustStoreEnbaled(config)) { tmf = getTrustManagerFactory(config.getTrustStorePath(), new StoreProperties(config.getTrustStorePassword(), config.getTrustManagerType(), config.getTrustStoreType(), config.getTrustStoreProvider())); } SSLContext sslContext = SSLContext.getInstance(config.getSslContextType()); sslContext.init(kmf != null ? kmf.getKeyManagers() : null, tmf != null ? tmf.getTrustManagers() : null, null); return sslContext; }
[ "public", "static", "SSLContext", "buildSSLContext", "(", "HttpClientConfig", "config", ")", "throws", "IOException", ",", "GeneralSecurityException", "{", "KeyManagerFactory", "kmf", "=", "null", ";", "if", "(", "isSslKeyManagerEnabled", "(", "config", ")", ")", "{...
Build SSL Socket factory. @param config Http client configuration @return SSL socket factory. @throws IOException @throws GeneralSecurityException
[ "Build", "SSL", "Socket", "factory", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java#L83-L103
train
wcm-io-caravan/caravan-commons
httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java
CertificateLoader.getResourceAsStream
private static InputStream getResourceAsStream(String path) throws IOException { if (StringUtils.isEmpty(path)) { return null; } // first try to load as file File file = new File(path); if (file.exists() && file.isFile()) { return new FileInputStream(file); } // if not a file fallback to classloader resource return CertificateLoader.class.getResourceAsStream(path); }
java
private static InputStream getResourceAsStream(String path) throws IOException { if (StringUtils.isEmpty(path)) { return null; } // first try to load as file File file = new File(path); if (file.exists() && file.isFile()) { return new FileInputStream(file); } // if not a file fallback to classloader resource return CertificateLoader.class.getResourceAsStream(path); }
[ "private", "static", "InputStream", "getResourceAsStream", "(", "String", "path", ")", "throws", "IOException", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "path", ")", ")", "{", "return", "null", ";", "}", "// first try to load as file", "File", "file",...
Tries to load the given resource as file, or if no file exists as classpath resource. @param path Filesystem or classpath path @return InputStream or null if neither file nor classpath resource is found @throws IOException
[ "Tries", "to", "load", "the", "given", "resource", "as", "file", "or", "if", "no", "file", "exists", "as", "classpath", "resource", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java#L215-L228
train
wcm-io-caravan/caravan-commons
httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java
CertificateLoader.getFilenameInfo
private static String getFilenameInfo(String path) { if (StringUtils.isEmpty(path)) { return null; } try { return new File(path).getCanonicalPath(); } catch (IOException ex) { return new File(path).getAbsolutePath(); } }
java
private static String getFilenameInfo(String path) { if (StringUtils.isEmpty(path)) { return null; } try { return new File(path).getCanonicalPath(); } catch (IOException ex) { return new File(path).getAbsolutePath(); } }
[ "private", "static", "String", "getFilenameInfo", "(", "String", "path", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "path", ")", ")", "{", "return", "null", ";", "}", "try", "{", "return", "new", "File", "(", "path", ")", ".", "getCanonic...
Generate filename info for given path for error messages. @param path Path @return Absolute path
[ "Generate", "filename", "info", "for", "given", "path", "for", "error", "messages", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java#L235-L245
train
wcm-io-caravan/caravan-commons
httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java
CertificateLoader.isSslKeyManagerEnabled
public static boolean isSslKeyManagerEnabled(HttpClientConfig config) { return StringUtils.isNotEmpty(config.getSslContextType()) && StringUtils.isNotEmpty(config.getKeyManagerType()) && StringUtils.isNotEmpty(config.getKeyStoreType()) && StringUtils.isNotEmpty(config.getKeyStorePath()); }
java
public static boolean isSslKeyManagerEnabled(HttpClientConfig config) { return StringUtils.isNotEmpty(config.getSslContextType()) && StringUtils.isNotEmpty(config.getKeyManagerType()) && StringUtils.isNotEmpty(config.getKeyStoreType()) && StringUtils.isNotEmpty(config.getKeyStorePath()); }
[ "public", "static", "boolean", "isSslKeyManagerEnabled", "(", "HttpClientConfig", "config", ")", "{", "return", "StringUtils", ".", "isNotEmpty", "(", "config", ".", "getSslContextType", "(", ")", ")", "&&", "StringUtils", ".", "isNotEmpty", "(", "config", ".", ...
Checks whether a SSL key store is configured. @param config Http client configuration @return true if client certificates are enabled
[ "Checks", "whether", "a", "SSL", "key", "store", "is", "configured", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java#L252-L257
train
wcm-io-caravan/caravan-commons
httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java
CertificateLoader.isSslTrustStoreEnbaled
public static boolean isSslTrustStoreEnbaled(HttpClientConfig config) { return StringUtils.isNotEmpty(config.getSslContextType()) && StringUtils.isNotEmpty(config.getTrustManagerType()) && StringUtils.isNotEmpty(config.getTrustStoreType()) && StringUtils.isNotEmpty(config.getTrustStorePath()); }
java
public static boolean isSslTrustStoreEnbaled(HttpClientConfig config) { return StringUtils.isNotEmpty(config.getSslContextType()) && StringUtils.isNotEmpty(config.getTrustManagerType()) && StringUtils.isNotEmpty(config.getTrustStoreType()) && StringUtils.isNotEmpty(config.getTrustStorePath()); }
[ "public", "static", "boolean", "isSslTrustStoreEnbaled", "(", "HttpClientConfig", "config", ")", "{", "return", "StringUtils", ".", "isNotEmpty", "(", "config", ".", "getSslContextType", "(", ")", ")", "&&", "StringUtils", ".", "isNotEmpty", "(", "config", ".", ...
Checks whether a SSL trust store is configured. @param config Http client configuration @return true if client certificates are enabled
[ "Checks", "whether", "a", "SSL", "trust", "store", "is", "configured", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java#L264-L269
train
wcm-io-caravan/caravan-commons
httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java
CertificateLoader.createDefaultSSlContext
public static SSLContext createDefaultSSlContext() throws SSLInitializationException { try { final SSLContext sslcontext = SSLContext.getInstance(SSL_CONTEXT_TYPE_DEFAULT); sslcontext.init(null, null, null); return sslcontext; } catch (NoSuchAlgorithmException ex) { throw new SSLInitializationException(ex.getMessage(), ex); } catch (KeyManagementException ex) { throw new SSLInitializationException(ex.getMessage(), ex); } }
java
public static SSLContext createDefaultSSlContext() throws SSLInitializationException { try { final SSLContext sslcontext = SSLContext.getInstance(SSL_CONTEXT_TYPE_DEFAULT); sslcontext.init(null, null, null); return sslcontext; } catch (NoSuchAlgorithmException ex) { throw new SSLInitializationException(ex.getMessage(), ex); } catch (KeyManagementException ex) { throw new SSLInitializationException(ex.getMessage(), ex); } }
[ "public", "static", "SSLContext", "createDefaultSSlContext", "(", ")", "throws", "SSLInitializationException", "{", "try", "{", "final", "SSLContext", "sslcontext", "=", "SSLContext", ".", "getInstance", "(", "SSL_CONTEXT_TYPE_DEFAULT", ")", ";", "sslcontext", ".", "i...
Creates default SSL context. @return SSL context
[ "Creates", "default", "SSL", "context", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java#L275-L287
train
mgormley/prim
src/main/java_generated/edu/jhu/prim/sort/ByteSort.java
ByteSort.swap
private static void swap(byte[] array, int i, int j) { if (i != j) { byte valAtI = array[i]; array[i] = array[j]; array[j] = valAtI; numSwaps++; } }
java
private static void swap(byte[] array, int i, int j) { if (i != j) { byte valAtI = array[i]; array[i] = array[j]; array[j] = valAtI; numSwaps++; } }
[ "private", "static", "void", "swap", "(", "byte", "[", "]", "array", ",", "int", "i", ",", "int", "j", ")", "{", "if", "(", "i", "!=", "j", ")", "{", "byte", "valAtI", "=", "array", "[", "i", "]", ";", "array", "[", "i", "]", "=", "array", ...
Swaps the elements at positions i and j.
[ "Swaps", "the", "elements", "at", "positions", "i", "and", "j", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/sort/ByteSort.java#L115-L122
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.mockup/src/main/java/org/carewebframework/plugin/mockup/MockupTypeEnumerator.java
MockupTypeEnumerator.getUrl
public String getUrl(String mockupType) { return mockupType == null ? null : mockupTypes.getProperty(mockupType); }
java
public String getUrl(String mockupType) { return mockupType == null ? null : mockupTypes.getProperty(mockupType); }
[ "public", "String", "getUrl", "(", "String", "mockupType", ")", "{", "return", "mockupType", "==", "null", "?", "null", ":", "mockupTypes", ".", "getProperty", "(", "mockupType", ")", ";", "}" ]
Returns the url given the mockup type. @param mockupType The mockup type. @return The url pattern, or null if not found.
[ "Returns", "the", "url", "given", "the", "mockup", "type", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.mockup/src/main/java/org/carewebframework/plugin/mockup/MockupTypeEnumerator.java#L66-L68
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.mockup/src/main/java/org/carewebframework/plugin/mockup/MockupTypeEnumerator.java
MockupTypeEnumerator.iterator
@Override public Iterator<String> iterator() { List<String> list = new ArrayList<>(mockupTypes.stringPropertyNames()); Collections.sort(list, String.CASE_INSENSITIVE_ORDER); return list.iterator(); }
java
@Override public Iterator<String> iterator() { List<String> list = new ArrayList<>(mockupTypes.stringPropertyNames()); Collections.sort(list, String.CASE_INSENSITIVE_ORDER); return list.iterator(); }
[ "@", "Override", "public", "Iterator", "<", "String", ">", "iterator", "(", ")", "{", "List", "<", "String", ">", "list", "=", "new", "ArrayList", "<>", "(", "mockupTypes", ".", "stringPropertyNames", "(", ")", ")", ";", "Collections", ".", "sort", "(", ...
Returns an alphabetically sorted iterator of recognized mockup framework types.
[ "Returns", "an", "alphabetically", "sorted", "iterator", "of", "recognized", "mockup", "framework", "types", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.mockup/src/main/java/org/carewebframework/plugin/mockup/MockupTypeEnumerator.java#L73-L78
train
mgormley/prim
src/main/java_generated/edu/jhu/prim/list/ShortArrayList.java
ShortArrayList.lookupIndex
public int lookupIndex(short value) { for (int i=0; i<elements.length; i++) { if (elements[i] == value) { return i; } } return -1; }
java
public int lookupIndex(short value) { for (int i=0; i<elements.length; i++) { if (elements[i] == value) { return i; } } return -1; }
[ "public", "int", "lookupIndex", "(", "short", "value", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "elements", ".", "length", ";", "i", "++", ")", "{", "if", "(", "elements", "[", "i", "]", "==", "value", ")", "{", "return", "i",...
Gets the index of the first element in this list with the specified value, or -1 if it is not present. @param value The value to search for. @return The index or -1 if not present.
[ "Gets", "the", "index", "of", "the", "first", "element", "in", "this", "list", "with", "the", "specified", "value", "or", "-", "1", "if", "it", "is", "not", "present", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/list/ShortArrayList.java#L105-L112
train
mgormley/prim
src/main/java_generated/edu/jhu/prim/list/ShortArrayList.java
ShortArrayList.ensureCapacity
public static short[] ensureCapacity(short[] elements, int size) { if (size > elements.length) { short[] tmp = new short[size*2]; System.arraycopy(elements, 0, tmp, 0, elements.length); elements = tmp; } return elements; }
java
public static short[] ensureCapacity(short[] elements, int size) { if (size > elements.length) { short[] tmp = new short[size*2]; System.arraycopy(elements, 0, tmp, 0, elements.length); elements = tmp; } return elements; }
[ "public", "static", "short", "[", "]", "ensureCapacity", "(", "short", "[", "]", "elements", ",", "int", "size", ")", "{", "if", "(", "size", ">", "elements", ".", "length", ")", "{", "short", "[", "]", "tmp", "=", "new", "short", "[", "size", "*",...
Ensure that the array has space to contain the specified number of elements. @param elements The array. @param size The number of elements.
[ "Ensure", "that", "the", "array", "has", "space", "to", "contain", "the", "specified", "number", "of", "elements", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/list/ShortArrayList.java#L166-L173
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java
CareWebShellEx.pluginById
private PluginDefinition pluginById(String id) { PluginDefinition def = pluginRegistry.get(id); if (def == null) { throw new PluginException(EXC_UNKNOWN_PLUGIN, null, null, id); } return def; }
java
private PluginDefinition pluginById(String id) { PluginDefinition def = pluginRegistry.get(id); if (def == null) { throw new PluginException(EXC_UNKNOWN_PLUGIN, null, null, id); } return def; }
[ "private", "PluginDefinition", "pluginById", "(", "String", "id", ")", "{", "PluginDefinition", "def", "=", "pluginRegistry", ".", "get", "(", "id", ")", ";", "if", "(", "def", "==", "null", ")", "{", "throw", "new", "PluginException", "(", "EXC_UNKNOWN_PLUG...
Lookup a plugin definition by its id. Raises a runtime exception if the plugin is not found. @param id Plugin id. @return The plugin definition.
[ "Lookup", "a", "plugin", "definition", "by", "its", "id", ".", "Raises", "a", "runtime", "exception", "if", "the", "plugin", "is", "not", "found", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java#L172-L180
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java
CareWebShellEx.registerMenu
public ElementMenuItem registerMenu(String path, String action) { ElementMenuItem menu = getElement(path, getDesktop().getMenubar(), ElementMenuItem.class); menu.setAction(action); return menu; }
java
public ElementMenuItem registerMenu(String path, String action) { ElementMenuItem menu = getElement(path, getDesktop().getMenubar(), ElementMenuItem.class); menu.setAction(action); return menu; }
[ "public", "ElementMenuItem", "registerMenu", "(", "String", "path", ",", "String", "action", ")", "{", "ElementMenuItem", "menu", "=", "getElement", "(", "path", ",", "getDesktop", "(", ")", ".", "getMenubar", "(", ")", ",", "ElementMenuItem", ".", "class", ...
Register a menu. @param path Path for the menu. @param action Associated action for the menu. @return Created menu.
[ "Register", "a", "menu", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java#L216-L220
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java
CareWebShellEx.registerLayout
public void registerLayout(String path, String resource) throws Exception { Layout layout = LayoutParser.parseResource(resource); ElementUI parent = parentFromPath(path); if (parent != null) { layout.materialize(parent); } }
java
public void registerLayout(String path, String resource) throws Exception { Layout layout = LayoutParser.parseResource(resource); ElementUI parent = parentFromPath(path); if (parent != null) { layout.materialize(parent); } }
[ "public", "void", "registerLayout", "(", "String", "path", ",", "String", "resource", ")", "throws", "Exception", "{", "Layout", "layout", "=", "LayoutParser", ".", "parseResource", "(", "resource", ")", ";", "ElementUI", "parent", "=", "parentFromPath", "(", ...
Registers a layout at the specified path. @param path Format is &lt;tab name&gt;\&lt;tree node path&gt; @param resource Location of the xml layout. @throws Exception Unspecified exception.
[ "Registers", "a", "layout", "at", "the", "specified", "path", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java#L311-L318
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java
CareWebShellEx.parentFromPath
private ElementUI parentFromPath(String path) throws Exception { if (TOOLBAR_PATH.equalsIgnoreCase(path)) { return getDesktop().getToolbar(); } String[] pieces = path.split(delim, 2); ElementTabPane tabPane = pieces.length == 0 ? null : findTabPane(pieces[0]); ElementUI parent = pieces.length < 2 ? null : getPathResolver().resolvePath(tabPane, pieces[1]); return parent == null ? tabPane : parent; }
java
private ElementUI parentFromPath(String path) throws Exception { if (TOOLBAR_PATH.equalsIgnoreCase(path)) { return getDesktop().getToolbar(); } String[] pieces = path.split(delim, 2); ElementTabPane tabPane = pieces.length == 0 ? null : findTabPane(pieces[0]); ElementUI parent = pieces.length < 2 ? null : getPathResolver().resolvePath(tabPane, pieces[1]); return parent == null ? tabPane : parent; }
[ "private", "ElementUI", "parentFromPath", "(", "String", "path", ")", "throws", "Exception", "{", "if", "(", "TOOLBAR_PATH", ".", "equalsIgnoreCase", "(", "path", ")", ")", "{", "return", "getDesktop", "(", ")", ".", "getToolbar", "(", ")", ";", "}", "Stri...
Returns the parent UI element based on the provided path. @param path Format is &lt;tab name&gt;\&lt;tree node path&gt; @return The parent UI element. @throws Exception Unspecified exception.
[ "Returns", "the", "parent", "UI", "element", "based", "on", "the", "provided", "path", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java#L327-L336
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java
CareWebShellEx.findTabPane
private ElementTabPane findTabPane(String name) throws Exception { ElementTabView tabView = getTabView(); ElementTabPane tabPane = null; while ((tabPane = tabView.getChild(ElementTabPane.class, tabPane)) != null) { if (name.equalsIgnoreCase(tabPane.getLabel())) { return tabPane; } } tabPane = new ElementTabPane(); tabPane.setParent(tabView); tabPane.setLabel(name); return tabPane; }
java
private ElementTabPane findTabPane(String name) throws Exception { ElementTabView tabView = getTabView(); ElementTabPane tabPane = null; while ((tabPane = tabView.getChild(ElementTabPane.class, tabPane)) != null) { if (name.equalsIgnoreCase(tabPane.getLabel())) { return tabPane; } } tabPane = new ElementTabPane(); tabPane.setParent(tabView); tabPane.setLabel(name); return tabPane; }
[ "private", "ElementTabPane", "findTabPane", "(", "String", "name", ")", "throws", "Exception", "{", "ElementTabView", "tabView", "=", "getTabView", "(", ")", ";", "ElementTabPane", "tabPane", "=", "null", ";", "while", "(", "(", "tabPane", "=", "tabView", ".",...
Locate the tab with the corresponding label, or create one if not found. @param name Label text of tab to find. @return Tab corresponding to label text. @throws Exception Unspecified exception.
[ "Locate", "the", "tab", "with", "the", "corresponding", "label", "or", "create", "one", "if", "not", "found", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java#L345-L359
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java
CareWebShellEx.getDefaultPluginId
private String getDefaultPluginId() { if (defaultPluginId == null) { try { defaultPluginId = PropertyUtil.getValue("CAREWEB.INITIAL.SECTION", null); if (defaultPluginId == null) { defaultPluginId = ""; } } catch (Exception e) { defaultPluginId = ""; } } return defaultPluginId; }
java
private String getDefaultPluginId() { if (defaultPluginId == null) { try { defaultPluginId = PropertyUtil.getValue("CAREWEB.INITIAL.SECTION", null); if (defaultPluginId == null) { defaultPluginId = ""; } } catch (Exception e) { defaultPluginId = ""; } } return defaultPluginId; }
[ "private", "String", "getDefaultPluginId", "(", ")", "{", "if", "(", "defaultPluginId", "==", "null", ")", "{", "try", "{", "defaultPluginId", "=", "PropertyUtil", ".", "getValue", "(", "\"CAREWEB.INITIAL.SECTION\"", ",", "null", ")", ";", "if", "(", "defaultP...
Returns the default plugin id as a user preference. @return The default plugin id.
[ "Returns", "the", "default", "plugin", "id", "as", "a", "user", "preference", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java#L381-L395
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.mock-parent/org.carewebframework.api.property.mock/src/main/java/org/carewebframework/api/property/mock/MockPropertyService.java
MockPropertyService.setResources
public void setResources(Resource[] resources) throws IOException { clear(); for (Resource resource : resources) { addResource(resource); } }
java
public void setResources(Resource[] resources) throws IOException { clear(); for (Resource resource : resources) { addResource(resource); } }
[ "public", "void", "setResources", "(", "Resource", "[", "]", "resources", ")", "throws", "IOException", "{", "clear", "(", ")", ";", "for", "(", "Resource", "resource", ":", "resources", ")", "{", "addResource", "(", "resource", ")", ";", "}", "}" ]
Initializes the properties from a multiple resources. @param resources Sources of properties. @throws IOException IO exception.
[ "Initializes", "the", "properties", "from", "a", "multiple", "resources", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.mock-parent/org.carewebframework.api.property.mock/src/main/java/org/carewebframework/api/property/mock/MockPropertyService.java#L107-L113
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.statuspanel/src/main/java/org/carewebframework/plugin/statuspanel/StatusPanel.java
StatusPanel.afterInitialized
@Override public void afterInitialized(BaseComponent comp) { super.afterInitialized(comp); createLabel("default"); getEventManager().subscribe(EventUtil.STATUS_EVENT, this); }
java
@Override public void afterInitialized(BaseComponent comp) { super.afterInitialized(comp); createLabel("default"); getEventManager().subscribe(EventUtil.STATUS_EVENT, this); }
[ "@", "Override", "public", "void", "afterInitialized", "(", "BaseComponent", "comp", ")", "{", "super", ".", "afterInitialized", "(", "comp", ")", ";", "createLabel", "(", "\"default\"", ")", ";", "getEventManager", "(", ")", ".", "subscribe", "(", "EventUtil"...
Creates the default pane.
[ "Creates", "the", "default", "pane", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.statuspanel/src/main/java/org/carewebframework/plugin/statuspanel/StatusPanel.java#L44-L49
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.statuspanel/src/main/java/org/carewebframework/plugin/statuspanel/StatusPanel.java
StatusPanel.getLabel
private Label getLabel(String pane) { Label lbl = root.findByName(pane, Label.class); return lbl == null ? createLabel(pane) : lbl; }
java
private Label getLabel(String pane) { Label lbl = root.findByName(pane, Label.class); return lbl == null ? createLabel(pane) : lbl; }
[ "private", "Label", "getLabel", "(", "String", "pane", ")", "{", "Label", "lbl", "=", "root", ".", "findByName", "(", "pane", ",", "Label", ".", "class", ")", ";", "return", "lbl", "==", "null", "?", "createLabel", "(", "pane", ")", ":", "lbl", ";", ...
Returns the label associated with the named pane, or creates a new one if necessary. @param pane Name of the pane @return The associated label.
[ "Returns", "the", "label", "associated", "with", "the", "named", "pane", "or", "creates", "a", "new", "one", "if", "necessary", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.statuspanel/src/main/java/org/carewebframework/plugin/statuspanel/StatusPanel.java#L72-L75
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.statuspanel/src/main/java/org/carewebframework/plugin/statuspanel/StatusPanel.java
StatusPanel.createLabel
private Label createLabel(String label) { Pane pane = new Pane(); root.addChild(pane); Label lbl = new Label(); lbl.setName(label); pane.addChild(lbl); adjustPanes(); return lbl; }
java
private Label createLabel(String label) { Pane pane = new Pane(); root.addChild(pane); Label lbl = new Label(); lbl.setName(label); pane.addChild(lbl); adjustPanes(); return lbl; }
[ "private", "Label", "createLabel", "(", "String", "label", ")", "{", "Pane", "pane", "=", "new", "Pane", "(", ")", ";", "root", ".", "addChild", "(", "pane", ")", ";", "Label", "lbl", "=", "new", "Label", "(", ")", ";", "lbl", ".", "setName", "(", ...
Create a new status pane and associated label. @param label Name of pane (becomes the name of the label). @return The newly created label.
[ "Create", "a", "new", "status", "pane", "and", "associated", "label", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.statuspanel/src/main/java/org/carewebframework/plugin/statuspanel/StatusPanel.java#L83-L91
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java
EventSubscriptions.addSubscriber
public synchronized int addSubscriber(String eventName, IGenericEvent<T> subscriber) { List<IGenericEvent<T>> subscribers = getSubscribers(eventName, true); subscribers.add(subscriber); return subscribers.size(); }
java
public synchronized int addSubscriber(String eventName, IGenericEvent<T> subscriber) { List<IGenericEvent<T>> subscribers = getSubscribers(eventName, true); subscribers.add(subscriber); return subscribers.size(); }
[ "public", "synchronized", "int", "addSubscriber", "(", "String", "eventName", ",", "IGenericEvent", "<", "T", ">", "subscriber", ")", "{", "List", "<", "IGenericEvent", "<", "T", ">>", "subscribers", "=", "getSubscribers", "(", "eventName", ",", "true", ")", ...
Adds a subscriber to the specified event. @param eventName Name of the event. @param subscriber Subscriber to add. @return Count of subscribers after the operation.
[ "Adds", "a", "subscriber", "to", "the", "specified", "event", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java#L56-L60
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java
EventSubscriptions.removeSubscriber
public synchronized int removeSubscriber(String eventName, IGenericEvent<T> subscriber) { List<IGenericEvent<T>> subscribers = getSubscribers(eventName, false); if (subscribers != null) { subscribers.remove(subscriber); if (subscribers.isEmpty()) { subscriptions.remove(eventName); } return subscribers.size(); } return -1; }
java
public synchronized int removeSubscriber(String eventName, IGenericEvent<T> subscriber) { List<IGenericEvent<T>> subscribers = getSubscribers(eventName, false); if (subscribers != null) { subscribers.remove(subscriber); if (subscribers.isEmpty()) { subscriptions.remove(eventName); } return subscribers.size(); } return -1; }
[ "public", "synchronized", "int", "removeSubscriber", "(", "String", "eventName", ",", "IGenericEvent", "<", "T", ">", "subscriber", ")", "{", "List", "<", "IGenericEvent", "<", "T", ">>", "subscribers", "=", "getSubscribers", "(", "eventName", ",", "false", ")...
Removes a subscriber from the specified event. @param eventName Name of the event. @param subscriber Subscriber to remove. @return Count of subscribers after the operation, or -1 no subscriber list existed.
[ "Removes", "a", "subscriber", "from", "the", "specified", "event", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java#L69-L83
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java
EventSubscriptions.hasSubscribers
public boolean hasSubscribers(String eventName, boolean exact) { while (!StringUtils.isEmpty(eventName)) { if (hasSubscribers(eventName)) { return true; } else if (exact) { return false; } else { eventName = stripLevel(eventName); } } return false; }
java
public boolean hasSubscribers(String eventName, boolean exact) { while (!StringUtils.isEmpty(eventName)) { if (hasSubscribers(eventName)) { return true; } else if (exact) { return false; } else { eventName = stripLevel(eventName); } } return false; }
[ "public", "boolean", "hasSubscribers", "(", "String", "eventName", ",", "boolean", "exact", ")", "{", "while", "(", "!", "StringUtils", ".", "isEmpty", "(", "eventName", ")", ")", "{", "if", "(", "hasSubscribers", "(", "eventName", ")", ")", "{", "return",...
Returns true If the event has subscribers. @param eventName Name of the event. @param exact If false, will iterate through parent events until a subscriber is found. If true, only the exact event is considered. @return True if a subscriber was found.
[ "Returns", "true", "If", "the", "event", "has", "subscribers", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java#L103-L115
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java
EventSubscriptions.getSubscribers
public synchronized Iterable<IGenericEvent<T>> getSubscribers(String eventName) { List<IGenericEvent<T>> subscribers = getSubscribers(eventName, false); return subscribers == null ? null : new ArrayList<>(subscribers); }
java
public synchronized Iterable<IGenericEvent<T>> getSubscribers(String eventName) { List<IGenericEvent<T>> subscribers = getSubscribers(eventName, false); return subscribers == null ? null : new ArrayList<>(subscribers); }
[ "public", "synchronized", "Iterable", "<", "IGenericEvent", "<", "T", ">", ">", "getSubscribers", "(", "String", "eventName", ")", "{", "List", "<", "IGenericEvent", "<", "T", ">>", "subscribers", "=", "getSubscribers", "(", "eventName", ",", "false", ")", "...
Returns a thread-safe iterable for the subscriber list. @param eventName Name of the event. @return Iterable for the subscriber list, or null if no list exists.
[ "Returns", "a", "thread", "-", "safe", "iterable", "for", "the", "subscriber", "list", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java#L123-L126
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java
EventSubscriptions.invokeCallbacks
public void invokeCallbacks(String eventName, T eventData) { String name = eventName; while (!StringUtils.isEmpty(name)) { Iterable<IGenericEvent<T>> subscribers = getSubscribers(name); if (subscribers != null) { for (IGenericEvent<T> subscriber : subscribers) { try { if (log.isDebugEnabled()) { log.debug(String.format("Firing local Event[name=%s,data=%s]", eventName, eventData)); } subscriber.eventCallback(eventName, eventData); } catch (Throwable e) { log.error("Error during local event callback.", e); } } } name = stripLevel(name); } }
java
public void invokeCallbacks(String eventName, T eventData) { String name = eventName; while (!StringUtils.isEmpty(name)) { Iterable<IGenericEvent<T>> subscribers = getSubscribers(name); if (subscribers != null) { for (IGenericEvent<T> subscriber : subscribers) { try { if (log.isDebugEnabled()) { log.debug(String.format("Firing local Event[name=%s,data=%s]", eventName, eventData)); } subscriber.eventCallback(eventName, eventData); } catch (Throwable e) { log.error("Error during local event callback.", e); } } } name = stripLevel(name); } }
[ "public", "void", "invokeCallbacks", "(", "String", "eventName", ",", "T", "eventData", ")", "{", "String", "name", "=", "eventName", ";", "while", "(", "!", "StringUtils", ".", "isEmpty", "(", "name", ")", ")", "{", "Iterable", "<", "IGenericEvent", "<", ...
Invokes callbacks on all subscribers of this and parent events. @param eventName Name of the event. @param eventData The associated event data.
[ "Invokes", "callbacks", "on", "all", "subscribers", "of", "this", "and", "parent", "events", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java#L150-L171
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java
EventSubscriptions.getSubscribers
private List<IGenericEvent<T>> getSubscribers(String eventName, boolean canCreate) { List<IGenericEvent<T>> subscribers = subscriptions.get(eventName); if (subscribers == null && canCreate) { subscribers = new LinkedList<>(); subscriptions.put(eventName, subscribers); } return subscribers; }
java
private List<IGenericEvent<T>> getSubscribers(String eventName, boolean canCreate) { List<IGenericEvent<T>> subscribers = subscriptions.get(eventName); if (subscribers == null && canCreate) { subscribers = new LinkedList<>(); subscriptions.put(eventName, subscribers); } return subscribers; }
[ "private", "List", "<", "IGenericEvent", "<", "T", ">", ">", "getSubscribers", "(", "String", "eventName", ",", "boolean", "canCreate", ")", "{", "List", "<", "IGenericEvent", "<", "T", ">>", "subscribers", "=", "subscriptions", ".", "get", "(", "eventName",...
Gets the list of subscribers associated with an event. @param eventName Name of the event. @param canCreate If true and the list does not exist, create it. @return The requested list; may be null.
[ "Gets", "the", "list", "of", "subscribers", "associated", "with", "an", "event", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java#L180-L189
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java
EventSubscriptions.stripLevel
private String stripLevel(String eventName) { int i = eventName.lastIndexOf('.'); return i > 1 ? eventName.substring(0, i) : ""; }
java
private String stripLevel(String eventName) { int i = eventName.lastIndexOf('.'); return i > 1 ? eventName.substring(0, i) : ""; }
[ "private", "String", "stripLevel", "(", "String", "eventName", ")", "{", "int", "i", "=", "eventName", ".", "lastIndexOf", "(", "'", "'", ")", ";", "return", "i", ">", "1", "?", "eventName", ".", "substring", "(", "0", ",", "i", ")", ":", "\"\"", "...
Strips the lowest hierarchical level from the event type. @param eventName Event type. @return Event type with the lowest level removed.
[ "Strips", "the", "lowest", "hierarchical", "level", "from", "the", "event", "type", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java#L197-L200
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/thread/ThreadEx.java
ThreadEx.start
public void start() { if (log.isDebugEnabled()) { log.debug("Executing ThreadEx [target=" + target.getClass().getName() + "]"); } ThreadUtil.startThread(this.thread); }
java
public void start() { if (log.isDebugEnabled()) { log.debug("Executing ThreadEx [target=" + target.getClass().getName() + "]"); } ThreadUtil.startThread(this.thread); }
[ "public", "void", "start", "(", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Executing ThreadEx [target=\"", "+", "target", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"]\"", ")", ...
Starts the background thread.
[ "Starts", "the", "background", "thread", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/thread/ThreadEx.java#L148-L153
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/thread/ThreadEx.java
ThreadEx.done
protected void done() { try { page.getEventQueue().queue(event); } catch (Exception e) { log.error(e); } }
java
protected void done() { try { page.getEventQueue().queue(event); } catch (Exception e) { log.error(e); } }
[ "protected", "void", "done", "(", ")", "{", "try", "{", "page", ".", "getEventQueue", "(", ")", ".", "queue", "(", "event", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "e", ")", ";", "}", "}" ]
Invoked by the background thread when it has completed the target operation, even if aborted. This schedules a notification on the desktop's event thread where the requester is notified of the completion.
[ "Invoked", "by", "the", "background", "thread", "when", "it", "has", "completed", "the", "target", "operation", "even", "if", "aborted", ".", "This", "schedules", "a", "notification", "on", "the", "desktop", "s", "event", "thread", "where", "the", "requester",...
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/thread/ThreadEx.java#L181-L187
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/thread/ThreadEx.java
ThreadEx.setAttribute
public void setAttribute(String name, Object value) { synchronized (attribute) { attribute.put(name, value); } }
java
public void setAttribute(String name, Object value) { synchronized (attribute) { attribute.put(name, value); } }
[ "public", "void", "setAttribute", "(", "String", "name", ",", "Object", "value", ")", "{", "synchronized", "(", "attribute", ")", "{", "attribute", ".", "put", "(", "name", ",", "value", ")", ";", "}", "}" ]
Sets the named attribute to the specified value. @param name Name of the attribute. @param value Value to associate with the attribute.
[ "Sets", "the", "named", "attribute", "to", "the", "specified", "value", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/thread/ThreadEx.java#L216-L220
train
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.revertImplementation
public void revertImplementation(Page page) { Integer previousImplementedVersion = getPreviousImplementedVersion(page); if (previousImplementedVersion != null) { saveImplementedVersion(page, previousImplementedVersion); savePreviousImplementedVersion(page, null); } }
java
public void revertImplementation(Page page) { Integer previousImplementedVersion = getPreviousImplementedVersion(page); if (previousImplementedVersion != null) { saveImplementedVersion(page, previousImplementedVersion); savePreviousImplementedVersion(page, null); } }
[ "public", "void", "revertImplementation", "(", "Page", "page", ")", "{", "Integer", "previousImplementedVersion", "=", "getPreviousImplementedVersion", "(", "page", ")", ";", "if", "(", "previousImplementedVersion", "!=", "null", ")", "{", "saveImplementedVersion", "(...
Sets the implemented version to the previous implemented version. @param page a {@link com.atlassian.confluence.pages.Page} object.
[ "Sets", "the", "implemented", "version", "to", "the", "previous", "implemented", "version", "." ]
2a61e6c179b74085babcc559d677490b0cad2d30
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L550-L556
train
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.getPreviousImplementedVersion
public Integer getPreviousImplementedVersion(Page page) { ContentEntityObject entityObject = getContentEntityManager().getById(page.getId()); String value = getContentPropertyManager().getStringProperty(entityObject, PREVIOUS_IMPLEMENTED_VERSION); return value == null ? null : Integer.valueOf(value); }
java
public Integer getPreviousImplementedVersion(Page page) { ContentEntityObject entityObject = getContentEntityManager().getById(page.getId()); String value = getContentPropertyManager().getStringProperty(entityObject, PREVIOUS_IMPLEMENTED_VERSION); return value == null ? null : Integer.valueOf(value); }
[ "public", "Integer", "getPreviousImplementedVersion", "(", "Page", "page", ")", "{", "ContentEntityObject", "entityObject", "=", "getContentEntityManager", "(", ")", ".", "getById", "(", "page", ".", "getId", "(", ")", ")", ";", "String", "value", "=", "getConte...
Retrieves the previous implemented version of the specification. @param page a {@link com.atlassian.confluence.pages.Page} object. @return the previous implemented version of the specification.
[ "Retrieves", "the", "previous", "implemented", "version", "of", "the", "specification", "." ]
2a61e6c179b74085babcc559d677490b0cad2d30
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L564-L568
train
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.savePreviousImplementedVersion
public void savePreviousImplementedVersion(Page page, Integer version) { String value = version != null ? String.valueOf(version) : null; ContentEntityObject entityObject = getContentEntityManager().getById(page.getId()); getContentPropertyManager().setStringProperty(entityObject, PREVIOUS_IMPLEMENTED_VERSION, value); }
java
public void savePreviousImplementedVersion(Page page, Integer version) { String value = version != null ? String.valueOf(version) : null; ContentEntityObject entityObject = getContentEntityManager().getById(page.getId()); getContentPropertyManager().setStringProperty(entityObject, PREVIOUS_IMPLEMENTED_VERSION, value); }
[ "public", "void", "savePreviousImplementedVersion", "(", "Page", "page", ",", "Integer", "version", ")", "{", "String", "value", "=", "version", "!=", "null", "?", "String", ".", "valueOf", "(", "version", ")", ":", "null", ";", "ContentEntityObject", "entityO...
Saves the sprecified version as the Previous implemented version @param page a {@link com.atlassian.confluence.pages.Page} object. @param version a {@link java.lang.Integer} object.
[ "Saves", "the", "sprecified", "version", "as", "the", "Previous", "implemented", "version" ]
2a61e6c179b74085babcc559d677490b0cad2d30
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L576-L580
train
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.canBeImplemented
public boolean canBeImplemented(Page page) { Integer implementedVersion = getImplementedVersion(page); return implementedVersion == null || page.getVersion() != implementedVersion; }
java
public boolean canBeImplemented(Page page) { Integer implementedVersion = getImplementedVersion(page); return implementedVersion == null || page.getVersion() != implementedVersion; }
[ "public", "boolean", "canBeImplemented", "(", "Page", "page", ")", "{", "Integer", "implementedVersion", "=", "getImplementedVersion", "(", "page", ")", ";", "return", "implementedVersion", "==", "null", "||", "page", ".", "getVersion", "(", ")", "!=", "implemen...
Verifies if the specification can be Implemented. @param page a {@link com.atlassian.confluence.pages.Page} object. @return true if the specification can be Implemented.
[ "Verifies", "if", "the", "specification", "can", "be", "Implemented", "." ]
2a61e6c179b74085babcc559d677490b0cad2d30
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L588-L591
train
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.getImplementedVersion
public Integer getImplementedVersion(Page page) { ContentEntityObject entityObject = getContentEntityManager().getById(page.getId()); String value = getContentPropertyManager().getStringProperty(entityObject, IMPLEMENTED_VERSION); return value == null ? null : Integer.valueOf(value); }
java
public Integer getImplementedVersion(Page page) { ContentEntityObject entityObject = getContentEntityManager().getById(page.getId()); String value = getContentPropertyManager().getStringProperty(entityObject, IMPLEMENTED_VERSION); return value == null ? null : Integer.valueOf(value); }
[ "public", "Integer", "getImplementedVersion", "(", "Page", "page", ")", "{", "ContentEntityObject", "entityObject", "=", "getContentEntityManager", "(", ")", ".", "getById", "(", "page", ".", "getId", "(", ")", ")", ";", "String", "value", "=", "getContentProper...
Retrieves the implemented version of the specification. @param page a {@link com.atlassian.confluence.pages.Page} object. @return the implemented version of the specification.
[ "Retrieves", "the", "implemented", "version", "of", "the", "specification", "." ]
2a61e6c179b74085babcc559d677490b0cad2d30
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L599-L603
train
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.saveImplementedVersion
public void saveImplementedVersion(Page page, Integer version) { Integer previousImplementedVersion = getImplementedVersion(page); if (previousImplementedVersion != null && version != null && previousImplementedVersion == version) return; if (previousImplementedVersion != null) savePreviousImplementedVersion(page, previousImplementedVersion); String value = version != null ? String.valueOf(version) : null; ContentEntityObject entityObject = getContentEntityManager().getById(page.getId()); getContentPropertyManager().setStringProperty(entityObject, IMPLEMENTED_VERSION, value); }
java
public void saveImplementedVersion(Page page, Integer version) { Integer previousImplementedVersion = getImplementedVersion(page); if (previousImplementedVersion != null && version != null && previousImplementedVersion == version) return; if (previousImplementedVersion != null) savePreviousImplementedVersion(page, previousImplementedVersion); String value = version != null ? String.valueOf(version) : null; ContentEntityObject entityObject = getContentEntityManager().getById(page.getId()); getContentPropertyManager().setStringProperty(entityObject, IMPLEMENTED_VERSION, value); }
[ "public", "void", "saveImplementedVersion", "(", "Page", "page", ",", "Integer", "version", ")", "{", "Integer", "previousImplementedVersion", "=", "getImplementedVersion", "(", "page", ")", ";", "if", "(", "previousImplementedVersion", "!=", "null", "&&", "version"...
Saves the sprecified version as the Iimplemented version @param page a {@link com.atlassian.confluence.pages.Page} object. @param version a {@link java.lang.Integer} object.
[ "Saves", "the", "sprecified", "version", "as", "the", "Iimplemented", "version" ]
2a61e6c179b74085babcc559d677490b0cad2d30
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L611-L622
train
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.isImplementationDue
public boolean isImplementationDue(Page page) { int version = page.getVersion(); Integer implementedVersion = getImplementedVersion(page); if (implementedVersion != null) version = page.getVersion() == implementedVersion ? implementedVersion : implementedVersion + 1; Date date = getPageManager().getPageByVersion(page, version).getLastModificationDate(); Period period = Period.fromTo(date, new Date(System.currentTimeMillis())); return period.daysCount() > CRITICAL_PERIOD; }
java
public boolean isImplementationDue(Page page) { int version = page.getVersion(); Integer implementedVersion = getImplementedVersion(page); if (implementedVersion != null) version = page.getVersion() == implementedVersion ? implementedVersion : implementedVersion + 1; Date date = getPageManager().getPageByVersion(page, version).getLastModificationDate(); Period period = Period.fromTo(date, new Date(System.currentTimeMillis())); return period.daysCount() > CRITICAL_PERIOD; }
[ "public", "boolean", "isImplementationDue", "(", "Page", "page", ")", "{", "int", "version", "=", "page", ".", "getVersion", "(", ")", ";", "Integer", "implementedVersion", "=", "getImplementedVersion", "(", "page", ")", ";", "if", "(", "implementedVersion", "...
Verifies if the Specification has stayed to long in the WORKING state. @param page a {@link com.atlassian.confluence.pages.Page} object. @return true if the Specification has stayed to long in the WORKING state.
[ "Verifies", "if", "the", "Specification", "has", "stayed", "to", "long", "in", "the", "WORKING", "state", "." ]
2a61e6c179b74085babcc559d677490b0cad2d30
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L645-L655
train
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.getExecuteChildren
public boolean getExecuteChildren(Page page) { ContentEntityObject entityObject = getContentEntityManager().getById(page.getId()); String value = getContentPropertyManager().getStringProperty(entityObject, EXECUTE_CHILDREN); return value == null ? false : Boolean.valueOf(value); }
java
public boolean getExecuteChildren(Page page) { ContentEntityObject entityObject = getContentEntityManager().getById(page.getId()); String value = getContentPropertyManager().getStringProperty(entityObject, EXECUTE_CHILDREN); return value == null ? false : Boolean.valueOf(value); }
[ "public", "boolean", "getExecuteChildren", "(", "Page", "page", ")", "{", "ContentEntityObject", "entityObject", "=", "getContentEntityManager", "(", ")", ".", "getById", "(", "page", ".", "getId", "(", ")", ")", ";", "String", "value", "=", "getContentPropertyM...
Retrieves from the page propeties the Execute childs boolean. If none registered false is returned. @param page a {@link com.atlassian.confluence.pages.Page} object. @return the Execute childs boolean.
[ "Retrieves", "from", "the", "page", "propeties", "the", "Execute", "childs", "boolean", ".", "If", "none", "registered", "false", "is", "returned", "." ]
2a61e6c179b74085babcc559d677490b0cad2d30
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L664-L668
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java
CWF2XML.toDocument
public static Document toDocument(BaseComponent root, String... excludedProperties) { try { CWF2XML instance = new CWF2XML(excludedProperties); instance.toXML(root, instance.doc); return instance.doc; } catch (ParserConfigurationException e) { return null; } }
java
public static Document toDocument(BaseComponent root, String... excludedProperties) { try { CWF2XML instance = new CWF2XML(excludedProperties); instance.toXML(root, instance.doc); return instance.doc; } catch (ParserConfigurationException e) { return null; } }
[ "public", "static", "Document", "toDocument", "(", "BaseComponent", "root", ",", "String", "...", "excludedProperties", ")", "{", "try", "{", "CWF2XML", "instance", "=", "new", "CWF2XML", "(", "excludedProperties", ")", ";", "instance", ".", "toXML", "(", "roo...
Returns an XML document that mirrors the CWF component tree starting at the specified root. @param root BaseComponent whose subtree is to be traversed. @param excludedProperties An optional list of properties that should be excluded from the output. These may either be the property name (e.g., "uuid") or a property name qualified by a component name (e.g., "window.uuid"). Optionally, an entry may be followed by an "=" and a value to exclude matches with a specific value. Note that "innerAttrs" and "outerAttrs" are always excluded. @return An XML document that represents the component subtree.
[ "Returns", "an", "XML", "document", "that", "mirrors", "the", "CWF", "component", "tree", "starting", "at", "the", "specified", "root", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java#L68-L76
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java
CWF2XML.toXML
public static String toXML(BaseComponent root, String... excludedProperties) { return XMLUtil.toString(toDocument(root, excludedProperties)); }
java
public static String toXML(BaseComponent root, String... excludedProperties) { return XMLUtil.toString(toDocument(root, excludedProperties)); }
[ "public", "static", "String", "toXML", "(", "BaseComponent", "root", ",", "String", "...", "excludedProperties", ")", "{", "return", "XMLUtil", ".", "toString", "(", "toDocument", "(", "root", ",", "excludedProperties", ")", ")", ";", "}" ]
Returns an XML-formatted string that mirrors the CWF component tree starting at the specified root. @param root BaseComponent whose subtree is to be traversed. @param excludedProperties An optional list of properties that should be excluded from the output. These may either be the property name (e.g., "uuid") or a property name qualified by a component name (e.g., "window.uuid"). Optionally, an entry may be followed by an "=" and a value to exclude matches with a specific value. Note that "innerAttrs" and "outerAttrs" are always excluded. @return The XML text representation of the component subtree.
[ "Returns", "an", "XML", "-", "formatted", "string", "that", "mirrors", "the", "CWF", "component", "tree", "starting", "at", "the", "specified", "root", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java#L90-L92
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java
CWF2XML.toXML
private void toXML(BaseComponent root, Node parent) { TreeMap<String, String> properties = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); Class<?> clazz = root.getClass(); ComponentDefinition def = root.getDefinition(); String cmpname = def.getTag(); if (def.getComponentClass() != clazz) { properties.put("impl", clazz.getName()); } Node child = doc.createElement(cmpname); parent.appendChild(child); for (PropertyDescriptor propDx : PropertyUtils.getPropertyDescriptors(root)) { Method getter = propDx.getReadMethod(); Method setter = propDx.getWriteMethod(); String name = propDx.getName(); if (getter != null && setter != null && !isExcluded(name, cmpname, null) && !setter.isAnnotationPresent(Deprecated.class) && (getter.getReturnType() == String.class || getter.getReturnType().isPrimitive())) { try { Object raw = getter.invoke(root); String value = raw == null ? null : raw.toString(); if (StringUtils.isEmpty(value) || ("id".equals(name) && value.startsWith("z_")) || isExcluded(name, cmpname, value)) { continue; } properties.put(name, value.toString()); } catch (Exception e) {} } } for (Entry<String, String> entry : properties.entrySet()) { Attr attr = doc.createAttribute(entry.getKey()); child.getAttributes().setNamedItem(attr); attr.setValue(entry.getValue()); } properties = null; for (BaseComponent cmp : root.getChildren()) { toXML(cmp, child); } }
java
private void toXML(BaseComponent root, Node parent) { TreeMap<String, String> properties = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); Class<?> clazz = root.getClass(); ComponentDefinition def = root.getDefinition(); String cmpname = def.getTag(); if (def.getComponentClass() != clazz) { properties.put("impl", clazz.getName()); } Node child = doc.createElement(cmpname); parent.appendChild(child); for (PropertyDescriptor propDx : PropertyUtils.getPropertyDescriptors(root)) { Method getter = propDx.getReadMethod(); Method setter = propDx.getWriteMethod(); String name = propDx.getName(); if (getter != null && setter != null && !isExcluded(name, cmpname, null) && !setter.isAnnotationPresent(Deprecated.class) && (getter.getReturnType() == String.class || getter.getReturnType().isPrimitive())) { try { Object raw = getter.invoke(root); String value = raw == null ? null : raw.toString(); if (StringUtils.isEmpty(value) || ("id".equals(name) && value.startsWith("z_")) || isExcluded(name, cmpname, value)) { continue; } properties.put(name, value.toString()); } catch (Exception e) {} } } for (Entry<String, String> entry : properties.entrySet()) { Attr attr = doc.createAttribute(entry.getKey()); child.getAttributes().setNamedItem(attr); attr.setValue(entry.getValue()); } properties = null; for (BaseComponent cmp : root.getChildren()) { toXML(cmp, child); } }
[ "private", "void", "toXML", "(", "BaseComponent", "root", ",", "Node", "parent", ")", "{", "TreeMap", "<", "String", ",", "String", ">", "properties", "=", "new", "TreeMap", "<>", "(", "String", ".", "CASE_INSENSITIVE_ORDER", ")", ";", "Class", "<", "?", ...
Adds the root component to the XML document at the current level along with all bean properties that return String or primitive types. Then, recurses over all of the root component's children. @param root The root component. @param parent The parent XML node.
[ "Adds", "the", "root", "component", "to", "the", "XML", "document", "at", "the", "current", "level", "along", "with", "all", "bean", "properties", "that", "return", "String", "or", "primitive", "types", ".", "Then", "recurses", "over", "all", "of", "the", ...
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java#L123-L169
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java
CWF2XML.isExcluded
private boolean isExcluded(String name, String cmpname, String value) { return exclude.contains(excludeKey(name, null, value)) || exclude.contains(excludeKey(name, cmpname, value)); }
java
private boolean isExcluded(String name, String cmpname, String value) { return exclude.contains(excludeKey(name, null, value)) || exclude.contains(excludeKey(name, cmpname, value)); }
[ "private", "boolean", "isExcluded", "(", "String", "name", ",", "String", "cmpname", ",", "String", "value", ")", "{", "return", "exclude", ".", "contains", "(", "excludeKey", "(", "name", ",", "null", ",", "value", ")", ")", "||", "exclude", ".", "conta...
Returns true if the property is to be excluded. @param name The property name. @param cmpname The component name (may be null). @param value The property value (may be null). @return True if the property should be excluded.
[ "Returns", "true", "if", "the", "property", "is", "to", "be", "excluded", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java#L179-L181
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java
CWF2XML.excludeKey
private String excludeKey(String name, String cmpname, String value) { StringBuilder sb = new StringBuilder(cmpname == null ? "" : cmpname + "."); sb.append(name).append(value == null ? "" : "=" + value); return sb.toString(); }
java
private String excludeKey(String name, String cmpname, String value) { StringBuilder sb = new StringBuilder(cmpname == null ? "" : cmpname + "."); sb.append(name).append(value == null ? "" : "=" + value); return sb.toString(); }
[ "private", "String", "excludeKey", "(", "String", "name", ",", "String", "cmpname", ",", "String", "value", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "cmpname", "==", "null", "?", "\"\"", ":", "cmpname", "+", "\".\"", ")", ";", "...
Returns the exclusion lookup key for the property. @param name The property name. @param cmpname The component name (may be null). @param value The property value (may be null). @return The exclusion lookup key.
[ "Returns", "the", "exclusion", "lookup", "key", "for", "the", "property", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java#L191-L195
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/DisruptorQueue.java
DisruptorQueue.putToRingBuffer
protected void putToRingBuffer(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull { if (msg == null) { throw new NullPointerException("Supplied queue message is null!"); } LOCK_PUT.lock(); try { if (!ringBuffer.tryPublishEvent((event, _seq) -> { event.set(msg); knownPublishedSeq = _seq > knownPublishedSeq ? _seq : knownPublishedSeq; })) { throw new QueueException.QueueIsFull(getRingSize()); } } finally { LOCK_PUT.unlock(); } }
java
protected void putToRingBuffer(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull { if (msg == null) { throw new NullPointerException("Supplied queue message is null!"); } LOCK_PUT.lock(); try { if (!ringBuffer.tryPublishEvent((event, _seq) -> { event.set(msg); knownPublishedSeq = _seq > knownPublishedSeq ? _seq : knownPublishedSeq; })) { throw new QueueException.QueueIsFull(getRingSize()); } } finally { LOCK_PUT.unlock(); } }
[ "protected", "void", "putToRingBuffer", "(", "IQueueMessage", "<", "ID", ",", "DATA", ">", "msg", ")", "throws", "QueueException", ".", "QueueIsFull", "{", "if", "(", "msg", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Supplied queue...
Put a message to the ring buffer. @param msg @throws QueueException.QueueIsFull if the ring buffer is full
[ "Put", "a", "message", "to", "the", "ring", "buffer", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/DisruptorQueue.java#L138-L153
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/DisruptorQueue.java
DisruptorQueue.takeFromRingBuffer
protected IQueueMessage<ID, DATA> takeFromRingBuffer() { LOCK_TAKE.lock(); try { long l = consumedSeq.get() + 1; if (l <= knownPublishedSeq) { try { Event<ID, DATA> eventHolder = ringBuffer.get(l); try { return eventHolder.get(); } finally { eventHolder.set(null); } } finally { consumedSeq.incrementAndGet(); } } else { knownPublishedSeq = ringBuffer.getCursor(); } return null; } finally { LOCK_TAKE.unlock(); } }
java
protected IQueueMessage<ID, DATA> takeFromRingBuffer() { LOCK_TAKE.lock(); try { long l = consumedSeq.get() + 1; if (l <= knownPublishedSeq) { try { Event<ID, DATA> eventHolder = ringBuffer.get(l); try { return eventHolder.get(); } finally { eventHolder.set(null); } } finally { consumedSeq.incrementAndGet(); } } else { knownPublishedSeq = ringBuffer.getCursor(); } return null; } finally { LOCK_TAKE.unlock(); } }
[ "protected", "IQueueMessage", "<", "ID", ",", "DATA", ">", "takeFromRingBuffer", "(", ")", "{", "LOCK_TAKE", ".", "lock", "(", ")", ";", "try", "{", "long", "l", "=", "consumedSeq", ".", "get", "(", ")", "+", "1", ";", "if", "(", "l", "<=", "knownP...
Takes a message from the ring buffer. @return the available message or {@code null} if the ring buffer is empty
[ "Takes", "a", "message", "from", "the", "ring", "buffer", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/DisruptorQueue.java#L219-L241
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV3_1Generator.java
PHS398FellowshipSupplementalV3_1Generator.setHumanSubjectInvolvedAndVertebrateAnimalUsed
protected void setHumanSubjectInvolvedAndVertebrateAnimalUsed(OtherResearchTrainingPlan researchTrainingPlan) { researchTrainingPlan.setHumanSubjectsInvolved(YesNoDataType.N_NO); researchTrainingPlan.setVertebrateAnimalsUsed(YesNoDataType.N_NO); for (ProposalSpecialReviewContract propSpecialReview : pdDoc.getDevelopmentProposal().getPropSpecialReviews()) { switch (Integer.parseInt(propSpecialReview.getSpecialReviewType().getCode())) { case 1: researchTrainingPlan.setHumanSubjectsInvolved(YesNoDataType.Y_YES); break; case 2: researchTrainingPlan.setVertebrateAnimalsUsed(YesNoDataType.Y_YES); break; default: break; } } }
java
protected void setHumanSubjectInvolvedAndVertebrateAnimalUsed(OtherResearchTrainingPlan researchTrainingPlan) { researchTrainingPlan.setHumanSubjectsInvolved(YesNoDataType.N_NO); researchTrainingPlan.setVertebrateAnimalsUsed(YesNoDataType.N_NO); for (ProposalSpecialReviewContract propSpecialReview : pdDoc.getDevelopmentProposal().getPropSpecialReviews()) { switch (Integer.parseInt(propSpecialReview.getSpecialReviewType().getCode())) { case 1: researchTrainingPlan.setHumanSubjectsInvolved(YesNoDataType.Y_YES); break; case 2: researchTrainingPlan.setVertebrateAnimalsUsed(YesNoDataType.Y_YES); break; default: break; } } }
[ "protected", "void", "setHumanSubjectInvolvedAndVertebrateAnimalUsed", "(", "OtherResearchTrainingPlan", "researchTrainingPlan", ")", "{", "researchTrainingPlan", ".", "setHumanSubjectsInvolved", "(", "YesNoDataType", ".", "N_NO", ")", ";", "researchTrainingPlan", ".", "setVert...
This method is used to set HumanSubjectInvoved and VertebrateAnimalUsed XMLObject Data. @param researchTrainingPlan
[ "This", "method", "is", "used", "to", "set", "HumanSubjectInvoved", "and", "VertebrateAnimalUsed", "XMLObject", "Data", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV3_1Generator.java#L891-L906
train
mgormley/prim
src/main/java/edu/jhu/prim/bimap/ObjectObjectBimap.java
ObjectObjectBimap.getEntries
public List<Pair<A, B>> getEntries() { List<Pair<A, B>> l = new ArrayList<>(size()); for (Map.Entry<A, B> x : map1.entrySet()) l.add(new Pair<>(x.getKey(), x.getValue())); return l; }
java
public List<Pair<A, B>> getEntries() { List<Pair<A, B>> l = new ArrayList<>(size()); for (Map.Entry<A, B> x : map1.entrySet()) l.add(new Pair<>(x.getKey(), x.getValue())); return l; }
[ "public", "List", "<", "Pair", "<", "A", ",", "B", ">", ">", "getEntries", "(", ")", "{", "List", "<", "Pair", "<", "A", ",", "B", ">", ">", "l", "=", "new", "ArrayList", "<>", "(", "size", "(", ")", ")", ";", "for", "(", "Map", ".", "Entry...
Returns a new List with all the entries in this bimap
[ "Returns", "a", "new", "List", "with", "all", "the", "entries", "in", "this", "bimap" ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/bimap/ObjectObjectBimap.java#L73-L78
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/PromptDialog.java
PromptDialog.show
public static void show(DialogControl<?> control) { DialogResponse<?> response = control.getLastResponse(); if (response != null) { control.callback(response); return; } Window root = null; try { Map<String, Object> args = Collections.singletonMap("control", control); root = (Window) PageUtil .createPage(DialogConstants.RESOURCE_PREFIX + "promptDialog.fsp", ExecutionContext.getPage(), args) .get(0); root.modal(null); } catch (Exception e) { log.error("Error Displaying Dialog", e); if (root != null) { root.destroy(); } throw MiscUtil.toUnchecked(e); } }
java
public static void show(DialogControl<?> control) { DialogResponse<?> response = control.getLastResponse(); if (response != null) { control.callback(response); return; } Window root = null; try { Map<String, Object> args = Collections.singletonMap("control", control); root = (Window) PageUtil .createPage(DialogConstants.RESOURCE_PREFIX + "promptDialog.fsp", ExecutionContext.getPage(), args) .get(0); root.modal(null); } catch (Exception e) { log.error("Error Displaying Dialog", e); if (root != null) { root.destroy(); } throw MiscUtil.toUnchecked(e); } }
[ "public", "static", "void", "show", "(", "DialogControl", "<", "?", ">", "control", ")", "{", "DialogResponse", "<", "?", ">", "response", "=", "control", ".", "getLastResponse", "(", ")", ";", "if", "(", "response", "!=", "null", ")", "{", "control", ...
Display the prompt dialog. @param control The dialog control.
[ "Display", "the", "prompt", "dialog", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/PromptDialog.java#L70-L95
train
carewebframework/carewebframework-core
org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/AbstractSecurityService.java
AbstractSecurityService.getSecurityContext
public static SecurityContext getSecurityContext() { Session session = ExecutionContext.getSession(); @SuppressWarnings("resource") WebSocketSession ws = session == null ? null : session.getSocket(); return ws == null ? null : (SecurityContext) ws.getAttributes().get(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY); }
java
public static SecurityContext getSecurityContext() { Session session = ExecutionContext.getSession(); @SuppressWarnings("resource") WebSocketSession ws = session == null ? null : session.getSocket(); return ws == null ? null : (SecurityContext) ws.getAttributes().get(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY); }
[ "public", "static", "SecurityContext", "getSecurityContext", "(", ")", "{", "Session", "session", "=", "ExecutionContext", ".", "getSession", "(", ")", ";", "@", "SuppressWarnings", "(", "\"resource\"", ")", "WebSocketSession", "ws", "=", "session", "==", "null", ...
Returns the security context from the execution context. @return The security context, or null if one cannot be determined.
[ "Returns", "the", "security", "context", "from", "the", "execution", "context", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/AbstractSecurityService.java#L72-L78
train
carewebframework/carewebframework-core
org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/AbstractSecurityService.java
AbstractSecurityService.logout
@Override public void logout(boolean force, String target, String message) { log.trace("Logging Out"); IContextManager contextManager = ContextManager.getInstance(); if (contextManager == null) { logout(target, message); } else { contextManager.reset(force, (response) -> { if (force || !response.rejected()) { logout(target, message); } }); }
java
@Override public void logout(boolean force, String target, String message) { log.trace("Logging Out"); IContextManager contextManager = ContextManager.getInstance(); if (contextManager == null) { logout(target, message); } else { contextManager.reset(force, (response) -> { if (force || !response.rejected()) { logout(target, message); } }); }
[ "@", "Override", "public", "void", "logout", "(", "boolean", "force", ",", "String", "target", ",", "String", "message", ")", "{", "log", ".", "trace", "(", "\"Logging Out\"", ")", ";", "IContextManager", "contextManager", "=", "ContextManager", ".", "getInsta...
Logout out the current page instance. @param force If true, force logout without user interaction. @param target Optional target url for next login. @param message Optional message to indicate reason for logout.
[ "Logout", "out", "the", "current", "page", "instance", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/AbstractSecurityService.java#L104-L117
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudgetBaseGenerator.java
RRBudgetBaseGenerator.hasPersonnelBudget
protected Boolean hasPersonnelBudget(KeyPersonDto keyPerson,int period){ List<? extends BudgetLineItemContract> budgetLineItemList = new ArrayList<>(); ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal()); budgetLineItemList = budget.getBudgetPeriods().get(period-1).getBudgetLineItems(); for(BudgetLineItemContract budgetLineItem : budgetLineItemList) { for(BudgetPersonnelDetailsContract budgetPersonnelDetails : budgetLineItem.getBudgetPersonnelDetailsList()){ if( budgetPersonnelDetails.getPersonId().equals(keyPerson.getPersonId())){ return true; } else if (keyPerson.getRolodexId() != null && budgetPersonnelDetails.getPersonId().equals(keyPerson.getRolodexId().toString())) { return true; } } } return false; }
java
protected Boolean hasPersonnelBudget(KeyPersonDto keyPerson,int period){ List<? extends BudgetLineItemContract> budgetLineItemList = new ArrayList<>(); ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal()); budgetLineItemList = budget.getBudgetPeriods().get(period-1).getBudgetLineItems(); for(BudgetLineItemContract budgetLineItem : budgetLineItemList) { for(BudgetPersonnelDetailsContract budgetPersonnelDetails : budgetLineItem.getBudgetPersonnelDetailsList()){ if( budgetPersonnelDetails.getPersonId().equals(keyPerson.getPersonId())){ return true; } else if (keyPerson.getRolodexId() != null && budgetPersonnelDetails.getPersonId().equals(keyPerson.getRolodexId().toString())) { return true; } } } return false; }
[ "protected", "Boolean", "hasPersonnelBudget", "(", "KeyPersonDto", "keyPerson", ",", "int", "period", ")", "{", "List", "<", "?", "extends", "BudgetLineItemContract", ">", "budgetLineItemList", "=", "new", "ArrayList", "<>", "(", ")", ";", "ProposalDevelopmentBudget...
This method check whether the key person has a personnel budget @param keyPerson (KeyPersonInfo) key person entry. @param period budget period @return true if key person has personnel budget else false.
[ "This", "method", "check", "whether", "the", "key", "person", "has", "a", "personnel", "budget" ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudgetBaseGenerator.java#L278-L295
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DialogResponse.java
DialogResponse.toResponseList
public static <T> List<DialogResponse<T>> toResponseList(T[] responses, T[] exclusions, T dflt) { List<DialogResponse<T>> list = new ArrayList<>(); boolean forceDefault = dflt == null && responses.length == 1; for (T response : responses) { DialogResponse<T> rsp = new DialogResponse<>(response, response.toString(), exclusions != null && ArrayUtils.contains(exclusions, response), forceDefault || response.equals(dflt)); list.add(rsp); } return list; }
java
public static <T> List<DialogResponse<T>> toResponseList(T[] responses, T[] exclusions, T dflt) { List<DialogResponse<T>> list = new ArrayList<>(); boolean forceDefault = dflt == null && responses.length == 1; for (T response : responses) { DialogResponse<T> rsp = new DialogResponse<>(response, response.toString(), exclusions != null && ArrayUtils.contains(exclusions, response), forceDefault || response.equals(dflt)); list.add(rsp); } return list; }
[ "public", "static", "<", "T", ">", "List", "<", "DialogResponse", "<", "T", ">", ">", "toResponseList", "(", "T", "[", "]", "responses", ",", "T", "[", "]", "exclusions", ",", "T", "dflt", ")", "{", "List", "<", "DialogResponse", "<", "T", ">>", "l...
Returns list of response objects created from a string of vertical bar delimited captions. @param <T> The type of response object. @param responses Response list. @param exclusions Exclusion list (may be null). @param dflt Default response (may be null). @return List of response objects corresponding to response list.
[ "Returns", "list", "of", "response", "objects", "created", "from", "a", "string", "of", "vertical", "bar", "delimited", "captions", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DialogResponse.java#L43-L54
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DialogResponse.java
DialogResponse.isResponseType
private boolean isResponseType(String text, String label) { return label.equals(text) || StrUtil.formatMessage(label).equals(text); }
java
private boolean isResponseType(String text, String label) { return label.equals(text) || StrUtil.formatMessage(label).equals(text); }
[ "private", "boolean", "isResponseType", "(", "String", "text", ",", "String", "label", ")", "{", "return", "label", ".", "equals", "(", "text", ")", "||", "StrUtil", ".", "formatMessage", "(", "label", ")", ".", "equals", "(", "text", ")", ";", "}" ]
Returns true if the text corresponds to a specific response type. @param text Text to test. @param label The label. @return True if represents the specified response type.
[ "Returns", "true", "if", "the", "text", "corresponds", "to", "a", "specific", "response", "type", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DialogResponse.java#L180-L182
train
mgormley/prim
src/main/java/edu/jhu/prim/vector/LongDoubleDenseVector.java
LongDoubleDenseVector.get
public double get(long i) { if (i < 0 || i >= idxAfterLast) { return missingEntries; } return elements[SafeCast.safeLongToInt(i)]; }
java
public double get(long i) { if (i < 0 || i >= idxAfterLast) { return missingEntries; } return elements[SafeCast.safeLongToInt(i)]; }
[ "public", "double", "get", "(", "long", "i", ")", "{", "if", "(", "i", "<", "0", "||", "i", ">=", "idxAfterLast", ")", "{", "return", "missingEntries", ";", "}", "return", "elements", "[", "SafeCast", ".", "safeLongToInt", "(", "i", ")", "]", ";", ...
Gets the i'th entry in the vector. @param i The index of the element to get. @return The value of the element to get.
[ "Gets", "the", "i", "th", "entry", "in", "the", "vector", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/vector/LongDoubleDenseVector.java#L69-L74
train
tomdcc/sham
sham-core/src/main/java/org/shamdata/person/Person.java
Person.getName
public String getName() { return getName(hasGivenNames() ? Collections.singletonList(givenNames.get(0)) : Collections.<String>emptyList()); }
java
public String getName() { return getName(hasGivenNames() ? Collections.singletonList(givenNames.get(0)) : Collections.<String>emptyList()); }
[ "public", "String", "getName", "(", ")", "{", "return", "getName", "(", "hasGivenNames", "(", ")", "?", "Collections", ".", "singletonList", "(", "givenNames", ".", "get", "(", "0", ")", ")", ":", "Collections", ".", "<", "String", ">", "emptyList", "(",...
Will return a standard Firstname Lastname representation of the person, with middle names omitted. @return the common form name of the person
[ "Will", "return", "a", "standard", "Firstname", "Lastname", "representation", "of", "the", "person", "with", "middle", "names", "omitted", "." ]
33ede5e7130888736d6c84368e16a56e9e31e033
https://github.com/tomdcc/sham/blob/33ede5e7130888736d6c84368e16a56e9e31e033/sham-core/src/main/java/org/shamdata/person/Person.java#L40-L42
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/ResourceCache.java
ResourceCache.getResources
@Override public Resource[] getResources(String pattern) { Resource[] resources = cache.get(pattern); return resources == null ? internalGet(pattern) : resources; }
java
@Override public Resource[] getResources(String pattern) { Resource[] resources = cache.get(pattern); return resources == null ? internalGet(pattern) : resources; }
[ "@", "Override", "public", "Resource", "[", "]", "getResources", "(", "String", "pattern", ")", "{", "Resource", "[", "]", "resources", "=", "cache", ".", "get", "(", "pattern", ")", ";", "return", "resources", "==", "null", "?", "internalGet", "(", "pat...
Returns an array of resources corresponding to the specified pattern. If the pattern has not yet been cached, the resources will be enumerated by the application context and stored in the cache. @param pattern Pattern to be used to lookup resources. @return An array of matching resources, sorted alphabetically by file name.
[ "Returns", "an", "array", "of", "resources", "corresponding", "to", "the", "specified", "pattern", ".", "If", "the", "pattern", "has", "not", "yet", "been", "cached", "the", "resources", "will", "be", "enumerated", "by", "the", "application", "context", "and",...
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/ResourceCache.java#L77-L81
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/ResourceCache.java
ResourceCache.internalGet
private synchronized Resource[] internalGet(String pattern) { Resource[] resources = cache.get(pattern); if (resources != null) { return resources; } try { resources = resolver.getResources(pattern); } catch (IOException e) { throw MiscUtil.toUnchecked(e); } if (resources == null) { resources = new Resource[0]; } else { Arrays.sort(resources, resourceComparator); } cache.put(pattern, resources); return resources; }
java
private synchronized Resource[] internalGet(String pattern) { Resource[] resources = cache.get(pattern); if (resources != null) { return resources; } try { resources = resolver.getResources(pattern); } catch (IOException e) { throw MiscUtil.toUnchecked(e); } if (resources == null) { resources = new Resource[0]; } else { Arrays.sort(resources, resourceComparator); } cache.put(pattern, resources); return resources; }
[ "private", "synchronized", "Resource", "[", "]", "internalGet", "(", "String", "pattern", ")", "{", "Resource", "[", "]", "resources", "=", "cache", ".", "get", "(", "pattern", ")", ";", "if", "(", "resources", "!=", "null", ")", "{", "return", "resource...
Use application context to enumerate resources. This call is thread safe. @param pattern Pattern to be used to lookup resources. @return An array of matching resources, sorted alphabetically by file name.
[ "Use", "application", "context", "to", "enumerate", "resources", ".", "This", "call", "is", "thread", "safe", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/ResourceCache.java#L89-L110
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/NSFApplicationChecklistV1_3Generator.java
NSFApplicationChecklistV1_3Generator.setQuestionnaireAnswers
private void setQuestionnaireAnswers(CoverSheet coverSheet, ProjectNarrative projectNarrative) { List<? extends AnswerContract> answers = getPropDevQuestionAnswerService().getQuestionnaireAnswers(pdDoc.getDevelopmentProposal().getProposalNumber(),getNamespace(),getFormName()); for (AnswerContract answer : answers) { Integer seqId = getQuestionAnswerService().findQuestionById(answer.getQuestionId()).getQuestionSeqId(); switch (seqId) { case PRELIMINARY: YesNoNotApplicableDataType.Enum yesNoNotApplicableDataType = YesNoNotApplicableDataType.N_NO; if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) { yesNoNotApplicableDataType = YesNoNotApplicableDataType.Y_YES; } else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) { yesNoNotApplicableDataType = YesNoNotApplicableDataType.N_NO; } else if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer())) { yesNoNotApplicableDataType = YesNoNotApplicableDataType.NA_NOT_APPLICABLE; } coverSheet.setCheckFullApp(yesNoNotApplicableDataType); break; case MERIT_REVIEW: if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) { projectNarrative .setCheckMeritReview(YesNoNotApplicableDataType.Y_YES); } else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) { projectNarrative .setCheckMeritReview(YesNoNotApplicableDataType.N_NO); } else if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer())) { projectNarrative .setCheckMeritReview(YesNoNotApplicableDataType.NA_NOT_APPLICABLE); } break; case MENTORING: if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) { projectNarrative .setCheckMentoring(YesNoNotApplicableDataType.Y_YES); } else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) { projectNarrative .setCheckMentoring(YesNoNotApplicableDataType.N_NO); } break; case PRIOR_SUPPORT: // Does narrative include info regarding prior support? if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) projectNarrative .setCheckPriorSupport(YesNoNotApplicableDataType.Y_YES); if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) projectNarrative .setCheckPriorSupport(YesNoNotApplicableDataType.N_NO); if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer())) projectNarrative .setCheckPriorSupport(YesNoNotApplicableDataType.NA_NOT_APPLICABLE); break; case HR_QUESTION: /* * HR Info that is mandatory for renwals from academic * institutions. */ if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) { projectNarrative .setCheckHRInfo(YesNoNotApplicableDataType.N_NO); } break; case HR_REQUIRED_INFO: /* * HR Info that is mandatory for renwals from academic * institutions. */ if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) { projectNarrative .setCheckHRInfo(YesNoNotApplicableDataType.Y_YES); } break; default: break; } } }
java
private void setQuestionnaireAnswers(CoverSheet coverSheet, ProjectNarrative projectNarrative) { List<? extends AnswerContract> answers = getPropDevQuestionAnswerService().getQuestionnaireAnswers(pdDoc.getDevelopmentProposal().getProposalNumber(),getNamespace(),getFormName()); for (AnswerContract answer : answers) { Integer seqId = getQuestionAnswerService().findQuestionById(answer.getQuestionId()).getQuestionSeqId(); switch (seqId) { case PRELIMINARY: YesNoNotApplicableDataType.Enum yesNoNotApplicableDataType = YesNoNotApplicableDataType.N_NO; if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) { yesNoNotApplicableDataType = YesNoNotApplicableDataType.Y_YES; } else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) { yesNoNotApplicableDataType = YesNoNotApplicableDataType.N_NO; } else if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer())) { yesNoNotApplicableDataType = YesNoNotApplicableDataType.NA_NOT_APPLICABLE; } coverSheet.setCheckFullApp(yesNoNotApplicableDataType); break; case MERIT_REVIEW: if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) { projectNarrative .setCheckMeritReview(YesNoNotApplicableDataType.Y_YES); } else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) { projectNarrative .setCheckMeritReview(YesNoNotApplicableDataType.N_NO); } else if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer())) { projectNarrative .setCheckMeritReview(YesNoNotApplicableDataType.NA_NOT_APPLICABLE); } break; case MENTORING: if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) { projectNarrative .setCheckMentoring(YesNoNotApplicableDataType.Y_YES); } else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) { projectNarrative .setCheckMentoring(YesNoNotApplicableDataType.N_NO); } break; case PRIOR_SUPPORT: // Does narrative include info regarding prior support? if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) projectNarrative .setCheckPriorSupport(YesNoNotApplicableDataType.Y_YES); if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) projectNarrative .setCheckPriorSupport(YesNoNotApplicableDataType.N_NO); if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer())) projectNarrative .setCheckPriorSupport(YesNoNotApplicableDataType.NA_NOT_APPLICABLE); break; case HR_QUESTION: /* * HR Info that is mandatory for renwals from academic * institutions. */ if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) { projectNarrative .setCheckHRInfo(YesNoNotApplicableDataType.N_NO); } break; case HR_REQUIRED_INFO: /* * HR Info that is mandatory for renwals from academic * institutions. */ if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) { projectNarrative .setCheckHRInfo(YesNoNotApplicableDataType.Y_YES); } break; default: break; } } }
[ "private", "void", "setQuestionnaireAnswers", "(", "CoverSheet", "coverSheet", ",", "ProjectNarrative", "projectNarrative", ")", "{", "List", "<", "?", "extends", "AnswerContract", ">", "answers", "=", "getPropDevQuestionAnswerService", "(", ")", ".", "getQuestionnaireA...
Setting the Coversheet and ProjectNarrative details according the Questionnaire Answers.
[ "Setting", "the", "Coversheet", "and", "ProjectNarrative", "details", "according", "the", "Questionnaire", "Answers", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/NSFApplicationChecklistV1_3Generator.java#L112-L188
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/Message.java
Message.getMetadata
@JsonProperty private Map<String, Object> getMetadata() { if (metadata == null) { metadata = new HashMap<>(); } return metadata; }
java
@JsonProperty private Map<String, Object> getMetadata() { if (metadata == null) { metadata = new HashMap<>(); } return metadata; }
[ "@", "JsonProperty", "private", "Map", "<", "String", ",", "Object", ">", "getMetadata", "(", ")", "{", "if", "(", "metadata", "==", "null", ")", "{", "metadata", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "return", "metadata", ";", "}" ]
Returns the metadata map, creating it if not already so. @return The metadata map.
[ "Returns", "the", "metadata", "map", "creating", "it", "if", "not", "already", "so", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/Message.java#L121-L128
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/Message.java
Message.setMetadata
public void setMetadata(String key, Object value) { if (value != null) { getMetadata().put(key, value); } }
java
public void setMetadata(String key, Object value) { if (value != null) { getMetadata().put(key, value); } }
[ "public", "void", "setMetadata", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "getMetadata", "(", ")", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}" ]
Sets a metadata value. @param key The key. @param value The value.
[ "Sets", "a", "metadata", "value", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/Message.java#L146-L150
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/person/S2SProposalPersonServiceImpl.java
S2SProposalPersonServiceImpl.getNKeyPersons
@Override public List<ProposalPersonContract> getNKeyPersons(List<? extends ProposalPersonContract> proposalPersons, int n) { ProposalPersonContract proposalPerson, previousProposalPerson; int size = proposalPersons.size(); for (int i = size - 1; i > 0; i--) { proposalPerson = proposalPersons.get(i); previousProposalPerson = proposalPersons.get(i - 1); if (proposalPerson.getPersonId() != null && previousProposalPerson.getPersonId() != null && proposalPerson.getPersonId().equals(previousProposalPerson.getPersonId())) { proposalPersons.remove(i); } else if (proposalPerson.getRolodexId() != null && previousProposalPerson.getRolodexId() != null && proposalPerson.getRolodexId().equals(previousProposalPerson.getRolodexId())) { proposalPersons.remove(i); } } size = proposalPersons.size(); List<ProposalPersonContract> firstNPersons = new ArrayList<>(); // Make sure we don't exceed the size of the list. if (size > n) { size = n; } // remove extras for (int i = 0; i < size; i++) { firstNPersons.add(proposalPersons.get(i)); } return firstNPersons; }
java
@Override public List<ProposalPersonContract> getNKeyPersons(List<? extends ProposalPersonContract> proposalPersons, int n) { ProposalPersonContract proposalPerson, previousProposalPerson; int size = proposalPersons.size(); for (int i = size - 1; i > 0; i--) { proposalPerson = proposalPersons.get(i); previousProposalPerson = proposalPersons.get(i - 1); if (proposalPerson.getPersonId() != null && previousProposalPerson.getPersonId() != null && proposalPerson.getPersonId().equals(previousProposalPerson.getPersonId())) { proposalPersons.remove(i); } else if (proposalPerson.getRolodexId() != null && previousProposalPerson.getRolodexId() != null && proposalPerson.getRolodexId().equals(previousProposalPerson.getRolodexId())) { proposalPersons.remove(i); } } size = proposalPersons.size(); List<ProposalPersonContract> firstNPersons = new ArrayList<>(); // Make sure we don't exceed the size of the list. if (size > n) { size = n; } // remove extras for (int i = 0; i < size; i++) { firstNPersons.add(proposalPersons.get(i)); } return firstNPersons; }
[ "@", "Override", "public", "List", "<", "ProposalPersonContract", ">", "getNKeyPersons", "(", "List", "<", "?", "extends", "ProposalPersonContract", ">", "proposalPersons", ",", "int", "n", ")", "{", "ProposalPersonContract", "proposalPerson", ",", "previousProposalPe...
This method limits the number of key persons to n, returns list of key persons. @param proposalPersons list of {@link org.kuali.coeus.propdev.api.person.ProposalPersonContract} @param n number of key persons that are considered as not extra persons @return list of {@link org.kuali.coeus.propdev.api.person.ProposalPersonContract}
[ "This", "method", "limits", "the", "number", "of", "key", "persons", "to", "n", "returns", "list", "of", "key", "persons", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/person/S2SProposalPersonServiceImpl.java#L47-L77
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/person/S2SProposalPersonServiceImpl.java
S2SProposalPersonServiceImpl.getPrincipalInvestigator
@Override public ProposalPersonContract getPrincipalInvestigator(ProposalDevelopmentDocumentContract pdDoc) { ProposalPersonContract proposalPerson = null; if (pdDoc != null) { for (ProposalPersonContract person : pdDoc.getDevelopmentProposal().getProposalPersons()) { if (person.isPrincipalInvestigator()) { proposalPerson = person; } } } return proposalPerson; }
java
@Override public ProposalPersonContract getPrincipalInvestigator(ProposalDevelopmentDocumentContract pdDoc) { ProposalPersonContract proposalPerson = null; if (pdDoc != null) { for (ProposalPersonContract person : pdDoc.getDevelopmentProposal().getProposalPersons()) { if (person.isPrincipalInvestigator()) { proposalPerson = person; } } } return proposalPerson; }
[ "@", "Override", "public", "ProposalPersonContract", "getPrincipalInvestigator", "(", "ProposalDevelopmentDocumentContract", "pdDoc", ")", "{", "ProposalPersonContract", "proposalPerson", "=", "null", ";", "if", "(", "pdDoc", "!=", "null", ")", "{", "for", "(", "Propo...
This method is to get PrincipalInvestigator from person list @param pdDoc Proposal development document. @return ProposalPerson PrincipalInvestigator for the proposal.
[ "This", "method", "is", "to", "get", "PrincipalInvestigator", "from", "person", "list" ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/person/S2SProposalPersonServiceImpl.java#L85-L96
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/person/S2SProposalPersonServiceImpl.java
S2SProposalPersonServiceImpl.getCoInvestigators
@Override public List<ProposalPersonContract> getCoInvestigators(ProposalDevelopmentDocumentContract pdDoc) { List<ProposalPersonContract> investigators = new ArrayList<>(); if (pdDoc != null) { for (ProposalPersonContract person : pdDoc.getDevelopmentProposal().getProposalPersons()) { //multi-pis are still considered co-i within S2S. if (person.isCoInvestigator() || person.isMultiplePi()) { investigators.add(person); } } } return investigators; }
java
@Override public List<ProposalPersonContract> getCoInvestigators(ProposalDevelopmentDocumentContract pdDoc) { List<ProposalPersonContract> investigators = new ArrayList<>(); if (pdDoc != null) { for (ProposalPersonContract person : pdDoc.getDevelopmentProposal().getProposalPersons()) { //multi-pis are still considered co-i within S2S. if (person.isCoInvestigator() || person.isMultiplePi()) { investigators.add(person); } } } return investigators; }
[ "@", "Override", "public", "List", "<", "ProposalPersonContract", ">", "getCoInvestigators", "(", "ProposalDevelopmentDocumentContract", "pdDoc", ")", "{", "List", "<", "ProposalPersonContract", ">", "investigators", "=", "new", "ArrayList", "<>", "(", ")", ";", "if...
Finds all the Investigators associated with the provided pdDoc.
[ "Finds", "all", "the", "Investigators", "associated", "with", "the", "provided", "pdDoc", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/person/S2SProposalPersonServiceImpl.java#L101-L113
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/person/S2SProposalPersonServiceImpl.java
S2SProposalPersonServiceImpl.getKeyPersons
@Override public List<ProposalPersonContract> getKeyPersons(ProposalDevelopmentDocumentContract pdDoc) { List<ProposalPersonContract> keyPersons = new ArrayList<>(); if (pdDoc != null) { for (ProposalPersonContract person : pdDoc.getDevelopmentProposal().getProposalPersons()) { if (person.isKeyPerson()) { keyPersons.add(person); } } } return keyPersons; }
java
@Override public List<ProposalPersonContract> getKeyPersons(ProposalDevelopmentDocumentContract pdDoc) { List<ProposalPersonContract> keyPersons = new ArrayList<>(); if (pdDoc != null) { for (ProposalPersonContract person : pdDoc.getDevelopmentProposal().getProposalPersons()) { if (person.isKeyPerson()) { keyPersons.add(person); } } } return keyPersons; }
[ "@", "Override", "public", "List", "<", "ProposalPersonContract", ">", "getKeyPersons", "(", "ProposalDevelopmentDocumentContract", "pdDoc", ")", "{", "List", "<", "ProposalPersonContract", ">", "keyPersons", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "("...
Finds all the key Person associated with the provided pdDoc.
[ "Finds", "all", "the", "key", "Person", "associated", "with", "the", "provided", "pdDoc", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/person/S2SProposalPersonServiceImpl.java#L118-L129
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/PopupDialog.java
PopupDialog.show
public static Window show(String dialog, Map<String, Object> args, boolean closable, boolean sizable, boolean show, IEventListener closeListener) { Window parent = new Window(); // Temporary parent in case materialize fails, so can cleanup. Page currentPage = ExecutionContext.getPage(); parent.setParent(currentPage); Window window = null; try { PageUtil.createPage(dialog, parent, args); window = parent.getChild(Window.class); if (window != null) { // If any top component is a window, discard temp parent window.setParent(null); BaseComponent child; while ((child = parent.getFirstChild()) != null) { child.setParent(window); } parent.destroy(); window.setParent(currentPage); } else { // Otherwise, use the temp parent as the window window = parent; } window.setClosable(closable); window.setSizable(sizable); if (show) { window.modal(closeListener); } } catch (Exception e) { if (window != null) { window.destroy(); window = null; } if (parent != null) { parent.destroy(); } DialogUtil.showError(e); log.error("Error materializing page", e); } return window; }
java
public static Window show(String dialog, Map<String, Object> args, boolean closable, boolean sizable, boolean show, IEventListener closeListener) { Window parent = new Window(); // Temporary parent in case materialize fails, so can cleanup. Page currentPage = ExecutionContext.getPage(); parent.setParent(currentPage); Window window = null; try { PageUtil.createPage(dialog, parent, args); window = parent.getChild(Window.class); if (window != null) { // If any top component is a window, discard temp parent window.setParent(null); BaseComponent child; while ((child = parent.getFirstChild()) != null) { child.setParent(window); } parent.destroy(); window.setParent(currentPage); } else { // Otherwise, use the temp parent as the window window = parent; } window.setClosable(closable); window.setSizable(sizable); if (show) { window.modal(closeListener); } } catch (Exception e) { if (window != null) { window.destroy(); window = null; } if (parent != null) { parent.destroy(); } DialogUtil.showError(e); log.error("Error materializing page", e); } return window; }
[ "public", "static", "Window", "show", "(", "String", "dialog", ",", "Map", "<", "String", ",", "Object", ">", "args", ",", "boolean", "closable", ",", "boolean", "sizable", ",", "boolean", "show", ",", "IEventListener", "closeListener", ")", "{", "Window", ...
Can be used to popup any page definition as a modal dialog. @param dialog String Page used to construct the dialog. @param args Argument list (may be null) @param closable If true, window closure button appears. @param sizable If true, window sizing grips appear. @param show If true, the window is displayed modally. If false, the window is created but not displayed. @param closeListener Called upon window closure. @return Reference to the opened window, if successful.
[ "Can", "be", "used", "to", "popup", "any", "page", "definition", "as", "a", "modal", "dialog", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/PopupDialog.java#L61-L107
train
SpartaTech/sparta-spring-web-utils
src/main/java/org/sparta/springwebutils/queryloader/impl/FileQueryLoader.java
FileQueryLoader.loadfromFromFile
private String loadfromFromFile(String queryName) throws IllegalStateException { try (final InputStream is = getClass().getResourceAsStream(scriptsFolder + queryName + ".sql");) { String sql = StringUtils.join(IOUtils.readLines(is, StandardCharsets.UTF_8), IOUtils.LINE_SEPARATOR); // Look for tokens final String[] tokens = StringUtils.substringsBetween(sql, "${", "}"); if (tokens != null && tokens.length > 0) { final Map<String, String> values = Arrays.stream(tokens).collect(Collectors.toMap( Function.identity(), this::load, (o, n) -> o )); sql = StrSubstitutor.replace(sql, values); } return sql; } catch (Exception e) { throw new IllegalStateException("Could not load query " + scriptsFolder + queryName, e); } }
java
private String loadfromFromFile(String queryName) throws IllegalStateException { try (final InputStream is = getClass().getResourceAsStream(scriptsFolder + queryName + ".sql");) { String sql = StringUtils.join(IOUtils.readLines(is, StandardCharsets.UTF_8), IOUtils.LINE_SEPARATOR); // Look for tokens final String[] tokens = StringUtils.substringsBetween(sql, "${", "}"); if (tokens != null && tokens.length > 0) { final Map<String, String> values = Arrays.stream(tokens).collect(Collectors.toMap( Function.identity(), this::load, (o, n) -> o )); sql = StrSubstitutor.replace(sql, values); } return sql; } catch (Exception e) { throw new IllegalStateException("Could not load query " + scriptsFolder + queryName, e); } }
[ "private", "String", "loadfromFromFile", "(", "String", "queryName", ")", "throws", "IllegalStateException", "{", "try", "(", "final", "InputStream", "is", "=", "getClass", "(", ")", ".", "getResourceAsStream", "(", "scriptsFolder", "+", "queryName", "+", "\".sql\...
Loads the query from the informed path and adds to cache @param queryName File name for the query to be loaded @return requested Query @throws IllegalStateException In case query was not found
[ "Loads", "the", "query", "from", "the", "informed", "path", "and", "adds", "to", "cache" ]
f5382474d46a6048d58707fc64e7936277e8b2ce
https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/queryloader/impl/FileQueryLoader.java#L82-L102
train
intel/jndn-utils
src/main/java/com/intel/jndn/utils/pubsub/NdnPublisher.java
NdnPublisher.open
synchronized void open() throws IOException { if (opened) { return; } opened = true; CompletableFuture<Void> future = new CompletableFuture<>(); OnRegistration onRegistration = new OnRegistration(future); try { registrationId = face.registerPrefix(prefix, this, (OnRegisterFailed) onRegistration, onRegistration); // assumes face.processEvents is driven concurrently elsewhere future.get(10, TimeUnit.SECONDS); announcementService.announceEntrance(publisherId); } catch (IOException | SecurityException | InterruptedException | ExecutionException | TimeoutException e) { throw new IOException("Failed to register NDN prefix; pub-sub IO will be impossible", e); } }
java
synchronized void open() throws IOException { if (opened) { return; } opened = true; CompletableFuture<Void> future = new CompletableFuture<>(); OnRegistration onRegistration = new OnRegistration(future); try { registrationId = face.registerPrefix(prefix, this, (OnRegisterFailed) onRegistration, onRegistration); // assumes face.processEvents is driven concurrently elsewhere future.get(10, TimeUnit.SECONDS); announcementService.announceEntrance(publisherId); } catch (IOException | SecurityException | InterruptedException | ExecutionException | TimeoutException e) { throw new IOException("Failed to register NDN prefix; pub-sub IO will be impossible", e); } }
[ "synchronized", "void", "open", "(", ")", "throws", "IOException", "{", "if", "(", "opened", ")", "{", "return", ";", "}", "opened", "=", "true", ";", "CompletableFuture", "<", "Void", ">", "future", "=", "new", "CompletableFuture", "<>", "(", ")", ";", ...
Open the publisher, registering prefixes and announcing group entry. If the publisher is already open, this method immediately returns @throws IOException if prefix registration or group announcement fails
[ "Open", "the", "publisher", "registering", "prefixes", "and", "announcing", "group", "entry", ".", "If", "the", "publisher", "is", "already", "open", "this", "method", "immediately", "returns" ]
7f670b259484c35d51a6c5acce5715b0573faedd
https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/pubsub/NdnPublisher.java#L87-L104
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/DomainPropertySource.java
DomainPropertySource.initPropertyService
private boolean initPropertyService() { if (propertyService == null && appContext.containsBean("propertyService")) { propertyService = appContext.getBean("propertyService", IPropertyService.class); } return propertyService != null; }
java
private boolean initPropertyService() { if (propertyService == null && appContext.containsBean("propertyService")) { propertyService = appContext.getBean("propertyService", IPropertyService.class); } return propertyService != null; }
[ "private", "boolean", "initPropertyService", "(", ")", "{", "if", "(", "propertyService", "==", "null", "&&", "appContext", ".", "containsBean", "(", "\"propertyService\"", ")", ")", "{", "propertyService", "=", "appContext", ".", "getBean", "(", "\"propertyServic...
Initializes the property service. @return True if initialized.
[ "Initializes", "the", "property", "service", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/DomainPropertySource.java#L80-L86
train
wcm-io-caravan/caravan-commons
stream/src/main/java/io/wcm/caravan/commons/stream/Streams.java
Streams.of
public static <T> Stream<T> of(Iterable<T> iterable) { checkNotNull(iterable); return new StreamImpl<T>(iterable); }
java
public static <T> Stream<T> of(Iterable<T> iterable) { checkNotNull(iterable); return new StreamImpl<T>(iterable); }
[ "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "of", "(", "Iterable", "<", "T", ">", "iterable", ")", "{", "checkNotNull", "(", "iterable", ")", ";", "return", "new", "StreamImpl", "<", "T", ">", "(", "iterable", ")", ";", "}" ]
Creates a stream from an iterable. @param iterable Iterable @param <T> Type to stream @return Stream
[ "Creates", "a", "stream", "from", "an", "iterable", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/stream/src/main/java/io/wcm/caravan/commons/stream/Streams.java#L48-L51
train
wcm-io-caravan/caravan-commons
stream/src/main/java/io/wcm/caravan/commons/stream/Streams.java
Streams.of
@SafeVarargs public static <T> Stream<T> of(T... items) { checkNotNull(items); return new StreamImpl<T>(Arrays.asList(items)); }
java
@SafeVarargs public static <T> Stream<T> of(T... items) { checkNotNull(items); return new StreamImpl<T>(Arrays.asList(items)); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "of", "(", "T", "...", "items", ")", "{", "checkNotNull", "(", "items", ")", ";", "return", "new", "StreamImpl", "<", "T", ">", "(", "Arrays", ".", "asList", "(", "item...
Creates a stream from items. @param items Stream items or array @param <T> Type to stream @return Stream
[ "Creates", "a", "stream", "from", "items", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/stream/src/main/java/io/wcm/caravan/commons/stream/Streams.java#L59-L63
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.parseResource
public static Layout parseResource(String resource) { int i = resource.indexOf(":"); if (i > 0) { String loaderId = resource.substring(0, i); ILayoutLoader layoutLoader = LayoutLoaderRegistry.getInstance().get(loaderId); if (layoutLoader != null) { String name = resource.substring(i + 1); return layoutLoader.loadLayout(name); } } InputStream strm = ExecutionContext.getSession().getServletContext().getResourceAsStream(resource); if (strm == null) { throw new CWFException("Unable to locate layout resource: " + resource); } return parseStream(strm); }
java
public static Layout parseResource(String resource) { int i = resource.indexOf(":"); if (i > 0) { String loaderId = resource.substring(0, i); ILayoutLoader layoutLoader = LayoutLoaderRegistry.getInstance().get(loaderId); if (layoutLoader != null) { String name = resource.substring(i + 1); return layoutLoader.loadLayout(name); } } InputStream strm = ExecutionContext.getSession().getServletContext().getResourceAsStream(resource); if (strm == null) { throw new CWFException("Unable to locate layout resource: " + resource); } return parseStream(strm); }
[ "public", "static", "Layout", "parseResource", "(", "String", "resource", ")", "{", "int", "i", "=", "resource", ".", "indexOf", "(", "\":\"", ")", ";", "if", "(", "i", ">", "0", ")", "{", "String", "loaderId", "=", "resource", ".", "substring", "(", ...
Loads a layout from the specified resource, using a registered layout loader or, failing that, using the default loadFromUrl method. @param resource The resource to be loaded. @return The loaded layout.
[ "Loads", "a", "layout", "from", "the", "specified", "resource", "using", "a", "registered", "layout", "loader", "or", "failing", "that", "using", "the", "default", "loadFromUrl", "method", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L74-L94
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.parseText
public static Layout parseText(String xml) { try { return parseDocument(XMLUtil.parseXMLFromString(xml)); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
java
public static Layout parseText(String xml) { try { return parseDocument(XMLUtil.parseXMLFromString(xml)); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
[ "public", "static", "Layout", "parseText", "(", "String", "xml", ")", "{", "try", "{", "return", "parseDocument", "(", "XMLUtil", ".", "parseXMLFromString", "(", "xml", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "MiscUtil", "....
Parse the layout from XML content. @param xml The XML content to parse. @return The root layout element.
[ "Parse", "the", "layout", "from", "XML", "content", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L102-L108
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.parseStream
public static Layout parseStream(InputStream stream) { try (InputStream is = stream) { return parseDocument(XMLUtil.parseXMLFromStream(is)); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
java
public static Layout parseStream(InputStream stream) { try (InputStream is = stream) { return parseDocument(XMLUtil.parseXMLFromStream(is)); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
[ "public", "static", "Layout", "parseStream", "(", "InputStream", "stream", ")", "{", "try", "(", "InputStream", "is", "=", "stream", ")", "{", "return", "parseDocument", "(", "XMLUtil", ".", "parseXMLFromStream", "(", "is", ")", ")", ";", "}", "catch", "("...
Parse layout from an input stream. @param stream The input stream. @return The root layout element.
[ "Parse", "layout", "from", "an", "input", "stream", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L116-L122
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.parseDocument
public static Layout parseDocument(Document document) { return new Layout(instance.parseChildren(document, null, Tag.LAYOUT)); }
java
public static Layout parseDocument(Document document) { return new Layout(instance.parseChildren(document, null, Tag.LAYOUT)); }
[ "public", "static", "Layout", "parseDocument", "(", "Document", "document", ")", "{", "return", "new", "Layout", "(", "instance", ".", "parseChildren", "(", "document", ",", "null", ",", "Tag", ".", "LAYOUT", ")", ")", ";", "}" ]
Parse the layout from an XML document. @param document An XML document. @return The root layout element.
[ "Parse", "the", "layout", "from", "an", "XML", "document", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L150-L152
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.parseElement
private LayoutElement parseElement(Element node, LayoutElement parent) { LayoutElement layoutElement = newLayoutElement(node, parent, null); parseChildren(node, layoutElement, Tag.ELEMENT, Tag.TRIGGER); return layoutElement; }
java
private LayoutElement parseElement(Element node, LayoutElement parent) { LayoutElement layoutElement = newLayoutElement(node, parent, null); parseChildren(node, layoutElement, Tag.ELEMENT, Tag.TRIGGER); return layoutElement; }
[ "private", "LayoutElement", "parseElement", "(", "Element", "node", ",", "LayoutElement", "parent", ")", "{", "LayoutElement", "layoutElement", "=", "newLayoutElement", "(", "node", ",", "parent", ",", "null", ")", ";", "parseChildren", "(", "node", ",", "layout...
Parse a layout element node. @param node The DOM node. @param parent The parent layout element. @return The newly created layout element.
[ "Parse", "a", "layout", "element", "node", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L273-L277
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.getRequiredAttribute
private String getRequiredAttribute(Element node, String name) { String value = node.getAttribute(name); if (value.isEmpty()) { throw new IllegalArgumentException("Missing " + name + " attribute on node: " + node.getTagName()); } return value; }
java
private String getRequiredAttribute(Element node, String name) { String value = node.getAttribute(name); if (value.isEmpty()) { throw new IllegalArgumentException("Missing " + name + " attribute on node: " + node.getTagName()); } return value; }
[ "private", "String", "getRequiredAttribute", "(", "Element", "node", ",", "String", "name", ")", "{", "String", "value", "=", "node", ".", "getAttribute", "(", "name", ")", ";", "if", "(", "value", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "I...
Returns the value of the named attribute from a DOM node, throwing an exception if not found. @param node The DOM node. @param name The attribute name. @return The attribute value.
[ "Returns", "the", "value", "of", "the", "named", "attribute", "from", "a", "DOM", "node", "throwing", "an", "exception", "if", "not", "found", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L286-L294
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.parseTrigger
private void parseTrigger(Element node, LayoutElement parent) { LayoutTrigger trigger = new LayoutTrigger(); parent.getTriggers().add(trigger); parseChildren(node, trigger, Tag.CONDITION, Tag.ACTION); }
java
private void parseTrigger(Element node, LayoutElement parent) { LayoutTrigger trigger = new LayoutTrigger(); parent.getTriggers().add(trigger); parseChildren(node, trigger, Tag.CONDITION, Tag.ACTION); }
[ "private", "void", "parseTrigger", "(", "Element", "node", ",", "LayoutElement", "parent", ")", "{", "LayoutTrigger", "trigger", "=", "new", "LayoutTrigger", "(", ")", ";", "parent", ".", "getTriggers", "(", ")", ".", "add", "(", "trigger", ")", ";", "pars...
Parse a trigger node. @param node The DOM node. @param parent The parent layout element.
[ "Parse", "a", "trigger", "node", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L302-L306
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.parseCondition
private void parseCondition(Element node, LayoutTrigger parent) { new LayoutTriggerCondition(parent, getDefinition(null, node)); }
java
private void parseCondition(Element node, LayoutTrigger parent) { new LayoutTriggerCondition(parent, getDefinition(null, node)); }
[ "private", "void", "parseCondition", "(", "Element", "node", ",", "LayoutTrigger", "parent", ")", "{", "new", "LayoutTriggerCondition", "(", "parent", ",", "getDefinition", "(", "null", ",", "node", ")", ")", ";", "}" ]
Parse a trigger condition node. @param node The DOM node. @param parent The parent layout trigger.
[ "Parse", "a", "trigger", "condition", "node", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L314-L316
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.parseAction
private void parseAction(Element node, LayoutTrigger parent) { new LayoutTriggerAction(parent, getDefinition(null, node)); }
java
private void parseAction(Element node, LayoutTrigger parent) { new LayoutTriggerAction(parent, getDefinition(null, node)); }
[ "private", "void", "parseAction", "(", "Element", "node", ",", "LayoutTrigger", "parent", ")", "{", "new", "LayoutTriggerAction", "(", "parent", ",", "getDefinition", "(", "null", ",", "node", ")", ")", ";", "}" ]
Parse a trigger action node. @param node The DOM node. @param parent The parent layout trigger.
[ "Parse", "a", "trigger", "action", "node", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L324-L326
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.getTag
private Tag getTag(Element node, Tag... tags) { String name = node.getTagName(); String error = null; try { Tag tag = Tag.valueOf(name.toUpperCase()); int i = ArrayUtils.indexOf(tags, tag); if (i < 0) { error = "Tag '%s' is not valid at this location"; } else { if (!tag.allowMultiple) { tags[i] = null; } return tag; } } catch (IllegalArgumentException e) { error = "Unrecognized tag '%s' in layout"; } throw new IllegalArgumentException(getInvalidTagError(error, name, tags)); }
java
private Tag getTag(Element node, Tag... tags) { String name = node.getTagName(); String error = null; try { Tag tag = Tag.valueOf(name.toUpperCase()); int i = ArrayUtils.indexOf(tags, tag); if (i < 0) { error = "Tag '%s' is not valid at this location"; } else { if (!tag.allowMultiple) { tags[i] = null; } return tag; } } catch (IllegalArgumentException e) { error = "Unrecognized tag '%s' in layout"; } throw new IllegalArgumentException(getInvalidTagError(error, name, tags)); }
[ "private", "Tag", "getTag", "(", "Element", "node", ",", "Tag", "...", "tags", ")", "{", "String", "name", "=", "node", ".", "getTagName", "(", ")", ";", "String", "error", "=", "null", ";", "try", "{", "Tag", "tag", "=", "Tag", ".", "valueOf", "("...
Return and validate the tag type, throwing an exception if the tag is unknown or among the allowable types. @param node The DOM node. @param tags The allowable tag types. @return The tag type.
[ "Return", "and", "validate", "the", "tag", "type", "throwing", "an", "exception", "if", "the", "tag", "is", "unknown", "or", "among", "the", "allowable", "types", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L336-L358
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.parseUI
private LayoutRoot parseUI(ElementBase root) { LayoutRoot ele = new LayoutRoot(); if (root instanceof ElementDesktop) { copyAttributes(root, ele); } parseChildren(root, ele); return ele; }
java
private LayoutRoot parseUI(ElementBase root) { LayoutRoot ele = new LayoutRoot(); if (root instanceof ElementDesktop) { copyAttributes(root, ele); } parseChildren(root, ele); return ele; }
[ "private", "LayoutRoot", "parseUI", "(", "ElementBase", "root", ")", "{", "LayoutRoot", "ele", "=", "new", "LayoutRoot", "(", ")", ";", "if", "(", "root", "instanceof", "ElementDesktop", ")", "{", "copyAttributes", "(", "root", ",", "ele", ")", ";", "}", ...
Parse the layout from the UI element tree. @param root The root of the UI element tree. @return The root layout element.
[ "Parse", "the", "layout", "from", "the", "UI", "element", "tree", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L382-L391
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.copyAttributes
private void copyAttributes(ElementBase src, LayoutElement dest) { for (PropertyInfo propInfo : src.getDefinition().getProperties()) { Object value = propInfo.isSerializable() ? propInfo.getPropertyValue(src) : null; String val = value == null ? null : propInfo.getPropertyType().getSerializer().serialize(value); if (!ObjectUtils.equals(value, propInfo.getDefault())) { dest.getAttributes().put(propInfo.getId(), val); } } }
java
private void copyAttributes(ElementBase src, LayoutElement dest) { for (PropertyInfo propInfo : src.getDefinition().getProperties()) { Object value = propInfo.isSerializable() ? propInfo.getPropertyValue(src) : null; String val = value == null ? null : propInfo.getPropertyType().getSerializer().serialize(value); if (!ObjectUtils.equals(value, propInfo.getDefault())) { dest.getAttributes().put(propInfo.getId(), val); } } }
[ "private", "void", "copyAttributes", "(", "ElementBase", "src", ",", "LayoutElement", "dest", ")", "{", "for", "(", "PropertyInfo", "propInfo", ":", "src", ".", "getDefinition", "(", ")", ".", "getProperties", "(", ")", ")", "{", "Object", "value", "=", "p...
Copy attributes from a UI element to layout element. @param src UI element. @param dest Layout element.
[ "Copy", "attributes", "from", "a", "UI", "element", "to", "layout", "element", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L407-L416
train
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/util/IOUtil.java
IOUtil.readContent
public static String readContent( File file ) throws IOException { Reader input = null; try { input = new FileReader( file ); return readContent( input ); } finally { closeQuietly( input ); } }
java
public static String readContent( File file ) throws IOException { Reader input = null; try { input = new FileReader( file ); return readContent( input ); } finally { closeQuietly( input ); } }
[ "public", "static", "String", "readContent", "(", "File", "file", ")", "throws", "IOException", "{", "Reader", "input", "=", "null", ";", "try", "{", "input", "=", "new", "FileReader", "(", "file", ")", ";", "return", "readContent", "(", "input", ")", ";...
Returns the content of a file as a String. @param file a {@link java.io.File} object. @return a {@link java.lang.String} object. @throws java.io.IOException if any.
[ "Returns", "the", "content", "of", "a", "file", "as", "a", "String", "." ]
2a61e6c179b74085babcc559d677490b0cad2d30
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/IOUtil.java#L63-L75
train
wcm-io-caravan/caravan-commons
performance/src/main/java/io/wcm/caravan/common/performance/PerformanceLogger.java
PerformanceLogger.log
public static void log(Marker marker, PerformanceMetrics metrics) { if (log.isDebugEnabled()) { log.debug(marker, getEndMetrics(metrics)); } }
java
public static void log(Marker marker, PerformanceMetrics metrics) { if (log.isDebugEnabled()) { log.debug(marker, getEndMetrics(metrics)); } }
[ "public", "static", "void", "log", "(", "Marker", "marker", ",", "PerformanceMetrics", "metrics", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "marker", ",", "getEndMetrics", "(", "metrics", ")", ")", ...
Log line of measured performance of single operation specifying by performance metrics parameter. @param marker log marker @param metrics PerformanceMetrics a result of measurement
[ "Log", "line", "of", "measured", "performance", "of", "single", "operation", "specifying", "by", "performance", "metrics", "parameter", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/performance/src/main/java/io/wcm/caravan/common/performance/PerformanceLogger.java#L51-L55
train