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
153,900
tvesalainen/util
util/src/main/java/org/vesalainen/util/CmdArgs.java
CmdArgs.getUsage
public String getUsage() { Set<Option> set = new HashSet<>(); StringBuilder sb = new StringBuilder(); sb.append("usage: "); boolean n1 = false; for (Entry<String,List<Option>> e : groups.entrySet()) { if (n1) { sb.append("|"); } n1 = true; sb.append("["); boolean n2 = false; for (Option opt : e.getValue()) { if (n2) { sb.append(" "); } n2 = true; append(sb, opt); set.add(opt); } sb.append("]"); } for (Option opt : map.values()) { if (!set.contains(opt)) { sb.append(" "); append(sb, opt); } } for (int ii=0;ii<names.size();ii++) { sb.append(" <").append(names.get(ii)).append(">"); if (types.get(ii).isArray()) { sb.append("..."); } } return sb.toString(); }
java
public String getUsage() { Set<Option> set = new HashSet<>(); StringBuilder sb = new StringBuilder(); sb.append("usage: "); boolean n1 = false; for (Entry<String,List<Option>> e : groups.entrySet()) { if (n1) { sb.append("|"); } n1 = true; sb.append("["); boolean n2 = false; for (Option opt : e.getValue()) { if (n2) { sb.append(" "); } n2 = true; append(sb, opt); set.add(opt); } sb.append("]"); } for (Option opt : map.values()) { if (!set.contains(opt)) { sb.append(" "); append(sb, opt); } } for (int ii=0;ii<names.size();ii++) { sb.append(" <").append(names.get(ii)).append(">"); if (types.get(ii).isArray()) { sb.append("..."); } } return sb.toString(); }
[ "public", "String", "getUsage", "(", ")", "{", "Set", "<", "Option", ">", "set", "=", "new", "HashSet", "<>", "(", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"usage: \"", ")", ";", "boolean", "n1", "=", "false", ";", "for", "(", "Entry", "<", "String", ",", "List", "<", "Option", ">", ">", "e", ":", "groups", ".", "entrySet", "(", ")", ")", "{", "if", "(", "n1", ")", "{", "sb", ".", "append", "(", "\"|\"", ")", ";", "}", "n1", "=", "true", ";", "sb", ".", "append", "(", "\"[\"", ")", ";", "boolean", "n2", "=", "false", ";", "for", "(", "Option", "opt", ":", "e", ".", "getValue", "(", ")", ")", "{", "if", "(", "n2", ")", "{", "sb", ".", "append", "(", "\" \"", ")", ";", "}", "n2", "=", "true", ";", "append", "(", "sb", ",", "opt", ")", ";", "set", ".", "add", "(", "opt", ")", ";", "}", "sb", ".", "append", "(", "\"]\"", ")", ";", "}", "for", "(", "Option", "opt", ":", "map", ".", "values", "(", ")", ")", "{", "if", "(", "!", "set", ".", "contains", "(", "opt", ")", ")", "{", "sb", ".", "append", "(", "\" \"", ")", ";", "append", "(", "sb", ",", "opt", ")", ";", "}", "}", "for", "(", "int", "ii", "=", "0", ";", "ii", "<", "names", ".", "size", "(", ")", ";", "ii", "++", ")", "{", "sb", ".", "append", "(", "\" <\"", ")", ".", "append", "(", "names", ".", "get", "(", "ii", ")", ")", ".", "append", "(", "\">\"", ")", ";", "if", "(", "types", ".", "get", "(", "ii", ")", ".", "isArray", "(", ")", ")", "{", "sb", ".", "append", "(", "\"...\"", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns usage string. @return
[ "Returns", "usage", "string", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CmdArgs.java#L401-L445
153,901
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/annotation/cglib/AnnotationMethodInterceptor.java
AnnotationMethodInterceptor.intercept
@Override public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { if (method.getName().equals("annotationType")) { return annotationType; } else if (method.getName().equals("toString")) { return toString(); } else if (method.getName().equals("equals")) { return annotationEquals(args[0]); } else if (method.getName().equals("hashCode")) { return proxy.hashCode(); } else { return attributeData.get(method.getName()); } }
java
@Override public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { if (method.getName().equals("annotationType")) { return annotationType; } else if (method.getName().equals("toString")) { return toString(); } else if (method.getName().equals("equals")) { return annotationEquals(args[0]); } else if (method.getName().equals("hashCode")) { return proxy.hashCode(); } else { return attributeData.get(method.getName()); } }
[ "@", "Override", "public", "Object", "intercept", "(", "Object", "obj", ",", "Method", "method", ",", "Object", "[", "]", "args", ",", "MethodProxy", "proxy", ")", "throws", "Throwable", "{", "if", "(", "method", ".", "getName", "(", ")", ".", "equals", "(", "\"annotationType\"", ")", ")", "{", "return", "annotationType", ";", "}", "else", "if", "(", "method", ".", "getName", "(", ")", ".", "equals", "(", "\"toString\"", ")", ")", "{", "return", "toString", "(", ")", ";", "}", "else", "if", "(", "method", ".", "getName", "(", ")", ".", "equals", "(", "\"equals\"", ")", ")", "{", "return", "annotationEquals", "(", "args", "[", "0", "]", ")", ";", "}", "else", "if", "(", "method", ".", "getName", "(", ")", ".", "equals", "(", "\"hashCode\"", ")", ")", "{", "return", "proxy", ".", "hashCode", "(", ")", ";", "}", "else", "{", "return", "attributeData", ".", "get", "(", "method", ".", "getName", "(", ")", ")", ";", "}", "}" ]
Intercept all methods calls. @param obj The enhanced CGLIB instance @param method Intercepted method @param args Method arguments @param proxy This method proxy
[ "Intercept", "all", "methods", "calls", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/annotation/cglib/AnnotationMethodInterceptor.java#L41-L55
153,902
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/annotation/cglib/AnnotationMethodInterceptor.java
AnnotationMethodInterceptor.annotationEquals
private boolean annotationEquals(Object object) { if (object == null || !(object instanceof Annotation) || !annotationType.equals(((Annotation) object).annotationType())) { return false; } for (Map.Entry<String, Method> entry : attributes.entrySet()) { String methodName = entry.getKey(); Method method = entry.getValue(); Object otherValue; try { otherValue = method.invoke(object); Object value = attributeData.get(methodName); if (!attributeEquals(value, otherValue)) { return false; } } catch (Exception e) { return false; } } return true; }
java
private boolean annotationEquals(Object object) { if (object == null || !(object instanceof Annotation) || !annotationType.equals(((Annotation) object).annotationType())) { return false; } for (Map.Entry<String, Method> entry : attributes.entrySet()) { String methodName = entry.getKey(); Method method = entry.getValue(); Object otherValue; try { otherValue = method.invoke(object); Object value = attributeData.get(methodName); if (!attributeEquals(value, otherValue)) { return false; } } catch (Exception e) { return false; } } return true; }
[ "private", "boolean", "annotationEquals", "(", "Object", "object", ")", "{", "if", "(", "object", "==", "null", "||", "!", "(", "object", "instanceof", "Annotation", ")", "||", "!", "annotationType", ".", "equals", "(", "(", "(", "Annotation", ")", "object", ")", ".", "annotationType", "(", ")", ")", ")", "{", "return", "false", ";", "}", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Method", ">", "entry", ":", "attributes", ".", "entrySet", "(", ")", ")", "{", "String", "methodName", "=", "entry", ".", "getKey", "(", ")", ";", "Method", "method", "=", "entry", ".", "getValue", "(", ")", ";", "Object", "otherValue", ";", "try", "{", "otherValue", "=", "method", ".", "invoke", "(", "object", ")", ";", "Object", "value", "=", "attributeData", ".", "get", "(", "methodName", ")", ";", "if", "(", "!", "attributeEquals", "(", "value", ",", "otherValue", ")", ")", "{", "return", "false", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Returns true if the specified object represents an annotation that is logically equivalent to this one. @param object Object to inspect. @return true if same annnotationType and all attributes are equal, else false.
[ "Returns", "true", "if", "the", "specified", "object", "represents", "an", "annotation", "that", "is", "logically", "equivalent", "to", "this", "one", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/annotation/cglib/AnnotationMethodInterceptor.java#L65-L88
153,903
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/annotation/cglib/AnnotationMethodInterceptor.java
AnnotationMethodInterceptor.attributeEquals
private boolean attributeEquals(Object value, Object otherValue) { if (value == null && otherValue == null) { return true; } else if (value == null || otherValue == null) { return false; } else { if (value.getClass().isArray()) { return Arrays.equals((Object[]) value, (Object[]) otherValue); } else { return value.equals(otherValue); } } }
java
private boolean attributeEquals(Object value, Object otherValue) { if (value == null && otherValue == null) { return true; } else if (value == null || otherValue == null) { return false; } else { if (value.getClass().isArray()) { return Arrays.equals((Object[]) value, (Object[]) otherValue); } else { return value.equals(otherValue); } } }
[ "private", "boolean", "attributeEquals", "(", "Object", "value", ",", "Object", "otherValue", ")", "{", "if", "(", "value", "==", "null", "&&", "otherValue", "==", "null", ")", "{", "return", "true", ";", "}", "else", "if", "(", "value", "==", "null", "||", "otherValue", "==", "null", ")", "{", "return", "false", ";", "}", "else", "{", "if", "(", "value", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "return", "Arrays", ".", "equals", "(", "(", "Object", "[", "]", ")", "value", ",", "(", "Object", "[", "]", ")", "otherValue", ")", ";", "}", "else", "{", "return", "value", ".", "equals", "(", "otherValue", ")", ";", "}", "}", "}" ]
Returns true if two attributes are equal. @param value First attribute value @param otherValue Second attribute value @return true if two attributes are equal.
[ "Returns", "true", "if", "two", "attributes", "are", "equal", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/annotation/cglib/AnnotationMethodInterceptor.java#L98-L111
153,904
tvesalainen/util
util/src/main/java/org/vesalainen/management/SimpleNotificationEmitter.java
SimpleNotificationEmitter.sendNotification
public synchronized void sendNotification(Supplier<String> textSupplier, Supplier<U> userDataSupplier, LongSupplier timestampSupplier) { if (!map.isEmpty()) { sendNotification(textSupplier.get(), userDataSupplier.get(), timestampSupplier.getAsLong()); } }
java
public synchronized void sendNotification(Supplier<String> textSupplier, Supplier<U> userDataSupplier, LongSupplier timestampSupplier) { if (!map.isEmpty()) { sendNotification(textSupplier.get(), userDataSupplier.get(), timestampSupplier.getAsLong()); } }
[ "public", "synchronized", "void", "sendNotification", "(", "Supplier", "<", "String", ">", "textSupplier", ",", "Supplier", "<", "U", ">", "userDataSupplier", ",", "LongSupplier", "timestampSupplier", ")", "{", "if", "(", "!", "map", ".", "isEmpty", "(", ")", ")", "{", "sendNotification", "(", "textSupplier", ".", "get", "(", ")", ",", "userDataSupplier", ".", "get", "(", ")", ",", "timestampSupplier", ".", "getAsLong", "(", ")", ")", ";", "}", "}" ]
Send notification. supplier is called only if there are listeners @param textSupplier @param userDataSupplier @param timestampSupplier
[ "Send", "notification", ".", "supplier", "is", "called", "only", "if", "there", "are", "listeners" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/management/SimpleNotificationEmitter.java#L77-L83
153,905
tvesalainen/util
util/src/main/java/org/vesalainen/management/SimpleNotificationEmitter.java
SimpleNotificationEmitter.sendNotification
public synchronized void sendNotification(String text, U userData, long timestamp) { map.allValues() .forEach((ListenerWrapper w)->executor.execute(()->w.sendNotification(text, userData, timestamp))); }
java
public synchronized void sendNotification(String text, U userData, long timestamp) { map.allValues() .forEach((ListenerWrapper w)->executor.execute(()->w.sendNotification(text, userData, timestamp))); }
[ "public", "synchronized", "void", "sendNotification", "(", "String", "text", ",", "U", "userData", ",", "long", "timestamp", ")", "{", "map", ".", "allValues", "(", ")", ".", "forEach", "(", "(", "ListenerWrapper", "w", ")", "->", "executor", ".", "execute", "(", "(", ")", "->", "w", ".", "sendNotification", "(", "text", ",", "userData", ",", "timestamp", ")", ")", ")", ";", "}" ]
Send notification. @param text @param userData @param timestamp
[ "Send", "notification", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/management/SimpleNotificationEmitter.java#L90-L94
153,906
isisaddons-legacy/isis-module-sessionlogger
dom/src/main/java/org/isisaddons/module/sessionlogger/dom/SessionLogEntryRepository.java
SessionLogEntryRepository.logoutAllSessions
@Programmatic public void logoutAllSessions(final Timestamp logoutTimestamp) { final PersistenceManager pm = isisJdoSupport.getJdoPersistenceManager(); final Properties properties = pm.getPersistenceManagerFactory().getProperties(); if(isTrue(properties.get(DN_BULK_UPDATES_KEY))) { final javax.jdo.Query jdoQuery = pm.newNamedQuery(SessionLogEntry.class, "logoutAllActiveSessions"); final Map argumentsByParameterName = ImmutableMap.of( "logoutTimestamp", logoutTimestamp, "causedBy2", SessionLogEntry.CausedBy2.RESTART); try { final Long numRows = (Long) jdoQuery.executeWithMap(argumentsByParameterName); } finally { jdoQuery.closeAll(); } } else { final List<SessionLogEntry> activeEntries = repositoryService.allMatches(new QueryDefault<>(SessionLogEntry.class, "listAllActiveSessions")); for (SessionLogEntry activeEntry : activeEntries) { activeEntry.setCausedBy2(SessionLogEntry.CausedBy2.RESTART); activeEntry.setLogoutTimestamp(logoutTimestamp); } } }
java
@Programmatic public void logoutAllSessions(final Timestamp logoutTimestamp) { final PersistenceManager pm = isisJdoSupport.getJdoPersistenceManager(); final Properties properties = pm.getPersistenceManagerFactory().getProperties(); if(isTrue(properties.get(DN_BULK_UPDATES_KEY))) { final javax.jdo.Query jdoQuery = pm.newNamedQuery(SessionLogEntry.class, "logoutAllActiveSessions"); final Map argumentsByParameterName = ImmutableMap.of( "logoutTimestamp", logoutTimestamp, "causedBy2", SessionLogEntry.CausedBy2.RESTART); try { final Long numRows = (Long) jdoQuery.executeWithMap(argumentsByParameterName); } finally { jdoQuery.closeAll(); } } else { final List<SessionLogEntry> activeEntries = repositoryService.allMatches(new QueryDefault<>(SessionLogEntry.class, "listAllActiveSessions")); for (SessionLogEntry activeEntry : activeEntries) { activeEntry.setCausedBy2(SessionLogEntry.CausedBy2.RESTART); activeEntry.setLogoutTimestamp(logoutTimestamp); } } }
[ "@", "Programmatic", "public", "void", "logoutAllSessions", "(", "final", "Timestamp", "logoutTimestamp", ")", "{", "final", "PersistenceManager", "pm", "=", "isisJdoSupport", ".", "getJdoPersistenceManager", "(", ")", ";", "final", "Properties", "properties", "=", "pm", ".", "getPersistenceManagerFactory", "(", ")", ".", "getProperties", "(", ")", ";", "if", "(", "isTrue", "(", "properties", ".", "get", "(", "DN_BULK_UPDATES_KEY", ")", ")", ")", "{", "final", "javax", ".", "jdo", ".", "Query", "jdoQuery", "=", "pm", ".", "newNamedQuery", "(", "SessionLogEntry", ".", "class", ",", "\"logoutAllActiveSessions\"", ")", ";", "final", "Map", "argumentsByParameterName", "=", "ImmutableMap", ".", "of", "(", "\"logoutTimestamp\"", ",", "logoutTimestamp", ",", "\"causedBy2\"", ",", "SessionLogEntry", ".", "CausedBy2", ".", "RESTART", ")", ";", "try", "{", "final", "Long", "numRows", "=", "(", "Long", ")", "jdoQuery", ".", "executeWithMap", "(", "argumentsByParameterName", ")", ";", "}", "finally", "{", "jdoQuery", ".", "closeAll", "(", ")", ";", "}", "}", "else", "{", "final", "List", "<", "SessionLogEntry", ">", "activeEntries", "=", "repositoryService", ".", "allMatches", "(", "new", "QueryDefault", "<>", "(", "SessionLogEntry", ".", "class", ",", "\"listAllActiveSessions\"", ")", ")", ";", "for", "(", "SessionLogEntry", "activeEntry", ":", "activeEntries", ")", "{", "activeEntry", ".", "setCausedBy2", "(", "SessionLogEntry", ".", "CausedBy2", ".", "RESTART", ")", ";", "activeEntry", ".", "setLogoutTimestamp", "(", "logoutTimestamp", ")", ";", "}", "}", "}" ]
region > logoutAllSessions
[ "region", ">", "logoutAllSessions" ]
4786d59a8068fefedf5e716793947edaf479c5a8
https://github.com/isisaddons-legacy/isis-module-sessionlogger/blob/4786d59a8068fefedf5e716793947edaf479c5a8/dom/src/main/java/org/isisaddons/module/sessionlogger/dom/SessionLogEntryRepository.java#L54-L79
153,907
isisaddons-legacy/isis-module-sessionlogger
dom/src/main/java/org/isisaddons/module/sessionlogger/dom/SessionLogEntryRepository.java
SessionLogEntryRepository.findBySessionId
@Programmatic public SessionLogEntry findBySessionId(final String sessionId) { return repositoryService.firstMatch( new QueryDefault<>(SessionLogEntry.class, "findBySessionId", "sessionId", sessionId)); }
java
@Programmatic public SessionLogEntry findBySessionId(final String sessionId) { return repositoryService.firstMatch( new QueryDefault<>(SessionLogEntry.class, "findBySessionId", "sessionId", sessionId)); }
[ "@", "Programmatic", "public", "SessionLogEntry", "findBySessionId", "(", "final", "String", "sessionId", ")", "{", "return", "repositoryService", ".", "firstMatch", "(", "new", "QueryDefault", "<>", "(", "SessionLogEntry", ".", "class", ",", "\"findBySessionId\"", ",", "\"sessionId\"", ",", "sessionId", ")", ")", ";", "}" ]
region > findBySessionId
[ "region", ">", "findBySessionId" ]
4786d59a8068fefedf5e716793947edaf479c5a8
https://github.com/isisaddons-legacy/isis-module-sessionlogger/blob/4786d59a8068fefedf5e716793947edaf479c5a8/dom/src/main/java/org/isisaddons/module/sessionlogger/dom/SessionLogEntryRepository.java#L105-L111
153,908
isisaddons-legacy/isis-module-sessionlogger
dom/src/main/java/org/isisaddons/module/sessionlogger/dom/SessionLogEntryRepository.java
SessionLogEntryRepository.findByUserAndStrictlyBefore
@Programmatic public List<SessionLogEntry> findByUserAndStrictlyBefore( final String user, final Timestamp from) { return repositoryService.allMatches(new QueryDefault<>(SessionLogEntry.class, "findByUserAndTimestampStrictlyBefore", "user", user, "from", from)); }
java
@Programmatic public List<SessionLogEntry> findByUserAndStrictlyBefore( final String user, final Timestamp from) { return repositoryService.allMatches(new QueryDefault<>(SessionLogEntry.class, "findByUserAndTimestampStrictlyBefore", "user", user, "from", from)); }
[ "@", "Programmatic", "public", "List", "<", "SessionLogEntry", ">", "findByUserAndStrictlyBefore", "(", "final", "String", "user", ",", "final", "Timestamp", "from", ")", "{", "return", "repositoryService", ".", "allMatches", "(", "new", "QueryDefault", "<>", "(", "SessionLogEntry", ".", "class", ",", "\"findByUserAndTimestampStrictlyBefore\"", ",", "\"user\"", ",", "user", ",", "\"from\"", ",", "from", ")", ")", ";", "}" ]
region > findByUserAndStrictlyBefore
[ "region", ">", "findByUserAndStrictlyBefore" ]
4786d59a8068fefedf5e716793947edaf479c5a8
https://github.com/isisaddons-legacy/isis-module-sessionlogger/blob/4786d59a8068fefedf5e716793947edaf479c5a8/dom/src/main/java/org/isisaddons/module/sessionlogger/dom/SessionLogEntryRepository.java#L207-L216
153,909
bremersee/pagebuilder
bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java
PaginationDto.getMaxPaginationLinks
@XmlElement(name = "maxPaginationLinks", defaultValue = "7") @JsonProperty(value = "maxPaginationLinks", required = true) @ApiModelProperty(value = "The maximum number of pagination links.", required = true, example = "7") public int getMaxPaginationLinks() { return maxPaginationLinks; }
java
@XmlElement(name = "maxPaginationLinks", defaultValue = "7") @JsonProperty(value = "maxPaginationLinks", required = true) @ApiModelProperty(value = "The maximum number of pagination links.", required = true, example = "7") public int getMaxPaginationLinks() { return maxPaginationLinks; }
[ "@", "XmlElement", "(", "name", "=", "\"maxPaginationLinks\"", ",", "defaultValue", "=", "\"7\"", ")", "@", "JsonProperty", "(", "value", "=", "\"maxPaginationLinks\"", ",", "required", "=", "true", ")", "@", "ApiModelProperty", "(", "value", "=", "\"The maximum number of pagination links.\"", ",", "required", "=", "true", ",", "example", "=", "\"7\"", ")", "public", "int", "getMaxPaginationLinks", "(", ")", "{", "return", "maxPaginationLinks", ";", "}" ]
Returns the maximum number of pagination links. @return the maximum number of pagination links
[ "Returns", "the", "maximum", "number", "of", "pagination", "links", "." ]
498614b02f577b08d2d65131ba472a09f080a192
https://github.com/bremersee/pagebuilder/blob/498614b02f577b08d2d65131ba472a09f080a192/bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java#L164-L169
153,910
bremersee/pagebuilder
bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java
PaginationDto.getFirstPageLink
@XmlElement(name = "firstPageLink") @JsonProperty(value = "firstPageLink") @ApiModelProperty(value = "The first pagination link.", position = 1) public PageRequestLinkDto getFirstPageLink() { return firstPageLink; }
java
@XmlElement(name = "firstPageLink") @JsonProperty(value = "firstPageLink") @ApiModelProperty(value = "The first pagination link.", position = 1) public PageRequestLinkDto getFirstPageLink() { return firstPageLink; }
[ "@", "XmlElement", "(", "name", "=", "\"firstPageLink\"", ")", "@", "JsonProperty", "(", "value", "=", "\"firstPageLink\"", ")", "@", "ApiModelProperty", "(", "value", "=", "\"The first pagination link.\"", ",", "position", "=", "1", ")", "public", "PageRequestLinkDto", "getFirstPageLink", "(", ")", "{", "return", "firstPageLink", ";", "}" ]
Returns the first pagination link. @return the first pagination link
[ "Returns", "the", "first", "pagination", "link", "." ]
498614b02f577b08d2d65131ba472a09f080a192
https://github.com/bremersee/pagebuilder/blob/498614b02f577b08d2d65131ba472a09f080a192/bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java#L190-L195
153,911
bremersee/pagebuilder
bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java
PaginationDto.getPreviousPageLink
@XmlElement(name = "previousPageLink") @JsonProperty(value = "previousPageLink") @ApiModelProperty(value = "The previous pagination link.", position = 2) public PageRequestLinkDto getPreviousPageLink() { return previousPageLink; }
java
@XmlElement(name = "previousPageLink") @JsonProperty(value = "previousPageLink") @ApiModelProperty(value = "The previous pagination link.", position = 2) public PageRequestLinkDto getPreviousPageLink() { return previousPageLink; }
[ "@", "XmlElement", "(", "name", "=", "\"previousPageLink\"", ")", "@", "JsonProperty", "(", "value", "=", "\"previousPageLink\"", ")", "@", "ApiModelProperty", "(", "value", "=", "\"The previous pagination link.\"", ",", "position", "=", "2", ")", "public", "PageRequestLinkDto", "getPreviousPageLink", "(", ")", "{", "return", "previousPageLink", ";", "}" ]
Returns the previous pagination link. @return the previous pagination link
[ "Returns", "the", "previous", "pagination", "link", "." ]
498614b02f577b08d2d65131ba472a09f080a192
https://github.com/bremersee/pagebuilder/blob/498614b02f577b08d2d65131ba472a09f080a192/bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java#L212-L217
153,912
bremersee/pagebuilder
bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java
PaginationDto.getLinks
@XmlElementWrapper(name = "links") @XmlElement(name = "link") @JsonProperty(value = "links") @ApiModelProperty(value = "The pagination links.", position = 3) public List<PageRequestLinkDto> getLinks() { return links; }
java
@XmlElementWrapper(name = "links") @XmlElement(name = "link") @JsonProperty(value = "links") @ApiModelProperty(value = "The pagination links.", position = 3) public List<PageRequestLinkDto> getLinks() { return links; }
[ "@", "XmlElementWrapper", "(", "name", "=", "\"links\"", ")", "@", "XmlElement", "(", "name", "=", "\"link\"", ")", "@", "JsonProperty", "(", "value", "=", "\"links\"", ")", "@", "ApiModelProperty", "(", "value", "=", "\"The pagination links.\"", ",", "position", "=", "3", ")", "public", "List", "<", "PageRequestLinkDto", ">", "getLinks", "(", ")", "{", "return", "links", ";", "}" ]
Returns the pagination links. @return the pagination links
[ "Returns", "the", "pagination", "links", "." ]
498614b02f577b08d2d65131ba472a09f080a192
https://github.com/bremersee/pagebuilder/blob/498614b02f577b08d2d65131ba472a09f080a192/bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java#L234-L240
153,913
bremersee/pagebuilder
bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java
PaginationDto.setLinks
@JsonProperty(value = "links") public void setLinks(List<PageRequestLinkDto> links) { if (links == null) { this.links = new ArrayList<>(); } else { this.links = links; } }
java
@JsonProperty(value = "links") public void setLinks(List<PageRequestLinkDto> links) { if (links == null) { this.links = new ArrayList<>(); } else { this.links = links; } }
[ "@", "JsonProperty", "(", "value", "=", "\"links\"", ")", "public", "void", "setLinks", "(", "List", "<", "PageRequestLinkDto", ">", "links", ")", "{", "if", "(", "links", "==", "null", ")", "{", "this", ".", "links", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "else", "{", "this", ".", "links", "=", "links", ";", "}", "}" ]
Sets the pagination links. @param links the pagination links
[ "Sets", "the", "pagination", "links", "." ]
498614b02f577b08d2d65131ba472a09f080a192
https://github.com/bremersee/pagebuilder/blob/498614b02f577b08d2d65131ba472a09f080a192/bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java#L247-L254
153,914
bremersee/pagebuilder
bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java
PaginationDto.getNextPageLink
@XmlElement(name = "nextPageLink") @JsonProperty(value = "nextPageLink") @ApiModelProperty(value = "The next pagination link.", position = 4) public PageRequestLinkDto getNextPageLink() { return nextPageLink; }
java
@XmlElement(name = "nextPageLink") @JsonProperty(value = "nextPageLink") @ApiModelProperty(value = "The next pagination link.", position = 4) public PageRequestLinkDto getNextPageLink() { return nextPageLink; }
[ "@", "XmlElement", "(", "name", "=", "\"nextPageLink\"", ")", "@", "JsonProperty", "(", "value", "=", "\"nextPageLink\"", ")", "@", "ApiModelProperty", "(", "value", "=", "\"The next pagination link.\"", ",", "position", "=", "4", ")", "public", "PageRequestLinkDto", "getNextPageLink", "(", ")", "{", "return", "nextPageLink", ";", "}" ]
Returns the next pagination link. @return the next pagination link
[ "Returns", "the", "next", "pagination", "link", "." ]
498614b02f577b08d2d65131ba472a09f080a192
https://github.com/bremersee/pagebuilder/blob/498614b02f577b08d2d65131ba472a09f080a192/bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java#L261-L266
153,915
bremersee/pagebuilder
bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java
PaginationDto.getLastPageLink
@XmlElement(name = "lastPageLink") @JsonProperty(value = "lastPageLink") @ApiModelProperty(value = "The last pagination link.", position = 5) public PageRequestLinkDto getLastPageLink() { return lastPageLink; }
java
@XmlElement(name = "lastPageLink") @JsonProperty(value = "lastPageLink") @ApiModelProperty(value = "The last pagination link.", position = 5) public PageRequestLinkDto getLastPageLink() { return lastPageLink; }
[ "@", "XmlElement", "(", "name", "=", "\"lastPageLink\"", ")", "@", "JsonProperty", "(", "value", "=", "\"lastPageLink\"", ")", "@", "ApiModelProperty", "(", "value", "=", "\"The last pagination link.\"", ",", "position", "=", "5", ")", "public", "PageRequestLinkDto", "getLastPageLink", "(", ")", "{", "return", "lastPageLink", ";", "}" ]
Returns the last pagination link. @return the last pagination link
[ "Returns", "the", "last", "pagination", "link", "." ]
498614b02f577b08d2d65131ba472a09f080a192
https://github.com/bremersee/pagebuilder/blob/498614b02f577b08d2d65131ba472a09f080a192/bremersee-pagebuilder/src/main/java/org/bremersee/pagebuilder/model/PaginationDto.java#L283-L288
153,916
jeremiehuchet/acrachilisync
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/AcraToChiliprojectSyncer.java
AcraToChiliprojectSyncer.retrieveUnsyncedElements
private List<EditableAcraReport> retrieveUnsyncedElements() throws IOException, ServiceException { final ListFeed listFeed = client.getFeed(listFeedUrl, ListFeed.class); final List<EditableAcraReport> reports = new ArrayList<EditableAcraReport>(); for (final ListEntry listEntry : listFeed.getEntries()) { try { reports.add(new EditableAcraReport(listEntry)); } catch (final MalformedSpreadsheetLineException e) { // log the error message LOGGER.error(e.getMessage()); } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("found {} reports to sync", CollectionUtils.size(reports)); if (LOGGER.isTraceEnabled()) { for (final EditableAcraReport report : reports) { LOGGER.trace("reportId={} stacktraceMd5={}", report.getId(), report.getStacktraceMD5()); } } } return reports; }
java
private List<EditableAcraReport> retrieveUnsyncedElements() throws IOException, ServiceException { final ListFeed listFeed = client.getFeed(listFeedUrl, ListFeed.class); final List<EditableAcraReport> reports = new ArrayList<EditableAcraReport>(); for (final ListEntry listEntry : listFeed.getEntries()) { try { reports.add(new EditableAcraReport(listEntry)); } catch (final MalformedSpreadsheetLineException e) { // log the error message LOGGER.error(e.getMessage()); } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("found {} reports to sync", CollectionUtils.size(reports)); if (LOGGER.isTraceEnabled()) { for (final EditableAcraReport report : reports) { LOGGER.trace("reportId={} stacktraceMd5={}", report.getId(), report.getStacktraceMD5()); } } } return reports; }
[ "private", "List", "<", "EditableAcraReport", ">", "retrieveUnsyncedElements", "(", ")", "throws", "IOException", ",", "ServiceException", "{", "final", "ListFeed", "listFeed", "=", "client", ".", "getFeed", "(", "listFeedUrl", ",", "ListFeed", ".", "class", ")", ";", "final", "List", "<", "EditableAcraReport", ">", "reports", "=", "new", "ArrayList", "<", "EditableAcraReport", ">", "(", ")", ";", "for", "(", "final", "ListEntry", "listEntry", ":", "listFeed", ".", "getEntries", "(", ")", ")", "{", "try", "{", "reports", ".", "add", "(", "new", "EditableAcraReport", "(", "listEntry", ")", ")", ";", "}", "catch", "(", "final", "MalformedSpreadsheetLineException", "e", ")", "{", "// log the error message", "LOGGER", ".", "error", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"found {} reports to sync\"", ",", "CollectionUtils", ".", "size", "(", "reports", ")", ")", ";", "if", "(", "LOGGER", ".", "isTraceEnabled", "(", ")", ")", "{", "for", "(", "final", "EditableAcraReport", "report", ":", "reports", ")", "{", "LOGGER", ".", "trace", "(", "\"reportId={} stacktraceMd5={}\"", ",", "report", ".", "getId", "(", ")", ",", "report", ".", "getStacktraceMD5", "(", ")", ")", ";", "}", "}", "}", "return", "reports", ";", "}" ]
Gets unsynchronized Acra reports from the Google spreadsheet. @return the list of rows of the Acra reports spreadsheet not already synchronized @throws IOException @throws ServiceException
[ "Gets", "unsynchronized", "Acra", "reports", "from", "the", "Google", "spreadsheet", "." ]
4eadb0218623e77e0d92b5a08515eea2db51e988
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/AcraToChiliprojectSyncer.java#L152-L175
153,917
jeremiehuchet/acrachilisync
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/AcraToChiliprojectSyncer.java
AcraToChiliprojectSyncer.startSynchronization
public void startSynchronization() throws IOException, ServiceException, AuthenticationException, NotFoundException, RedmineException, ParseException { // retrieve new issues final List<EditableAcraReport> listReports = retrieveUnsyncedElements(); // update Chiliproject for (final EditableAcraReport report : listReports) { final Issue issue = getIssueForStack(report.getStacktraceMD5()); try { if (null == issue) { LOGGER.debug("Got a new bugreport: reportId={}", report.getId()); for (final AcraReportHandler handler : reportHandlers) { handler.onNewReport(report); } } else if (ChiliprojectUtils.isSynchronized(report, issue)) { LOGGER.debug("Got a bugreport already synchronized: reportId={}", report.getId()); for (final AcraReportHandler handler : reportHandlers) { handler.onKnownIssueAlreadySynchronized(report, issue); } } else { LOGGER.debug( "Got a new bugreport with a stacktrace similar to an existing ticket: reportId={}", report.getId()); for (final AcraReportHandler handler : reportHandlers) { handler.onKnownIssueNotSynchronized(report, issue); } } } catch (final SynchronizationException e) { report.mergeSyncStatus(SyncStatus.FAILURE); LOGGER.error("Unable to synchronize ACRA report " + report.getId(), e); } } try { for (final AcraReportHandler handler : reportHandlers) { handler.onFinishReceivingNewReports(); } } catch (final SynchronizationException e) { for (final EditableAcraReport report : listReports) { report.mergeSyncStatus(SyncStatus.FAILURE); } LOGGER.error("Unable to finalize ACRA report synchronization"); } // update/set stack_trace_md5 cells for (final EditableAcraReport report : listReports) { if (SyncStatus.SUCCESS.equals(report.getStatus())) { report.commitStacktraceMD5(); } } }
java
public void startSynchronization() throws IOException, ServiceException, AuthenticationException, NotFoundException, RedmineException, ParseException { // retrieve new issues final List<EditableAcraReport> listReports = retrieveUnsyncedElements(); // update Chiliproject for (final EditableAcraReport report : listReports) { final Issue issue = getIssueForStack(report.getStacktraceMD5()); try { if (null == issue) { LOGGER.debug("Got a new bugreport: reportId={}", report.getId()); for (final AcraReportHandler handler : reportHandlers) { handler.onNewReport(report); } } else if (ChiliprojectUtils.isSynchronized(report, issue)) { LOGGER.debug("Got a bugreport already synchronized: reportId={}", report.getId()); for (final AcraReportHandler handler : reportHandlers) { handler.onKnownIssueAlreadySynchronized(report, issue); } } else { LOGGER.debug( "Got a new bugreport with a stacktrace similar to an existing ticket: reportId={}", report.getId()); for (final AcraReportHandler handler : reportHandlers) { handler.onKnownIssueNotSynchronized(report, issue); } } } catch (final SynchronizationException e) { report.mergeSyncStatus(SyncStatus.FAILURE); LOGGER.error("Unable to synchronize ACRA report " + report.getId(), e); } } try { for (final AcraReportHandler handler : reportHandlers) { handler.onFinishReceivingNewReports(); } } catch (final SynchronizationException e) { for (final EditableAcraReport report : listReports) { report.mergeSyncStatus(SyncStatus.FAILURE); } LOGGER.error("Unable to finalize ACRA report synchronization"); } // update/set stack_trace_md5 cells for (final EditableAcraReport report : listReports) { if (SyncStatus.SUCCESS.equals(report.getStatus())) { report.commitStacktraceMD5(); } } }
[ "public", "void", "startSynchronization", "(", ")", "throws", "IOException", ",", "ServiceException", ",", "AuthenticationException", ",", "NotFoundException", ",", "RedmineException", ",", "ParseException", "{", "// retrieve new issues", "final", "List", "<", "EditableAcraReport", ">", "listReports", "=", "retrieveUnsyncedElements", "(", ")", ";", "// update Chiliproject", "for", "(", "final", "EditableAcraReport", "report", ":", "listReports", ")", "{", "final", "Issue", "issue", "=", "getIssueForStack", "(", "report", ".", "getStacktraceMD5", "(", ")", ")", ";", "try", "{", "if", "(", "null", "==", "issue", ")", "{", "LOGGER", ".", "debug", "(", "\"Got a new bugreport: reportId={}\"", ",", "report", ".", "getId", "(", ")", ")", ";", "for", "(", "final", "AcraReportHandler", "handler", ":", "reportHandlers", ")", "{", "handler", ".", "onNewReport", "(", "report", ")", ";", "}", "}", "else", "if", "(", "ChiliprojectUtils", ".", "isSynchronized", "(", "report", ",", "issue", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"Got a bugreport already synchronized: reportId={}\"", ",", "report", ".", "getId", "(", ")", ")", ";", "for", "(", "final", "AcraReportHandler", "handler", ":", "reportHandlers", ")", "{", "handler", ".", "onKnownIssueAlreadySynchronized", "(", "report", ",", "issue", ")", ";", "}", "}", "else", "{", "LOGGER", ".", "debug", "(", "\"Got a new bugreport with a stacktrace similar to an existing ticket: reportId={}\"", ",", "report", ".", "getId", "(", ")", ")", ";", "for", "(", "final", "AcraReportHandler", "handler", ":", "reportHandlers", ")", "{", "handler", ".", "onKnownIssueNotSynchronized", "(", "report", ",", "issue", ")", ";", "}", "}", "}", "catch", "(", "final", "SynchronizationException", "e", ")", "{", "report", ".", "mergeSyncStatus", "(", "SyncStatus", ".", "FAILURE", ")", ";", "LOGGER", ".", "error", "(", "\"Unable to synchronize ACRA report \"", "+", "report", ".", "getId", "(", ")", ",", "e", ")", ";", "}", "}", "try", "{", "for", "(", "final", "AcraReportHandler", "handler", ":", "reportHandlers", ")", "{", "handler", ".", "onFinishReceivingNewReports", "(", ")", ";", "}", "}", "catch", "(", "final", "SynchronizationException", "e", ")", "{", "for", "(", "final", "EditableAcraReport", "report", ":", "listReports", ")", "{", "report", ".", "mergeSyncStatus", "(", "SyncStatus", ".", "FAILURE", ")", ";", "}", "LOGGER", ".", "error", "(", "\"Unable to finalize ACRA report synchronization\"", ")", ";", "}", "// update/set stack_trace_md5 cells", "for", "(", "final", "EditableAcraReport", "report", ":", "listReports", ")", "{", "if", "(", "SyncStatus", ".", "SUCCESS", ".", "equals", "(", "report", ".", "getStatus", "(", ")", ")", ")", "{", "report", ".", "commitStacktraceMD5", "(", ")", ";", "}", "}", "}" ]
Starts the synchronization between Acra reports Google spreadsheet and Chiliproject bugtracker. @throws IOException @throws ServiceException @throws RedmineException @throws NotFoundException @throws AuthenticationException @throws ParseException
[ "Starts", "the", "synchronization", "between", "Acra", "reports", "Google", "spreadsheet", "and", "Chiliproject", "bugtracker", "." ]
4eadb0218623e77e0d92b5a08515eea2db51e988
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/AcraToChiliprojectSyncer.java#L188-L242
153,918
jeremiehuchet/acrachilisync
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/AcraToChiliprojectSyncer.java
AcraToChiliprojectSyncer.getIssueForStack
private Issue getIssueForStack(final String pStacktraceMD5) throws IOException, AuthenticationException, NotFoundException, RedmineException { final Map<String, String> parameters = new HashMap<String, String>(); parameters.put("project_id", String.valueOf(config.CHILIPROJECT_PROJECT_ID)); parameters.put(String.format("cf_%d", config.CHILIPROJECT_STACKTRACE_MD5_CF_ID), pStacktraceMD5); final List<Issue> results = redmineClient.getIssues(parameters); Issue issue = null; if (CollectionUtils.size(results) > 1) { issue = handleMultipleIssuesForSameStacktrace(results); } else if (CollectionUtils.size(results) == 1) { issue = results.get(0); } return issue; }
java
private Issue getIssueForStack(final String pStacktraceMD5) throws IOException, AuthenticationException, NotFoundException, RedmineException { final Map<String, String> parameters = new HashMap<String, String>(); parameters.put("project_id", String.valueOf(config.CHILIPROJECT_PROJECT_ID)); parameters.put(String.format("cf_%d", config.CHILIPROJECT_STACKTRACE_MD5_CF_ID), pStacktraceMD5); final List<Issue> results = redmineClient.getIssues(parameters); Issue issue = null; if (CollectionUtils.size(results) > 1) { issue = handleMultipleIssuesForSameStacktrace(results); } else if (CollectionUtils.size(results) == 1) { issue = results.get(0); } return issue; }
[ "private", "Issue", "getIssueForStack", "(", "final", "String", "pStacktraceMD5", ")", "throws", "IOException", ",", "AuthenticationException", ",", "NotFoundException", ",", "RedmineException", "{", "final", "Map", "<", "String", ",", "String", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"project_id\"", ",", "String", ".", "valueOf", "(", "config", ".", "CHILIPROJECT_PROJECT_ID", ")", ")", ";", "parameters", ".", "put", "(", "String", ".", "format", "(", "\"cf_%d\"", ",", "config", ".", "CHILIPROJECT_STACKTRACE_MD5_CF_ID", ")", ",", "pStacktraceMD5", ")", ";", "final", "List", "<", "Issue", ">", "results", "=", "redmineClient", ".", "getIssues", "(", "parameters", ")", ";", "Issue", "issue", "=", "null", ";", "if", "(", "CollectionUtils", ".", "size", "(", "results", ")", ">", "1", ")", "{", "issue", "=", "handleMultipleIssuesForSameStacktrace", "(", "results", ")", ";", "}", "else", "if", "(", "CollectionUtils", ".", "size", "(", "results", ")", "==", "1", ")", "{", "issue", "=", "results", ".", "get", "(", "0", ")", ";", "}", "return", "issue", ";", "}" ]
Search for the issue related to the given MD5 stacktrace hash. @param pStacktraceMD5 an MD5 stacktrace hash @return the Chiliproject issue related to the given stacktrace or null if no issue found @throws IOException @throws AuthenticationException @throws NotFoundException @throws RedmineException
[ "Search", "for", "the", "issue", "related", "to", "the", "given", "MD5", "stacktrace", "hash", "." ]
4eadb0218623e77e0d92b5a08515eea2db51e988
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/AcraToChiliprojectSyncer.java#L255-L270
153,919
tvesalainen/util
util/src/main/java/org/vesalainen/util/AbstractMapSet.java
AbstractMapSet.get
@Override public Set<V> get(Object key) { Set<V> set = map.get(key); return set != null ? set : Collections.EMPTY_SET; }
java
@Override public Set<V> get(Object key) { Set<V> set = map.get(key); return set != null ? set : Collections.EMPTY_SET; }
[ "@", "Override", "public", "Set", "<", "V", ">", "get", "(", "Object", "key", ")", "{", "Set", "<", "V", ">", "set", "=", "map", ".", "get", "(", "key", ")", ";", "return", "set", "!=", "null", "?", "set", ":", "Collections", ".", "EMPTY_SET", ";", "}" ]
Returns mapped set. Returns empty set if no mapping exists. @param key @return
[ "Returns", "mapped", "set", ".", "Returns", "empty", "set", "if", "no", "mapping", "exists", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/AbstractMapSet.java#L155-L160
153,920
TrueNight/Utils
safe-typeface/src/main/java/xyz/truenight/safetypeface/SafeTypeface.java
SafeTypeface.createFromAsset
public static Typeface createFromAsset(AssetManager mgr, String path) { Typeface typeface = TYPEFACES.get(path); if (typeface != null) { return typeface; } else { typeface = Typeface.createFromAsset(mgr, path); TYPEFACES.put(path, typeface); return typeface; } }
java
public static Typeface createFromAsset(AssetManager mgr, String path) { Typeface typeface = TYPEFACES.get(path); if (typeface != null) { return typeface; } else { typeface = Typeface.createFromAsset(mgr, path); TYPEFACES.put(path, typeface); return typeface; } }
[ "public", "static", "Typeface", "createFromAsset", "(", "AssetManager", "mgr", ",", "String", "path", ")", "{", "Typeface", "typeface", "=", "TYPEFACES", ".", "get", "(", "path", ")", ";", "if", "(", "typeface", "!=", "null", ")", "{", "return", "typeface", ";", "}", "else", "{", "typeface", "=", "Typeface", ".", "createFromAsset", "(", "mgr", ",", "path", ")", ";", "TYPEFACES", ".", "put", "(", "path", ",", "typeface", ")", ";", "return", "typeface", ";", "}", "}" ]
Create a new typeface from the specified font data. @param mgr The application's asset manager @param path The file name of the font data in the assets directory @return The new typeface.
[ "Create", "a", "new", "typeface", "from", "the", "specified", "font", "data", "." ]
78a11faa16258b09f08826797370310ab650530c
https://github.com/TrueNight/Utils/blob/78a11faa16258b09f08826797370310ab650530c/safe-typeface/src/main/java/xyz/truenight/safetypeface/SafeTypeface.java#L40-L49
153,921
openCage/eightyfs
src/main/java/de/pfabulist/lindwurm/eighty/attributes/AttributeProvider.java
AttributeProvider.addIsLinkIfPossible
@SuppressWarnings( "PMD.CollapsibleIfStatements" ) private <V extends FileAttributeView> V addIsLinkIfPossible( Class<V> type, V fav ) { if( BasicFileAttributeView.class.isAssignableFrom( type ) ) { if( (! v( () -> BasicFileAttributeView.class.cast( fav ).readAttributes()).isSymbolicLink() )) { if( !( fav instanceof LinkInfoSettable ) ) { throw new UnsupportedOperationException( "the attribute view need to implement LinkInfoSettable in order to make SymLinks work" ); } ( (LinkInfoSettable) ( fav ) ).setLink(); } } return fav; }
java
@SuppressWarnings( "PMD.CollapsibleIfStatements" ) private <V extends FileAttributeView> V addIsLinkIfPossible( Class<V> type, V fav ) { if( BasicFileAttributeView.class.isAssignableFrom( type ) ) { if( (! v( () -> BasicFileAttributeView.class.cast( fav ).readAttributes()).isSymbolicLink() )) { if( !( fav instanceof LinkInfoSettable ) ) { throw new UnsupportedOperationException( "the attribute view need to implement LinkInfoSettable in order to make SymLinks work" ); } ( (LinkInfoSettable) ( fav ) ).setLink(); } } return fav; }
[ "@", "SuppressWarnings", "(", "\"PMD.CollapsibleIfStatements\"", ")", "private", "<", "V", "extends", "FileAttributeView", ">", "V", "addIsLinkIfPossible", "(", "Class", "<", "V", ">", "type", ",", "V", "fav", ")", "{", "if", "(", "BasicFileAttributeView", ".", "class", ".", "isAssignableFrom", "(", "type", ")", ")", "{", "if", "(", "(", "!", "v", "(", "(", ")", "->", "BasicFileAttributeView", ".", "class", ".", "cast", "(", "fav", ")", ".", "readAttributes", "(", ")", ")", ".", "isSymbolicLink", "(", ")", ")", ")", "{", "if", "(", "!", "(", "fav", "instanceof", "LinkInfoSettable", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"the attribute view need to implement LinkInfoSettable in order to make SymLinks work\"", ")", ";", "}", "(", "(", "LinkInfoSettable", ")", "(", "fav", ")", ")", ".", "setLink", "(", ")", ";", "}", "}", "return", "fav", ";", "}" ]
if the the FAV is actually a BasicFileAttributeView then there is an isLink method if this is not already set and FAV implements LinkInfoSettable use it to add this link info
[ "if", "the", "the", "FAV", "is", "actually", "a", "BasicFileAttributeView", "then", "there", "is", "an", "isLink", "method", "if", "this", "is", "not", "already", "set", "and", "FAV", "implements", "LinkInfoSettable", "use", "it", "to", "add", "this", "link", "info" ]
708ec4d336ee5e3dbd4196099f64091eaf6b3387
https://github.com/openCage/eightyfs/blob/708ec4d336ee5e3dbd4196099f64091eaf6b3387/src/main/java/de/pfabulist/lindwurm/eighty/attributes/AttributeProvider.java#L106-L119
153,922
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java
GetWSDLBase.unmarshalThisMessage
public Object unmarshalThisMessage(String strXMLBody) { try { Reader inStream = new StringReader(strXMLBody); Object msg = this.unmarshalRootElement(inStream); inStream.close(); return msg; } catch(Throwable ex) { ex.printStackTrace(); } return null; // Error }
java
public Object unmarshalThisMessage(String strXMLBody) { try { Reader inStream = new StringReader(strXMLBody); Object msg = this.unmarshalRootElement(inStream); inStream.close(); return msg; } catch(Throwable ex) { ex.printStackTrace(); } return null; // Error }
[ "public", "Object", "unmarshalThisMessage", "(", "String", "strXMLBody", ")", "{", "try", "{", "Reader", "inStream", "=", "new", "StringReader", "(", "strXMLBody", ")", ";", "Object", "msg", "=", "this", ".", "unmarshalRootElement", "(", "inStream", ")", ";", "inStream", ".", "close", "(", ")", ";", "return", "msg", ";", "}", "catch", "(", "Throwable", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "// Error", "}" ]
UnmarshalThisMessage Method.
[ "UnmarshalThisMessage", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java#L68-L82
153,923
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java
GetWSDLBase.unmarshalRootElement
public Object unmarshalRootElement(Reader inStream) throws UnmarshalException { try { // create a JAXBContext capable of handling classes generated into // the primer.po package String strSOAPPackage = this.getSOAPPackage(); if (strSOAPPackage != null) { // create an Unmarshaller Unmarshaller u = JaxbContexts.getJAXBContexts().getUnmarshaller(strSOAPPackage); // unmarshal a po instance document into a tree of Java content // objects composed of classes from the primer.po package. Object obj = null; synchronized (u) { obj = u.unmarshal( inStream ); } return obj; } //+} catch (XMLStreamException ex) { //+ ex.printStackTrace(); } catch (JAXBException ex) { ex.printStackTrace(); } return null; }
java
public Object unmarshalRootElement(Reader inStream) throws UnmarshalException { try { // create a JAXBContext capable of handling classes generated into // the primer.po package String strSOAPPackage = this.getSOAPPackage(); if (strSOAPPackage != null) { // create an Unmarshaller Unmarshaller u = JaxbContexts.getJAXBContexts().getUnmarshaller(strSOAPPackage); // unmarshal a po instance document into a tree of Java content // objects composed of classes from the primer.po package. Object obj = null; synchronized (u) { obj = u.unmarshal( inStream ); } return obj; } //+} catch (XMLStreamException ex) { //+ ex.printStackTrace(); } catch (JAXBException ex) { ex.printStackTrace(); } return null; }
[ "public", "Object", "unmarshalRootElement", "(", "Reader", "inStream", ")", "throws", "UnmarshalException", "{", "try", "{", "// create a JAXBContext capable of handling classes generated into", "// the primer.po package", "String", "strSOAPPackage", "=", "this", ".", "getSOAPPackage", "(", ")", ";", "if", "(", "strSOAPPackage", "!=", "null", ")", "{", "// create an Unmarshaller", "Unmarshaller", "u", "=", "JaxbContexts", ".", "getJAXBContexts", "(", ")", ".", "getUnmarshaller", "(", "strSOAPPackage", ")", ";", "// unmarshal a po instance document into a tree of Java content", "// objects composed of classes from the primer.po package.", "Object", "obj", "=", "null", ";", "synchronized", "(", "u", ")", "{", "obj", "=", "u", ".", "unmarshal", "(", "inStream", ")", ";", "}", "return", "obj", ";", "}", "//+} catch (XMLStreamException ex) {", "//+ ex.printStackTrace();", "}", "catch", "(", "JAXBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}" ]
UnmarshalRootElement Method.
[ "UnmarshalRootElement", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java#L86-L113
153,924
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java
GetWSDLBase.updateMessageProcessInfo
public void updateMessageProcessInfo(String elementIn, String elementOut, String elementFault, boolean bIsSafe, String address) { MessageInfo recMessageInfo = this.getMessageInfo(elementIn); // Note: Message IN for them is Message Out for me if (recMessageInfo != null) { MessageProcessInfo recMessageProcessInfo = (MessageProcessInfo)this.getRecord(MessageProcessInfo.MESSAGE_PROCESS_INFO_FILE); FileListener listener = new SubFileFilter(recMessageInfo); recMessageProcessInfo.addListener(listener); recMessageProcessInfo.setKeyArea(MessageProcessInfo.MESSAGE_INFO_ID_KEY); recMessageProcessInfo.close(); try { while (recMessageProcessInfo.hasNext()) { recMessageProcessInfo.next(); if (!MessageType.MESSAGE_OUT.equalsIgnoreCase(((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_TYPE_ID)).getReference().getField(MessageType.CODE).toString())) continue; boolean safe = CreateWSDL.SAFE_DEFAULT; String safeValue = ((PropertiesField)recMessageProcessInfo.getField(MessageProcessInfo.PROPERTIES)).getProperty(MessageProcessInfo.SAFE); if (safeValue != null) safe = Boolean.parseBoolean(safeValue); if (safeValue != null) if (safe != bIsSafe) continue; Record recMessageProcessInfo2 = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.REPLY_MESSAGE_PROCESS_INFO_ID)).getReference(); if (recMessageProcessInfo2 != null) if ((recMessageProcessInfo2.getEditMode() == DBConstants.EDIT_IN_PROGRESS) || (recMessageProcessInfo2.getEditMode() == DBConstants.EDIT_CURRENT)) { Record recMessageInfo2 = ((ReferenceField)recMessageProcessInfo2.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); if (recMessageInfo2 != null) { if (elementOut != null) if (elementOut.equalsIgnoreCase(recMessageInfo2.getField(MessageInfo.CODE).getString())) { Map<String,Object> map = null; if (address != null) { map = new Hashtable<String,Object>(); String site = this.getSiteFromAddress(address, null); map.put(TrxMessageHeader.DESTINATION_PARAM, site); map.put(TrxMessageHeader.DESTINATION_MESSAGE_PARAM, this.getPathFromAddress(address, site)); } this.updateMessageDetail(recMessageProcessInfo, map); // Found } } } } } catch (DBException e) { e.printStackTrace(); } finally { recMessageProcessInfo.removeListener(listener, true); } } }
java
public void updateMessageProcessInfo(String elementIn, String elementOut, String elementFault, boolean bIsSafe, String address) { MessageInfo recMessageInfo = this.getMessageInfo(elementIn); // Note: Message IN for them is Message Out for me if (recMessageInfo != null) { MessageProcessInfo recMessageProcessInfo = (MessageProcessInfo)this.getRecord(MessageProcessInfo.MESSAGE_PROCESS_INFO_FILE); FileListener listener = new SubFileFilter(recMessageInfo); recMessageProcessInfo.addListener(listener); recMessageProcessInfo.setKeyArea(MessageProcessInfo.MESSAGE_INFO_ID_KEY); recMessageProcessInfo.close(); try { while (recMessageProcessInfo.hasNext()) { recMessageProcessInfo.next(); if (!MessageType.MESSAGE_OUT.equalsIgnoreCase(((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_TYPE_ID)).getReference().getField(MessageType.CODE).toString())) continue; boolean safe = CreateWSDL.SAFE_DEFAULT; String safeValue = ((PropertiesField)recMessageProcessInfo.getField(MessageProcessInfo.PROPERTIES)).getProperty(MessageProcessInfo.SAFE); if (safeValue != null) safe = Boolean.parseBoolean(safeValue); if (safeValue != null) if (safe != bIsSafe) continue; Record recMessageProcessInfo2 = ((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.REPLY_MESSAGE_PROCESS_INFO_ID)).getReference(); if (recMessageProcessInfo2 != null) if ((recMessageProcessInfo2.getEditMode() == DBConstants.EDIT_IN_PROGRESS) || (recMessageProcessInfo2.getEditMode() == DBConstants.EDIT_CURRENT)) { Record recMessageInfo2 = ((ReferenceField)recMessageProcessInfo2.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); if (recMessageInfo2 != null) { if (elementOut != null) if (elementOut.equalsIgnoreCase(recMessageInfo2.getField(MessageInfo.CODE).getString())) { Map<String,Object> map = null; if (address != null) { map = new Hashtable<String,Object>(); String site = this.getSiteFromAddress(address, null); map.put(TrxMessageHeader.DESTINATION_PARAM, site); map.put(TrxMessageHeader.DESTINATION_MESSAGE_PARAM, this.getPathFromAddress(address, site)); } this.updateMessageDetail(recMessageProcessInfo, map); // Found } } } } } catch (DBException e) { e.printStackTrace(); } finally { recMessageProcessInfo.removeListener(listener, true); } } }
[ "public", "void", "updateMessageProcessInfo", "(", "String", "elementIn", ",", "String", "elementOut", ",", "String", "elementFault", ",", "boolean", "bIsSafe", ",", "String", "address", ")", "{", "MessageInfo", "recMessageInfo", "=", "this", ".", "getMessageInfo", "(", "elementIn", ")", ";", "// Note: Message IN for them is Message Out for me", "if", "(", "recMessageInfo", "!=", "null", ")", "{", "MessageProcessInfo", "recMessageProcessInfo", "=", "(", "MessageProcessInfo", ")", "this", ".", "getRecord", "(", "MessageProcessInfo", ".", "MESSAGE_PROCESS_INFO_FILE", ")", ";", "FileListener", "listener", "=", "new", "SubFileFilter", "(", "recMessageInfo", ")", ";", "recMessageProcessInfo", ".", "addListener", "(", "listener", ")", ";", "recMessageProcessInfo", ".", "setKeyArea", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID_KEY", ")", ";", "recMessageProcessInfo", ".", "close", "(", ")", ";", "try", "{", "while", "(", "recMessageProcessInfo", ".", "hasNext", "(", ")", ")", "{", "recMessageProcessInfo", ".", "next", "(", ")", ";", "if", "(", "!", "MessageType", ".", "MESSAGE_OUT", ".", "equalsIgnoreCase", "(", "(", "(", "ReferenceField", ")", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_TYPE_ID", ")", ")", ".", "getReference", "(", ")", ".", "getField", "(", "MessageType", ".", "CODE", ")", ".", "toString", "(", ")", ")", ")", "continue", ";", "boolean", "safe", "=", "CreateWSDL", ".", "SAFE_DEFAULT", ";", "String", "safeValue", "=", "(", "(", "PropertiesField", ")", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "PROPERTIES", ")", ")", ".", "getProperty", "(", "MessageProcessInfo", ".", "SAFE", ")", ";", "if", "(", "safeValue", "!=", "null", ")", "safe", "=", "Boolean", ".", "parseBoolean", "(", "safeValue", ")", ";", "if", "(", "safeValue", "!=", "null", ")", "if", "(", "safe", "!=", "bIsSafe", ")", "continue", ";", "Record", "recMessageProcessInfo2", "=", "(", "(", "ReferenceField", ")", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "REPLY_MESSAGE_PROCESS_INFO_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "recMessageProcessInfo2", "!=", "null", ")", "if", "(", "(", "recMessageProcessInfo2", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_IN_PROGRESS", ")", "||", "(", "recMessageProcessInfo2", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_CURRENT", ")", ")", "{", "Record", "recMessageInfo2", "=", "(", "(", "ReferenceField", ")", "recMessageProcessInfo2", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "recMessageInfo2", "!=", "null", ")", "{", "if", "(", "elementOut", "!=", "null", ")", "if", "(", "elementOut", ".", "equalsIgnoreCase", "(", "recMessageInfo2", ".", "getField", "(", "MessageInfo", ".", "CODE", ")", ".", "getString", "(", ")", ")", ")", "{", "Map", "<", "String", ",", "Object", ">", "map", "=", "null", ";", "if", "(", "address", "!=", "null", ")", "{", "map", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "String", "site", "=", "this", ".", "getSiteFromAddress", "(", "address", ",", "null", ")", ";", "map", ".", "put", "(", "TrxMessageHeader", ".", "DESTINATION_PARAM", ",", "site", ")", ";", "map", ".", "put", "(", "TrxMessageHeader", ".", "DESTINATION_MESSAGE_PARAM", ",", "this", ".", "getPathFromAddress", "(", "address", ",", "site", ")", ")", ";", "}", "this", ".", "updateMessageDetail", "(", "recMessageProcessInfo", ",", "map", ")", ";", "// Found", "}", "}", "}", "}", "}", "catch", "(", "DBException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "recMessageProcessInfo", ".", "removeListener", "(", "listener", ",", "true", ")", ";", "}", "}", "}" ]
UpdateMessageProcessInfo Method.
[ "UpdateMessageProcessInfo", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java#L126-L179
153,925
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java
GetWSDLBase.getMessageInfo
public MessageInfo getMessageInfo(String element) { MessageInfo recMessageInfo = (MessageInfo)this.getRecord(MessageInfo.MESSAGE_INFO_FILE); recMessageInfo.setKeyArea(MessageInfo.CODE_KEY); recMessageInfo.getField(MessageInfo.CODE).setString(element); try { if (recMessageInfo.seek(null)) { return recMessageInfo; } } catch (DBException e) { e.printStackTrace(); } return null; }
java
public MessageInfo getMessageInfo(String element) { MessageInfo recMessageInfo = (MessageInfo)this.getRecord(MessageInfo.MESSAGE_INFO_FILE); recMessageInfo.setKeyArea(MessageInfo.CODE_KEY); recMessageInfo.getField(MessageInfo.CODE).setString(element); try { if (recMessageInfo.seek(null)) { return recMessageInfo; } } catch (DBException e) { e.printStackTrace(); } return null; }
[ "public", "MessageInfo", "getMessageInfo", "(", "String", "element", ")", "{", "MessageInfo", "recMessageInfo", "=", "(", "MessageInfo", ")", "this", ".", "getRecord", "(", "MessageInfo", ".", "MESSAGE_INFO_FILE", ")", ";", "recMessageInfo", ".", "setKeyArea", "(", "MessageInfo", ".", "CODE_KEY", ")", ";", "recMessageInfo", ".", "getField", "(", "MessageInfo", ".", "CODE", ")", ".", "setString", "(", "element", ")", ";", "try", "{", "if", "(", "recMessageInfo", ".", "seek", "(", "null", ")", ")", "{", "return", "recMessageInfo", ";", "}", "}", "catch", "(", "DBException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}" ]
GetMessageInfo Method.
[ "GetMessageInfo", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java#L183-L197
153,926
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java
GetWSDLBase.addAddressToTarget
public String addAddressToTarget(String address) { if (address != null) { MessageDetailTarget messageDetailTarget = (MessageDetailTarget)this.getMainRecord(); String site = messageDetailTarget.getProperty(TrxMessageHeader.DESTINATION_PARAM); site = this.getSiteFromAddress(address, site); if (!messageDetailTarget.setProperty(TrxMessageHeader.DESTINATION_PARAM, site)) address = null; // This type doesn't take properties (never) messageDetailTarget.setProperty(TrxMessageHeader.DESTINATION_MESSAGE_PARAM, this.getPathFromAddress(address, site)); String wsdlPath = messageDetailTarget.getProperty(TrxMessageHeader.WSDL_PATH); wsdlPath = this.getPathFromAddress(wsdlPath, site); if (wsdlPath != null) messageDetailTarget.setProperty(TrxMessageHeader.WSDL_PATH, wsdlPath); } return address; }
java
public String addAddressToTarget(String address) { if (address != null) { MessageDetailTarget messageDetailTarget = (MessageDetailTarget)this.getMainRecord(); String site = messageDetailTarget.getProperty(TrxMessageHeader.DESTINATION_PARAM); site = this.getSiteFromAddress(address, site); if (!messageDetailTarget.setProperty(TrxMessageHeader.DESTINATION_PARAM, site)) address = null; // This type doesn't take properties (never) messageDetailTarget.setProperty(TrxMessageHeader.DESTINATION_MESSAGE_PARAM, this.getPathFromAddress(address, site)); String wsdlPath = messageDetailTarget.getProperty(TrxMessageHeader.WSDL_PATH); wsdlPath = this.getPathFromAddress(wsdlPath, site); if (wsdlPath != null) messageDetailTarget.setProperty(TrxMessageHeader.WSDL_PATH, wsdlPath); } return address; }
[ "public", "String", "addAddressToTarget", "(", "String", "address", ")", "{", "if", "(", "address", "!=", "null", ")", "{", "MessageDetailTarget", "messageDetailTarget", "=", "(", "MessageDetailTarget", ")", "this", ".", "getMainRecord", "(", ")", ";", "String", "site", "=", "messageDetailTarget", ".", "getProperty", "(", "TrxMessageHeader", ".", "DESTINATION_PARAM", ")", ";", "site", "=", "this", ".", "getSiteFromAddress", "(", "address", ",", "site", ")", ";", "if", "(", "!", "messageDetailTarget", ".", "setProperty", "(", "TrxMessageHeader", ".", "DESTINATION_PARAM", ",", "site", ")", ")", "address", "=", "null", ";", "// This type doesn't take properties (never)", "messageDetailTarget", ".", "setProperty", "(", "TrxMessageHeader", ".", "DESTINATION_MESSAGE_PARAM", ",", "this", ".", "getPathFromAddress", "(", "address", ",", "site", ")", ")", ";", "String", "wsdlPath", "=", "messageDetailTarget", ".", "getProperty", "(", "TrxMessageHeader", ".", "WSDL_PATH", ")", ";", "wsdlPath", "=", "this", ".", "getPathFromAddress", "(", "wsdlPath", ",", "site", ")", ";", "if", "(", "wsdlPath", "!=", "null", ")", "messageDetailTarget", ".", "setProperty", "(", "TrxMessageHeader", ".", "WSDL_PATH", ",", "wsdlPath", ")", ";", "}", "return", "address", ";", "}" ]
AddAddressToTarget Method.
[ "AddAddressToTarget", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java#L201-L217
153,927
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java
GetWSDLBase.updateMessageDetail
public void updateMessageDetail(MessageProcessInfo recMessageProcessInfo, Map<String,Object> map) { MessageDetail recMessageDetail = (MessageDetail)this.getRecord(MessageDetail.MESSAGE_DETAIL_FILE); MessageTransport recMessageTransport = (MessageTransport)this.getRecord(MessageTransport.MESSAGE_TRANSPORT_FILE); try { recMessageDetail.addNew(); recMessageDetail.getField(MessageDetail.MESSAGE_PROCESS_INFO_ID).moveFieldToThis((BaseField)recMessageProcessInfo.getCounterField()); recMessageDetail.getField(MessageDetail.MESSAGE_TRANSPORT_ID).moveFieldToThis((BaseField)recMessageTransport.getCounterField()); if (recMessageDetail.seek(null)) recMessageDetail.edit(); else recMessageDetail.addNew(); recMessageDetail.getField(MessageDetail.MESSAGE_PROCESS_INFO_ID).moveFieldToThis((BaseField)recMessageProcessInfo.getCounterField()); recMessageDetail.getField(MessageDetail.MESSAGE_TRANSPORT_ID).moveFieldToThis((BaseField)recMessageTransport.getCounterField()); String site = (map == null) ? null : (String)map.get(TrxMessageHeader.DESTINATION_PARAM); ((PropertiesField)recMessageDetail.getField(MessageDetail.PROPERTIES)).setProperty(TrxMessageHeader.DESTINATION_PARAM, site); String wspath = (map == null) ? null : (String)map.get(TrxMessageHeader.DESTINATION_MESSAGE_PARAM); ((PropertiesField)recMessageDetail.getField(MessageDetail.PROPERTIES)).setProperty(TrxMessageHeader.DESTINATION_MESSAGE_PARAM, wspath); if (recMessageDetail.getEditMode() == DBConstants.EDIT_ADD) recMessageDetail.add(); else recMessageDetail.set(); } catch (DBException e) { e.printStackTrace(); } }
java
public void updateMessageDetail(MessageProcessInfo recMessageProcessInfo, Map<String,Object> map) { MessageDetail recMessageDetail = (MessageDetail)this.getRecord(MessageDetail.MESSAGE_DETAIL_FILE); MessageTransport recMessageTransport = (MessageTransport)this.getRecord(MessageTransport.MESSAGE_TRANSPORT_FILE); try { recMessageDetail.addNew(); recMessageDetail.getField(MessageDetail.MESSAGE_PROCESS_INFO_ID).moveFieldToThis((BaseField)recMessageProcessInfo.getCounterField()); recMessageDetail.getField(MessageDetail.MESSAGE_TRANSPORT_ID).moveFieldToThis((BaseField)recMessageTransport.getCounterField()); if (recMessageDetail.seek(null)) recMessageDetail.edit(); else recMessageDetail.addNew(); recMessageDetail.getField(MessageDetail.MESSAGE_PROCESS_INFO_ID).moveFieldToThis((BaseField)recMessageProcessInfo.getCounterField()); recMessageDetail.getField(MessageDetail.MESSAGE_TRANSPORT_ID).moveFieldToThis((BaseField)recMessageTransport.getCounterField()); String site = (map == null) ? null : (String)map.get(TrxMessageHeader.DESTINATION_PARAM); ((PropertiesField)recMessageDetail.getField(MessageDetail.PROPERTIES)).setProperty(TrxMessageHeader.DESTINATION_PARAM, site); String wspath = (map == null) ? null : (String)map.get(TrxMessageHeader.DESTINATION_MESSAGE_PARAM); ((PropertiesField)recMessageDetail.getField(MessageDetail.PROPERTIES)).setProperty(TrxMessageHeader.DESTINATION_MESSAGE_PARAM, wspath); if (recMessageDetail.getEditMode() == DBConstants.EDIT_ADD) recMessageDetail.add(); else recMessageDetail.set(); } catch (DBException e) { e.printStackTrace(); } }
[ "public", "void", "updateMessageDetail", "(", "MessageProcessInfo", "recMessageProcessInfo", ",", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "MessageDetail", "recMessageDetail", "=", "(", "MessageDetail", ")", "this", ".", "getRecord", "(", "MessageDetail", ".", "MESSAGE_DETAIL_FILE", ")", ";", "MessageTransport", "recMessageTransport", "=", "(", "MessageTransport", ")", "this", ".", "getRecord", "(", "MessageTransport", ".", "MESSAGE_TRANSPORT_FILE", ")", ";", "try", "{", "recMessageDetail", ".", "addNew", "(", ")", ";", "recMessageDetail", ".", "getField", "(", "MessageDetail", ".", "MESSAGE_PROCESS_INFO_ID", ")", ".", "moveFieldToThis", "(", "(", "BaseField", ")", "recMessageProcessInfo", ".", "getCounterField", "(", ")", ")", ";", "recMessageDetail", ".", "getField", "(", "MessageDetail", ".", "MESSAGE_TRANSPORT_ID", ")", ".", "moveFieldToThis", "(", "(", "BaseField", ")", "recMessageTransport", ".", "getCounterField", "(", ")", ")", ";", "if", "(", "recMessageDetail", ".", "seek", "(", "null", ")", ")", "recMessageDetail", ".", "edit", "(", ")", ";", "else", "recMessageDetail", ".", "addNew", "(", ")", ";", "recMessageDetail", ".", "getField", "(", "MessageDetail", ".", "MESSAGE_PROCESS_INFO_ID", ")", ".", "moveFieldToThis", "(", "(", "BaseField", ")", "recMessageProcessInfo", ".", "getCounterField", "(", ")", ")", ";", "recMessageDetail", ".", "getField", "(", "MessageDetail", ".", "MESSAGE_TRANSPORT_ID", ")", ".", "moveFieldToThis", "(", "(", "BaseField", ")", "recMessageTransport", ".", "getCounterField", "(", ")", ")", ";", "String", "site", "=", "(", "map", "==", "null", ")", "?", "null", ":", "(", "String", ")", "map", ".", "get", "(", "TrxMessageHeader", ".", "DESTINATION_PARAM", ")", ";", "(", "(", "PropertiesField", ")", "recMessageDetail", ".", "getField", "(", "MessageDetail", ".", "PROPERTIES", ")", ")", ".", "setProperty", "(", "TrxMessageHeader", ".", "DESTINATION_PARAM", ",", "site", ")", ";", "String", "wspath", "=", "(", "map", "==", "null", ")", "?", "null", ":", "(", "String", ")", "map", ".", "get", "(", "TrxMessageHeader", ".", "DESTINATION_MESSAGE_PARAM", ")", ";", "(", "(", "PropertiesField", ")", "recMessageDetail", ".", "getField", "(", "MessageDetail", ".", "PROPERTIES", ")", ")", ".", "setProperty", "(", "TrxMessageHeader", ".", "DESTINATION_MESSAGE_PARAM", ",", "wspath", ")", ";", "if", "(", "recMessageDetail", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_ADD", ")", "recMessageDetail", ".", "add", "(", ")", ";", "else", "recMessageDetail", ".", "set", "(", ")", ";", "}", "catch", "(", "DBException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
UpdateMessageDetail Method.
[ "UpdateMessageDetail", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java#L221-L250
153,928
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java
GetWSDLBase.getSiteFromAddress
public String getSiteFromAddress(String url, String site) { int iStart = url.indexOf("//") + 2; iStart = url.indexOf('/', iStart); if (iStart == -1) iStart = url.length(); if ((site != null) && (site.length() > 0)) if (!url.equalsIgnoreCase(site)) return site; // Return this site if different from URL return url.substring(0, iStart); }
java
public String getSiteFromAddress(String url, String site) { int iStart = url.indexOf("//") + 2; iStart = url.indexOf('/', iStart); if (iStart == -1) iStart = url.length(); if ((site != null) && (site.length() > 0)) if (!url.equalsIgnoreCase(site)) return site; // Return this site if different from URL return url.substring(0, iStart); }
[ "public", "String", "getSiteFromAddress", "(", "String", "url", ",", "String", "site", ")", "{", "int", "iStart", "=", "url", ".", "indexOf", "(", "\"//\"", ")", "+", "2", ";", "iStart", "=", "url", ".", "indexOf", "(", "'", "'", ",", "iStart", ")", ";", "if", "(", "iStart", "==", "-", "1", ")", "iStart", "=", "url", ".", "length", "(", ")", ";", "if", "(", "(", "site", "!=", "null", ")", "&&", "(", "site", ".", "length", "(", ")", ">", "0", ")", ")", "if", "(", "!", "url", ".", "equalsIgnoreCase", "(", "site", ")", ")", "return", "site", ";", "// Return this site if different from URL", "return", "url", ".", "substring", "(", "0", ",", "iStart", ")", ";", "}" ]
GetSiteFromAddress Method.
[ "GetSiteFromAddress", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/GetWSDLBase.java#L254-L264
153,929
simter/simter-context
src/main/java/tech/simter/Context.java
Context.get
@SuppressWarnings("unchecked") public static <V> V get(String key) { return (V) share.get().get(key); }
java
@SuppressWarnings("unchecked") public static <V> V get(String key) { return (V) share.get().get(key); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "V", ">", "V", "get", "(", "String", "key", ")", "{", "return", "(", "V", ")", "share", ".", "get", "(", ")", ".", "get", "(", "key", ")", ";", "}" ]
Get the specific key value @param key the key @param <V> the expected return type @return the value or <tt>null</tt> if there was no mapping for <tt>key</tt>
[ "Get", "the", "specific", "key", "value" ]
4d372b71b9f159abdf365a96ff5f300e23fa670a
https://github.com/simter/simter-context/blob/4d372b71b9f159abdf365a96ff5f300e23fa670a/src/main/java/tech/simter/Context.java#L56-L59
153,930
simter/simter-context
src/main/java/tech/simter/Context.java
Context.set
public static void set(String key, Object value) { share.get().put(key, value); }
java
public static void set(String key, Object value) { share.get().put(key, value); }
[ "public", "static", "void", "set", "(", "String", "key", ",", "Object", "value", ")", "{", "share", ".", "get", "(", ")", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Set the specific key value @param key the key @param value the value
[ "Set", "the", "specific", "key", "value" ]
4d372b71b9f159abdf365a96ff5f300e23fa670a
https://github.com/simter/simter-context/blob/4d372b71b9f159abdf365a96ff5f300e23fa670a/src/main/java/tech/simter/Context.java#L67-L69
153,931
simter/simter-context
src/main/java/tech/simter/Context.java
Context.remove
@SuppressWarnings("unchecked") public static <V> V remove(String key) { return (V) share.get().remove(key); }
java
@SuppressWarnings("unchecked") public static <V> V remove(String key) { return (V) share.get().remove(key); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "V", ">", "V", "remove", "(", "String", "key", ")", "{", "return", "(", "V", ")", "share", ".", "get", "(", ")", ".", "remove", "(", "key", ")", ";", "}" ]
Remove the specific key @param key the key @param <V> the expected return type @return the previous value associated with <tt>key</tt>, or <tt>null</tt> if there was no mapping for <tt>key</tt>.
[ "Remove", "the", "specific", "key" ]
4d372b71b9f159abdf365a96ff5f300e23fa670a
https://github.com/simter/simter-context/blob/4d372b71b9f159abdf365a96ff5f300e23fa670a/src/main/java/tech/simter/Context.java#L78-L81
153,932
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseGridScreen.java
BaseGridScreen.getNextRecord
public Record getNextRecord(PrintWriter out, int iPrintOptions, boolean bFirstTime, boolean bHeadingFootingExists) throws DBException { Object[] rgobjEnabled = null; boolean bAfterRequery = !this.getMainRecord().isOpen(); if (!this.getMainRecord().isOpen()) this.getMainRecord().open(); // Make sure any listeners are called before disabling. if (bHeadingFootingExists) rgobjEnabled = this.getMainRecord().setEnableNonFilter(null, false, false, false, false, true); Record record = this.getNextGridRecord(bFirstTime); if (bHeadingFootingExists) { boolean bBreak = this.printHeadingFootingData(out, iPrintOptions | HtmlConstants.FOOTING_SCREEN | HtmlConstants.DETAIL_SCREEN); this.getMainRecord().setEnableNonFilter(rgobjEnabled, (record != null), bBreak, bFirstTime | bAfterRequery, (record == null), true); } return record; }
java
public Record getNextRecord(PrintWriter out, int iPrintOptions, boolean bFirstTime, boolean bHeadingFootingExists) throws DBException { Object[] rgobjEnabled = null; boolean bAfterRequery = !this.getMainRecord().isOpen(); if (!this.getMainRecord().isOpen()) this.getMainRecord().open(); // Make sure any listeners are called before disabling. if (bHeadingFootingExists) rgobjEnabled = this.getMainRecord().setEnableNonFilter(null, false, false, false, false, true); Record record = this.getNextGridRecord(bFirstTime); if (bHeadingFootingExists) { boolean bBreak = this.printHeadingFootingData(out, iPrintOptions | HtmlConstants.FOOTING_SCREEN | HtmlConstants.DETAIL_SCREEN); this.getMainRecord().setEnableNonFilter(rgobjEnabled, (record != null), bBreak, bFirstTime | bAfterRequery, (record == null), true); } return record; }
[ "public", "Record", "getNextRecord", "(", "PrintWriter", "out", ",", "int", "iPrintOptions", ",", "boolean", "bFirstTime", ",", "boolean", "bHeadingFootingExists", ")", "throws", "DBException", "{", "Object", "[", "]", "rgobjEnabled", "=", "null", ";", "boolean", "bAfterRequery", "=", "!", "this", ".", "getMainRecord", "(", ")", ".", "isOpen", "(", ")", ";", "if", "(", "!", "this", ".", "getMainRecord", "(", ")", ".", "isOpen", "(", ")", ")", "this", ".", "getMainRecord", "(", ")", ".", "open", "(", ")", ";", "// Make sure any listeners are called before disabling.", "if", "(", "bHeadingFootingExists", ")", "rgobjEnabled", "=", "this", ".", "getMainRecord", "(", ")", ".", "setEnableNonFilter", "(", "null", ",", "false", ",", "false", ",", "false", ",", "false", ",", "true", ")", ";", "Record", "record", "=", "this", ".", "getNextGridRecord", "(", "bFirstTime", ")", ";", "if", "(", "bHeadingFootingExists", ")", "{", "boolean", "bBreak", "=", "this", ".", "printHeadingFootingData", "(", "out", ",", "iPrintOptions", "|", "HtmlConstants", ".", "FOOTING_SCREEN", "|", "HtmlConstants", ".", "DETAIL_SCREEN", ")", ";", "this", ".", "getMainRecord", "(", ")", ".", "setEnableNonFilter", "(", "rgobjEnabled", ",", "(", "record", "!=", "null", ")", ",", "bBreak", ",", "bFirstTime", "|", "bAfterRequery", ",", "(", "record", "==", "null", ")", ",", "true", ")", ";", "}", "return", "record", ";", "}" ]
Get the next record. This is the special method for a report. It handles breaks by disabling all listeners except filter listeners, then reenabling and calling the listeners after the footing has been printed, so totals, etc will be in the next break. @param out The out stream. @param iPrintOptions Print options. @param bFirstTime Reading the first record? @param bHeadingFootingExists Does a break exist (skips all the fancy code if not). @return The next record (or null if EOF).
[ "Get", "the", "next", "record", ".", "This", "is", "the", "special", "method", "for", "a", "report", ".", "It", "handles", "breaks", "by", "disabling", "all", "listeners", "except", "filter", "listeners", "then", "reenabling", "and", "calling", "the", "listeners", "after", "the", "footing", "has", "been", "printed", "so", "totals", "etc", "will", "be", "in", "the", "next", "break", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseGridScreen.java#L302-L321
153,933
entrusc/xdata
src/main/java/com/moebiusgames/xdata/AnnotationBasedMarshaller.java
AnnotationBasedMarshaller.box
private static Class<?> box(Class<?> clazz) { if (clazz == int.class) { return Integer.class; } else if (clazz == float.class) { return Float.class; } else if (clazz == long.class) { return Long.class; } else if (clazz == double.class) { return double.class; } else if (clazz == boolean.class) { return Boolean.class; } else if (clazz == char.class) { return Character.class; } else if (clazz == byte.class) { return Byte.class; } return clazz; }
java
private static Class<?> box(Class<?> clazz) { if (clazz == int.class) { return Integer.class; } else if (clazz == float.class) { return Float.class; } else if (clazz == long.class) { return Long.class; } else if (clazz == double.class) { return double.class; } else if (clazz == boolean.class) { return Boolean.class; } else if (clazz == char.class) { return Character.class; } else if (clazz == byte.class) { return Byte.class; } return clazz; }
[ "private", "static", "Class", "<", "?", ">", "box", "(", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", "==", "int", ".", "class", ")", "{", "return", "Integer", ".", "class", ";", "}", "else", "if", "(", "clazz", "==", "float", ".", "class", ")", "{", "return", "Float", ".", "class", ";", "}", "else", "if", "(", "clazz", "==", "long", ".", "class", ")", "{", "return", "Long", ".", "class", ";", "}", "else", "if", "(", "clazz", "==", "double", ".", "class", ")", "{", "return", "double", ".", "class", ";", "}", "else", "if", "(", "clazz", "==", "boolean", ".", "class", ")", "{", "return", "Boolean", ".", "class", ";", "}", "else", "if", "(", "clazz", "==", "char", ".", "class", ")", "{", "return", "Character", ".", "class", ";", "}", "else", "if", "(", "clazz", "==", "byte", ".", "class", ")", "{", "return", "Byte", ".", "class", ";", "}", "return", "clazz", ";", "}" ]
returns the boxed type of the primitive class or the class itself if there is no wrapper for the given type. @param clazz @return
[ "returns", "the", "boxed", "type", "of", "the", "primitive", "class", "or", "the", "class", "itself", "if", "there", "is", "no", "wrapper", "for", "the", "given", "type", "." ]
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/AnnotationBasedMarshaller.java#L286-L309
153,934
OrienteerBAP/orientdb-oda-birt
org.orienteer.birt.orientdb/src/org/orienteer/birt/orientdb/impl/Driver.java
Driver.getNativeDataTypeName
static String getNativeDataTypeName( int nativeDataTypeCode ) throws OdaException { DataTypeMapping typeMapping = getManifest().getDataSetType( null ) .getDataTypeMapping( nativeDataTypeCode ); if( typeMapping != null ) return typeMapping.getNativeType(); return "Non-defined"; }
java
static String getNativeDataTypeName( int nativeDataTypeCode ) throws OdaException { DataTypeMapping typeMapping = getManifest().getDataSetType( null ) .getDataTypeMapping( nativeDataTypeCode ); if( typeMapping != null ) return typeMapping.getNativeType(); return "Non-defined"; }
[ "static", "String", "getNativeDataTypeName", "(", "int", "nativeDataTypeCode", ")", "throws", "OdaException", "{", "DataTypeMapping", "typeMapping", "=", "getManifest", "(", ")", ".", "getDataSetType", "(", "null", ")", ".", "getDataTypeMapping", "(", "nativeDataTypeCode", ")", ";", "if", "(", "typeMapping", "!=", "null", ")", "return", "typeMapping", ".", "getNativeType", "(", ")", ";", "return", "\"Non-defined\"", ";", "}" ]
Returns the native data type name of the specified code, as defined in this data source extension's manifest. @param nativeTypeCode the native data type code @return corresponding native data type name @throws OdaException if lookup fails
[ "Returns", "the", "native", "data", "type", "name", "of", "the", "specified", "code", "as", "defined", "in", "this", "data", "source", "extension", "s", "manifest", "." ]
62820c256fa1d221265e68b8ebb60f291a9a1405
https://github.com/OrienteerBAP/orientdb-oda-birt/blob/62820c256fa1d221265e68b8ebb60f291a9a1405/org.orienteer.birt.orientdb/src/org/orienteer/birt/orientdb/impl/Driver.java#L77-L86
153,935
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyService.java
PropertyService.toAlias
private String toAlias(String propertyName) { String result = propertyAliasType.get(propertyName); return result == null ? propertyName : result; }
java
private String toAlias(String propertyName) { String result = propertyAliasType.get(propertyName); return result == null ? propertyName : result; }
[ "private", "String", "toAlias", "(", "String", "propertyName", ")", "{", "String", "result", "=", "propertyAliasType", ".", "get", "(", "propertyName", ")", ";", "return", "result", "==", "null", "?", "propertyName", ":", "result", ";", "}" ]
Returns alias for name if it exists, or the original name if not. @param propertyName Property name. @return Alias if exists, original name if not.
[ "Returns", "alias", "for", "name", "if", "it", "exists", "or", "the", "original", "name", "if", "not", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyService.java#L62-L65
153,936
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyService.java
PropertyService.newProperty
private Property newProperty(String propertyName, String instanceName, String entity) { return new Property(toAlias(propertyName), instanceName, entity); }
java
private Property newProperty(String propertyName, String instanceName, String entity) { return new Property(toAlias(propertyName), instanceName, entity); }
[ "private", "Property", "newProperty", "(", "String", "propertyName", ",", "String", "instanceName", ",", "String", "entity", ")", "{", "return", "new", "Property", "(", "toAlias", "(", "propertyName", ")", ",", "instanceName", ",", "entity", ")", ";", "}" ]
Returns an instance of the specified property, observing property aliases. @param propertyName Property name @param instanceName Instance name @param entity Entity list @return Newly created property.
[ "Returns", "an", "instance", "of", "the", "specified", "property", "observing", "property", "aliases", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyService.java#L75-L77
153,937
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/core/ECKey.java
ECKey.compressPoint
public static ECPoint compressPoint(ECPoint uncompressed) { return CURVE.getCurve().decodePoint(uncompressed.getEncoded(true)); }
java
public static ECPoint compressPoint(ECPoint uncompressed) { return CURVE.getCurve().decodePoint(uncompressed.getEncoded(true)); }
[ "public", "static", "ECPoint", "compressPoint", "(", "ECPoint", "uncompressed", ")", "{", "return", "CURVE", ".", "getCurve", "(", ")", ".", "decodePoint", "(", "uncompressed", ".", "getEncoded", "(", "true", ")", ")", ";", "}" ]
Utility for compressing an elliptic curve point. Returns the same point if it's already compressed. See the ECKey class docs for a discussion of point compression. @param uncompressed - @return - @deprecated per-point compression property will be removed in Bouncy Castle
[ "Utility", "for", "compressing", "an", "elliptic", "curve", "point", ".", "Returns", "the", "same", "point", "if", "it", "s", "already", "compressed", ".", "See", "the", "ECKey", "class", "docs", "for", "a", "discussion", "of", "point", "compression", "." ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L284-L286
153,938
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/core/ECKey.java
ECKey.decompressPoint
public static ECPoint decompressPoint(ECPoint compressed) { return CURVE.getCurve().decodePoint(compressed.getEncoded(false)); }
java
public static ECPoint decompressPoint(ECPoint compressed) { return CURVE.getCurve().decodePoint(compressed.getEncoded(false)); }
[ "public", "static", "ECPoint", "decompressPoint", "(", "ECPoint", "compressed", ")", "{", "return", "CURVE", ".", "getCurve", "(", ")", ".", "decodePoint", "(", "compressed", ".", "getEncoded", "(", "false", ")", ")", ";", "}" ]
Utility for decompressing an elliptic curve point. Returns the same point if it's already compressed. See the ECKey class docs for a discussion of point compression. @param compressed - @return - @deprecated per-point compression property will be removed in Bouncy Castle
[ "Utility", "for", "decompressing", "an", "elliptic", "curve", "point", ".", "Returns", "the", "same", "point", "if", "it", "s", "already", "compressed", ".", "See", "the", "ECKey", "class", "docs", "for", "a", "discussion", "of", "point", "compression", "." ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L299-L301
153,939
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/core/ECKey.java
ECKey.fromPrivate
public static ECKey fromPrivate(BigInteger privKey) { return new ECKey(privKey, CURVE.getG().multiply(privKey)); }
java
public static ECKey fromPrivate(BigInteger privKey) { return new ECKey(privKey, CURVE.getG().multiply(privKey)); }
[ "public", "static", "ECKey", "fromPrivate", "(", "BigInteger", "privKey", ")", "{", "return", "new", "ECKey", "(", "privKey", ",", "CURVE", ".", "getG", "(", ")", ".", "multiply", "(", "privKey", ")", ")", ";", "}" ]
Creates an ECKey given the private key only. @param privKey - @return -
[ "Creates", "an", "ECKey", "given", "the", "private", "key", "only", "." ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L312-L314
153,940
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/core/ECKey.java
ECKey.pubBytesWithoutFormat
public static byte[] pubBytesWithoutFormat(ECPoint pubPoint) { final byte[] pubBytes = pubPoint.getEncoded(/* uncompressed */ false); return Arrays.copyOfRange(pubBytes, 1, pubBytes.length); }
java
public static byte[] pubBytesWithoutFormat(ECPoint pubPoint) { final byte[] pubBytes = pubPoint.getEncoded(/* uncompressed */ false); return Arrays.copyOfRange(pubBytes, 1, pubBytes.length); }
[ "public", "static", "byte", "[", "]", "pubBytesWithoutFormat", "(", "ECPoint", "pubPoint", ")", "{", "final", "byte", "[", "]", "pubBytes", "=", "pubPoint", ".", "getEncoded", "(", "/* uncompressed */", "false", ")", ";", "return", "Arrays", ".", "copyOfRange", "(", "pubBytes", ",", "1", ",", "pubBytes", ".", "length", ")", ";", "}" ]
Compute the encoded X, Y coordinates of a public point. This is the encoded public key without the leading byte. @param pubPoint a public point @return 64-byte X,Y point pair
[ "Compute", "the", "encoded", "X", "Y", "coordinates", "of", "a", "public", "point", "." ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L493-L496
153,941
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/core/ECKey.java
ECKey.fromNodeId
public static ECKey fromNodeId(byte[] nodeId) { check(nodeId.length == 64, "Expected a 64 byte node id"); byte[] pubBytes = new byte[65]; System.arraycopy(nodeId, 0, pubBytes, 1, nodeId.length); pubBytes[0] = 0x04; // uncompressed return ECKey.fromPublicOnly(pubBytes); }
java
public static ECKey fromNodeId(byte[] nodeId) { check(nodeId.length == 64, "Expected a 64 byte node id"); byte[] pubBytes = new byte[65]; System.arraycopy(nodeId, 0, pubBytes, 1, nodeId.length); pubBytes[0] = 0x04; // uncompressed return ECKey.fromPublicOnly(pubBytes); }
[ "public", "static", "ECKey", "fromNodeId", "(", "byte", "[", "]", "nodeId", ")", "{", "check", "(", "nodeId", ".", "length", "==", "64", ",", "\"Expected a 64 byte node id\"", ")", ";", "byte", "[", "]", "pubBytes", "=", "new", "byte", "[", "65", "]", ";", "System", ".", "arraycopy", "(", "nodeId", ",", "0", ",", "pubBytes", ",", "1", ",", "nodeId", ".", "length", ")", ";", "pubBytes", "[", "0", "]", "=", "0x04", ";", "// uncompressed", "return", "ECKey", ".", "fromPublicOnly", "(", "pubBytes", ")", ";", "}" ]
Recover the public key from an encoded node id. @param nodeId a 64-byte X,Y point pair @return ECKey
[ "Recover", "the", "public", "key", "from", "an", "encoded", "node", "id", "." ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L517-L523
153,942
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/core/ECKey.java
ECKey.doSign
public ECDSASignature doSign(byte[] input) { if (input.length != 32) { throw new IllegalArgumentException("Expected 32 byte input to ECDSA signature, not " + input.length); } // No decryption of private key required. if (privKey == null) throw new MissingPrivateKeyException(); if (privKey instanceof BCECPrivateKey) { ECDSASigner signer = new ECDSASigner(new HMacDSAKCalculator(new SHA256Digest())); ECPrivateKeyParameters privKeyParams = new ECPrivateKeyParameters(((BCECPrivateKey) privKey).getD(), CURVE); signer.init(true, privKeyParams); BigInteger[] components = signer.generateSignature(input); return new ECDSASignature(components[0], components[1]).toCanonicalised(); } else { try { final Signature ecSig = ECSignatureFactory.getRawInstance(provider); ecSig.initSign(privKey); ecSig.update(input); final byte[] derSignature = ecSig.sign(); return ECDSASignature.decodeFromDER(derSignature).toCanonicalised(); } catch (SignatureException | InvalidKeyException ex) { throw new RuntimeException("ECKey signing error", ex); } } }
java
public ECDSASignature doSign(byte[] input) { if (input.length != 32) { throw new IllegalArgumentException("Expected 32 byte input to ECDSA signature, not " + input.length); } // No decryption of private key required. if (privKey == null) throw new MissingPrivateKeyException(); if (privKey instanceof BCECPrivateKey) { ECDSASigner signer = new ECDSASigner(new HMacDSAKCalculator(new SHA256Digest())); ECPrivateKeyParameters privKeyParams = new ECPrivateKeyParameters(((BCECPrivateKey) privKey).getD(), CURVE); signer.init(true, privKeyParams); BigInteger[] components = signer.generateSignature(input); return new ECDSASignature(components[0], components[1]).toCanonicalised(); } else { try { final Signature ecSig = ECSignatureFactory.getRawInstance(provider); ecSig.initSign(privKey); ecSig.update(input); final byte[] derSignature = ecSig.sign(); return ECDSASignature.decodeFromDER(derSignature).toCanonicalised(); } catch (SignatureException | InvalidKeyException ex) { throw new RuntimeException("ECKey signing error", ex); } } }
[ "public", "ECDSASignature", "doSign", "(", "byte", "[", "]", "input", ")", "{", "if", "(", "input", ".", "length", "!=", "32", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Expected 32 byte input to ECDSA signature, not \"", "+", "input", ".", "length", ")", ";", "}", "// No decryption of private key required.", "if", "(", "privKey", "==", "null", ")", "throw", "new", "MissingPrivateKeyException", "(", ")", ";", "if", "(", "privKey", "instanceof", "BCECPrivateKey", ")", "{", "ECDSASigner", "signer", "=", "new", "ECDSASigner", "(", "new", "HMacDSAKCalculator", "(", "new", "SHA256Digest", "(", ")", ")", ")", ";", "ECPrivateKeyParameters", "privKeyParams", "=", "new", "ECPrivateKeyParameters", "(", "(", "(", "BCECPrivateKey", ")", "privKey", ")", ".", "getD", "(", ")", ",", "CURVE", ")", ";", "signer", ".", "init", "(", "true", ",", "privKeyParams", ")", ";", "BigInteger", "[", "]", "components", "=", "signer", ".", "generateSignature", "(", "input", ")", ";", "return", "new", "ECDSASignature", "(", "components", "[", "0", "]", ",", "components", "[", "1", "]", ")", ".", "toCanonicalised", "(", ")", ";", "}", "else", "{", "try", "{", "final", "Signature", "ecSig", "=", "ECSignatureFactory", ".", "getRawInstance", "(", "provider", ")", ";", "ecSig", ".", "initSign", "(", "privKey", ")", ";", "ecSig", ".", "update", "(", "input", ")", ";", "final", "byte", "[", "]", "derSignature", "=", "ecSig", ".", "sign", "(", ")", ";", "return", "ECDSASignature", ".", "decodeFromDER", "(", "derSignature", ")", ".", "toCanonicalised", "(", ")", ";", "}", "catch", "(", "SignatureException", "|", "InvalidKeyException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "\"ECKey signing error\"", ",", "ex", ")", ";", "}", "}", "}" ]
Signs the given hash and returns the R and S components as BigIntegers and put them in ECDSASignature @param input to sign @return ECDSASignature signature that contains the R and S components
[ "Signs", "the", "given", "hash", "and", "returns", "the", "R", "and", "S", "components", "as", "BigIntegers", "and", "put", "them", "in", "ECDSASignature" ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L759-L783
153,943
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/core/ECKey.java
ECKey.signatureToKeyBytes
public static byte[] signatureToKeyBytes(byte[] messageHash, String signatureBase64) throws SignatureException { byte[] signatureEncoded; try { signatureEncoded = Base64.decode(signatureBase64); } catch (RuntimeException e) { // This is what you get back from Bouncy Castle if base64 doesn't decode :( throw new SignatureException("Could not decode base64", e); } // Parse the signature bytes into r/s and the selector value. if (signatureEncoded.length < 65) throw new SignatureException("Signature truncated, expected 65 bytes and got " + signatureEncoded.length); return signatureToKeyBytes(messageHash, ECDSASignature.fromComponents(Arrays.copyOfRange(signatureEncoded, 1, 33), Arrays.copyOfRange(signatureEncoded, 33, 65), (byte) (signatureEncoded[0] & 0xFF))); }
java
public static byte[] signatureToKeyBytes(byte[] messageHash, String signatureBase64) throws SignatureException { byte[] signatureEncoded; try { signatureEncoded = Base64.decode(signatureBase64); } catch (RuntimeException e) { // This is what you get back from Bouncy Castle if base64 doesn't decode :( throw new SignatureException("Could not decode base64", e); } // Parse the signature bytes into r/s and the selector value. if (signatureEncoded.length < 65) throw new SignatureException("Signature truncated, expected 65 bytes and got " + signatureEncoded.length); return signatureToKeyBytes(messageHash, ECDSASignature.fromComponents(Arrays.copyOfRange(signatureEncoded, 1, 33), Arrays.copyOfRange(signatureEncoded, 33, 65), (byte) (signatureEncoded[0] & 0xFF))); }
[ "public", "static", "byte", "[", "]", "signatureToKeyBytes", "(", "byte", "[", "]", "messageHash", ",", "String", "signatureBase64", ")", "throws", "SignatureException", "{", "byte", "[", "]", "signatureEncoded", ";", "try", "{", "signatureEncoded", "=", "Base64", ".", "decode", "(", "signatureBase64", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "// This is what you get back from Bouncy Castle if base64 doesn't decode :(", "throw", "new", "SignatureException", "(", "\"Could not decode base64\"", ",", "e", ")", ";", "}", "// Parse the signature bytes into r/s and the selector value.", "if", "(", "signatureEncoded", ".", "length", "<", "65", ")", "throw", "new", "SignatureException", "(", "\"Signature truncated, expected 65 bytes and got \"", "+", "signatureEncoded", ".", "length", ")", ";", "return", "signatureToKeyBytes", "(", "messageHash", ",", "ECDSASignature", ".", "fromComponents", "(", "Arrays", ".", "copyOfRange", "(", "signatureEncoded", ",", "1", ",", "33", ")", ",", "Arrays", ".", "copyOfRange", "(", "signatureEncoded", ",", "33", ",", "65", ")", ",", "(", "byte", ")", "(", "signatureEncoded", "[", "0", "]", "&", "0xFF", ")", ")", ")", ";", "}" ]
Given a piece of text and a message signature encoded in base64, returns an ECKey containing the public key that was used to sign it. This can then be compared to the expected public key to determine if the signature was correct. @param messageHash a piece of human readable text that was signed @param signatureBase64 The message signature in base64 @return - @throws SignatureException If the public key could not be recovered or if there was a signature format error.
[ "Given", "a", "piece", "of", "text", "and", "a", "message", "signature", "encoded", "in", "base64", "returns", "an", "ECKey", "containing", "the", "public", "key", "that", "was", "used", "to", "sign", "it", ".", "This", "can", "then", "be", "compared", "to", "the", "expected", "public", "key", "to", "determine", "if", "the", "signature", "was", "correct", "." ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L829-L844
153,944
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/core/ECKey.java
ECKey.isPubKeyCanonical
public static boolean isPubKeyCanonical(byte[] pubkey) { if (pubkey[0] == 0x04) { // Uncompressed pubkey if (pubkey.length != 65) return false; } else if (pubkey[0] == 0x02 || pubkey[0] == 0x03) { // Compressed pubkey if (pubkey.length != 33) return false; } else return false; return true; }
java
public static boolean isPubKeyCanonical(byte[] pubkey) { if (pubkey[0] == 0x04) { // Uncompressed pubkey if (pubkey.length != 65) return false; } else if (pubkey[0] == 0x02 || pubkey[0] == 0x03) { // Compressed pubkey if (pubkey.length != 33) return false; } else return false; return true; }
[ "public", "static", "boolean", "isPubKeyCanonical", "(", "byte", "[", "]", "pubkey", ")", "{", "if", "(", "pubkey", "[", "0", "]", "==", "0x04", ")", "{", "// Uncompressed pubkey", "if", "(", "pubkey", ".", "length", "!=", "65", ")", "return", "false", ";", "}", "else", "if", "(", "pubkey", "[", "0", "]", "==", "0x02", "||", "pubkey", "[", "0", "]", "==", "0x03", ")", "{", "// Compressed pubkey", "if", "(", "pubkey", ".", "length", "!=", "33", ")", "return", "false", ";", "}", "else", "return", "false", ";", "return", "true", ";", "}" ]
Returns true if the given pubkey is canonical, i.e. the correct length taking into account compression. @param pubkey - @return -
[ "Returns", "true", "if", "the", "given", "pubkey", "is", "canonical", "i", ".", "e", ".", "the", "correct", "length", "taking", "into", "account", "compression", "." ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L1087-L1099
153,945
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/core/ECKey.java
ECKey.getPrivKeyBytes
public byte[] getPrivKeyBytes() { if (privKey == null) { return null; } else if (privKey instanceof BCECPrivateKey) { return bigIntegerToBytes(((BCECPrivateKey) privKey).getD(), 32); } else { return null; } }
java
public byte[] getPrivKeyBytes() { if (privKey == null) { return null; } else if (privKey instanceof BCECPrivateKey) { return bigIntegerToBytes(((BCECPrivateKey) privKey).getD(), 32); } else { return null; } }
[ "public", "byte", "[", "]", "getPrivKeyBytes", "(", ")", "{", "if", "(", "privKey", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "privKey", "instanceof", "BCECPrivateKey", ")", "{", "return", "bigIntegerToBytes", "(", "(", "(", "BCECPrivateKey", ")", "privKey", ")", ".", "getD", "(", ")", ",", "32", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Returns a 32 byte array containing the private key, or null if the key is encrypted or public only @return -
[ "Returns", "a", "32", "byte", "array", "containing", "the", "private", "key", "or", "null", "if", "the", "key", "is", "encrypted", "or", "public", "only" ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L1256-L1264
153,946
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java
SortOrderHandler.setGridTable
public void setGridTable(int iKeyArea) { String keyAreaName = null; if (iKeyArea != -1) keyAreaName = this.getOwner().getRecord().getKeyArea(iKeyArea).getKeyName(); this.setGridTable(keyAreaName, null, -1); }
java
public void setGridTable(int iKeyArea) { String keyAreaName = null; if (iKeyArea != -1) keyAreaName = this.getOwner().getRecord().getKeyArea(iKeyArea).getKeyName(); this.setGridTable(keyAreaName, null, -1); }
[ "public", "void", "setGridTable", "(", "int", "iKeyArea", ")", "{", "String", "keyAreaName", "=", "null", ";", "if", "(", "iKeyArea", "!=", "-", "1", ")", "keyAreaName", "=", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getKeyArea", "(", "iKeyArea", ")", ".", "getKeyName", "(", ")", ";", "this", ".", "setGridTable", "(", "keyAreaName", ",", "null", ",", "-", "1", ")", ";", "}" ]
Default call; gridTable=mainRecord, index=next. @param iKeyArea The key area to set to the next key.
[ "Default", "call", ";", "gridTable", "=", "mainRecord", "index", "=", "next", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java#L148-L154
153,947
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java
SortOrderHandler.setGridTable
public void setGridTable(String keyAreaName, Rec gridTable, int index) { if (index == -1) index = m_iNextArrayIndex; // Next available m_iNextArrayIndex = Math.max(m_iNextArrayIndex, index+1); if (gridTable == null) if (m_gridScreen != null) gridTable = m_gridScreen.getMainRecord(); if (gridTable != null) if (m_gridScreen != null) if (gridTable != m_gridScreen.getMainRecord()) { if (m_gridScreen.getMainRecord() instanceof QueryRecord) { int keyIndex = ((QueryRecord)m_gridScreen.getMainRecord()).setGridFile((Record)gridTable, keyAreaName); // Sets the key order and gridtable (even if only one file) keyAreaName = gridTable.getKeyArea(keyIndex).getKeyName(); } } m_iKeyAreaArray[index] = keyAreaName; }
java
public void setGridTable(String keyAreaName, Rec gridTable, int index) { if (index == -1) index = m_iNextArrayIndex; // Next available m_iNextArrayIndex = Math.max(m_iNextArrayIndex, index+1); if (gridTable == null) if (m_gridScreen != null) gridTable = m_gridScreen.getMainRecord(); if (gridTable != null) if (m_gridScreen != null) if (gridTable != m_gridScreen.getMainRecord()) { if (m_gridScreen.getMainRecord() instanceof QueryRecord) { int keyIndex = ((QueryRecord)m_gridScreen.getMainRecord()).setGridFile((Record)gridTable, keyAreaName); // Sets the key order and gridtable (even if only one file) keyAreaName = gridTable.getKeyArea(keyIndex).getKeyName(); } } m_iKeyAreaArray[index] = keyAreaName; }
[ "public", "void", "setGridTable", "(", "String", "keyAreaName", ",", "Rec", "gridTable", ",", "int", "index", ")", "{", "if", "(", "index", "==", "-", "1", ")", "index", "=", "m_iNextArrayIndex", ";", "// Next available", "m_iNextArrayIndex", "=", "Math", ".", "max", "(", "m_iNextArrayIndex", ",", "index", "+", "1", ")", ";", "if", "(", "gridTable", "==", "null", ")", "if", "(", "m_gridScreen", "!=", "null", ")", "gridTable", "=", "m_gridScreen", ".", "getMainRecord", "(", ")", ";", "if", "(", "gridTable", "!=", "null", ")", "if", "(", "m_gridScreen", "!=", "null", ")", "if", "(", "gridTable", "!=", "m_gridScreen", ".", "getMainRecord", "(", ")", ")", "{", "if", "(", "m_gridScreen", ".", "getMainRecord", "(", ")", "instanceof", "QueryRecord", ")", "{", "int", "keyIndex", "=", "(", "(", "QueryRecord", ")", "m_gridScreen", ".", "getMainRecord", "(", ")", ")", ".", "setGridFile", "(", "(", "Record", ")", "gridTable", ",", "keyAreaName", ")", ";", "// Sets the key order and gridtable (even if only one file)", "keyAreaName", "=", "gridTable", ".", "getKeyArea", "(", "keyIndex", ")", ".", "getKeyName", "(", ")", ";", "}", "}", "m_iKeyAreaArray", "[", "index", "]", "=", "keyAreaName", ";", "}" ]
Set an index to a key area. @param iKeyArea The key area to set to this index. @param gridTable The record to set. @param index The index to relate to this keyarea/gridtable combo.
[ "Set", "an", "index", "to", "a", "key", "area", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java#L171-L187
153,948
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java
SortOrderHandler.setupGridOrder
public int setupGridOrder() { int iErrorCode = DBConstants.NORMAL_RETURN; boolean bOrder = DBConstants.ASCENDING; int iKeyOrder = (int)((NumberField)this.getOwner()).getValue(); if (iKeyOrder == 0) return DBConstants.KEY_NOT_FOUND; if (iKeyOrder < 0) { bOrder = DBConstants.DESCENDING; iKeyOrder = -iKeyOrder; } iKeyOrder--; // 0 Based if (iKeyOrder < m_iNextArrayIndex) { if (m_recGrid == null) m_recGrid = (Record)m_gridScreen.getMainRecord(); for (int i = 0; i < m_recGrid.getKeyAreaCount(); i++) { if (m_recGrid.getKeyArea(i).getKeyName().equals(m_iKeyAreaArray[iKeyOrder])) iKeyOrder = i; // Get key order from internal array } } else { // They chose a column that was was not specified... Get the desc and try to sort it by the field if (m_gridScreen != null) { int iColumn = iKeyOrder + 1 + m_gridScreen.getNavCount(); // grid column ScreenComponent sField = m_gridScreen.getSField(iColumn); if (sField.getConverter() != null) if (sField.getConverter().getField() != null) { Record record = (Record)m_gridScreen.getMainRecord(); iKeyOrder = -1; // No obvious sort order for (int iKeyArea = 0; iKeyArea < record.getKeyAreaCount(); iKeyArea++) { KeyArea keyArea = record.getKeyArea(iKeyArea); if (keyArea.getField(0) == sField.getConverter().getField()) { // Is this field the first field of this key? iKeyOrder = iKeyArea; // Yes, use this order break; } } if (iKeyOrder == -1) if (m_bCreateSortOrder) { // Create a key to sort on BaseField field = (BaseField)sField.getConverter().getField(); KeyArea keyArea = new KeyArea(record, DBConstants.NOT_UNIQUE, field.getFieldName() + "tempKey"); new KeyField(keyArea, field, DBConstants.ASCENDING); iKeyOrder = record.getKeyAreaCount() - 1; } } } } if (iKeyOrder < 0) return DBConstants.KEY_NOT_FOUND; KeyArea keyArea = null; if (m_recGrid == null) m_recGrid = (Record)m_gridScreen.getMainRecord(); keyArea = m_recGrid.setKeyArea(iKeyOrder); if (keyArea == null) iErrorCode = DBConstants.KEY_NOT_FOUND; else { for (int i = 0; i < keyArea.getKeyFields(); i++) { KeyField keyField = keyArea.getKeyField(i); keyField.setKeyOrder(bOrder); } } return iErrorCode; }
java
public int setupGridOrder() { int iErrorCode = DBConstants.NORMAL_RETURN; boolean bOrder = DBConstants.ASCENDING; int iKeyOrder = (int)((NumberField)this.getOwner()).getValue(); if (iKeyOrder == 0) return DBConstants.KEY_NOT_FOUND; if (iKeyOrder < 0) { bOrder = DBConstants.DESCENDING; iKeyOrder = -iKeyOrder; } iKeyOrder--; // 0 Based if (iKeyOrder < m_iNextArrayIndex) { if (m_recGrid == null) m_recGrid = (Record)m_gridScreen.getMainRecord(); for (int i = 0; i < m_recGrid.getKeyAreaCount(); i++) { if (m_recGrid.getKeyArea(i).getKeyName().equals(m_iKeyAreaArray[iKeyOrder])) iKeyOrder = i; // Get key order from internal array } } else { // They chose a column that was was not specified... Get the desc and try to sort it by the field if (m_gridScreen != null) { int iColumn = iKeyOrder + 1 + m_gridScreen.getNavCount(); // grid column ScreenComponent sField = m_gridScreen.getSField(iColumn); if (sField.getConverter() != null) if (sField.getConverter().getField() != null) { Record record = (Record)m_gridScreen.getMainRecord(); iKeyOrder = -1; // No obvious sort order for (int iKeyArea = 0; iKeyArea < record.getKeyAreaCount(); iKeyArea++) { KeyArea keyArea = record.getKeyArea(iKeyArea); if (keyArea.getField(0) == sField.getConverter().getField()) { // Is this field the first field of this key? iKeyOrder = iKeyArea; // Yes, use this order break; } } if (iKeyOrder == -1) if (m_bCreateSortOrder) { // Create a key to sort on BaseField field = (BaseField)sField.getConverter().getField(); KeyArea keyArea = new KeyArea(record, DBConstants.NOT_UNIQUE, field.getFieldName() + "tempKey"); new KeyField(keyArea, field, DBConstants.ASCENDING); iKeyOrder = record.getKeyAreaCount() - 1; } } } } if (iKeyOrder < 0) return DBConstants.KEY_NOT_FOUND; KeyArea keyArea = null; if (m_recGrid == null) m_recGrid = (Record)m_gridScreen.getMainRecord(); keyArea = m_recGrid.setKeyArea(iKeyOrder); if (keyArea == null) iErrorCode = DBConstants.KEY_NOT_FOUND; else { for (int i = 0; i < keyArea.getKeyFields(); i++) { KeyField keyField = keyArea.getKeyField(i); keyField.setKeyOrder(bOrder); } } return iErrorCode; }
[ "public", "int", "setupGridOrder", "(", ")", "{", "int", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "boolean", "bOrder", "=", "DBConstants", ".", "ASCENDING", ";", "int", "iKeyOrder", "=", "(", "int", ")", "(", "(", "NumberField", ")", "this", ".", "getOwner", "(", ")", ")", ".", "getValue", "(", ")", ";", "if", "(", "iKeyOrder", "==", "0", ")", "return", "DBConstants", ".", "KEY_NOT_FOUND", ";", "if", "(", "iKeyOrder", "<", "0", ")", "{", "bOrder", "=", "DBConstants", ".", "DESCENDING", ";", "iKeyOrder", "=", "-", "iKeyOrder", ";", "}", "iKeyOrder", "--", ";", "// 0 Based", "if", "(", "iKeyOrder", "<", "m_iNextArrayIndex", ")", "{", "if", "(", "m_recGrid", "==", "null", ")", "m_recGrid", "=", "(", "Record", ")", "m_gridScreen", ".", "getMainRecord", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_recGrid", ".", "getKeyAreaCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "m_recGrid", ".", "getKeyArea", "(", "i", ")", ".", "getKeyName", "(", ")", ".", "equals", "(", "m_iKeyAreaArray", "[", "iKeyOrder", "]", ")", ")", "iKeyOrder", "=", "i", ";", "// Get key order from internal array", "}", "}", "else", "{", "// They chose a column that was was not specified... Get the desc and try to sort it by the field", "if", "(", "m_gridScreen", "!=", "null", ")", "{", "int", "iColumn", "=", "iKeyOrder", "+", "1", "+", "m_gridScreen", ".", "getNavCount", "(", ")", ";", "// grid column", "ScreenComponent", "sField", "=", "m_gridScreen", ".", "getSField", "(", "iColumn", ")", ";", "if", "(", "sField", ".", "getConverter", "(", ")", "!=", "null", ")", "if", "(", "sField", ".", "getConverter", "(", ")", ".", "getField", "(", ")", "!=", "null", ")", "{", "Record", "record", "=", "(", "Record", ")", "m_gridScreen", ".", "getMainRecord", "(", ")", ";", "iKeyOrder", "=", "-", "1", ";", "// No obvious sort order", "for", "(", "int", "iKeyArea", "=", "0", ";", "iKeyArea", "<", "record", ".", "getKeyAreaCount", "(", ")", ";", "iKeyArea", "++", ")", "{", "KeyArea", "keyArea", "=", "record", ".", "getKeyArea", "(", "iKeyArea", ")", ";", "if", "(", "keyArea", ".", "getField", "(", "0", ")", "==", "sField", ".", "getConverter", "(", ")", ".", "getField", "(", ")", ")", "{", "// Is this field the first field of this key?", "iKeyOrder", "=", "iKeyArea", ";", "// Yes, use this order", "break", ";", "}", "}", "if", "(", "iKeyOrder", "==", "-", "1", ")", "if", "(", "m_bCreateSortOrder", ")", "{", "// Create a key to sort on", "BaseField", "field", "=", "(", "BaseField", ")", "sField", ".", "getConverter", "(", ")", ".", "getField", "(", ")", ";", "KeyArea", "keyArea", "=", "new", "KeyArea", "(", "record", ",", "DBConstants", ".", "NOT_UNIQUE", ",", "field", ".", "getFieldName", "(", ")", "+", "\"tempKey\"", ")", ";", "new", "KeyField", "(", "keyArea", ",", "field", ",", "DBConstants", ".", "ASCENDING", ")", ";", "iKeyOrder", "=", "record", ".", "getKeyAreaCount", "(", ")", "-", "1", ";", "}", "}", "}", "}", "if", "(", "iKeyOrder", "<", "0", ")", "return", "DBConstants", ".", "KEY_NOT_FOUND", ";", "KeyArea", "keyArea", "=", "null", ";", "if", "(", "m_recGrid", "==", "null", ")", "m_recGrid", "=", "(", "Record", ")", "m_gridScreen", ".", "getMainRecord", "(", ")", ";", "keyArea", "=", "m_recGrid", ".", "setKeyArea", "(", "iKeyOrder", ")", ";", "if", "(", "keyArea", "==", "null", ")", "iErrorCode", "=", "DBConstants", ".", "KEY_NOT_FOUND", ";", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "keyArea", ".", "getKeyFields", "(", ")", ";", "i", "++", ")", "{", "KeyField", "keyField", "=", "keyArea", ".", "getKeyField", "(", "i", ")", ";", "keyField", ".", "setKeyOrder", "(", "bOrder", ")", ";", "}", "}", "return", "iErrorCode", ";", "}" ]
Set the grid order to the value in this field. @return an error code.
[ "Set", "the", "grid", "order", "to", "the", "value", "in", "this", "field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java#L192-L264
153,949
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java
SortOrderHandler.fieldChanged
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { int iErrorCode = this.setupGridOrder(); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; return super.fieldChanged(bDisplayOption, iMoveMode); }
java
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { int iErrorCode = this.setupGridOrder(); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; return super.fieldChanged(bDisplayOption, iMoveMode); }
[ "public", "int", "fieldChanged", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "int", "iErrorCode", "=", "this", ".", "setupGridOrder", "(", ")", ";", "if", "(", "iErrorCode", "!=", "DBConstants", ".", "NORMAL_RETURN", ")", "return", "iErrorCode", ";", "return", "super", ".", "fieldChanged", "(", "bDisplayOption", ",", "iMoveMode", ")", ";", "}" ]
The Field has Changed. Change the key order to match this field's value. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "The", "Field", "has", "Changed", ".", "Change", "the", "key", "order", "to", "match", "this", "field", "s", "value", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java#L272-L278
153,950
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/ToggleConverter.java
ToggleConverter.setString
public int setString(String string, boolean bDisplayOption, int moveMode) { boolean bNewState = !this.getNextConverter().getState(); return this.getNextConverter().setState(bNewState, bDisplayOption, moveMode); // Toggle the state }
java
public int setString(String string, boolean bDisplayOption, int moveMode) { boolean bNewState = !this.getNextConverter().getState(); return this.getNextConverter().setState(bNewState, bDisplayOption, moveMode); // Toggle the state }
[ "public", "int", "setString", "(", "String", "string", ",", "boolean", "bDisplayOption", ",", "int", "moveMode", ")", "{", "boolean", "bNewState", "=", "!", "this", ".", "getNextConverter", "(", ")", ".", "getState", "(", ")", ";", "return", "this", ".", "getNextConverter", "(", ")", ".", "setState", "(", "bNewState", ",", "bDisplayOption", ",", "moveMode", ")", ";", "// Toggle the state", "}" ]
Convert and move string to this field. Toggle the field value. Override this method to convert the String to the actual Physical Data Type. @param strString the state to set the data to. @param bDisplayOption Display the data on the screen if true. @param iMoveMode INIT, SCREEN, or READ move mode. @return The error code (or NORMAL_RETURN).
[ "Convert", "and", "move", "string", "to", "this", "field", ".", "Toggle", "the", "field", "value", ".", "Override", "this", "method", "to", "convert", "the", "String", "to", "the", "actual", "Physical", "Data", "Type", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/ToggleConverter.java#L49-L53
153,951
lshift/jamume
src/main/java/net/lshift/java/dispatch/JavaC3.java
JavaC3.isCandidate
private static <X> Predicate<X> isCandidate(final Iterable<List<X>> remainingInputs) { return new Predicate<X>() { Predicate<List<X>> headIs(final X c) { return new Predicate<List<X>>() { public boolean apply(List<X> input) { return !input.isEmpty() && c.equals(input.get(0)); } }; } Predicate<List<X>> tailContains(final X c) { return new Predicate<List<X>>() { public boolean apply(List<X> input) { return input.indexOf(c) > 0; } }; } public boolean apply(final X c) { return any(remainingInputs, headIs(c)) && all(remainingInputs, not(tailContains(c))); } }; }
java
private static <X> Predicate<X> isCandidate(final Iterable<List<X>> remainingInputs) { return new Predicate<X>() { Predicate<List<X>> headIs(final X c) { return new Predicate<List<X>>() { public boolean apply(List<X> input) { return !input.isEmpty() && c.equals(input.get(0)); } }; } Predicate<List<X>> tailContains(final X c) { return new Predicate<List<X>>() { public boolean apply(List<X> input) { return input.indexOf(c) > 0; } }; } public boolean apply(final X c) { return any(remainingInputs, headIs(c)) && all(remainingInputs, not(tailContains(c))); } }; }
[ "private", "static", "<", "X", ">", "Predicate", "<", "X", ">", "isCandidate", "(", "final", "Iterable", "<", "List", "<", "X", ">", ">", "remainingInputs", ")", "{", "return", "new", "Predicate", "<", "X", ">", "(", ")", "{", "Predicate", "<", "List", "<", "X", ">", ">", "headIs", "(", "final", "X", "c", ")", "{", "return", "new", "Predicate", "<", "List", "<", "X", ">", ">", "(", ")", "{", "public", "boolean", "apply", "(", "List", "<", "X", ">", "input", ")", "{", "return", "!", "input", ".", "isEmpty", "(", ")", "&&", "c", ".", "equals", "(", "input", ".", "get", "(", "0", ")", ")", ";", "}", "}", ";", "}", "Predicate", "<", "List", "<", "X", ">", ">", "tailContains", "(", "final", "X", "c", ")", "{", "return", "new", "Predicate", "<", "List", "<", "X", ">", ">", "(", ")", "{", "public", "boolean", "apply", "(", "List", "<", "X", ">", "input", ")", "{", "return", "input", ".", "indexOf", "(", "c", ")", ">", "0", ";", "}", "}", ";", "}", "public", "boolean", "apply", "(", "final", "X", "c", ")", "{", "return", "any", "(", "remainingInputs", ",", "headIs", "(", "c", ")", ")", "&&", "all", "(", "remainingInputs", ",", "not", "(", "tailContains", "(", "c", ")", ")", ")", ";", "}", "}", ";", "}" ]
To be a candidate for the next place in the linearization, you must be the head of at least one list, and in the tail of none of the lists. @param remainingInputs the lists we are looking for position in. @return true if the class is a candidate for next.
[ "To", "be", "a", "candidate", "for", "the", "next", "place", "in", "the", "linearization", "you", "must", "be", "the", "head", "of", "at", "least", "one", "list", "and", "in", "the", "tail", "of", "none", "of", "the", "lists", "." ]
754d9ab29311601328a2f39928775e4e010305b7
https://github.com/lshift/jamume/blob/754d9ab29311601328a2f39928775e4e010305b7/src/main/java/net/lshift/java/dispatch/JavaC3.java#L186-L210
153,952
tvesalainen/util
util/src/main/java/org/vesalainen/nio/channels/vc/SingletonSelectableVirtualCircuit.java
SingletonSelectableVirtualCircuit.join
public void join(SelectableBySelector ch1, SelectableBySelector ch2) throws IOException { join(ch1.getSelector(), ch2.getSelector(), (ByteChannel)ch1, (ByteChannel)ch2); }
java
public void join(SelectableBySelector ch1, SelectableBySelector ch2) throws IOException { join(ch1.getSelector(), ch2.getSelector(), (ByteChannel)ch1, (ByteChannel)ch2); }
[ "public", "void", "join", "(", "SelectableBySelector", "ch1", ",", "SelectableBySelector", "ch2", ")", "throws", "IOException", "{", "join", "(", "ch1", ".", "getSelector", "(", ")", ",", "ch2", ".", "getSelector", "(", ")", ",", "(", "ByteChannel", ")", "ch1", ",", "(", "ByteChannel", ")", "ch2", ")", ";", "}" ]
Join channel pair to this virtual circuit @param ch1 @param ch2 @throws IOException
[ "Join", "channel", "pair", "to", "this", "virtual", "circuit" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/vc/SingletonSelectableVirtualCircuit.java#L76-L79
153,953
caspervg/SC4D-LEX4J
lex4j/src/main/java/net/caspervg/lex4j/route/CategoryRoute.java
CategoryRoute.getBroadCategories
public List<BroadCategory> getBroadCategories() { ClientResource resource = new ClientResource(Route.BROAD_CATEGORY.url()); try { Representation repr = resource.get(); return mapper.readValue(repr.getText(), new TypeReference<List<BroadCategory>>() {}); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve broad categories correctly!"); return null; } }
java
public List<BroadCategory> getBroadCategories() { ClientResource resource = new ClientResource(Route.BROAD_CATEGORY.url()); try { Representation repr = resource.get(); return mapper.readValue(repr.getText(), new TypeReference<List<BroadCategory>>() {}); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve broad categories correctly!"); return null; } }
[ "public", "List", "<", "BroadCategory", ">", "getBroadCategories", "(", ")", "{", "ClientResource", "resource", "=", "new", "ClientResource", "(", "Route", ".", "BROAD_CATEGORY", ".", "url", "(", ")", ")", ";", "try", "{", "Representation", "repr", "=", "resource", ".", "get", "(", ")", ";", "return", "mapper", ".", "readValue", "(", "repr", ".", "getText", "(", ")", ",", "new", "TypeReference", "<", "List", "<", "BroadCategory", ">", ">", "(", ")", "{", "}", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "LEX4JLogger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Could not retrieve broad categories correctly!\"", ")", ";", "return", "null", ";", "}", "}" ]
Returns the broad categories @return the broad categories
[ "Returns", "the", "broad", "categories" ]
3d086ec70c817119a88573c2e23af27276cdb1d6
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/CategoryRoute.java#L35-L45
153,954
caspervg/SC4D-LEX4J
lex4j/src/main/java/net/caspervg/lex4j/route/CategoryRoute.java
CategoryRoute.getLEXCategories
public List<Category> getLEXCategories() { ClientResource resource = new ClientResource(Route.LEX_CATEGORY.url()); try { Representation repr = resource.get(); return mapper.readValue(repr.getText(), new TypeReference<List<Category>>() {}); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve LEX categories correctly!"); return null; } }
java
public List<Category> getLEXCategories() { ClientResource resource = new ClientResource(Route.LEX_CATEGORY.url()); try { Representation repr = resource.get(); return mapper.readValue(repr.getText(), new TypeReference<List<Category>>() {}); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve LEX categories correctly!"); return null; } }
[ "public", "List", "<", "Category", ">", "getLEXCategories", "(", ")", "{", "ClientResource", "resource", "=", "new", "ClientResource", "(", "Route", ".", "LEX_CATEGORY", ".", "url", "(", ")", ")", ";", "try", "{", "Representation", "repr", "=", "resource", ".", "get", "(", ")", ";", "return", "mapper", ".", "readValue", "(", "repr", ".", "getText", "(", ")", ",", "new", "TypeReference", "<", "List", "<", "Category", ">", ">", "(", ")", "{", "}", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "LEX4JLogger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Could not retrieve LEX categories correctly!\"", ")", ";", "return", "null", ";", "}", "}" ]
Returns the LEX categories @return the LEX categories
[ "Returns", "the", "LEX", "categories" ]
3d086ec70c817119a88573c2e23af27276cdb1d6
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/CategoryRoute.java#L52-L62
153,955
caspervg/SC4D-LEX4J
lex4j/src/main/java/net/caspervg/lex4j/route/CategoryRoute.java
CategoryRoute.getLEXTypes
public List<TypeCategory> getLEXTypes() { ClientResource resource = new ClientResource(Route.LEX_TYPE.url()); try { Representation repr = resource.get(); return mapper.readValue(repr.getText(), new TypeReference<List<TypeCategory>>() {}); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve LEX types correctly!"); return null; } }
java
public List<TypeCategory> getLEXTypes() { ClientResource resource = new ClientResource(Route.LEX_TYPE.url()); try { Representation repr = resource.get(); return mapper.readValue(repr.getText(), new TypeReference<List<TypeCategory>>() {}); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve LEX types correctly!"); return null; } }
[ "public", "List", "<", "TypeCategory", ">", "getLEXTypes", "(", ")", "{", "ClientResource", "resource", "=", "new", "ClientResource", "(", "Route", ".", "LEX_TYPE", ".", "url", "(", ")", ")", ";", "try", "{", "Representation", "repr", "=", "resource", ".", "get", "(", ")", ";", "return", "mapper", ".", "readValue", "(", "repr", ".", "getText", "(", ")", ",", "new", "TypeReference", "<", "List", "<", "TypeCategory", ">", ">", "(", ")", "{", "}", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "LEX4JLogger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Could not retrieve LEX types correctly!\"", ")", ";", "return", "null", ";", "}", "}" ]
Returns the LEX types @return the LEX types
[ "Returns", "the", "LEX", "types" ]
3d086ec70c817119a88573c2e23af27276cdb1d6
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/CategoryRoute.java#L69-L79
153,956
caspervg/SC4D-LEX4J
lex4j/src/main/java/net/caspervg/lex4j/route/CategoryRoute.java
CategoryRoute.getLotGroups
public List<GroupCategory> getLotGroups() { ClientResource resource = new ClientResource(Route.LOTGROUP.url()); try { Representation repr = resource.get(); return mapper.readValue(repr.getText(), new TypeReference<List<GroupCategory>>() {}); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve lot groups correctly!"); return null; } }
java
public List<GroupCategory> getLotGroups() { ClientResource resource = new ClientResource(Route.LOTGROUP.url()); try { Representation repr = resource.get(); return mapper.readValue(repr.getText(), new TypeReference<List<GroupCategory>>() {}); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve lot groups correctly!"); return null; } }
[ "public", "List", "<", "GroupCategory", ">", "getLotGroups", "(", ")", "{", "ClientResource", "resource", "=", "new", "ClientResource", "(", "Route", ".", "LOTGROUP", ".", "url", "(", ")", ")", ";", "try", "{", "Representation", "repr", "=", "resource", ".", "get", "(", ")", ";", "return", "mapper", ".", "readValue", "(", "repr", ".", "getText", "(", ")", ",", "new", "TypeReference", "<", "List", "<", "GroupCategory", ">", ">", "(", ")", "{", "}", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "LEX4JLogger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Could not retrieve lot groups correctly!\"", ")", ";", "return", "null", ";", "}", "}" ]
Returns the lot groups @return the lot groups
[ "Returns", "the", "lot", "groups" ]
3d086ec70c817119a88573c2e23af27276cdb1d6
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/CategoryRoute.java#L86-L96
153,957
caspervg/SC4D-LEX4J
lex4j/src/main/java/net/caspervg/lex4j/route/CategoryRoute.java
CategoryRoute.getCategories
public CategoryOverview getCategories() { ClientResource resource = new ClientResource(Route.ALL_CATEGORY.url()); try { Representation repr = resource.get(); return mapper.readValue(repr.getText(), CategoryOverview.class); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve the categories correctly!"); return null; } }
java
public CategoryOverview getCategories() { ClientResource resource = new ClientResource(Route.ALL_CATEGORY.url()); try { Representation repr = resource.get(); return mapper.readValue(repr.getText(), CategoryOverview.class); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve the categories correctly!"); return null; } }
[ "public", "CategoryOverview", "getCategories", "(", ")", "{", "ClientResource", "resource", "=", "new", "ClientResource", "(", "Route", ".", "ALL_CATEGORY", ".", "url", "(", ")", ")", ";", "try", "{", "Representation", "repr", "=", "resource", ".", "get", "(", ")", ";", "return", "mapper", ".", "readValue", "(", "repr", ".", "getText", "(", ")", ",", "CategoryOverview", ".", "class", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "LEX4JLogger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Could not retrieve the categories correctly!\"", ")", ";", "return", "null", ";", "}", "}" ]
Returns all the categories @return all the categories
[ "Returns", "all", "the", "categories" ]
3d086ec70c817119a88573c2e23af27276cdb1d6
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/CategoryRoute.java#L120-L130
153,958
js-lib-com/commons
src/main/java/js/io/VariablesWriter.java
VariablesWriter.write
@Override public void write(char[] cbuf, int off, int len) throws IOException { for (int count = 0; count < len; ++off, ++count) { char c = cbuf[off]; switch (state) { case TEXT: if (c == '$') { state = State.VARIABLE_MARK; } else { targetWriter.write(c); } break; case VARIABLE_MARK: if (c == '{') { state = State.VARIABLE; variableBuilder.setLength(0); } else { targetWriter.write('$'); targetWriter.write(c); state = State.TEXT; } break; case VARIABLE: if (c == '}') { String variable = variables.get(variableBuilder.toString()); if (variable == null) { // if variable not found it should be an internal variable used by processing file // for example ${BUILD} from ant files; copy as it is targetWriter.write("${"); targetWriter.write(variableBuilder.toString()); targetWriter.write('}'); } else { targetWriter.write(variable); } state = State.TEXT; } else { variableBuilder.append(c); } break; default: throw new IllegalStateException(); } } }
java
@Override public void write(char[] cbuf, int off, int len) throws IOException { for (int count = 0; count < len; ++off, ++count) { char c = cbuf[off]; switch (state) { case TEXT: if (c == '$') { state = State.VARIABLE_MARK; } else { targetWriter.write(c); } break; case VARIABLE_MARK: if (c == '{') { state = State.VARIABLE; variableBuilder.setLength(0); } else { targetWriter.write('$'); targetWriter.write(c); state = State.TEXT; } break; case VARIABLE: if (c == '}') { String variable = variables.get(variableBuilder.toString()); if (variable == null) { // if variable not found it should be an internal variable used by processing file // for example ${BUILD} from ant files; copy as it is targetWriter.write("${"); targetWriter.write(variableBuilder.toString()); targetWriter.write('}'); } else { targetWriter.write(variable); } state = State.TEXT; } else { variableBuilder.append(c); } break; default: throw new IllegalStateException(); } } }
[ "@", "Override", "public", "void", "write", "(", "char", "[", "]", "cbuf", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "for", "(", "int", "count", "=", "0", ";", "count", "<", "len", ";", "++", "off", ",", "++", "count", ")", "{", "char", "c", "=", "cbuf", "[", "off", "]", ";", "switch", "(", "state", ")", "{", "case", "TEXT", ":", "if", "(", "c", "==", "'", "'", ")", "{", "state", "=", "State", ".", "VARIABLE_MARK", ";", "}", "else", "{", "targetWriter", ".", "write", "(", "c", ")", ";", "}", "break", ";", "case", "VARIABLE_MARK", ":", "if", "(", "c", "==", "'", "'", ")", "{", "state", "=", "State", ".", "VARIABLE", ";", "variableBuilder", ".", "setLength", "(", "0", ")", ";", "}", "else", "{", "targetWriter", ".", "write", "(", "'", "'", ")", ";", "targetWriter", ".", "write", "(", "c", ")", ";", "state", "=", "State", ".", "TEXT", ";", "}", "break", ";", "case", "VARIABLE", ":", "if", "(", "c", "==", "'", "'", ")", "{", "String", "variable", "=", "variables", ".", "get", "(", "variableBuilder", ".", "toString", "(", ")", ")", ";", "if", "(", "variable", "==", "null", ")", "{", "// if variable not found it should be an internal variable used by processing file\r", "// for example ${BUILD} from ant files; copy as it is\r", "targetWriter", ".", "write", "(", "\"${\"", ")", ";", "targetWriter", ".", "write", "(", "variableBuilder", ".", "toString", "(", ")", ")", ";", "targetWriter", ".", "write", "(", "'", "'", ")", ";", "}", "else", "{", "targetWriter", ".", "write", "(", "variable", ")", ";", "}", "state", "=", "State", ".", "TEXT", ";", "}", "else", "{", "variableBuilder", ".", "append", "(", "c", ")", ";", "}", "break", ";", "default", ":", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "}", "}" ]
Inject values into given variables stream and write the result to target writer. @param cbuf characters from variables stream, @param off buffer offset, @param len buffer length.
[ "Inject", "values", "into", "given", "variables", "stream", "and", "write", "the", "result", "to", "target", "writer", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/VariablesWriter.java#L80-L127
153,959
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/SBaseButton.java
SBaseButton.getButtonDesc
public String getButtonDesc() { if (this.getDisplayFieldDesc(this) == false) return null; // Don't display a desc with this control if (this.getSeparateFieldDesc()) return null; // Field desc is already a separate control, don't display if (this.getConverter() != null) return this.getConverter().getFieldDesc(); // Or override and supply value return null; }
java
public String getButtonDesc() { if (this.getDisplayFieldDesc(this) == false) return null; // Don't display a desc with this control if (this.getSeparateFieldDesc()) return null; // Field desc is already a separate control, don't display if (this.getConverter() != null) return this.getConverter().getFieldDesc(); // Or override and supply value return null; }
[ "public", "String", "getButtonDesc", "(", ")", "{", "if", "(", "this", ".", "getDisplayFieldDesc", "(", "this", ")", "==", "false", ")", "return", "null", ";", "// Don't display a desc with this control", "if", "(", "this", ".", "getSeparateFieldDesc", "(", ")", ")", "return", "null", ";", "// Field desc is already a separate control, don't display", "if", "(", "this", ".", "getConverter", "(", ")", "!=", "null", ")", "return", "this", ".", "getConverter", "(", ")", ".", "getFieldDesc", "(", ")", ";", "// Or override and supply value", "return", "null", ";", "}" ]
Get the button description. @return The button description.
[ "Get", "the", "button", "description", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/SBaseButton.java#L137-L146
153,960
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/SBaseButton.java
SBaseButton.getButtonCommand
public String getButtonCommand() { String strCommand = m_strCommand; if (strCommand == null) strCommand = this.getButtonDesc(); if ((strCommand == null) || (strCommand.equals(Constants.BLANK))) strCommand = m_strImageButton; // Use image name until the image is loaded return strCommand; }
java
public String getButtonCommand() { String strCommand = m_strCommand; if (strCommand == null) strCommand = this.getButtonDesc(); if ((strCommand == null) || (strCommand.equals(Constants.BLANK))) strCommand = m_strImageButton; // Use image name until the image is loaded return strCommand; }
[ "public", "String", "getButtonCommand", "(", ")", "{", "String", "strCommand", "=", "m_strCommand", ";", "if", "(", "strCommand", "==", "null", ")", "strCommand", "=", "this", ".", "getButtonDesc", "(", ")", ";", "if", "(", "(", "strCommand", "==", "null", ")", "||", "(", "strCommand", ".", "equals", "(", "Constants", ".", "BLANK", ")", ")", ")", "strCommand", "=", "m_strImageButton", ";", "// Use image name until the image is loaded", "return", "strCommand", ";", "}" ]
Get the best guess for the command name. This is usually used to get the command to perform for a canned button. @return The button command (or the best guess for the command).
[ "Get", "the", "best", "guess", "for", "the", "command", "name", ".", "This", "is", "usually", "used", "to", "get", "the", "command", "to", "perform", "for", "a", "canned", "button", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/SBaseButton.java#L160-L168
153,961
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/IndexConverter.java
IndexConverter.getMaxLength
public int getMaxLength() { // Survey the first few to get the max length (Only called when setting up screen field) String string; int maxLength = 1; for (int index = 0; index < 10; index++) { string = this.getNextConverter().convertIndexToDisStr(index); if (index > 0) if (string.length() == 0) break; // Far Enough if (string.length() > (short)maxLength) maxLength = string.length(); } return maxLength; }
java
public int getMaxLength() { // Survey the first few to get the max length (Only called when setting up screen field) String string; int maxLength = 1; for (int index = 0; index < 10; index++) { string = this.getNextConverter().convertIndexToDisStr(index); if (index > 0) if (string.length() == 0) break; // Far Enough if (string.length() > (short)maxLength) maxLength = string.length(); } return maxLength; }
[ "public", "int", "getMaxLength", "(", ")", "{", "// Survey the first few to get the max length (Only called when setting up screen field)", "String", "string", ";", "int", "maxLength", "=", "1", ";", "for", "(", "int", "index", "=", "0", ";", "index", "<", "10", ";", "index", "++", ")", "{", "string", "=", "this", ".", "getNextConverter", "(", ")", ".", "convertIndexToDisStr", "(", "index", ")", ";", "if", "(", "index", ">", "0", ")", "if", "(", "string", ".", "length", "(", ")", "==", "0", ")", "break", ";", "// Far Enough", "if", "(", "string", ".", "length", "(", ")", ">", "(", "short", ")", "maxLength", ")", "maxLength", "=", "string", ".", "length", "(", ")", ";", "}", "return", "maxLength", ";", "}" ]
Get the maximum length of this field. Survey the first 10 items in the display list and return the longest length. @return The max length.
[ "Get", "the", "maximum", "length", "of", "this", "field", ".", "Survey", "the", "first", "10", "items", "in", "the", "display", "list", "and", "return", "the", "longest", "length", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/IndexConverter.java#L51-L64
153,962
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/IndexConverter.java
IndexConverter.setString
public int setString(String fieldPtr, boolean bDisplayOption, int moveMode) // init this field override for other value { int index = ((NumberField)this.getNextConverter()).convertStringToIndex(fieldPtr); return this.getNextConverter().setValue(index, bDisplayOption, moveMode); }
java
public int setString(String fieldPtr, boolean bDisplayOption, int moveMode) // init this field override for other value { int index = ((NumberField)this.getNextConverter()).convertStringToIndex(fieldPtr); return this.getNextConverter().setValue(index, bDisplayOption, moveMode); }
[ "public", "int", "setString", "(", "String", "fieldPtr", ",", "boolean", "bDisplayOption", ",", "int", "moveMode", ")", "// init this field override for other value", "{", "int", "index", "=", "(", "(", "NumberField", ")", "this", ".", "getNextConverter", "(", ")", ")", ".", "convertStringToIndex", "(", "fieldPtr", ")", ";", "return", "this", ".", "getNextConverter", "(", ")", ".", "setValue", "(", "index", ",", "bDisplayOption", ",", "moveMode", ")", ";", "}" ]
Convert and move string to this field. Convert this string to an index and set the index value. Override this method to convert the String to the actual Physical Data Type. @param strString the state to set the data to. @param bDisplayOption Display the data on the screen if true. @param iMoveMode INIT, SCREEN, or READ move mode. @return The error code (or NORMAL_RETURN).
[ "Convert", "and", "move", "string", "to", "this", "field", ".", "Convert", "this", "string", "to", "an", "index", "and", "set", "the", "index", "value", ".", "Override", "this", "method", "to", "convert", "the", "String", "to", "the", "actual", "Physical", "Data", "Type", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/IndexConverter.java#L83-L87
153,963
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/io/FileData.java
FileData.setFullFileName
public void setFullFileName(String fullFileName) { fullFileName = StringSupport.replaceAll(fullFileName, "\\", "/"); fullFileName = StringSupport.replaceAll(fullFileName, "//", "/"); int lastFileSeparator = fullFileName.lastIndexOf('/'); if (lastFileSeparator != -1) { path = fullFileName.substring(0, lastFileSeparator); } else { path = ""; } setFileName(fullFileName.substring(lastFileSeparator + 1, fullFileName.length())); }
java
public void setFullFileName(String fullFileName) { fullFileName = StringSupport.replaceAll(fullFileName, "\\", "/"); fullFileName = StringSupport.replaceAll(fullFileName, "//", "/"); int lastFileSeparator = fullFileName.lastIndexOf('/'); if (lastFileSeparator != -1) { path = fullFileName.substring(0, lastFileSeparator); } else { path = ""; } setFileName(fullFileName.substring(lastFileSeparator + 1, fullFileName.length())); }
[ "public", "void", "setFullFileName", "(", "String", "fullFileName", ")", "{", "fullFileName", "=", "StringSupport", ".", "replaceAll", "(", "fullFileName", ",", "\"\\\\\"", ",", "\"/\"", ")", ";", "fullFileName", "=", "StringSupport", ".", "replaceAll", "(", "fullFileName", ",", "\"//\"", ",", "\"/\"", ")", ";", "int", "lastFileSeparator", "=", "fullFileName", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "lastFileSeparator", "!=", "-", "1", ")", "{", "path", "=", "fullFileName", ".", "substring", "(", "0", ",", "lastFileSeparator", ")", ";", "}", "else", "{", "path", "=", "\"\"", ";", "}", "setFileName", "(", "fullFileName", ".", "substring", "(", "lastFileSeparator", "+", "1", ",", "fullFileName", ".", "length", "(", ")", ")", ")", ";", "}" ]
Sets the file name including path and extension @param fullFileName
[ "Sets", "the", "file", "name", "including", "path", "and", "extension" ]
971eb022115247b1e34dc26dd02e7e621e29e910
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileData.java#L97-L109
153,964
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/DatabaseException.java
DatabaseException.getMessage
public String getMessage(Task task) { String strError = null; switch (m_iErrorCode) { case DBConstants.NORMAL_RETURN: strError = "Normal return";break; // Never case DBConstants.END_OF_FILE: strError = "End of file";break; case DBConstants.KEY_NOT_FOUND: strError = "Key not found";break; case DBConstants.DUPLICATE_KEY: strError = "Duplicate key";break; case DBConstants.FILE_NOT_OPEN: strError = "File not open";break; case DBConstants.FILE_ALREADY_OPEN: strError = "File already open";break; case DBConstants.FILE_TABLE_FULL: strError = "File table full";break; case DBConstants.FILE_INCONSISTENCY: strError = "File inconsistency";break; case DBConstants.INVALID_RECORD: strError = "Invalid record";break; case DBConstants.FILE_NOT_FOUND: strError = "File not found";break; case DBConstants.INVALID_KEY: strError = "Invalid Key";break; case DBConstants.FILE_ALREADY_EXISTS: strError = "File Already Exists";break; case DBConstants.NULL_FIELD: strError = "Null field";break; case DBConstants.READ_NOT_NEW: strError = "Read not new";break; case DBConstants.NO_ACTIVE_QUERY: strError = "No active query";break; case DBConstants.RECORD_NOT_LOCKED: strError = "Record not locked";break; case DBConstants.RETRY_ERROR: strError = "Retry error";break; case DBConstants.ERROR_READ_ONLY: strError = "Can't update read only file";break; case DBConstants.ERROR_APPEND_ONLY: strError = "Can't update append only file";break; case DBConstants.RECORD_LOCKED: strError = "Record locked";break; case DBConstants.BROKEN_PIPE: strError = "Broken Pipe";break; case DBConstants.DUPLICATE_COUNTER: strError = "Duplicate counter";break; case DBConstants.DB_NOT_FOUND: strError = "Database not found";break; case DBConstants.NEXT_ERROR_CODE: case DBConstants.ERROR_RETURN: case DBConstants.ERROR_STRING: default: strError = super.getMessage(); // See if there is a built-in message if ((strError == null) || (strError.length() == 0) || (strError.startsWith("null"))) if (task != null) { // Unknown error code, see if it was the last error strError = task.getLastError(m_iErrorCode); if ((strError != null) && (strError.length() > 0)) break; // Yes, return the error message } break; } return strError; }
java
public String getMessage(Task task) { String strError = null; switch (m_iErrorCode) { case DBConstants.NORMAL_RETURN: strError = "Normal return";break; // Never case DBConstants.END_OF_FILE: strError = "End of file";break; case DBConstants.KEY_NOT_FOUND: strError = "Key not found";break; case DBConstants.DUPLICATE_KEY: strError = "Duplicate key";break; case DBConstants.FILE_NOT_OPEN: strError = "File not open";break; case DBConstants.FILE_ALREADY_OPEN: strError = "File already open";break; case DBConstants.FILE_TABLE_FULL: strError = "File table full";break; case DBConstants.FILE_INCONSISTENCY: strError = "File inconsistency";break; case DBConstants.INVALID_RECORD: strError = "Invalid record";break; case DBConstants.FILE_NOT_FOUND: strError = "File not found";break; case DBConstants.INVALID_KEY: strError = "Invalid Key";break; case DBConstants.FILE_ALREADY_EXISTS: strError = "File Already Exists";break; case DBConstants.NULL_FIELD: strError = "Null field";break; case DBConstants.READ_NOT_NEW: strError = "Read not new";break; case DBConstants.NO_ACTIVE_QUERY: strError = "No active query";break; case DBConstants.RECORD_NOT_LOCKED: strError = "Record not locked";break; case DBConstants.RETRY_ERROR: strError = "Retry error";break; case DBConstants.ERROR_READ_ONLY: strError = "Can't update read only file";break; case DBConstants.ERROR_APPEND_ONLY: strError = "Can't update append only file";break; case DBConstants.RECORD_LOCKED: strError = "Record locked";break; case DBConstants.BROKEN_PIPE: strError = "Broken Pipe";break; case DBConstants.DUPLICATE_COUNTER: strError = "Duplicate counter";break; case DBConstants.DB_NOT_FOUND: strError = "Database not found";break; case DBConstants.NEXT_ERROR_CODE: case DBConstants.ERROR_RETURN: case DBConstants.ERROR_STRING: default: strError = super.getMessage(); // See if there is a built-in message if ((strError == null) || (strError.length() == 0) || (strError.startsWith("null"))) if (task != null) { // Unknown error code, see if it was the last error strError = task.getLastError(m_iErrorCode); if ((strError != null) && (strError.length() > 0)) break; // Yes, return the error message } break; } return strError; }
[ "public", "String", "getMessage", "(", "Task", "task", ")", "{", "String", "strError", "=", "null", ";", "switch", "(", "m_iErrorCode", ")", "{", "case", "DBConstants", ".", "NORMAL_RETURN", ":", "strError", "=", "\"Normal return\"", ";", "break", ";", "// Never", "case", "DBConstants", ".", "END_OF_FILE", ":", "strError", "=", "\"End of file\"", ";", "break", ";", "case", "DBConstants", ".", "KEY_NOT_FOUND", ":", "strError", "=", "\"Key not found\"", ";", "break", ";", "case", "DBConstants", ".", "DUPLICATE_KEY", ":", "strError", "=", "\"Duplicate key\"", ";", "break", ";", "case", "DBConstants", ".", "FILE_NOT_OPEN", ":", "strError", "=", "\"File not open\"", ";", "break", ";", "case", "DBConstants", ".", "FILE_ALREADY_OPEN", ":", "strError", "=", "\"File already open\"", ";", "break", ";", "case", "DBConstants", ".", "FILE_TABLE_FULL", ":", "strError", "=", "\"File table full\"", ";", "break", ";", "case", "DBConstants", ".", "FILE_INCONSISTENCY", ":", "strError", "=", "\"File inconsistency\"", ";", "break", ";", "case", "DBConstants", ".", "INVALID_RECORD", ":", "strError", "=", "\"Invalid record\"", ";", "break", ";", "case", "DBConstants", ".", "FILE_NOT_FOUND", ":", "strError", "=", "\"File not found\"", ";", "break", ";", "case", "DBConstants", ".", "INVALID_KEY", ":", "strError", "=", "\"Invalid Key\"", ";", "break", ";", "case", "DBConstants", ".", "FILE_ALREADY_EXISTS", ":", "strError", "=", "\"File Already Exists\"", ";", "break", ";", "case", "DBConstants", ".", "NULL_FIELD", ":", "strError", "=", "\"Null field\"", ";", "break", ";", "case", "DBConstants", ".", "READ_NOT_NEW", ":", "strError", "=", "\"Read not new\"", ";", "break", ";", "case", "DBConstants", ".", "NO_ACTIVE_QUERY", ":", "strError", "=", "\"No active query\"", ";", "break", ";", "case", "DBConstants", ".", "RECORD_NOT_LOCKED", ":", "strError", "=", "\"Record not locked\"", ";", "break", ";", "case", "DBConstants", ".", "RETRY_ERROR", ":", "strError", "=", "\"Retry error\"", ";", "break", ";", "case", "DBConstants", ".", "ERROR_READ_ONLY", ":", "strError", "=", "\"Can't update read only file\"", ";", "break", ";", "case", "DBConstants", ".", "ERROR_APPEND_ONLY", ":", "strError", "=", "\"Can't update append only file\"", ";", "break", ";", "case", "DBConstants", ".", "RECORD_LOCKED", ":", "strError", "=", "\"Record locked\"", ";", "break", ";", "case", "DBConstants", ".", "BROKEN_PIPE", ":", "strError", "=", "\"Broken Pipe\"", ";", "break", ";", "case", "DBConstants", ".", "DUPLICATE_COUNTER", ":", "strError", "=", "\"Duplicate counter\"", ";", "break", ";", "case", "DBConstants", ".", "DB_NOT_FOUND", ":", "strError", "=", "\"Database not found\"", ";", "break", ";", "case", "DBConstants", ".", "NEXT_ERROR_CODE", ":", "case", "DBConstants", ".", "ERROR_RETURN", ":", "case", "DBConstants", ".", "ERROR_STRING", ":", "default", ":", "strError", "=", "super", ".", "getMessage", "(", ")", ";", "// See if there is a built-in message", "if", "(", "(", "strError", "==", "null", ")", "||", "(", "strError", ".", "length", "(", ")", "==", "0", ")", "||", "(", "strError", ".", "startsWith", "(", "\"null\"", ")", ")", ")", "if", "(", "task", "!=", "null", ")", "{", "// Unknown error code, see if it was the last error", "strError", "=", "task", ".", "getLastError", "(", "m_iErrorCode", ")", ";", "if", "(", "(", "strError", "!=", "null", ")", "&&", "(", "strError", ".", "length", "(", ")", ">", "0", ")", ")", "break", ";", "// Yes, return the error message", "}", "break", ";", "}", "return", "strError", ";", "}" ]
Return the error message.
[ "Return", "the", "error", "message", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/DatabaseException.java#L122-L188
153,965
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/DatabaseException.java
DatabaseException.toDatabaseException
public static DatabaseException toDatabaseException(Exception ex) { if (ex instanceof DatabaseException) return (DatabaseException)ex; int iErrorCode = DBConstants.ERROR_STRING; if (ex instanceof DBException) iErrorCode = ((DBException)ex).getErrorCode(); String strMessage = ex.getMessage(); if (strMessage != null) if (strMessage.startsWith(DBEXCEPTION_TEXT)) { int iNextPos = strMessage.indexOf(' ', DBEXCEPTION_TEXT.length()); if (iNextPos != -1) { iErrorCode = Integer.parseInt(strMessage.substring(DBEXCEPTION_TEXT.length(), iNextPos)); if (iNextPos + 1 < strMessage.length()) strMessage = strMessage.substring(iNextPos + 1); } } return new DatabaseException(iErrorCode, strMessage); }
java
public static DatabaseException toDatabaseException(Exception ex) { if (ex instanceof DatabaseException) return (DatabaseException)ex; int iErrorCode = DBConstants.ERROR_STRING; if (ex instanceof DBException) iErrorCode = ((DBException)ex).getErrorCode(); String strMessage = ex.getMessage(); if (strMessage != null) if (strMessage.startsWith(DBEXCEPTION_TEXT)) { int iNextPos = strMessage.indexOf(' ', DBEXCEPTION_TEXT.length()); if (iNextPos != -1) { iErrorCode = Integer.parseInt(strMessage.substring(DBEXCEPTION_TEXT.length(), iNextPos)); if (iNextPos + 1 < strMessage.length()) strMessage = strMessage.substring(iNextPos + 1); } } return new DatabaseException(iErrorCode, strMessage); }
[ "public", "static", "DatabaseException", "toDatabaseException", "(", "Exception", "ex", ")", "{", "if", "(", "ex", "instanceof", "DatabaseException", ")", "return", "(", "DatabaseException", ")", "ex", ";", "int", "iErrorCode", "=", "DBConstants", ".", "ERROR_STRING", ";", "if", "(", "ex", "instanceof", "DBException", ")", "iErrorCode", "=", "(", "(", "DBException", ")", "ex", ")", ".", "getErrorCode", "(", ")", ";", "String", "strMessage", "=", "ex", ".", "getMessage", "(", ")", ";", "if", "(", "strMessage", "!=", "null", ")", "if", "(", "strMessage", ".", "startsWith", "(", "DBEXCEPTION_TEXT", ")", ")", "{", "int", "iNextPos", "=", "strMessage", ".", "indexOf", "(", "'", "'", ",", "DBEXCEPTION_TEXT", ".", "length", "(", ")", ")", ";", "if", "(", "iNextPos", "!=", "-", "1", ")", "{", "iErrorCode", "=", "Integer", ".", "parseInt", "(", "strMessage", ".", "substring", "(", "DBEXCEPTION_TEXT", ".", "length", "(", ")", ",", "iNextPos", ")", ")", ";", "if", "(", "iNextPos", "+", "1", "<", "strMessage", ".", "length", "(", ")", ")", "strMessage", "=", "strMessage", ".", "substring", "(", "iNextPos", "+", "1", ")", ";", "}", "}", "return", "new", "DatabaseException", "(", "iErrorCode", ",", "strMessage", ")", ";", "}" ]
Convert a normal Exception to a DBException.
[ "Convert", "a", "normal", "Exception", "to", "a", "DBException", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/DatabaseException.java#L199-L219
153,966
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SubFileIntegrityHandler.java
SubFileIntegrityHandler.getSubRecord
public Record getSubRecord() { if (m_recDependent == null) m_recDependent = this.createSubRecord(); if (m_recDependent != null) { if (m_recDependent.getListener(SubFileFilter.class.getName()) == null) m_recDependent.addListener(new SubFileFilter(this.getOwner())); } return m_recDependent; }
java
public Record getSubRecord() { if (m_recDependent == null) m_recDependent = this.createSubRecord(); if (m_recDependent != null) { if (m_recDependent.getListener(SubFileFilter.class.getName()) == null) m_recDependent.addListener(new SubFileFilter(this.getOwner())); } return m_recDependent; }
[ "public", "Record", "getSubRecord", "(", ")", "{", "if", "(", "m_recDependent", "==", "null", ")", "m_recDependent", "=", "this", ".", "createSubRecord", "(", ")", ";", "if", "(", "m_recDependent", "!=", "null", ")", "{", "if", "(", "m_recDependent", ".", "getListener", "(", "SubFileFilter", ".", "class", ".", "getName", "(", ")", ")", "==", "null", ")", "m_recDependent", ".", "addListener", "(", "new", "SubFileFilter", "(", "this", ".", "getOwner", "(", ")", ")", ")", ";", "}", "return", "m_recDependent", ";", "}" ]
Get the sub-record.
[ "Get", "the", "sub", "-", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SubFileIntegrityHandler.java#L188-L198
153,967
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SubFileIntegrityHandler.java
SubFileIntegrityHandler.createSubRecord
public Record createSubRecord() { Record record = (Record)ClassServiceUtility.getClassService().makeObjectFromClassName(m_strSubFile); if (record != null) { RecordOwner recordOwner = Record.findRecordOwner(this.getOwner()); record.init(recordOwner); if (recordOwner != null) recordOwner.removeRecord(record); this.getOwner().addListener(new FreeOnFreeHandler(record)); } return record; }
java
public Record createSubRecord() { Record record = (Record)ClassServiceUtility.getClassService().makeObjectFromClassName(m_strSubFile); if (record != null) { RecordOwner recordOwner = Record.findRecordOwner(this.getOwner()); record.init(recordOwner); if (recordOwner != null) recordOwner.removeRecord(record); this.getOwner().addListener(new FreeOnFreeHandler(record)); } return record; }
[ "public", "Record", "createSubRecord", "(", ")", "{", "Record", "record", "=", "(", "Record", ")", "ClassServiceUtility", ".", "getClassService", "(", ")", ".", "makeObjectFromClassName", "(", "m_strSubFile", ")", ";", "if", "(", "record", "!=", "null", ")", "{", "RecordOwner", "recordOwner", "=", "Record", ".", "findRecordOwner", "(", "this", ".", "getOwner", "(", ")", ")", ";", "record", ".", "init", "(", "recordOwner", ")", ";", "if", "(", "recordOwner", "!=", "null", ")", "recordOwner", ".", "removeRecord", "(", "record", ")", ";", "this", ".", "getOwner", "(", ")", ".", "addListener", "(", "new", "FreeOnFreeHandler", "(", "record", ")", ")", ";", "}", "return", "record", ";", "}" ]
Create the sub-record. Override this method to create a sub-record.
[ "Create", "the", "sub", "-", "record", ".", "Override", "this", "method", "to", "create", "a", "sub", "-", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SubFileIntegrityHandler.java#L203-L215
153,968
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/structures/TopicErrorDatabase.java
TopicErrorDatabase.addTocError
public void addTocError(final BaseTopicWrapper<?> topic, final ErrorType errorType, final String error) { addItem(topic, error, ErrorLevel.ERROR, errorType); }
java
public void addTocError(final BaseTopicWrapper<?> topic, final ErrorType errorType, final String error) { addItem(topic, error, ErrorLevel.ERROR, errorType); }
[ "public", "void", "addTocError", "(", "final", "BaseTopicWrapper", "<", "?", ">", "topic", ",", "final", "ErrorType", "errorType", ",", "final", "String", "error", ")", "{", "addItem", "(", "topic", ",", "error", ",", "ErrorLevel", ".", "ERROR", ",", "errorType", ")", ";", "}" ]
Add a error for a topic that was included in the TOC @param topic @param error
[ "Add", "a", "error", "for", "a", "topic", "that", "was", "included", "in", "the", "TOC" ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/structures/TopicErrorDatabase.java#L85-L87
153,969
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseMenuScreen.java
BaseMenuScreen.isMainMenu
public boolean isMainMenu() { boolean bIsMainMenu = false; if (m_strMenu != null) { if (this.getTask() != null) if (HtmlConstants.MAIN_MENU_KEY.equalsIgnoreCase(this.getTask().getProperty(DBParams.MENU))) bIsMainMenu = true; if (m_strMenu.equalsIgnoreCase(HtmlConstants.MAIN_MENU_KEY)) bIsMainMenu = true; else if (((this.getProperty(DBParams.HOME) == null) || (this.getProperty(DBParams.HOME).length() == 0)) && (DBConstants.ANON_USER_ID.equals(this.getProperty(DBParams.USER_ID)))) bIsMainMenu = true; } return bIsMainMenu; }
java
public boolean isMainMenu() { boolean bIsMainMenu = false; if (m_strMenu != null) { if (this.getTask() != null) if (HtmlConstants.MAIN_MENU_KEY.equalsIgnoreCase(this.getTask().getProperty(DBParams.MENU))) bIsMainMenu = true; if (m_strMenu.equalsIgnoreCase(HtmlConstants.MAIN_MENU_KEY)) bIsMainMenu = true; else if (((this.getProperty(DBParams.HOME) == null) || (this.getProperty(DBParams.HOME).length() == 0)) && (DBConstants.ANON_USER_ID.equals(this.getProperty(DBParams.USER_ID)))) bIsMainMenu = true; } return bIsMainMenu; }
[ "public", "boolean", "isMainMenu", "(", ")", "{", "boolean", "bIsMainMenu", "=", "false", ";", "if", "(", "m_strMenu", "!=", "null", ")", "{", "if", "(", "this", ".", "getTask", "(", ")", "!=", "null", ")", "if", "(", "HtmlConstants", ".", "MAIN_MENU_KEY", ".", "equalsIgnoreCase", "(", "this", ".", "getTask", "(", ")", ".", "getProperty", "(", "DBParams", ".", "MENU", ")", ")", ")", "bIsMainMenu", "=", "true", ";", "if", "(", "m_strMenu", ".", "equalsIgnoreCase", "(", "HtmlConstants", ".", "MAIN_MENU_KEY", ")", ")", "bIsMainMenu", "=", "true", ";", "else", "if", "(", "(", "(", "this", ".", "getProperty", "(", "DBParams", ".", "HOME", ")", "==", "null", ")", "||", "(", "this", ".", "getProperty", "(", "DBParams", ".", "HOME", ")", ".", "length", "(", ")", "==", "0", ")", ")", "&&", "(", "DBConstants", ".", "ANON_USER_ID", ".", "equals", "(", "this", ".", "getProperty", "(", "DBParams", ".", "USER_ID", ")", ")", ")", ")", "bIsMainMenu", "=", "true", ";", "}", "return", "bIsMainMenu", ";", "}" ]
Is this the user's main menu? @return true if this is the main menu.
[ "Is", "this", "the", "user", "s", "main", "menu?" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseMenuScreen.java#L123-L138
153,970
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseMenuScreen.java
BaseMenuScreen.getMenuLink
public String getMenuLink(Record recMenu) { String strRecordClass = recMenu.getClass().getName(); String strLink = HtmlConstants.SERVLET_LINK; strLink = Utility.addURLParam(strLink, DBParams.RECORD, strRecordClass); strLink = Utility.addURLParam(strLink, DBParams.COMMAND, MenuConstants.FORM); if ((recMenu.getEditMode() == Constants.EDIT_IN_PROGRESS) || (recMenu.getEditMode() == Constants.EDIT_CURRENT)) { try { String strBookmark = recMenu.getHandle(DBConstants.OBJECT_ID_HANDLE).toString(); strLink = Utility.addURLParam(strLink, DBConstants.STRING_OBJECT_ID_HANDLE, strBookmark); } catch (DBException ex) { ex.printStackTrace(); } } return strLink; }
java
public String getMenuLink(Record recMenu) { String strRecordClass = recMenu.getClass().getName(); String strLink = HtmlConstants.SERVLET_LINK; strLink = Utility.addURLParam(strLink, DBParams.RECORD, strRecordClass); strLink = Utility.addURLParam(strLink, DBParams.COMMAND, MenuConstants.FORM); if ((recMenu.getEditMode() == Constants.EDIT_IN_PROGRESS) || (recMenu.getEditMode() == Constants.EDIT_CURRENT)) { try { String strBookmark = recMenu.getHandle(DBConstants.OBJECT_ID_HANDLE).toString(); strLink = Utility.addURLParam(strLink, DBConstants.STRING_OBJECT_ID_HANDLE, strBookmark); } catch (DBException ex) { ex.printStackTrace(); } } return strLink; }
[ "public", "String", "getMenuLink", "(", "Record", "recMenu", ")", "{", "String", "strRecordClass", "=", "recMenu", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "String", "strLink", "=", "HtmlConstants", ".", "SERVLET_LINK", ";", "strLink", "=", "Utility", ".", "addURLParam", "(", "strLink", ",", "DBParams", ".", "RECORD", ",", "strRecordClass", ")", ";", "strLink", "=", "Utility", ".", "addURLParam", "(", "strLink", ",", "DBParams", ".", "COMMAND", ",", "MenuConstants", ".", "FORM", ")", ";", "if", "(", "(", "recMenu", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_IN_PROGRESS", ")", "||", "(", "recMenu", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_CURRENT", ")", ")", "{", "try", "{", "String", "strBookmark", "=", "recMenu", ".", "getHandle", "(", "DBConstants", ".", "OBJECT_ID_HANDLE", ")", ".", "toString", "(", ")", ";", "strLink", "=", "Utility", ".", "addURLParam", "(", "strLink", ",", "DBConstants", ".", "STRING_OBJECT_ID_HANDLE", ",", "strBookmark", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}", "return", "strLink", ";", "}" ]
Get menu link. @param recMenu The menu record. @return The menu link.
[ "Get", "menu", "link", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseMenuScreen.java#L251-L267
153,971
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/message/record/BaseRecordMessageFilter.java
BaseRecordMessageFilter.getRemoteSession
public Object getRemoteSession() { Object remoteSession = super.getRemoteSession(); if (remoteSession == null) if (this.getMessageSource() instanceof Record) { Record record = (Record)this.getMessageSource(); BaseTable table = record.getTable().getCurrentTable(); if (DBParams.CLIENT.equals(table.getSourceType())) remoteSession = (RemoteSession)table.getRemoteTableType(org.jbundle.model.Remote.class); // Only pass the remoteSession if remoteSession is the client part of the remote session! } return remoteSession; }
java
public Object getRemoteSession() { Object remoteSession = super.getRemoteSession(); if (remoteSession == null) if (this.getMessageSource() instanceof Record) { Record record = (Record)this.getMessageSource(); BaseTable table = record.getTable().getCurrentTable(); if (DBParams.CLIENT.equals(table.getSourceType())) remoteSession = (RemoteSession)table.getRemoteTableType(org.jbundle.model.Remote.class); // Only pass the remoteSession if remoteSession is the client part of the remote session! } return remoteSession; }
[ "public", "Object", "getRemoteSession", "(", ")", "{", "Object", "remoteSession", "=", "super", ".", "getRemoteSession", "(", ")", ";", "if", "(", "remoteSession", "==", "null", ")", "if", "(", "this", ".", "getMessageSource", "(", ")", "instanceof", "Record", ")", "{", "Record", "record", "=", "(", "Record", ")", "this", ".", "getMessageSource", "(", ")", ";", "BaseTable", "table", "=", "record", ".", "getTable", "(", ")", ".", "getCurrentTable", "(", ")", ";", "if", "(", "DBParams", ".", "CLIENT", ".", "equals", "(", "table", ".", "getSourceType", "(", ")", ")", ")", "remoteSession", "=", "(", "RemoteSession", ")", "table", ".", "getRemoteTableType", "(", "org", ".", "jbundle", ".", "model", ".", "Remote", ".", "class", ")", ";", "// Only pass the remoteSession if remoteSession is the client part of the remote session!", "}", "return", "remoteSession", ";", "}" ]
Try to figure out the remote session that this filter belongs to. In this case, the remotesession should be the RecordOwner. @return The remote session that belongs to this filter.
[ "Try", "to", "figure", "out", "the", "remote", "session", "that", "this", "filter", "belongs", "to", ".", "In", "this", "case", "the", "remotesession", "should", "be", "the", "RecordOwner", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/BaseRecordMessageFilter.java#L156-L169
153,972
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/message/record/BaseRecordMessageFilter.java
BaseRecordMessageFilter.isSendRemoteMessage
public boolean isSendRemoteMessage(BaseMessage message) { if (message instanceof RecordMessage) // Always { RecordMessageHeader recMessageHeader = (RecordMessageHeader)message.getMessageHeader(); int iChangeType = recMessageHeader.getRecordMessageType(); if (m_iDatabaseType == recMessageHeader.getDatabaseType()) if (DBParams.CLIENT.equals(recMessageHeader.getSourceType())) // Don't send only if Client DB is handling these messages. { if (!(this instanceof GridRecordMessageFilter)) if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) || (iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_DELETE_TYPE)) return false; // The remote version of me handles this message remotely. if (this instanceof GridRecordMessageFilter) if (iChangeType == DBConstants.AFTER_REQUERY_TYPE) return false; // The remote version of me handles this message remotely. } } return super.isSendRemoteMessage(message); }
java
public boolean isSendRemoteMessage(BaseMessage message) { if (message instanceof RecordMessage) // Always { RecordMessageHeader recMessageHeader = (RecordMessageHeader)message.getMessageHeader(); int iChangeType = recMessageHeader.getRecordMessageType(); if (m_iDatabaseType == recMessageHeader.getDatabaseType()) if (DBParams.CLIENT.equals(recMessageHeader.getSourceType())) // Don't send only if Client DB is handling these messages. { if (!(this instanceof GridRecordMessageFilter)) if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) || (iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_DELETE_TYPE)) return false; // The remote version of me handles this message remotely. if (this instanceof GridRecordMessageFilter) if (iChangeType == DBConstants.AFTER_REQUERY_TYPE) return false; // The remote version of me handles this message remotely. } } return super.isSendRemoteMessage(message); }
[ "public", "boolean", "isSendRemoteMessage", "(", "BaseMessage", "message", ")", "{", "if", "(", "message", "instanceof", "RecordMessage", ")", "// Always", "{", "RecordMessageHeader", "recMessageHeader", "=", "(", "RecordMessageHeader", ")", "message", ".", "getMessageHeader", "(", ")", ";", "int", "iChangeType", "=", "recMessageHeader", ".", "getRecordMessageType", "(", ")", ";", "if", "(", "m_iDatabaseType", "==", "recMessageHeader", ".", "getDatabaseType", "(", ")", ")", "if", "(", "DBParams", ".", "CLIENT", ".", "equals", "(", "recMessageHeader", ".", "getSourceType", "(", ")", ")", ")", "// Don't send only if Client DB is handling these messages.", "{", "if", "(", "!", "(", "this", "instanceof", "GridRecordMessageFilter", ")", ")", "if", "(", "(", "iChangeType", "==", "DBConstants", ".", "AFTER_UPDATE_TYPE", ")", "||", "(", "iChangeType", "==", "DBConstants", ".", "AFTER_ADD_TYPE", ")", "||", "(", "iChangeType", "==", "DBConstants", ".", "AFTER_DELETE_TYPE", ")", ")", "return", "false", ";", "// The remote version of me handles this message remotely.", "if", "(", "this", "instanceof", "GridRecordMessageFilter", ")", "if", "(", "iChangeType", "==", "DBConstants", ".", "AFTER_REQUERY_TYPE", ")", "return", "false", ";", "// The remote version of me handles this message remotely.", "}", "}", "return", "super", ".", "isSendRemoteMessage", "(", "message", ")", ";", "}" ]
Do I send this message to the remote server? @return true If I do (default).
[ "Do", "I", "send", "this", "message", "to", "the", "remote", "server?" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/BaseRecordMessageFilter.java#L197-L217
153,973
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/message/record/BaseRecordMessageFilter.java
BaseRecordMessageFilter.isSameFilter
public boolean isSameFilter(BaseMessageFilter filter) { if (filter.getClass().equals(this.getClass())) { if (this.get(DB_NAME) != null) if (this.get(DB_NAME).equals(filter.get(DB_NAME))) if (this.get(TABLE_NAME) != null) if (this.get(TABLE_NAME).equals(filter.get(TABLE_NAME))) { return true; } if (filter.isFilterMatch(this)) ; } return false; }
java
public boolean isSameFilter(BaseMessageFilter filter) { if (filter.getClass().equals(this.getClass())) { if (this.get(DB_NAME) != null) if (this.get(DB_NAME).equals(filter.get(DB_NAME))) if (this.get(TABLE_NAME) != null) if (this.get(TABLE_NAME).equals(filter.get(TABLE_NAME))) { return true; } if (filter.isFilterMatch(this)) ; } return false; }
[ "public", "boolean", "isSameFilter", "(", "BaseMessageFilter", "filter", ")", "{", "if", "(", "filter", ".", "getClass", "(", ")", ".", "equals", "(", "this", ".", "getClass", "(", ")", ")", ")", "{", "if", "(", "this", ".", "get", "(", "DB_NAME", ")", "!=", "null", ")", "if", "(", "this", ".", "get", "(", "DB_NAME", ")", ".", "equals", "(", "filter", ".", "get", "(", "DB_NAME", ")", ")", ")", "if", "(", "this", ".", "get", "(", "TABLE_NAME", ")", "!=", "null", ")", "if", "(", "this", ".", "get", "(", "TABLE_NAME", ")", ".", "equals", "(", "filter", ".", "get", "(", "TABLE_NAME", ")", ")", ")", "{", "return", "true", ";", "}", "if", "(", "filter", ".", "isFilterMatch", "(", "this", ")", ")", ";", "}", "return", "false", ";", "}" ]
Are these filters functionally the same? @return true if they are.
[ "Are", "these", "filters", "functionally", "the", "same?" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/BaseRecordMessageFilter.java#L242-L257
153,974
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java
AnnotationScanner.findAnotatedClasses
public <T> Set<Class<? extends T>> findAnotatedClasses(String scanPath, Class<? extends Annotation> annotationClass, Class<T> ofType) throws IOException { Set<Class<? extends T>> classes = new HashSet<Class<? extends T>>(); if (scanPath.contains(".")) { scanPath = scanPath.replace('.', '/'); } String[] scanPaths = scanPath.split(","); String includeRegExp = buildIncludeRegExp(scanPaths); Set<URL> urls = resolverUrls(scanPaths); Map<String, Set<String>> annotationIndex = scanForAnnotatedClasses(urls); Set<String> classNames = annotationIndex.get(annotationClass.getName()); if (classNames != null) { for (String className : classNames) { addClass(classes, includeRegExp, className, ofType, annotationClass); } } return classes; }
java
public <T> Set<Class<? extends T>> findAnotatedClasses(String scanPath, Class<? extends Annotation> annotationClass, Class<T> ofType) throws IOException { Set<Class<? extends T>> classes = new HashSet<Class<? extends T>>(); if (scanPath.contains(".")) { scanPath = scanPath.replace('.', '/'); } String[] scanPaths = scanPath.split(","); String includeRegExp = buildIncludeRegExp(scanPaths); Set<URL> urls = resolverUrls(scanPaths); Map<String, Set<String>> annotationIndex = scanForAnnotatedClasses(urls); Set<String> classNames = annotationIndex.get(annotationClass.getName()); if (classNames != null) { for (String className : classNames) { addClass(classes, includeRegExp, className, ofType, annotationClass); } } return classes; }
[ "public", "<", "T", ">", "Set", "<", "Class", "<", "?", "extends", "T", ">", ">", "findAnotatedClasses", "(", "String", "scanPath", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ",", "Class", "<", "T", ">", "ofType", ")", "throws", "IOException", "{", "Set", "<", "Class", "<", "?", "extends", "T", ">", ">", "classes", "=", "new", "HashSet", "<", "Class", "<", "?", "extends", "T", ">", ">", "(", ")", ";", "if", "(", "scanPath", ".", "contains", "(", "\".\"", ")", ")", "{", "scanPath", "=", "scanPath", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ";", "}", "String", "[", "]", "scanPaths", "=", "scanPath", ".", "split", "(", "\",\"", ")", ";", "String", "includeRegExp", "=", "buildIncludeRegExp", "(", "scanPaths", ")", ";", "Set", "<", "URL", ">", "urls", "=", "resolverUrls", "(", "scanPaths", ")", ";", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "annotationIndex", "=", "scanForAnnotatedClasses", "(", "urls", ")", ";", "Set", "<", "String", ">", "classNames", "=", "annotationIndex", ".", "get", "(", "annotationClass", ".", "getName", "(", ")", ")", ";", "if", "(", "classNames", "!=", "null", ")", "{", "for", "(", "String", "className", ":", "classNames", ")", "{", "addClass", "(", "classes", ",", "includeRegExp", ",", "className", ",", "ofType", ",", "annotationClass", ")", ";", "}", "}", "return", "classes", ";", "}" ]
Scan classpath for packages matching scanPath for classes annotated with the supplied annotationClass that extends or implements the supplied ofType. @param <T> Type of class to find @param scanPath Comma separated list of packages to scan for classes. @param annotationClass The annotation to find. @param ofType The type the found classes should extend or implement, set to Object if no validation is needed. @return All classes found by scanning the classapth that extends or implements the ofType type. @throws IOException If exception occurred while accessing class path. @throws IllegalStateException if class found does not extends of implement the ofType parameter or the class found could not be loaded.
[ "Scan", "classpath", "for", "packages", "matching", "scanPath", "for", "classes", "annotated", "with", "the", "supplied", "annotationClass", "that", "extends", "or", "implements", "the", "supplied", "ofType", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java#L39-L59
153,975
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java
AnnotationScanner.addClass
@SuppressWarnings("unchecked") private <T> void addClass(Set<Class<? extends T>> classes, String includeRegExp, String className, Class<T> ofType, Class<? extends Annotation> annotationClass) { if (className.matches(includeRegExp)) { try { Class<?> matchingClass = Class.forName(className); matchingClass.asSubclass(ofType); classes.add((Class<T>) matchingClass); } catch (ClassNotFoundException cnfe) { throw new IllegalStateException("Scannotation found a class that does not exist " + className + " !", cnfe); } catch (ClassCastException cce) { throw new IllegalStateException("Class " + className + " is annoted with @"+annotationClass+" but does not extend or implement "+ofType); } } }
java
@SuppressWarnings("unchecked") private <T> void addClass(Set<Class<? extends T>> classes, String includeRegExp, String className, Class<T> ofType, Class<? extends Annotation> annotationClass) { if (className.matches(includeRegExp)) { try { Class<?> matchingClass = Class.forName(className); matchingClass.asSubclass(ofType); classes.add((Class<T>) matchingClass); } catch (ClassNotFoundException cnfe) { throw new IllegalStateException("Scannotation found a class that does not exist " + className + " !", cnfe); } catch (ClassCastException cce) { throw new IllegalStateException("Class " + className + " is annoted with @"+annotationClass+" but does not extend or implement "+ofType); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "<", "T", ">", "void", "addClass", "(", "Set", "<", "Class", "<", "?", "extends", "T", ">", ">", "classes", ",", "String", "includeRegExp", ",", "String", "className", ",", "Class", "<", "T", ">", "ofType", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ")", "{", "if", "(", "className", ".", "matches", "(", "includeRegExp", ")", ")", "{", "try", "{", "Class", "<", "?", ">", "matchingClass", "=", "Class", ".", "forName", "(", "className", ")", ";", "matchingClass", ".", "asSubclass", "(", "ofType", ")", ";", "classes", ".", "add", "(", "(", "Class", "<", "T", ">", ")", "matchingClass", ")", ";", "}", "catch", "(", "ClassNotFoundException", "cnfe", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Scannotation found a class that does not exist \"", "+", "className", "+", "\" !\"", ",", "cnfe", ")", ";", "}", "catch", "(", "ClassCastException", "cce", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Class \"", "+", "className", "+", "\" is annoted with @\"", "+", "annotationClass", "+", "\" but does not extend or implement \"", "+", "ofType", ")", ";", "}", "}", "}" ]
Created and adds the event to the eventsFound set, if its package matches the includeRegExp. @param eventBuilderFactory Event Factory used to create the EventConfig instance with. @param eventsFound Set of events found, to add the newly created EventConfig to. @param includeRegExp Regular expression to test eventClassName with. @param eventClassName Name of the class.
[ "Created", "and", "adds", "the", "event", "to", "the", "eventsFound", "set", "if", "its", "package", "matches", "the", "includeRegExp", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java#L70-L89
153,976
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java
AnnotationScanner.resolverUrls
private Set<URL> resolverUrls(String[] scanPaths) { Set<URL> urls = new HashSet<URL>(); for (String path : scanPaths) { URL[] urlsFromPath = ClasspathUrlFinder.findResourceBases(path.trim()); urls.addAll(Arrays.asList(urlsFromPath)); } return urls; }
java
private Set<URL> resolverUrls(String[] scanPaths) { Set<URL> urls = new HashSet<URL>(); for (String path : scanPaths) { URL[] urlsFromPath = ClasspathUrlFinder.findResourceBases(path.trim()); urls.addAll(Arrays.asList(urlsFromPath)); } return urls; }
[ "private", "Set", "<", "URL", ">", "resolverUrls", "(", "String", "[", "]", "scanPaths", ")", "{", "Set", "<", "URL", ">", "urls", "=", "new", "HashSet", "<", "URL", ">", "(", ")", ";", "for", "(", "String", "path", ":", "scanPaths", ")", "{", "URL", "[", "]", "urlsFromPath", "=", "ClasspathUrlFinder", ".", "findResourceBases", "(", "path", ".", "trim", "(", ")", ")", ";", "urls", ".", "addAll", "(", "Arrays", ".", "asList", "(", "urlsFromPath", ")", ")", ";", "}", "return", "urls", ";", "}" ]
Returns the URLs which has classes from scanPaths. @param scanPaths Comma separated list of package names. @return URLs matching classes in scanPaths.
[ "Returns", "the", "URLs", "which", "has", "classes", "from", "scanPaths", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java#L99-L109
153,977
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java
AnnotationScanner.buildIncludeRegExp
private String buildIncludeRegExp(String[] scanPaths) { String includeRegExp = ""; for (String path : scanPaths) { includeRegExp += path.trim().replace("/", "\\.") + ".*|"; } if (scanPaths.length > 0) { // Remove last | includeRegExp = includeRegExp.substring(0, includeRegExp.length() - 1); } return includeRegExp; }
java
private String buildIncludeRegExp(String[] scanPaths) { String includeRegExp = ""; for (String path : scanPaths) { includeRegExp += path.trim().replace("/", "\\.") + ".*|"; } if (scanPaths.length > 0) { // Remove last | includeRegExp = includeRegExp.substring(0, includeRegExp.length() - 1); } return includeRegExp; }
[ "private", "String", "buildIncludeRegExp", "(", "String", "[", "]", "scanPaths", ")", "{", "String", "includeRegExp", "=", "\"\"", ";", "for", "(", "String", "path", ":", "scanPaths", ")", "{", "includeRegExp", "+=", "path", ".", "trim", "(", ")", ".", "replace", "(", "\"/\"", ",", "\"\\\\.\"", ")", "+", "\".*|\"", ";", "}", "if", "(", "scanPaths", ".", "length", ">", "0", ")", "{", "// Remove last |", "includeRegExp", "=", "includeRegExp", ".", "substring", "(", "0", ",", "includeRegExp", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "includeRegExp", ";", "}" ]
Returns a regular expression of acceptable package names. @param scanPaths Comma separated list of package names. @return a regular expression of acceptable package names.
[ "Returns", "a", "regular", "expression", "of", "acceptable", "package", "names", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java#L117-L127
153,978
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java
AnnotationScanner.scanForAnnotatedClasses
private Map<String, Set<String>> scanForAnnotatedClasses(Set<URL> urls) throws IOException { AnnotationDB db = new AnnotationDB(); db.setScanClassAnnotations(true); db.setScanFieldAnnotations(false); db.setScanMethodAnnotations(false); db.setScanParameterAnnotations(false); db.scanArchives(urls.toArray(new URL[urls.size()])); return db.getAnnotationIndex(); }
java
private Map<String, Set<String>> scanForAnnotatedClasses(Set<URL> urls) throws IOException { AnnotationDB db = new AnnotationDB(); db.setScanClassAnnotations(true); db.setScanFieldAnnotations(false); db.setScanMethodAnnotations(false); db.setScanParameterAnnotations(false); db.scanArchives(urls.toArray(new URL[urls.size()])); return db.getAnnotationIndex(); }
[ "private", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "scanForAnnotatedClasses", "(", "Set", "<", "URL", ">", "urls", ")", "throws", "IOException", "{", "AnnotationDB", "db", "=", "new", "AnnotationDB", "(", ")", ";", "db", ".", "setScanClassAnnotations", "(", "true", ")", ";", "db", ".", "setScanFieldAnnotations", "(", "false", ")", ";", "db", ".", "setScanMethodAnnotations", "(", "false", ")", ";", "db", ".", "setScanParameterAnnotations", "(", "false", ")", ";", "db", ".", "scanArchives", "(", "urls", ".", "toArray", "(", "new", "URL", "[", "urls", ".", "size", "(", ")", "]", ")", ")", ";", "return", "db", ".", "getAnnotationIndex", "(", ")", ";", "}" ]
Scans for classes in URLs. @param urls URLs to scan for annotated classes. @return Map of annotated classes found. @throws IOException If exception occurs.
[ "Scans", "for", "classes", "in", "URLs", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/AnnotationScanner.java#L137-L147
153,979
js-lib-com/commons
src/main/java/js/converter/ConverterRegistry.java
ConverterRegistry.registerConverterInstance
private void registerConverterInstance(Class<?> valueType, Converter converter) { if(converters.put(valueType, converter) == null) { log.debug("Register converter |%s| for value type |%s|.", converter.getClass(), valueType); } else { log.warn("Override converter |%s| for value type |%s|.", converter.getClass(), valueType); } }
java
private void registerConverterInstance(Class<?> valueType, Converter converter) { if(converters.put(valueType, converter) == null) { log.debug("Register converter |%s| for value type |%s|.", converter.getClass(), valueType); } else { log.warn("Override converter |%s| for value type |%s|.", converter.getClass(), valueType); } }
[ "private", "void", "registerConverterInstance", "(", "Class", "<", "?", ">", "valueType", ",", "Converter", "converter", ")", "{", "if", "(", "converters", ".", "put", "(", "valueType", ",", "converter", ")", "==", "null", ")", "{", "log", ".", "debug", "(", "\"Register converter |%s| for value type |%s|.\"", ",", "converter", ".", "getClass", "(", ")", ",", "valueType", ")", ";", "}", "else", "{", "log", ".", "warn", "(", "\"Override converter |%s| for value type |%s|.\"", ",", "converter", ".", "getClass", "(", ")", ",", "valueType", ")", ";", "}", "}" ]
Utility method to bind converter instance to concrete value type. @param valueType concrete value type, @param converter converter instance able to handle value type.
[ "Utility", "method", "to", "bind", "converter", "instance", "to", "concrete", "value", "type", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/ConverterRegistry.java#L382-L390
153,980
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/InitFieldHandler.java
InitFieldHandler.init
public void init(BaseField field, Field sourceField, Object sourceString, boolean bInitIfSourceNull, boolean bOnlyInitIfDestNull) { super.init(field); m_objSource = sourceString; m_fldSource = (BaseField)sourceField; m_bInitIfSourceNull = bInitIfSourceNull; m_bOnlyInitIfDestNull = bOnlyInitIfDestNull; m_bScreenMove = false; m_bInitMove = true; // Only respond to init m_bReadMove = false; }
java
public void init(BaseField field, Field sourceField, Object sourceString, boolean bInitIfSourceNull, boolean bOnlyInitIfDestNull) { super.init(field); m_objSource = sourceString; m_fldSource = (BaseField)sourceField; m_bInitIfSourceNull = bInitIfSourceNull; m_bOnlyInitIfDestNull = bOnlyInitIfDestNull; m_bScreenMove = false; m_bInitMove = true; // Only respond to init m_bReadMove = false; }
[ "public", "void", "init", "(", "BaseField", "field", ",", "Field", "sourceField", ",", "Object", "sourceString", ",", "boolean", "bInitIfSourceNull", ",", "boolean", "bOnlyInitIfDestNull", ")", "{", "super", ".", "init", "(", "field", ")", ";", "m_objSource", "=", "sourceString", ";", "m_fldSource", "=", "(", "BaseField", ")", "sourceField", ";", "m_bInitIfSourceNull", "=", "bInitIfSourceNull", ";", "m_bOnlyInitIfDestNull", "=", "bOnlyInitIfDestNull", ";", "m_bScreenMove", "=", "false", ";", "m_bInitMove", "=", "true", ";", "// Only respond to init", "m_bReadMove", "=", "false", ";", "}" ]
Constructor. Only responds to init moves. @param field The basefield owner of this listener (usually null and set on setOwner()). @param sourceField The source field to initialize the field owner to. @param sourceString The source string to initialize the field owner to.
[ "Constructor", ".", "Only", "responds", "to", "init", "moves", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/InitFieldHandler.java#L95-L106
153,981
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/InitFieldHandler.java
InitFieldHandler.fieldChanged
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { if (m_fldSource != null) { if (((m_bInitIfSourceNull == true) || (!m_fldSource.isNull())) && ((m_bOnlyInitIfDestNull == false) || (m_bOnlyInitIfDestNull == true) && (this.getOwner().isNull()))) { boolean bModified = this.getOwner().isModified(); int iErrorCode = this.getOwner().moveFieldToThis(m_fldSource, bDisplayOption, iMoveMode); this.getOwner().setModified(bModified); return iErrorCode; } else return super.fieldChanged(bDisplayOption, iMoveMode); } else { if (m_objSource instanceof String) return this.getOwner().setString(m_objSource.toString(), bDisplayOption, iMoveMode); else return this.getOwner().setData(m_objSource, bDisplayOption, iMoveMode); } }
java
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { if (m_fldSource != null) { if (((m_bInitIfSourceNull == true) || (!m_fldSource.isNull())) && ((m_bOnlyInitIfDestNull == false) || (m_bOnlyInitIfDestNull == true) && (this.getOwner().isNull()))) { boolean bModified = this.getOwner().isModified(); int iErrorCode = this.getOwner().moveFieldToThis(m_fldSource, bDisplayOption, iMoveMode); this.getOwner().setModified(bModified); return iErrorCode; } else return super.fieldChanged(bDisplayOption, iMoveMode); } else { if (m_objSource instanceof String) return this.getOwner().setString(m_objSource.toString(), bDisplayOption, iMoveMode); else return this.getOwner().setData(m_objSource, bDisplayOption, iMoveMode); } }
[ "public", "int", "fieldChanged", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "if", "(", "m_fldSource", "!=", "null", ")", "{", "if", "(", "(", "(", "m_bInitIfSourceNull", "==", "true", ")", "||", "(", "!", "m_fldSource", ".", "isNull", "(", ")", ")", ")", "&&", "(", "(", "m_bOnlyInitIfDestNull", "==", "false", ")", "||", "(", "m_bOnlyInitIfDestNull", "==", "true", ")", "&&", "(", "this", ".", "getOwner", "(", ")", ".", "isNull", "(", ")", ")", ")", ")", "{", "boolean", "bModified", "=", "this", ".", "getOwner", "(", ")", ".", "isModified", "(", ")", ";", "int", "iErrorCode", "=", "this", ".", "getOwner", "(", ")", ".", "moveFieldToThis", "(", "m_fldSource", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "this", ".", "getOwner", "(", ")", ".", "setModified", "(", "bModified", ")", ";", "return", "iErrorCode", ";", "}", "else", "return", "super", ".", "fieldChanged", "(", "bDisplayOption", ",", "iMoveMode", ")", ";", "}", "else", "{", "if", "(", "m_objSource", "instanceof", "String", ")", "return", "this", ".", "getOwner", "(", ")", ".", "setString", "(", "m_objSource", ".", "toString", "(", ")", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "else", "return", "this", ".", "getOwner", "(", ")", ".", "setData", "(", "m_objSource", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "}", "}" ]
The Field has Changed. Move the source field or string to this listener's owner. @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). Field Changed, init the field.
[ "The", "Field", "has", "Changed", ".", "Move", "the", "source", "field", "or", "string", "to", "this", "listener", "s", "owner", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/InitFieldHandler.java#L157-L180
153,982
jbundle/jbundle
thin/opt/location/src/main/java/org/jbundle/thin/opt/location/NodeData.java
NodeData.init
public void init(BaseApplet baseApplet, RemoteSession remoteSession, String strDescription, String objID, String strRecordName) { m_baseApplet = baseApplet; m_remoteSession = remoteSession; m_strDescription = strDescription; m_objID = objID; m_strRecordName = strRecordName; }
java
public void init(BaseApplet baseApplet, RemoteSession remoteSession, String strDescription, String objID, String strRecordName) { m_baseApplet = baseApplet; m_remoteSession = remoteSession; m_strDescription = strDescription; m_objID = objID; m_strRecordName = strRecordName; }
[ "public", "void", "init", "(", "BaseApplet", "baseApplet", ",", "RemoteSession", "remoteSession", ",", "String", "strDescription", ",", "String", "objID", ",", "String", "strRecordName", ")", "{", "m_baseApplet", "=", "baseApplet", ";", "m_remoteSession", "=", "remoteSession", ";", "m_strDescription", "=", "strDescription", ";", "m_objID", "=", "objID", ";", "m_strRecordName", "=", "strRecordName", ";", "}" ]
Constructs a new instance of SampleData with the passed in arguments.
[ "Constructs", "a", "new", "instance", "of", "SampleData", "with", "the", "passed", "in", "arguments", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/location/src/main/java/org/jbundle/thin/opt/location/NodeData.java#L52-L59
153,983
jbundle/jbundle
thin/opt/location/src/main/java/org/jbundle/thin/opt/location/NodeData.java
NodeData.makeRecord
public FieldList makeRecord() { // Make record from desc name //x FieldList fieldList = new org.jbundle.thin.tour.product.Continent(null); //x m_baseApplet.linkNewRemoteTable(null, fieldList); //x return fieldList; FieldList record = null; try { Map<String,Object> properties = new Hashtable<String,Object>(); properties.put("description", m_strDescription); if (m_objID != null) properties.put("id", m_objID); String strSubRecordName = this.getSubRecordClassName(); if (strSubRecordName != null) properties.put("record", strSubRecordName); m_remoteSession.doRemoteAction("requery", properties); RemoteTable remoteTable = m_remoteSession.getRemoteTable(strSubRecordName); record = remoteTable.makeFieldList(null); // NO! new org.jbundle.thin.base.db.client.RemoteFieldTable(record, remoteTable, m_baseApplet); } catch (Exception ex) { ex.printStackTrace(); } return record; }
java
public FieldList makeRecord() { // Make record from desc name //x FieldList fieldList = new org.jbundle.thin.tour.product.Continent(null); //x m_baseApplet.linkNewRemoteTable(null, fieldList); //x return fieldList; FieldList record = null; try { Map<String,Object> properties = new Hashtable<String,Object>(); properties.put("description", m_strDescription); if (m_objID != null) properties.put("id", m_objID); String strSubRecordName = this.getSubRecordClassName(); if (strSubRecordName != null) properties.put("record", strSubRecordName); m_remoteSession.doRemoteAction("requery", properties); RemoteTable remoteTable = m_remoteSession.getRemoteTable(strSubRecordName); record = remoteTable.makeFieldList(null); // NO! new org.jbundle.thin.base.db.client.RemoteFieldTable(record, remoteTable, m_baseApplet); } catch (Exception ex) { ex.printStackTrace(); } return record; }
[ "public", "FieldList", "makeRecord", "(", ")", "{", "// Make record from desc name", "//x FieldList fieldList = new org.jbundle.thin.tour.product.Continent(null);", "//x m_baseApplet.linkNewRemoteTable(null, fieldList);", "//x return fieldList;", "FieldList", "record", "=", "null", ";", "try", "{", "Map", "<", "String", ",", "Object", ">", "properties", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "properties", ".", "put", "(", "\"description\"", ",", "m_strDescription", ")", ";", "if", "(", "m_objID", "!=", "null", ")", "properties", ".", "put", "(", "\"id\"", ",", "m_objID", ")", ";", "String", "strSubRecordName", "=", "this", ".", "getSubRecordClassName", "(", ")", ";", "if", "(", "strSubRecordName", "!=", "null", ")", "properties", ".", "put", "(", "\"record\"", ",", "strSubRecordName", ")", ";", "m_remoteSession", ".", "doRemoteAction", "(", "\"requery\"", ",", "properties", ")", ";", "RemoteTable", "remoteTable", "=", "m_remoteSession", ".", "getRemoteTable", "(", "strSubRecordName", ")", ";", "record", "=", "remoteTable", ".", "makeFieldList", "(", "null", ")", ";", "// NO!", "new", "org", ".", "jbundle", ".", "thin", ".", "base", ".", "db", ".", "client", ".", "RemoteFieldTable", "(", "record", ",", "remoteTable", ",", "m_baseApplet", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "return", "record", ";", "}" ]
Returns the field list.
[ "Returns", "the", "field", "list", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/location/src/main/java/org/jbundle/thin/opt/location/NodeData.java#L98-L121
153,984
jbundle/jbundle
thin/opt/location/src/main/java/org/jbundle/thin/opt/location/NodeData.java
NodeData.getSubRecordClassName
public String getSubRecordClassName() { for (int i = 0; i < m_rgstrRecordHierarchy.length - 1; i++) { if (m_rgstrRecordHierarchy[i].equalsIgnoreCase(m_strRecordName)) return m_rgstrRecordHierarchy[i+1]; } return null; // No further leafs //m_rgstrRecordHierarchy[0]; }
java
public String getSubRecordClassName() { for (int i = 0; i < m_rgstrRecordHierarchy.length - 1; i++) { if (m_rgstrRecordHierarchy[i].equalsIgnoreCase(m_strRecordName)) return m_rgstrRecordHierarchy[i+1]; } return null; // No further leafs //m_rgstrRecordHierarchy[0]; }
[ "public", "String", "getSubRecordClassName", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_rgstrRecordHierarchy", ".", "length", "-", "1", ";", "i", "++", ")", "{", "if", "(", "m_rgstrRecordHierarchy", "[", "i", "]", ".", "equalsIgnoreCase", "(", "m_strRecordName", ")", ")", "return", "m_rgstrRecordHierarchy", "[", "i", "+", "1", "]", ";", "}", "return", "null", ";", "// No further leafs //m_rgstrRecordHierarchy[0];", "}" ]
Get the next logical sub-record class, given this record's class.
[ "Get", "the", "next", "logical", "sub", "-", "record", "class", "given", "this", "record", "s", "class", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/location/src/main/java/org/jbundle/thin/opt/location/NodeData.java#L144-L152
153,985
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/CopySoundexHandler.java
CopySoundexHandler.soundex
public String soundex(String s) { String sound = "01230120022455012623010202"; // Letters' categories // ABCDEFGHIJKLMNOPQRSTUVWXYZ char code[] = {'0', '0', '0', '0'}; if ((s == null) || (s.length() == 0)) return null; code[0] = Character.toUpperCase(s.charAt(0)); if (!Character.isLetter(code[0])) return null; // Must start with a letter int iSrc = 0; // Start at second char int iDest = 1; char ch; while (iSrc < s.length()) { if (iDest >= 4) break; iSrc++; if (!Character.isLetter(s.charAt(iSrc))) continue; // skip all nonalphabetics ch = sound.charAt(Character.toUpperCase(s.charAt(iSrc))-'A'); // Determine the category if ((ch == '0') || (ch == code[iDest - 1]) ) continue; code[iDest++] = ch; } return new String(code); }
java
public String soundex(String s) { String sound = "01230120022455012623010202"; // Letters' categories // ABCDEFGHIJKLMNOPQRSTUVWXYZ char code[] = {'0', '0', '0', '0'}; if ((s == null) || (s.length() == 0)) return null; code[0] = Character.toUpperCase(s.charAt(0)); if (!Character.isLetter(code[0])) return null; // Must start with a letter int iSrc = 0; // Start at second char int iDest = 1; char ch; while (iSrc < s.length()) { if (iDest >= 4) break; iSrc++; if (!Character.isLetter(s.charAt(iSrc))) continue; // skip all nonalphabetics ch = sound.charAt(Character.toUpperCase(s.charAt(iSrc))-'A'); // Determine the category if ((ch == '0') || (ch == code[iDest - 1]) ) continue; code[iDest++] = ch; } return new String(code); }
[ "public", "String", "soundex", "(", "String", "s", ")", "{", "String", "sound", "=", "\"01230120022455012623010202\"", ";", "// Letters' categories", "// ABCDEFGHIJKLMNOPQRSTUVWXYZ", "char", "code", "[", "]", "=", "{", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", "}", ";", "if", "(", "(", "s", "==", "null", ")", "||", "(", "s", ".", "length", "(", ")", "==", "0", ")", ")", "return", "null", ";", "code", "[", "0", "]", "=", "Character", ".", "toUpperCase", "(", "s", ".", "charAt", "(", "0", ")", ")", ";", "if", "(", "!", "Character", ".", "isLetter", "(", "code", "[", "0", "]", ")", ")", "return", "null", ";", "// Must start with a letter", "int", "iSrc", "=", "0", ";", "// Start at second char", "int", "iDest", "=", "1", ";", "char", "ch", ";", "while", "(", "iSrc", "<", "s", ".", "length", "(", ")", ")", "{", "if", "(", "iDest", ">=", "4", ")", "break", ";", "iSrc", "++", ";", "if", "(", "!", "Character", ".", "isLetter", "(", "s", ".", "charAt", "(", "iSrc", ")", ")", ")", "continue", ";", "// skip all nonalphabetics", "ch", "=", "sound", ".", "charAt", "(", "Character", ".", "toUpperCase", "(", "s", ".", "charAt", "(", "iSrc", ")", ")", "-", "'", "'", ")", ";", "// Determine the category", "if", "(", "(", "ch", "==", "'", "'", ")", "||", "(", "ch", "==", "code", "[", "iDest", "-", "1", "]", ")", ")", "continue", ";", "code", "[", "iDest", "++", "]", "=", "ch", ";", "}", "return", "new", "String", "(", "code", ")", ";", "}" ]
Convert this four character string to a soundex string. @param s Four character string to convert. @retrun The soundex string.
[ "Convert", "this", "four", "character", "string", "to", "a", "soundex", "string", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/CopySoundexHandler.java#L99-L126
153,986
Stratio/stratio-connector-commons
connector-commons/src/main/java/com/stratio/connector/commons/MethodTimer.java
MethodTimer.around
@Around("execution(* *(..)) && @annotation(TimerJ)") public Object around(ProceedingJoinPoint point) throws Throwable { String methodName = MethodSignature.class.cast(point.getSignature()).getMethod().getName(); String methodArgs = point.getArgs().toString(); MetricRegistry metricRegistry = Metrics.getRegistry(); Timer timer; String metricName = "Starting method "+methodName + "at "+System.nanoTime(); synchronized (this) { if(metricRegistry.getTimers().containsKey(methodName)){ timer = metricRegistry.getTimers().get(metricName); } else{ timer = metricRegistry.register(metricName, new Timer()); } } Timer.Context before = timer.time(); Object result = point.proceed(); long timeAfter = before.stop(); logger.debug("Method " + methodName + " with args " + methodArgs + " executed in " + timeAfter + " ns"); return result; }
java
@Around("execution(* *(..)) && @annotation(TimerJ)") public Object around(ProceedingJoinPoint point) throws Throwable { String methodName = MethodSignature.class.cast(point.getSignature()).getMethod().getName(); String methodArgs = point.getArgs().toString(); MetricRegistry metricRegistry = Metrics.getRegistry(); Timer timer; String metricName = "Starting method "+methodName + "at "+System.nanoTime(); synchronized (this) { if(metricRegistry.getTimers().containsKey(methodName)){ timer = metricRegistry.getTimers().get(metricName); } else{ timer = metricRegistry.register(metricName, new Timer()); } } Timer.Context before = timer.time(); Object result = point.proceed(); long timeAfter = before.stop(); logger.debug("Method " + methodName + " with args " + methodArgs + " executed in " + timeAfter + " ns"); return result; }
[ "@", "Around", "(", "\"execution(* *(..)) && @annotation(TimerJ)\"", ")", "public", "Object", "around", "(", "ProceedingJoinPoint", "point", ")", "throws", "Throwable", "{", "String", "methodName", "=", "MethodSignature", ".", "class", ".", "cast", "(", "point", ".", "getSignature", "(", ")", ")", ".", "getMethod", "(", ")", ".", "getName", "(", ")", ";", "String", "methodArgs", "=", "point", ".", "getArgs", "(", ")", ".", "toString", "(", ")", ";", "MetricRegistry", "metricRegistry", "=", "Metrics", ".", "getRegistry", "(", ")", ";", "Timer", "timer", ";", "String", "metricName", "=", "\"Starting method \"", "+", "methodName", "+", "\"at \"", "+", "System", ".", "nanoTime", "(", ")", ";", "synchronized", "(", "this", ")", "{", "if", "(", "metricRegistry", ".", "getTimers", "(", ")", ".", "containsKey", "(", "methodName", ")", ")", "{", "timer", "=", "metricRegistry", ".", "getTimers", "(", ")", ".", "get", "(", "metricName", ")", ";", "}", "else", "{", "timer", "=", "metricRegistry", ".", "register", "(", "metricName", ",", "new", "Timer", "(", ")", ")", ";", "}", "}", "Timer", ".", "Context", "before", "=", "timer", ".", "time", "(", ")", ";", "Object", "result", "=", "point", ".", "proceed", "(", ")", ";", "long", "timeAfter", "=", "before", ".", "stop", "(", ")", ";", "logger", ".", "debug", "(", "\"Method \"", "+", "methodName", "+", "\" with args \"", "+", "methodArgs", "+", "\" executed in \"", "+", "timeAfter", "+", "\" ns\"", ")", ";", "return", "result", ";", "}" ]
Function that register metrics. @param point @return @throws Throwable
[ "Function", "that", "register", "metrics", "." ]
d7cc66cb9591344a13055962e87a91f01c3707d1
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/MethodTimer.java#L31-L54
153,987
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.getContentSpecID
public static Integer getContentSpecID(final String contentSpecString) { final Matcher matcher = CS_ID_PATTERN.matcher(contentSpecString); if (matcher.find()) { return Integer.parseInt(matcher.group("ID")); } return null; }
java
public static Integer getContentSpecID(final String contentSpecString) { final Matcher matcher = CS_ID_PATTERN.matcher(contentSpecString); if (matcher.find()) { return Integer.parseInt(matcher.group("ID")); } return null; }
[ "public", "static", "Integer", "getContentSpecID", "(", "final", "String", "contentSpecString", ")", "{", "final", "Matcher", "matcher", "=", "CS_ID_PATTERN", ".", "matcher", "(", "contentSpecString", ")", ";", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "return", "Integer", ".", "parseInt", "(", "matcher", ".", "group", "(", "\"ID\"", ")", ")", ";", "}", "return", "null", ";", "}" ]
Get the ID of a Content Specification object. @param contentSpecString The content spec string to calculate the checksum for. @return The ID of the Content Spec, or null if it isn't set.
[ "Get", "the", "ID", "of", "a", "Content", "Specification", "object", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L108-L115
153,988
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.replaceChecksum
public static String replaceChecksum(final String contentSpecString, final String checksum) { Matcher matcher = CS_CHECKSUM_PATTERN.matcher(contentSpecString); if (matcher.find()) { return matcher.replaceFirst("CHECKSUM=" + checksum + "\n"); } return contentSpecString; }
java
public static String replaceChecksum(final String contentSpecString, final String checksum) { Matcher matcher = CS_CHECKSUM_PATTERN.matcher(contentSpecString); if (matcher.find()) { return matcher.replaceFirst("CHECKSUM=" + checksum + "\n"); } return contentSpecString; }
[ "public", "static", "String", "replaceChecksum", "(", "final", "String", "contentSpecString", ",", "final", "String", "checksum", ")", "{", "Matcher", "matcher", "=", "CS_CHECKSUM_PATTERN", ".", "matcher", "(", "contentSpecString", ")", ";", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "return", "matcher", ".", "replaceFirst", "(", "\"CHECKSUM=\"", "+", "checksum", "+", "\"\\n\"", ")", ";", "}", "return", "contentSpecString", ";", "}" ]
Replaces the checksum of a Content Spec with a new checksum value @param contentSpecString The content spec to replace the checksum for. @param checksum The new checksum to be set in the Content Spec. @return The fixed content spec string.
[ "Replaces", "the", "checksum", "of", "a", "Content", "Spec", "with", "a", "new", "checksum", "value" ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L151-L158
153,989
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.getAllNodes
public static List<CSNodeWrapper> getAllNodes(final ContentSpecWrapper contentSpec) { final List<CSNodeWrapper> nodes = new LinkedList<CSNodeWrapper>(); if (contentSpec.getChildren() != null) { final List<CSNodeWrapper> childrenNodes = contentSpec.getChildren().getItems(); for (final CSNodeWrapper childNode : childrenNodes) { nodes.add(childNode); nodes.addAll(getAllChildrenNodes(childNode)); } } return nodes; }
java
public static List<CSNodeWrapper> getAllNodes(final ContentSpecWrapper contentSpec) { final List<CSNodeWrapper> nodes = new LinkedList<CSNodeWrapper>(); if (contentSpec.getChildren() != null) { final List<CSNodeWrapper> childrenNodes = contentSpec.getChildren().getItems(); for (final CSNodeWrapper childNode : childrenNodes) { nodes.add(childNode); nodes.addAll(getAllChildrenNodes(childNode)); } } return nodes; }
[ "public", "static", "List", "<", "CSNodeWrapper", ">", "getAllNodes", "(", "final", "ContentSpecWrapper", "contentSpec", ")", "{", "final", "List", "<", "CSNodeWrapper", ">", "nodes", "=", "new", "LinkedList", "<", "CSNodeWrapper", ">", "(", ")", ";", "if", "(", "contentSpec", ".", "getChildren", "(", ")", "!=", "null", ")", "{", "final", "List", "<", "CSNodeWrapper", ">", "childrenNodes", "=", "contentSpec", ".", "getChildren", "(", ")", ".", "getItems", "(", ")", ";", "for", "(", "final", "CSNodeWrapper", "childNode", ":", "childrenNodes", ")", "{", "nodes", ".", "add", "(", "childNode", ")", ";", "nodes", ".", "addAll", "(", "getAllChildrenNodes", "(", "childNode", ")", ")", ";", "}", "}", "return", "nodes", ";", "}" ]
Recursively find all of a Content Specs child nodes. @param contentSpec The content spec to get all the children nodes from. @return A list of children nodes that exist for the content spec.
[ "Recursively", "find", "all", "of", "a", "Content", "Specs", "child", "nodes", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L285-L296
153,990
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.getAllChildrenNodes
public static List<CSNodeWrapper> getAllChildrenNodes(final CSNodeWrapper csNode) { final List<CSNodeWrapper> nodes = new LinkedList<CSNodeWrapper>(); if (csNode.getChildren() != null) { final List<CSNodeWrapper> childrenNodes = csNode.getChildren().getItems(); for (final CSNodeWrapper childNode : childrenNodes) { nodes.add(childNode); nodes.addAll(getAllChildrenNodes(childNode)); } } return nodes; }
java
public static List<CSNodeWrapper> getAllChildrenNodes(final CSNodeWrapper csNode) { final List<CSNodeWrapper> nodes = new LinkedList<CSNodeWrapper>(); if (csNode.getChildren() != null) { final List<CSNodeWrapper> childrenNodes = csNode.getChildren().getItems(); for (final CSNodeWrapper childNode : childrenNodes) { nodes.add(childNode); nodes.addAll(getAllChildrenNodes(childNode)); } } return nodes; }
[ "public", "static", "List", "<", "CSNodeWrapper", ">", "getAllChildrenNodes", "(", "final", "CSNodeWrapper", "csNode", ")", "{", "final", "List", "<", "CSNodeWrapper", ">", "nodes", "=", "new", "LinkedList", "<", "CSNodeWrapper", ">", "(", ")", ";", "if", "(", "csNode", ".", "getChildren", "(", ")", "!=", "null", ")", "{", "final", "List", "<", "CSNodeWrapper", ">", "childrenNodes", "=", "csNode", ".", "getChildren", "(", ")", ".", "getItems", "(", ")", ";", "for", "(", "final", "CSNodeWrapper", "childNode", ":", "childrenNodes", ")", "{", "nodes", ".", "add", "(", "childNode", ")", ";", "nodes", ".", "addAll", "(", "getAllChildrenNodes", "(", "childNode", ")", ")", ";", "}", "}", "return", "nodes", ";", "}" ]
Recursively find all of a Content Spec Nodes children. @param csNode The node to get all the children nodes from. @return A list of children nodes that exist for the node.
[ "Recursively", "find", "all", "of", "a", "Content", "Spec", "Nodes", "children", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L304-L315
153,991
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.isSpecTopicMetaData
public static boolean isSpecTopicMetaData(final String key) { return key.equalsIgnoreCase(CommonConstants.CS_LEGAL_NOTICE_TITLE) || key.equalsIgnoreCase( CommonConstants.CS_REV_HISTORY_TITLE) || key.equalsIgnoreCase(CommonConstants.CS_FEEDBACK_TITLE) || key.equalsIgnoreCase( CommonConstants.CS_AUTHOR_GROUP_TITLE) || key.equalsIgnoreCase(CommonConstants.CS_ABSTRACT_TITLE) || key.equalsIgnoreCase( CommonConstants.CS_ABSTRACT_ALTERNATE_TITLE); }
java
public static boolean isSpecTopicMetaData(final String key) { return key.equalsIgnoreCase(CommonConstants.CS_LEGAL_NOTICE_TITLE) || key.equalsIgnoreCase( CommonConstants.CS_REV_HISTORY_TITLE) || key.equalsIgnoreCase(CommonConstants.CS_FEEDBACK_TITLE) || key.equalsIgnoreCase( CommonConstants.CS_AUTHOR_GROUP_TITLE) || key.equalsIgnoreCase(CommonConstants.CS_ABSTRACT_TITLE) || key.equalsIgnoreCase( CommonConstants.CS_ABSTRACT_ALTERNATE_TITLE); }
[ "public", "static", "boolean", "isSpecTopicMetaData", "(", "final", "String", "key", ")", "{", "return", "key", ".", "equalsIgnoreCase", "(", "CommonConstants", ".", "CS_LEGAL_NOTICE_TITLE", ")", "||", "key", ".", "equalsIgnoreCase", "(", "CommonConstants", ".", "CS_REV_HISTORY_TITLE", ")", "||", "key", ".", "equalsIgnoreCase", "(", "CommonConstants", ".", "CS_FEEDBACK_TITLE", ")", "||", "key", ".", "equalsIgnoreCase", "(", "CommonConstants", ".", "CS_AUTHOR_GROUP_TITLE", ")", "||", "key", ".", "equalsIgnoreCase", "(", "CommonConstants", ".", "CS_ABSTRACT_TITLE", ")", "||", "key", ".", "equalsIgnoreCase", "(", "CommonConstants", ".", "CS_ABSTRACT_ALTERNATE_TITLE", ")", ";", "}" ]
Check to see if a Meta Data line is a Spec Topic Meta Data, based on the key value. @param key The Meta Data key. @return True if the Meta Data is a Spec Topic Meta Data, otherwise false.
[ "Check", "to", "see", "if", "a", "Meta", "Data", "line", "is", "a", "Spec", "Topic", "Meta", "Data", "based", "on", "the", "key", "value", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L410-L415
153,992
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.escapeTitle
public static String escapeTitle(final String title) { if (title == null) { return null; } else { return title.replace("[", "\\[").replace("]", "\\]"); } }
java
public static String escapeTitle(final String title) { if (title == null) { return null; } else { return title.replace("[", "\\[").replace("]", "\\]"); } }
[ "public", "static", "String", "escapeTitle", "(", "final", "String", "title", ")", "{", "if", "(", "title", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "title", ".", "replace", "(", "\"[\"", ",", "\"\\\\[\"", ")", ".", "replace", "(", "\"]\"", ",", "\"\\\\]\"", ")", ";", "}", "}" ]
Escapes a title so that it can be used in a Content Specification. @param title @return
[ "Escapes", "a", "title", "so", "that", "it", "can", "be", "used", "in", "a", "Content", "Specification", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L441-L447
153,993
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.getContentSpecEntities
public static List<Entity> getContentSpecEntities(final ContentSpec contentSpec) { final DocBookVersion docBookVersion = getDocBookVersion(contentSpec); final String escapedTitle = DocBookUtilities.escapeTitle(contentSpec.getTitle()); final String entitiesString = ContentSpecUtilities.generateEntitiesForContentSpec(contentSpec, docBookVersion, escapedTitle, contentSpec.getTitle(), contentSpec.getProduct()); return XMLUtilities.parseEntitiesFromString(entitiesString); }
java
public static List<Entity> getContentSpecEntities(final ContentSpec contentSpec) { final DocBookVersion docBookVersion = getDocBookVersion(contentSpec); final String escapedTitle = DocBookUtilities.escapeTitle(contentSpec.getTitle()); final String entitiesString = ContentSpecUtilities.generateEntitiesForContentSpec(contentSpec, docBookVersion, escapedTitle, contentSpec.getTitle(), contentSpec.getProduct()); return XMLUtilities.parseEntitiesFromString(entitiesString); }
[ "public", "static", "List", "<", "Entity", ">", "getContentSpecEntities", "(", "final", "ContentSpec", "contentSpec", ")", "{", "final", "DocBookVersion", "docBookVersion", "=", "getDocBookVersion", "(", "contentSpec", ")", ";", "final", "String", "escapedTitle", "=", "DocBookUtilities", ".", "escapeTitle", "(", "contentSpec", ".", "getTitle", "(", ")", ")", ";", "final", "String", "entitiesString", "=", "ContentSpecUtilities", ".", "generateEntitiesForContentSpec", "(", "contentSpec", ",", "docBookVersion", ",", "escapedTitle", ",", "contentSpec", ".", "getTitle", "(", ")", ",", "contentSpec", ".", "getProduct", "(", ")", ")", ";", "return", "XMLUtilities", ".", "parseEntitiesFromString", "(", "entitiesString", ")", ";", "}" ]
Gets the entities that are allowed to be used in a Content Specification. @param contentSpec The content spec object to get the entities from. @return A {@link List} of {@link org.w3c.dom.Entity} objects created from the content spec entities.
[ "Gets", "the", "entities", "that", "are", "allowed", "to", "be", "used", "in", "a", "Content", "Specification", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L606-L612
153,994
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.getLevelPrefix
public static String getLevelPrefix(final Level level) { // Get the pre link string switch (level.getLevelType()) { case APPENDIX: return "appe-"; case SECTION: return "sect-"; case PROCESS: return "proc-"; case CHAPTER: return "chap-"; case PART: return "part-"; case PREFACE: return "pref-"; default: return ""; } }
java
public static String getLevelPrefix(final Level level) { // Get the pre link string switch (level.getLevelType()) { case APPENDIX: return "appe-"; case SECTION: return "sect-"; case PROCESS: return "proc-"; case CHAPTER: return "chap-"; case PART: return "part-"; case PREFACE: return "pref-"; default: return ""; } }
[ "public", "static", "String", "getLevelPrefix", "(", "final", "Level", "level", ")", "{", "// Get the pre link string", "switch", "(", "level", ".", "getLevelType", "(", ")", ")", "{", "case", "APPENDIX", ":", "return", "\"appe-\"", ";", "case", "SECTION", ":", "return", "\"sect-\"", ";", "case", "PROCESS", ":", "return", "\"proc-\"", ";", "case", "CHAPTER", ":", "return", "\"chap-\"", ";", "case", "PART", ":", "return", "\"part-\"", ";", "case", "PREFACE", ":", "return", "\"pref-\"", ";", "default", ":", "return", "\"\"", ";", "}", "}" ]
Get the prefix to use for level container fixed urls. @param level The level to get the prefix for. @return The levels prefix to be used in a fixed url.
[ "Get", "the", "prefix", "to", "use", "for", "level", "container", "fixed", "urls", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L620-L638
153,995
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.getFixedURLs
public static Set<String> getFixedURLs(final ContentSpec contentSpec) { final Set<String> fixedUrls = new HashSet<String>(); for (final Node childNode : contentSpec.getNodes()) { if (childNode instanceof SpecNode) { final SpecNode specNode = ((SpecNode) childNode); if (!isNullOrEmpty(specNode.getFixedUrl())) { fixedUrls.add(specNode.getFixedUrl()); } } if (childNode instanceof Level) { fixedUrls.addAll(getFixedURLs((Level) childNode)); } } fixedUrls.addAll(getFixedURLs(contentSpec.getBaseLevel())); return fixedUrls; }
java
public static Set<String> getFixedURLs(final ContentSpec contentSpec) { final Set<String> fixedUrls = new HashSet<String>(); for (final Node childNode : contentSpec.getNodes()) { if (childNode instanceof SpecNode) { final SpecNode specNode = ((SpecNode) childNode); if (!isNullOrEmpty(specNode.getFixedUrl())) { fixedUrls.add(specNode.getFixedUrl()); } } if (childNode instanceof Level) { fixedUrls.addAll(getFixedURLs((Level) childNode)); } } fixedUrls.addAll(getFixedURLs(contentSpec.getBaseLevel())); return fixedUrls; }
[ "public", "static", "Set", "<", "String", ">", "getFixedURLs", "(", "final", "ContentSpec", "contentSpec", ")", "{", "final", "Set", "<", "String", ">", "fixedUrls", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "final", "Node", "childNode", ":", "contentSpec", ".", "getNodes", "(", ")", ")", "{", "if", "(", "childNode", "instanceof", "SpecNode", ")", "{", "final", "SpecNode", "specNode", "=", "(", "(", "SpecNode", ")", "childNode", ")", ";", "if", "(", "!", "isNullOrEmpty", "(", "specNode", ".", "getFixedUrl", "(", ")", ")", ")", "{", "fixedUrls", ".", "add", "(", "specNode", ".", "getFixedUrl", "(", ")", ")", ";", "}", "}", "if", "(", "childNode", "instanceof", "Level", ")", "{", "fixedUrls", ".", "addAll", "(", "getFixedURLs", "(", "(", "Level", ")", "childNode", ")", ")", ";", "}", "}", "fixedUrls", ".", "addAll", "(", "getFixedURLs", "(", "contentSpec", ".", "getBaseLevel", "(", ")", ")", ")", ";", "return", "fixedUrls", ";", "}" ]
Gets all the fixed urls from a content specification @param contentSpec A content spec to get the fixed urls for @return A set of fixed urls used in the content spec.
[ "Gets", "all", "the", "fixed", "urls", "from", "a", "content", "specification" ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L646-L665
153,996
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.getFixedURLs
public static Set<String> getFixedURLs(final Level level) { final Set<String> fixedUrls = new HashSet<String>(); for (final Node childNode : level.getChildNodes()) { if (childNode instanceof SpecNode) { final SpecNode specNode = ((SpecNode) childNode); if (!isNullOrEmpty(specNode.getFixedUrl())) { fixedUrls.add(specNode.getFixedUrl()); } } if (childNode instanceof Level) { fixedUrls.addAll(getFixedURLs((Level) childNode)); } } return fixedUrls; }
java
public static Set<String> getFixedURLs(final Level level) { final Set<String> fixedUrls = new HashSet<String>(); for (final Node childNode : level.getChildNodes()) { if (childNode instanceof SpecNode) { final SpecNode specNode = ((SpecNode) childNode); if (!isNullOrEmpty(specNode.getFixedUrl())) { fixedUrls.add(specNode.getFixedUrl()); } } if (childNode instanceof Level) { fixedUrls.addAll(getFixedURLs((Level) childNode)); } } return fixedUrls; }
[ "public", "static", "Set", "<", "String", ">", "getFixedURLs", "(", "final", "Level", "level", ")", "{", "final", "Set", "<", "String", ">", "fixedUrls", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "final", "Node", "childNode", ":", "level", ".", "getChildNodes", "(", ")", ")", "{", "if", "(", "childNode", "instanceof", "SpecNode", ")", "{", "final", "SpecNode", "specNode", "=", "(", "(", "SpecNode", ")", "childNode", ")", ";", "if", "(", "!", "isNullOrEmpty", "(", "specNode", ".", "getFixedUrl", "(", ")", ")", ")", "{", "fixedUrls", ".", "add", "(", "specNode", ".", "getFixedUrl", "(", ")", ")", ";", "}", "}", "if", "(", "childNode", "instanceof", "Level", ")", "{", "fixedUrls", ".", "addAll", "(", "getFixedURLs", "(", "(", "Level", ")", "childNode", ")", ")", ";", "}", "}", "return", "fixedUrls", ";", "}" ]
Gets all the fixed urls from a content specification level. @param level A level to get the fixed urls for @return A set of fixed urls used in the level.
[ "Gets", "all", "the", "fixed", "urls", "from", "a", "content", "specification", "level", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L673-L690
153,997
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.getTopicTitleWithConditions
public static String getTopicTitleWithConditions(final ITopicNode specTopic, final BaseTopicWrapper<?> topic) { final String condition = specTopic.getConditionStatement(true); if (condition != null && topic.getTitle() != null && topic.getTitle().contains("condition")) { try { final Document doc = XMLUtilities.convertStringToDocument("<title>" + topic.getTitle() + "</title>"); // Process the condition on the title DocBookUtilities.processConditions(condition, doc); // Return the processed title return XMLUtilities.convertNodeToString(doc, false); } catch (Exception e) { log.debug(e.getMessage()); } return topic.getTitle(); } else { return topic.getTitle(); } }
java
public static String getTopicTitleWithConditions(final ITopicNode specTopic, final BaseTopicWrapper<?> topic) { final String condition = specTopic.getConditionStatement(true); if (condition != null && topic.getTitle() != null && topic.getTitle().contains("condition")) { try { final Document doc = XMLUtilities.convertStringToDocument("<title>" + topic.getTitle() + "</title>"); // Process the condition on the title DocBookUtilities.processConditions(condition, doc); // Return the processed title return XMLUtilities.convertNodeToString(doc, false); } catch (Exception e) { log.debug(e.getMessage()); } return topic.getTitle(); } else { return topic.getTitle(); } }
[ "public", "static", "String", "getTopicTitleWithConditions", "(", "final", "ITopicNode", "specTopic", ",", "final", "BaseTopicWrapper", "<", "?", ">", "topic", ")", "{", "final", "String", "condition", "=", "specTopic", ".", "getConditionStatement", "(", "true", ")", ";", "if", "(", "condition", "!=", "null", "&&", "topic", ".", "getTitle", "(", ")", "!=", "null", "&&", "topic", ".", "getTitle", "(", ")", ".", "contains", "(", "\"condition\"", ")", ")", "{", "try", "{", "final", "Document", "doc", "=", "XMLUtilities", ".", "convertStringToDocument", "(", "\"<title>\"", "+", "topic", ".", "getTitle", "(", ")", "+", "\"</title>\"", ")", ";", "// Process the condition on the title", "DocBookUtilities", ".", "processConditions", "(", "condition", ",", "doc", ")", ";", "// Return the processed title", "return", "XMLUtilities", ".", "convertNodeToString", "(", "doc", ",", "false", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "debug", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "topic", ".", "getTitle", "(", ")", ";", "}", "else", "{", "return", "topic", ".", "getTitle", "(", ")", ";", "}", "}" ]
Gets a Topics title with conditional statements applied @param specTopic The TopicNode of the topic to get the title for. @param topic The actual topic to get the non-processed title from. @return The processed title that has the conditions applied.
[ "Gets", "a", "Topics", "title", "with", "conditional", "statements", "applied" ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L699-L718
153,998
OwlPlatform/java-owl-worldmodel
src/main/java/com/owlplatform/worldmodel/solver/SolverWorldConnection.java
SolverWorldConnection.updateAttribute
public boolean updateAttribute(Attribute attribute) throws IllegalStateException { if (this.terminated) { throw new IllegalStateException( "Cannot send solutions to the World Model once the connection has been destroyed."); } if (this.canSend) { return this.wmi.updateAttribute(attribute); } return this.attributeBuffer.offer(attribute); }
java
public boolean updateAttribute(Attribute attribute) throws IllegalStateException { if (this.terminated) { throw new IllegalStateException( "Cannot send solutions to the World Model once the connection has been destroyed."); } if (this.canSend) { return this.wmi.updateAttribute(attribute); } return this.attributeBuffer.offer(attribute); }
[ "public", "boolean", "updateAttribute", "(", "Attribute", "attribute", ")", "throws", "IllegalStateException", "{", "if", "(", "this", ".", "terminated", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot send solutions to the World Model once the connection has been destroyed.\"", ")", ";", "}", "if", "(", "this", ".", "canSend", ")", "{", "return", "this", ".", "wmi", ".", "updateAttribute", "(", "attribute", ")", ";", "}", "return", "this", ".", "attributeBuffer", ".", "offer", "(", "attribute", ")", ";", "}" ]
Sends a single attribute value update to the world model, or buffers it to be sent later if the World Model is not connected. @param attribute the Attribute value to send. @return {@code true} if the solution was sent immediately or buffered, and {@code false} if it was unable to be sent or buffered. @throws IllegalStateException if this method is called once the world model connection has been destroyed.
[ "Sends", "a", "single", "attribute", "value", "update", "to", "the", "world", "model", "or", "buffers", "it", "to", "be", "sent", "later", "if", "the", "World", "Model", "is", "not", "connected", "." ]
a850e8b930c6e9787c7cad30c0de887858ca563d
https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/solver/SolverWorldConnection.java#L250-L261
153,999
OwlPlatform/java-owl-worldmodel
src/main/java/com/owlplatform/worldmodel/solver/SolverWorldConnection.java
SolverWorldConnection.updateAttributes
public boolean updateAttributes(Collection<Attribute> attributes) throws IllegalStateException { if (this.terminated) { throw new IllegalStateException( "Cannot send solutions to the World Model once the connection has been destroyed."); } if (this.canSend) { return this.wmi.updateAttributes(attributes); } for (Attribute a : attributes) { if (!this.attributeBuffer.offer(a)) { return false; } } return true; }
java
public boolean updateAttributes(Collection<Attribute> attributes) throws IllegalStateException { if (this.terminated) { throw new IllegalStateException( "Cannot send solutions to the World Model once the connection has been destroyed."); } if (this.canSend) { return this.wmi.updateAttributes(attributes); } for (Attribute a : attributes) { if (!this.attributeBuffer.offer(a)) { return false; } } return true; }
[ "public", "boolean", "updateAttributes", "(", "Collection", "<", "Attribute", ">", "attributes", ")", "throws", "IllegalStateException", "{", "if", "(", "this", ".", "terminated", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot send solutions to the World Model once the connection has been destroyed.\"", ")", ";", "}", "if", "(", "this", ".", "canSend", ")", "{", "return", "this", ".", "wmi", ".", "updateAttributes", "(", "attributes", ")", ";", "}", "for", "(", "Attribute", "a", ":", "attributes", ")", "{", "if", "(", "!", "this", ".", "attributeBuffer", ".", "offer", "(", "a", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Sends a collection of updated Attribute values to the world model, or buffers them to be sent later if the World Model is not connected. @param attributes the Attribute values to send. @return {@code true} if the solutions were able to be sent immediately, and {@code false} if one or more were unable to be sent or were buffered for later transmission. @throws IllegalStateException if this method is called once the world model connection has been destroyed.
[ "Sends", "a", "collection", "of", "updated", "Attribute", "values", "to", "the", "world", "model", "or", "buffers", "them", "to", "be", "sent", "later", "if", "the", "World", "Model", "is", "not", "connected", "." ]
a850e8b930c6e9787c7cad30c0de887858ca563d
https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/solver/SolverWorldConnection.java#L276-L293