id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
151,400
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseListener.java
BaseListener.getNextEnabledListener
public BaseListener getNextEnabledListener() { if (m_nextListener == null) return null; if (m_nextListener.isEnabled()) return m_nextListener; else return m_nextListener.getNextEnabledListener(); }
java
public BaseListener getNextEnabledListener() { if (m_nextListener == null) return null; if (m_nextListener.isEnabled()) return m_nextListener; else return m_nextListener.getNextEnabledListener(); }
[ "public", "BaseListener", "getNextEnabledListener", "(", ")", "{", "if", "(", "m_nextListener", "==", "null", ")", "return", "null", ";", "if", "(", "m_nextListener", ".", "isEnabled", "(", ")", ")", "return", "m_nextListener", ";", "else", "return", "m_nextListener", ".", "getNextEnabledListener", "(", ")", ";", "}" ]
Get then next enabled listener in the chain. @return The next enabled listener (of null if none).
[ "Get", "then", "next", "enabled", "listener", "in", "the", "chain", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseListener.java#L242-L250
151,401
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDL.java
GetWSDL.getFullPath
public String getFullPath(String strSite, String strPath) { if (strSite != null) { if (strPath != null) if (strPath.startsWith("/")) strPath = strSite + strPath; } return strPath; }
java
public String getFullPath(String strSite, String strPath) { if (strSite != null) { if (strPath != null) if (strPath.startsWith("/")) strPath = strSite + strPath; } return strPath; }
[ "public", "String", "getFullPath", "(", "String", "strSite", ",", "String", "strPath", ")", "{", "if", "(", "strSite", "!=", "null", ")", "{", "if", "(", "strPath", "!=", "null", ")", "if", "(", "strPath", ".", "startsWith", "(", "\"/\"", ")", ")", "strPath", "=", "strSite", "+", "strPath", ";", "}", "return", "strPath", ";", "}" ]
GetFullPath Method.
[ "GetFullPath", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDL.java#L164-L173
151,402
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/shared/SharedBaseRecordTable.java
SharedBaseRecordTable.moveToCurrentRecord
public Record moveToCurrentRecord(Record recBase) { if (recBase == null) recBase = this.getBaseRecord(); // Actually, should always be the recBase. BaseField fldRecordType = recBase.getSharedRecordTypeKey(); Object objKey = fldRecordType.getData(); BaseTable tableCurrent = this.getTableAt(objKey); Record recCurrent = null; if (tableCurrent != null) recCurrent = tableCurrent.getRecord(); if (recCurrent == null) { RecordOwner recordOwner = recBase.getRecordOwner(); RecordOwner recordOwnerFake = this.getFakeRecordOwner(recordOwner); recCurrent = recBase.createSharedRecord(objKey, recordOwnerFake); if (recCurrent != null) if (recCurrent.getRecordOwner() == recordOwnerFake) { // Usually recCurrent.setRecordOwner(recordOwner); // No record owner // Add this table (but do not use this.addTable because it closes the next table) this.addTable(objKey, recCurrent.getTable()); recCurrent.setOpenMode(recBase.getOpenMode()); // Same mode. recBase.matchListeners(recCurrent, true, true, true, true, true); // Clone the listeners that are not there already. } } if (recCurrent != null) if (recCurrent != recBase) { this.copyRecordInfo(recCurrent, recBase, true, false); } if (recCurrent != null) this.setCurrentRecord(recCurrent); return recCurrent; }
java
public Record moveToCurrentRecord(Record recBase) { if (recBase == null) recBase = this.getBaseRecord(); // Actually, should always be the recBase. BaseField fldRecordType = recBase.getSharedRecordTypeKey(); Object objKey = fldRecordType.getData(); BaseTable tableCurrent = this.getTableAt(objKey); Record recCurrent = null; if (tableCurrent != null) recCurrent = tableCurrent.getRecord(); if (recCurrent == null) { RecordOwner recordOwner = recBase.getRecordOwner(); RecordOwner recordOwnerFake = this.getFakeRecordOwner(recordOwner); recCurrent = recBase.createSharedRecord(objKey, recordOwnerFake); if (recCurrent != null) if (recCurrent.getRecordOwner() == recordOwnerFake) { // Usually recCurrent.setRecordOwner(recordOwner); // No record owner // Add this table (but do not use this.addTable because it closes the next table) this.addTable(objKey, recCurrent.getTable()); recCurrent.setOpenMode(recBase.getOpenMode()); // Same mode. recBase.matchListeners(recCurrent, true, true, true, true, true); // Clone the listeners that are not there already. } } if (recCurrent != null) if (recCurrent != recBase) { this.copyRecordInfo(recCurrent, recBase, true, false); } if (recCurrent != null) this.setCurrentRecord(recCurrent); return recCurrent; }
[ "public", "Record", "moveToCurrentRecord", "(", "Record", "recBase", ")", "{", "if", "(", "recBase", "==", "null", ")", "recBase", "=", "this", ".", "getBaseRecord", "(", ")", ";", "// Actually, should always be the recBase.", "BaseField", "fldRecordType", "=", "recBase", ".", "getSharedRecordTypeKey", "(", ")", ";", "Object", "objKey", "=", "fldRecordType", ".", "getData", "(", ")", ";", "BaseTable", "tableCurrent", "=", "this", ".", "getTableAt", "(", "objKey", ")", ";", "Record", "recCurrent", "=", "null", ";", "if", "(", "tableCurrent", "!=", "null", ")", "recCurrent", "=", "tableCurrent", ".", "getRecord", "(", ")", ";", "if", "(", "recCurrent", "==", "null", ")", "{", "RecordOwner", "recordOwner", "=", "recBase", ".", "getRecordOwner", "(", ")", ";", "RecordOwner", "recordOwnerFake", "=", "this", ".", "getFakeRecordOwner", "(", "recordOwner", ")", ";", "recCurrent", "=", "recBase", ".", "createSharedRecord", "(", "objKey", ",", "recordOwnerFake", ")", ";", "if", "(", "recCurrent", "!=", "null", ")", "if", "(", "recCurrent", ".", "getRecordOwner", "(", ")", "==", "recordOwnerFake", ")", "{", "// Usually", "recCurrent", ".", "setRecordOwner", "(", "recordOwner", ")", ";", "// No record owner", "// Add this table (but do not use this.addTable because it closes the next table)", "this", ".", "addTable", "(", "objKey", ",", "recCurrent", ".", "getTable", "(", ")", ")", ";", "recCurrent", ".", "setOpenMode", "(", "recBase", ".", "getOpenMode", "(", ")", ")", ";", "// Same mode.", "recBase", ".", "matchListeners", "(", "recCurrent", ",", "true", ",", "true", ",", "true", ",", "true", ",", "true", ")", ";", "// Clone the listeners that are not there already.", "}", "}", "if", "(", "recCurrent", "!=", "null", ")", "if", "(", "recCurrent", "!=", "recBase", ")", "{", "this", ".", "copyRecordInfo", "(", "recCurrent", ",", "recBase", ",", "true", ",", "false", ")", ";", "}", "if", "(", "recCurrent", "!=", "null", ")", "this", ".", "setCurrentRecord", "(", "recCurrent", ")", ";", "return", "recCurrent", ";", "}" ]
Figure what kind of record this record is and move it to the correct record. @record The record to move to current.
[ "Figure", "what", "kind", "of", "record", "this", "record", "is", "and", "move", "it", "to", "the", "correct", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/shared/SharedBaseRecordTable.java#L393-L426
151,403
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/shared/SharedBaseRecordTable.java
SharedBaseRecordTable.copyRecordInfo
public void copyRecordInfo(Record recDest, Record recSource, boolean bCopyEditMode, boolean bOnlyModifiedFields) { if (recDest == null) recDest = this.getCurrentRecord(); if (recDest != recSource) { boolean bAllowFieldChange = false; // This will disable field behaviors on move boolean bMoveModifiedState = true; // This will move the modified status to the new field Object[] rgobjEnabledFieldsOld = recSource.setEnableFieldListeners(false); recDest.moveFields(recSource, null, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE, bAllowFieldChange, bOnlyModifiedFields, bMoveModifiedState, false); recSource.setEnableFieldListeners(rgobjEnabledFieldsOld); if (bCopyEditMode) recDest.setEditMode(recSource.getEditMode()); // Okay? } }
java
public void copyRecordInfo(Record recDest, Record recSource, boolean bCopyEditMode, boolean bOnlyModifiedFields) { if (recDest == null) recDest = this.getCurrentRecord(); if (recDest != recSource) { boolean bAllowFieldChange = false; // This will disable field behaviors on move boolean bMoveModifiedState = true; // This will move the modified status to the new field Object[] rgobjEnabledFieldsOld = recSource.setEnableFieldListeners(false); recDest.moveFields(recSource, null, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE, bAllowFieldChange, bOnlyModifiedFields, bMoveModifiedState, false); recSource.setEnableFieldListeners(rgobjEnabledFieldsOld); if (bCopyEditMode) recDest.setEditMode(recSource.getEditMode()); // Okay? } }
[ "public", "void", "copyRecordInfo", "(", "Record", "recDest", ",", "Record", "recSource", ",", "boolean", "bCopyEditMode", ",", "boolean", "bOnlyModifiedFields", ")", "{", "if", "(", "recDest", "==", "null", ")", "recDest", "=", "this", ".", "getCurrentRecord", "(", ")", ";", "if", "(", "recDest", "!=", "recSource", ")", "{", "boolean", "bAllowFieldChange", "=", "false", ";", "// This will disable field behaviors on move", "boolean", "bMoveModifiedState", "=", "true", ";", "// This will move the modified status to the new field", "Object", "[", "]", "rgobjEnabledFieldsOld", "=", "recSource", ".", "setEnableFieldListeners", "(", "false", ")", ";", "recDest", ".", "moveFields", "(", "recSource", ",", "null", ",", "DBConstants", ".", "DONT_DISPLAY", ",", "DBConstants", ".", "READ_MOVE", ",", "bAllowFieldChange", ",", "bOnlyModifiedFields", ",", "bMoveModifiedState", ",", "false", ")", ";", "recSource", ".", "setEnableFieldListeners", "(", "rgobjEnabledFieldsOld", ")", ";", "if", "(", "bCopyEditMode", ")", "recDest", ".", "setEditMode", "(", "recSource", ".", "getEditMode", "(", ")", ")", ";", "// Okay?", "}", "}" ]
Set the current table target. @param table The new current table.
[ "Set", "the", "current", "table", "target", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/shared/SharedBaseRecordTable.java#L431-L445
151,404
nwillc/almost-functional
src/main/java/almost/functional/Optional.java
Optional.of
public static <T> Optional<T> of(final T optionalValue) { //NOPMD checkNotNull(optionalValue, "Optional value may not be null in method of"); return new Optional<T>(optionalValue); }
java
public static <T> Optional<T> of(final T optionalValue) { //NOPMD checkNotNull(optionalValue, "Optional value may not be null in method of"); return new Optional<T>(optionalValue); }
[ "public", "static", "<", "T", ">", "Optional", "<", "T", ">", "of", "(", "final", "T", "optionalValue", ")", "{", "//NOPMD", "checkNotNull", "(", "optionalValue", ",", "\"Optional value may not be null in method of\"", ")", ";", "return", "new", "Optional", "<", "T", ">", "(", "optionalValue", ")", ";", "}" ]
Returns an Optional with the specified present non-null value. @param <T> the class of the value @param optionalValue the value to be present, which must be non-null @return an Optional with the value present
[ "Returns", "an", "Optional", "with", "the", "specified", "present", "non", "-", "null", "value", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/Optional.java#L68-L71
151,405
nwillc/almost-functional
src/main/java/almost/functional/Optional.java
Optional.filter
public Optional<T> filter(final Predicate<? super T> predicate) { if (isPresent() && predicate.test(get())) { return this; } return empty(); }
java
public Optional<T> filter(final Predicate<? super T> predicate) { if (isPresent() && predicate.test(get())) { return this; } return empty(); }
[ "public", "Optional", "<", "T", ">", "filter", "(", "final", "Predicate", "<", "?", "super", "T", ">", "predicate", ")", "{", "if", "(", "isPresent", "(", ")", "&&", "predicate", ".", "test", "(", "get", "(", ")", ")", ")", "{", "return", "this", ";", "}", "return", "empty", "(", ")", ";", "}" ]
Apply a predicate to the optional, if the optional is present, and the predicate is true, return the optional, otherwise return empty. @param predicate the predicate to apply @return the optional if the predicate is true, empty if not @since 1.7
[ "Apply", "a", "predicate", "to", "the", "optional", "if", "the", "optional", "is", "present", "and", "the", "predicate", "is", "true", "return", "the", "optional", "otherwise", "return", "empty", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/Optional.java#L96-L102
151,406
nwillc/almost-functional
src/main/java/almost/functional/Optional.java
Optional.ifPresent
public Optional<T> ifPresent(final Consumer<? super T> consumer) { if (isPresent()) { consumer.accept(get()); } return this; }
java
public Optional<T> ifPresent(final Consumer<? super T> consumer) { if (isPresent()) { consumer.accept(get()); } return this; }
[ "public", "Optional", "<", "T", ">", "ifPresent", "(", "final", "Consumer", "<", "?", "super", "T", ">", "consumer", ")", "{", "if", "(", "isPresent", "(", ")", ")", "{", "consumer", ".", "accept", "(", "get", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
If a value is present, invoke the specified consumer with the value, otherwise do nothing. @param consumer consumer to be invoked if present. @return this Optional @since 1.7.8
[ "If", "a", "value", "is", "present", "invoke", "the", "specified", "consumer", "with", "the", "value", "otherwise", "do", "nothing", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/Optional.java#L133-L139
151,407
nwillc/almost-functional
src/main/java/almost/functional/Optional.java
Optional.orElseSupplier
public T orElseSupplier(final Supplier<T> other) { checkNotNull(other, "orElse requires a non null supplier"); if (isPresent()) { return get(); } return other.get(); }
java
public T orElseSupplier(final Supplier<T> other) { checkNotNull(other, "orElse requires a non null supplier"); if (isPresent()) { return get(); } return other.get(); }
[ "public", "T", "orElseSupplier", "(", "final", "Supplier", "<", "T", ">", "other", ")", "{", "checkNotNull", "(", "other", ",", "\"orElse requires a non null supplier\"", ")", ";", "if", "(", "isPresent", "(", ")", ")", "{", "return", "get", "(", ")", ";", "}", "return", "other", ".", "get", "(", ")", ";", "}" ]
Return the value if present, otherwise get the value from the Supplier. @param other a Supplier @return the value, if present, or the return of the Supplier @since 1.7
[ "Return", "the", "value", "if", "present", "otherwise", "get", "the", "value", "from", "the", "Supplier", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/Optional.java#L176-L182
151,408
nwillc/almost-functional
src/main/java/almost/functional/Optional.java
Optional.orElseThrow
public T orElseThrow(final String msg) { checkNonEmptyString(msg, "Valid message required"); if (isPresent()) { return get(); } throw new NoSuchElementException(msg); }
java
public T orElseThrow(final String msg) { checkNonEmptyString(msg, "Valid message required"); if (isPresent()) { return get(); } throw new NoSuchElementException(msg); }
[ "public", "T", "orElseThrow", "(", "final", "String", "msg", ")", "{", "checkNonEmptyString", "(", "msg", ",", "\"Valid message required\"", ")", ";", "if", "(", "isPresent", "(", ")", ")", "{", "return", "get", "(", ")", ";", "}", "throw", "new", "NoSuchElementException", "(", "msg", ")", ";", "}" ]
If optional is not empty return it's value, if empty throw a NoSuchElementException with message. @param msg message for exception @return optional value if present @throws java.util.NoSuchElementException thrown if optional is empty @since 1.7.3
[ "If", "optional", "is", "not", "empty", "return", "it", "s", "value", "if", "empty", "throw", "a", "NoSuchElementException", "with", "message", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/Optional.java#L192-L199
151,409
nwillc/almost-functional
src/main/java/almost/functional/Optional.java
Optional.map
public <V> Optional<V> map(final Function<T, V> function) { checkNotNull(function, "Must provide non null function to map"); if (isPresent()) { final V applied = function.apply(get()); return applied == null ? Optional.<V>empty() : Optional.of(function.apply(get())); } else { return Optional.empty(); } }
java
public <V> Optional<V> map(final Function<T, V> function) { checkNotNull(function, "Must provide non null function to map"); if (isPresent()) { final V applied = function.apply(get()); return applied == null ? Optional.<V>empty() : Optional.of(function.apply(get())); } else { return Optional.empty(); } }
[ "public", "<", "V", ">", "Optional", "<", "V", ">", "map", "(", "final", "Function", "<", "T", ",", "V", ">", "function", ")", "{", "checkNotNull", "(", "function", ",", "\"Must provide non null function to map\"", ")", ";", "if", "(", "isPresent", "(", ")", ")", "{", "final", "V", "applied", "=", "function", ".", "apply", "(", "get", "(", ")", ")", ";", "return", "applied", "==", "null", "?", "Optional", ".", "<", "V", ">", "empty", "(", ")", ":", "Optional", ".", "of", "(", "function", ".", "apply", "(", "get", "(", ")", ")", ")", ";", "}", "else", "{", "return", "Optional", ".", "empty", "(", ")", ";", "}", "}" ]
If a value is present, map is with function, and if the result is non-null, return an Optional describing the result. Otherwise return an empty Optional. @param function a map function to apply to the value, if present @param <V> The type of the result of the mapping function @return an Optional describing the result of map, if a value is present, otherwise an empty Optional
[ "If", "a", "value", "is", "present", "map", "is", "with", "function", "and", "if", "the", "result", "is", "non", "-", "null", "return", "an", "Optional", "describing", "the", "result", ".", "Otherwise", "return", "an", "empty", "Optional", "." ]
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/Optional.java#L209-L217
151,410
aoindustries/ao-dao-base
src/main/java/com/aoindustries/dao/impl/Encryption.java
Encryption.hash
@Deprecated public static String hash(String plaintext) throws WrappedException { try { MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(plaintext.getBytes("UTF-8")); return hexEncode(md.digest()); } catch(NoSuchAlgorithmException | UnsupportedEncodingException e) { throw new WrappedException(e); } }
java
@Deprecated public static String hash(String plaintext) throws WrappedException { try { MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(plaintext.getBytes("UTF-8")); return hexEncode(md.digest()); } catch(NoSuchAlgorithmException | UnsupportedEncodingException e) { throw new WrappedException(e); } }
[ "@", "Deprecated", "public", "static", "String", "hash", "(", "String", "plaintext", ")", "throws", "WrappedException", "{", "try", "{", "MessageDigest", "md", "=", "MessageDigest", ".", "getInstance", "(", "\"SHA-1\"", ")", ";", "md", ".", "update", "(", "plaintext", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "return", "hexEncode", "(", "md", ".", "digest", "(", ")", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "|", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "WrappedException", "(", "e", ")", ";", "}", "}" ]
Performs a one-way hash of the plaintext value using SHA-1. @exception WrappedException if any problem occurs. @deprecated Use salted algorithm, update database of stored passwords as passwords are validated @see HashedPassword for proper password hashing @see HashedKey for SHA-256 hashing
[ "Performs", "a", "one", "-", "way", "hash", "of", "the", "plaintext", "value", "using", "SHA", "-", "1", "." ]
b1cde7f8d976f2d1ab57d110a77e2399ffa595ac
https://github.com/aoindustries/ao-dao-base/blob/b1cde7f8d976f2d1ab57d110a77e2399ffa595ac/src/main/java/com/aoindustries/dao/impl/Encryption.java#L63-L72
151,411
aoindustries/ao-dao-base
src/main/java/com/aoindustries/dao/impl/Encryption.java
Encryption.generateKey
public static String generateKey() { byte[] bytes = new byte[32]; getRandom().nextBytes(bytes); char[] chars = new char[64]; for(int c=0;c<32;c++) { byte b = bytes[c]; chars[c*2]=hexChars[(b&255)>>>4]; chars[c*2+1]=hexChars[b&15]; } return new String(chars); }
java
public static String generateKey() { byte[] bytes = new byte[32]; getRandom().nextBytes(bytes); char[] chars = new char[64]; for(int c=0;c<32;c++) { byte b = bytes[c]; chars[c*2]=hexChars[(b&255)>>>4]; chars[c*2+1]=hexChars[b&15]; } return new String(chars); }
[ "public", "static", "String", "generateKey", "(", ")", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "32", "]", ";", "getRandom", "(", ")", ".", "nextBytes", "(", "bytes", ")", ";", "char", "[", "]", "chars", "=", "new", "char", "[", "64", "]", ";", "for", "(", "int", "c", "=", "0", ";", "c", "<", "32", ";", "c", "++", ")", "{", "byte", "b", "=", "bytes", "[", "c", "]", ";", "chars", "[", "c", "*", "2", "]", "=", "hexChars", "[", "(", "b", "&", "255", ")", ">>>", "4", "]", ";", "chars", "[", "c", "*", "2", "+", "1", "]", "=", "hexChars", "[", "b", "&", "15", "]", ";", "}", "return", "new", "String", "(", "chars", ")", ";", "}" ]
Generates a random key.
[ "Generates", "a", "random", "key", "." ]
b1cde7f8d976f2d1ab57d110a77e2399ffa595ac
https://github.com/aoindustries/ao-dao-base/blob/b1cde7f8d976f2d1ab57d110a77e2399ffa595ac/src/main/java/com/aoindustries/dao/impl/Encryption.java#L88-L98
151,412
OwlPlatform/java-owl-worldmodel
src/main/java/com/owlplatform/worldmodel/types/DataConverter.java
DataConverter.encode
@SuppressWarnings({ "rawtypes", "unchecked"}) public static byte[] encode(final String attributeName, final Object obj) { TypeConverter converter = DataConverter.attributeConverters .get(attributeName); if (converter == null) { log.warn( "Unable to find a suitable data converter for attribute {}.", attributeName); throw new IllegalArgumentException( "Unable to find a suitable data converter for attribute \"" + attributeName + "\"."); } if (obj instanceof String) { return converter.encode((String) obj); } return converter.encode(obj); }
java
@SuppressWarnings({ "rawtypes", "unchecked"}) public static byte[] encode(final String attributeName, final Object obj) { TypeConverter converter = DataConverter.attributeConverters .get(attributeName); if (converter == null) { log.warn( "Unable to find a suitable data converter for attribute {}.", attributeName); throw new IllegalArgumentException( "Unable to find a suitable data converter for attribute \"" + attributeName + "\"."); } if (obj instanceof String) { return converter.encode((String) obj); } return converter.encode(obj); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "byte", "[", "]", "encode", "(", "final", "String", "attributeName", ",", "final", "Object", "obj", ")", "{", "TypeConverter", "converter", "=", "DataConverter", ".", "attributeConverters", ".", "get", "(", "attributeName", ")", ";", "if", "(", "converter", "==", "null", ")", "{", "log", ".", "warn", "(", "\"Unable to find a suitable data converter for attribute {}.\"", ",", "attributeName", ")", ";", "throw", "new", "IllegalArgumentException", "(", "\"Unable to find a suitable data converter for attribute \\\"\"", "+", "attributeName", "+", "\"\\\".\"", ")", ";", "}", "if", "(", "obj", "instanceof", "String", ")", "{", "return", "converter", ".", "encode", "(", "(", "String", ")", "obj", ")", ";", "}", "return", "converter", ".", "encode", "(", "obj", ")", ";", "}" ]
Encodes attribute data into the standard binary representation for the type. @param attributeName the name of the attribute @param obj the object to encode @return the encoded form of the object as a byte[].
[ "Encodes", "attribute", "data", "into", "the", "standard", "binary", "representation", "for", "the", "type", "." ]
a850e8b930c6e9787c7cad30c0de887858ca563d
https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/types/DataConverter.java#L110-L127
151,413
OwlPlatform/java-owl-worldmodel
src/main/java/com/owlplatform/worldmodel/types/DataConverter.java
DataConverter.putConverter
public static TypeConverter<?> putConverter(final String attributeName, final String type) { TypeConverter<?> conv = DataConverter.converterClasses.get(type); if (conv == null) { log.warn("Could not find a converter for data type {}.", type); throw new IllegalArgumentException( "Could not find a converter for data type \"" + type + "\"."); } return DataConverter.attributeConverters.put(attributeName, conv); }
java
public static TypeConverter<?> putConverter(final String attributeName, final String type) { TypeConverter<?> conv = DataConverter.converterClasses.get(type); if (conv == null) { log.warn("Could not find a converter for data type {}.", type); throw new IllegalArgumentException( "Could not find a converter for data type \"" + type + "\"."); } return DataConverter.attributeConverters.put(attributeName, conv); }
[ "public", "static", "TypeConverter", "<", "?", ">", "putConverter", "(", "final", "String", "attributeName", ",", "final", "String", "type", ")", "{", "TypeConverter", "<", "?", ">", "conv", "=", "DataConverter", ".", "converterClasses", ".", "get", "(", "type", ")", ";", "if", "(", "conv", "==", "null", ")", "{", "log", ".", "warn", "(", "\"Could not find a converter for data type {}.\"", ",", "type", ")", ";", "throw", "new", "IllegalArgumentException", "(", "\"Could not find a converter for data type \\\"\"", "+", "type", "+", "\"\\\".\"", ")", ";", "}", "return", "DataConverter", ".", "attributeConverters", ".", "put", "(", "attributeName", ",", "conv", ")", ";", "}" ]
Maps a converter for an Attribute name. @param attributeName the name of the Attribute. @param type the type of the Attribute (<i>e.g.</i>, "String", "Integer", "byte[]") @return the converter that was mapped @throws IllegalArgumentException if no converter is available for the type @see #getSupportedTypes()
[ "Maps", "a", "converter", "for", "an", "Attribute", "name", "." ]
a850e8b930c6e9787c7cad30c0de887858ca563d
https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/types/DataConverter.java#L187-L196
151,414
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java
SpecNodeWithRelationships.addRelationshipToTarget
public void addRelationshipToTarget(final Level level, final RelationshipType type) { final TargetRelationship relationship = new TargetRelationship(this, level, type); levelRelationships.add(relationship); relationships.add(relationship); }
java
public void addRelationshipToTarget(final Level level, final RelationshipType type) { final TargetRelationship relationship = new TargetRelationship(this, level, type); levelRelationships.add(relationship); relationships.add(relationship); }
[ "public", "void", "addRelationshipToTarget", "(", "final", "Level", "level", ",", "final", "RelationshipType", "type", ")", "{", "final", "TargetRelationship", "relationship", "=", "new", "TargetRelationship", "(", "this", ",", "level", ",", "type", ")", ";", "levelRelationships", ".", "add", "(", "relationship", ")", ";", "relationships", ".", "add", "(", "relationship", ")", ";", "}" ]
Add a relationship to the target level. @param level The target level that is to be related to. @param type The type of the relationship.
[ "Add", "a", "relationship", "to", "the", "target", "level", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java#L107-L111
151,415
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java
SpecNodeWithRelationships.getPreviousRelationships
public List<Relationship> getPreviousRelationships() { final List<Relationship> prevRelationships = new LinkedList<Relationship>(); for (final Relationship r : relationships) { if (r.getType() == RelationshipType.PREVIOUS) { prevRelationships.add(r); } } return prevRelationships; }
java
public List<Relationship> getPreviousRelationships() { final List<Relationship> prevRelationships = new LinkedList<Relationship>(); for (final Relationship r : relationships) { if (r.getType() == RelationshipType.PREVIOUS) { prevRelationships.add(r); } } return prevRelationships; }
[ "public", "List", "<", "Relationship", ">", "getPreviousRelationships", "(", ")", "{", "final", "List", "<", "Relationship", ">", "prevRelationships", "=", "new", "LinkedList", "<", "Relationship", ">", "(", ")", ";", "for", "(", "final", "Relationship", "r", ":", "relationships", ")", "{", "if", "(", "r", ".", "getType", "(", ")", "==", "RelationshipType", ".", "PREVIOUS", ")", "{", "prevRelationships", ".", "add", "(", "r", ")", ";", "}", "}", "return", "prevRelationships", ";", "}" ]
Gets a list of previous relationships for the Topic.
[ "Gets", "a", "list", "of", "previous", "relationships", "for", "the", "Topic", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java#L138-L146
151,416
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java
SpecNodeWithRelationships.getNextRelationships
public List<Relationship> getNextRelationships() { final List<Relationship> nextRelationships = new LinkedList<Relationship>(); for (final Relationship r : relationships) { if (r.getType() == RelationshipType.NEXT) { nextRelationships.add(r); } } return nextRelationships; }
java
public List<Relationship> getNextRelationships() { final List<Relationship> nextRelationships = new LinkedList<Relationship>(); for (final Relationship r : relationships) { if (r.getType() == RelationshipType.NEXT) { nextRelationships.add(r); } } return nextRelationships; }
[ "public", "List", "<", "Relationship", ">", "getNextRelationships", "(", ")", "{", "final", "List", "<", "Relationship", ">", "nextRelationships", "=", "new", "LinkedList", "<", "Relationship", ">", "(", ")", ";", "for", "(", "final", "Relationship", "r", ":", "relationships", ")", "{", "if", "(", "r", ".", "getType", "(", ")", "==", "RelationshipType", ".", "NEXT", ")", "{", "nextRelationships", ".", "add", "(", "r", ")", ";", "}", "}", "return", "nextRelationships", ";", "}" ]
Gets a list of next relationships for the Topic.
[ "Gets", "a", "list", "of", "next", "relationships", "for", "the", "Topic", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java#L151-L159
151,417
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java
SpecNodeWithRelationships.getPrerequisiteRelationships
public List<Relationship> getPrerequisiteRelationships() { final List<Relationship> prerequisiteRelationships = new LinkedList<Relationship>(); for (final Relationship r : relationships) { if (r.getType() == RelationshipType.PREREQUISITE) { prerequisiteRelationships.add(r); } } return prerequisiteRelationships; }
java
public List<Relationship> getPrerequisiteRelationships() { final List<Relationship> prerequisiteRelationships = new LinkedList<Relationship>(); for (final Relationship r : relationships) { if (r.getType() == RelationshipType.PREREQUISITE) { prerequisiteRelationships.add(r); } } return prerequisiteRelationships; }
[ "public", "List", "<", "Relationship", ">", "getPrerequisiteRelationships", "(", ")", "{", "final", "List", "<", "Relationship", ">", "prerequisiteRelationships", "=", "new", "LinkedList", "<", "Relationship", ">", "(", ")", ";", "for", "(", "final", "Relationship", "r", ":", "relationships", ")", "{", "if", "(", "r", ".", "getType", "(", ")", "==", "RelationshipType", ".", "PREREQUISITE", ")", "{", "prerequisiteRelationships", ".", "add", "(", "r", ")", ";", "}", "}", "return", "prerequisiteRelationships", ";", "}" ]
Gets a list of prerequisite relationships for the topic.
[ "Gets", "a", "list", "of", "prerequisite", "relationships", "for", "the", "topic", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java#L164-L172
151,418
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java
SpecNodeWithRelationships.getRelatedRelationships
public List<Relationship> getRelatedRelationships() { final List<Relationship> relatedRelationships = new LinkedList<Relationship>(); for (final Relationship r : relationships) { if (r.getType() == RelationshipType.REFER_TO) { relatedRelationships.add(r); } } return relatedRelationships; }
java
public List<Relationship> getRelatedRelationships() { final List<Relationship> relatedRelationships = new LinkedList<Relationship>(); for (final Relationship r : relationships) { if (r.getType() == RelationshipType.REFER_TO) { relatedRelationships.add(r); } } return relatedRelationships; }
[ "public", "List", "<", "Relationship", ">", "getRelatedRelationships", "(", ")", "{", "final", "List", "<", "Relationship", ">", "relatedRelationships", "=", "new", "LinkedList", "<", "Relationship", ">", "(", ")", ";", "for", "(", "final", "Relationship", "r", ":", "relationships", ")", "{", "if", "(", "r", ".", "getType", "(", ")", "==", "RelationshipType", ".", "REFER_TO", ")", "{", "relatedRelationships", ".", "add", "(", "r", ")", ";", "}", "}", "return", "relatedRelationships", ";", "}" ]
Gets a list of related relationships for the topic.
[ "Gets", "a", "list", "of", "related", "relationships", "for", "the", "topic", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java#L177-L185
151,419
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java
SpecNodeWithRelationships.getLinkListRelationships
public List<Relationship> getLinkListRelationships() { final List<Relationship> linkListRelationships = new LinkedList<Relationship>(); for (final Relationship r : relationships) { if (r.getType() == RelationshipType.LINKLIST) { linkListRelationships.add(r); } } return linkListRelationships; }
java
public List<Relationship> getLinkListRelationships() { final List<Relationship> linkListRelationships = new LinkedList<Relationship>(); for (final Relationship r : relationships) { if (r.getType() == RelationshipType.LINKLIST) { linkListRelationships.add(r); } } return linkListRelationships; }
[ "public", "List", "<", "Relationship", ">", "getLinkListRelationships", "(", ")", "{", "final", "List", "<", "Relationship", ">", "linkListRelationships", "=", "new", "LinkedList", "<", "Relationship", ">", "(", ")", ";", "for", "(", "final", "Relationship", "r", ":", "relationships", ")", "{", "if", "(", "r", ".", "getType", "(", ")", "==", "RelationshipType", ".", "LINKLIST", ")", "{", "linkListRelationships", ".", "add", "(", "r", ")", ";", "}", "}", "return", "linkListRelationships", ";", "}" ]
Gets a list of link-list relationships for the topic.
[ "Gets", "a", "list", "of", "link", "-", "list", "relationships", "for", "the", "topic", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java#L190-L198
151,420
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java
SpecNodeWithRelationships.printRelationshipsWithLongSyntax
private boolean printRelationshipsWithLongSyntax(final List<Relationship> relationships) { for (final Relationship relationship : relationships) { if (relationship.getRelationshipTitle() != null && !relationship.getRelationshipTitle().trim().isEmpty()) { return true; } } return false; }
java
private boolean printRelationshipsWithLongSyntax(final List<Relationship> relationships) { for (final Relationship relationship : relationships) { if (relationship.getRelationshipTitle() != null && !relationship.getRelationshipTitle().trim().isEmpty()) { return true; } } return false; }
[ "private", "boolean", "printRelationshipsWithLongSyntax", "(", "final", "List", "<", "Relationship", ">", "relationships", ")", "{", "for", "(", "final", "Relationship", "relationship", ":", "relationships", ")", "{", "if", "(", "relationship", ".", "getRelationshipTitle", "(", ")", "!=", "null", "&&", "!", "relationship", ".", "getRelationshipTitle", "(", ")", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks to see if a list of relationships should be printed using the long syntax. @param relationships The list of relationships to be checked. @return True if the relationships should be printed using the long syntax.
[ "Checks", "to", "see", "if", "a", "list", "of", "relationships", "should", "be", "printed", "using", "the", "long", "syntax", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java#L226-L234
151,421
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java
SpecNodeWithRelationships.generateRelationshipText
protected String generateRelationshipText(final RelationshipType relationshipType, boolean shortSyntax, final String spacer) { final StringBuilder retValue; final List<Relationship> relationships; // Create the relationship heading if (relationshipType == RelationshipType.REFER_TO) { if (shortSyntax) { retValue = new StringBuilder(" [R: "); } else { retValue = new StringBuilder("\n" + spacer + "[Refer-to:"); } relationships = getRelatedRelationships(); } else if (relationshipType == RelationshipType.PREREQUISITE) { if (shortSyntax) { retValue = new StringBuilder(" [P: "); } else { retValue = new StringBuilder("\n" + spacer + "[Prerequisite:"); } relationships = getPrerequisiteRelationships(); } else if (relationshipType == RelationshipType.LINKLIST) { if (shortSyntax) { retValue = new StringBuilder(" [L: "); } else { retValue = new StringBuilder("\n" + spacer + "[Link-List:"); } relationships = getLinkListRelationships(); } else { throw new IllegalArgumentException("Unable to create a text based formation for the " + relationshipType.toString() + " " + "relationship type."); } // Create the list of relationships if (shortSyntax) { final List<String> relatedIds = new ArrayList<String>(); for (final Relationship related : relationships) { relatedIds.add(related.getSecondaryRelationshipId()); } retValue.append(StringUtilities.buildString(relatedIds.toArray(new String[relatedIds.size()]), ", ")); } else { boolean first = true; for (final Relationship related : relationships) { if (first) { retValue.append("\n"); first = false; } else { retValue.append(",\n"); } retValue.append(spacer); retValue.append(SPACER); if (related.getRelationshipTitle() != null && !related.getRelationshipTitle().trim().isEmpty()) { retValue.append(ContentSpecUtilities.escapeRelationshipTitle(related.getRelationshipTitle())).append(" "); } retValue.append("["); retValue.append(related.getSecondaryRelationshipId()); retValue.append("]"); } } retValue.append("]"); return retValue.toString(); }
java
protected String generateRelationshipText(final RelationshipType relationshipType, boolean shortSyntax, final String spacer) { final StringBuilder retValue; final List<Relationship> relationships; // Create the relationship heading if (relationshipType == RelationshipType.REFER_TO) { if (shortSyntax) { retValue = new StringBuilder(" [R: "); } else { retValue = new StringBuilder("\n" + spacer + "[Refer-to:"); } relationships = getRelatedRelationships(); } else if (relationshipType == RelationshipType.PREREQUISITE) { if (shortSyntax) { retValue = new StringBuilder(" [P: "); } else { retValue = new StringBuilder("\n" + spacer + "[Prerequisite:"); } relationships = getPrerequisiteRelationships(); } else if (relationshipType == RelationshipType.LINKLIST) { if (shortSyntax) { retValue = new StringBuilder(" [L: "); } else { retValue = new StringBuilder("\n" + spacer + "[Link-List:"); } relationships = getLinkListRelationships(); } else { throw new IllegalArgumentException("Unable to create a text based formation for the " + relationshipType.toString() + " " + "relationship type."); } // Create the list of relationships if (shortSyntax) { final List<String> relatedIds = new ArrayList<String>(); for (final Relationship related : relationships) { relatedIds.add(related.getSecondaryRelationshipId()); } retValue.append(StringUtilities.buildString(relatedIds.toArray(new String[relatedIds.size()]), ", ")); } else { boolean first = true; for (final Relationship related : relationships) { if (first) { retValue.append("\n"); first = false; } else { retValue.append(",\n"); } retValue.append(spacer); retValue.append(SPACER); if (related.getRelationshipTitle() != null && !related.getRelationshipTitle().trim().isEmpty()) { retValue.append(ContentSpecUtilities.escapeRelationshipTitle(related.getRelationshipTitle())).append(" "); } retValue.append("["); retValue.append(related.getSecondaryRelationshipId()); retValue.append("]"); } } retValue.append("]"); return retValue.toString(); }
[ "protected", "String", "generateRelationshipText", "(", "final", "RelationshipType", "relationshipType", ",", "boolean", "shortSyntax", ",", "final", "String", "spacer", ")", "{", "final", "StringBuilder", "retValue", ";", "final", "List", "<", "Relationship", ">", "relationships", ";", "// Create the relationship heading", "if", "(", "relationshipType", "==", "RelationshipType", ".", "REFER_TO", ")", "{", "if", "(", "shortSyntax", ")", "{", "retValue", "=", "new", "StringBuilder", "(", "\" [R: \"", ")", ";", "}", "else", "{", "retValue", "=", "new", "StringBuilder", "(", "\"\\n\"", "+", "spacer", "+", "\"[Refer-to:\"", ")", ";", "}", "relationships", "=", "getRelatedRelationships", "(", ")", ";", "}", "else", "if", "(", "relationshipType", "==", "RelationshipType", ".", "PREREQUISITE", ")", "{", "if", "(", "shortSyntax", ")", "{", "retValue", "=", "new", "StringBuilder", "(", "\" [P: \"", ")", ";", "}", "else", "{", "retValue", "=", "new", "StringBuilder", "(", "\"\\n\"", "+", "spacer", "+", "\"[Prerequisite:\"", ")", ";", "}", "relationships", "=", "getPrerequisiteRelationships", "(", ")", ";", "}", "else", "if", "(", "relationshipType", "==", "RelationshipType", ".", "LINKLIST", ")", "{", "if", "(", "shortSyntax", ")", "{", "retValue", "=", "new", "StringBuilder", "(", "\" [L: \"", ")", ";", "}", "else", "{", "retValue", "=", "new", "StringBuilder", "(", "\"\\n\"", "+", "spacer", "+", "\"[Link-List:\"", ")", ";", "}", "relationships", "=", "getLinkListRelationships", "(", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unable to create a text based formation for the \"", "+", "relationshipType", ".", "toString", "(", ")", "+", "\" \"", "+", "\"relationship type.\"", ")", ";", "}", "// Create the list of relationships", "if", "(", "shortSyntax", ")", "{", "final", "List", "<", "String", ">", "relatedIds", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "final", "Relationship", "related", ":", "relationships", ")", "{", "relatedIds", ".", "add", "(", "related", ".", "getSecondaryRelationshipId", "(", ")", ")", ";", "}", "retValue", ".", "append", "(", "StringUtilities", ".", "buildString", "(", "relatedIds", ".", "toArray", "(", "new", "String", "[", "relatedIds", ".", "size", "(", ")", "]", ")", ",", "\", \"", ")", ")", ";", "}", "else", "{", "boolean", "first", "=", "true", ";", "for", "(", "final", "Relationship", "related", ":", "relationships", ")", "{", "if", "(", "first", ")", "{", "retValue", ".", "append", "(", "\"\\n\"", ")", ";", "first", "=", "false", ";", "}", "else", "{", "retValue", ".", "append", "(", "\",\\n\"", ")", ";", "}", "retValue", ".", "append", "(", "spacer", ")", ";", "retValue", ".", "append", "(", "SPACER", ")", ";", "if", "(", "related", ".", "getRelationshipTitle", "(", ")", "!=", "null", "&&", "!", "related", ".", "getRelationshipTitle", "(", ")", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "retValue", ".", "append", "(", "ContentSpecUtilities", ".", "escapeRelationshipTitle", "(", "related", ".", "getRelationshipTitle", "(", ")", ")", ")", ".", "append", "(", "\" \"", ")", ";", "}", "retValue", ".", "append", "(", "\"[\"", ")", ";", "retValue", ".", "append", "(", "related", ".", "getSecondaryRelationshipId", "(", ")", ")", ";", "retValue", ".", "append", "(", "\"]\"", ")", ";", "}", "}", "retValue", ".", "append", "(", "\"]\"", ")", ";", "return", "retValue", ".", "toString", "(", ")", ";", "}" ]
Creates the relationship text to be added to a topic's text. @param relationshipType The type of relationship to generate the text for. @param shortSyntax If the short relationship syntax should be used. @param spacer The spacer that should be added to the start of every new line. @return The generated relationship text.
[ "Creates", "the", "relationship", "text", "to", "be", "added", "to", "a", "topic", "s", "text", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNodeWithRelationships.java#L244-L303
151,422
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/Env.java
Env.getFileFormat
public static final FileFormat getFileFormat(Path path, Map<String, ?> env) { FileFormat fmt = (FileFormat) env.get(FORMAT); String filename = path.getFileName().toString(); if (fmt == null) { if (filename.endsWith(".tar.gz") || filename.endsWith(".tar") || filename.endsWith(".deb")) { fmt = TAR_GNU; } else { fmt = CPIO_CRC; } } return fmt; }
java
public static final FileFormat getFileFormat(Path path, Map<String, ?> env) { FileFormat fmt = (FileFormat) env.get(FORMAT); String filename = path.getFileName().toString(); if (fmt == null) { if (filename.endsWith(".tar.gz") || filename.endsWith(".tar") || filename.endsWith(".deb")) { fmt = TAR_GNU; } else { fmt = CPIO_CRC; } } return fmt; }
[ "public", "static", "final", "FileFormat", "getFileFormat", "(", "Path", "path", ",", "Map", "<", "String", ",", "?", ">", "env", ")", "{", "FileFormat", "fmt", "=", "(", "FileFormat", ")", "env", ".", "get", "(", "FORMAT", ")", ";", "String", "filename", "=", "path", ".", "getFileName", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "fmt", "==", "null", ")", "{", "if", "(", "filename", ".", "endsWith", "(", "\".tar.gz\"", ")", "||", "filename", ".", "endsWith", "(", "\".tar\"", ")", "||", "filename", ".", "endsWith", "(", "\".deb\"", ")", ")", "{", "fmt", "=", "TAR_GNU", ";", "}", "else", "{", "fmt", "=", "CPIO_CRC", ";", "}", "}", "return", "fmt", ";", "}" ]
Returns FileFormat either from env or using default value which is TAR_GNU for tar and CPIO_CRC for others. @param path @param env @return
[ "Returns", "FileFormat", "either", "from", "env", "or", "using", "default", "value", "which", "is", "TAR_GNU", "for", "tar", "and", "CPIO_CRC", "for", "others", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/Env.java#L81-L97
151,423
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/Env.java
Env.getFileAttributes
public static final FileAttribute<?>[] getFileAttributes(Map<String, ?> env) { FileAttribute<?>[] attrs = (FileAttribute<?>[]) env.get(FILE_ATTRIBUTES); if (attrs == null) { attrs = new FileAttribute<?>[0]; } return attrs; }
java
public static final FileAttribute<?>[] getFileAttributes(Map<String, ?> env) { FileAttribute<?>[] attrs = (FileAttribute<?>[]) env.get(FILE_ATTRIBUTES); if (attrs == null) { attrs = new FileAttribute<?>[0]; } return attrs; }
[ "public", "static", "final", "FileAttribute", "<", "?", ">", "[", "]", "getFileAttributes", "(", "Map", "<", "String", ",", "?", ">", "env", ")", "{", "FileAttribute", "<", "?", ">", "[", "]", "attrs", "=", "(", "FileAttribute", "<", "?", ">", "[", "]", ")", "env", ".", "get", "(", "FILE_ATTRIBUTES", ")", ";", "if", "(", "attrs", "==", "null", ")", "{", "attrs", "=", "new", "FileAttribute", "<", "?", ">", "[", "0", "]", ";", "}", "return", "attrs", ";", "}" ]
Return file attributes from env or empty array. These attributes are used in creating archive file. Because of zip-file-system crashes if trying to open file system for not existing file. @param env @return
[ "Return", "file", "attributes", "from", "env", "or", "empty", "array", ".", "These", "attributes", "are", "used", "in", "creating", "archive", "file", ".", "Because", "of", "zip", "-", "file", "-", "system", "crashes", "if", "trying", "to", "open", "file", "system", "for", "not", "existing", "file", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/Env.java#L105-L113
151,424
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/Env.java
Env.getDefaultRegularFileAttributes
public static final FileAttribute<?>[] getDefaultRegularFileAttributes(Map<String, ?> env) { FileAttribute<?>[] attrs = (FileAttribute<?>[]) env.get(DEFAULT_REGULAR_FILE_ATTRIBUTES); if (attrs == null) { attrs = new FileAttribute<?>[]{ PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rw-r--r--")), new FileAttributeImpl(OWNER, new UnixUser("root", 0)), new FileAttributeImpl(GROUP, new UnixGroup("root", 0)), }; } return attrs; }
java
public static final FileAttribute<?>[] getDefaultRegularFileAttributes(Map<String, ?> env) { FileAttribute<?>[] attrs = (FileAttribute<?>[]) env.get(DEFAULT_REGULAR_FILE_ATTRIBUTES); if (attrs == null) { attrs = new FileAttribute<?>[]{ PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rw-r--r--")), new FileAttributeImpl(OWNER, new UnixUser("root", 0)), new FileAttributeImpl(GROUP, new UnixGroup("root", 0)), }; } return attrs; }
[ "public", "static", "final", "FileAttribute", "<", "?", ">", "[", "]", "getDefaultRegularFileAttributes", "(", "Map", "<", "String", ",", "?", ">", "env", ")", "{", "FileAttribute", "<", "?", ">", "[", "]", "attrs", "=", "(", "FileAttribute", "<", "?", ">", "[", "]", ")", "env", ".", "get", "(", "DEFAULT_REGULAR_FILE_ATTRIBUTES", ")", ";", "if", "(", "attrs", "==", "null", ")", "{", "attrs", "=", "new", "FileAttribute", "<", "?", ">", "[", "]", "{", "PosixFilePermissions", ".", "asFileAttribute", "(", "PosixFilePermissions", ".", "fromString", "(", "\"rw-r--r--\"", ")", ")", ",", "new", "FileAttributeImpl", "(", "OWNER", ",", "new", "UnixUser", "(", "\"root\"", ",", "0", ")", ")", ",", "new", "FileAttributeImpl", "(", "GROUP", ",", "new", "UnixGroup", "(", "\"root\"", ",", "0", ")", ")", ",", "}", ";", "}", "return", "attrs", ";", "}" ]
Return default attributes for new regular file. Either from env or default values. @param env @return
[ "Return", "default", "attributes", "for", "new", "regular", "file", ".", "Either", "from", "env", "or", "default", "values", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/Env.java#L120-L132
151,425
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/Env.java
Env.getDefaultDirectoryFileAttributes
public static final FileAttribute<?>[] getDefaultDirectoryFileAttributes(Map<String, ?> env) { FileAttribute<?>[] attrs = (FileAttribute<?>[]) env.get(DEFAULT_DIRECTORY_FILE_ATTRIBUTES); if (attrs == null) { attrs = new FileAttribute<?>[]{ PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxr-xr-x")), new FileAttributeImpl(OWNER, new UnixUser("root", 0)), new FileAttributeImpl(GROUP, new UnixGroup("root", 0)), }; } return attrs; }
java
public static final FileAttribute<?>[] getDefaultDirectoryFileAttributes(Map<String, ?> env) { FileAttribute<?>[] attrs = (FileAttribute<?>[]) env.get(DEFAULT_DIRECTORY_FILE_ATTRIBUTES); if (attrs == null) { attrs = new FileAttribute<?>[]{ PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxr-xr-x")), new FileAttributeImpl(OWNER, new UnixUser("root", 0)), new FileAttributeImpl(GROUP, new UnixGroup("root", 0)), }; } return attrs; }
[ "public", "static", "final", "FileAttribute", "<", "?", ">", "[", "]", "getDefaultDirectoryFileAttributes", "(", "Map", "<", "String", ",", "?", ">", "env", ")", "{", "FileAttribute", "<", "?", ">", "[", "]", "attrs", "=", "(", "FileAttribute", "<", "?", ">", "[", "]", ")", "env", ".", "get", "(", "DEFAULT_DIRECTORY_FILE_ATTRIBUTES", ")", ";", "if", "(", "attrs", "==", "null", ")", "{", "attrs", "=", "new", "FileAttribute", "<", "?", ">", "[", "]", "{", "PosixFilePermissions", ".", "asFileAttribute", "(", "PosixFilePermissions", ".", "fromString", "(", "\"rwxr-xr-x\"", ")", ")", ",", "new", "FileAttributeImpl", "(", "OWNER", ",", "new", "UnixUser", "(", "\"root\"", ",", "0", ")", ")", ",", "new", "FileAttributeImpl", "(", "GROUP", ",", "new", "UnixGroup", "(", "\"root\"", ",", "0", ")", ")", ",", "}", ";", "}", "return", "attrs", ";", "}" ]
Return default attributes for new directory. Either from env or default values. @param env @return
[ "Return", "default", "attributes", "for", "new", "directory", ".", "Either", "from", "env", "or", "default", "values", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/Env.java#L139-L151
151,426
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/Env.java
Env.getDefaultSymbolicLinkFileAttributes
public static final FileAttribute<?>[] getDefaultSymbolicLinkFileAttributes(Map<String, ?> env) { FileAttribute<?>[] attrs = (FileAttribute<?>[]) env.get(DEFAULT_SYMBOLIC_LINK_FILE_ATTRIBUTES); if (attrs == null) { attrs = new FileAttribute<?>[]{ PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxrwxrwx")), new FileAttributeImpl(OWNER, new UnixUser("root", 0)), new FileAttributeImpl(GROUP, new UnixGroup("root", 0)), }; } return attrs; }
java
public static final FileAttribute<?>[] getDefaultSymbolicLinkFileAttributes(Map<String, ?> env) { FileAttribute<?>[] attrs = (FileAttribute<?>[]) env.get(DEFAULT_SYMBOLIC_LINK_FILE_ATTRIBUTES); if (attrs == null) { attrs = new FileAttribute<?>[]{ PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxrwxrwx")), new FileAttributeImpl(OWNER, new UnixUser("root", 0)), new FileAttributeImpl(GROUP, new UnixGroup("root", 0)), }; } return attrs; }
[ "public", "static", "final", "FileAttribute", "<", "?", ">", "[", "]", "getDefaultSymbolicLinkFileAttributes", "(", "Map", "<", "String", ",", "?", ">", "env", ")", "{", "FileAttribute", "<", "?", ">", "[", "]", "attrs", "=", "(", "FileAttribute", "<", "?", ">", "[", "]", ")", "env", ".", "get", "(", "DEFAULT_SYMBOLIC_LINK_FILE_ATTRIBUTES", ")", ";", "if", "(", "attrs", "==", "null", ")", "{", "attrs", "=", "new", "FileAttribute", "<", "?", ">", "[", "]", "{", "PosixFilePermissions", ".", "asFileAttribute", "(", "PosixFilePermissions", ".", "fromString", "(", "\"rwxrwxrwx\"", ")", ")", ",", "new", "FileAttributeImpl", "(", "OWNER", ",", "new", "UnixUser", "(", "\"root\"", ",", "0", ")", ")", ",", "new", "FileAttributeImpl", "(", "GROUP", ",", "new", "UnixGroup", "(", "\"root\"", ",", "0", ")", ")", ",", "}", ";", "}", "return", "attrs", ";", "}" ]
Return default attributes for new symbolic link. Either from env or default values. @param env @return
[ "Return", "default", "attributes", "for", "new", "symbolic", "link", ".", "Either", "from", "env", "or", "default", "values", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/Env.java#L158-L170
151,427
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/Env.java
Env.getOpenOptions
public static final Set<? extends OpenOption> getOpenOptions(Path path, Map<String, ?> env) throws IOException { Set<? extends OpenOption> opts = (Set<? extends OpenOption>) env.get(OPEN_OPTIONS); if (opts == null) { if (Files.exists(path) && Files.size(path) > 0) { opts = EnumSet.of(READ); } else { opts = EnumSet.of(WRITE, CREATE); } } return opts; }
java
public static final Set<? extends OpenOption> getOpenOptions(Path path, Map<String, ?> env) throws IOException { Set<? extends OpenOption> opts = (Set<? extends OpenOption>) env.get(OPEN_OPTIONS); if (opts == null) { if (Files.exists(path) && Files.size(path) > 0) { opts = EnumSet.of(READ); } else { opts = EnumSet.of(WRITE, CREATE); } } return opts; }
[ "public", "static", "final", "Set", "<", "?", "extends", "OpenOption", ">", "getOpenOptions", "(", "Path", "path", ",", "Map", "<", "String", ",", "?", ">", "env", ")", "throws", "IOException", "{", "Set", "<", "?", "extends", "OpenOption", ">", "opts", "=", "(", "Set", "<", "?", "extends", "OpenOption", ">", ")", "env", ".", "get", "(", "OPEN_OPTIONS", ")", ";", "if", "(", "opts", "==", "null", ")", "{", "if", "(", "Files", ".", "exists", "(", "path", ")", "&&", "Files", ".", "size", "(", "path", ")", ">", "0", ")", "{", "opts", "=", "EnumSet", ".", "of", "(", "READ", ")", ";", "}", "else", "{", "opts", "=", "EnumSet", ".", "of", "(", "WRITE", ",", "CREATE", ")", ";", "}", "}", "return", "opts", ";", "}" ]
Returns open-options. Returns from env if exists. Otherwise if file exists and size greater than 0 returns READ or READ,WRITE. @param path @param env @return @throws IOException
[ "Returns", "open", "-", "options", ".", "Returns", "from", "env", "if", "exists", ".", "Otherwise", "if", "file", "exists", "and", "size", "greater", "than", "0", "returns", "READ", "or", "READ", "WRITE", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/Env.java#L179-L194
151,428
sworisbreathing/sfmf4j
sfmf4j-nio2/src/main/java/com/github/sworisbreathing/sfmf4j/nio2/WatchServiceFileMonitorServiceImpl.java
WatchServiceFileMonitorServiceImpl.getWatchKeyForPath
private synchronized WatchKey getWatchKeyForPath(final String path) throws IOException { WatchKey key = watchKeysByPath.get(path); if (key == null) { logger.debug("Lazy-instantiating watch key for path: {}", path); key = Paths.get(path).register(watchService, interested_types); watchKeysByPath.put(path, key); pathsByWatchKey.put(key, path); listenersByWatchKey.put(key, Collections.newSetFromMap(new ConcurrentHashMap<SFMF4JWatchListener, Boolean>())); } return key; }
java
private synchronized WatchKey getWatchKeyForPath(final String path) throws IOException { WatchKey key = watchKeysByPath.get(path); if (key == null) { logger.debug("Lazy-instantiating watch key for path: {}", path); key = Paths.get(path).register(watchService, interested_types); watchKeysByPath.put(path, key); pathsByWatchKey.put(key, path); listenersByWatchKey.put(key, Collections.newSetFromMap(new ConcurrentHashMap<SFMF4JWatchListener, Boolean>())); } return key; }
[ "private", "synchronized", "WatchKey", "getWatchKeyForPath", "(", "final", "String", "path", ")", "throws", "IOException", "{", "WatchKey", "key", "=", "watchKeysByPath", ".", "get", "(", "path", ")", ";", "if", "(", "key", "==", "null", ")", "{", "logger", ".", "debug", "(", "\"Lazy-instantiating watch key for path: {}\"", ",", "path", ")", ";", "key", "=", "Paths", ".", "get", "(", "path", ")", ".", "register", "(", "watchService", ",", "interested_types", ")", ";", "watchKeysByPath", ".", "put", "(", "path", ",", "key", ")", ";", "pathsByWatchKey", ".", "put", "(", "key", ",", "path", ")", ";", "listenersByWatchKey", ".", "put", "(", "key", ",", "Collections", ".", "newSetFromMap", "(", "new", "ConcurrentHashMap", "<", "SFMF4JWatchListener", ",", "Boolean", ">", "(", ")", ")", ")", ";", "}", "return", "key", ";", "}" ]
Gets the watch key for a path with lazy initialization. @param path the path @return a registered watch key for the path @throws IOException if lazy initialization fails
[ "Gets", "the", "watch", "key", "for", "a", "path", "with", "lazy", "initialization", "." ]
826c2c02af69d55f98e64fbcfae23d0c7bac3f19
https://github.com/sworisbreathing/sfmf4j/blob/826c2c02af69d55f98e64fbcfae23d0c7bac3f19/sfmf4j-nio2/src/main/java/com/github/sworisbreathing/sfmf4j/nio2/WatchServiceFileMonitorServiceImpl.java#L151-L161
151,429
sworisbreathing/sfmf4j
sfmf4j-nio2/src/main/java/com/github/sworisbreathing/sfmf4j/nio2/WatchServiceFileMonitorServiceImpl.java
WatchServiceFileMonitorServiceImpl.resolveEventWithCorrectPath
private synchronized WatchEvent<Path> resolveEventWithCorrectPath(final WatchKey key, final WatchEvent<Path> event) { Path correctPath = Paths.get(pathsByWatchKey.get(key)); return new ResolvedPathWatchEvent(event, correctPath); }
java
private synchronized WatchEvent<Path> resolveEventWithCorrectPath(final WatchKey key, final WatchEvent<Path> event) { Path correctPath = Paths.get(pathsByWatchKey.get(key)); return new ResolvedPathWatchEvent(event, correctPath); }
[ "private", "synchronized", "WatchEvent", "<", "Path", ">", "resolveEventWithCorrectPath", "(", "final", "WatchKey", "key", ",", "final", "WatchEvent", "<", "Path", ">", "event", ")", "{", "Path", "correctPath", "=", "Paths", ".", "get", "(", "pathsByWatchKey", ".", "get", "(", "key", ")", ")", ";", "return", "new", "ResolvedPathWatchEvent", "(", "event", ",", "correctPath", ")", ";", "}" ]
Resolves a watch event with its absolute path. @param key the watch key (used to look up the parent path) @param event the event to resolve @return a copy of the event, with a resolved path
[ "Resolves", "a", "watch", "event", "with", "its", "absolute", "path", "." ]
826c2c02af69d55f98e64fbcfae23d0c7bac3f19
https://github.com/sworisbreathing/sfmf4j/blob/826c2c02af69d55f98e64fbcfae23d0c7bac3f19/sfmf4j-nio2/src/main/java/com/github/sworisbreathing/sfmf4j/nio2/WatchServiceFileMonitorServiceImpl.java#L201-L204
151,430
OwlPlatform/java-owl-solver
src/main/java/com/owlplatform/solver/SolverAggregatorConnection.java
SolverAggregatorConnection.getNextSample
public SampleMessage getNextSample() { if (this.connected) { try { return this.sampleQueue.take(); } catch (InterruptedException e) { log.error( "Interrupted while waiting for next sample to arrive.", e); } return null; } throw new IllegalStateException( "Connection to the aggregator has terminated."); }
java
public SampleMessage getNextSample() { if (this.connected) { try { return this.sampleQueue.take(); } catch (InterruptedException e) { log.error( "Interrupted while waiting for next sample to arrive.", e); } return null; } throw new IllegalStateException( "Connection to the aggregator has terminated."); }
[ "public", "SampleMessage", "getNextSample", "(", ")", "{", "if", "(", "this", ".", "connected", ")", "{", "try", "{", "return", "this", ".", "sampleQueue", ".", "take", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "log", ".", "error", "(", "\"Interrupted while waiting for next sample to arrive.\"", ",", "e", ")", ";", "}", "return", "null", ";", "}", "throw", "new", "IllegalStateException", "(", "\"Connection to the aggregator has terminated.\"", ")", ";", "}" ]
Returns the next sample from the Aggregator, blocking until it is available if none are currently buffered. If the connection to the aggregator has been completely shut down, then this method will throw an IllegalStateException. @return the next sample received from the Aggregator. @throws IllegalStateException if this method is called after the Aggregator has been disconnected.
[ "Returns", "the", "next", "sample", "from", "the", "Aggregator", "blocking", "until", "it", "is", "available", "if", "none", "are", "currently", "buffered", ".", "If", "the", "connection", "to", "the", "aggregator", "has", "been", "completely", "shut", "down", "then", "this", "method", "will", "throw", "an", "IllegalStateException", "." ]
53a1faabd63613c716203922cd52f871e5fedb9b
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/SolverAggregatorConnection.java#L249-L263
151,431
OwlPlatform/java-owl-solver
src/main/java/com/owlplatform/solver/SolverAggregatorConnection.java
SolverAggregatorConnection.addRule
public int addRule(final SubscriptionRequestRule rule) { Integer theRuleNum = Integer.valueOf(this.nextRuleNum.getAndIncrement()); synchronized (this.ruleMap) { if (!this.ruleMap.values().contains(rule)) { this.ruleMap.put(theRuleNum, rule); SubscriptionRequestRule[] newRules = this.ruleMap.values().toArray(new SubscriptionRequestRule[]{}); this.agg.setRules(newRules); if (this.agg.isConnected()) { SubscriptionMessage msg = new SubscriptionMessage(); msg.setRules(new SubscriptionRequestRule[] { rule }); msg.setMessageType(SubscriptionMessage.SUBSCRIPTION_MESSAGE_ID); this.agg.getSession().write(msg); } return theRuleNum.intValue(); } log.warn("Rule {} is already configured for use.", rule); return -1; } }
java
public int addRule(final SubscriptionRequestRule rule) { Integer theRuleNum = Integer.valueOf(this.nextRuleNum.getAndIncrement()); synchronized (this.ruleMap) { if (!this.ruleMap.values().contains(rule)) { this.ruleMap.put(theRuleNum, rule); SubscriptionRequestRule[] newRules = this.ruleMap.values().toArray(new SubscriptionRequestRule[]{}); this.agg.setRules(newRules); if (this.agg.isConnected()) { SubscriptionMessage msg = new SubscriptionMessage(); msg.setRules(new SubscriptionRequestRule[] { rule }); msg.setMessageType(SubscriptionMessage.SUBSCRIPTION_MESSAGE_ID); this.agg.getSession().write(msg); } return theRuleNum.intValue(); } log.warn("Rule {} is already configured for use.", rule); return -1; } }
[ "public", "int", "addRule", "(", "final", "SubscriptionRequestRule", "rule", ")", "{", "Integer", "theRuleNum", "=", "Integer", ".", "valueOf", "(", "this", ".", "nextRuleNum", ".", "getAndIncrement", "(", ")", ")", ";", "synchronized", "(", "this", ".", "ruleMap", ")", "{", "if", "(", "!", "this", ".", "ruleMap", ".", "values", "(", ")", ".", "contains", "(", "rule", ")", ")", "{", "this", ".", "ruleMap", ".", "put", "(", "theRuleNum", ",", "rule", ")", ";", "SubscriptionRequestRule", "[", "]", "newRules", "=", "this", ".", "ruleMap", ".", "values", "(", ")", ".", "toArray", "(", "new", "SubscriptionRequestRule", "[", "]", "{", "}", ")", ";", "this", ".", "agg", ".", "setRules", "(", "newRules", ")", ";", "if", "(", "this", ".", "agg", ".", "isConnected", "(", ")", ")", "{", "SubscriptionMessage", "msg", "=", "new", "SubscriptionMessage", "(", ")", ";", "msg", ".", "setRules", "(", "new", "SubscriptionRequestRule", "[", "]", "{", "rule", "}", ")", ";", "msg", ".", "setMessageType", "(", "SubscriptionMessage", ".", "SUBSCRIPTION_MESSAGE_ID", ")", ";", "this", ".", "agg", ".", "getSession", "(", ")", ".", "write", "(", "msg", ")", ";", "}", "return", "theRuleNum", ".", "intValue", "(", ")", ";", "}", "log", ".", "warn", "(", "\"Rule {} is already configured for use.\"", ",", "rule", ")", ";", "return", "-", "1", ";", "}", "}" ]
Adds a Subscription Request Rule to the aggregator interface. If the aggregator is already connected, the rule will be sent immediately, otherwise it will be sent with all rules when the aggregator is connected. @param rule the rule to add to this aggregator. @return the rule number, which can be used later to remove a Subscription Request Rule.
[ "Adds", "a", "Subscription", "Request", "Rule", "to", "the", "aggregator", "interface", ".", "If", "the", "aggregator", "is", "already", "connected", "the", "rule", "will", "be", "sent", "immediately", "otherwise", "it", "will", "be", "sent", "with", "all", "rules", "when", "the", "aggregator", "is", "connected", "." ]
53a1faabd63613c716203922cd52f871e5fedb9b
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/SolverAggregatorConnection.java#L300-L320
151,432
OwlPlatform/java-owl-solver
src/main/java/com/owlplatform/solver/SolverAggregatorConnection.java
SolverAggregatorConnection.sampleReceived
void sampleReceived(SolverAggregatorInterface aggregator, SampleMessage sample) { if (!this.sampleQueue.offer(sample) && this.warnBufferFull) { log.warn("Unable to insert a sample due to a full buffer."); } }
java
void sampleReceived(SolverAggregatorInterface aggregator, SampleMessage sample) { if (!this.sampleQueue.offer(sample) && this.warnBufferFull) { log.warn("Unable to insert a sample due to a full buffer."); } }
[ "void", "sampleReceived", "(", "SolverAggregatorInterface", "aggregator", ",", "SampleMessage", "sample", ")", "{", "if", "(", "!", "this", ".", "sampleQueue", ".", "offer", "(", "sample", ")", "&&", "this", ".", "warnBufferFull", ")", "{", "log", ".", "warn", "(", "\"Unable to insert a sample due to a full buffer.\"", ")", ";", "}", "}" ]
Called when the aggregator sends a sample. Enqueues the sample into the internal buffer. @param aggregator the aggregator that sent the sample. @param sample the sample that was sent.
[ "Called", "when", "the", "aggregator", "sends", "a", "sample", ".", "Enqueues", "the", "sample", "into", "the", "internal", "buffer", "." ]
53a1faabd63613c716203922cd52f871e5fedb9b
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/SolverAggregatorConnection.java#L391-L396
151,433
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java
CreateWSDL.getDefaultVersion
public String getDefaultVersion() { Record recMessageVersion = ((ReferenceField)this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.DEFAULT_VERSION_ID)).getReference(); if (recMessageVersion != null) if ((recMessageVersion.getEditMode() == DBConstants.EDIT_CURRENT) || (recMessageVersion.getEditMode() == DBConstants.EDIT_IN_PROGRESS)) return recMessageVersion.getField(MessageVersion.CODE).toString(); return "2007B"; // Never }
java
public String getDefaultVersion() { Record recMessageVersion = ((ReferenceField)this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.DEFAULT_VERSION_ID)).getReference(); if (recMessageVersion != null) if ((recMessageVersion.getEditMode() == DBConstants.EDIT_CURRENT) || (recMessageVersion.getEditMode() == DBConstants.EDIT_IN_PROGRESS)) return recMessageVersion.getField(MessageVersion.CODE).toString(); return "2007B"; // Never }
[ "public", "String", "getDefaultVersion", "(", ")", "{", "Record", "recMessageVersion", "=", "(", "(", "ReferenceField", ")", "this", ".", "getRecord", "(", "MessageControl", ".", "MESSAGE_CONTROL_FILE", ")", ".", "getField", "(", "MessageControl", ".", "DEFAULT_VERSION_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "recMessageVersion", "!=", "null", ")", "if", "(", "(", "recMessageVersion", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_CURRENT", ")", "||", "(", "recMessageVersion", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_IN_PROGRESS", ")", ")", "return", "recMessageVersion", ".", "getField", "(", "MessageVersion", ".", "CODE", ")", ".", "toString", "(", ")", ";", "return", "\"2007B\"", ";", "// Never", "}" ]
GetDefaultVersion Method.
[ "GetDefaultVersion", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java#L144-L151
151,434
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java
CreateWSDL.scanProcesses
public void scanProcesses(Object typeObject, OperationType type) { String strTargetVersion = this.getProperty("version"); if (strTargetVersion == null) strTargetVersion = this.getDefaultVersion(); Record recMessageTransport = ((ReferenceField)this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.WEB_MESSAGE_TRANSPORT_ID)).getReference(); MessageVersion recMessageVersion = ((MessageControl)this.getRecord(MessageControl.MESSAGE_CONTROL_FILE)).getMessageVersion(strTargetVersion); MessageProcessInfo recMessageProcessInfo = new MessageProcessInfo(this); recMessageProcessInfo.setKeyArea(MessageProcessInfo.MESSAGE_INFO_ID_KEY); try { // Always register this generic processing queue. recMessageProcessInfo.close(); while (recMessageProcessInfo.hasNext()) { recMessageProcessInfo.next(); String strQueueName = recMessageProcessInfo.getQueueName(true); String strQueueType = recMessageProcessInfo.getQueueType(true); String strProcessClass = recMessageProcessInfo.getField(MessageProcessInfo.PROCESSOR_CLASS).toString(); Map<String,Object> properties = ((PropertiesField)recMessageProcessInfo.getField(MessageProcessInfo.PROPERTIES)).getProperties(); Record recMessageType = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_TYPE_ID)).getReference(); if (recMessageType != null) { // Start all processes that handle INcoming REQUESTs. String strMessageType = recMessageType.getField(MessageType.CODE).toString(); Record recMessageInfo = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); if (recMessageInfo != null) { Record recMessageInfoType = ((ReferenceField)recMessageInfo.getField(MessageInfo.MESSAGE_INFO_TYPE_ID)).getReference(); if (recMessageInfoType != null) { String strMessageInfoType = recMessageInfoType.getField(MessageInfoType.CODE).toString(); if (MessageInfoType.REQUEST.equals(strMessageInfoType)) if (MessageType.MESSAGE_IN.equals(strMessageType)) if ((strQueueName != null) && (strQueueName.length() > 0)) { Record recMessageTransportInfo = this.getRecord(MessageTransportInfo.MESSAGE_TRANSPORT_INFO_FILE); recMessageTransportInfo.setKeyArea(MessageTransportInfo.MESSAGE_PROCESS_INFO_ID_KEY); recMessageTransportInfo.getField(MessageTransportInfo.MESSAGE_PROCESS_INFO_ID).moveFieldToThis(recMessageProcessInfo.getField(MessageProcessInfo.ID)); recMessageTransportInfo.getField(MessageTransportInfo.MESSAGE_TRANSPORT_ID).moveFieldToThis(recMessageTransport.getField(MessageTransport.ID)); recMessageTransportInfo.getField(MessageTransportInfo.MESSAGE_VERSION_ID).moveFieldToThis(recMessageVersion.getField(MessageVersion.ID)); if (recMessageTransportInfo.seek(DBConstants.EQUALS)) { this.addProcessForWSDL(strTargetVersion, typeObject, recMessageProcessInfo, type); } } } } } } recMessageProcessInfo.close(); } catch (DBException ex) { ex.printStackTrace(); } finally { recMessageProcessInfo.free(); } }
java
public void scanProcesses(Object typeObject, OperationType type) { String strTargetVersion = this.getProperty("version"); if (strTargetVersion == null) strTargetVersion = this.getDefaultVersion(); Record recMessageTransport = ((ReferenceField)this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.WEB_MESSAGE_TRANSPORT_ID)).getReference(); MessageVersion recMessageVersion = ((MessageControl)this.getRecord(MessageControl.MESSAGE_CONTROL_FILE)).getMessageVersion(strTargetVersion); MessageProcessInfo recMessageProcessInfo = new MessageProcessInfo(this); recMessageProcessInfo.setKeyArea(MessageProcessInfo.MESSAGE_INFO_ID_KEY); try { // Always register this generic processing queue. recMessageProcessInfo.close(); while (recMessageProcessInfo.hasNext()) { recMessageProcessInfo.next(); String strQueueName = recMessageProcessInfo.getQueueName(true); String strQueueType = recMessageProcessInfo.getQueueType(true); String strProcessClass = recMessageProcessInfo.getField(MessageProcessInfo.PROCESSOR_CLASS).toString(); Map<String,Object> properties = ((PropertiesField)recMessageProcessInfo.getField(MessageProcessInfo.PROPERTIES)).getProperties(); Record recMessageType = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_TYPE_ID)).getReference(); if (recMessageType != null) { // Start all processes that handle INcoming REQUESTs. String strMessageType = recMessageType.getField(MessageType.CODE).toString(); Record recMessageInfo = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); if (recMessageInfo != null) { Record recMessageInfoType = ((ReferenceField)recMessageInfo.getField(MessageInfo.MESSAGE_INFO_TYPE_ID)).getReference(); if (recMessageInfoType != null) { String strMessageInfoType = recMessageInfoType.getField(MessageInfoType.CODE).toString(); if (MessageInfoType.REQUEST.equals(strMessageInfoType)) if (MessageType.MESSAGE_IN.equals(strMessageType)) if ((strQueueName != null) && (strQueueName.length() > 0)) { Record recMessageTransportInfo = this.getRecord(MessageTransportInfo.MESSAGE_TRANSPORT_INFO_FILE); recMessageTransportInfo.setKeyArea(MessageTransportInfo.MESSAGE_PROCESS_INFO_ID_KEY); recMessageTransportInfo.getField(MessageTransportInfo.MESSAGE_PROCESS_INFO_ID).moveFieldToThis(recMessageProcessInfo.getField(MessageProcessInfo.ID)); recMessageTransportInfo.getField(MessageTransportInfo.MESSAGE_TRANSPORT_ID).moveFieldToThis(recMessageTransport.getField(MessageTransport.ID)); recMessageTransportInfo.getField(MessageTransportInfo.MESSAGE_VERSION_ID).moveFieldToThis(recMessageVersion.getField(MessageVersion.ID)); if (recMessageTransportInfo.seek(DBConstants.EQUALS)) { this.addProcessForWSDL(strTargetVersion, typeObject, recMessageProcessInfo, type); } } } } } } recMessageProcessInfo.close(); } catch (DBException ex) { ex.printStackTrace(); } finally { recMessageProcessInfo.free(); } }
[ "public", "void", "scanProcesses", "(", "Object", "typeObject", ",", "OperationType", "type", ")", "{", "String", "strTargetVersion", "=", "this", ".", "getProperty", "(", "\"version\"", ")", ";", "if", "(", "strTargetVersion", "==", "null", ")", "strTargetVersion", "=", "this", ".", "getDefaultVersion", "(", ")", ";", "Record", "recMessageTransport", "=", "(", "(", "ReferenceField", ")", "this", ".", "getRecord", "(", "MessageControl", ".", "MESSAGE_CONTROL_FILE", ")", ".", "getField", "(", "MessageControl", ".", "WEB_MESSAGE_TRANSPORT_ID", ")", ")", ".", "getReference", "(", ")", ";", "MessageVersion", "recMessageVersion", "=", "(", "(", "MessageControl", ")", "this", ".", "getRecord", "(", "MessageControl", ".", "MESSAGE_CONTROL_FILE", ")", ")", ".", "getMessageVersion", "(", "strTargetVersion", ")", ";", "MessageProcessInfo", "recMessageProcessInfo", "=", "new", "MessageProcessInfo", "(", "this", ")", ";", "recMessageProcessInfo", ".", "setKeyArea", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID_KEY", ")", ";", "try", "{", "// Always register this generic processing queue.", "recMessageProcessInfo", ".", "close", "(", ")", ";", "while", "(", "recMessageProcessInfo", ".", "hasNext", "(", ")", ")", "{", "recMessageProcessInfo", ".", "next", "(", ")", ";", "String", "strQueueName", "=", "recMessageProcessInfo", ".", "getQueueName", "(", "true", ")", ";", "String", "strQueueType", "=", "recMessageProcessInfo", ".", "getQueueType", "(", "true", ")", ";", "String", "strProcessClass", "=", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "PROCESSOR_CLASS", ")", ".", "toString", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "properties", "=", "(", "(", "PropertiesField", ")", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "PROPERTIES", ")", ")", ".", "getProperties", "(", ")", ";", "Record", "recMessageType", "=", "(", "(", "ReferenceField", ")", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_TYPE_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "recMessageType", "!=", "null", ")", "{", "// Start all processes that handle INcoming REQUESTs.", "String", "strMessageType", "=", "recMessageType", ".", "getField", "(", "MessageType", ".", "CODE", ")", ".", "toString", "(", ")", ";", "Record", "recMessageInfo", "=", "(", "(", "ReferenceField", ")", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "recMessageInfo", "!=", "null", ")", "{", "Record", "recMessageInfoType", "=", "(", "(", "ReferenceField", ")", "recMessageInfo", ".", "getField", "(", "MessageInfo", ".", "MESSAGE_INFO_TYPE_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "recMessageInfoType", "!=", "null", ")", "{", "String", "strMessageInfoType", "=", "recMessageInfoType", ".", "getField", "(", "MessageInfoType", ".", "CODE", ")", ".", "toString", "(", ")", ";", "if", "(", "MessageInfoType", ".", "REQUEST", ".", "equals", "(", "strMessageInfoType", ")", ")", "if", "(", "MessageType", ".", "MESSAGE_IN", ".", "equals", "(", "strMessageType", ")", ")", "if", "(", "(", "strQueueName", "!=", "null", ")", "&&", "(", "strQueueName", ".", "length", "(", ")", ">", "0", ")", ")", "{", "Record", "recMessageTransportInfo", "=", "this", ".", "getRecord", "(", "MessageTransportInfo", ".", "MESSAGE_TRANSPORT_INFO_FILE", ")", ";", "recMessageTransportInfo", ".", "setKeyArea", "(", "MessageTransportInfo", ".", "MESSAGE_PROCESS_INFO_ID_KEY", ")", ";", "recMessageTransportInfo", ".", "getField", "(", "MessageTransportInfo", ".", "MESSAGE_PROCESS_INFO_ID", ")", ".", "moveFieldToThis", "(", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "ID", ")", ")", ";", "recMessageTransportInfo", ".", "getField", "(", "MessageTransportInfo", ".", "MESSAGE_TRANSPORT_ID", ")", ".", "moveFieldToThis", "(", "recMessageTransport", ".", "getField", "(", "MessageTransport", ".", "ID", ")", ")", ";", "recMessageTransportInfo", ".", "getField", "(", "MessageTransportInfo", ".", "MESSAGE_VERSION_ID", ")", ".", "moveFieldToThis", "(", "recMessageVersion", ".", "getField", "(", "MessageVersion", ".", "ID", ")", ")", ";", "if", "(", "recMessageTransportInfo", ".", "seek", "(", "DBConstants", ".", "EQUALS", ")", ")", "{", "this", ".", "addProcessForWSDL", "(", "strTargetVersion", ",", "typeObject", ",", "recMessageProcessInfo", ",", "type", ")", ";", "}", "}", "}", "}", "}", "}", "recMessageProcessInfo", ".", "close", "(", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "recMessageProcessInfo", ".", "free", "(", ")", ";", "}", "}" ]
ScanProcesses Method.
[ "ScanProcesses", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java#L155-L209
151,435
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java
CreateWSDL.getControlProperty
public String getControlProperty(String strKey, String strDefaultValue) { String strValue = ((PropertiesField)this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.PROPERTIES)).getProperty(strKey); if (strValue == null) { if (strDefaultValue == null) strDefaultValue = this.getDefaultValue(strKey); strValue = strDefaultValue; } return strValue; }
java
public String getControlProperty(String strKey, String strDefaultValue) { String strValue = ((PropertiesField)this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.PROPERTIES)).getProperty(strKey); if (strValue == null) { if (strDefaultValue == null) strDefaultValue = this.getDefaultValue(strKey); strValue = strDefaultValue; } return strValue; }
[ "public", "String", "getControlProperty", "(", "String", "strKey", ",", "String", "strDefaultValue", ")", "{", "String", "strValue", "=", "(", "(", "PropertiesField", ")", "this", ".", "getRecord", "(", "MessageControl", ".", "MESSAGE_CONTROL_FILE", ")", ".", "getField", "(", "MessageControl", ".", "PROPERTIES", ")", ")", ".", "getProperty", "(", "strKey", ")", ";", "if", "(", "strValue", "==", "null", ")", "{", "if", "(", "strDefaultValue", "==", "null", ")", "strDefaultValue", "=", "this", ".", "getDefaultValue", "(", "strKey", ")", ";", "strValue", "=", "strDefaultValue", ";", "}", "return", "strValue", ";", "}" ]
GetControlProperty Method.
[ "GetControlProperty", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java#L227-L237
151,436
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java
CreateWSDL.getDefaultValue
public String getDefaultValue(String strKey) { if (DESCRIPTIONS == null) DESCRIPTIONS = Utility.arrayToMap(DEFAULTS); return (String)DESCRIPTIONS.get(strKey); }
java
public String getDefaultValue(String strKey) { if (DESCRIPTIONS == null) DESCRIPTIONS = Utility.arrayToMap(DEFAULTS); return (String)DESCRIPTIONS.get(strKey); }
[ "public", "String", "getDefaultValue", "(", "String", "strKey", ")", "{", "if", "(", "DESCRIPTIONS", "==", "null", ")", "DESCRIPTIONS", "=", "Utility", ".", "arrayToMap", "(", "DEFAULTS", ")", ";", "return", "(", "String", ")", "DESCRIPTIONS", ".", "get", "(", "strKey", ")", ";", "}" ]
GetDefaultValue Method.
[ "GetDefaultValue", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java#L241-L246
151,437
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java
CreateWSDL.getURIProperty
public String getURIProperty(String strKey, String strDefaultValue) { String strValue = this.getControlProperty(strKey, strDefaultValue); return this.getURIValue(strValue); }
java
public String getURIProperty(String strKey, String strDefaultValue) { String strValue = this.getControlProperty(strKey, strDefaultValue); return this.getURIValue(strValue); }
[ "public", "String", "getURIProperty", "(", "String", "strKey", ",", "String", "strDefaultValue", ")", "{", "String", "strValue", "=", "this", ".", "getControlProperty", "(", "strKey", ",", "strDefaultValue", ")", ";", "return", "this", ".", "getURIValue", "(", "strValue", ")", ";", "}" ]
GetURIProperty Method.
[ "GetURIProperty", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java#L257-L261
151,438
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java
CreateWSDL.getURIValue
public String getURIValue(String strValue) { String strBaseURI = ((PropertiesField)this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.PROPERTIES)).getProperty(MessageControl.BASE_NAMESPACE_URI); if (strBaseURI == null) { strBaseURI = this.getProperty(DBParams.BASE_URL); // Defaults to same site as wsdl if (strBaseURI != null) if (strBaseURI.endsWith("/")) strBaseURI = strBaseURI.substring(0, strBaseURI.length() - 1); } if (strBaseURI != null) if (strBaseURI.indexOf("http://") != 0) strBaseURI = "http://" + strBaseURI; if (strBaseURI != null) { if (strValue == null) strValue = strBaseURI; else if ((strValue.indexOf("http://") != 0) || (strValue.startsWith("/"))) strValue = strBaseURI + strValue; } return strValue; }
java
public String getURIValue(String strValue) { String strBaseURI = ((PropertiesField)this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.PROPERTIES)).getProperty(MessageControl.BASE_NAMESPACE_URI); if (strBaseURI == null) { strBaseURI = this.getProperty(DBParams.BASE_URL); // Defaults to same site as wsdl if (strBaseURI != null) if (strBaseURI.endsWith("/")) strBaseURI = strBaseURI.substring(0, strBaseURI.length() - 1); } if (strBaseURI != null) if (strBaseURI.indexOf("http://") != 0) strBaseURI = "http://" + strBaseURI; if (strBaseURI != null) { if (strValue == null) strValue = strBaseURI; else if ((strValue.indexOf("http://") != 0) || (strValue.startsWith("/"))) strValue = strBaseURI + strValue; } return strValue; }
[ "public", "String", "getURIValue", "(", "String", "strValue", ")", "{", "String", "strBaseURI", "=", "(", "(", "PropertiesField", ")", "this", ".", "getRecord", "(", "MessageControl", ".", "MESSAGE_CONTROL_FILE", ")", ".", "getField", "(", "MessageControl", ".", "PROPERTIES", ")", ")", ".", "getProperty", "(", "MessageControl", ".", "BASE_NAMESPACE_URI", ")", ";", "if", "(", "strBaseURI", "==", "null", ")", "{", "strBaseURI", "=", "this", ".", "getProperty", "(", "DBParams", ".", "BASE_URL", ")", ";", "// Defaults to same site as wsdl", "if", "(", "strBaseURI", "!=", "null", ")", "if", "(", "strBaseURI", ".", "endsWith", "(", "\"/\"", ")", ")", "strBaseURI", "=", "strBaseURI", ".", "substring", "(", "0", ",", "strBaseURI", ".", "length", "(", ")", "-", "1", ")", ";", "}", "if", "(", "strBaseURI", "!=", "null", ")", "if", "(", "strBaseURI", ".", "indexOf", "(", "\"http://\"", ")", "!=", "0", ")", "strBaseURI", "=", "\"http://\"", "+", "strBaseURI", ";", "if", "(", "strBaseURI", "!=", "null", ")", "{", "if", "(", "strValue", "==", "null", ")", "strValue", "=", "strBaseURI", ";", "else", "if", "(", "(", "strValue", ".", "indexOf", "(", "\"http://\"", ")", "!=", "0", ")", "||", "(", "strValue", ".", "startsWith", "(", "\"/\"", ")", ")", ")", "strValue", "=", "strBaseURI", "+", "strValue", ";", "}", "return", "strValue", ";", "}" ]
GetURIValue Method.
[ "GetURIValue", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java#L265-L287
151,439
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java
CreateWSDL.getMessageIn
public MessageInfo getMessageIn(MessageProcessInfo recMessageProcessInfo) { return (MessageInfo)((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); }
java
public MessageInfo getMessageIn(MessageProcessInfo recMessageProcessInfo) { return (MessageInfo)((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); }
[ "public", "MessageInfo", "getMessageIn", "(", "MessageProcessInfo", "recMessageProcessInfo", ")", "{", "return", "(", "MessageInfo", ")", "(", "(", "ReferenceField", ")", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID", ")", ")", ".", "getReference", "(", ")", ";", "}" ]
GetMessageIn Method.
[ "GetMessageIn", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java#L291-L294
151,440
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java
CreateWSDL.getMessageOut
public MessageInfo getMessageOut(MessageProcessInfo recMessageProcessInfo) { MessageProcessInfo recMessageProcessInfo2 = (MessageProcessInfo)((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.REPLY_MESSAGE_PROCESS_INFO_ID)).getReference(); if (recMessageProcessInfo2 != null) return (MessageInfo)((ReferenceField)recMessageProcessInfo2.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); return null; }
java
public MessageInfo getMessageOut(MessageProcessInfo recMessageProcessInfo) { MessageProcessInfo recMessageProcessInfo2 = (MessageProcessInfo)((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.REPLY_MESSAGE_PROCESS_INFO_ID)).getReference(); if (recMessageProcessInfo2 != null) return (MessageInfo)((ReferenceField)recMessageProcessInfo2.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); return null; }
[ "public", "MessageInfo", "getMessageOut", "(", "MessageProcessInfo", "recMessageProcessInfo", ")", "{", "MessageProcessInfo", "recMessageProcessInfo2", "=", "(", "MessageProcessInfo", ")", "(", "(", "ReferenceField", ")", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "REPLY_MESSAGE_PROCESS_INFO_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "recMessageProcessInfo2", "!=", "null", ")", "return", "(", "MessageInfo", ")", "(", "(", "ReferenceField", ")", "recMessageProcessInfo2", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID", ")", ")", ".", "getReference", "(", ")", ";", "return", "null", ";", "}" ]
GetMessageOut Method.
[ "GetMessageOut", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java#L298-L304
151,441
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java
CreateWSDL.fixName
public String fixName(String name) { for (int i = 0; i < name.length(); i++) { if (Character.isWhitespace(name.charAt(i))) name = name.substring(0, i) + name.substring(i + 1); } return name; }
java
public String fixName(String name) { for (int i = 0; i < name.length(); i++) { if (Character.isWhitespace(name.charAt(i))) name = name.substring(0, i) + name.substring(i + 1); } return name; }
[ "public", "String", "fixName", "(", "String", "name", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "name", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "Character", ".", "isWhitespace", "(", "name", ".", "charAt", "(", "i", ")", ")", ")", "name", "=", "name", ".", "substring", "(", "0", ",", "i", ")", "+", "name", ".", "substring", "(", "i", "+", "1", ")", ";", "}", "return", "name", ";", "}" ]
FixName Method.
[ "FixName", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java#L308-L316
151,442
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java
CreateWSDL.getNamespace
public String getNamespace() { String strTargetVersion = this.getProperty("version"); if (strTargetVersion == null) strTargetVersion = this.getDefaultVersion(); return this.getMessageControl().getNamespaceFromVersion(strTargetVersion); }
java
public String getNamespace() { String strTargetVersion = this.getProperty("version"); if (strTargetVersion == null) strTargetVersion = this.getDefaultVersion(); return this.getMessageControl().getNamespaceFromVersion(strTargetVersion); }
[ "public", "String", "getNamespace", "(", ")", "{", "String", "strTargetVersion", "=", "this", ".", "getProperty", "(", "\"version\"", ")", ";", "if", "(", "strTargetVersion", "==", "null", ")", "strTargetVersion", "=", "this", ".", "getDefaultVersion", "(", ")", ";", "return", "this", ".", "getMessageControl", "(", ")", ".", "getNamespaceFromVersion", "(", "strTargetVersion", ")", ";", "}" ]
GetNamespace Method.
[ "GetNamespace", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL.java#L328-L334
151,443
jbundle/jbundle
app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTask.java
ProjectTask.linkLastPredecessor
public boolean linkLastPredecessor(Record recNewProjectTask, boolean bDisplayOption) { if ((recNewProjectTask == null) || (recNewProjectTask.getEditMode() != DBConstants.EDIT_ADD)) return false; // Being careful Object bookmark = recNewProjectTask.getLastModified(DBConstants.BOOKMARK_HANDLE); if (bookmark == null) return false; // Never if (m_recDetail == null) { RecordOwner recordOwner = this.getRecordOwner(); m_recDetail = new ProjectTask(recordOwner); if (recordOwner != null) recordOwner.removeRecord(m_recDetail); m_recDetail.addListener(new SubFileFilter(this)); } int iMoveMode = DBConstants.SCREEN_MOVE; m_recDetail.getKeyArea().setKeyOrder(DBConstants.DESCENDING); try { m_recDetail.close(); while (m_recDetail.hasNext()) { // Always m_recDetail.next(); if (m_recDetail.getHandle(DBConstants.BOOKMARK_HANDLE).equals(bookmark)) continue; // Don't use the one you just added if ((!m_recDetail.getField(ProjectTask.END_DATE_TIME).equals(this.getField(ProjectTask.END_DATE_TIME))) || (!m_recDetail.getField(ProjectTask.END_DATE_TIME).equals(recNewProjectTask.getField(ProjectTask.START_DATE_TIME)))) return false; // Never ProjectTaskPredecessor recProjectTaskPredecessor = this.getProjectTaskPredecessor(); recProjectTaskPredecessor.addNew(); recProjectTaskPredecessor.getField(ProjectTaskPredecessor.PROJECT_TASK_PREDECESSOR_ID).moveFieldToThis(m_recDetail.getField(ProjectTask.ID)); recProjectTaskPredecessor.getField(ProjectTaskPredecessor.PROJECT_TASK_ID).setData(bookmark); recProjectTaskPredecessor.getField(ProjectTaskPredecessor.PREDECESSOR_TYPE).setString(PredecessorTypeField.FINISH_START); recProjectTaskPredecessor.add(); this.getListener(UpdateChildrenHandler.class).setEnabledListener(false); this.edit(); ((DateTimeField)this.getField(ProjectTask.END_DATE_TIME)).moveFieldToThis(recNewProjectTask.getField(ProjectTask.END_DATE_TIME), bDisplayOption, iMoveMode); bookmark = this.getHandle(DBConstants.BOOKMARK_HANDLE); this.set(); this.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); return true; // Success - Survey unnecessary } } catch (DBException ex) { ex.printStackTrace(); } finally { this.getListener(UpdateChildrenHandler.class).setEnabledListener(true); m_recDetail.getKeyArea().setKeyOrder(DBConstants.ASCENDING); } return false; }
java
public boolean linkLastPredecessor(Record recNewProjectTask, boolean bDisplayOption) { if ((recNewProjectTask == null) || (recNewProjectTask.getEditMode() != DBConstants.EDIT_ADD)) return false; // Being careful Object bookmark = recNewProjectTask.getLastModified(DBConstants.BOOKMARK_HANDLE); if (bookmark == null) return false; // Never if (m_recDetail == null) { RecordOwner recordOwner = this.getRecordOwner(); m_recDetail = new ProjectTask(recordOwner); if (recordOwner != null) recordOwner.removeRecord(m_recDetail); m_recDetail.addListener(new SubFileFilter(this)); } int iMoveMode = DBConstants.SCREEN_MOVE; m_recDetail.getKeyArea().setKeyOrder(DBConstants.DESCENDING); try { m_recDetail.close(); while (m_recDetail.hasNext()) { // Always m_recDetail.next(); if (m_recDetail.getHandle(DBConstants.BOOKMARK_HANDLE).equals(bookmark)) continue; // Don't use the one you just added if ((!m_recDetail.getField(ProjectTask.END_DATE_TIME).equals(this.getField(ProjectTask.END_DATE_TIME))) || (!m_recDetail.getField(ProjectTask.END_DATE_TIME).equals(recNewProjectTask.getField(ProjectTask.START_DATE_TIME)))) return false; // Never ProjectTaskPredecessor recProjectTaskPredecessor = this.getProjectTaskPredecessor(); recProjectTaskPredecessor.addNew(); recProjectTaskPredecessor.getField(ProjectTaskPredecessor.PROJECT_TASK_PREDECESSOR_ID).moveFieldToThis(m_recDetail.getField(ProjectTask.ID)); recProjectTaskPredecessor.getField(ProjectTaskPredecessor.PROJECT_TASK_ID).setData(bookmark); recProjectTaskPredecessor.getField(ProjectTaskPredecessor.PREDECESSOR_TYPE).setString(PredecessorTypeField.FINISH_START); recProjectTaskPredecessor.add(); this.getListener(UpdateChildrenHandler.class).setEnabledListener(false); this.edit(); ((DateTimeField)this.getField(ProjectTask.END_DATE_TIME)).moveFieldToThis(recNewProjectTask.getField(ProjectTask.END_DATE_TIME), bDisplayOption, iMoveMode); bookmark = this.getHandle(DBConstants.BOOKMARK_HANDLE); this.set(); this.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); return true; // Success - Survey unnecessary } } catch (DBException ex) { ex.printStackTrace(); } finally { this.getListener(UpdateChildrenHandler.class).setEnabledListener(true); m_recDetail.getKeyArea().setKeyOrder(DBConstants.ASCENDING); } return false; }
[ "public", "boolean", "linkLastPredecessor", "(", "Record", "recNewProjectTask", ",", "boolean", "bDisplayOption", ")", "{", "if", "(", "(", "recNewProjectTask", "==", "null", ")", "||", "(", "recNewProjectTask", ".", "getEditMode", "(", ")", "!=", "DBConstants", ".", "EDIT_ADD", ")", ")", "return", "false", ";", "// Being careful", "Object", "bookmark", "=", "recNewProjectTask", ".", "getLastModified", "(", "DBConstants", ".", "BOOKMARK_HANDLE", ")", ";", "if", "(", "bookmark", "==", "null", ")", "return", "false", ";", "// Never", "if", "(", "m_recDetail", "==", "null", ")", "{", "RecordOwner", "recordOwner", "=", "this", ".", "getRecordOwner", "(", ")", ";", "m_recDetail", "=", "new", "ProjectTask", "(", "recordOwner", ")", ";", "if", "(", "recordOwner", "!=", "null", ")", "recordOwner", ".", "removeRecord", "(", "m_recDetail", ")", ";", "m_recDetail", ".", "addListener", "(", "new", "SubFileFilter", "(", "this", ")", ")", ";", "}", "int", "iMoveMode", "=", "DBConstants", ".", "SCREEN_MOVE", ";", "m_recDetail", ".", "getKeyArea", "(", ")", ".", "setKeyOrder", "(", "DBConstants", ".", "DESCENDING", ")", ";", "try", "{", "m_recDetail", ".", "close", "(", ")", ";", "while", "(", "m_recDetail", ".", "hasNext", "(", ")", ")", "{", "// Always", "m_recDetail", ".", "next", "(", ")", ";", "if", "(", "m_recDetail", ".", "getHandle", "(", "DBConstants", ".", "BOOKMARK_HANDLE", ")", ".", "equals", "(", "bookmark", ")", ")", "continue", ";", "// Don't use the one you just added", "if", "(", "(", "!", "m_recDetail", ".", "getField", "(", "ProjectTask", ".", "END_DATE_TIME", ")", ".", "equals", "(", "this", ".", "getField", "(", "ProjectTask", ".", "END_DATE_TIME", ")", ")", ")", "||", "(", "!", "m_recDetail", ".", "getField", "(", "ProjectTask", ".", "END_DATE_TIME", ")", ".", "equals", "(", "recNewProjectTask", ".", "getField", "(", "ProjectTask", ".", "START_DATE_TIME", ")", ")", ")", ")", "return", "false", ";", "// Never", "ProjectTaskPredecessor", "recProjectTaskPredecessor", "=", "this", ".", "getProjectTaskPredecessor", "(", ")", ";", "recProjectTaskPredecessor", ".", "addNew", "(", ")", ";", "recProjectTaskPredecessor", ".", "getField", "(", "ProjectTaskPredecessor", ".", "PROJECT_TASK_PREDECESSOR_ID", ")", ".", "moveFieldToThis", "(", "m_recDetail", ".", "getField", "(", "ProjectTask", ".", "ID", ")", ")", ";", "recProjectTaskPredecessor", ".", "getField", "(", "ProjectTaskPredecessor", ".", "PROJECT_TASK_ID", ")", ".", "setData", "(", "bookmark", ")", ";", "recProjectTaskPredecessor", ".", "getField", "(", "ProjectTaskPredecessor", ".", "PREDECESSOR_TYPE", ")", ".", "setString", "(", "PredecessorTypeField", ".", "FINISH_START", ")", ";", "recProjectTaskPredecessor", ".", "add", "(", ")", ";", "this", ".", "getListener", "(", "UpdateChildrenHandler", ".", "class", ")", ".", "setEnabledListener", "(", "false", ")", ";", "this", ".", "edit", "(", ")", ";", "(", "(", "DateTimeField", ")", "this", ".", "getField", "(", "ProjectTask", ".", "END_DATE_TIME", ")", ")", ".", "moveFieldToThis", "(", "recNewProjectTask", ".", "getField", "(", "ProjectTask", ".", "END_DATE_TIME", ")", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "bookmark", "=", "this", ".", "getHandle", "(", "DBConstants", ".", "BOOKMARK_HANDLE", ")", ";", "this", ".", "set", "(", ")", ";", "this", ".", "setHandle", "(", "bookmark", ",", "DBConstants", ".", "BOOKMARK_HANDLE", ")", ";", "return", "true", ";", "// Success - Survey unnecessary", "}", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "this", ".", "getListener", "(", "UpdateChildrenHandler", ".", "class", ")", ".", "setEnabledListener", "(", "true", ")", ";", "m_recDetail", ".", "getKeyArea", "(", ")", ".", "setKeyOrder", "(", "DBConstants", ".", "ASCENDING", ")", ";", "}", "return", "false", ";", "}" ]
LinkLastPredecessor Method.
[ "LinkLastPredecessor", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTask.java#L310-L362
151,444
jbundle/jbundle
app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTask.java
ProjectTask.updateChildren
public boolean updateChildren(boolean bDisplayOption) { int iMoveMode = DBConstants.SCREEN_MOVE; ProjectTask recDetailChildren = this.getDetailChildren(); Date startDate = ((DateTimeField)this.getField(ProjectTask.START_DATE_TIME)).getDateTime(); Date endDate = ((DateTimeField)this.getField(ProjectTask.END_DATE_TIME)).getDateTime(); try { boolean bFirstRecord = true; double dOffset = 0; recDetailChildren.getListener(SurveyDatesHandler.class).setEnabledListener(false); ((UpdateDependenciesHandler)recDetailChildren.getListener(UpdateDependenciesHandler.class)).setMoveSiblingDependents(false); recDetailChildren.close(); while (recDetailChildren.hasNext()) { recDetailChildren.next(); Date thisStartDate = ((DateTimeField)recDetailChildren.getField(ProjectTask.START_DATE_TIME)).getDateTime(); Date thisEndDate = ((DateTimeField)recDetailChildren.getField(ProjectTask.END_DATE_TIME)).getDateTime(); if (bFirstRecord) { bFirstRecord = false; if ((thisStartDate == null) || (thisEndDate == null) || (startDate == null) || (endDate == null)) break; if (thisStartDate.equals(startDate)) break; dOffset = startDate.getTime() - thisStartDate.getTime(); if ((dOffset >= -1000) && (dOffset <= 1000)) break; } recDetailChildren.edit(); Converter.gCalendar = ((DateTimeField)recDetailChildren.getField(ProjectTask.START_DATE_TIME)).getCalendar(); Converter.gCalendar.add(Calendar.MILLISECOND, (int)dOffset); ((DateTimeField)recDetailChildren.getField(ProjectTask.START_DATE_TIME)).setCalendar(Converter.gCalendar, bDisplayOption, iMoveMode); recDetailChildren.set(); } } catch (DBException ex) { ex.printStackTrace(); } finally { recDetailChildren.getListener(SurveyDatesHandler.class).setEnabledListener(true); ((UpdateDependenciesHandler)recDetailChildren.getListener(UpdateDependenciesHandler.class)).setMoveSiblingDependents(true); } return false; // No update required }
java
public boolean updateChildren(boolean bDisplayOption) { int iMoveMode = DBConstants.SCREEN_MOVE; ProjectTask recDetailChildren = this.getDetailChildren(); Date startDate = ((DateTimeField)this.getField(ProjectTask.START_DATE_TIME)).getDateTime(); Date endDate = ((DateTimeField)this.getField(ProjectTask.END_DATE_TIME)).getDateTime(); try { boolean bFirstRecord = true; double dOffset = 0; recDetailChildren.getListener(SurveyDatesHandler.class).setEnabledListener(false); ((UpdateDependenciesHandler)recDetailChildren.getListener(UpdateDependenciesHandler.class)).setMoveSiblingDependents(false); recDetailChildren.close(); while (recDetailChildren.hasNext()) { recDetailChildren.next(); Date thisStartDate = ((DateTimeField)recDetailChildren.getField(ProjectTask.START_DATE_TIME)).getDateTime(); Date thisEndDate = ((DateTimeField)recDetailChildren.getField(ProjectTask.END_DATE_TIME)).getDateTime(); if (bFirstRecord) { bFirstRecord = false; if ((thisStartDate == null) || (thisEndDate == null) || (startDate == null) || (endDate == null)) break; if (thisStartDate.equals(startDate)) break; dOffset = startDate.getTime() - thisStartDate.getTime(); if ((dOffset >= -1000) && (dOffset <= 1000)) break; } recDetailChildren.edit(); Converter.gCalendar = ((DateTimeField)recDetailChildren.getField(ProjectTask.START_DATE_TIME)).getCalendar(); Converter.gCalendar.add(Calendar.MILLISECOND, (int)dOffset); ((DateTimeField)recDetailChildren.getField(ProjectTask.START_DATE_TIME)).setCalendar(Converter.gCalendar, bDisplayOption, iMoveMode); recDetailChildren.set(); } } catch (DBException ex) { ex.printStackTrace(); } finally { recDetailChildren.getListener(SurveyDatesHandler.class).setEnabledListener(true); ((UpdateDependenciesHandler)recDetailChildren.getListener(UpdateDependenciesHandler.class)).setMoveSiblingDependents(true); } return false; // No update required }
[ "public", "boolean", "updateChildren", "(", "boolean", "bDisplayOption", ")", "{", "int", "iMoveMode", "=", "DBConstants", ".", "SCREEN_MOVE", ";", "ProjectTask", "recDetailChildren", "=", "this", ".", "getDetailChildren", "(", ")", ";", "Date", "startDate", "=", "(", "(", "DateTimeField", ")", "this", ".", "getField", "(", "ProjectTask", ".", "START_DATE_TIME", ")", ")", ".", "getDateTime", "(", ")", ";", "Date", "endDate", "=", "(", "(", "DateTimeField", ")", "this", ".", "getField", "(", "ProjectTask", ".", "END_DATE_TIME", ")", ")", ".", "getDateTime", "(", ")", ";", "try", "{", "boolean", "bFirstRecord", "=", "true", ";", "double", "dOffset", "=", "0", ";", "recDetailChildren", ".", "getListener", "(", "SurveyDatesHandler", ".", "class", ")", ".", "setEnabledListener", "(", "false", ")", ";", "(", "(", "UpdateDependenciesHandler", ")", "recDetailChildren", ".", "getListener", "(", "UpdateDependenciesHandler", ".", "class", ")", ")", ".", "setMoveSiblingDependents", "(", "false", ")", ";", "recDetailChildren", ".", "close", "(", ")", ";", "while", "(", "recDetailChildren", ".", "hasNext", "(", ")", ")", "{", "recDetailChildren", ".", "next", "(", ")", ";", "Date", "thisStartDate", "=", "(", "(", "DateTimeField", ")", "recDetailChildren", ".", "getField", "(", "ProjectTask", ".", "START_DATE_TIME", ")", ")", ".", "getDateTime", "(", ")", ";", "Date", "thisEndDate", "=", "(", "(", "DateTimeField", ")", "recDetailChildren", ".", "getField", "(", "ProjectTask", ".", "END_DATE_TIME", ")", ")", ".", "getDateTime", "(", ")", ";", "if", "(", "bFirstRecord", ")", "{", "bFirstRecord", "=", "false", ";", "if", "(", "(", "thisStartDate", "==", "null", ")", "||", "(", "thisEndDate", "==", "null", ")", "||", "(", "startDate", "==", "null", ")", "||", "(", "endDate", "==", "null", ")", ")", "break", ";", "if", "(", "thisStartDate", ".", "equals", "(", "startDate", ")", ")", "break", ";", "dOffset", "=", "startDate", ".", "getTime", "(", ")", "-", "thisStartDate", ".", "getTime", "(", ")", ";", "if", "(", "(", "dOffset", ">=", "-", "1000", ")", "&&", "(", "dOffset", "<=", "1000", ")", ")", "break", ";", "}", "recDetailChildren", ".", "edit", "(", ")", ";", "Converter", ".", "gCalendar", "=", "(", "(", "DateTimeField", ")", "recDetailChildren", ".", "getField", "(", "ProjectTask", ".", "START_DATE_TIME", ")", ")", ".", "getCalendar", "(", ")", ";", "Converter", ".", "gCalendar", ".", "add", "(", "Calendar", ".", "MILLISECOND", ",", "(", "int", ")", "dOffset", ")", ";", "(", "(", "DateTimeField", ")", "recDetailChildren", ".", "getField", "(", "ProjectTask", ".", "START_DATE_TIME", ")", ")", ".", "setCalendar", "(", "Converter", ".", "gCalendar", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "recDetailChildren", ".", "set", "(", ")", ";", "}", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "recDetailChildren", ".", "getListener", "(", "SurveyDatesHandler", ".", "class", ")", ".", "setEnabledListener", "(", "true", ")", ";", "(", "(", "UpdateDependenciesHandler", ")", "recDetailChildren", ".", "getListener", "(", "UpdateDependenciesHandler", ".", "class", ")", ")", ".", "setMoveSiblingDependents", "(", "true", ")", ";", "}", "return", "false", ";", "// No update required", "}" ]
UpdateChildren Method.
[ "UpdateChildren", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTask.java#L366-L407
151,445
jbundle/jbundle
app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTask.java
ProjectTask.surveyDates
public boolean surveyDates(boolean bDisplayOption) { if (m_recDetail == null) { RecordOwner recordOwner = this.getRecordOwner(); m_recDetail = new ProjectTask(recordOwner); if (recordOwner != null) recordOwner.removeRecord(m_recDetail); m_recDetail.addListener(new SubFileFilter(this, true)); } Date startDate = null; Date endDate = null; try { m_recDetail.close(); while (m_recDetail.hasNext()) { m_recDetail.next(); Date thisStartDate = null; if (!m_recDetail.getField(ProjectTask.START_DATE_TIME).isNull()) thisStartDate = ((DateTimeField)m_recDetail.getField(ProjectTask.START_DATE_TIME)).getDateTime(); if (thisStartDate != null) if ((startDate == null) || (thisStartDate.before(startDate))) startDate = thisStartDate; Date thisEndDate = null; if (!m_recDetail.getField(ProjectTask.END_DATE_TIME).isNull()) thisEndDate = ((DateTimeField)m_recDetail.getField(ProjectTask.END_DATE_TIME)).getDateTime(); if (thisEndDate != null) if ((endDate == null) || (thisEndDate.after(endDate))) endDate = thisEndDate; } this.getListener(UpdateChildrenHandler.class).setEnabledListener(false); this.edit(); int iMoveMode = DBConstants.SCREEN_MOVE; if (startDate != null) ((DateTimeField)this.getField(ProjectTask.START_DATE_TIME)).setDateTime(startDate, bDisplayOption, iMoveMode); if (endDate != null) ((DateTimeField)this.getField(ProjectTask.END_DATE_TIME)).setDateTime(endDate, bDisplayOption, iMoveMode); boolean bHasChildren = true; if ((startDate == null) && (endDate == null)) bHasChildren = false; this.getField(ProjectTask.HAS_CHILDREN).setState(bHasChildren); if (this.isModified()) { Object bookmark = this.getHandle(DBConstants.BOOKMARK_HANDLE); this.set(); this.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); return true; // Record updated } } catch (DBException ex) { ex.printStackTrace(); } finally { this.getListener(UpdateChildrenHandler.class).setEnabledListener(true); } return false; // No update required }
java
public boolean surveyDates(boolean bDisplayOption) { if (m_recDetail == null) { RecordOwner recordOwner = this.getRecordOwner(); m_recDetail = new ProjectTask(recordOwner); if (recordOwner != null) recordOwner.removeRecord(m_recDetail); m_recDetail.addListener(new SubFileFilter(this, true)); } Date startDate = null; Date endDate = null; try { m_recDetail.close(); while (m_recDetail.hasNext()) { m_recDetail.next(); Date thisStartDate = null; if (!m_recDetail.getField(ProjectTask.START_DATE_TIME).isNull()) thisStartDate = ((DateTimeField)m_recDetail.getField(ProjectTask.START_DATE_TIME)).getDateTime(); if (thisStartDate != null) if ((startDate == null) || (thisStartDate.before(startDate))) startDate = thisStartDate; Date thisEndDate = null; if (!m_recDetail.getField(ProjectTask.END_DATE_TIME).isNull()) thisEndDate = ((DateTimeField)m_recDetail.getField(ProjectTask.END_DATE_TIME)).getDateTime(); if (thisEndDate != null) if ((endDate == null) || (thisEndDate.after(endDate))) endDate = thisEndDate; } this.getListener(UpdateChildrenHandler.class).setEnabledListener(false); this.edit(); int iMoveMode = DBConstants.SCREEN_MOVE; if (startDate != null) ((DateTimeField)this.getField(ProjectTask.START_DATE_TIME)).setDateTime(startDate, bDisplayOption, iMoveMode); if (endDate != null) ((DateTimeField)this.getField(ProjectTask.END_DATE_TIME)).setDateTime(endDate, bDisplayOption, iMoveMode); boolean bHasChildren = true; if ((startDate == null) && (endDate == null)) bHasChildren = false; this.getField(ProjectTask.HAS_CHILDREN).setState(bHasChildren); if (this.isModified()) { Object bookmark = this.getHandle(DBConstants.BOOKMARK_HANDLE); this.set(); this.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); return true; // Record updated } } catch (DBException ex) { ex.printStackTrace(); } finally { this.getListener(UpdateChildrenHandler.class).setEnabledListener(true); } return false; // No update required }
[ "public", "boolean", "surveyDates", "(", "boolean", "bDisplayOption", ")", "{", "if", "(", "m_recDetail", "==", "null", ")", "{", "RecordOwner", "recordOwner", "=", "this", ".", "getRecordOwner", "(", ")", ";", "m_recDetail", "=", "new", "ProjectTask", "(", "recordOwner", ")", ";", "if", "(", "recordOwner", "!=", "null", ")", "recordOwner", ".", "removeRecord", "(", "m_recDetail", ")", ";", "m_recDetail", ".", "addListener", "(", "new", "SubFileFilter", "(", "this", ",", "true", ")", ")", ";", "}", "Date", "startDate", "=", "null", ";", "Date", "endDate", "=", "null", ";", "try", "{", "m_recDetail", ".", "close", "(", ")", ";", "while", "(", "m_recDetail", ".", "hasNext", "(", ")", ")", "{", "m_recDetail", ".", "next", "(", ")", ";", "Date", "thisStartDate", "=", "null", ";", "if", "(", "!", "m_recDetail", ".", "getField", "(", "ProjectTask", ".", "START_DATE_TIME", ")", ".", "isNull", "(", ")", ")", "thisStartDate", "=", "(", "(", "DateTimeField", ")", "m_recDetail", ".", "getField", "(", "ProjectTask", ".", "START_DATE_TIME", ")", ")", ".", "getDateTime", "(", ")", ";", "if", "(", "thisStartDate", "!=", "null", ")", "if", "(", "(", "startDate", "==", "null", ")", "||", "(", "thisStartDate", ".", "before", "(", "startDate", ")", ")", ")", "startDate", "=", "thisStartDate", ";", "Date", "thisEndDate", "=", "null", ";", "if", "(", "!", "m_recDetail", ".", "getField", "(", "ProjectTask", ".", "END_DATE_TIME", ")", ".", "isNull", "(", ")", ")", "thisEndDate", "=", "(", "(", "DateTimeField", ")", "m_recDetail", ".", "getField", "(", "ProjectTask", ".", "END_DATE_TIME", ")", ")", ".", "getDateTime", "(", ")", ";", "if", "(", "thisEndDate", "!=", "null", ")", "if", "(", "(", "endDate", "==", "null", ")", "||", "(", "thisEndDate", ".", "after", "(", "endDate", ")", ")", ")", "endDate", "=", "thisEndDate", ";", "}", "this", ".", "getListener", "(", "UpdateChildrenHandler", ".", "class", ")", ".", "setEnabledListener", "(", "false", ")", ";", "this", ".", "edit", "(", ")", ";", "int", "iMoveMode", "=", "DBConstants", ".", "SCREEN_MOVE", ";", "if", "(", "startDate", "!=", "null", ")", "(", "(", "DateTimeField", ")", "this", ".", "getField", "(", "ProjectTask", ".", "START_DATE_TIME", ")", ")", ".", "setDateTime", "(", "startDate", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "if", "(", "endDate", "!=", "null", ")", "(", "(", "DateTimeField", ")", "this", ".", "getField", "(", "ProjectTask", ".", "END_DATE_TIME", ")", ")", ".", "setDateTime", "(", "endDate", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "boolean", "bHasChildren", "=", "true", ";", "if", "(", "(", "startDate", "==", "null", ")", "&&", "(", "endDate", "==", "null", ")", ")", "bHasChildren", "=", "false", ";", "this", ".", "getField", "(", "ProjectTask", ".", "HAS_CHILDREN", ")", ".", "setState", "(", "bHasChildren", ")", ";", "if", "(", "this", ".", "isModified", "(", ")", ")", "{", "Object", "bookmark", "=", "this", ".", "getHandle", "(", "DBConstants", ".", "BOOKMARK_HANDLE", ")", ";", "this", ".", "set", "(", ")", ";", "this", ".", "setHandle", "(", "bookmark", ",", "DBConstants", ".", "BOOKMARK_HANDLE", ")", ";", "return", "true", ";", "// Record updated", "}", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "this", ".", "getListener", "(", "UpdateChildrenHandler", ".", "class", ")", ".", "setEnabledListener", "(", "true", ")", ";", "}", "return", "false", ";", "// No update required", "}" ]
SurveyDates Method.
[ "SurveyDates", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTask.java#L519-L575
151,446
jbundle/jbundle
app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTask.java
ProjectTask.getProjectTaskPredecessor
public ProjectTaskPredecessor getProjectTaskPredecessor() { if (m_recProjectTaskPredecessor == null) { m_recProjectTaskPredecessor = new ProjectTaskPredecessor(this.getRecordOwner()); // Must have the sub-records set up in advance to EEP them from mixing with this record. ((ReferenceField)m_recProjectTaskPredecessor.getField(ProjectTaskPredecessor.PROJECT_TASK_ID)).getReferenceRecord(); ((ReferenceField)m_recProjectTaskPredecessor.getField(ProjectTaskPredecessor.PROJECT_TASK_PREDECESSOR_ID)).getReferenceRecord(); } return m_recProjectTaskPredecessor; }
java
public ProjectTaskPredecessor getProjectTaskPredecessor() { if (m_recProjectTaskPredecessor == null) { m_recProjectTaskPredecessor = new ProjectTaskPredecessor(this.getRecordOwner()); // Must have the sub-records set up in advance to EEP them from mixing with this record. ((ReferenceField)m_recProjectTaskPredecessor.getField(ProjectTaskPredecessor.PROJECT_TASK_ID)).getReferenceRecord(); ((ReferenceField)m_recProjectTaskPredecessor.getField(ProjectTaskPredecessor.PROJECT_TASK_PREDECESSOR_ID)).getReferenceRecord(); } return m_recProjectTaskPredecessor; }
[ "public", "ProjectTaskPredecessor", "getProjectTaskPredecessor", "(", ")", "{", "if", "(", "m_recProjectTaskPredecessor", "==", "null", ")", "{", "m_recProjectTaskPredecessor", "=", "new", "ProjectTaskPredecessor", "(", "this", ".", "getRecordOwner", "(", ")", ")", ";", "// Must have the sub-records set up in advance to EEP them from mixing with this record.", "(", "(", "ReferenceField", ")", "m_recProjectTaskPredecessor", ".", "getField", "(", "ProjectTaskPredecessor", ".", "PROJECT_TASK_ID", ")", ")", ".", "getReferenceRecord", "(", ")", ";", "(", "(", "ReferenceField", ")", "m_recProjectTaskPredecessor", ".", "getField", "(", "ProjectTaskPredecessor", ".", "PROJECT_TASK_PREDECESSOR_ID", ")", ")", ".", "getReferenceRecord", "(", ")", ";", "}", "return", "m_recProjectTaskPredecessor", ";", "}" ]
GetProjectTaskPredecessor Method.
[ "GetProjectTaskPredecessor", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTask.java#L579-L589
151,447
jbundle/jbundle
app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTask.java
ProjectTask.getDetailChildren
public ProjectTask getDetailChildren() { if (m_recDetailChildren == null) { RecordOwner recordOwner = this.getRecordOwner(); m_recDetailChildren = new ProjectTask(recordOwner); if (recordOwner != null) recordOwner.removeRecord(m_recDetailChildren); m_recDetailChildren.addListener(new SubFileFilter(this, true)); } return m_recDetailChildren; }
java
public ProjectTask getDetailChildren() { if (m_recDetailChildren == null) { RecordOwner recordOwner = this.getRecordOwner(); m_recDetailChildren = new ProjectTask(recordOwner); if (recordOwner != null) recordOwner.removeRecord(m_recDetailChildren); m_recDetailChildren.addListener(new SubFileFilter(this, true)); } return m_recDetailChildren; }
[ "public", "ProjectTask", "getDetailChildren", "(", ")", "{", "if", "(", "m_recDetailChildren", "==", "null", ")", "{", "RecordOwner", "recordOwner", "=", "this", ".", "getRecordOwner", "(", ")", ";", "m_recDetailChildren", "=", "new", "ProjectTask", "(", "recordOwner", ")", ";", "if", "(", "recordOwner", "!=", "null", ")", "recordOwner", ".", "removeRecord", "(", "m_recDetailChildren", ")", ";", "m_recDetailChildren", ".", "addListener", "(", "new", "SubFileFilter", "(", "this", ",", "true", ")", ")", ";", "}", "return", "m_recDetailChildren", ";", "}" ]
GetDetailChildren Method.
[ "GetDetailChildren", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTask.java#L600-L611
151,448
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/InitIfSubFieldHandler.java
InitIfSubFieldHandler.doSetData
public int doSetData(Object fieldPtr, boolean bDisplayOption, int iMoveMode) { int iErrorCode = DBConstants.NORMAL_RETURN; boolean bSubExists = (this.getOwner().getRecord().getListener(SubFileFilter.class.getName()) != null); if (bSubExists) iErrorCode = super.doSetData(fieldPtr, bDisplayOption, iMoveMode); return iErrorCode; }
java
public int doSetData(Object fieldPtr, boolean bDisplayOption, int iMoveMode) { int iErrorCode = DBConstants.NORMAL_RETURN; boolean bSubExists = (this.getOwner().getRecord().getListener(SubFileFilter.class.getName()) != null); if (bSubExists) iErrorCode = super.doSetData(fieldPtr, bDisplayOption, iMoveMode); return iErrorCode; }
[ "public", "int", "doSetData", "(", "Object", "fieldPtr", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "int", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "boolean", "bSubExists", "=", "(", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getListener", "(", "SubFileFilter", ".", "class", ".", "getName", "(", ")", ")", "!=", "null", ")", ";", "if", "(", "bSubExists", ")", "iErrorCode", "=", "super", ".", "doSetData", "(", "fieldPtr", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "return", "iErrorCode", ";", "}" ]
Move the physical binary data to this field. If there is not SubFileFilter, then don't allow the field to be inited. @param objData the raw data to set the basefield to. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "Move", "the", "physical", "binary", "data", "to", "this", "field", ".", "If", "there", "is", "not", "SubFileFilter", "then", "don", "t", "allow", "the", "field", "to", "be", "inited", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/InitIfSubFieldHandler.java#L61-L68
151,449
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XButtonBox.java
XButtonBox.isSingleDataImage
public boolean isSingleDataImage() { if (this.getScreenField().getConverter() != null) if (this.getScreenField().getConverter().getField() != null) if (this.getScreenField().getConverter().getField().getComponent(1) == null) return true; return false; }
java
public boolean isSingleDataImage() { if (this.getScreenField().getConverter() != null) if (this.getScreenField().getConverter().getField() != null) if (this.getScreenField().getConverter().getField().getComponent(1) == null) return true; return false; }
[ "public", "boolean", "isSingleDataImage", "(", ")", "{", "if", "(", "this", ".", "getScreenField", "(", ")", ".", "getConverter", "(", ")", "!=", "null", ")", "if", "(", "this", ".", "getScreenField", "(", ")", ".", "getConverter", "(", ")", ".", "getField", "(", ")", "!=", "null", ")", "if", "(", "this", ".", "getScreenField", "(", ")", ".", "getConverter", "(", ")", ".", "getField", "(", ")", ".", "getComponent", "(", "1", ")", "==", "null", ")", "return", "true", ";", "return", "false", ";", "}" ]
Special case - if this button is linked to data and this is the only sfield, then display it. @return
[ "Special", "case", "-", "if", "this", "button", "is", "linked", "to", "data", "and", "this", "is", "the", "only", "sfield", "then", "display", "it", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XButtonBox.java#L84-L91
151,450
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/dialogs/DirectorySelector.java
DirectorySelector.ok
protected final void ok() { final String dir = panel.getDirectory(); final boolean include = panel.isIncludeSubdirs(); close(); listener.finished(dir, include); }
java
protected final void ok() { final String dir = panel.getDirectory(); final boolean include = panel.isIncludeSubdirs(); close(); listener.finished(dir, include); }
[ "protected", "final", "void", "ok", "(", ")", "{", "final", "String", "dir", "=", "panel", ".", "getDirectory", "(", ")", ";", "final", "boolean", "include", "=", "panel", ".", "isIncludeSubdirs", "(", ")", ";", "close", "(", ")", ";", "listener", ".", "finished", "(", "dir", ",", "include", ")", ";", "}" ]
The dialog was successfully finished.
[ "The", "dialog", "was", "successfully", "finished", "." ]
560fb69eac182e3473de9679c3c15433e524ef6b
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/dialogs/DirectorySelector.java#L183-L188
151,451
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/dialogs/DirectorySelector.java
DirectorySelector.main
public static void main(final String[] args) throws IOException { Utils4Swing.initSystemLookAndFeel(); DirectorySelector.Result result; try { result = DirectorySelector.selectDirectory( "Please select the destination directory:", new File(".") .getCanonicalPath(), true); System.out.println("SELECTED=" + result.getDirectory() + ", SUBDIRS=" + result.isIncludeSubdirs()); } catch (CanceledException e) { System.out.println("CANCELED!"); } }
java
public static void main(final String[] args) throws IOException { Utils4Swing.initSystemLookAndFeel(); DirectorySelector.Result result; try { result = DirectorySelector.selectDirectory( "Please select the destination directory:", new File(".") .getCanonicalPath(), true); System.out.println("SELECTED=" + result.getDirectory() + ", SUBDIRS=" + result.isIncludeSubdirs()); } catch (CanceledException e) { System.out.println("CANCELED!"); } }
[ "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "throws", "IOException", "{", "Utils4Swing", ".", "initSystemLookAndFeel", "(", ")", ";", "DirectorySelector", ".", "Result", "result", ";", "try", "{", "result", "=", "DirectorySelector", ".", "selectDirectory", "(", "\"Please select the destination directory:\"", ",", "new", "File", "(", "\".\"", ")", ".", "getCanonicalPath", "(", ")", ",", "true", ")", ";", "System", ".", "out", ".", "println", "(", "\"SELECTED=\"", "+", "result", ".", "getDirectory", "(", ")", "+", "\", SUBDIRS=\"", "+", "result", ".", "isIncludeSubdirs", "(", ")", ")", ";", "}", "catch", "(", "CanceledException", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"CANCELED!\"", ")", ";", "}", "}" ]
Starts the selector for a test. @param args Not used. @throws IOException Error creating the canonical path for the current directory.
[ "Starts", "the", "selector", "for", "a", "test", "." ]
560fb69eac182e3473de9679c3c15433e524ef6b
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/dialogs/DirectorySelector.java#L358-L370
151,452
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/message/ReceiveQueueSession.java
ReceiveQueueSession.handleMessage
public int handleMessage(BaseMessage message) { Utility.getLogger().info("RemoteQueue handling message " + message); if (message.getProcessedByClientSession() == this.getParentSession()) return DBConstants.NORMAL_RETURN; // Do not process this message (the client has already taken care of it). //? if (message.getProcessedByClientSession() instanceof RemoteObject) //? if (this.getParentSession() instanceof RemoteObject) // Always //? if (((RemoteObject)this.getParentSession()).getRef().remoteEquals(((RemoteObject)message.getProcessedByClientSession()).getRef())) //? return DBConstants.NORMAL_RETURN; // Same client. if (message == m_messageLastMessage) return DBConstants.NORMAL_RETURN; // Don't send a message to the same client twice. m_messageLastMessage = message; this.getMessageStack().sendMessage(message); return DBConstants.NORMAL_RETURN; }
java
public int handleMessage(BaseMessage message) { Utility.getLogger().info("RemoteQueue handling message " + message); if (message.getProcessedByClientSession() == this.getParentSession()) return DBConstants.NORMAL_RETURN; // Do not process this message (the client has already taken care of it). //? if (message.getProcessedByClientSession() instanceof RemoteObject) //? if (this.getParentSession() instanceof RemoteObject) // Always //? if (((RemoteObject)this.getParentSession()).getRef().remoteEquals(((RemoteObject)message.getProcessedByClientSession()).getRef())) //? return DBConstants.NORMAL_RETURN; // Same client. if (message == m_messageLastMessage) return DBConstants.NORMAL_RETURN; // Don't send a message to the same client twice. m_messageLastMessage = message; this.getMessageStack().sendMessage(message); return DBConstants.NORMAL_RETURN; }
[ "public", "int", "handleMessage", "(", "BaseMessage", "message", ")", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"RemoteQueue handling message \"", "+", "message", ")", ";", "if", "(", "message", ".", "getProcessedByClientSession", "(", ")", "==", "this", ".", "getParentSession", "(", ")", ")", "return", "DBConstants", ".", "NORMAL_RETURN", ";", "// Do not process this message (the client has already taken care of it).", "//? if (message.getProcessedByClientSession() instanceof RemoteObject)", "//? if (this.getParentSession() instanceof RemoteObject) // Always", "//? if (((RemoteObject)this.getParentSession()).getRef().remoteEquals(((RemoteObject)message.getProcessedByClientSession()).getRef()))", "//? return DBConstants.NORMAL_RETURN; // Same client.", "if", "(", "message", "==", "m_messageLastMessage", ")", "return", "DBConstants", ".", "NORMAL_RETURN", ";", "// Don't send a message to the same client twice.", "m_messageLastMessage", "=", "message", ";", "this", ".", "getMessageStack", "(", ")", ".", "sendMessage", "(", "message", ")", ";", "return", "DBConstants", ".", "NORMAL_RETURN", ";", "}" ]
Listen for messages. @param message The message to send back to the client.
[ "Listen", "for", "messages", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/message/ReceiveQueueSession.java#L133-L147
151,453
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/message/ReceiveQueueSession.java
ReceiveQueueSession.addRemoteMessageFilter
public BaseMessageFilter addRemoteMessageFilter(BaseMessageFilter messageFilter, RemoteSession remoteSession) throws RemoteException { BaseMessageFilter remoteFilter = messageFilter; // The actual remote filter. messageFilter.setRegistryID(null); // The needs to be null to add this filter to the receiver. messageFilter.setFilterID(null); // The needs to be null to add this filter to the receiver. remoteFilter.setCreateRemoteFilter(true); // This must be set by the session. remoteFilter.setUpdateRemoteFilter(true); // (This is a transient field you MUST set the initial value) Utility.getLogger().info("EJB addRemoteMessageFilter session: " + remoteSession); // Give the filter the remote environment MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager(); if (remoteSession == null) messageManager.addMessageFilter(remoteFilter); // If there was a remote session, setupRemoteSessionFilter would have added the filter. else { remoteFilter = remoteSession.setupRemoteSessionFilter(remoteFilter); // This has the effect of calling: messageFilter.linkRemoteSession(remoteSession); remoteFilter = ((BaseMessageReceiver)messageManager.getMessageQueue(remoteFilter.getQueueName(), remoteFilter.getQueueType()).getMessageReceiver()).getMessageFilter(remoteFilter.getFilterID()); // Must look it up } remoteFilter.addMessageListener(this); messageFilter.setQueueName(remoteFilter.getQueueName()); // Info to pass to client. messageFilter.setQueueType(remoteFilter.getQueueType()); // Info to pass to client. messageFilter.setFilterID(remoteFilter.getFilterID()); // Info to pass to client. messageFilter.setRegistryID(remoteFilter.getRegistryID()); return messageFilter; // All client needs if the name/type/and ID of the remote filter. (Don't pass the remoteFilter as it's class may not be accessable to thin). }
java
public BaseMessageFilter addRemoteMessageFilter(BaseMessageFilter messageFilter, RemoteSession remoteSession) throws RemoteException { BaseMessageFilter remoteFilter = messageFilter; // The actual remote filter. messageFilter.setRegistryID(null); // The needs to be null to add this filter to the receiver. messageFilter.setFilterID(null); // The needs to be null to add this filter to the receiver. remoteFilter.setCreateRemoteFilter(true); // This must be set by the session. remoteFilter.setUpdateRemoteFilter(true); // (This is a transient field you MUST set the initial value) Utility.getLogger().info("EJB addRemoteMessageFilter session: " + remoteSession); // Give the filter the remote environment MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager(); if (remoteSession == null) messageManager.addMessageFilter(remoteFilter); // If there was a remote session, setupRemoteSessionFilter would have added the filter. else { remoteFilter = remoteSession.setupRemoteSessionFilter(remoteFilter); // This has the effect of calling: messageFilter.linkRemoteSession(remoteSession); remoteFilter = ((BaseMessageReceiver)messageManager.getMessageQueue(remoteFilter.getQueueName(), remoteFilter.getQueueType()).getMessageReceiver()).getMessageFilter(remoteFilter.getFilterID()); // Must look it up } remoteFilter.addMessageListener(this); messageFilter.setQueueName(remoteFilter.getQueueName()); // Info to pass to client. messageFilter.setQueueType(remoteFilter.getQueueType()); // Info to pass to client. messageFilter.setFilterID(remoteFilter.getFilterID()); // Info to pass to client. messageFilter.setRegistryID(remoteFilter.getRegistryID()); return messageFilter; // All client needs if the name/type/and ID of the remote filter. (Don't pass the remoteFilter as it's class may not be accessable to thin). }
[ "public", "BaseMessageFilter", "addRemoteMessageFilter", "(", "BaseMessageFilter", "messageFilter", ",", "RemoteSession", "remoteSession", ")", "throws", "RemoteException", "{", "BaseMessageFilter", "remoteFilter", "=", "messageFilter", ";", "// The actual remote filter.", "messageFilter", ".", "setRegistryID", "(", "null", ")", ";", "// The needs to be null to add this filter to the receiver.", "messageFilter", ".", "setFilterID", "(", "null", ")", ";", "// The needs to be null to add this filter to the receiver.", "remoteFilter", ".", "setCreateRemoteFilter", "(", "true", ")", ";", "// This must be set by the session.", "remoteFilter", ".", "setUpdateRemoteFilter", "(", "true", ")", ";", "// (This is a transient field you MUST set the initial value)", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"EJB addRemoteMessageFilter session: \"", "+", "remoteSession", ")", ";", "// Give the filter the remote environment", "MessageManager", "messageManager", "=", "(", "(", "Application", ")", "this", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ")", ".", "getMessageManager", "(", ")", ";", "if", "(", "remoteSession", "==", "null", ")", "messageManager", ".", "addMessageFilter", "(", "remoteFilter", ")", ";", "// If there was a remote session, setupRemoteSessionFilter would have added the filter.", "else", "{", "remoteFilter", "=", "remoteSession", ".", "setupRemoteSessionFilter", "(", "remoteFilter", ")", ";", "// This has the effect of calling: messageFilter.linkRemoteSession(remoteSession);", "remoteFilter", "=", "(", "(", "BaseMessageReceiver", ")", "messageManager", ".", "getMessageQueue", "(", "remoteFilter", ".", "getQueueName", "(", ")", ",", "remoteFilter", ".", "getQueueType", "(", ")", ")", ".", "getMessageReceiver", "(", ")", ")", ".", "getMessageFilter", "(", "remoteFilter", ".", "getFilterID", "(", ")", ")", ";", "// Must look it up", "}", "remoteFilter", ".", "addMessageListener", "(", "this", ")", ";", "messageFilter", ".", "setQueueName", "(", "remoteFilter", ".", "getQueueName", "(", ")", ")", ";", "// Info to pass to client.", "messageFilter", ".", "setQueueType", "(", "remoteFilter", ".", "getQueueType", "(", ")", ")", ";", "// Info to pass to client.", "messageFilter", ".", "setFilterID", "(", "remoteFilter", ".", "getFilterID", "(", ")", ")", ";", "// Info to pass to client.", "messageFilter", ".", "setRegistryID", "(", "remoteFilter", ".", "getRegistryID", "(", ")", ")", ";", "return", "messageFilter", ";", "// All client needs if the name/type/and ID of the remote filter. (Don't pass the remoteFilter as it's class may not be accessable to thin).", "}" ]
Given a copy of the client's message filter, set up a remote filter. @param messageFilter The message filter. @param remoteSession The remote session. @return The message filter.
[ "Given", "a", "copy", "of", "the", "client", "s", "message", "filter", "set", "up", "a", "remote", "filter", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/message/ReceiveQueueSession.java#L154-L179
151,454
tvesalainen/util
util/src/main/java/org/vesalainen/net/ExceptionParser.java
ExceptionParser.brokenConnection
public static final Level brokenConnection(Level level, Throwable thr) { if (thr instanceof EOFException) { return level; } if (thr instanceof ClosedChannelException) { return level; } if ((thr instanceof IOException) && ( "Broken pipe".equals(thr.getMessage()) || "Connection reset by peer".equals(thr.getMessage()) ) ) { return level; } if ((thr instanceof ConnectException) && ( "Connection timed out".equals(thr.getMessage()) || "Connection refused".equals(thr.getMessage()) ) ) { return level; } Throwable cause = thr.getCause(); if (cause != null) { return brokenConnection(level, cause); } return Level.SEVERE; }
java
public static final Level brokenConnection(Level level, Throwable thr) { if (thr instanceof EOFException) { return level; } if (thr instanceof ClosedChannelException) { return level; } if ((thr instanceof IOException) && ( "Broken pipe".equals(thr.getMessage()) || "Connection reset by peer".equals(thr.getMessage()) ) ) { return level; } if ((thr instanceof ConnectException) && ( "Connection timed out".equals(thr.getMessage()) || "Connection refused".equals(thr.getMessage()) ) ) { return level; } Throwable cause = thr.getCause(); if (cause != null) { return brokenConnection(level, cause); } return Level.SEVERE; }
[ "public", "static", "final", "Level", "brokenConnection", "(", "Level", "level", ",", "Throwable", "thr", ")", "{", "if", "(", "thr", "instanceof", "EOFException", ")", "{", "return", "level", ";", "}", "if", "(", "thr", "instanceof", "ClosedChannelException", ")", "{", "return", "level", ";", "}", "if", "(", "(", "thr", "instanceof", "IOException", ")", "&&", "(", "\"Broken pipe\"", ".", "equals", "(", "thr", ".", "getMessage", "(", ")", ")", "||", "\"Connection reset by peer\"", ".", "equals", "(", "thr", ".", "getMessage", "(", ")", ")", ")", ")", "{", "return", "level", ";", "}", "if", "(", "(", "thr", "instanceof", "ConnectException", ")", "&&", "(", "\"Connection timed out\"", ".", "equals", "(", "thr", ".", "getMessage", "(", ")", ")", "||", "\"Connection refused\"", ".", "equals", "(", "thr", ".", "getMessage", "(", ")", ")", ")", ")", "{", "return", "level", ";", "}", "Throwable", "cause", "=", "thr", ".", "getCause", "(", ")", ";", "if", "(", "cause", "!=", "null", ")", "{", "return", "brokenConnection", "(", "level", ",", "cause", ")", ";", "}", "return", "Level", ".", "SEVERE", ";", "}" ]
Tries to detect if Throwable is caused by broken connection. If detected returns level, else return SEVERE. @param level @param thr @return
[ "Tries", "to", "detect", "if", "Throwable", "is", "caused", "by", "broken", "connection", ".", "If", "detected", "returns", "level", "else", "return", "SEVERE", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/net/ExceptionParser.java#L38-L70
151,455
carewebframework/carewebframework-vista
org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/mbroker/AsyncRPCEventDispatcher.java
AsyncRPCEventDispatcher.callRPCAsync
public int callRPCAsync(String rpcName, Object... args) { abort(); this.rpcName = rpcName; asyncHandle = broker.callRPCAsync(rpcName, this, args); return asyncHandle; }
java
public int callRPCAsync(String rpcName, Object... args) { abort(); this.rpcName = rpcName; asyncHandle = broker.callRPCAsync(rpcName, this, args); return asyncHandle; }
[ "public", "int", "callRPCAsync", "(", "String", "rpcName", ",", "Object", "...", "args", ")", "{", "abort", "(", ")", ";", "this", ".", "rpcName", "=", "rpcName", ";", "asyncHandle", "=", "broker", ".", "callRPCAsync", "(", "rpcName", ",", "this", ",", "args", ")", ";", "return", "asyncHandle", ";", "}" ]
Make an asynchronous call. @param rpcName The RPC name. @param args The RPC arguments. @return The async handle.
[ "Make", "an", "asynchronous", "call", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/mbroker/AsyncRPCEventDispatcher.java#L66-L71
151,456
carewebframework/carewebframework-vista
org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/mbroker/AsyncRPCEventDispatcher.java
AsyncRPCEventDispatcher.abort
public void abort() { if (asyncHandle != 0) { int handle = asyncHandle; asyncHandle = 0; broker.callRPCAbort(handle); ZKUtil.fireEvent(new AsyncRPCAbortEvent(rpcName, target, handle)); rpcName = null; } }
java
public void abort() { if (asyncHandle != 0) { int handle = asyncHandle; asyncHandle = 0; broker.callRPCAbort(handle); ZKUtil.fireEvent(new AsyncRPCAbortEvent(rpcName, target, handle)); rpcName = null; } }
[ "public", "void", "abort", "(", ")", "{", "if", "(", "asyncHandle", "!=", "0", ")", "{", "int", "handle", "=", "asyncHandle", ";", "asyncHandle", "=", "0", ";", "broker", ".", "callRPCAbort", "(", "handle", ")", ";", "ZKUtil", ".", "fireEvent", "(", "new", "AsyncRPCAbortEvent", "(", "rpcName", ",", "target", ",", "handle", ")", ")", ";", "rpcName", "=", "null", ";", "}", "}" ]
Abort any asynchronous RPC in progress.
[ "Abort", "any", "asynchronous", "RPC", "in", "progress", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/mbroker/AsyncRPCEventDispatcher.java#L76-L84
151,457
carewebframework/carewebframework-vista
org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/mbroker/AsyncRPCEventDispatcher.java
AsyncRPCEventDispatcher.onRPCComplete
@Override public void onRPCComplete(int handle, String data) { if (handle == asyncHandle) { asyncHandle = 0; ZKUtil.fireEvent(new AsyncRPCCompleteEvent(rpcName, target, data, handle)); rpcName = null; } }
java
@Override public void onRPCComplete(int handle, String data) { if (handle == asyncHandle) { asyncHandle = 0; ZKUtil.fireEvent(new AsyncRPCCompleteEvent(rpcName, target, data, handle)); rpcName = null; } }
[ "@", "Override", "public", "void", "onRPCComplete", "(", "int", "handle", ",", "String", "data", ")", "{", "if", "(", "handle", "==", "asyncHandle", ")", "{", "asyncHandle", "=", "0", ";", "ZKUtil", ".", "fireEvent", "(", "new", "AsyncRPCCompleteEvent", "(", "rpcName", ",", "target", ",", "data", ",", "handle", ")", ")", ";", "rpcName", "=", "null", ";", "}", "}" ]
RPC completion callback.
[ "RPC", "completion", "callback", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/mbroker/AsyncRPCEventDispatcher.java#L89-L96
151,458
carewebframework/carewebframework-vista
org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/mbroker/AsyncRPCEventDispatcher.java
AsyncRPCEventDispatcher.onRPCError
@Override public void onRPCError(int handle, int code, String text) { if (handle == asyncHandle) { asyncHandle = 0; ZKUtil.fireEvent(new AsyncRPCErrorEvent(rpcName, target, code, text, handle)); rpcName = null; } }
java
@Override public void onRPCError(int handle, int code, String text) { if (handle == asyncHandle) { asyncHandle = 0; ZKUtil.fireEvent(new AsyncRPCErrorEvent(rpcName, target, code, text, handle)); rpcName = null; } }
[ "@", "Override", "public", "void", "onRPCError", "(", "int", "handle", ",", "int", "code", ",", "String", "text", ")", "{", "if", "(", "handle", "==", "asyncHandle", ")", "{", "asyncHandle", "=", "0", ";", "ZKUtil", ".", "fireEvent", "(", "new", "AsyncRPCErrorEvent", "(", "rpcName", ",", "target", ",", "code", ",", "text", ",", "handle", ")", ")", ";", "rpcName", "=", "null", ";", "}", "}" ]
RPC error callback.
[ "RPC", "error", "callback", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/mbroker/AsyncRPCEventDispatcher.java#L101-L108
151,459
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/grid/GridList.java
GridList.findElement
public int findElement(Object bookmark, int iHandleType) { int iTargetPosition; Object thisBookmark = null; if (bookmark == null) return -1; //+ Not found, look through the recordlist boolean bDataRecordFormat = false; for (iTargetPosition = 0; iTargetPosition < m_iRecordListEnd; iTargetPosition += m_iRecordListStep) { thisBookmark = this.elementAt(iTargetPosition); if (iTargetPosition == 0) if (thisBookmark instanceof DataRecord) bDataRecordFormat = true; if (bookmark.equals(thisBookmark)) return iTargetPosition; else if (bDataRecordFormat) if (bookmark.equals(((DataRecord)thisBookmark).getHandle(iHandleType))) return iTargetPosition; } //+ Still not found, do a binary search through the recordlist for a matching key return -1; // Not found }
java
public int findElement(Object bookmark, int iHandleType) { int iTargetPosition; Object thisBookmark = null; if (bookmark == null) return -1; //+ Not found, look through the recordlist boolean bDataRecordFormat = false; for (iTargetPosition = 0; iTargetPosition < m_iRecordListEnd; iTargetPosition += m_iRecordListStep) { thisBookmark = this.elementAt(iTargetPosition); if (iTargetPosition == 0) if (thisBookmark instanceof DataRecord) bDataRecordFormat = true; if (bookmark.equals(thisBookmark)) return iTargetPosition; else if (bDataRecordFormat) if (bookmark.equals(((DataRecord)thisBookmark).getHandle(iHandleType))) return iTargetPosition; } //+ Still not found, do a binary search through the recordlist for a matching key return -1; // Not found }
[ "public", "int", "findElement", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "{", "int", "iTargetPosition", ";", "Object", "thisBookmark", "=", "null", ";", "if", "(", "bookmark", "==", "null", ")", "return", "-", "1", ";", "//+ Not found, look through the recordlist", "boolean", "bDataRecordFormat", "=", "false", ";", "for", "(", "iTargetPosition", "=", "0", ";", "iTargetPosition", "<", "m_iRecordListEnd", ";", "iTargetPosition", "+=", "m_iRecordListStep", ")", "{", "thisBookmark", "=", "this", ".", "elementAt", "(", "iTargetPosition", ")", ";", "if", "(", "iTargetPosition", "==", "0", ")", "if", "(", "thisBookmark", "instanceof", "DataRecord", ")", "bDataRecordFormat", "=", "true", ";", "if", "(", "bookmark", ".", "equals", "(", "thisBookmark", ")", ")", "return", "iTargetPosition", ";", "else", "if", "(", "bDataRecordFormat", ")", "if", "(", "bookmark", ".", "equals", "(", "(", "(", "DataRecord", ")", "thisBookmark", ")", ".", "getHandle", "(", "iHandleType", ")", ")", ")", "return", "iTargetPosition", ";", "}", "//+ Still not found, do a binary search through the recordlist for a matching key", "return", "-", "1", ";", "// Not found", "}" ]
Search through this list for this bookmark. @return int index in table; or -1 if not found. @param bookmark java.lang.Object The bookmark to search for. @param iHandleType The type of bookmark passed.
[ "Search", "through", "this", "list", "for", "this", "bookmark", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/grid/GridList.java#L92-L114
151,460
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/grid/GridList.java
GridList.growAccessList
public void growAccessList(int iTargetPosition) { int iArrayIndex; if (m_aRecords == null) { m_aRecords = new Object[MAX_RECORD_ARRAY_SIZE]; m_iRecordListStep = 1; m_iRecordListMax = MAX_RECORD_ARRAY_SIZE; // Last + 1 } else { // First, free the odd items for (iArrayIndex = 1; iArrayIndex < MAX_RECORD_ARRAY_SIZE; iArrayIndex += 2) { // Free the objects that are no longer used this.freeElement(m_aRecords[iArrayIndex]); m_aRecords[iArrayIndex] = null; } // Next, compact the even ones to the first half of the array int nSourceIndex, nDestIndex; for (nSourceIndex = 2, nDestIndex = 1; nSourceIndex < MAX_RECORD_ARRAY_SIZE; nSourceIndex += 2, nDestIndex++) { Object bookmark = m_aRecords[nSourceIndex]; m_aRecords[nDestIndex] = bookmark; m_aRecords[nSourceIndex] = null; } // Now, reduce the size of the array and increase the step m_iRecordListMax = m_iRecordListMax * 2; m_iRecordListStep = m_iRecordListStep * 2; // Grow the array by elimating the odd records } if (iTargetPosition >= m_iRecordListMax) this.growAccessList(iTargetPosition); // Still not big enough, do it again }
java
public void growAccessList(int iTargetPosition) { int iArrayIndex; if (m_aRecords == null) { m_aRecords = new Object[MAX_RECORD_ARRAY_SIZE]; m_iRecordListStep = 1; m_iRecordListMax = MAX_RECORD_ARRAY_SIZE; // Last + 1 } else { // First, free the odd items for (iArrayIndex = 1; iArrayIndex < MAX_RECORD_ARRAY_SIZE; iArrayIndex += 2) { // Free the objects that are no longer used this.freeElement(m_aRecords[iArrayIndex]); m_aRecords[iArrayIndex] = null; } // Next, compact the even ones to the first half of the array int nSourceIndex, nDestIndex; for (nSourceIndex = 2, nDestIndex = 1; nSourceIndex < MAX_RECORD_ARRAY_SIZE; nSourceIndex += 2, nDestIndex++) { Object bookmark = m_aRecords[nSourceIndex]; m_aRecords[nDestIndex] = bookmark; m_aRecords[nSourceIndex] = null; } // Now, reduce the size of the array and increase the step m_iRecordListMax = m_iRecordListMax * 2; m_iRecordListStep = m_iRecordListStep * 2; // Grow the array by elimating the odd records } if (iTargetPosition >= m_iRecordListMax) this.growAccessList(iTargetPosition); // Still not big enough, do it again }
[ "public", "void", "growAccessList", "(", "int", "iTargetPosition", ")", "{", "int", "iArrayIndex", ";", "if", "(", "m_aRecords", "==", "null", ")", "{", "m_aRecords", "=", "new", "Object", "[", "MAX_RECORD_ARRAY_SIZE", "]", ";", "m_iRecordListStep", "=", "1", ";", "m_iRecordListMax", "=", "MAX_RECORD_ARRAY_SIZE", ";", "// Last + 1", "}", "else", "{", "// First, free the odd items", "for", "(", "iArrayIndex", "=", "1", ";", "iArrayIndex", "<", "MAX_RECORD_ARRAY_SIZE", ";", "iArrayIndex", "+=", "2", ")", "{", "// Free the objects that are no longer used", "this", ".", "freeElement", "(", "m_aRecords", "[", "iArrayIndex", "]", ")", ";", "m_aRecords", "[", "iArrayIndex", "]", "=", "null", ";", "}", "// Next, compact the even ones to the first half of the array", "int", "nSourceIndex", ",", "nDestIndex", ";", "for", "(", "nSourceIndex", "=", "2", ",", "nDestIndex", "=", "1", ";", "nSourceIndex", "<", "MAX_RECORD_ARRAY_SIZE", ";", "nSourceIndex", "+=", "2", ",", "nDestIndex", "++", ")", "{", "Object", "bookmark", "=", "m_aRecords", "[", "nSourceIndex", "]", ";", "m_aRecords", "[", "nDestIndex", "]", "=", "bookmark", ";", "m_aRecords", "[", "nSourceIndex", "]", "=", "null", ";", "}", "// Now, reduce the size of the array and increase the step", "m_iRecordListMax", "=", "m_iRecordListMax", "*", "2", ";", "m_iRecordListStep", "=", "m_iRecordListStep", "*", "2", ";", "// Grow the array by elimating the odd records", "}", "if", "(", "iTargetPosition", ">=", "m_iRecordListMax", ")", "this", ".", "growAccessList", "(", "iTargetPosition", ")", ";", "// Still not big enough, do it again", "}" ]
Increase the granularity of the access list. @param iTargetPosition The virtual size of the list has to include this target position.
[ "Increase", "the", "granularity", "of", "the", "access", "list", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/grid/GridList.java#L137-L169
151,461
thorinii/lct
src/main/java/me/lachlanap/lct/data/ClassInspector.java
ClassInspector.getConstants
public List<ConstantField> getConstants(Class<?> aClass) { List<ConstantField> constants = new ArrayList<>(); List<Field> fields = Arrays.asList(aClass.getDeclaredFields()); for (Field field : fields) { if (Modifier.isStatic(field.getModifiers()) && !Modifier.isFinal(field.getModifiers())) { if (!Modifier.isPublic(field.getModifiers())) if (tryMakeAccessible) field.setAccessible(true); else continue; constants.add(processField(aClass, field)); } } Iterator<ConstantField> itr = constants.iterator(); while (itr.hasNext()) { if (itr.next() == null) itr.remove(); } return constants; }
java
public List<ConstantField> getConstants(Class<?> aClass) { List<ConstantField> constants = new ArrayList<>(); List<Field> fields = Arrays.asList(aClass.getDeclaredFields()); for (Field field : fields) { if (Modifier.isStatic(field.getModifiers()) && !Modifier.isFinal(field.getModifiers())) { if (!Modifier.isPublic(field.getModifiers())) if (tryMakeAccessible) field.setAccessible(true); else continue; constants.add(processField(aClass, field)); } } Iterator<ConstantField> itr = constants.iterator(); while (itr.hasNext()) { if (itr.next() == null) itr.remove(); } return constants; }
[ "public", "List", "<", "ConstantField", ">", "getConstants", "(", "Class", "<", "?", ">", "aClass", ")", "{", "List", "<", "ConstantField", ">", "constants", "=", "new", "ArrayList", "<>", "(", ")", ";", "List", "<", "Field", ">", "fields", "=", "Arrays", ".", "asList", "(", "aClass", ".", "getDeclaredFields", "(", ")", ")", ";", "for", "(", "Field", "field", ":", "fields", ")", "{", "if", "(", "Modifier", ".", "isStatic", "(", "field", ".", "getModifiers", "(", ")", ")", "&&", "!", "Modifier", ".", "isFinal", "(", "field", ".", "getModifiers", "(", ")", ")", ")", "{", "if", "(", "!", "Modifier", ".", "isPublic", "(", "field", ".", "getModifiers", "(", ")", ")", ")", "if", "(", "tryMakeAccessible", ")", "field", ".", "setAccessible", "(", "true", ")", ";", "else", "continue", ";", "constants", ".", "add", "(", "processField", "(", "aClass", ",", "field", ")", ")", ";", "}", "}", "Iterator", "<", "ConstantField", ">", "itr", "=", "constants", ".", "iterator", "(", ")", ";", "while", "(", "itr", ".", "hasNext", "(", ")", ")", "{", "if", "(", "itr", ".", "next", "(", ")", "==", "null", ")", "itr", ".", "remove", "(", ")", ";", "}", "return", "constants", ";", "}" ]
Gets all fields that are potential 'constants'. @param aClass the class to work from @return all constants that could be found
[ "Gets", "all", "fields", "that", "are", "potential", "constants", "." ]
83d9dd94aac1efec4815b5658faa395a081592dc
https://github.com/thorinii/lct/blob/83d9dd94aac1efec4815b5658faa395a081592dc/src/main/java/me/lachlanap/lct/data/ClassInspector.java#L37-L59
151,462
incodehq-legacy/incode-module-base
dom/src/main/java/org/incode/module/base/dom/valuetypes/LocalDateInterval.java
LocalDateInterval.parseString
public static LocalDateInterval parseString(final String input) { String[] values = input.split("/"); try { return new LocalDateInterval(parseLocalDate(values[0]), parseLocalDate(values[1]), IntervalEnding.EXCLUDING_END_DATE); } catch (Exception e) { throw new IllegalArgumentException("Unable to parse " + input); } }
java
public static LocalDateInterval parseString(final String input) { String[] values = input.split("/"); try { return new LocalDateInterval(parseLocalDate(values[0]), parseLocalDate(values[1]), IntervalEnding.EXCLUDING_END_DATE); } catch (Exception e) { throw new IllegalArgumentException("Unable to parse " + input); } }
[ "public", "static", "LocalDateInterval", "parseString", "(", "final", "String", "input", ")", "{", "String", "[", "]", "values", "=", "input", ".", "split", "(", "\"/\"", ")", ";", "try", "{", "return", "new", "LocalDateInterval", "(", "parseLocalDate", "(", "values", "[", "0", "]", ")", ",", "parseLocalDate", "(", "values", "[", "1", "]", ")", ",", "IntervalEnding", ".", "EXCLUDING_END_DATE", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unable to parse \"", "+", "input", ")", ";", "}", "}" ]
Parse a string representation of a LocalDateInterval Since this method is only used for testing it's not heavily guarded against illegal arguments @param input a string with format yyyy-mm-dd/yyyy-mm-dd, end date is excluding @return
[ "Parse", "a", "string", "representation", "of", "a", "LocalDateInterval" ]
8dfbf946c26423adf6d3e751698968b035c4ef11
https://github.com/incodehq-legacy/incode-module-base/blob/8dfbf946c26423adf6d3e751698968b035c4ef11/dom/src/main/java/org/incode/module/base/dom/valuetypes/LocalDateInterval.java#L114-L121
151,463
incodehq-legacy/incode-module-base
dom/src/main/java/org/incode/module/base/dom/valuetypes/LocalDateInterval.java
LocalDateInterval.parseLocalDate
private static LocalDate parseLocalDate(final String input) { if (input.contains("--") || input.contains("*")) { return null; } return LocalDate.parse(input); }
java
private static LocalDate parseLocalDate(final String input) { if (input.contains("--") || input.contains("*")) { return null; } return LocalDate.parse(input); }
[ "private", "static", "LocalDate", "parseLocalDate", "(", "final", "String", "input", ")", "{", "if", "(", "input", ".", "contains", "(", "\"--\"", ")", "||", "input", ".", "contains", "(", "\"*\"", ")", ")", "{", "return", "null", ";", "}", "return", "LocalDate", ".", "parse", "(", "input", ")", ";", "}" ]
Parse a string to a LocalDate @param input a string representing a parsable LocalDate, "*" or "----------" returns null @return
[ "Parse", "a", "string", "to", "a", "LocalDate" ]
8dfbf946c26423adf6d3e751698968b035c4ef11
https://github.com/incodehq-legacy/incode-module-base/blob/8dfbf946c26423adf6d3e751698968b035c4ef11/dom/src/main/java/org/incode/module/base/dom/valuetypes/LocalDateInterval.java#L129-L134
151,464
etnetera/seb
src/main/java/cz/etnetera/seb/listener/SebListener.java
SebListener.disable
@SuppressWarnings("unchecked") public SebListener disable(Class<? extends SebEvent>... events) { if (events != null) { enabledEvents = null; if (disabledEvents == null) disabledEvents = new HashSet<>(); for (Class<? extends SebEvent> event : events) { disabledEvents.add(event); } } return this; }
java
@SuppressWarnings("unchecked") public SebListener disable(Class<? extends SebEvent>... events) { if (events != null) { enabledEvents = null; if (disabledEvents == null) disabledEvents = new HashSet<>(); for (Class<? extends SebEvent> event : events) { disabledEvents.add(event); } } return this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "SebListener", "disable", "(", "Class", "<", "?", "extends", "SebEvent", ">", "...", "events", ")", "{", "if", "(", "events", "!=", "null", ")", "{", "enabledEvents", "=", "null", ";", "if", "(", "disabledEvents", "==", "null", ")", "disabledEvents", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "Class", "<", "?", "extends", "SebEvent", ">", "event", ":", "events", ")", "{", "disabledEvents", ".", "add", "(", "event", ")", ";", "}", "}", "return", "this", ";", "}" ]
Disables specific events only. It overrides all enabled events. @param events Events to enable @return This instance
[ "Disables", "specific", "events", "only", ".", "It", "overrides", "all", "enabled", "events", "." ]
6aed29c7726db12f440c60cfd253de229064ed04
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/listener/SebListener.java#L120-L131
151,465
etnetera/seb
src/main/java/cz/etnetera/seb/listener/SebListener.java
SebListener.saveFile
protected void saveFile(SebEvent event, String content, String name, String extension) { event.saveFile(content, getListenerFileName(name), extension); }
java
protected void saveFile(SebEvent event, String content, String name, String extension) { event.saveFile(content, getListenerFileName(name), extension); }
[ "protected", "void", "saveFile", "(", "SebEvent", "event", ",", "String", "content", ",", "String", "name", ",", "String", "extension", ")", "{", "event", ".", "saveFile", "(", "content", ",", "getListenerFileName", "(", "name", ")", ",", "extension", ")", ";", "}" ]
Save string content into output file with given name and extension. @param event @param content @param name @param extension
[ "Save", "string", "content", "into", "output", "file", "with", "given", "name", "and", "extension", "." ]
6aed29c7726db12f440c60cfd253de229064ed04
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/listener/SebListener.java#L437-L439
151,466
etnetera/seb
src/main/java/cz/etnetera/seb/listener/SebListener.java
SebListener.saveFile
protected void saveFile(SebEvent event, byte[] bytes, String name, String extension) { event.saveFile(bytes, getListenerFileName(name), extension); }
java
protected void saveFile(SebEvent event, byte[] bytes, String name, String extension) { event.saveFile(bytes, getListenerFileName(name), extension); }
[ "protected", "void", "saveFile", "(", "SebEvent", "event", ",", "byte", "[", "]", "bytes", ",", "String", "name", ",", "String", "extension", ")", "{", "event", ".", "saveFile", "(", "bytes", ",", "getListenerFileName", "(", "name", ")", ",", "extension", ")", ";", "}" ]
Save bytes into output file with given name and extension. @param event @param bytes @param name @param extension
[ "Save", "bytes", "into", "output", "file", "with", "given", "name", "and", "extension", "." ]
6aed29c7726db12f440c60cfd253de229064ed04
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/listener/SebListener.java#L449-L451
151,467
etnetera/seb
src/main/java/cz/etnetera/seb/listener/SebListener.java
SebListener.saveFile
protected void saveFile(SebEvent event, File file, String name, String extension) { event.saveFile(file, getListenerFileName(name), extension); }
java
protected void saveFile(SebEvent event, File file, String name, String extension) { event.saveFile(file, getListenerFileName(name), extension); }
[ "protected", "void", "saveFile", "(", "SebEvent", "event", ",", "File", "file", ",", "String", "name", ",", "String", "extension", ")", "{", "event", ".", "saveFile", "(", "file", ",", "getListenerFileName", "(", "name", ")", ",", "extension", ")", ";", "}" ]
Save file into output file with given name and extension. @param event @param file @param name @param extension
[ "Save", "file", "into", "output", "file", "with", "given", "name", "and", "extension", "." ]
6aed29c7726db12f440c60cfd253de229064ed04
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/listener/SebListener.java#L461-L463
151,468
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java
JAltGridScreen.setupPanel
public void setupPanel() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.addGridHeading(); JPanel panel = new JPanel(); panel.setOpaque(false); panel.setMinimumSize(new Dimension(20, 20)); panel.setLayout(new BorderLayout()); JScrollPane scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); panel.add(scrollPane); this.add(panel); m_panelGrid = new JPanel(); JPanel panelAligner = new JPanel(); // This panel keeps the panelgrid in the upper left hand of the scrollpane. panelAligner.add(m_panelGrid); panelAligner.setLayout(new FlowLayout(FlowLayout.LEADING)); scrollPane.getViewport().add(panelAligner); panelAligner.setOpaque(false); m_panelGrid.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setOpaque(false); this.addGridDetail(); }
java
public void setupPanel() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.addGridHeading(); JPanel panel = new JPanel(); panel.setOpaque(false); panel.setMinimumSize(new Dimension(20, 20)); panel.setLayout(new BorderLayout()); JScrollPane scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); panel.add(scrollPane); this.add(panel); m_panelGrid = new JPanel(); JPanel panelAligner = new JPanel(); // This panel keeps the panelgrid in the upper left hand of the scrollpane. panelAligner.add(m_panelGrid); panelAligner.setLayout(new FlowLayout(FlowLayout.LEADING)); scrollPane.getViewport().add(panelAligner); panelAligner.setOpaque(false); m_panelGrid.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setOpaque(false); this.addGridDetail(); }
[ "public", "void", "setupPanel", "(", ")", "{", "this", ".", "setLayout", "(", "new", "BoxLayout", "(", "this", ",", "BoxLayout", ".", "Y_AXIS", ")", ")", ";", "this", ".", "addGridHeading", "(", ")", ";", "JPanel", "panel", "=", "new", "JPanel", "(", ")", ";", "panel", ".", "setOpaque", "(", "false", ")", ";", "panel", ".", "setMinimumSize", "(", "new", "Dimension", "(", "20", ",", "20", ")", ")", ";", "panel", ".", "setLayout", "(", "new", "BorderLayout", "(", ")", ")", ";", "JScrollPane", "scrollPane", "=", "new", "JScrollPane", "(", "JScrollPane", ".", "VERTICAL_SCROLLBAR_AS_NEEDED", ",", "JScrollPane", ".", "HORIZONTAL_SCROLLBAR_AS_NEEDED", ")", ";", "panel", ".", "add", "(", "scrollPane", ")", ";", "this", ".", "add", "(", "panel", ")", ";", "m_panelGrid", "=", "new", "JPanel", "(", ")", ";", "JPanel", "panelAligner", "=", "new", "JPanel", "(", ")", ";", "// This panel keeps the panelgrid in the upper left hand of the scrollpane.", "panelAligner", ".", "add", "(", "m_panelGrid", ")", ";", "panelAligner", ".", "setLayout", "(", "new", "FlowLayout", "(", "FlowLayout", ".", "LEADING", ")", ")", ";", "scrollPane", ".", "getViewport", "(", ")", ".", "add", "(", "panelAligner", ")", ";", "panelAligner", ".", "setOpaque", "(", "false", ")", ";", "m_panelGrid", ".", "setOpaque", "(", "false", ")", ";", "scrollPane", ".", "getViewport", "(", ")", ".", "setOpaque", "(", "false", ")", ";", "scrollPane", ".", "setOpaque", "(", "false", ")", ";", "this", ".", "addGridDetail", "(", ")", ";", "}" ]
Setup a new panel.
[ "Setup", "a", "new", "panel", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java#L122-L145
151,469
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java
JAltGridScreen.addGridDetailItem
public void addGridDetailItem(TableModel model, int iRowIndex, GridBagLayout gridbag, GridBagConstraints c) { JComponent rgcompoments[] = new JComponent[model.getColumnCount()]; for (int iColumnIndex = 0; iColumnIndex < rgcompoments.length; iColumnIndex++) { Object obj = model.getValueAt(iRowIndex, iColumnIndex); if ((obj == null) || (model.getRowCount() <= iRowIndex)) return; // EOF if (iColumnIndex == rgcompoments.length - 1) { // Last column - take remainder c.weightx = 1.0; c.gridwidth = GridBagConstraints.REMAINDER; //end row c.anchor = GridBagConstraints.WEST; // Edit boxes left justified c.insets.right = 5; } Component component = this.addDetailComponent(model, obj, iRowIndex, iColumnIndex, c); if (component == null) continue; // Skip this column gridbag.setConstraints(component, c); m_panelGrid.add(component); rgcompoments[iColumnIndex] = (JComponent)component; } // Set up a table to lookup the item<->textfield link m_vComponentCache.addElement(new ComponentCache(iRowIndex, rgcompoments)); }
java
public void addGridDetailItem(TableModel model, int iRowIndex, GridBagLayout gridbag, GridBagConstraints c) { JComponent rgcompoments[] = new JComponent[model.getColumnCount()]; for (int iColumnIndex = 0; iColumnIndex < rgcompoments.length; iColumnIndex++) { Object obj = model.getValueAt(iRowIndex, iColumnIndex); if ((obj == null) || (model.getRowCount() <= iRowIndex)) return; // EOF if (iColumnIndex == rgcompoments.length - 1) { // Last column - take remainder c.weightx = 1.0; c.gridwidth = GridBagConstraints.REMAINDER; //end row c.anchor = GridBagConstraints.WEST; // Edit boxes left justified c.insets.right = 5; } Component component = this.addDetailComponent(model, obj, iRowIndex, iColumnIndex, c); if (component == null) continue; // Skip this column gridbag.setConstraints(component, c); m_panelGrid.add(component); rgcompoments[iColumnIndex] = (JComponent)component; } // Set up a table to lookup the item<->textfield link m_vComponentCache.addElement(new ComponentCache(iRowIndex, rgcompoments)); }
[ "public", "void", "addGridDetailItem", "(", "TableModel", "model", ",", "int", "iRowIndex", ",", "GridBagLayout", "gridbag", ",", "GridBagConstraints", "c", ")", "{", "JComponent", "rgcompoments", "[", "]", "=", "new", "JComponent", "[", "model", ".", "getColumnCount", "(", ")", "]", ";", "for", "(", "int", "iColumnIndex", "=", "0", ";", "iColumnIndex", "<", "rgcompoments", ".", "length", ";", "iColumnIndex", "++", ")", "{", "Object", "obj", "=", "model", ".", "getValueAt", "(", "iRowIndex", ",", "iColumnIndex", ")", ";", "if", "(", "(", "obj", "==", "null", ")", "||", "(", "model", ".", "getRowCount", "(", ")", "<=", "iRowIndex", ")", ")", "return", ";", "// EOF", "if", "(", "iColumnIndex", "==", "rgcompoments", ".", "length", "-", "1", ")", "{", "// Last column - take remainder", "c", ".", "weightx", "=", "1.0", ";", "c", ".", "gridwidth", "=", "GridBagConstraints", ".", "REMAINDER", ";", "//end row", "c", ".", "anchor", "=", "GridBagConstraints", ".", "WEST", ";", "// Edit boxes left justified", "c", ".", "insets", ".", "right", "=", "5", ";", "}", "Component", "component", "=", "this", ".", "addDetailComponent", "(", "model", ",", "obj", ",", "iRowIndex", ",", "iColumnIndex", ",", "c", ")", ";", "if", "(", "component", "==", "null", ")", "continue", ";", "// Skip this column", "gridbag", ".", "setConstraints", "(", "component", ",", "c", ")", ";", "m_panelGrid", ".", "add", "(", "component", ")", ";", "rgcompoments", "[", "iColumnIndex", "]", "=", "(", "JComponent", ")", "component", ";", "}", "// Set up a table to lookup the item<->textfield link", "m_vComponentCache", ".", "addElement", "(", "new", "ComponentCache", "(", "iRowIndex", ",", "rgcompoments", ")", ")", ";", "}" ]
Add this item to the grid detail at this row. @param model The table model to read through. @param iRowIndex The row to add this item. @param gridbag The screen layout. @param c The constraint to use.
[ "Add", "this", "item", "to", "the", "grid", "detail", "at", "this", "row", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java#L223-L247
151,470
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java
JAltGridScreen.addDetailComponent
public Component addDetailComponent(TableModel model, Object aValue, int iRowIndex, int iColumnIndex, GridBagConstraints c) { JComponent component = null; String string = ""; if (aValue instanceof ImageIcon) { component = new JLabel((ImageIcon)aValue); } if (aValue instanceof PortableImage) { component = new JLabel(new ImageIcon((Image)((PortableImage)aValue).getImage())); } else if (aValue != null) { string = aValue.toString(); if (model.isCellEditable(iRowIndex, iColumnIndex)) { if (string.length() == 0) component = new JTextField(3); else component = new JTextField(string); } else component = new JLabel(string); } return component; }
java
public Component addDetailComponent(TableModel model, Object aValue, int iRowIndex, int iColumnIndex, GridBagConstraints c) { JComponent component = null; String string = ""; if (aValue instanceof ImageIcon) { component = new JLabel((ImageIcon)aValue); } if (aValue instanceof PortableImage) { component = new JLabel(new ImageIcon((Image)((PortableImage)aValue).getImage())); } else if (aValue != null) { string = aValue.toString(); if (model.isCellEditable(iRowIndex, iColumnIndex)) { if (string.length() == 0) component = new JTextField(3); else component = new JTextField(string); } else component = new JLabel(string); } return component; }
[ "public", "Component", "addDetailComponent", "(", "TableModel", "model", ",", "Object", "aValue", ",", "int", "iRowIndex", ",", "int", "iColumnIndex", ",", "GridBagConstraints", "c", ")", "{", "JComponent", "component", "=", "null", ";", "String", "string", "=", "\"\"", ";", "if", "(", "aValue", "instanceof", "ImageIcon", ")", "{", "component", "=", "new", "JLabel", "(", "(", "ImageIcon", ")", "aValue", ")", ";", "}", "if", "(", "aValue", "instanceof", "PortableImage", ")", "{", "component", "=", "new", "JLabel", "(", "new", "ImageIcon", "(", "(", "Image", ")", "(", "(", "PortableImage", ")", "aValue", ")", ".", "getImage", "(", ")", ")", ")", ";", "}", "else", "if", "(", "aValue", "!=", "null", ")", "{", "string", "=", "aValue", ".", "toString", "(", ")", ";", "if", "(", "model", ".", "isCellEditable", "(", "iRowIndex", ",", "iColumnIndex", ")", ")", "{", "if", "(", "string", ".", "length", "(", ")", "==", "0", ")", "component", "=", "new", "JTextField", "(", "3", ")", ";", "else", "component", "=", "new", "JTextField", "(", "string", ")", ";", "}", "else", "component", "=", "new", "JLabel", "(", "string", ")", ";", "}", "return", "component", ";", "}" ]
Create the appropriate component and add it to the grid detail at this location. @param model The table model to read through. @param iRowIndex The row to add this item. @param iColumnIndex The column index of this component. @param c The constraint to use.
[ "Create", "the", "appropriate", "component", "and", "add", "it", "to", "the", "grid", "detail", "at", "this", "location", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java#L255-L281
151,471
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java
JAltGridScreen.dataToField
public void dataToField(ComponentCache componentCache, int iRowIndex, int iColumnIndex) { if (componentCache.m_rgcompoments[iColumnIndex] != null) { String string = null; if (componentCache.m_rgcompoments[iColumnIndex] instanceof JTextComponent) string = ((JTextComponent)componentCache.m_rgcompoments[iColumnIndex]).getText(); if (componentCache.m_rgcompoments[iColumnIndex] instanceof JCheckBox) if (((JCheckBox)componentCache.m_rgcompoments[iColumnIndex]).isSelected()) string = "1"; //xif (string != null) if (string.length() > 0) this.getModel().setValueAt(string, iRowIndex, iColumnIndex); } }
java
public void dataToField(ComponentCache componentCache, int iRowIndex, int iColumnIndex) { if (componentCache.m_rgcompoments[iColumnIndex] != null) { String string = null; if (componentCache.m_rgcompoments[iColumnIndex] instanceof JTextComponent) string = ((JTextComponent)componentCache.m_rgcompoments[iColumnIndex]).getText(); if (componentCache.m_rgcompoments[iColumnIndex] instanceof JCheckBox) if (((JCheckBox)componentCache.m_rgcompoments[iColumnIndex]).isSelected()) string = "1"; //xif (string != null) if (string.length() > 0) this.getModel().setValueAt(string, iRowIndex, iColumnIndex); } }
[ "public", "void", "dataToField", "(", "ComponentCache", "componentCache", ",", "int", "iRowIndex", ",", "int", "iColumnIndex", ")", "{", "if", "(", "componentCache", ".", "m_rgcompoments", "[", "iColumnIndex", "]", "!=", "null", ")", "{", "String", "string", "=", "null", ";", "if", "(", "componentCache", ".", "m_rgcompoments", "[", "iColumnIndex", "]", "instanceof", "JTextComponent", ")", "string", "=", "(", "(", "JTextComponent", ")", "componentCache", ".", "m_rgcompoments", "[", "iColumnIndex", "]", ")", ".", "getText", "(", ")", ";", "if", "(", "componentCache", ".", "m_rgcompoments", "[", "iColumnIndex", "]", "instanceof", "JCheckBox", ")", "if", "(", "(", "(", "JCheckBox", ")", "componentCache", ".", "m_rgcompoments", "[", "iColumnIndex", "]", ")", ".", "isSelected", "(", ")", ")", "string", "=", "\"1\"", ";", "//xif (string != null) if (string.length() > 0)", "this", ".", "getModel", "(", ")", ".", "setValueAt", "(", "string", ",", "iRowIndex", ",", "iColumnIndex", ")", ";", "}", "}" ]
Change the table by setting this field to the value in the component at this location. @param componentCache The cached components on this row. @param iRowIndex The row to set. @param ColumnIndex The column to set.
[ "Change", "the", "table", "by", "setting", "this", "field", "to", "the", "value", "in", "the", "component", "at", "this", "location", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java#L330-L343
151,472
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java
JAltGridScreen.fieldToData
public void fieldToData(ComponentCache componentCache, int iRowIndex, int iColumnIndex) { if (componentCache.m_rgcompoments[iColumnIndex] != null) { Object object = this.getModel().getValueAt(iRowIndex, iColumnIndex); String string = ""; if (object != null) string = object.toString(); if (componentCache.m_rgcompoments[iColumnIndex] instanceof JTextComponent) ((JTextComponent)componentCache.m_rgcompoments[iColumnIndex]).setText(string); else if (componentCache.m_rgcompoments[iColumnIndex] instanceof JCheckBox) { boolean bIsSelected = false; if (string != null) if (string.equals("1")) bIsSelected = true; ((JCheckBox)componentCache.m_rgcompoments[iColumnIndex]).setSelected(bIsSelected); } } }
java
public void fieldToData(ComponentCache componentCache, int iRowIndex, int iColumnIndex) { if (componentCache.m_rgcompoments[iColumnIndex] != null) { Object object = this.getModel().getValueAt(iRowIndex, iColumnIndex); String string = ""; if (object != null) string = object.toString(); if (componentCache.m_rgcompoments[iColumnIndex] instanceof JTextComponent) ((JTextComponent)componentCache.m_rgcompoments[iColumnIndex]).setText(string); else if (componentCache.m_rgcompoments[iColumnIndex] instanceof JCheckBox) { boolean bIsSelected = false; if (string != null) if (string.equals("1")) bIsSelected = true; ((JCheckBox)componentCache.m_rgcompoments[iColumnIndex]).setSelected(bIsSelected); } } }
[ "public", "void", "fieldToData", "(", "ComponentCache", "componentCache", ",", "int", "iRowIndex", ",", "int", "iColumnIndex", ")", "{", "if", "(", "componentCache", ".", "m_rgcompoments", "[", "iColumnIndex", "]", "!=", "null", ")", "{", "Object", "object", "=", "this", ".", "getModel", "(", ")", ".", "getValueAt", "(", "iRowIndex", ",", "iColumnIndex", ")", ";", "String", "string", "=", "\"\"", ";", "if", "(", "object", "!=", "null", ")", "string", "=", "object", ".", "toString", "(", ")", ";", "if", "(", "componentCache", ".", "m_rgcompoments", "[", "iColumnIndex", "]", "instanceof", "JTextComponent", ")", "(", "(", "JTextComponent", ")", "componentCache", ".", "m_rgcompoments", "[", "iColumnIndex", "]", ")", ".", "setText", "(", "string", ")", ";", "else", "if", "(", "componentCache", ".", "m_rgcompoments", "[", "iColumnIndex", "]", "instanceof", "JCheckBox", ")", "{", "boolean", "bIsSelected", "=", "false", ";", "if", "(", "string", "!=", "null", ")", "if", "(", "string", ".", "equals", "(", "\"1\"", ")", ")", "bIsSelected", "=", "true", ";", "(", "(", "JCheckBox", ")", "componentCache", ".", "m_rgcompoments", "[", "iColumnIndex", "]", ")", ".", "setSelected", "(", "bIsSelected", ")", ";", "}", "}", "}" ]
Move the data in this row and column in the table to this component. @param componentCache The cached components on this row. @param iRowIndex The row to set. @param ColumnIndex The column to set.
[ "Move", "the", "data", "in", "this", "row", "and", "column", "in", "the", "table", "to", "this", "component", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java#L368-L386
151,473
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java
JAltGridScreen.tableChanged
public void tableChanged(TableModelEvent e) { if ((e.getFirstRow() == TableModelEvent.HEADER_ROW) || (e.getLastRow() >= m_vComponentCache.size())) { // Entire table changed, rebuild table this.removeAll(); this.setupPanel(); this.validate(); } else if (e.getType() == TableModelEvent.UPDATE) { int iFirstRow = e.getFirstRow(); int iLastRow = e.getLastRow(); for (int iRowIndex = iFirstRow; iRowIndex <= iLastRow; iRowIndex++) { if (iRowIndex < m_vComponentCache.size()) { ComponentCache componentCache = (ComponentCache)m_vComponentCache.elementAt(iRowIndex); if (componentCache != null) { // Move the data to the model for (int iColumnIndex = 0; iColumnIndex < componentCache.m_rgcompoments.length; iColumnIndex++) { this.fieldToData(componentCache, iRowIndex, iColumnIndex); } } } else break; } } }
java
public void tableChanged(TableModelEvent e) { if ((e.getFirstRow() == TableModelEvent.HEADER_ROW) || (e.getLastRow() >= m_vComponentCache.size())) { // Entire table changed, rebuild table this.removeAll(); this.setupPanel(); this.validate(); } else if (e.getType() == TableModelEvent.UPDATE) { int iFirstRow = e.getFirstRow(); int iLastRow = e.getLastRow(); for (int iRowIndex = iFirstRow; iRowIndex <= iLastRow; iRowIndex++) { if (iRowIndex < m_vComponentCache.size()) { ComponentCache componentCache = (ComponentCache)m_vComponentCache.elementAt(iRowIndex); if (componentCache != null) { // Move the data to the model for (int iColumnIndex = 0; iColumnIndex < componentCache.m_rgcompoments.length; iColumnIndex++) { this.fieldToData(componentCache, iRowIndex, iColumnIndex); } } } else break; } } }
[ "public", "void", "tableChanged", "(", "TableModelEvent", "e", ")", "{", "if", "(", "(", "e", ".", "getFirstRow", "(", ")", "==", "TableModelEvent", ".", "HEADER_ROW", ")", "||", "(", "e", ".", "getLastRow", "(", ")", ">=", "m_vComponentCache", ".", "size", "(", ")", ")", ")", "{", "// Entire table changed, rebuild table", "this", ".", "removeAll", "(", ")", ";", "this", ".", "setupPanel", "(", ")", ";", "this", ".", "validate", "(", ")", ";", "}", "else", "if", "(", "e", ".", "getType", "(", ")", "==", "TableModelEvent", ".", "UPDATE", ")", "{", "int", "iFirstRow", "=", "e", ".", "getFirstRow", "(", ")", ";", "int", "iLastRow", "=", "e", ".", "getLastRow", "(", ")", ";", "for", "(", "int", "iRowIndex", "=", "iFirstRow", ";", "iRowIndex", "<=", "iLastRow", ";", "iRowIndex", "++", ")", "{", "if", "(", "iRowIndex", "<", "m_vComponentCache", ".", "size", "(", ")", ")", "{", "ComponentCache", "componentCache", "=", "(", "ComponentCache", ")", "m_vComponentCache", ".", "elementAt", "(", "iRowIndex", ")", ";", "if", "(", "componentCache", "!=", "null", ")", "{", "// Move the data to the model", "for", "(", "int", "iColumnIndex", "=", "0", ";", "iColumnIndex", "<", "componentCache", ".", "m_rgcompoments", ".", "length", ";", "iColumnIndex", "++", ")", "{", "this", ".", "fieldToData", "(", "componentCache", ",", "iRowIndex", ",", "iColumnIndex", ")", ";", "}", "}", "}", "else", "break", ";", "}", "}", "}" ]
The table has changed, update the grid. @param e The TableModelEvent.
[ "The", "table", "has", "changed", "update", "the", "grid", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java#L391-L421
151,474
trellis-ldp-archive/trellis-io-jena
src/main/java/org/trellisldp/io/impl/HtmlSerializer.java
HtmlSerializer.write
public void write(final OutputStream out, final Stream<? extends Triple> triples, final IRI subject) { final Writer writer = new OutputStreamWriter(out, UTF_8); try { template .execute(writer, new HtmlData(namespaceService, subject, triples.collect(toList()), properties)) .flush(); } catch (final IOException ex) { throw new UncheckedIOException(ex); } }
java
public void write(final OutputStream out, final Stream<? extends Triple> triples, final IRI subject) { final Writer writer = new OutputStreamWriter(out, UTF_8); try { template .execute(writer, new HtmlData(namespaceService, subject, triples.collect(toList()), properties)) .flush(); } catch (final IOException ex) { throw new UncheckedIOException(ex); } }
[ "public", "void", "write", "(", "final", "OutputStream", "out", ",", "final", "Stream", "<", "?", "extends", "Triple", ">", "triples", ",", "final", "IRI", "subject", ")", "{", "final", "Writer", "writer", "=", "new", "OutputStreamWriter", "(", "out", ",", "UTF_8", ")", ";", "try", "{", "template", ".", "execute", "(", "writer", ",", "new", "HtmlData", "(", "namespaceService", ",", "subject", ",", "triples", ".", "collect", "(", "toList", "(", ")", ")", ",", "properties", ")", ")", ".", "flush", "(", ")", ";", "}", "catch", "(", "final", "IOException", "ex", ")", "{", "throw", "new", "UncheckedIOException", "(", "ex", ")", ";", "}", "}" ]
Send the content to an output stream @param out the output stream @param triples the triples @param subject the subject
[ "Send", "the", "content", "to", "an", "output", "stream" ]
3a06f8f8e7b6fc83fb659cb61217810f813967e8
https://github.com/trellis-ldp-archive/trellis-io-jena/blob/3a06f8f8e7b6fc83fb659cb61217810f813967e8/src/main/java/org/trellisldp/io/impl/HtmlSerializer.java#L80-L89
151,475
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerHttpResponse.java
BrokerHttpResponse.parseContentType
private ContentType parseContentType(String value) { String[] pcs = value.split("\\;"); String mimeType = pcs[0].trim(); String charSet = "UTF-8"; for (int i = 1; i < pcs.length; i++) { String s = pcs[i].trim().toUpperCase(); if (s.startsWith("CHARSET=")) { charSet = s.substring(8); break; } } return ContentType.create(mimeType, charSet); }
java
private ContentType parseContentType(String value) { String[] pcs = value.split("\\;"); String mimeType = pcs[0].trim(); String charSet = "UTF-8"; for (int i = 1; i < pcs.length; i++) { String s = pcs[i].trim().toUpperCase(); if (s.startsWith("CHARSET=")) { charSet = s.substring(8); break; } } return ContentType.create(mimeType, charSet); }
[ "private", "ContentType", "parseContentType", "(", "String", "value", ")", "{", "String", "[", "]", "pcs", "=", "value", ".", "split", "(", "\"\\\\;\"", ")", ";", "String", "mimeType", "=", "pcs", "[", "0", "]", ".", "trim", "(", ")", ";", "String", "charSet", "=", "\"UTF-8\"", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "pcs", ".", "length", ";", "i", "++", ")", "{", "String", "s", "=", "pcs", "[", "i", "]", ".", "trim", "(", ")", ".", "toUpperCase", "(", ")", ";", "if", "(", "s", ".", "startsWith", "(", "\"CHARSET=\"", ")", ")", "{", "charSet", "=", "s", ".", "substring", "(", "8", ")", ";", "break", ";", "}", "}", "return", "ContentType", ".", "create", "(", "mimeType", ",", "charSet", ")", ";", "}" ]
Parse the returned content type. @param value Value to parse @return ContentType instance
[ "Parse", "the", "returned", "content", "type", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/BrokerHttpResponse.java#L147-L162
151,476
oglimmer/utils
src/main/java/de/oglimmer/utils/random/RandomString.java
RandomString.getRandomString
public static String getRandomString(final int size, final int start, final int length) { final StringBuilder buff = new StringBuilder(size); for (int i = 0; i < size; i++) { buff.append((char) (RAN.nextInt(length) + start)); } return buff.toString(); }
java
public static String getRandomString(final int size, final int start, final int length) { final StringBuilder buff = new StringBuilder(size); for (int i = 0; i < size; i++) { buff.append((char) (RAN.nextInt(length) + start)); } return buff.toString(); }
[ "public", "static", "String", "getRandomString", "(", "final", "int", "size", ",", "final", "int", "start", ",", "final", "int", "length", ")", "{", "final", "StringBuilder", "buff", "=", "new", "StringBuilder", "(", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "buff", ".", "append", "(", "(", "char", ")", "(", "RAN", ".", "nextInt", "(", "length", ")", "+", "start", ")", ")", ";", "}", "return", "buff", ".", "toString", "(", ")", ";", "}" ]
Creates a size byte long unicode string. All codes are &gt;= start and &lt; start+length @param size number of characters in the return string @param start start code @param length all generated codes are within this range @return
[ "Creates", "a", "size", "byte", "long", "unicode", "string", ".", "All", "codes", "are", "&gt", ";", "=", "start", "and", "&lt", ";", "start", "+", "length" ]
bc46c57a24e60c9dbda4c73a810c163b0ce407ea
https://github.com/oglimmer/utils/blob/bc46c57a24e60c9dbda4c73a810c163b0ce407ea/src/main/java/de/oglimmer/utils/random/RandomString.java#L26-L33
151,477
oglimmer/utils
src/main/java/de/oglimmer/utils/random/RandomString.java
RandomString.getRandomString
public static String getRandomString(final int size, final String stringSet) { final StringBuilder buff = new StringBuilder(size); for (int i = 0; i < size; i++) { final char nextChar = stringSet.charAt(RAN.nextInt(stringSet.length())); buff.append(nextChar); } return buff.toString(); }
java
public static String getRandomString(final int size, final String stringSet) { final StringBuilder buff = new StringBuilder(size); for (int i = 0; i < size; i++) { final char nextChar = stringSet.charAt(RAN.nextInt(stringSet.length())); buff.append(nextChar); } return buff.toString(); }
[ "public", "static", "String", "getRandomString", "(", "final", "int", "size", ",", "final", "String", "stringSet", ")", "{", "final", "StringBuilder", "buff", "=", "new", "StringBuilder", "(", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "final", "char", "nextChar", "=", "stringSet", ".", "charAt", "(", "RAN", ".", "nextInt", "(", "stringSet", ".", "length", "(", ")", ")", ")", ";", "buff", ".", "append", "(", "nextChar", ")", ";", "}", "return", "buff", ".", "toString", "(", ")", ";", "}" ]
Creates a size byte long unicode string. All codes are from the set "stringSet" @param size number of characters in the return string @param stringSet set of characters used for string creation @return a random string build from "stringSet"
[ "Creates", "a", "size", "byte", "long", "unicode", "string", ".", "All", "codes", "are", "from", "the", "set", "stringSet" ]
bc46c57a24e60c9dbda4c73a810c163b0ce407ea
https://github.com/oglimmer/utils/blob/bc46c57a24e60c9dbda4c73a810c163b0ce407ea/src/main/java/de/oglimmer/utils/random/RandomString.java#L77-L86
151,478
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.addChild
public void addChild(Config child) { Params.notNull(child, "Child"); child.parent = this; children.add(child); }
java
public void addChild(Config child) { Params.notNull(child, "Child"); child.parent = this; children.add(child); }
[ "public", "void", "addChild", "(", "Config", "child", ")", "{", "Params", ".", "notNull", "(", "child", ",", "\"Child\"", ")", ";", "child", ".", "parent", "=", "this", ";", "children", ".", "add", "(", "child", ")", ";", "}" ]
Add child configuration object. @param child child configuration object. @throws IllegalArgumentException if <code>child</code> argument is null.
[ "Add", "child", "configuration", "object", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L99-L104
151,479
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.setAttribute
public void setAttribute(String name, String value) { Params.notNullOrEmpty(name, "Attribute name"); Params.notEmpty(value, "Attribute value"); if(value != null) { attributes.put(name, value); } else { attributes.remove(name); } }
java
public void setAttribute(String name, String value) { Params.notNullOrEmpty(name, "Attribute name"); Params.notEmpty(value, "Attribute value"); if(value != null) { attributes.put(name, value); } else { attributes.remove(name); } }
[ "public", "void", "setAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Attribute name\"", ")", ";", "Params", ".", "notEmpty", "(", "value", ",", "\"Attribute value\"", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "attributes", ".", "put", "(", "name", ",", "value", ")", ";", "}", "else", "{", "attributes", ".", "remove", "(", "name", ")", ";", "}", "}" ]
Set configuration object attribute. If attribute already exists overwrite old value. Empty value is not accepted but null is considered indication to remove attribute. So that, an existing attribute cannot be either null or empty. @param name attribute name, @param value attribute value, null ignored. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>value</code> argument is empty.
[ "Set", "configuration", "object", "attribute", ".", "If", "attribute", "already", "exists", "overwrite", "old", "value", ".", "Empty", "value", "is", "not", "accepted", "but", "null", "is", "considered", "indication", "to", "remove", "attribute", ".", "So", "that", "an", "existing", "attribute", "cannot", "be", "either", "null", "or", "empty", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L116-L126
151,480
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getRoot
public Config getRoot() { Config root = this; while(root.parent != null) { root = root.parent; } return root; }
java
public Config getRoot() { Config root = this; while(root.parent != null) { root = root.parent; } return root; }
[ "public", "Config", "getRoot", "(", ")", "{", "Config", "root", "=", "this", ";", "while", "(", "root", ".", "parent", "!=", "null", ")", "{", "root", "=", "root", ".", "parent", ";", "}", "return", "root", ";", "}" ]
Get root of the tree this configuration object is part of. @return configuration object root.
[ "Get", "root", "of", "the", "tree", "this", "configuration", "object", "is", "part", "of", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L201-L208
151,481
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.hasAttribute
public boolean hasAttribute(String name, String value) { Params.notNullOrEmpty(name, "Attribute name"); Params.notNullOrEmpty(value, "Attribute value"); return value.equals(attributes.get(name)); }
java
public boolean hasAttribute(String name, String value) { Params.notNullOrEmpty(name, "Attribute name"); Params.notNullOrEmpty(value, "Attribute value"); return value.equals(attributes.get(name)); }
[ "public", "boolean", "hasAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Attribute name\"", ")", ";", "Params", ".", "notNullOrEmpty", "(", "value", ",", "\"Attribute value\"", ")", ";", "return", "value", ".", "equals", "(", "attributes", ".", "get", "(", "name", ")", ")", ";", "}" ]
Test if configuration object has an attribute with requested name and value. @param name name of the attribute to search for, @param value attribute value. @return true if configuration object has an attribute with requested name and value. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>value</code> argument is null or empty.
[ "Test", "if", "configuration", "object", "has", "an", "attribute", "with", "requested", "name", "and", "value", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L252-L257
151,482
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getAttribute
public String getAttribute(String name) { Params.notNullOrEmpty(name, "Attribute name"); return attributes.get(name); }
java
public String getAttribute(String name) { Params.notNullOrEmpty(name, "Attribute name"); return attributes.get(name); }
[ "public", "String", "getAttribute", "(", "String", "name", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Attribute name\"", ")", ";", "return", "attributes", ".", "get", "(", "name", ")", ";", "}" ]
Get attribute value or null if there is no attribute with requested name. An existing attribute value cannot ever be empty or null so if this method returns null is for missing attribute. @param name attribute name. @return attribute value or null if named attribute not found. @throws IllegalArgumentException if <code>name</code> argument is null or empty.
[ "Get", "attribute", "value", "or", "null", "if", "there", "is", "no", "attribute", "with", "requested", "name", ".", "An", "existing", "attribute", "value", "cannot", "ever", "be", "empty", "or", "null", "so", "if", "this", "method", "returns", "null", "is", "for", "missing", "attribute", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L267-L271
151,483
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getAttribute
public String getAttribute(String name, String defaultValue) { Params.notNullOrEmpty(name, "Attribute name"); return getAttribute(name, String.class, defaultValue); }
java
public String getAttribute(String name, String defaultValue) { Params.notNullOrEmpty(name, "Attribute name"); return getAttribute(name, String.class, defaultValue); }
[ "public", "String", "getAttribute", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Attribute name\"", ")", ";", "return", "getAttribute", "(", "name", ",", "String", ".", "class", ",", "defaultValue", ")", ";", "}" ]
Get attribute value or given default value if there is no attribute with requested name. If given default value is null and attribute is not found this method still returns null, that is, requested default value. @param name attribute name. @param defaultValue default value, null or empty accepted. @return attribute value or default value. @throws IllegalArgumentException if <code>name</code> argument is null or empty.
[ "Get", "attribute", "value", "or", "given", "default", "value", "if", "there", "is", "no", "attribute", "with", "requested", "name", ".", "If", "given", "default", "value", "is", "null", "and", "attribute", "is", "not", "found", "this", "method", "still", "returns", "null", "that", "is", "requested", "default", "value", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L282-L286
151,484
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getAttribute
public <T> T getAttribute(String name, Class<T> type) { Params.notNullOrEmpty(name, "Attribute name"); Params.notNull(type, "Attribute type"); return getAttribute(name, type, null); }
java
public <T> T getAttribute(String name, Class<T> type) { Params.notNullOrEmpty(name, "Attribute name"); Params.notNull(type, "Attribute type"); return getAttribute(name, type, null); }
[ "public", "<", "T", ">", "T", "getAttribute", "(", "String", "name", ",", "Class", "<", "T", ">", "type", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Attribute name\"", ")", ";", "Params", ".", "notNull", "(", "type", ",", "\"Attribute type\"", ")", ";", "return", "getAttribute", "(", "name", ",", "type", ",", "null", ")", ";", "}" ]
Get attribute value converted to requested type or null if there is no attribute with requested name. @param name attribute name, @param type type to converter attribute value to. @param <T> type to convert attribute value. @return newly created value object or null if named attribute not found. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>type</code> argument is null. @throws ConverterException if there is no converter registered for value type or value parse fails.
[ "Get", "attribute", "value", "converted", "to", "requested", "type", "or", "null", "if", "there", "is", "no", "attribute", "with", "requested", "name", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L299-L304
151,485
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getAttribute
public <T> T getAttribute(String name, Class<T> type, T defaultValue) { Params.notNullOrEmpty(name, "Attribute name"); Params.notNull(type, "Attribute type"); String value = attributes.get(name); return value != null ? converter.asObject(value, type) : defaultValue; }
java
public <T> T getAttribute(String name, Class<T> type, T defaultValue) { Params.notNullOrEmpty(name, "Attribute name"); Params.notNull(type, "Attribute type"); String value = attributes.get(name); return value != null ? converter.asObject(value, type) : defaultValue; }
[ "public", "<", "T", ">", "T", "getAttribute", "(", "String", "name", ",", "Class", "<", "T", ">", "type", ",", "T", "defaultValue", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Attribute name\"", ")", ";", "Params", ".", "notNull", "(", "type", ",", "\"Attribute type\"", ")", ";", "String", "value", "=", "attributes", ".", "get", "(", "name", ")", ";", "return", "value", "!=", "null", "?", "converter", ".", "asObject", "(", "value", ",", "type", ")", ":", "defaultValue", ";", "}" ]
Get attribute value converted to requested type or default value if there is no attribute with requested name. If given default value is null and attribute is not found this method still returns null, that is, the requested default value. @param name attribute name, @param type type to converter attribute value to, @param defaultValue default value. @param <T> type to convert attribute value to. @return newly created value object instance or default value. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>type</code> argument is null. @throws ConverterException if there is no converter registered for value type or value parse fails.
[ "Get", "attribute", "value", "converted", "to", "requested", "type", "or", "default", "value", "if", "there", "is", "no", "attribute", "with", "requested", "name", ".", "If", "given", "default", "value", "is", "null", "and", "attribute", "is", "not", "found", "this", "method", "still", "returns", "null", "that", "is", "the", "requested", "default", "value", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L320-L326
151,486
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getProperty
public String getProperty(String name) { Params.notNullOrEmpty(name, "Property name"); usedProperties.add(name); return properties.getProperty(name); }
java
public String getProperty(String name) { Params.notNullOrEmpty(name, "Property name"); usedProperties.add(name); return properties.getProperty(name); }
[ "public", "String", "getProperty", "(", "String", "name", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Property name\"", ")", ";", "usedProperties", ".", "add", "(", "name", ")", ";", "return", "properties", ".", "getProperty", "(", "name", ")", ";", "}" ]
Get configuration object property value or null if there is no property with requested name. @param name property name. @return configuration object property value or null. @throws IllegalArgumentException if <code>name</code> argument is null or empty.
[ "Get", "configuration", "object", "property", "value", "or", "null", "if", "there", "is", "no", "property", "with", "requested", "name", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L377-L382
151,487
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getProperty
public <T> T getProperty(String name, Class<T> type) { return getProperty(name, type, null); }
java
public <T> T getProperty(String name, Class<T> type) { return getProperty(name, type, null); }
[ "public", "<", "T", ">", "T", "getProperty", "(", "String", "name", ",", "Class", "<", "T", ">", "type", ")", "{", "return", "getProperty", "(", "name", ",", "type", ",", "null", ")", ";", "}" ]
Get configuration object property converter to requested type or null if there is no property with given name. @param name property name. @param type type to convert property value to. @param <T> value type. @return newly created value object or null. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>type</code> argument is null. @throws ConverterException if there is no converter registered for value type or value parse fails.
[ "Get", "configuration", "object", "property", "converter", "to", "requested", "type", "or", "null", "if", "there", "is", "no", "property", "with", "given", "name", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L409-L412
151,488
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getProperty
public <T> T getProperty(String name, Class<T> type, T defaultValue) { Params.notNullOrEmpty(name, "Property name"); Params.notNull(type, "Property type"); String value = getProperty(name); if(value != null) { return converter.asObject(value, type); } return defaultValue; }
java
public <T> T getProperty(String name, Class<T> type, T defaultValue) { Params.notNullOrEmpty(name, "Property name"); Params.notNull(type, "Property type"); String value = getProperty(name); if(value != null) { return converter.asObject(value, type); } return defaultValue; }
[ "public", "<", "T", ">", "T", "getProperty", "(", "String", "name", ",", "Class", "<", "T", ">", "type", ",", "T", "defaultValue", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Property name\"", ")", ";", "Params", ".", "notNull", "(", "type", ",", "\"Property type\"", ")", ";", "String", "value", "=", "getProperty", "(", "name", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return", "converter", ".", "asObject", "(", "value", ",", "type", ")", ";", "}", "return", "defaultValue", ";", "}" ]
Get configuration object property converter to requested type or default value if there is no property with given name. @param name property name. @param type type to convert property value to, @param defaultValue default value, possible null or empty. @param <T> value type. @return newly created value object or default value. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>type</code> argument is null. @throws ConverterException if there is no converter registered for value type or value parse fails.
[ "Get", "configuration", "object", "property", "converter", "to", "requested", "type", "or", "default", "value", "if", "there", "is", "no", "property", "with", "given", "name", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L427-L436
151,489
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.hasChild
public boolean hasChild(String name) { Params.notNullOrEmpty(name, "Child name"); for(Config child : children) { if(child.name.equals(name)) { return true; } } return false; }
java
public boolean hasChild(String name) { Params.notNullOrEmpty(name, "Child name"); for(Config child : children) { if(child.name.equals(name)) { return true; } } return false; }
[ "public", "boolean", "hasChild", "(", "String", "name", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Child name\"", ")", ";", "for", "(", "Config", "child", ":", "children", ")", "{", "if", "(", "child", ".", "name", ".", "equals", "(", "name", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Test if configuration object has at least a child with requested name. @param name child name. @return true if configuration object has at least one child with requested name. @throws IllegalArgumentException if <code>name</code> argument is null or empty.
[ "Test", "if", "configuration", "object", "has", "at", "least", "a", "child", "with", "requested", "name", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L475-L484
151,490
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getChild
public Config getChild(String name) { Params.notNullOrEmpty(name, "Child name"); for(Config child : children) { if(child.name.equals(name)) { return child; } } return null; }
java
public Config getChild(String name) { Params.notNullOrEmpty(name, "Child name"); for(Config child : children) { if(child.name.equals(name)) { return child; } } return null; }
[ "public", "Config", "getChild", "(", "String", "name", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Child name\"", ")", ";", "for", "(", "Config", "child", ":", "children", ")", "{", "if", "(", "child", ".", "name", ".", "equals", "(", "name", ")", ")", "{", "return", "child", ";", "}", "}", "return", "null", ";", "}" ]
Get configuration object first child with requested name or null if there is no child with given name. @param name child name. @return configuration object child or null. @throws IllegalArgumentException if <code>name</code> argument is null or empty.
[ "Get", "configuration", "object", "first", "child", "with", "requested", "name", "or", "null", "if", "there", "is", "no", "child", "with", "given", "name", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L493-L502
151,491
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getChild
public Config getChild(int index) { Params.range(index, 0, children.size(), "Index"); return children.get(index); }
java
public Config getChild(int index) { Params.range(index, 0, children.size(), "Index"); return children.get(index); }
[ "public", "Config", "getChild", "(", "int", "index", ")", "{", "Params", ".", "range", "(", "index", ",", "0", ",", "children", ".", "size", "(", ")", ",", "\"Index\"", ")", ";", "return", "children", ".", "get", "(", "index", ")", ";", "}" ]
Get configuration object child by index. Given index should be in range so that invoking this method on empty children list will throw exception. @param index child index. @return configuration object child at requested index. @throws IllegalArgumentException if <code>index</code> argument is not in range.
[ "Get", "configuration", "object", "child", "by", "index", ".", "Given", "index", "should", "be", "in", "range", "so", "that", "invoking", "this", "method", "on", "empty", "children", "list", "will", "throw", "exception", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L512-L516
151,492
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.findChildren
public List<Config> findChildren(String... name) { Params.notNullOrEmpty(name, "Children names"); List<String> names = Arrays.asList(name); List<Config> results = new ArrayList<Config>(); for(Config child : children) { if(names.contains(child.name)) { results.add(child); } } return results; }
java
public List<Config> findChildren(String... name) { Params.notNullOrEmpty(name, "Children names"); List<String> names = Arrays.asList(name); List<Config> results = new ArrayList<Config>(); for(Config child : children) { if(names.contains(child.name)) { results.add(child); } } return results; }
[ "public", "List", "<", "Config", ">", "findChildren", "(", "String", "...", "name", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Children names\"", ")", ";", "List", "<", "String", ">", "names", "=", "Arrays", ".", "asList", "(", "name", ")", ";", "List", "<", "Config", ">", "results", "=", "new", "ArrayList", "<", "Config", ">", "(", ")", ";", "for", "(", "Config", "child", ":", "children", ")", "{", "if", "(", "names", ".", "contains", "(", "child", ".", "name", ")", ")", "{", "results", ".", "add", "(", "child", ")", ";", "}", "}", "return", "results", ";", "}" ]
Find configuration object children with requested names. @param name one or more child names. @return configuration object children with requested names, possible empty. @throws IllegalArgumentException if <code>name</code> list does not contains at least one item.
[ "Find", "configuration", "object", "children", "with", "requested", "names", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L525-L536
151,493
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getValue
public <T> T getValue(Class<T> type) { Params.notNull(type, "Value type"); if(value == null) { return null; } return converter.asObject(value, type); }
java
public <T> T getValue(Class<T> type) { Params.notNull(type, "Value type"); if(value == null) { return null; } return converter.asObject(value, type); }
[ "public", "<", "T", ">", "T", "getValue", "(", "Class", "<", "T", ">", "type", ")", "{", "Params", ".", "notNull", "(", "type", ",", "\"Value type\"", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "return", "converter", ".", "asObject", "(", "value", ",", "type", ")", ";", "}" ]
Get this configuration object value converted to requested type. Returns null if this configuration object has no value. @param type desired value object type. @param <T> value type. @return newly created value object or null. @throws IllegalArgumentException if <code>type</code> argument is null. @throws ConverterException if there is no converter registered for value type or value parse fails.
[ "Get", "this", "configuration", "object", "value", "converted", "to", "requested", "type", ".", "Returns", "null", "if", "this", "configuration", "object", "has", "no", "value", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L559-L566
151,494
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getChildValue
public String getChildValue(String name) { Config child = getChild(name); return child != null ? child.getValue() : null; }
java
public String getChildValue(String name) { Config child = getChild(name); return child != null ? child.getValue() : null; }
[ "public", "String", "getChildValue", "(", "String", "name", ")", "{", "Config", "child", "=", "getChild", "(", "name", ")", ";", "return", "child", "!=", "null", "?", "child", ".", "getValue", "(", ")", ":", "null", ";", "}" ]
Get named child string value or null if child not found or it has no value. @param name name of the child to retrieve value from. @return named child string value, possible null.
[ "Get", "named", "child", "string", "value", "or", "null", "if", "child", "not", "found", "or", "it", "has", "no", "value", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L574-L578
151,495
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.print
private void print(Config config, int indent) { for(int i = 0; i < indent; ++i) { System.out.print("\t"); } System.out.print(config.name); System.out.print("\r\n"); for(Config child : config.children) { print(child, indent + 1); } }
java
private void print(Config config, int indent) { for(int i = 0; i < indent; ++i) { System.out.print("\t"); } System.out.print(config.name); System.out.print("\r\n"); for(Config child : config.children) { print(child, indent + 1); } }
[ "private", "void", "print", "(", "Config", "config", ",", "int", "indent", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "indent", ";", "++", "i", ")", "{", "System", ".", "out", ".", "print", "(", "\"\\t\"", ")", ";", "}", "System", ".", "out", ".", "print", "(", "config", ".", "name", ")", ";", "System", ".", "out", ".", "print", "(", "\"\\r\\n\"", ")", ";", "for", "(", "Config", "child", ":", "config", ".", "children", ")", "{", "print", "(", "child", ",", "indent", "+", "1", ")", ";", "}", "}" ]
Recursively print configuration object tree to standard out. @param config configuration object, @param indent indentation index.
[ "Recursively", "print", "configuration", "object", "tree", "to", "standard", "out", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L592-L603
151,496
jbundle/jbundle
thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedItem.java
CachedItem.setEndDate
public synchronized Date setEndDate(Date time) { m_cachedInfo.setEndDate(time); int iThisIndex = m_model.indexOf(this); if (iThisIndex != -1) m_model.fireTableRowsUpdated(iThisIndex, iThisIndex); this.changeRemoteDate(null, null, this, null, time); return this.getEndDate(); }
java
public synchronized Date setEndDate(Date time) { m_cachedInfo.setEndDate(time); int iThisIndex = m_model.indexOf(this); if (iThisIndex != -1) m_model.fireTableRowsUpdated(iThisIndex, iThisIndex); this.changeRemoteDate(null, null, this, null, time); return this.getEndDate(); }
[ "public", "synchronized", "Date", "setEndDate", "(", "Date", "time", ")", "{", "m_cachedInfo", ".", "setEndDate", "(", "time", ")", ";", "int", "iThisIndex", "=", "m_model", ".", "indexOf", "(", "this", ")", ";", "if", "(", "iThisIndex", "!=", "-", "1", ")", "m_model", ".", "fireTableRowsUpdated", "(", "iThisIndex", ",", "iThisIndex", ")", ";", "this", ".", "changeRemoteDate", "(", "null", ",", "null", ",", "this", ",", "null", ",", "time", ")", ";", "return", "this", ".", "getEndDate", "(", ")", ";", "}" ]
Change the ending time of this service. First, move the item on the screen, then call the method to change the remote data.
[ "Change", "the", "ending", "time", "of", "this", "service", ".", "First", "move", "the", "item", "on", "the", "screen", "then", "call", "the", "method", "to", "change", "the", "remote", "data", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedItem.java#L133-L141
151,497
jbundle/jbundle
thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedItem.java
CachedItem.getMealCache
public String[] getMealCache(Date dateStart, Date dateEnd) throws Exception { int iDays = (int)((dateEnd.getTime() - dateStart.getTime()) / Constants.KMS_IN_A_DAY) + 2; if (iDays <= 0) return null; String[] rgstrMeals = new String[iDays]; Date date = new Date(dateStart.getTime()); for (int iDay = 0; iDay < iDays; iDay++) { rgstrMeals[iDay] = this.getRemoteMealDesc(date); date.setTime(date.getTime() + Constants.KMS_IN_A_DAY); } return rgstrMeals; }
java
public String[] getMealCache(Date dateStart, Date dateEnd) throws Exception { int iDays = (int)((dateEnd.getTime() - dateStart.getTime()) / Constants.KMS_IN_A_DAY) + 2; if (iDays <= 0) return null; String[] rgstrMeals = new String[iDays]; Date date = new Date(dateStart.getTime()); for (int iDay = 0; iDay < iDays; iDay++) { rgstrMeals[iDay] = this.getRemoteMealDesc(date); date.setTime(date.getTime() + Constants.KMS_IN_A_DAY); } return rgstrMeals; }
[ "public", "String", "[", "]", "getMealCache", "(", "Date", "dateStart", ",", "Date", "dateEnd", ")", "throws", "Exception", "{", "int", "iDays", "=", "(", "int", ")", "(", "(", "dateEnd", ".", "getTime", "(", ")", "-", "dateStart", ".", "getTime", "(", ")", ")", "/", "Constants", ".", "KMS_IN_A_DAY", ")", "+", "2", ";", "if", "(", "iDays", "<=", "0", ")", "return", "null", ";", "String", "[", "]", "rgstrMeals", "=", "new", "String", "[", "iDays", "]", ";", "Date", "date", "=", "new", "Date", "(", "dateStart", ".", "getTime", "(", ")", ")", ";", "for", "(", "int", "iDay", "=", "0", ";", "iDay", "<", "iDays", ";", "iDay", "++", ")", "{", "rgstrMeals", "[", "iDay", "]", "=", "this", ".", "getRemoteMealDesc", "(", "date", ")", ";", "date", ".", "setTime", "(", "date", ".", "getTime", "(", ")", "+", "Constants", ".", "KMS_IN_A_DAY", ")", ";", "}", "return", "rgstrMeals", ";", "}" ]
Get the meals on each day of this product and put them in an array.
[ "Get", "the", "meals", "on", "each", "day", "of", "this", "product", "and", "put", "them", "in", "an", "array", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedItem.java#L195-L208
151,498
jbundle/jbundle
thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedItem.java
CachedItem.setStatus
public synchronized int setStatus(int iStatus) { m_cachedInfo.setStatus(iStatus); int iThisIndex = m_model.indexOf(this); if (iThisIndex != -1) m_model.fireTableRowsUpdated(iThisIndex, iThisIndex); return this.getStatus(); }
java
public synchronized int setStatus(int iStatus) { m_cachedInfo.setStatus(iStatus); int iThisIndex = m_model.indexOf(this); if (iThisIndex != -1) m_model.fireTableRowsUpdated(iThisIndex, iThisIndex); return this.getStatus(); }
[ "public", "synchronized", "int", "setStatus", "(", "int", "iStatus", ")", "{", "m_cachedInfo", ".", "setStatus", "(", "iStatus", ")", ";", "int", "iThisIndex", "=", "m_model", ".", "indexOf", "(", "this", ")", ";", "if", "(", "iThisIndex", "!=", "-", "1", ")", "m_model", ".", "fireTableRowsUpdated", "(", "iThisIndex", ",", "iThisIndex", ")", ";", "return", "this", ".", "getStatus", "(", ")", ";", "}" ]
Set the status of this item.
[ "Set", "the", "status", "of", "this", "item", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedItem.java#L270-L277
151,499
jbundle/jbundle
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java
HBasePanel.printHtmlFooter
public void printHtmlFooter(PrintWriter out, ResourceBundle reg) { String strHTML = reg.getString("htmlFooter"); if ((strHTML == null) || (strHTML.length() == 0)) strHTML = "</body>\n</html>"; out.println(strHTML); out.flush(); }
java
public void printHtmlFooter(PrintWriter out, ResourceBundle reg) { String strHTML = reg.getString("htmlFooter"); if ((strHTML == null) || (strHTML.length() == 0)) strHTML = "</body>\n</html>"; out.println(strHTML); out.flush(); }
[ "public", "void", "printHtmlFooter", "(", "PrintWriter", "out", ",", "ResourceBundle", "reg", ")", "{", "String", "strHTML", "=", "reg", ".", "getString", "(", "\"htmlFooter\"", ")", ";", "if", "(", "(", "strHTML", "==", "null", ")", "||", "(", "strHTML", ".", "length", "(", ")", "==", "0", ")", ")", "strHTML", "=", "\"</body>\\n</html>\"", ";", "out", ".", "println", "(", "strHTML", ")", ";", "out", ".", "flush", "(", ")", ";", "}" ]
Bottom of HTML form. @param out The html out stream. @param reg The resources object.
[ "Bottom", "of", "HTML", "form", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L237-L244