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
152,900
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.setFieldValue
public static void setFieldValue(Object object, Class<?> clazz, String fieldName, Object value) { Field field = getField(clazz, fieldName); if(object == null ^ Modifier.isStatic(field.getModifiers())) { throw new BugError("Cannot access static field |%s| from instance |%s|.", fieldName, clazz); } setFieldValue(object, field, value); }
java
public static void setFieldValue(Object object, Class<?> clazz, String fieldName, Object value) { Field field = getField(clazz, fieldName); if(object == null ^ Modifier.isStatic(field.getModifiers())) { throw new BugError("Cannot access static field |%s| from instance |%s|.", fieldName, clazz); } setFieldValue(object, field, value); }
[ "public", "static", "void", "setFieldValue", "(", "Object", "object", ",", "Class", "<", "?", ">", "clazz", ",", "String", "fieldName", ",", "Object", "value", ")", "{", "Field", "field", "=", "getField", "(", "clazz", ",", "fieldName", ")", ";", "if", "(", "object", "==", "null", "^", "Modifier", ".", "isStatic", "(", "field", ".", "getModifiers", "(", ")", ")", ")", "{", "throw", "new", "BugError", "(", "\"Cannot access static field |%s| from instance |%s|.\"", ",", "fieldName", ",", "clazz", ")", ";", "}", "setFieldValue", "(", "object", ",", "field", ",", "value", ")", ";", "}" ]
Set instance field declared into superclass. Try to set field value throwing exception if field is not declared into superclass; if field is static object instance should be null. @param object instance to set field value to or null if field is static, @param clazz instance superclass where field is declared, @param fieldName field name, @param value field value. @throws NoSuchBeingException if field not found. @throws BugError if object is null and field is not static or if object is not null and field is static.
[ "Set", "instance", "field", "declared", "into", "superclass", ".", "Try", "to", "set", "field", "value", "throwing", "exception", "if", "field", "is", "not", "declared", "into", "superclass", ";", "if", "field", "is", "static", "object", "instance", "should", "be", "null", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L888-L895
152,901
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getResource
private static URL getResource(String name, ClassLoader[] classLoaders) { // Java standard class loader require resource name to be an absolute path without leading path separator // at this point <name> argument is guaranteed to not start with leading path separator for(ClassLoader classLoader : classLoaders) { URL url = classLoader.getResource(name); if(url == null) { // it seems there are class loaders that require leading path separator // not confirmed rumor but found in similar libraries url = classLoader.getResource('/' + name); } if(url != null) { return url; } } return null; }
java
private static URL getResource(String name, ClassLoader[] classLoaders) { // Java standard class loader require resource name to be an absolute path without leading path separator // at this point <name> argument is guaranteed to not start with leading path separator for(ClassLoader classLoader : classLoaders) { URL url = classLoader.getResource(name); if(url == null) { // it seems there are class loaders that require leading path separator // not confirmed rumor but found in similar libraries url = classLoader.getResource('/' + name); } if(url != null) { return url; } } return null; }
[ "private", "static", "URL", "getResource", "(", "String", "name", ",", "ClassLoader", "[", "]", "classLoaders", ")", "{", "// Java standard class loader require resource name to be an absolute path without leading path separator\r", "// at this point <name> argument is guaranteed to not start with leading path separator\r", "for", "(", "ClassLoader", "classLoader", ":", "classLoaders", ")", "{", "URL", "url", "=", "classLoader", ".", "getResource", "(", "name", ")", ";", "if", "(", "url", "==", "null", ")", "{", "// it seems there are class loaders that require leading path separator\r", "// not confirmed rumor but found in similar libraries\r", "url", "=", "classLoader", ".", "getResource", "(", "'", "'", "+", "name", ")", ";", "}", "if", "(", "url", "!=", "null", ")", "{", "return", "url", ";", "}", "}", "return", "null", ";", "}" ]
Get named resource URL from a list of class loaders. Traverses class loaders in given order searching for requested resource. Return first resource found or null if none found. @param name resource name with syntax as requested by Java ClassLoader, @param classLoaders target class loaders. @return found resource URL or null.
[ "Get", "named", "resource", "URL", "from", "a", "list", "of", "class", "loaders", ".", "Traverses", "class", "loaders", "in", "given", "order", "searching", "for", "requested", "resource", ".", "Return", "first", "resource", "found", "or", "null", "if", "none", "found", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L997-L1014
152,902
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getResourceAsStream
private static InputStream getResourceAsStream(String name, ClassLoader[] classLoaders) { // Java standard class loader require resource name to be an absolute path without leading path separator // at this point <name> argument is guaranteed to not start with leading path separator for(ClassLoader classLoader : classLoaders) { InputStream stream = classLoader.getResourceAsStream(name); if(stream == null) { // it seems there are class loaders that require leading path separator // not confirmed rumor but found in similar libraries stream = classLoader.getResourceAsStream('/' + name); } if(stream != null) { return stream; } } return null; }
java
private static InputStream getResourceAsStream(String name, ClassLoader[] classLoaders) { // Java standard class loader require resource name to be an absolute path without leading path separator // at this point <name> argument is guaranteed to not start with leading path separator for(ClassLoader classLoader : classLoaders) { InputStream stream = classLoader.getResourceAsStream(name); if(stream == null) { // it seems there are class loaders that require leading path separator // not confirmed rumor but found in similar libraries stream = classLoader.getResourceAsStream('/' + name); } if(stream != null) { return stream; } } return null; }
[ "private", "static", "InputStream", "getResourceAsStream", "(", "String", "name", ",", "ClassLoader", "[", "]", "classLoaders", ")", "{", "// Java standard class loader require resource name to be an absolute path without leading path separator\r", "// at this point <name> argument is guaranteed to not start with leading path separator\r", "for", "(", "ClassLoader", "classLoader", ":", "classLoaders", ")", "{", "InputStream", "stream", "=", "classLoader", ".", "getResourceAsStream", "(", "name", ")", ";", "if", "(", "stream", "==", "null", ")", "{", "// it seems there are class loaders that require leading path separator\r", "// not confirmed rumor but found in similar libraries\r", "stream", "=", "classLoader", ".", "getResourceAsStream", "(", "'", "'", "+", "name", ")", ";", "}", "if", "(", "stream", "!=", "null", ")", "{", "return", "stream", ";", "}", "}", "return", "null", ";", "}" ]
Get named resource input stream from a list of class loaders. Traverses class loaders in given order searching for requested resource. Return first resource found or null if none found. @param name resource name with syntax as required by Java ClassLoader, @param classLoaders target class loaders. @return found resource as input stream or null.
[ "Get", "named", "resource", "input", "stream", "from", "a", "list", "of", "class", "loaders", ".", "Traverses", "class", "loaders", "in", "given", "order", "searching", "for", "requested", "resource", ".", "Return", "first", "resource", "found", "or", "null", "if", "none", "found", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1061-L1078
152,903
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.newInstance
@SuppressWarnings("unchecked") public static <T> T newInstance(String className, Object... arguments) { return (T)newInstance(Classes.forName(className), arguments); }
java
@SuppressWarnings("unchecked") public static <T> T newInstance(String className, Object... arguments) { return (T)newInstance(Classes.forName(className), arguments); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "newInstance", "(", "String", "className", ",", "Object", "...", "arguments", ")", "{", "return", "(", "T", ")", "newInstance", "(", "Classes", ".", "forName", "(", "className", ")", ",", "arguments", ")", ";", "}" ]
Create a new instance. Handy utility for hidden classes creation. Constructor accepting given arguments, if any, must exists. @param className fully qualified class name, @param arguments variable number of arguments to be passed to constructor. @param <T> instance type. @return newly created instance. @throws NoSuchBeingException if class or constructor not found.
[ "Create", "a", "new", "instance", ".", "Handy", "utility", "for", "hidden", "classes", "creation", ".", "Constructor", "accepting", "given", "arguments", "if", "any", "must", "exists", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1317-L1321
152,904
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.missingConstructorException
private static NoSuchBeingException missingConstructorException(Class<?> clazz, Object... arguments) { Type[] types = new Type[arguments.length]; for(int i = 0; i < arguments.length; ++i) { types[i] = arguments[i].getClass(); } return new NoSuchBeingException("Missing constructor(%s) for |%s|.", Arrays.toString(types), clazz); }
java
private static NoSuchBeingException missingConstructorException(Class<?> clazz, Object... arguments) { Type[] types = new Type[arguments.length]; for(int i = 0; i < arguments.length; ++i) { types[i] = arguments[i].getClass(); } return new NoSuchBeingException("Missing constructor(%s) for |%s|.", Arrays.toString(types), clazz); }
[ "private", "static", "NoSuchBeingException", "missingConstructorException", "(", "Class", "<", "?", ">", "clazz", ",", "Object", "...", "arguments", ")", "{", "Type", "[", "]", "types", "=", "new", "Type", "[", "arguments", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "++", "i", ")", "{", "types", "[", "i", "]", "=", "arguments", "[", "i", "]", ".", "getClass", "(", ")", ";", "}", "return", "new", "NoSuchBeingException", "(", "\"Missing constructor(%s) for |%s|.\"", ",", "Arrays", ".", "toString", "(", "types", ")", ",", "clazz", ")", ";", "}" ]
Helper for missing constructor exception. @param clazz constructor class, @param arguments constructor arguments. @return formatted exception.
[ "Helper", "for", "missing", "constructor", "exception", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1406-L1413
152,905
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getListDefaultImplementation
@SuppressWarnings("unchecked") public static <T extends List<?>> Class<T> getListDefaultImplementation(Type listType) { return (Class<T>)getImplementation(LISTS, listType); }
java
@SuppressWarnings("unchecked") public static <T extends List<?>> Class<T> getListDefaultImplementation(Type listType) { return (Class<T>)getImplementation(LISTS, listType); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "List", "<", "?", ">", ">", "Class", "<", "T", ">", "getListDefaultImplementation", "(", "Type", "listType", ")", "{", "return", "(", "Class", "<", "T", ">", ")", "getImplementation", "(", "LISTS", ",", "listType", ")", ";", "}" ]
Get default implementation for requested list type. @param listType raw list type. @param <T> list type. @return default implementation for requested list.
[ "Get", "default", "implementation", "for", "requested", "list", "type", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1461-L1465
152,906
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getImplementation
public static Class<?> getImplementation(Map<Class<?>, Class<?>> implementationsRegistry, Type interfaceType) { Class<?> implementation = implementationsRegistry.get(interfaceType); if(implementation == null) { throw new BugError("No registered implementation for type |%s|.", interfaceType); } return implementation; }
java
public static Class<?> getImplementation(Map<Class<?>, Class<?>> implementationsRegistry, Type interfaceType) { Class<?> implementation = implementationsRegistry.get(interfaceType); if(implementation == null) { throw new BugError("No registered implementation for type |%s|.", interfaceType); } return implementation; }
[ "public", "static", "Class", "<", "?", ">", "getImplementation", "(", "Map", "<", "Class", "<", "?", ">", ",", "Class", "<", "?", ">", ">", "implementationsRegistry", ",", "Type", "interfaceType", ")", "{", "Class", "<", "?", ">", "implementation", "=", "implementationsRegistry", ".", "get", "(", "interfaceType", ")", ";", "if", "(", "implementation", "==", "null", ")", "{", "throw", "new", "BugError", "(", "\"No registered implementation for type |%s|.\"", ",", "interfaceType", ")", ";", "}", "return", "implementation", ";", "}" ]
Lookup implementation into given registry, throwing exception if not found. @param implementationsRegistry implementations registry, @param interfaceType interface to lookup into registry. @return implementation for requested interface type. @throws BugError if implementation is not found into registry.
[ "Lookup", "implementation", "into", "given", "registry", "throwing", "exception", "if", "not", "found", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1487-L1494
152,907
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.newRegisteredInstance
@SuppressWarnings("unchecked") private static <T> T newRegisteredInstance(Map<Class<?>, Class<?>> implementationsRegistry, Type interfaceType) throws BugError { Class<?> implementation = getImplementation(implementationsRegistry, interfaceType); try { return (T)implementation.newInstance(); } catch(IllegalAccessException e) { // illegal access exception is thrown if the class or its no-arguments constructor is not accessible // since we use well known JRE classes this condition may never meet throw new BugError(e); } catch(InstantiationException e) { // instantiation exception is thrown if class is abstract, interface, array, primitive or void // since we use well known JRE classes this condition may never meet throw new BugError(e); } }
java
@SuppressWarnings("unchecked") private static <T> T newRegisteredInstance(Map<Class<?>, Class<?>> implementationsRegistry, Type interfaceType) throws BugError { Class<?> implementation = getImplementation(implementationsRegistry, interfaceType); try { return (T)implementation.newInstance(); } catch(IllegalAccessException e) { // illegal access exception is thrown if the class or its no-arguments constructor is not accessible // since we use well known JRE classes this condition may never meet throw new BugError(e); } catch(InstantiationException e) { // instantiation exception is thrown if class is abstract, interface, array, primitive or void // since we use well known JRE classes this condition may never meet throw new BugError(e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "<", "T", ">", "T", "newRegisteredInstance", "(", "Map", "<", "Class", "<", "?", ">", ",", "Class", "<", "?", ">", ">", "implementationsRegistry", ",", "Type", "interfaceType", ")", "throws", "BugError", "{", "Class", "<", "?", ">", "implementation", "=", "getImplementation", "(", "implementationsRegistry", ",", "interfaceType", ")", ";", "try", "{", "return", "(", "T", ")", "implementation", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "// illegal access exception is thrown if the class or its no-arguments constructor is not accessible\r", "// since we use well known JRE classes this condition may never meet\r", "throw", "new", "BugError", "(", "e", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "// instantiation exception is thrown if class is abstract, interface, array, primitive or void\r", "// since we use well known JRE classes this condition may never meet\r", "throw", "new", "BugError", "(", "e", ")", ";", "}", "}" ]
Lookup implementation for requested interface into given registry and return a new instance of it. @param implementationsRegistry implementations registry, @param interfaceType interface to lookup into registry. @param <T> instance type. @return implementation instance. @throws BugError if implementation is not found into registry.
[ "Lookup", "implementation", "for", "requested", "interface", "into", "given", "registry", "and", "return", "a", "new", "instance", "of", "it", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1505-L1522
152,908
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.newMap
@SuppressWarnings("unchecked") public static <T extends Map<?, ?>> T newMap(Type type) { Class<?> implementation = MAPS.get(type); if(implementation == null) { throw new BugError("No registered implementation for map |%s|.", type); } return (T)newInstance(implementation); }
java
@SuppressWarnings("unchecked") public static <T extends Map<?, ?>> T newMap(Type type) { Class<?> implementation = MAPS.get(type); if(implementation == null) { throw new BugError("No registered implementation for map |%s|.", type); } return (T)newInstance(implementation); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Map", "<", "?", ",", "?", ">", ">", "T", "newMap", "(", "Type", "type", ")", "{", "Class", "<", "?", ">", "implementation", "=", "MAPS", ".", "get", "(", "type", ")", ";", "if", "(", "implementation", "==", "null", ")", "{", "throw", "new", "BugError", "(", "\"No registered implementation for map |%s|.\"", ",", "type", ")", ";", "}", "return", "(", "T", ")", "newInstance", "(", "implementation", ")", ";", "}" ]
Create new map of given type. @param type map type. @param <T> map type. @return newly created map.
[ "Create", "new", "map", "of", "given", "type", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1544-L1552
152,909
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.forType
public static Class<?> forType(Type type) { if(type instanceof Class) { return (Class<?>)type; } if(type instanceof ParameterizedType) { return forType(((ParameterizedType)type).getRawType()); } if(!(type instanceof GenericArrayType)) { return null; } Type componentType = ((GenericArrayType)type).getGenericComponentType(); Class<?> componentClass = forType(componentType); return componentClass != null ? Array.newInstance(componentClass, 0).getClass() : null; }
java
public static Class<?> forType(Type type) { if(type instanceof Class) { return (Class<?>)type; } if(type instanceof ParameterizedType) { return forType(((ParameterizedType)type).getRawType()); } if(!(type instanceof GenericArrayType)) { return null; } Type componentType = ((GenericArrayType)type).getGenericComponentType(); Class<?> componentClass = forType(componentType); return componentClass != null ? Array.newInstance(componentClass, 0).getClass() : null; }
[ "public", "static", "Class", "<", "?", ">", "forType", "(", "Type", "type", ")", "{", "if", "(", "type", "instanceof", "Class", ")", "{", "return", "(", "Class", "<", "?", ">", ")", "type", ";", "}", "if", "(", "type", "instanceof", "ParameterizedType", ")", "{", "return", "forType", "(", "(", "(", "ParameterizedType", ")", "type", ")", ".", "getRawType", "(", ")", ")", ";", "}", "if", "(", "!", "(", "type", "instanceof", "GenericArrayType", ")", ")", "{", "return", "null", ";", "}", "Type", "componentType", "=", "(", "(", "GenericArrayType", ")", "type", ")", ".", "getGenericComponentType", "(", ")", ";", "Class", "<", "?", ">", "componentClass", "=", "forType", "(", "componentType", ")", ";", "return", "componentClass", "!=", "null", "?", "Array", ".", "newInstance", "(", "componentClass", ",", "0", ")", ".", "getClass", "(", ")", ":", "null", ";", "}" ]
Get the underlying class for a type, or null if the type is a variable type. @param type the type @return the underlying class
[ "Get", "the", "underlying", "class", "for", "a", "type", "or", "null", "if", "the", "type", "is", "a", "variable", "type", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1560-L1577
152,910
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/lock/LockTable.java
LockTable.removeLock
public synchronized boolean removeLock(Object bookmark, SessionInfo sessionInfo) { Utility.getLogger().info("Unlock: " + bookmark + ", Session: " + sessionInfo.m_iSessionID + " success: " + sessionInfo.equals(this.get(bookmark))); if (!sessionInfo.equals(this.get(bookmark))) return false; // Not my session - error. if (this.getWaitlist(bookmark, false) != null) if (this.getWaitlist(bookmark, false).size() > 0) { // Notify this person that the wait is over SessionInfo sessionInfoToUnlock = this.getWaitlist(bookmark, true).get(0); if (sessionInfoToUnlock == null) return false; // Never synchronized (sessionInfoToUnlock) { if (sessionInfoToUnlock != this.popWaitlistSession(bookmark)) return false; // Never since the only remove is this (synchronized line) boolean bSuccess = sessionInfo.equals(this.remove(bookmark)); if (bSuccess) // Always sessionInfoToUnlock.notify(); // Tell locked session to continue return bSuccess; } } return sessionInfo.equals(this.remove(bookmark)); }
java
public synchronized boolean removeLock(Object bookmark, SessionInfo sessionInfo) { Utility.getLogger().info("Unlock: " + bookmark + ", Session: " + sessionInfo.m_iSessionID + " success: " + sessionInfo.equals(this.get(bookmark))); if (!sessionInfo.equals(this.get(bookmark))) return false; // Not my session - error. if (this.getWaitlist(bookmark, false) != null) if (this.getWaitlist(bookmark, false).size() > 0) { // Notify this person that the wait is over SessionInfo sessionInfoToUnlock = this.getWaitlist(bookmark, true).get(0); if (sessionInfoToUnlock == null) return false; // Never synchronized (sessionInfoToUnlock) { if (sessionInfoToUnlock != this.popWaitlistSession(bookmark)) return false; // Never since the only remove is this (synchronized line) boolean bSuccess = sessionInfo.equals(this.remove(bookmark)); if (bSuccess) // Always sessionInfoToUnlock.notify(); // Tell locked session to continue return bSuccess; } } return sessionInfo.equals(this.remove(bookmark)); }
[ "public", "synchronized", "boolean", "removeLock", "(", "Object", "bookmark", ",", "SessionInfo", "sessionInfo", ")", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"Unlock: \"", "+", "bookmark", "+", "\", Session: \"", "+", "sessionInfo", ".", "m_iSessionID", "+", "\" success: \"", "+", "sessionInfo", ".", "equals", "(", "this", ".", "get", "(", "bookmark", ")", ")", ")", ";", "if", "(", "!", "sessionInfo", ".", "equals", "(", "this", ".", "get", "(", "bookmark", ")", ")", ")", "return", "false", ";", "// Not my session - error.", "if", "(", "this", ".", "getWaitlist", "(", "bookmark", ",", "false", ")", "!=", "null", ")", "if", "(", "this", ".", "getWaitlist", "(", "bookmark", ",", "false", ")", ".", "size", "(", ")", ">", "0", ")", "{", "// Notify this person that the wait is over", "SessionInfo", "sessionInfoToUnlock", "=", "this", ".", "getWaitlist", "(", "bookmark", ",", "true", ")", ".", "get", "(", "0", ")", ";", "if", "(", "sessionInfoToUnlock", "==", "null", ")", "return", "false", ";", "// Never", "synchronized", "(", "sessionInfoToUnlock", ")", "{", "if", "(", "sessionInfoToUnlock", "!=", "this", ".", "popWaitlistSession", "(", "bookmark", ")", ")", "return", "false", ";", "// Never since the only remove is this (synchronized line)", "boolean", "bSuccess", "=", "sessionInfo", ".", "equals", "(", "this", ".", "remove", "(", "bookmark", ")", ")", ";", "if", "(", "bSuccess", ")", "// Always", "sessionInfoToUnlock", ".", "notify", "(", ")", ";", "// Tell locked session to continue", "return", "bSuccess", ";", "}", "}", "return", "sessionInfo", ".", "equals", "(", "this", ".", "remove", "(", "bookmark", ")", ")", ";", "}" ]
Remove this bookmark from the lock list. @param bookmark The bookmark to lock. @param session The session to lock. @return true if successful.
[ "Remove", "this", "bookmark", "from", "the", "lock", "list", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/lock/LockTable.java#L47-L69
152,911
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/lock/LockTable.java
LockTable.unlockAll
public synchronized boolean unlockAll(SessionInfo sessionInfo) { Utility.getLogger().info("Unlock all, Session: " + sessionInfo.m_iSessionID); for (Object bookmark : this.keySet()) { SessionInfo thisSession = (SessionInfo)this.get(bookmark); if (sessionInfo.equals(thisSession)) this.removeLock(bookmark, thisSession); } return true; }
java
public synchronized boolean unlockAll(SessionInfo sessionInfo) { Utility.getLogger().info("Unlock all, Session: " + sessionInfo.m_iSessionID); for (Object bookmark : this.keySet()) { SessionInfo thisSession = (SessionInfo)this.get(bookmark); if (sessionInfo.equals(thisSession)) this.removeLock(bookmark, thisSession); } return true; }
[ "public", "synchronized", "boolean", "unlockAll", "(", "SessionInfo", "sessionInfo", ")", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"Unlock all, Session: \"", "+", "sessionInfo", ".", "m_iSessionID", ")", ";", "for", "(", "Object", "bookmark", ":", "this", ".", "keySet", "(", ")", ")", "{", "SessionInfo", "thisSession", "=", "(", "SessionInfo", ")", "this", ".", "get", "(", "bookmark", ")", ";", "if", "(", "sessionInfo", ".", "equals", "(", "thisSession", ")", ")", "this", ".", "removeLock", "(", "bookmark", ",", "thisSession", ")", ";", "}", "return", "true", ";", "}" ]
Unlock all the locks for this session.
[ "Unlock", "all", "the", "locks", "for", "this", "session", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/lock/LockTable.java#L97-L107
152,912
lshift/jamume
src/main/java/net/lshift/java/dispatch/ExecutorServiceProxy.java
ExecutorServiceProxy.proxy
@SuppressWarnings("unchecked") public <T> T proxy(final Object delegate, Class<?> [] interfaces) { return (T)Proxy.newProxyInstance (delegate.getClass().getClassLoader(), interfaces, new ProxyInvocationHandler(delegate)); }
java
@SuppressWarnings("unchecked") public <T> T proxy(final Object delegate, Class<?> [] interfaces) { return (T)Proxy.newProxyInstance (delegate.getClass().getClassLoader(), interfaces, new ProxyInvocationHandler(delegate)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "proxy", "(", "final", "Object", "delegate", ",", "Class", "<", "?", ">", "[", "]", "interfaces", ")", "{", "return", "(", "T", ")", "Proxy", ".", "newProxyInstance", "(", "delegate", ".", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ",", "interfaces", ",", "new", "ProxyInvocationHandler", "(", "delegate", ")", ")", ";", "}" ]
Construct a proxy, for which each method is invoked by the execution server. @param delegate the object whose methods are to be run inside the worker thread. @return a proxy implementing the interfaces
[ "Construct", "a", "proxy", "for", "which", "each", "method", "is", "invoked", "by", "the", "execution", "server", "." ]
754d9ab29311601328a2f39928775e4e010305b7
https://github.com/lshift/jamume/blob/754d9ab29311601328a2f39928775e4e010305b7/src/main/java/net/lshift/java/dispatch/ExecutorServiceProxy.java#L239-L246
152,913
jbundle/jbundle
app/program/screen/src/main/java/org/jbundle/app/program/screen/LayoutPrint.java
LayoutPrint.printIt
public void printIt(Record recLayout, PrintWriter out, int iIndents, String strEnd) { // Print out the current record String strName = recLayout.getField(Layout.NAME).toString(); String strType = recLayout.getField(Layout.TYPE).toString(); String strValue = recLayout.getField(Layout.FIELD_VALUE).toString(); String strReturns = recLayout.getField(Layout.RETURNS_VALUE).toString(); String strMax = recLayout.getField(Layout.MAXIMUM).toString(); String strDescription = recLayout.getField(Layout.COMMENT).toString(); boolean bLoop = false; if ((strType.equalsIgnoreCase("module")) || (strType.equalsIgnoreCase("enum")) || (strType.equalsIgnoreCase("struct")) || (strType.equalsIgnoreCase("interface"))) bLoop = true; if (bLoop) { this.println(out, strType + " " + strName, strDescription, iIndents, ""); String strEndLoop = ";"; if (strType.equalsIgnoreCase("enum")) strEndLoop = null; this.println(out, "{", null, iIndents, ""); Layout recLayoutLoop = new Layout(recLayout.findRecordOwner()); recLayoutLoop.setKeyArea(Layout.PARENT_FOLDER_ID_KEY); recLayoutLoop.addListener(new SubFileFilter(recLayout)); try { boolean bFirstLoop = true; while (recLayoutLoop.hasNext()) { if (strEndLoop == null) if (!bFirstLoop) this.println(out, ",", null, 0, ""); recLayoutLoop.next(); this.printIt(recLayoutLoop, out, iIndents + 1, strEndLoop); bFirstLoop = false; } if (strEndLoop == null) if (!bFirstLoop) this.println(out, "", null, 0, ""); // Carriage return recLayoutLoop.free(); recLayoutLoop = null; } catch (DBException ex) { ex.printStackTrace(); } this.println(out, "}", null, iIndents, strEnd); } else { if (strType.equalsIgnoreCase("collection")) strType = "typedef sequence<" + strValue +">"; else if (strType.equalsIgnoreCase("method")) { strType = strReturns + " "; strName += "(" + strValue + ")"; } else if (strType.equalsIgnoreCase("comment")) strType = "//\t" + strType; else if (strValue.length() > 0) strName += " = " + strValue; this.println(out, strType + " " + strName, strDescription, iIndents, strEnd); } }
java
public void printIt(Record recLayout, PrintWriter out, int iIndents, String strEnd) { // Print out the current record String strName = recLayout.getField(Layout.NAME).toString(); String strType = recLayout.getField(Layout.TYPE).toString(); String strValue = recLayout.getField(Layout.FIELD_VALUE).toString(); String strReturns = recLayout.getField(Layout.RETURNS_VALUE).toString(); String strMax = recLayout.getField(Layout.MAXIMUM).toString(); String strDescription = recLayout.getField(Layout.COMMENT).toString(); boolean bLoop = false; if ((strType.equalsIgnoreCase("module")) || (strType.equalsIgnoreCase("enum")) || (strType.equalsIgnoreCase("struct")) || (strType.equalsIgnoreCase("interface"))) bLoop = true; if (bLoop) { this.println(out, strType + " " + strName, strDescription, iIndents, ""); String strEndLoop = ";"; if (strType.equalsIgnoreCase("enum")) strEndLoop = null; this.println(out, "{", null, iIndents, ""); Layout recLayoutLoop = new Layout(recLayout.findRecordOwner()); recLayoutLoop.setKeyArea(Layout.PARENT_FOLDER_ID_KEY); recLayoutLoop.addListener(new SubFileFilter(recLayout)); try { boolean bFirstLoop = true; while (recLayoutLoop.hasNext()) { if (strEndLoop == null) if (!bFirstLoop) this.println(out, ",", null, 0, ""); recLayoutLoop.next(); this.printIt(recLayoutLoop, out, iIndents + 1, strEndLoop); bFirstLoop = false; } if (strEndLoop == null) if (!bFirstLoop) this.println(out, "", null, 0, ""); // Carriage return recLayoutLoop.free(); recLayoutLoop = null; } catch (DBException ex) { ex.printStackTrace(); } this.println(out, "}", null, iIndents, strEnd); } else { if (strType.equalsIgnoreCase("collection")) strType = "typedef sequence<" + strValue +">"; else if (strType.equalsIgnoreCase("method")) { strType = strReturns + " "; strName += "(" + strValue + ")"; } else if (strType.equalsIgnoreCase("comment")) strType = "//\t" + strType; else if (strValue.length() > 0) strName += " = " + strValue; this.println(out, strType + " " + strName, strDescription, iIndents, strEnd); } }
[ "public", "void", "printIt", "(", "Record", "recLayout", ",", "PrintWriter", "out", ",", "int", "iIndents", ",", "String", "strEnd", ")", "{", "// Print out the current record", "String", "strName", "=", "recLayout", ".", "getField", "(", "Layout", ".", "NAME", ")", ".", "toString", "(", ")", ";", "String", "strType", "=", "recLayout", ".", "getField", "(", "Layout", ".", "TYPE", ")", ".", "toString", "(", ")", ";", "String", "strValue", "=", "recLayout", ".", "getField", "(", "Layout", ".", "FIELD_VALUE", ")", ".", "toString", "(", ")", ";", "String", "strReturns", "=", "recLayout", ".", "getField", "(", "Layout", ".", "RETURNS_VALUE", ")", ".", "toString", "(", ")", ";", "String", "strMax", "=", "recLayout", ".", "getField", "(", "Layout", ".", "MAXIMUM", ")", ".", "toString", "(", ")", ";", "String", "strDescription", "=", "recLayout", ".", "getField", "(", "Layout", ".", "COMMENT", ")", ".", "toString", "(", ")", ";", "boolean", "bLoop", "=", "false", ";", "if", "(", "(", "strType", ".", "equalsIgnoreCase", "(", "\"module\"", ")", ")", "||", "(", "strType", ".", "equalsIgnoreCase", "(", "\"enum\"", ")", ")", "||", "(", "strType", ".", "equalsIgnoreCase", "(", "\"struct\"", ")", ")", "||", "(", "strType", ".", "equalsIgnoreCase", "(", "\"interface\"", ")", ")", ")", "bLoop", "=", "true", ";", "if", "(", "bLoop", ")", "{", "this", ".", "println", "(", "out", ",", "strType", "+", "\" \"", "+", "strName", ",", "strDescription", ",", "iIndents", ",", "\"\"", ")", ";", "String", "strEndLoop", "=", "\";\"", ";", "if", "(", "strType", ".", "equalsIgnoreCase", "(", "\"enum\"", ")", ")", "strEndLoop", "=", "null", ";", "this", ".", "println", "(", "out", ",", "\"{\"", ",", "null", ",", "iIndents", ",", "\"\"", ")", ";", "Layout", "recLayoutLoop", "=", "new", "Layout", "(", "recLayout", ".", "findRecordOwner", "(", ")", ")", ";", "recLayoutLoop", ".", "setKeyArea", "(", "Layout", ".", "PARENT_FOLDER_ID_KEY", ")", ";", "recLayoutLoop", ".", "addListener", "(", "new", "SubFileFilter", "(", "recLayout", ")", ")", ";", "try", "{", "boolean", "bFirstLoop", "=", "true", ";", "while", "(", "recLayoutLoop", ".", "hasNext", "(", ")", ")", "{", "if", "(", "strEndLoop", "==", "null", ")", "if", "(", "!", "bFirstLoop", ")", "this", ".", "println", "(", "out", ",", "\",\"", ",", "null", ",", "0", ",", "\"\"", ")", ";", "recLayoutLoop", ".", "next", "(", ")", ";", "this", ".", "printIt", "(", "recLayoutLoop", ",", "out", ",", "iIndents", "+", "1", ",", "strEndLoop", ")", ";", "bFirstLoop", "=", "false", ";", "}", "if", "(", "strEndLoop", "==", "null", ")", "if", "(", "!", "bFirstLoop", ")", "this", ".", "println", "(", "out", ",", "\"\"", ",", "null", ",", "0", ",", "\"\"", ")", ";", "// Carriage return", "recLayoutLoop", ".", "free", "(", ")", ";", "recLayoutLoop", "=", "null", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "this", ".", "println", "(", "out", ",", "\"}\"", ",", "null", ",", "iIndents", ",", "strEnd", ")", ";", "}", "else", "{", "if", "(", "strType", ".", "equalsIgnoreCase", "(", "\"collection\"", ")", ")", "strType", "=", "\"typedef sequence<\"", "+", "strValue", "+", "\">\"", ";", "else", "if", "(", "strType", ".", "equalsIgnoreCase", "(", "\"method\"", ")", ")", "{", "strType", "=", "strReturns", "+", "\" \"", ";", "strName", "+=", "\"(\"", "+", "strValue", "+", "\")\"", ";", "}", "else", "if", "(", "strType", ".", "equalsIgnoreCase", "(", "\"comment\"", ")", ")", "strType", "=", "\"//\\t\"", "+", "strType", ";", "else", "if", "(", "strValue", ".", "length", "(", ")", ">", "0", ")", "strName", "+=", "\" = \"", "+", "strValue", ";", "this", ".", "println", "(", "out", ",", "strType", "+", "\" \"", "+", "strName", ",", "strDescription", ",", "iIndents", ",", "strEnd", ")", ";", "}", "}" ]
PrintIt Method.
[ "PrintIt", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/screen/LayoutPrint.java#L92-L151
152,914
jbundle/jbundle
app/program/screen/src/main/java/org/jbundle/app/program/screen/LayoutPrint.java
LayoutPrint.println
public void println(PrintWriter out, String string, String strDescription, int iIndents, String strEnd) { while (iIndents-- > 0) out.print("\t"); if (strEnd != null) if ((strDescription != null) && (strDescription.length() > 0)) strEnd = strEnd + "\t\t// " + strDescription; if (strEnd != null) out.println(string + strEnd); else out.print(string); }
java
public void println(PrintWriter out, String string, String strDescription, int iIndents, String strEnd) { while (iIndents-- > 0) out.print("\t"); if (strEnd != null) if ((strDescription != null) && (strDescription.length() > 0)) strEnd = strEnd + "\t\t// " + strDescription; if (strEnd != null) out.println(string + strEnd); else out.print(string); }
[ "public", "void", "println", "(", "PrintWriter", "out", ",", "String", "string", ",", "String", "strDescription", ",", "int", "iIndents", ",", "String", "strEnd", ")", "{", "while", "(", "iIndents", "--", ">", "0", ")", "out", ".", "print", "(", "\"\\t\"", ")", ";", "if", "(", "strEnd", "!=", "null", ")", "if", "(", "(", "strDescription", "!=", "null", ")", "&&", "(", "strDescription", ".", "length", "(", ")", ">", "0", ")", ")", "strEnd", "=", "strEnd", "+", "\"\\t\\t// \"", "+", "strDescription", ";", "if", "(", "strEnd", "!=", "null", ")", "out", ".", "println", "(", "string", "+", "strEnd", ")", ";", "else", "out", ".", "print", "(", "string", ")", ";", "}" ]
Println Method.
[ "Println", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/screen/LayoutPrint.java#L155-L165
152,915
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL11.java
CreateWSDL11.addService
public void addService(TDefinitions descriptionType) { String interfacens; String interfacename; QName qname; String name; if (soapFactory == null) soapFactory = new org.xmlsoap.schemas.wsdl.soap.ObjectFactory(); TService service = wsdlFactory.createTService(); descriptionType.getAnyTopLevelOptionalElement().add(service); name = this.getControlProperty(MessageControl.SERVICE_NAME); service.setName(name); interfacens = this.getNamespace(); interfacename = this.getControlProperty(MessageControl.BINDING_NAME); qname = new QName(interfacens, interfacename); TPort port = wsdlFactory.createTPort(); service.getPort().add(port); port.setName(name + "Port"); port.setBinding(qname); org.xmlsoap.schemas.wsdl.soap.TAddress tAddress = soapFactory.createTAddress(); port.getAny().add(soapFactory.createAddress(tAddress)); String address = this.getURIValue(this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.WEB_SERVICES_SERVER).toString()); // Important - This is the web services URL tAddress.setLocation(address); }
java
public void addService(TDefinitions descriptionType) { String interfacens; String interfacename; QName qname; String name; if (soapFactory == null) soapFactory = new org.xmlsoap.schemas.wsdl.soap.ObjectFactory(); TService service = wsdlFactory.createTService(); descriptionType.getAnyTopLevelOptionalElement().add(service); name = this.getControlProperty(MessageControl.SERVICE_NAME); service.setName(name); interfacens = this.getNamespace(); interfacename = this.getControlProperty(MessageControl.BINDING_NAME); qname = new QName(interfacens, interfacename); TPort port = wsdlFactory.createTPort(); service.getPort().add(port); port.setName(name + "Port"); port.setBinding(qname); org.xmlsoap.schemas.wsdl.soap.TAddress tAddress = soapFactory.createTAddress(); port.getAny().add(soapFactory.createAddress(tAddress)); String address = this.getURIValue(this.getRecord(MessageControl.MESSAGE_CONTROL_FILE).getField(MessageControl.WEB_SERVICES_SERVER).toString()); // Important - This is the web services URL tAddress.setLocation(address); }
[ "public", "void", "addService", "(", "TDefinitions", "descriptionType", ")", "{", "String", "interfacens", ";", "String", "interfacename", ";", "QName", "qname", ";", "String", "name", ";", "if", "(", "soapFactory", "==", "null", ")", "soapFactory", "=", "new", "org", ".", "xmlsoap", ".", "schemas", ".", "wsdl", ".", "soap", ".", "ObjectFactory", "(", ")", ";", "TService", "service", "=", "wsdlFactory", ".", "createTService", "(", ")", ";", "descriptionType", ".", "getAnyTopLevelOptionalElement", "(", ")", ".", "add", "(", "service", ")", ";", "name", "=", "this", ".", "getControlProperty", "(", "MessageControl", ".", "SERVICE_NAME", ")", ";", "service", ".", "setName", "(", "name", ")", ";", "interfacens", "=", "this", ".", "getNamespace", "(", ")", ";", "interfacename", "=", "this", ".", "getControlProperty", "(", "MessageControl", ".", "BINDING_NAME", ")", ";", "qname", "=", "new", "QName", "(", "interfacens", ",", "interfacename", ")", ";", "TPort", "port", "=", "wsdlFactory", ".", "createTPort", "(", ")", ";", "service", ".", "getPort", "(", ")", ".", "add", "(", "port", ")", ";", "port", ".", "setName", "(", "name", "+", "\"Port\"", ")", ";", "port", ".", "setBinding", "(", "qname", ")", ";", "org", ".", "xmlsoap", ".", "schemas", ".", "wsdl", ".", "soap", ".", "TAddress", "tAddress", "=", "soapFactory", ".", "createTAddress", "(", ")", ";", "port", ".", "getAny", "(", ")", ".", "add", "(", "soapFactory", ".", "createAddress", "(", "tAddress", ")", ")", ";", "String", "address", "=", "this", ".", "getURIValue", "(", "this", ".", "getRecord", "(", "MessageControl", ".", "MESSAGE_CONTROL_FILE", ")", ".", "getField", "(", "MessageControl", ".", "WEB_SERVICES_SERVER", ")", ".", "toString", "(", ")", ")", ";", "// Important - This is the web services URL", "tAddress", ".", "setLocation", "(", "address", ")", ";", "}" ]
AddService Method.
[ "AddService", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL11.java#L135-L165
152,916
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL11.java
CreateWSDL11.addBindingsType
public void addBindingsType(TDefinitions definitions) { String interfacens; String interfacename; QName qname; String value; String name; if (soapFactory == null) soapFactory = new org.xmlsoap.schemas.wsdl.soap.ObjectFactory(); // Create the bindings type TBinding binding = wsdlFactory.createTBinding(); definitions.getAnyTopLevelOptionalElement().add(binding); name = this.getControlProperty(MessageControl.BINDING_NAME); binding.setName(name); interfacens = this.getNamespace(); interfacename = this.getControlProperty(MessageControl.INTERFACE_NAME); qname = new QName(interfacens, interfacename); binding.setType(qname); //?LocalElement localElement = schemaFactory.createLocalElement(); //?TBinding.getAny().add(localElement); org.xmlsoap.schemas.wsdl.soap.TBinding tBinding = soapFactory.createTBinding(); binding.getAny().add(soapFactory.createBinding(tBinding)); interfacens = this.getControlProperty(SOAP_URI); tBinding.setTransport(interfacens); tBinding.setStyle(org.xmlsoap.schemas.wsdl.soap.TStyleChoice.DOCUMENT); this.addBindingOperationTypes(binding); }
java
public void addBindingsType(TDefinitions definitions) { String interfacens; String interfacename; QName qname; String value; String name; if (soapFactory == null) soapFactory = new org.xmlsoap.schemas.wsdl.soap.ObjectFactory(); // Create the bindings type TBinding binding = wsdlFactory.createTBinding(); definitions.getAnyTopLevelOptionalElement().add(binding); name = this.getControlProperty(MessageControl.BINDING_NAME); binding.setName(name); interfacens = this.getNamespace(); interfacename = this.getControlProperty(MessageControl.INTERFACE_NAME); qname = new QName(interfacens, interfacename); binding.setType(qname); //?LocalElement localElement = schemaFactory.createLocalElement(); //?TBinding.getAny().add(localElement); org.xmlsoap.schemas.wsdl.soap.TBinding tBinding = soapFactory.createTBinding(); binding.getAny().add(soapFactory.createBinding(tBinding)); interfacens = this.getControlProperty(SOAP_URI); tBinding.setTransport(interfacens); tBinding.setStyle(org.xmlsoap.schemas.wsdl.soap.TStyleChoice.DOCUMENT); this.addBindingOperationTypes(binding); }
[ "public", "void", "addBindingsType", "(", "TDefinitions", "definitions", ")", "{", "String", "interfacens", ";", "String", "interfacename", ";", "QName", "qname", ";", "String", "value", ";", "String", "name", ";", "if", "(", "soapFactory", "==", "null", ")", "soapFactory", "=", "new", "org", ".", "xmlsoap", ".", "schemas", ".", "wsdl", ".", "soap", ".", "ObjectFactory", "(", ")", ";", "// Create the bindings type", "TBinding", "binding", "=", "wsdlFactory", ".", "createTBinding", "(", ")", ";", "definitions", ".", "getAnyTopLevelOptionalElement", "(", ")", ".", "add", "(", "binding", ")", ";", "name", "=", "this", ".", "getControlProperty", "(", "MessageControl", ".", "BINDING_NAME", ")", ";", "binding", ".", "setName", "(", "name", ")", ";", "interfacens", "=", "this", ".", "getNamespace", "(", ")", ";", "interfacename", "=", "this", ".", "getControlProperty", "(", "MessageControl", ".", "INTERFACE_NAME", ")", ";", "qname", "=", "new", "QName", "(", "interfacens", ",", "interfacename", ")", ";", "binding", ".", "setType", "(", "qname", ")", ";", "//?LocalElement localElement = schemaFactory.createLocalElement();", "//?TBinding.getAny().add(localElement);", "org", ".", "xmlsoap", ".", "schemas", ".", "wsdl", ".", "soap", ".", "TBinding", "tBinding", "=", "soapFactory", ".", "createTBinding", "(", ")", ";", "binding", ".", "getAny", "(", ")", ".", "add", "(", "soapFactory", ".", "createBinding", "(", "tBinding", ")", ")", ";", "interfacens", "=", "this", ".", "getControlProperty", "(", "SOAP_URI", ")", ";", "tBinding", ".", "setTransport", "(", "interfacens", ")", ";", "tBinding", ".", "setStyle", "(", "org", ".", "xmlsoap", ".", "schemas", ".", "wsdl", ".", "soap", ".", "TStyleChoice", ".", "DOCUMENT", ")", ";", "this", ".", "addBindingOperationTypes", "(", "binding", ")", ";", "}" ]
AddBindingsType Method.
[ "AddBindingsType", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL11.java#L169-L198
152,917
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL11.java
CreateWSDL11.addPort
public void addPort(TDefinitions description) { // Create the interfaces TPortType interfaceType = wsdlFactory.createTPortType(); description.getAnyTopLevelOptionalElement().add(interfaceType); String interfaceName = this.getControlProperty(MessageControl.INTERFACE_NAME); interfaceType.setName(interfaceName); this.addInterfaceOperationTypes(interfaceType); }
java
public void addPort(TDefinitions description) { // Create the interfaces TPortType interfaceType = wsdlFactory.createTPortType(); description.getAnyTopLevelOptionalElement().add(interfaceType); String interfaceName = this.getControlProperty(MessageControl.INTERFACE_NAME); interfaceType.setName(interfaceName); this.addInterfaceOperationTypes(interfaceType); }
[ "public", "void", "addPort", "(", "TDefinitions", "description", ")", "{", "// Create the interfaces", "TPortType", "interfaceType", "=", "wsdlFactory", ".", "createTPortType", "(", ")", ";", "description", ".", "getAnyTopLevelOptionalElement", "(", ")", ".", "add", "(", "interfaceType", ")", ";", "String", "interfaceName", "=", "this", ".", "getControlProperty", "(", "MessageControl", ".", "INTERFACE_NAME", ")", ";", "interfaceType", ".", "setName", "(", "interfaceName", ")", ";", "this", ".", "addInterfaceOperationTypes", "(", "interfaceType", ")", ";", "}" ]
AddPort Method.
[ "AddPort", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL11.java#L241-L250
152,918
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL11.java
CreateWSDL11.addMessageType
public void addMessageType(String version, TDefinitions descriptionType, MessageProcessInfo recMessageProcessInfo) { // Create the types (import the OTA specs) MessageInfo recMessageInfo = this.getMessageIn(recMessageProcessInfo); if (recMessageInfo != null) { String name = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString()); if (this.isNewType(name)) { this.addMessage(version, descriptionType, recMessageInfo); } } recMessageInfo = this.getMessageOut(recMessageProcessInfo); if (recMessageInfo != null) { String name = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString()); if (this.isNewType(name)) { this.addMessage(version, descriptionType, recMessageInfo); } } }
java
public void addMessageType(String version, TDefinitions descriptionType, MessageProcessInfo recMessageProcessInfo) { // Create the types (import the OTA specs) MessageInfo recMessageInfo = this.getMessageIn(recMessageProcessInfo); if (recMessageInfo != null) { String name = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString()); if (this.isNewType(name)) { this.addMessage(version, descriptionType, recMessageInfo); } } recMessageInfo = this.getMessageOut(recMessageProcessInfo); if (recMessageInfo != null) { String name = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString()); if (this.isNewType(name)) { this.addMessage(version, descriptionType, recMessageInfo); } } }
[ "public", "void", "addMessageType", "(", "String", "version", ",", "TDefinitions", "descriptionType", ",", "MessageProcessInfo", "recMessageProcessInfo", ")", "{", "// Create the types (import the OTA specs)", "MessageInfo", "recMessageInfo", "=", "this", ".", "getMessageIn", "(", "recMessageProcessInfo", ")", ";", "if", "(", "recMessageInfo", "!=", "null", ")", "{", "String", "name", "=", "this", ".", "fixName", "(", "recMessageInfo", ".", "getField", "(", "MessageInfo", ".", "DESCRIPTION", ")", ".", "toString", "(", ")", ")", ";", "if", "(", "this", ".", "isNewType", "(", "name", ")", ")", "{", "this", ".", "addMessage", "(", "version", ",", "descriptionType", ",", "recMessageInfo", ")", ";", "}", "}", "recMessageInfo", "=", "this", ".", "getMessageOut", "(", "recMessageProcessInfo", ")", ";", "if", "(", "recMessageInfo", "!=", "null", ")", "{", "String", "name", "=", "this", ".", "fixName", "(", "recMessageInfo", ".", "getField", "(", "MessageInfo", ".", "DESCRIPTION", ")", ".", "toString", "(", ")", ")", ";", "if", "(", "this", ".", "isNewType", "(", "name", ")", ")", "{", "this", ".", "addMessage", "(", "version", ",", "descriptionType", ",", "recMessageInfo", ")", ";", "}", "}", "}" ]
AddMessageType Method.
[ "AddMessageType", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL11.java#L326-L347
152,919
jbundle/jbundle
main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL11.java
CreateWSDL11.addMessage
public void addMessage(String version, TDefinitions descriptionType, MessageInfo recMessageInfo) { TMessage messageType = wsdlFactory.createTMessage(); descriptionType.getAnyTopLevelOptionalElement().add(messageType); String strMessageName = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString()); messageType.setName(strMessageName); TPart TPart = wsdlFactory.createTPart(); messageType.getPart().add(TPart); TPart.setName(strMessageName); String interfacens = this.getNamespace(); String interfacename = this.fixName(recMessageInfo.getField(MessageInfo.CODE).toString()); QName qname = new QName(interfacens, interfacename); TPart.setElement(qname); }
java
public void addMessage(String version, TDefinitions descriptionType, MessageInfo recMessageInfo) { TMessage messageType = wsdlFactory.createTMessage(); descriptionType.getAnyTopLevelOptionalElement().add(messageType); String strMessageName = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString()); messageType.setName(strMessageName); TPart TPart = wsdlFactory.createTPart(); messageType.getPart().add(TPart); TPart.setName(strMessageName); String interfacens = this.getNamespace(); String interfacename = this.fixName(recMessageInfo.getField(MessageInfo.CODE).toString()); QName qname = new QName(interfacens, interfacename); TPart.setElement(qname); }
[ "public", "void", "addMessage", "(", "String", "version", ",", "TDefinitions", "descriptionType", ",", "MessageInfo", "recMessageInfo", ")", "{", "TMessage", "messageType", "=", "wsdlFactory", ".", "createTMessage", "(", ")", ";", "descriptionType", ".", "getAnyTopLevelOptionalElement", "(", ")", ".", "add", "(", "messageType", ")", ";", "String", "strMessageName", "=", "this", ".", "fixName", "(", "recMessageInfo", ".", "getField", "(", "MessageInfo", ".", "DESCRIPTION", ")", ".", "toString", "(", ")", ")", ";", "messageType", ".", "setName", "(", "strMessageName", ")", ";", "TPart", "TPart", "=", "wsdlFactory", ".", "createTPart", "(", ")", ";", "messageType", ".", "getPart", "(", ")", ".", "add", "(", "TPart", ")", ";", "TPart", ".", "setName", "(", "strMessageName", ")", ";", "String", "interfacens", "=", "this", ".", "getNamespace", "(", ")", ";", "String", "interfacename", "=", "this", ".", "fixName", "(", "recMessageInfo", ".", "getField", "(", "MessageInfo", ".", "CODE", ")", ".", "toString", "(", ")", ")", ";", "QName", "qname", "=", "new", "QName", "(", "interfacens", ",", "interfacename", ")", ";", "TPart", ".", "setElement", "(", "qname", ")", ";", "}" ]
AddMessage Method.
[ "AddMessage", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg.wsdl/src/main/java/org/jbundle/main/msg/wsdl/CreateWSDL11.java#L351-L364
152,920
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.isCellEditable
public boolean isCellEditable(int iRowIndex, int iColumnIndex) { FieldList fieldList = this.makeRowCurrent(iRowIndex, false); if (fieldList != null) if (fieldList.getEditMode() == Constants.EDIT_NONE) if ((m_iLastRecord == RECORD_UNKNOWN) || (iRowIndex != m_iLastRecord + 1)) return false; // Don't allow changes to deleted records return true; // All my fields are editable }
java
public boolean isCellEditable(int iRowIndex, int iColumnIndex) { FieldList fieldList = this.makeRowCurrent(iRowIndex, false); if (fieldList != null) if (fieldList.getEditMode() == Constants.EDIT_NONE) if ((m_iLastRecord == RECORD_UNKNOWN) || (iRowIndex != m_iLastRecord + 1)) return false; // Don't allow changes to deleted records return true; // All my fields are editable }
[ "public", "boolean", "isCellEditable", "(", "int", "iRowIndex", ",", "int", "iColumnIndex", ")", "{", "FieldList", "fieldList", "=", "this", ".", "makeRowCurrent", "(", "iRowIndex", ",", "false", ")", ";", "if", "(", "fieldList", "!=", "null", ")", "if", "(", "fieldList", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_NONE", ")", "if", "(", "(", "m_iLastRecord", "==", "RECORD_UNKNOWN", ")", "||", "(", "iRowIndex", "!=", "m_iLastRecord", "+", "1", ")", ")", "return", "false", ";", "// Don't allow changes to deleted records", "return", "true", ";", "// All my fields are editable", "}" ]
Is this cell editable. @return true unless this is a deleted record.
[ "Is", "this", "cell", "editable", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L184-L191
152,921
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.setValueAt
public void setValueAt(Object aValue, int iRowIndex, int iColumnIndex) { try { this.updateIfNewRow(iRowIndex); // Update old if new row boolean bPhysicallyLockRecord = true; // Fix this? if (this.getFieldInfo(iColumnIndex) == null) bPhysicallyLockRecord = false; // No need to lock if this control isn't tied into a field. // Note: The record has to be locked in case there are any behaviors that change other fields and lock the record. // This code was originally designed to change the fields in the buffer, then update the record when the row changed // Unfortunately, if there was a listener that locked the record, the changes to that point would be lost since the record is not locked. FieldList fieldList = this.makeRowCurrent(iRowIndex, bPhysicallyLockRecord); boolean bFieldChanged = this.setColumnValue(iColumnIndex, aValue, Constants.DISPLAY, Constants.SCREEN_MOVE); // if (this.isRecordChanged()) if (bFieldChanged) { this.cacheCurrentLockedData(iRowIndex, fieldList); this.fireTableRowsUpdated(iRowIndex, iRowIndex); } int iRowCount = this.getRowCount(false); if ((this.isAppending()) && (iRowIndex == m_iLastRecord + 1) // Changing a new last row && (iRowCount == m_iLastRecord + 1) && (m_iLastRecord != RECORD_UNKNOWN)) // Last row = new row { // Changing the last row (If changes, add a row) bFieldChanged = this.isRecordChanged(); if ((fieldList.getEditMode() == Constants.EDIT_CURRENT) || (fieldList.getEditMode() == Constants.EDIT_IN_PROGRESS)) { m_iLastRecord++; // Special case (A listener possibly wrote and refreshed the record) bFieldChanged = true; } if (bFieldChanged) { // Currently adding a new record to the end, so add a blank for a new next record this.setRowCount(iRowCount + 1); // new EOF this.fireTableRowsInserted(iRowCount + 1, iRowCount + 1); } } if (this.getSelectedRow() != iRowIndex) this.updateIfNewRow(this.getSelectedRow()); // If no longer selected, update it! } catch (Exception ex) { ex.printStackTrace(); } }
java
public void setValueAt(Object aValue, int iRowIndex, int iColumnIndex) { try { this.updateIfNewRow(iRowIndex); // Update old if new row boolean bPhysicallyLockRecord = true; // Fix this? if (this.getFieldInfo(iColumnIndex) == null) bPhysicallyLockRecord = false; // No need to lock if this control isn't tied into a field. // Note: The record has to be locked in case there are any behaviors that change other fields and lock the record. // This code was originally designed to change the fields in the buffer, then update the record when the row changed // Unfortunately, if there was a listener that locked the record, the changes to that point would be lost since the record is not locked. FieldList fieldList = this.makeRowCurrent(iRowIndex, bPhysicallyLockRecord); boolean bFieldChanged = this.setColumnValue(iColumnIndex, aValue, Constants.DISPLAY, Constants.SCREEN_MOVE); // if (this.isRecordChanged()) if (bFieldChanged) { this.cacheCurrentLockedData(iRowIndex, fieldList); this.fireTableRowsUpdated(iRowIndex, iRowIndex); } int iRowCount = this.getRowCount(false); if ((this.isAppending()) && (iRowIndex == m_iLastRecord + 1) // Changing a new last row && (iRowCount == m_iLastRecord + 1) && (m_iLastRecord != RECORD_UNKNOWN)) // Last row = new row { // Changing the last row (If changes, add a row) bFieldChanged = this.isRecordChanged(); if ((fieldList.getEditMode() == Constants.EDIT_CURRENT) || (fieldList.getEditMode() == Constants.EDIT_IN_PROGRESS)) { m_iLastRecord++; // Special case (A listener possibly wrote and refreshed the record) bFieldChanged = true; } if (bFieldChanged) { // Currently adding a new record to the end, so add a blank for a new next record this.setRowCount(iRowCount + 1); // new EOF this.fireTableRowsInserted(iRowCount + 1, iRowCount + 1); } } if (this.getSelectedRow() != iRowIndex) this.updateIfNewRow(this.getSelectedRow()); // If no longer selected, update it! } catch (Exception ex) { ex.printStackTrace(); } }
[ "public", "void", "setValueAt", "(", "Object", "aValue", ",", "int", "iRowIndex", ",", "int", "iColumnIndex", ")", "{", "try", "{", "this", ".", "updateIfNewRow", "(", "iRowIndex", ")", ";", "// Update old if new row", "boolean", "bPhysicallyLockRecord", "=", "true", ";", "// Fix this?", "if", "(", "this", ".", "getFieldInfo", "(", "iColumnIndex", ")", "==", "null", ")", "bPhysicallyLockRecord", "=", "false", ";", "// No need to lock if this control isn't tied into a field.", "// Note: The record has to be locked in case there are any behaviors that change other fields and lock the record.", "// This code was originally designed to change the fields in the buffer, then update the record when the row changed", "// Unfortunately, if there was a listener that locked the record, the changes to that point would be lost since the record is not locked.", "FieldList", "fieldList", "=", "this", ".", "makeRowCurrent", "(", "iRowIndex", ",", "bPhysicallyLockRecord", ")", ";", "boolean", "bFieldChanged", "=", "this", ".", "setColumnValue", "(", "iColumnIndex", ",", "aValue", ",", "Constants", ".", "DISPLAY", ",", "Constants", ".", "SCREEN_MOVE", ")", ";", "// if (this.isRecordChanged())", "if", "(", "bFieldChanged", ")", "{", "this", ".", "cacheCurrentLockedData", "(", "iRowIndex", ",", "fieldList", ")", ";", "this", ".", "fireTableRowsUpdated", "(", "iRowIndex", ",", "iRowIndex", ")", ";", "}", "int", "iRowCount", "=", "this", ".", "getRowCount", "(", "false", ")", ";", "if", "(", "(", "this", ".", "isAppending", "(", ")", ")", "&&", "(", "iRowIndex", "==", "m_iLastRecord", "+", "1", ")", "// Changing a new last row", "&&", "(", "iRowCount", "==", "m_iLastRecord", "+", "1", ")", "&&", "(", "m_iLastRecord", "!=", "RECORD_UNKNOWN", ")", ")", "// Last row = new row", "{", "// Changing the last row (If changes, add a row)", "bFieldChanged", "=", "this", ".", "isRecordChanged", "(", ")", ";", "if", "(", "(", "fieldList", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_CURRENT", ")", "||", "(", "fieldList", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_IN_PROGRESS", ")", ")", "{", "m_iLastRecord", "++", ";", "// Special case (A listener possibly wrote and refreshed the record)", "bFieldChanged", "=", "true", ";", "}", "if", "(", "bFieldChanged", ")", "{", "// Currently adding a new record to the end, so add a blank for a new next record", "this", ".", "setRowCount", "(", "iRowCount", "+", "1", ")", ";", "// new EOF", "this", ".", "fireTableRowsInserted", "(", "iRowCount", "+", "1", ",", "iRowCount", "+", "1", ")", ";", "}", "}", "if", "(", "this", ".", "getSelectedRow", "(", ")", "!=", "iRowIndex", ")", "this", ".", "updateIfNewRow", "(", "this", ".", "getSelectedRow", "(", ")", ")", ";", "// If no longer selected, update it!", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Set the value at this location. @param aValue The raw-data value to set. @param iRowIndex The row. @param iColumnIndex The column.
[ "Set", "the", "value", "at", "this", "location", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L198-L237
152,922
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.cacheCurrentLockedData
public BaseBuffer cacheCurrentLockedData(int iRowIndex, FieldList fieldList) { int iColumnCount = this.getColumnCount(); if ((m_buffCurrentLockedData == null) || (m_iCurrentLockedRowIndex != iRowIndex)) m_buffCurrentLockedData = new VectorBuffer(null, BaseBuffer.ALL_FIELDS); m_buffCurrentLockedData.fieldsToBuffer(fieldList); for (int i = 0; i < iColumnCount; i++) { // Cache the non-field data Field field = null; if (this.getFieldInfo(i) != null) field = this.getFieldInfo(i).getField(); if ((field != null) && (field.getRecord() != fieldList)) m_buffCurrentLockedData.addNextString(field.toString()); } m_iCurrentLockedRowIndex = iRowIndex; return m_buffCurrentLockedData; }
java
public BaseBuffer cacheCurrentLockedData(int iRowIndex, FieldList fieldList) { int iColumnCount = this.getColumnCount(); if ((m_buffCurrentLockedData == null) || (m_iCurrentLockedRowIndex != iRowIndex)) m_buffCurrentLockedData = new VectorBuffer(null, BaseBuffer.ALL_FIELDS); m_buffCurrentLockedData.fieldsToBuffer(fieldList); for (int i = 0; i < iColumnCount; i++) { // Cache the non-field data Field field = null; if (this.getFieldInfo(i) != null) field = this.getFieldInfo(i).getField(); if ((field != null) && (field.getRecord() != fieldList)) m_buffCurrentLockedData.addNextString(field.toString()); } m_iCurrentLockedRowIndex = iRowIndex; return m_buffCurrentLockedData; }
[ "public", "BaseBuffer", "cacheCurrentLockedData", "(", "int", "iRowIndex", ",", "FieldList", "fieldList", ")", "{", "int", "iColumnCount", "=", "this", ".", "getColumnCount", "(", ")", ";", "if", "(", "(", "m_buffCurrentLockedData", "==", "null", ")", "||", "(", "m_iCurrentLockedRowIndex", "!=", "iRowIndex", ")", ")", "m_buffCurrentLockedData", "=", "new", "VectorBuffer", "(", "null", ",", "BaseBuffer", ".", "ALL_FIELDS", ")", ";", "m_buffCurrentLockedData", ".", "fieldsToBuffer", "(", "fieldList", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "iColumnCount", ";", "i", "++", ")", "{", "// Cache the non-field data", "Field", "field", "=", "null", ";", "if", "(", "this", ".", "getFieldInfo", "(", "i", ")", "!=", "null", ")", "field", "=", "this", ".", "getFieldInfo", "(", "i", ")", ".", "getField", "(", ")", ";", "if", "(", "(", "field", "!=", "null", ")", "&&", "(", "field", ".", "getRecord", "(", ")", "!=", "fieldList", ")", ")", "m_buffCurrentLockedData", ".", "addNextString", "(", "field", ".", "toString", "(", ")", ")", ";", "}", "m_iCurrentLockedRowIndex", "=", "iRowIndex", ";", "return", "m_buffCurrentLockedData", ";", "}" ]
Get the array of changed values for the current row. I use a standard field buffer and append all the screen items which are not included in the field. @param iRowIndex The row to get the data for. @return The array of data for the currently locked row.
[ "Get", "the", "array", "of", "changed", "values", "for", "the", "current", "row", ".", "I", "use", "a", "standard", "field", "buffer", "and", "append", "all", "the", "screen", "items", "which", "are", "not", "included", "in", "the", "field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L245-L261
152,923
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.restoreCurrentRecord
public void restoreCurrentRecord(FieldList fieldList) { m_buffCurrentLockedData.bufferToFields(fieldList, Constants.DONT_DISPLAY, Constants.READ_MOVE); int iColumnCount = this.getColumnCount(); for (int i = 0; i < iColumnCount; i++) { // Cache the non-field data Field field = null; if (this.getFieldInfo(i) != null) field = this.getFieldInfo(i).getField(); if ((field != null) && (field.getRecord() != fieldList)) field.setString(m_buffCurrentLockedData.getNextString(), Constants.DONT_DISPLAY, Constants.READ_MOVE); } }
java
public void restoreCurrentRecord(FieldList fieldList) { m_buffCurrentLockedData.bufferToFields(fieldList, Constants.DONT_DISPLAY, Constants.READ_MOVE); int iColumnCount = this.getColumnCount(); for (int i = 0; i < iColumnCount; i++) { // Cache the non-field data Field field = null; if (this.getFieldInfo(i) != null) field = this.getFieldInfo(i).getField(); if ((field != null) && (field.getRecord() != fieldList)) field.setString(m_buffCurrentLockedData.getNextString(), Constants.DONT_DISPLAY, Constants.READ_MOVE); } }
[ "public", "void", "restoreCurrentRecord", "(", "FieldList", "fieldList", ")", "{", "m_buffCurrentLockedData", ".", "bufferToFields", "(", "fieldList", ",", "Constants", ".", "DONT_DISPLAY", ",", "Constants", ".", "READ_MOVE", ")", ";", "int", "iColumnCount", "=", "this", ".", "getColumnCount", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "iColumnCount", ";", "i", "++", ")", "{", "// Cache the non-field data", "Field", "field", "=", "null", ";", "if", "(", "this", ".", "getFieldInfo", "(", "i", ")", "!=", "null", ")", "field", "=", "this", ".", "getFieldInfo", "(", "i", ")", ".", "getField", "(", ")", ";", "if", "(", "(", "field", "!=", "null", ")", "&&", "(", "field", ".", "getRecord", "(", ")", "!=", "fieldList", ")", ")", "field", ".", "setString", "(", "m_buffCurrentLockedData", ".", "getNextString", "(", ")", ",", "Constants", ".", "DONT_DISPLAY", ",", "Constants", ".", "READ_MOVE", ")", ";", "}", "}" ]
Restore this fieldlist with items from the input cache. I use a standard field buffer and append all the screen items which are not included in the field. @param fieldList The record to fill with the data.
[ "Restore", "this", "fieldlist", "with", "items", "from", "the", "input", "cache", ".", "I", "use", "a", "standard", "field", "buffer", "and", "append", "all", "the", "screen", "items", "which", "are", "not", "included", "in", "the", "field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L268-L281
152,924
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.setColumnValue
public boolean setColumnValue(int iColumnIndex, Object value, boolean bDisplay, int iMoveMode) { Convert fieldInfo = this.getFieldInfo(iColumnIndex); if (fieldInfo != null) { Object dataBefore = fieldInfo.getData(); if (!(value instanceof String)) fieldInfo.setData(value, bDisplay, iMoveMode); else fieldInfo.setString((String)value, bDisplay, iMoveMode); Object dataAfter = fieldInfo.getData(); if (dataBefore == null) return (dataAfter != null); else return (!dataBefore.equals(dataAfter)); } return false; }
java
public boolean setColumnValue(int iColumnIndex, Object value, boolean bDisplay, int iMoveMode) { Convert fieldInfo = this.getFieldInfo(iColumnIndex); if (fieldInfo != null) { Object dataBefore = fieldInfo.getData(); if (!(value instanceof String)) fieldInfo.setData(value, bDisplay, iMoveMode); else fieldInfo.setString((String)value, bDisplay, iMoveMode); Object dataAfter = fieldInfo.getData(); if (dataBefore == null) return (dataAfter != null); else return (!dataBefore.equals(dataAfter)); } return false; }
[ "public", "boolean", "setColumnValue", "(", "int", "iColumnIndex", ",", "Object", "value", ",", "boolean", "bDisplay", ",", "int", "iMoveMode", ")", "{", "Convert", "fieldInfo", "=", "this", ".", "getFieldInfo", "(", "iColumnIndex", ")", ";", "if", "(", "fieldInfo", "!=", "null", ")", "{", "Object", "dataBefore", "=", "fieldInfo", ".", "getData", "(", ")", ";", "if", "(", "!", "(", "value", "instanceof", "String", ")", ")", "fieldInfo", ".", "setData", "(", "value", ",", "bDisplay", ",", "iMoveMode", ")", ";", "else", "fieldInfo", ".", "setString", "(", "(", "String", ")", "value", ",", "bDisplay", ",", "iMoveMode", ")", ";", "Object", "dataAfter", "=", "fieldInfo", ".", "getData", "(", ")", ";", "if", "(", "dataBefore", "==", "null", ")", "return", "(", "dataAfter", "!=", "null", ")", ";", "else", "return", "(", "!", "dataBefore", ".", "equals", "(", "dataAfter", ")", ")", ";", "}", "return", "false", ";", "}" ]
Set the value at the field at the column. Since this is only used by the restore current record method, pass dont_display and read_move when you set the data. This is NOT a TableModel override, this is my method. @param iColumnIndex The column. @param value The raw data value or string to set. @return True if the value at this cell changed.
[ "Set", "the", "value", "at", "the", "field", "at", "the", "column", ".", "Since", "this", "is", "only", "used", "by", "the", "restore", "current", "record", "method", "pass", "dont_display", "and", "read_move", "when", "you", "set", "the", "data", ".", "This", "is", "NOT", "a", "TableModel", "override", "this", "is", "my", "method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L291-L308
152,925
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.getValueAt
public Object getValueAt(int iRowIndex, int iColumnIndex) { int iEditMode = Constants.EDIT_NONE; try { if (iRowIndex >= 0) { FieldList fieldList = this.makeRowCurrent(iRowIndex, false); if (fieldList != null) iEditMode = fieldList.getEditMode(); } } catch (Exception ex) { ex.printStackTrace(); } return this.getColumnValue(iColumnIndex, iEditMode); }
java
public Object getValueAt(int iRowIndex, int iColumnIndex) { int iEditMode = Constants.EDIT_NONE; try { if (iRowIndex >= 0) { FieldList fieldList = this.makeRowCurrent(iRowIndex, false); if (fieldList != null) iEditMode = fieldList.getEditMode(); } } catch (Exception ex) { ex.printStackTrace(); } return this.getColumnValue(iColumnIndex, iEditMode); }
[ "public", "Object", "getValueAt", "(", "int", "iRowIndex", ",", "int", "iColumnIndex", ")", "{", "int", "iEditMode", "=", "Constants", ".", "EDIT_NONE", ";", "try", "{", "if", "(", "iRowIndex", ">=", "0", ")", "{", "FieldList", "fieldList", "=", "this", ".", "makeRowCurrent", "(", "iRowIndex", ",", "false", ")", ";", "if", "(", "fieldList", "!=", "null", ")", "iEditMode", "=", "fieldList", ".", "getEditMode", "(", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "return", "this", ".", "getColumnValue", "(", "iColumnIndex", ",", "iEditMode", ")", ";", "}" ]
Get the value at this location. @param iRowIndex The row. @param iColumnIndex The column. @return The raw data at this location.
[ "Get", "the", "value", "at", "this", "location", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L315-L329
152,926
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.getColumnValue
public Object getColumnValue(int iColumnIndex, int iEditMode) { Convert fieldInfo = this.getFieldInfo(iColumnIndex); if (fieldInfo != null) return fieldInfo.getString(); return Constants.BLANK; }
java
public Object getColumnValue(int iColumnIndex, int iEditMode) { Convert fieldInfo = this.getFieldInfo(iColumnIndex); if (fieldInfo != null) return fieldInfo.getString(); return Constants.BLANK; }
[ "public", "Object", "getColumnValue", "(", "int", "iColumnIndex", ",", "int", "iEditMode", ")", "{", "Convert", "fieldInfo", "=", "this", ".", "getFieldInfo", "(", "iColumnIndex", ")", ";", "if", "(", "fieldInfo", "!=", "null", ")", "return", "fieldInfo", ".", "getString", "(", ")", ";", "return", "Constants", ".", "BLANK", ";", "}" ]
Get the value of the field at the column. This is NOT a TableModel override, this is my method. @param iColumnIndex The column. @return The string at this location.
[ "Get", "the", "value", "of", "the", "field", "at", "the", "column", ".", "This", "is", "NOT", "a", "TableModel", "override", "this", "is", "my", "method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L336-L342
152,927
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.removeTableModelListener
public void removeTableModelListener(TableModelListener l) { try { this.updateIfNewRow(-1); // Update any locked record. } catch (DBException ex) { ex.printStackTrace(); } super.removeTableModelListener(l); }
java
public void removeTableModelListener(TableModelListener l) { try { this.updateIfNewRow(-1); // Update any locked record. } catch (DBException ex) { ex.printStackTrace(); } super.removeTableModelListener(l); }
[ "public", "void", "removeTableModelListener", "(", "TableModelListener", "l", ")", "{", "try", "{", "this", ".", "updateIfNewRow", "(", "-", "1", ")", ";", "// Update any locked record.", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "super", ".", "removeTableModelListener", "(", "l", ")", ";", "}" ]
This is called when the model is no longer need by the JTable, so update any current record. @param l The table model listener to remove.
[ "This", "is", "called", "when", "the", "model", "is", "no", "longer", "need", "by", "the", "JTable", "so", "update", "any", "current", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L348-L356
152,928
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.resetTheModel
public void resetTheModel() { this.setRowCount(START_ROWS); // Theoretical EOF value for table scroller (Actual when known). m_iLastRecord = RECORD_UNKNOWN; // When EOF is known m_iLargestValidRecord = -1; this.setCurrentRow(-1); m_iCurrentLockedRowIndex = -1; this.fireTableChanged(new TableModelEvent(this)); // Entire table changed }
java
public void resetTheModel() { this.setRowCount(START_ROWS); // Theoretical EOF value for table scroller (Actual when known). m_iLastRecord = RECORD_UNKNOWN; // When EOF is known m_iLargestValidRecord = -1; this.setCurrentRow(-1); m_iCurrentLockedRowIndex = -1; this.fireTableChanged(new TableModelEvent(this)); // Entire table changed }
[ "public", "void", "resetTheModel", "(", ")", "{", "this", ".", "setRowCount", "(", "START_ROWS", ")", ";", "// Theoretical EOF value for table scroller (Actual when known).", "m_iLastRecord", "=", "RECORD_UNKNOWN", ";", "// When EOF is known", "m_iLargestValidRecord", "=", "-", "1", ";", "this", ".", "setCurrentRow", "(", "-", "1", ")", ";", "m_iCurrentLockedRowIndex", "=", "-", "1", ";", "this", ".", "fireTableChanged", "(", "new", "TableModelEvent", "(", "this", ")", ")", ";", "// Entire table changed", "}" ]
The underlying query changed, reset the model.
[ "The", "underlying", "query", "changed", "reset", "the", "model", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L376-L384
152,929
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.updateIfNewRow
public void updateIfNewRow(int iRowIndex) throws DBException { if ((m_iCurrentLockedRowIndex != -1) && (m_iCurrentLockedRowIndex != iRowIndex)) if (m_buffCurrentLockedData != null) { { FieldList fieldList = this.makeRowCurrent(m_iCurrentLockedRowIndex, false); // Read this row if it isn't current if (this.isRecordChanged()) { // Only update if there are changes. synchronized (this) { // This time do the physical read (last time I asked for the cache) DBException ex = null; fieldList = this.makeRowCurrent(m_iCurrentLockedRowIndex, true); // Read this row if it isn't current if ((this.isAppending()) && ((m_iCurrentLockedRowIndex == m_iLastRecord + 1) && (m_iLastRecord != RECORD_UNKNOWN))) { m_table.add(fieldList); // New record = add this.setCurrentRow(-1); // Make sure I don't try to use this unknown record without re-reading it. if (m_iLastRecord != RECORD_UNKNOWN) // Could have been set in 'add' m_iLastRecord++; } else { if ((fieldList.getEditMode() == Constants.EDIT_CURRENT) || (fieldList.getEditMode() == Constants.EDIT_IN_PROGRESS)) { try { m_table.set(fieldList); // Current record = set } catch (DBException e) { ex = e; } } this.setCurrentRow(-1); // Can't use current record anymore } m_iCurrentLockedRowIndex = -1; m_buffCurrentLockedData = null; if (ex != null) throw ex; } } } } }
java
public void updateIfNewRow(int iRowIndex) throws DBException { if ((m_iCurrentLockedRowIndex != -1) && (m_iCurrentLockedRowIndex != iRowIndex)) if (m_buffCurrentLockedData != null) { { FieldList fieldList = this.makeRowCurrent(m_iCurrentLockedRowIndex, false); // Read this row if it isn't current if (this.isRecordChanged()) { // Only update if there are changes. synchronized (this) { // This time do the physical read (last time I asked for the cache) DBException ex = null; fieldList = this.makeRowCurrent(m_iCurrentLockedRowIndex, true); // Read this row if it isn't current if ((this.isAppending()) && ((m_iCurrentLockedRowIndex == m_iLastRecord + 1) && (m_iLastRecord != RECORD_UNKNOWN))) { m_table.add(fieldList); // New record = add this.setCurrentRow(-1); // Make sure I don't try to use this unknown record without re-reading it. if (m_iLastRecord != RECORD_UNKNOWN) // Could have been set in 'add' m_iLastRecord++; } else { if ((fieldList.getEditMode() == Constants.EDIT_CURRENT) || (fieldList.getEditMode() == Constants.EDIT_IN_PROGRESS)) { try { m_table.set(fieldList); // Current record = set } catch (DBException e) { ex = e; } } this.setCurrentRow(-1); // Can't use current record anymore } m_iCurrentLockedRowIndex = -1; m_buffCurrentLockedData = null; if (ex != null) throw ex; } } } } }
[ "public", "void", "updateIfNewRow", "(", "int", "iRowIndex", ")", "throws", "DBException", "{", "if", "(", "(", "m_iCurrentLockedRowIndex", "!=", "-", "1", ")", "&&", "(", "m_iCurrentLockedRowIndex", "!=", "iRowIndex", ")", ")", "if", "(", "m_buffCurrentLockedData", "!=", "null", ")", "{", "{", "FieldList", "fieldList", "=", "this", ".", "makeRowCurrent", "(", "m_iCurrentLockedRowIndex", ",", "false", ")", ";", "// Read this row if it isn't current", "if", "(", "this", ".", "isRecordChanged", "(", ")", ")", "{", "// Only update if there are changes.", "synchronized", "(", "this", ")", "{", "// This time do the physical read (last time I asked for the cache)", "DBException", "ex", "=", "null", ";", "fieldList", "=", "this", ".", "makeRowCurrent", "(", "m_iCurrentLockedRowIndex", ",", "true", ")", ";", "// Read this row if it isn't current", "if", "(", "(", "this", ".", "isAppending", "(", ")", ")", "&&", "(", "(", "m_iCurrentLockedRowIndex", "==", "m_iLastRecord", "+", "1", ")", "&&", "(", "m_iLastRecord", "!=", "RECORD_UNKNOWN", ")", ")", ")", "{", "m_table", ".", "add", "(", "fieldList", ")", ";", "// New record = add", "this", ".", "setCurrentRow", "(", "-", "1", ")", ";", "// Make sure I don't try to use this unknown record without re-reading it.", "if", "(", "m_iLastRecord", "!=", "RECORD_UNKNOWN", ")", "// Could have been set in 'add'", "m_iLastRecord", "++", ";", "}", "else", "{", "if", "(", "(", "fieldList", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_CURRENT", ")", "||", "(", "fieldList", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_IN_PROGRESS", ")", ")", "{", "try", "{", "m_table", ".", "set", "(", "fieldList", ")", ";", "// Current record = set", "}", "catch", "(", "DBException", "e", ")", "{", "ex", "=", "e", ";", "}", "}", "this", ".", "setCurrentRow", "(", "-", "1", ")", ";", "// Can't use current record anymore", "}", "m_iCurrentLockedRowIndex", "=", "-", "1", ";", "m_buffCurrentLockedData", "=", "null", ";", "if", "(", "ex", "!=", "null", ")", "throw", "ex", ";", "}", "}", "}", "}", "}" ]
Update the currently updated record if the row is different from this row. @param iRowIndex Row to read... If different from current record, update current. If -1, update and don't read.
[ "Update", "the", "currently", "updated", "record", "if", "the", "row", "is", "different", "from", "this", "row", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L509-L551
152,930
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.addMouseListenerToHeaderInTable
public void addMouseListenerToHeaderInTable(JTable table) { table.setColumnSelectionAllowed(false); MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getSource() instanceof JTableHeader) { // Always JTableHeader tableHeader = (JTableHeader)e.getSource(); TableColumnModel columnModel = tableHeader.getColumnModel(); int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int column = tableHeader.getTable().convertColumnIndexToModel(viewColumn); if(e.getClickCount() == 1 && column != -1) { boolean order = Constants.ASCENDING; if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0) order = !order; if (!(tableHeader.getDefaultRenderer() instanceof SortableHeaderRenderer)) tableHeader.setDefaultRenderer(new SortableHeaderRenderer(tableHeader.getDefaultRenderer())); // Set up header renderer the first time if ((((SortableHeaderRenderer)tableHeader.getDefaultRenderer()).getSortedByColumn() == viewColumn) && (((SortableHeaderRenderer)tableHeader.getDefaultRenderer()).getSortedOrder() == order)) order = !order; column = columnToFieldColumn(column); boolean bSuccess = sortByColumn(column, order); if (bSuccess) setSortedByColumn(tableHeader, viewColumn, order); } } } }; table.getTableHeader().addMouseListener(mouseListener); }
java
public void addMouseListenerToHeaderInTable(JTable table) { table.setColumnSelectionAllowed(false); MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getSource() instanceof JTableHeader) { // Always JTableHeader tableHeader = (JTableHeader)e.getSource(); TableColumnModel columnModel = tableHeader.getColumnModel(); int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int column = tableHeader.getTable().convertColumnIndexToModel(viewColumn); if(e.getClickCount() == 1 && column != -1) { boolean order = Constants.ASCENDING; if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0) order = !order; if (!(tableHeader.getDefaultRenderer() instanceof SortableHeaderRenderer)) tableHeader.setDefaultRenderer(new SortableHeaderRenderer(tableHeader.getDefaultRenderer())); // Set up header renderer the first time if ((((SortableHeaderRenderer)tableHeader.getDefaultRenderer()).getSortedByColumn() == viewColumn) && (((SortableHeaderRenderer)tableHeader.getDefaultRenderer()).getSortedOrder() == order)) order = !order; column = columnToFieldColumn(column); boolean bSuccess = sortByColumn(column, order); if (bSuccess) setSortedByColumn(tableHeader, viewColumn, order); } } } }; table.getTableHeader().addMouseListener(mouseListener); }
[ "public", "void", "addMouseListenerToHeaderInTable", "(", "JTable", "table", ")", "{", "table", ".", "setColumnSelectionAllowed", "(", "false", ")", ";", "MouseListener", "mouseListener", "=", "new", "MouseAdapter", "(", ")", "{", "public", "void", "mouseClicked", "(", "MouseEvent", "e", ")", "{", "if", "(", "e", ".", "getSource", "(", ")", "instanceof", "JTableHeader", ")", "{", "// Always", "JTableHeader", "tableHeader", "=", "(", "JTableHeader", ")", "e", ".", "getSource", "(", ")", ";", "TableColumnModel", "columnModel", "=", "tableHeader", ".", "getColumnModel", "(", ")", ";", "int", "viewColumn", "=", "columnModel", ".", "getColumnIndexAtX", "(", "e", ".", "getX", "(", ")", ")", ";", "int", "column", "=", "tableHeader", ".", "getTable", "(", ")", ".", "convertColumnIndexToModel", "(", "viewColumn", ")", ";", "if", "(", "e", ".", "getClickCount", "(", ")", "==", "1", "&&", "column", "!=", "-", "1", ")", "{", "boolean", "order", "=", "Constants", ".", "ASCENDING", ";", "if", "(", "(", "e", ".", "getModifiers", "(", ")", "&", "InputEvent", ".", "SHIFT_MASK", ")", "!=", "0", ")", "order", "=", "!", "order", ";", "if", "(", "!", "(", "tableHeader", ".", "getDefaultRenderer", "(", ")", "instanceof", "SortableHeaderRenderer", ")", ")", "tableHeader", ".", "setDefaultRenderer", "(", "new", "SortableHeaderRenderer", "(", "tableHeader", ".", "getDefaultRenderer", "(", ")", ")", ")", ";", "// Set up header renderer the first time", "if", "(", "(", "(", "(", "SortableHeaderRenderer", ")", "tableHeader", ".", "getDefaultRenderer", "(", ")", ")", ".", "getSortedByColumn", "(", ")", "==", "viewColumn", ")", "&&", "(", "(", "(", "SortableHeaderRenderer", ")", "tableHeader", ".", "getDefaultRenderer", "(", ")", ")", ".", "getSortedOrder", "(", ")", "==", "order", ")", ")", "order", "=", "!", "order", ";", "column", "=", "columnToFieldColumn", "(", "column", ")", ";", "boolean", "bSuccess", "=", "sortByColumn", "(", "column", ",", "order", ")", ";", "if", "(", "bSuccess", ")", "setSortedByColumn", "(", "tableHeader", ",", "viewColumn", ",", "order", ")", ";", "}", "}", "}", "}", ";", "table", ".", "getTableHeader", "(", ")", ".", "addMouseListener", "(", "mouseListener", ")", ";", "}" ]
There is no-where else to put this. Add a mouse listener to the Table to trigger a table sort when a column heading is clicked in the JTable. @param table The table to listen for a header mouse click.
[ "There", "is", "no", "-", "where", "else", "to", "put", "this", ".", "Add", "a", "mouse", "listener", "to", "the", "Table", "to", "trigger", "a", "table", "sort", "when", "a", "column", "heading", "is", "clicked", "in", "the", "JTable", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L680-L712
152,931
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.setSortedByColumn
public void setSortedByColumn(JTableHeader tableHeader, int iViewColumn, boolean bOrder) { if (!(tableHeader.getDefaultRenderer() instanceof SortableHeaderRenderer)) tableHeader.setDefaultRenderer(new SortableHeaderRenderer(tableHeader.getDefaultRenderer())); // Set up header renderer the first time ((SortableHeaderRenderer)tableHeader.getDefaultRenderer()).setSortedByColumn(tableHeader, iViewColumn, bOrder); }
java
public void setSortedByColumn(JTableHeader tableHeader, int iViewColumn, boolean bOrder) { if (!(tableHeader.getDefaultRenderer() instanceof SortableHeaderRenderer)) tableHeader.setDefaultRenderer(new SortableHeaderRenderer(tableHeader.getDefaultRenderer())); // Set up header renderer the first time ((SortableHeaderRenderer)tableHeader.getDefaultRenderer()).setSortedByColumn(tableHeader, iViewColumn, bOrder); }
[ "public", "void", "setSortedByColumn", "(", "JTableHeader", "tableHeader", ",", "int", "iViewColumn", ",", "boolean", "bOrder", ")", "{", "if", "(", "!", "(", "tableHeader", ".", "getDefaultRenderer", "(", ")", "instanceof", "SortableHeaderRenderer", ")", ")", "tableHeader", ".", "setDefaultRenderer", "(", "new", "SortableHeaderRenderer", "(", "tableHeader", ".", "getDefaultRenderer", "(", ")", ")", ")", ";", "// Set up header renderer the first time", "(", "(", "SortableHeaderRenderer", ")", "tableHeader", ".", "getDefaultRenderer", "(", ")", ")", ".", "setSortedByColumn", "(", "tableHeader", ",", "iViewColumn", ",", "bOrder", ")", ";", "}" ]
Change the tableheader to display this sort column and order.
[ "Change", "the", "tableheader", "to", "display", "this", "sort", "column", "and", "order", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L734-L739
152,932
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java
ThinTableModel.displayError
public boolean displayError(Exception ex, Component panel) { if (panel != null) { // Always BaseApplet baseApplet = null; if (panel instanceof BaseApplet) baseApplet = (BaseApplet)panel; else { while ((panel = panel.getParent()) != null) { if (panel instanceof org.jbundle.thin.base.screen.JBasePanel) { baseApplet = ((org.jbundle.thin.base.screen.JBasePanel)panel).getBaseApplet(); break; } } } if (baseApplet != null) { //baseApplet.setLastError(ex.getMessage()); baseApplet.setStatusText(ex.getMessage(), Constants.WARNING); if (ex instanceof DBException) return true; } } return false; }
java
public boolean displayError(Exception ex, Component panel) { if (panel != null) { // Always BaseApplet baseApplet = null; if (panel instanceof BaseApplet) baseApplet = (BaseApplet)panel; else { while ((panel = panel.getParent()) != null) { if (panel instanceof org.jbundle.thin.base.screen.JBasePanel) { baseApplet = ((org.jbundle.thin.base.screen.JBasePanel)panel).getBaseApplet(); break; } } } if (baseApplet != null) { //baseApplet.setLastError(ex.getMessage()); baseApplet.setStatusText(ex.getMessage(), Constants.WARNING); if (ex instanceof DBException) return true; } } return false; }
[ "public", "boolean", "displayError", "(", "Exception", "ex", ",", "Component", "panel", ")", "{", "if", "(", "panel", "!=", "null", ")", "{", "// Always", "BaseApplet", "baseApplet", "=", "null", ";", "if", "(", "panel", "instanceof", "BaseApplet", ")", "baseApplet", "=", "(", "BaseApplet", ")", "panel", ";", "else", "{", "while", "(", "(", "panel", "=", "panel", ".", "getParent", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "panel", "instanceof", "org", ".", "jbundle", ".", "thin", ".", "base", ".", "screen", ".", "JBasePanel", ")", "{", "baseApplet", "=", "(", "(", "org", ".", "jbundle", ".", "thin", ".", "base", ".", "screen", ".", "JBasePanel", ")", "panel", ")", ".", "getBaseApplet", "(", ")", ";", "break", ";", "}", "}", "}", "if", "(", "baseApplet", "!=", "null", ")", "{", "//baseApplet.setLastError(ex.getMessage());", "baseApplet", ".", "setStatusText", "(", "ex", ".", "getMessage", "(", ")", ",", "Constants", ".", "WARNING", ")", ";", "if", "(", "ex", "instanceof", "DBException", ")", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Displayed this error code. @param ex @param source @return True if it was a database exception and the error was displayed
[ "Displayed", "this", "error", "code", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L824-L851
152,933
krotscheck/jersey2-toolkit
jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/factory/HibernateSessionFactoryFactory.java
HibernateSessionFactoryFactory.provide
@Override public SessionFactory provide() { logger.trace("Creating hibernate session factory."); // Build the service registry. SessionFactory factory = new MetadataSources(serviceRegistry) .buildMetadata() .buildSessionFactory(); // Register our event listeners. injectEventListeners(((SessionFactoryImpl) factory) .getServiceRegistry()); return factory; }
java
@Override public SessionFactory provide() { logger.trace("Creating hibernate session factory."); // Build the service registry. SessionFactory factory = new MetadataSources(serviceRegistry) .buildMetadata() .buildSessionFactory(); // Register our event listeners. injectEventListeners(((SessionFactoryImpl) factory) .getServiceRegistry()); return factory; }
[ "@", "Override", "public", "SessionFactory", "provide", "(", ")", "{", "logger", ".", "trace", "(", "\"Creating hibernate session factory.\"", ")", ";", "// Build the service registry.", "SessionFactory", "factory", "=", "new", "MetadataSources", "(", "serviceRegistry", ")", ".", "buildMetadata", "(", ")", ".", "buildSessionFactory", "(", ")", ";", "// Register our event listeners.", "injectEventListeners", "(", "(", "(", "SessionFactoryImpl", ")", "factory", ")", ".", "getServiceRegistry", "(", ")", ")", ";", "return", "factory", ";", "}" ]
Provide a singleton instance of the hibernate session factory. @return A session factory.
[ "Provide", "a", "singleton", "instance", "of", "the", "hibernate", "session", "factory", "." ]
11d757bd222dc82ada462caf6730ba4ff85dae04
https://github.com/krotscheck/jersey2-toolkit/blob/11d757bd222dc82ada462caf6730ba4ff85dae04/jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/factory/HibernateSessionFactoryFactory.java#L96-L110
152,934
krotscheck/jersey2-toolkit
jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/factory/HibernateSessionFactoryFactory.java
HibernateSessionFactoryFactory.dispose
@Override public void dispose(final SessionFactory sessionFactory) { if (sessionFactory != null && !sessionFactory.isClosed()) { logger.info("Disposing of hibernate session factory."); sessionFactory.close(); } }
java
@Override public void dispose(final SessionFactory sessionFactory) { if (sessionFactory != null && !sessionFactory.isClosed()) { logger.info("Disposing of hibernate session factory."); sessionFactory.close(); } }
[ "@", "Override", "public", "void", "dispose", "(", "final", "SessionFactory", "sessionFactory", ")", "{", "if", "(", "sessionFactory", "!=", "null", "&&", "!", "sessionFactory", ".", "isClosed", "(", ")", ")", "{", "logger", ".", "info", "(", "\"Disposing of hibernate session factory.\"", ")", ";", "sessionFactory", ".", "close", "(", ")", ";", "}", "}" ]
Dispose of the hibernate session. @param sessionFactory The session to dispose.
[ "Dispose", "of", "the", "hibernate", "session", "." ]
11d757bd222dc82ada462caf6730ba4ff85dae04
https://github.com/krotscheck/jersey2-toolkit/blob/11d757bd222dc82ada462caf6730ba4ff85dae04/jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/factory/HibernateSessionFactoryFactory.java#L117-L123
152,935
krotscheck/jersey2-toolkit
jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/factory/HibernateSessionFactoryFactory.java
HibernateSessionFactoryFactory.injectEventListeners
private void injectEventListeners(final ServiceRegistry registry) { EventListenerRegistry eventRegistry = registry .getService(EventListenerRegistry.class); List<PostInsertEventListener> postInsertEvents = locator .getAllServices(PostInsertEventListener.class); for (PostInsertEventListener piEventListener : postInsertEvents) { logger.trace("Registering PostInsert: " + piEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_INSERT, piEventListener); } List<PostUpdateEventListener> postUpdateEvents = locator .getAllServices(PostUpdateEventListener.class); for (PostUpdateEventListener puEventListener : postUpdateEvents) { logger.trace("Registering PostUpdate: " + puEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_UPDATE, puEventListener); } List<PostDeleteEventListener> postDeleteEvents = locator .getAllServices(PostDeleteEventListener.class); for (PostDeleteEventListener pdEventListener : postDeleteEvents) { logger.trace("Registering PostDelete: " + pdEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_DELETE, pdEventListener); } List<PreInsertEventListener> preInsertEvents = locator .getAllServices(PreInsertEventListener.class); for (PreInsertEventListener piEventListener : preInsertEvents) { logger.trace("Registering PreInsert: " + piEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.PRE_INSERT, piEventListener); } List<PreUpdateEventListener> preUpdateEvents = locator .getAllServices(PreUpdateEventListener.class); for (PreUpdateEventListener puEventListener : preUpdateEvents) { logger.trace("Registering PreUpdate: " + puEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.PRE_UPDATE, puEventListener); } List<PreDeleteEventListener> preDeleteEvents = locator .getAllServices(PreDeleteEventListener.class); for (PreDeleteEventListener pdEventListener : preDeleteEvents) { logger.trace("Registering PreDelete: " + pdEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.PRE_DELETE, pdEventListener); } List<PostCommitInsertEventListener> pciEvents = locator .getAllServices(PostCommitInsertEventListener.class); for (PostCommitInsertEventListener cpiEventListener : pciEvents) { logger.trace("Registering PostCommitInsert: " + cpiEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_COMMIT_INSERT, cpiEventListener); } List<PostCommitUpdateEventListener> pcuEvents = locator .getAllServices(PostCommitUpdateEventListener.class); for (PostCommitUpdateEventListener cpuEventListener : pcuEvents) { logger.trace("Registering PostCommitUpdate: " + cpuEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_COMMIT_UPDATE, cpuEventListener); } List<PostCommitDeleteEventListener> pcdEvents = locator .getAllServices(PostCommitDeleteEventListener.class); for (PostCommitDeleteEventListener cpdEventListener : pcdEvents) { logger.trace("Registering PostCommitDelete: " + cpdEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_COMMIT_DELETE, cpdEventListener); } }
java
private void injectEventListeners(final ServiceRegistry registry) { EventListenerRegistry eventRegistry = registry .getService(EventListenerRegistry.class); List<PostInsertEventListener> postInsertEvents = locator .getAllServices(PostInsertEventListener.class); for (PostInsertEventListener piEventListener : postInsertEvents) { logger.trace("Registering PostInsert: " + piEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_INSERT, piEventListener); } List<PostUpdateEventListener> postUpdateEvents = locator .getAllServices(PostUpdateEventListener.class); for (PostUpdateEventListener puEventListener : postUpdateEvents) { logger.trace("Registering PostUpdate: " + puEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_UPDATE, puEventListener); } List<PostDeleteEventListener> postDeleteEvents = locator .getAllServices(PostDeleteEventListener.class); for (PostDeleteEventListener pdEventListener : postDeleteEvents) { logger.trace("Registering PostDelete: " + pdEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_DELETE, pdEventListener); } List<PreInsertEventListener> preInsertEvents = locator .getAllServices(PreInsertEventListener.class); for (PreInsertEventListener piEventListener : preInsertEvents) { logger.trace("Registering PreInsert: " + piEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.PRE_INSERT, piEventListener); } List<PreUpdateEventListener> preUpdateEvents = locator .getAllServices(PreUpdateEventListener.class); for (PreUpdateEventListener puEventListener : preUpdateEvents) { logger.trace("Registering PreUpdate: " + puEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.PRE_UPDATE, puEventListener); } List<PreDeleteEventListener> preDeleteEvents = locator .getAllServices(PreDeleteEventListener.class); for (PreDeleteEventListener pdEventListener : preDeleteEvents) { logger.trace("Registering PreDelete: " + pdEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.PRE_DELETE, pdEventListener); } List<PostCommitInsertEventListener> pciEvents = locator .getAllServices(PostCommitInsertEventListener.class); for (PostCommitInsertEventListener cpiEventListener : pciEvents) { logger.trace("Registering PostCommitInsert: " + cpiEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_COMMIT_INSERT, cpiEventListener); } List<PostCommitUpdateEventListener> pcuEvents = locator .getAllServices(PostCommitUpdateEventListener.class); for (PostCommitUpdateEventListener cpuEventListener : pcuEvents) { logger.trace("Registering PostCommitUpdate: " + cpuEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_COMMIT_UPDATE, cpuEventListener); } List<PostCommitDeleteEventListener> pcdEvents = locator .getAllServices(PostCommitDeleteEventListener.class); for (PostCommitDeleteEventListener cpdEventListener : pcdEvents) { logger.trace("Registering PostCommitDelete: " + cpdEventListener .getClass().getCanonicalName()); eventRegistry.appendListeners(EventType.POST_COMMIT_DELETE, cpdEventListener); } }
[ "private", "void", "injectEventListeners", "(", "final", "ServiceRegistry", "registry", ")", "{", "EventListenerRegistry", "eventRegistry", "=", "registry", ".", "getService", "(", "EventListenerRegistry", ".", "class", ")", ";", "List", "<", "PostInsertEventListener", ">", "postInsertEvents", "=", "locator", ".", "getAllServices", "(", "PostInsertEventListener", ".", "class", ")", ";", "for", "(", "PostInsertEventListener", "piEventListener", ":", "postInsertEvents", ")", "{", "logger", ".", "trace", "(", "\"Registering PostInsert: \"", "+", "piEventListener", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ";", "eventRegistry", ".", "appendListeners", "(", "EventType", ".", "POST_INSERT", ",", "piEventListener", ")", ";", "}", "List", "<", "PostUpdateEventListener", ">", "postUpdateEvents", "=", "locator", ".", "getAllServices", "(", "PostUpdateEventListener", ".", "class", ")", ";", "for", "(", "PostUpdateEventListener", "puEventListener", ":", "postUpdateEvents", ")", "{", "logger", ".", "trace", "(", "\"Registering PostUpdate: \"", "+", "puEventListener", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ";", "eventRegistry", ".", "appendListeners", "(", "EventType", ".", "POST_UPDATE", ",", "puEventListener", ")", ";", "}", "List", "<", "PostDeleteEventListener", ">", "postDeleteEvents", "=", "locator", ".", "getAllServices", "(", "PostDeleteEventListener", ".", "class", ")", ";", "for", "(", "PostDeleteEventListener", "pdEventListener", ":", "postDeleteEvents", ")", "{", "logger", ".", "trace", "(", "\"Registering PostDelete: \"", "+", "pdEventListener", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ";", "eventRegistry", ".", "appendListeners", "(", "EventType", ".", "POST_DELETE", ",", "pdEventListener", ")", ";", "}", "List", "<", "PreInsertEventListener", ">", "preInsertEvents", "=", "locator", ".", "getAllServices", "(", "PreInsertEventListener", ".", "class", ")", ";", "for", "(", "PreInsertEventListener", "piEventListener", ":", "preInsertEvents", ")", "{", "logger", ".", "trace", "(", "\"Registering PreInsert: \"", "+", "piEventListener", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ";", "eventRegistry", ".", "appendListeners", "(", "EventType", ".", "PRE_INSERT", ",", "piEventListener", ")", ";", "}", "List", "<", "PreUpdateEventListener", ">", "preUpdateEvents", "=", "locator", ".", "getAllServices", "(", "PreUpdateEventListener", ".", "class", ")", ";", "for", "(", "PreUpdateEventListener", "puEventListener", ":", "preUpdateEvents", ")", "{", "logger", ".", "trace", "(", "\"Registering PreUpdate: \"", "+", "puEventListener", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ";", "eventRegistry", ".", "appendListeners", "(", "EventType", ".", "PRE_UPDATE", ",", "puEventListener", ")", ";", "}", "List", "<", "PreDeleteEventListener", ">", "preDeleteEvents", "=", "locator", ".", "getAllServices", "(", "PreDeleteEventListener", ".", "class", ")", ";", "for", "(", "PreDeleteEventListener", "pdEventListener", ":", "preDeleteEvents", ")", "{", "logger", ".", "trace", "(", "\"Registering PreDelete: \"", "+", "pdEventListener", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ";", "eventRegistry", ".", "appendListeners", "(", "EventType", ".", "PRE_DELETE", ",", "pdEventListener", ")", ";", "}", "List", "<", "PostCommitInsertEventListener", ">", "pciEvents", "=", "locator", ".", "getAllServices", "(", "PostCommitInsertEventListener", ".", "class", ")", ";", "for", "(", "PostCommitInsertEventListener", "cpiEventListener", ":", "pciEvents", ")", "{", "logger", ".", "trace", "(", "\"Registering PostCommitInsert: \"", "+", "cpiEventListener", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ";", "eventRegistry", ".", "appendListeners", "(", "EventType", ".", "POST_COMMIT_INSERT", ",", "cpiEventListener", ")", ";", "}", "List", "<", "PostCommitUpdateEventListener", ">", "pcuEvents", "=", "locator", ".", "getAllServices", "(", "PostCommitUpdateEventListener", ".", "class", ")", ";", "for", "(", "PostCommitUpdateEventListener", "cpuEventListener", ":", "pcuEvents", ")", "{", "logger", ".", "trace", "(", "\"Registering PostCommitUpdate: \"", "+", "cpuEventListener", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ";", "eventRegistry", ".", "appendListeners", "(", "EventType", ".", "POST_COMMIT_UPDATE", ",", "cpuEventListener", ")", ";", "}", "List", "<", "PostCommitDeleteEventListener", ">", "pcdEvents", "=", "locator", ".", "getAllServices", "(", "PostCommitDeleteEventListener", ".", "class", ")", ";", "for", "(", "PostCommitDeleteEventListener", "cpdEventListener", ":", "pcdEvents", ")", "{", "logger", ".", "trace", "(", "\"Registering PostCommitDelete: \"", "+", "cpdEventListener", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ";", "eventRegistry", ".", "appendListeners", "(", "EventType", ".", "POST_COMMIT_DELETE", ",", "cpdEventListener", ")", ";", "}", "}" ]
This method automatically adds discovered hibernate event listeners into the hibernate service registry. @param registry The service registry.
[ "This", "method", "automatically", "adds", "discovered", "hibernate", "event", "listeners", "into", "the", "hibernate", "service", "registry", "." ]
11d757bd222dc82ada462caf6730ba4ff85dae04
https://github.com/krotscheck/jersey2-toolkit/blob/11d757bd222dc82ada462caf6730ba4ff85dae04/jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/factory/HibernateSessionFactoryFactory.java#L131-L216
152,936
jeremiehuchet/acrachilisync
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionReader.java
IssueDescriptionReader.checkDescriptionVersion
private void checkDescriptionVersion(final Issue pIssue) throws IssueParseException { final Matcher m = DESCRIPTION_VERSION_PATTERN.matcher(pIssue.getDescription()); final int version; if (m.find()) { version = Integer.parseInt(m.group(1)); } else { // default version is 1 version = 1; } if (IssueDescriptionUtils.DESCRIPTION_VERSION != version) { throw new IssueParseException(String.format( "Issue #%s has unsupported description: %d. Expected version %d ", pIssue.getId(), version, IssueDescriptionUtils.DESCRIPTION_VERSION)); } }
java
private void checkDescriptionVersion(final Issue pIssue) throws IssueParseException { final Matcher m = DESCRIPTION_VERSION_PATTERN.matcher(pIssue.getDescription()); final int version; if (m.find()) { version = Integer.parseInt(m.group(1)); } else { // default version is 1 version = 1; } if (IssueDescriptionUtils.DESCRIPTION_VERSION != version) { throw new IssueParseException(String.format( "Issue #%s has unsupported description: %d. Expected version %d ", pIssue.getId(), version, IssueDescriptionUtils.DESCRIPTION_VERSION)); } }
[ "private", "void", "checkDescriptionVersion", "(", "final", "Issue", "pIssue", ")", "throws", "IssueParseException", "{", "final", "Matcher", "m", "=", "DESCRIPTION_VERSION_PATTERN", ".", "matcher", "(", "pIssue", ".", "getDescription", "(", ")", ")", ";", "final", "int", "version", ";", "if", "(", "m", ".", "find", "(", ")", ")", "{", "version", "=", "Integer", ".", "parseInt", "(", "m", ".", "group", "(", "1", ")", ")", ";", "}", "else", "{", "// default version is 1\r", "version", "=", "1", ";", "}", "if", "(", "IssueDescriptionUtils", ".", "DESCRIPTION_VERSION", "!=", "version", ")", "{", "throw", "new", "IssueParseException", "(", "String", ".", "format", "(", "\"Issue #%s has unsupported description: %d. Expected version %d \"", ",", "pIssue", ".", "getId", "(", ")", ",", "version", ",", "IssueDescriptionUtils", ".", "DESCRIPTION_VERSION", ")", ")", ";", "}", "}" ]
Checks the description version tag. @param pIssue the issue @throws IssueParseException the description version tag doesn't describe the expected version {@link IssueDescriptionUtils#DESCRIPTION_VERSION}
[ "Checks", "the", "description", "version", "tag", "." ]
4eadb0218623e77e0d92b5a08515eea2db51e988
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionReader.java#L128-L143
152,937
jeremiehuchet/acrachilisync
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionReader.java
IssueDescriptionReader.getStacktraceMD5
private String getStacktraceMD5(final Issue pIssue) throws IssueParseException { final int stackCfId = ConfigurationManager.getInstance().CHILIPROJECT_STACKTRACE_MD5_CF_ID; final Predicate findStacktraceMD5 = new CustomFieldIdPredicate(stackCfId); final CustomField field = (CustomField) CollectionUtils.find(pIssue.getCustomFields(), findStacktraceMD5); if (null == field) { throw new IssueParseException(String.format( "Issue %d doesn't contains a custom_field id=%d", pIssue.getId(), stackCfId)); } return field.getValue(); }
java
private String getStacktraceMD5(final Issue pIssue) throws IssueParseException { final int stackCfId = ConfigurationManager.getInstance().CHILIPROJECT_STACKTRACE_MD5_CF_ID; final Predicate findStacktraceMD5 = new CustomFieldIdPredicate(stackCfId); final CustomField field = (CustomField) CollectionUtils.find(pIssue.getCustomFields(), findStacktraceMD5); if (null == field) { throw new IssueParseException(String.format( "Issue %d doesn't contains a custom_field id=%d", pIssue.getId(), stackCfId)); } return field.getValue(); }
[ "private", "String", "getStacktraceMD5", "(", "final", "Issue", "pIssue", ")", "throws", "IssueParseException", "{", "final", "int", "stackCfId", "=", "ConfigurationManager", ".", "getInstance", "(", ")", ".", "CHILIPROJECT_STACKTRACE_MD5_CF_ID", ";", "final", "Predicate", "findStacktraceMD5", "=", "new", "CustomFieldIdPredicate", "(", "stackCfId", ")", ";", "final", "CustomField", "field", "=", "(", "CustomField", ")", "CollectionUtils", ".", "find", "(", "pIssue", ".", "getCustomFields", "(", ")", ",", "findStacktraceMD5", ")", ";", "if", "(", "null", "==", "field", ")", "{", "throw", "new", "IssueParseException", "(", "String", ".", "format", "(", "\"Issue %d doesn't contains a custom_field id=%d\"", ",", "pIssue", ".", "getId", "(", ")", ",", "stackCfId", ")", ")", ";", "}", "return", "field", ".", "getValue", "(", ")", ";", "}" ]
Extracts the stacktrace MD5 custom field value from the issue. @param pIssue the issue @return the stacktrace MD5 @throws IssueParseException issue doesn't contains a stack trace md5 custom field
[ "Extracts", "the", "stacktrace", "MD5", "custom", "field", "value", "from", "the", "issue", "." ]
4eadb0218623e77e0d92b5a08515eea2db51e988
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionReader.java#L154-L165
152,938
jeremiehuchet/acrachilisync
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionReader.java
IssueDescriptionReader.parseStacktrace
private String parseStacktrace(final String pDescription, final String pStacktraceMD5) throws IssueParseException { String stacktrace = null; // escape braces { and } to use strings in regexp final String start = "<pre class=\"javastacktrace\">"; final String qStart = Pattern.quote(start); final String end = "</pre>"; final String qEnd = Pattern.quote(end); final Pattern p = Pattern.compile(qStart + "(.*)" + qEnd, Pattern.DOTALL | Pattern.CASE_INSENSITIVE); final Matcher m = p.matcher(pDescription); if (m.find()) { stacktrace = m.group(1); // if a start tag or an end tag is found in the stacktrace, then there is a problem if (StringUtils.contains(stacktrace, start) || StringUtils.contains(stacktrace, end)) { throw new IssueParseException("Invalid stacktrace block"); } } else { throw new IssueParseException("0 stacktrace block found in the description"); } return stacktrace; }
java
private String parseStacktrace(final String pDescription, final String pStacktraceMD5) throws IssueParseException { String stacktrace = null; // escape braces { and } to use strings in regexp final String start = "<pre class=\"javastacktrace\">"; final String qStart = Pattern.quote(start); final String end = "</pre>"; final String qEnd = Pattern.quote(end); final Pattern p = Pattern.compile(qStart + "(.*)" + qEnd, Pattern.DOTALL | Pattern.CASE_INSENSITIVE); final Matcher m = p.matcher(pDescription); if (m.find()) { stacktrace = m.group(1); // if a start tag or an end tag is found in the stacktrace, then there is a problem if (StringUtils.contains(stacktrace, start) || StringUtils.contains(stacktrace, end)) { throw new IssueParseException("Invalid stacktrace block"); } } else { throw new IssueParseException("0 stacktrace block found in the description"); } return stacktrace; }
[ "private", "String", "parseStacktrace", "(", "final", "String", "pDescription", ",", "final", "String", "pStacktraceMD5", ")", "throws", "IssueParseException", "{", "String", "stacktrace", "=", "null", ";", "// escape braces { and } to use strings in regexp\r", "final", "String", "start", "=", "\"<pre class=\\\"javastacktrace\\\">\"", ";", "final", "String", "qStart", "=", "Pattern", ".", "quote", "(", "start", ")", ";", "final", "String", "end", "=", "\"</pre>\"", ";", "final", "String", "qEnd", "=", "Pattern", ".", "quote", "(", "end", ")", ";", "final", "Pattern", "p", "=", "Pattern", ".", "compile", "(", "qStart", "+", "\"(.*)\"", "+", "qEnd", ",", "Pattern", ".", "DOTALL", "|", "Pattern", ".", "CASE_INSENSITIVE", ")", ";", "final", "Matcher", "m", "=", "p", ".", "matcher", "(", "pDescription", ")", ";", "if", "(", "m", ".", "find", "(", ")", ")", "{", "stacktrace", "=", "m", ".", "group", "(", "1", ")", ";", "// if a start tag or an end tag is found in the stacktrace, then there is a problem\r", "if", "(", "StringUtils", ".", "contains", "(", "stacktrace", ",", "start", ")", "||", "StringUtils", ".", "contains", "(", "stacktrace", ",", "end", ")", ")", "{", "throw", "new", "IssueParseException", "(", "\"Invalid stacktrace block\"", ")", ";", "}", "}", "else", "{", "throw", "new", "IssueParseException", "(", "\"0 stacktrace block found in the description\"", ")", ";", "}", "return", "stacktrace", ";", "}" ]
Extracts the bug stacktrace from the description. @param pDescription the issue description @param pStacktraceMD5 the stacktrace MD5 hash the issue is related to @return the stacktrace @throws IssueParseException malformed issue description
[ "Extracts", "the", "bug", "stacktrace", "from", "the", "description", "." ]
4eadb0218623e77e0d92b5a08515eea2db51e988
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/IssueDescriptionReader.java#L252-L278
152,939
mlhartme/jasmin
src/main/java/net/oneandone/jasmin/main/Servlet.java
Servlet.init
@Override public void init(ServletConfig config) throws ServletException { World world; String str; try { world = World.create(); configure(world, "http"); configure(world, "https"); str = config.getInitParameter("docroot"); docroot = Application.file(world, str != null ? str : config.getServletContext().getRealPath("")); docroot.checkDirectory(); LOG.info("home: " + world.getHome()); application = Application.load(world, config, docroot); LOG.info("docroot: " + docroot); } catch (RuntimeException | Error e) { error(null, "init", e); throw e; } catch (Exception e) { error(null, "init", e); throw new ServletException(e); } catch (Throwable e) { error(null, "init", e); throw new RuntimeException("unexpected throwable", e); } }
java
@Override public void init(ServletConfig config) throws ServletException { World world; String str; try { world = World.create(); configure(world, "http"); configure(world, "https"); str = config.getInitParameter("docroot"); docroot = Application.file(world, str != null ? str : config.getServletContext().getRealPath("")); docroot.checkDirectory(); LOG.info("home: " + world.getHome()); application = Application.load(world, config, docroot); LOG.info("docroot: " + docroot); } catch (RuntimeException | Error e) { error(null, "init", e); throw e; } catch (Exception e) { error(null, "init", e); throw new ServletException(e); } catch (Throwable e) { error(null, "init", e); throw new RuntimeException("unexpected throwable", e); } }
[ "@", "Override", "public", "void", "init", "(", "ServletConfig", "config", ")", "throws", "ServletException", "{", "World", "world", ";", "String", "str", ";", "try", "{", "world", "=", "World", ".", "create", "(", ")", ";", "configure", "(", "world", ",", "\"http\"", ")", ";", "configure", "(", "world", ",", "\"https\"", ")", ";", "str", "=", "config", ".", "getInitParameter", "(", "\"docroot\"", ")", ";", "docroot", "=", "Application", ".", "file", "(", "world", ",", "str", "!=", "null", "?", "str", ":", "config", ".", "getServletContext", "(", ")", ".", "getRealPath", "(", "\"\"", ")", ")", ";", "docroot", ".", "checkDirectory", "(", ")", ";", "LOG", ".", "info", "(", "\"home: \"", "+", "world", ".", "getHome", "(", ")", ")", ";", "application", "=", "Application", ".", "load", "(", "world", ",", "config", ",", "docroot", ")", ";", "LOG", ".", "info", "(", "\"docroot: \"", "+", "docroot", ")", ";", "}", "catch", "(", "RuntimeException", "|", "Error", "e", ")", "{", "error", "(", "null", ",", "\"init\"", ",", "e", ")", ";", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "error", "(", "null", ",", "\"init\"", ",", "e", ")", ";", "throw", "new", "ServletException", "(", "e", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "error", "(", "null", ",", "\"init\"", ",", "e", ")", ";", "throw", "new", "RuntimeException", "(", "\"unexpected throwable\"", ",", "e", ")", ";", "}", "}" ]
creates configuration.
[ "creates", "configuration", "." ]
1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d
https://github.com/mlhartme/jasmin/blob/1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d/src/main/java/net/oneandone/jasmin/main/Servlet.java#L85-L110
152,940
tvesalainen/util
util/src/main/java/org/vesalainen/graph/Graphs.java
Graphs.breadthFirst
public static final <T> Stream<T> breadthFirst(T root, Function<? super T, ? extends Stream<T>> edges) { return BreadthFirst.stream(root, edges); }
java
public static final <T> Stream<T> breadthFirst(T root, Function<? super T, ? extends Stream<T>> edges) { return BreadthFirst.stream(root, edges); }
[ "public", "static", "final", "<", "T", ">", "Stream", "<", "T", ">", "breadthFirst", "(", "T", "root", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "Stream", "<", "T", ">", ">", "edges", ")", "{", "return", "BreadthFirst", ".", "stream", "(", "root", ",", "edges", ")", ";", "}" ]
Returns stream for graph nodes starting with root. Function edges returns stream for each node containing nodes edges. Traversal is in breadth first order. @param <T> @param root @param edges @return
[ "Returns", "stream", "for", "graph", "nodes", "starting", "with", "root", ".", "Function", "edges", "returns", "stream", "for", "each", "node", "containing", "nodes", "edges", ".", "Traversal", "is", "in", "breadth", "first", "order", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/graph/Graphs.java#L37-L40
152,941
tvesalainen/util
util/src/main/java/org/vesalainen/graph/Graphs.java
Graphs.diGraph
public static final <T> Stream<T> diGraph(T root, Function<? super T, ? extends Stream<T>> edges) { return DiGraphIterator.stream(root, edges); }
java
public static final <T> Stream<T> diGraph(T root, Function<? super T, ? extends Stream<T>> edges) { return DiGraphIterator.stream(root, edges); }
[ "public", "static", "final", "<", "T", ">", "Stream", "<", "T", ">", "diGraph", "(", "T", "root", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "Stream", "<", "T", ">", ">", "edges", ")", "{", "return", "DiGraphIterator", ".", "stream", "(", "root", ",", "edges", ")", ";", "}" ]
Returns stream for graph nodes starting with root. Function edges returns stream for each node containing nodes edges. @param <T> @param root @param edges @return
[ "Returns", "stream", "for", "graph", "nodes", "starting", "with", "root", ".", "Function", "edges", "returns", "stream", "for", "each", "node", "containing", "nodes", "edges", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/graph/Graphs.java#L49-L52
152,942
attribyte/wpdb
src/main/java/org/attribyte/wp/model/User.java
User.withId
public User withId(final long id) { return new User(id, username, displayName, slug, email, createTimestamp, url, metadata); }
java
public User withId(final long id) { return new User(id, username, displayName, slug, email, createTimestamp, url, metadata); }
[ "public", "User", "withId", "(", "final", "long", "id", ")", "{", "return", "new", "User", "(", "id", ",", "username", ",", "displayName", ",", "slug", ",", "email", ",", "createTimestamp", ",", "url", ",", "metadata", ")", ";", "}" ]
Creates a user with a new id. @param id The new id. @return The user with new id.
[ "Creates", "a", "user", "with", "a", "new", "id", "." ]
b9adf6131dfb67899ebff770c9bfeb001cc42f30
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/User.java#L138-L140
152,943
attribyte/wpdb
src/main/java/org/attribyte/wp/model/User.java
User.withMetadata
public User withMetadata(final List<Meta> metadata) { return new User(id, username, displayName, slug, email, createTimestamp, url, metadata); }
java
public User withMetadata(final List<Meta> metadata) { return new User(id, username, displayName, slug, email, createTimestamp, url, metadata); }
[ "public", "User", "withMetadata", "(", "final", "List", "<", "Meta", ">", "metadata", ")", "{", "return", "new", "User", "(", "id", ",", "username", ",", "displayName", ",", "slug", ",", "email", ",", "createTimestamp", ",", "url", ",", "metadata", ")", ";", "}" ]
Creates a user with added metadata. @param metadata The metadata. @return The user with metadata added.
[ "Creates", "a", "user", "with", "added", "metadata", "." ]
b9adf6131dfb67899ebff770c9bfeb001cc42f30
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/User.java#L147-L149
152,944
NessComputing/components-ness-httpclient
client/src/main/java/com/nesscomputing/httpclient/guice/HttpClientModule.java
HttpClientModule.bindNewObserver
public static LinkedBindingBuilder<HttpClientObserver> bindNewObserver(final Binder binder, final Annotation annotation) { return Multibinder.newSetBinder(binder, HttpClientObserver.class, annotation).addBinding(); }
java
public static LinkedBindingBuilder<HttpClientObserver> bindNewObserver(final Binder binder, final Annotation annotation) { return Multibinder.newSetBinder(binder, HttpClientObserver.class, annotation).addBinding(); }
[ "public", "static", "LinkedBindingBuilder", "<", "HttpClientObserver", ">", "bindNewObserver", "(", "final", "Binder", "binder", ",", "final", "Annotation", "annotation", ")", "{", "return", "Multibinder", ".", "newSetBinder", "(", "binder", ",", "HttpClientObserver", ".", "class", ",", "annotation", ")", ".", "addBinding", "(", ")", ";", "}" ]
Register a HttpClientObserver which observes only requests from a HttpClient with the given Guice binding annotation. @return the binding builder you should register with
[ "Register", "a", "HttpClientObserver", "which", "observes", "only", "requests", "from", "a", "HttpClient", "with", "the", "given", "Guice", "binding", "annotation", "." ]
8e97e8576e470449672c81fa7890c60f9986966d
https://github.com/NessComputing/components-ness-httpclient/blob/8e97e8576e470449672c81fa7890c60f9986966d/client/src/main/java/com/nesscomputing/httpclient/guice/HttpClientModule.java#L108-L111
152,945
inkstand-io/scribble
scribble-net/src/main/java/io/inkstand/scribble/net/NetworkUtils.java
NetworkUtils.findAvailablePort
public static int findAvailablePort(int maxRetries) { int retries = 0; int randomPort; boolean portAvailable; do { randomPort = randomPort(); portAvailable = isPortAvailable(randomPort); retries++; } while (retries <= maxRetries && !portAvailable); assumeTrue("no open port found", portAvailable); return randomPort; }
java
public static int findAvailablePort(int maxRetries) { int retries = 0; int randomPort; boolean portAvailable; do { randomPort = randomPort(); portAvailable = isPortAvailable(randomPort); retries++; } while (retries <= maxRetries && !portAvailable); assumeTrue("no open port found", portAvailable); return randomPort; }
[ "public", "static", "int", "findAvailablePort", "(", "int", "maxRetries", ")", "{", "int", "retries", "=", "0", ";", "int", "randomPort", ";", "boolean", "portAvailable", ";", "do", "{", "randomPort", "=", "randomPort", "(", ")", ";", "portAvailable", "=", "isPortAvailable", "(", "randomPort", ")", ";", "retries", "++", ";", "}", "while", "(", "retries", "<=", "maxRetries", "&&", "!", "portAvailable", ")", ";", "assumeTrue", "(", "\"no open port found\"", ",", "portAvailable", ")", ";", "return", "randomPort", ";", "}" ]
Finds an available port. @param maxRetries the maximum number of retries before an {@link org.junit.internal .AssumptionViolatedException} is thrown. @return the number of the port that is available
[ "Finds", "an", "available", "port", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-net/src/main/java/io/inkstand/scribble/net/NetworkUtils.java#L85-L97
152,946
inkstand-io/scribble
scribble-net/src/main/java/io/inkstand/scribble/net/NetworkUtils.java
NetworkUtils.isPortAvailable
public static boolean isPortAvailable(final int port) { try (ServerSocket tcp = new ServerSocket(port); DatagramSocket udp = new DatagramSocket(port)) { return tcp.isBound() && udp.isBound(); } catch (Exception e) { //NOSONAR return false; } }
java
public static boolean isPortAvailable(final int port) { try (ServerSocket tcp = new ServerSocket(port); DatagramSocket udp = new DatagramSocket(port)) { return tcp.isBound() && udp.isBound(); } catch (Exception e) { //NOSONAR return false; } }
[ "public", "static", "boolean", "isPortAvailable", "(", "final", "int", "port", ")", "{", "try", "(", "ServerSocket", "tcp", "=", "new", "ServerSocket", "(", "port", ")", ";", "DatagramSocket", "udp", "=", "new", "DatagramSocket", "(", "port", ")", ")", "{", "return", "tcp", ".", "isBound", "(", ")", "&&", "udp", ".", "isBound", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "//NOSONAR", "return", "false", ";", "}", "}" ]
Checks if the specified is available as listen port. @param port the port to check @return true if the port is available
[ "Checks", "if", "the", "specified", "is", "available", "as", "listen", "port", "." ]
66e67553bad4b1ff817e1715fd1d3dd833406744
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-net/src/main/java/io/inkstand/scribble/net/NetworkUtils.java#L118-L126
152,947
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/execution/CommandShell.java
CommandShell.open
public Receiver open(Receiver receiver)// throws IOException { this.receiver = receiver; Runtime rt = Runtime.getRuntime(); //command + arguments, environment parameters, workingdir try { proc = rt.exec(commandArray, null, workingDir); } catch (IOException e) { throw new RuntimeException("can not start command shell [" + ArraySupport.format(commandArray, ",") + "] + in directory " + workingDir); } // any error message? errorForwarder = new Transponder(proc.getErrorStream(), new Pipe(receiver, new NewLineFilter())); // any output? outputForwarder = new Transponder(proc.getInputStream(), new Pipe(receiver, new NewLineFilter())); errorForwarder.start(); outputForwarder.start(); return receiver; }
java
public Receiver open(Receiver receiver)// throws IOException { this.receiver = receiver; Runtime rt = Runtime.getRuntime(); //command + arguments, environment parameters, workingdir try { proc = rt.exec(commandArray, null, workingDir); } catch (IOException e) { throw new RuntimeException("can not start command shell [" + ArraySupport.format(commandArray, ",") + "] + in directory " + workingDir); } // any error message? errorForwarder = new Transponder(proc.getErrorStream(), new Pipe(receiver, new NewLineFilter())); // any output? outputForwarder = new Transponder(proc.getInputStream(), new Pipe(receiver, new NewLineFilter())); errorForwarder.start(); outputForwarder.start(); return receiver; }
[ "public", "Receiver", "open", "(", "Receiver", "receiver", ")", "// throws IOException", "{", "this", ".", "receiver", "=", "receiver", ";", "Runtime", "rt", "=", "Runtime", ".", "getRuntime", "(", ")", ";", "//command + arguments, environment parameters, workingdir", "try", "{", "proc", "=", "rt", ".", "exec", "(", "commandArray", ",", "null", ",", "workingDir", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"can not start command shell [\"", "+", "ArraySupport", ".", "format", "(", "commandArray", ",", "\",\"", ")", "+", "\"] + in directory \"", "+", "workingDir", ")", ";", "}", "// any error message?", "errorForwarder", "=", "new", "Transponder", "(", "proc", ".", "getErrorStream", "(", ")", ",", "new", "Pipe", "(", "receiver", ",", "new", "NewLineFilter", "(", ")", ")", ")", ";", "// any output?", "outputForwarder", "=", "new", "Transponder", "(", "proc", ".", "getInputStream", "(", ")", ",", "new", "Pipe", "(", "receiver", ",", "new", "NewLineFilter", "(", ")", ")", ")", ";", "errorForwarder", ".", "start", "(", ")", ";", "outputForwarder", ".", "start", "(", ")", ";", "return", "receiver", ";", "}" ]
Opens permanent shell @param receiver @return
[ "Opens", "permanent", "shell" ]
971eb022115247b1e34dc26dd02e7e621e29e910
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/execution/CommandShell.java#L183-L208
152,948
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/execution/CommandShell.java
CommandShell.execute
public static int execute(String[] commandArray, String[] alternativeEnvVars, File workingDir, Receiver outputReceiver) throws IOException { Runtime rt = Runtime.getRuntime(); //command + arguments, environment parameters, workingdir Process proc = null; try { proc = rt.exec(commandArray, alternativeEnvVars, workingDir); } catch (Exception e) { System.out.println("unable to execute command: " + ArraySupport.format(commandArray, ", ")); e.printStackTrace(); throw new RuntimeException("unable to execute command: " + ArraySupport.format(commandArray, ", "), e); } // any error message? Transponder errorForwarder = new Transponder(proc.getErrorStream(), new Pipe(outputReceiver)); // any output? Transponder outputForwarder = new Transponder(proc.getInputStream(), new Pipe(outputReceiver)); errorForwarder.start(); outputForwarder.start(); try { int retval = proc.waitFor();//threads will stop when proc is done and InputStream and ErrorStream close errorForwarder.stop(); outputForwarder.stop(); return retval; } catch (InterruptedException ie) { //... } return -1; }
java
public static int execute(String[] commandArray, String[] alternativeEnvVars, File workingDir, Receiver outputReceiver) throws IOException { Runtime rt = Runtime.getRuntime(); //command + arguments, environment parameters, workingdir Process proc = null; try { proc = rt.exec(commandArray, alternativeEnvVars, workingDir); } catch (Exception e) { System.out.println("unable to execute command: " + ArraySupport.format(commandArray, ", ")); e.printStackTrace(); throw new RuntimeException("unable to execute command: " + ArraySupport.format(commandArray, ", "), e); } // any error message? Transponder errorForwarder = new Transponder(proc.getErrorStream(), new Pipe(outputReceiver)); // any output? Transponder outputForwarder = new Transponder(proc.getInputStream(), new Pipe(outputReceiver)); errorForwarder.start(); outputForwarder.start(); try { int retval = proc.waitFor();//threads will stop when proc is done and InputStream and ErrorStream close errorForwarder.stop(); outputForwarder.stop(); return retval; } catch (InterruptedException ie) { //... } return -1; }
[ "public", "static", "int", "execute", "(", "String", "[", "]", "commandArray", ",", "String", "[", "]", "alternativeEnvVars", ",", "File", "workingDir", ",", "Receiver", "outputReceiver", ")", "throws", "IOException", "{", "Runtime", "rt", "=", "Runtime", ".", "getRuntime", "(", ")", ";", "//command + arguments, environment parameters, workingdir", "Process", "proc", "=", "null", ";", "try", "{", "proc", "=", "rt", ".", "exec", "(", "commandArray", ",", "alternativeEnvVars", ",", "workingDir", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"unable to execute command: \"", "+", "ArraySupport", ".", "format", "(", "commandArray", ",", "\", \"", ")", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "throw", "new", "RuntimeException", "(", "\"unable to execute command: \"", "+", "ArraySupport", ".", "format", "(", "commandArray", ",", "\", \"", ")", ",", "e", ")", ";", "}", "// any error message?", "Transponder", "errorForwarder", "=", "new", "Transponder", "(", "proc", ".", "getErrorStream", "(", ")", ",", "new", "Pipe", "(", "outputReceiver", ")", ")", ";", "// any output?", "Transponder", "outputForwarder", "=", "new", "Transponder", "(", "proc", ".", "getInputStream", "(", ")", ",", "new", "Pipe", "(", "outputReceiver", ")", ")", ";", "errorForwarder", ".", "start", "(", ")", ";", "outputForwarder", ".", "start", "(", ")", ";", "try", "{", "int", "retval", "=", "proc", ".", "waitFor", "(", ")", ";", "//threads will stop when proc is done and InputStream and ErrorStream close", "errorForwarder", ".", "stop", "(", ")", ";", "outputForwarder", ".", "stop", "(", ")", ";", "return", "retval", ";", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "//...", "}", "return", "-", "1", ";", "}" ]
execute particular command @return @throws IOException
[ "execute", "particular", "command" ]
971eb022115247b1e34dc26dd02e7e621e29e910
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/execution/CommandShell.java#L216-L249
152,949
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/execution/CommandShell.java
CommandShell.main
public static void main(String[] args) { // StdIODialog dialog = new StdIODialog(System.in, System.out, new CommandShell("cmd.exe", new File("C:\\"))); StdIODialog dialog = new StdIODialog(System.in, System.out, new CommandShell(new String[]{"cmd.exe"}, new File("./"))); try { dialog.open(); } catch (IOException ioe) { ioe.printStackTrace(); } }
java
public static void main(String[] args) { // StdIODialog dialog = new StdIODialog(System.in, System.out, new CommandShell("cmd.exe", new File("C:\\"))); StdIODialog dialog = new StdIODialog(System.in, System.out, new CommandShell(new String[]{"cmd.exe"}, new File("./"))); try { dialog.open(); } catch (IOException ioe) { ioe.printStackTrace(); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "//\t\tStdIODialog dialog = new StdIODialog(System.in, System.out, new CommandShell(\"cmd.exe\", new File(\"C:\\\\\")));", "StdIODialog", "dialog", "=", "new", "StdIODialog", "(", "System", ".", "in", ",", "System", ".", "out", ",", "new", "CommandShell", "(", "new", "String", "[", "]", "{", "\"cmd.exe\"", "}", ",", "new", "File", "(", "\"./\"", ")", ")", ")", ";", "try", "{", "dialog", ".", "open", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "ioe", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Runs test dialog. @param args
[ "Runs", "test", "dialog", "." ]
971eb022115247b1e34dc26dd02e7e621e29e910
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/execution/CommandShell.java#L331-L341
152,950
jbundle/jbundle
thin/base/screen/cal/sample/remote/src/main/java/org/jbundle/thin/base/screen/cal/sample/remote/AppointmentCalendarItem.java
AppointmentCalendarItem.getRemoteClassName
public String getRemoteClassName() { String strClassName = Appointment.class.getName().toString(); int iThinPos = strClassName.indexOf("thin."); return strClassName.substring(0, iThinPos) + strClassName.substring(iThinPos + 5); }
java
public String getRemoteClassName() { String strClassName = Appointment.class.getName().toString(); int iThinPos = strClassName.indexOf("thin."); return strClassName.substring(0, iThinPos) + strClassName.substring(iThinPos + 5); }
[ "public", "String", "getRemoteClassName", "(", ")", "{", "String", "strClassName", "=", "Appointment", ".", "class", ".", "getName", "(", ")", ".", "toString", "(", ")", ";", "int", "iThinPos", "=", "strClassName", ".", "indexOf", "(", "\"thin.\"", ")", ";", "return", "strClassName", ".", "substring", "(", "0", ",", "iThinPos", ")", "+", "strClassName", ".", "substring", "(", "iThinPos", "+", "5", ")", ";", "}" ]
Get the name of the remote class.
[ "Get", "the", "name", "of", "the", "remote", "class", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/sample/remote/src/main/java/org/jbundle/thin/base/screen/cal/sample/remote/AppointmentCalendarItem.java#L69-L74
152,951
jbundle/jbundle
thin/base/screen/cal/sample/remote/src/main/java/org/jbundle/thin/base/screen/cal/sample/remote/AppointmentCalendarItem.java
AppointmentCalendarItem.setEndDate
public Date setEndDate(Date time) { try { this.getTable().edit(); this.getField("EndDateTime").setData(time); this.getTable().set(this); this.getTable().seek(null); // Read this record } catch (Exception ex) { ex.printStackTrace(); } return this.getEndDate(); }
java
public Date setEndDate(Date time) { try { this.getTable().edit(); this.getField("EndDateTime").setData(time); this.getTable().set(this); this.getTable().seek(null); // Read this record } catch (Exception ex) { ex.printStackTrace(); } return this.getEndDate(); }
[ "public", "Date", "setEndDate", "(", "Date", "time", ")", "{", "try", "{", "this", ".", "getTable", "(", ")", ".", "edit", "(", ")", ";", "this", ".", "getField", "(", "\"EndDateTime\"", ")", ".", "setData", "(", "time", ")", ";", "this", ".", "getTable", "(", ")", ".", "set", "(", "this", ")", ";", "this", ".", "getTable", "(", ")", ".", "seek", "(", "null", ")", ";", "// Read this record", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "return", "this", ".", "getEndDate", "(", ")", ";", "}" ]
Change the ending time of this service.
[ "Change", "the", "ending", "time", "of", "this", "service", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/sample/remote/src/main/java/org/jbundle/thin/base/screen/cal/sample/remote/AppointmentCalendarItem.java#L142-L153
152,952
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNode.java
SpecNode.getSourceUrls
public List<String> getSourceUrls(boolean useInherited) { List<String> temp = new ArrayList<String>(); // Get the parent source urls if requested if (useInherited && parent != null) { if (parent instanceof ContentSpec) { temp = ((ContentSpec) parent).getBaseLevel().getSourceUrls(true); } else if (parent instanceof KeyValueNode) { temp = ((KeyValueNode) parent).getParent().getBaseLevel().getSourceUrls(true); } else { temp = ((SpecNode) parent).getSourceUrls(true); } } // Add any local source urls if (sourceUrls != null) { temp.addAll(sourceUrls); } return temp; }
java
public List<String> getSourceUrls(boolean useInherited) { List<String> temp = new ArrayList<String>(); // Get the parent source urls if requested if (useInherited && parent != null) { if (parent instanceof ContentSpec) { temp = ((ContentSpec) parent).getBaseLevel().getSourceUrls(true); } else if (parent instanceof KeyValueNode) { temp = ((KeyValueNode) parent).getParent().getBaseLevel().getSourceUrls(true); } else { temp = ((SpecNode) parent).getSourceUrls(true); } } // Add any local source urls if (sourceUrls != null) { temp.addAll(sourceUrls); } return temp; }
[ "public", "List", "<", "String", ">", "getSourceUrls", "(", "boolean", "useInherited", ")", "{", "List", "<", "String", ">", "temp", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "// Get the parent source urls if requested", "if", "(", "useInherited", "&&", "parent", "!=", "null", ")", "{", "if", "(", "parent", "instanceof", "ContentSpec", ")", "{", "temp", "=", "(", "(", "ContentSpec", ")", "parent", ")", ".", "getBaseLevel", "(", ")", ".", "getSourceUrls", "(", "true", ")", ";", "}", "else", "if", "(", "parent", "instanceof", "KeyValueNode", ")", "{", "temp", "=", "(", "(", "KeyValueNode", ")", "parent", ")", ".", "getParent", "(", ")", ".", "getBaseLevel", "(", ")", ".", "getSourceUrls", "(", "true", ")", ";", "}", "else", "{", "temp", "=", "(", "(", "SpecNode", ")", "parent", ")", ".", "getSourceUrls", "(", "true", ")", ";", "}", "}", "// Add any local source urls", "if", "(", "sourceUrls", "!=", "null", ")", "{", "temp", ".", "addAll", "(", "sourceUrls", ")", ";", "}", "return", "temp", ";", "}" ]
Get the Source Urls for a node and also checks to make sure the url hasn't already been inherited @param useInherited If the function should check for inherited source urls @return A List of Strings that represent the source urls
[ "Get", "the", "Source", "Urls", "for", "a", "node", "and", "also", "checks", "to", "make", "sure", "the", "url", "hasn", "t", "already", "been", "inherited" ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecNode.java#L253-L272
152,953
StefanLiebenberg/kute
kute-core/src/main/java/slieb/kute/KutePredicates.java
KutePredicates.distinctFilter
public static <R extends Resource, X> ResourcePredicate<R> distinctFilter(FunctionWithThrowable<R, X, IOException> function) { final Map<X, Boolean> seen = Maps.newConcurrentMap(); return resource -> seen.putIfAbsent(function.apply(resource), Boolean.TRUE) == null; }
java
public static <R extends Resource, X> ResourcePredicate<R> distinctFilter(FunctionWithThrowable<R, X, IOException> function) { final Map<X, Boolean> seen = Maps.newConcurrentMap(); return resource -> seen.putIfAbsent(function.apply(resource), Boolean.TRUE) == null; }
[ "public", "static", "<", "R", "extends", "Resource", ",", "X", ">", "ResourcePredicate", "<", "R", ">", "distinctFilter", "(", "FunctionWithThrowable", "<", "R", ",", "X", ",", "IOException", ">", "function", ")", "{", "final", "Map", "<", "X", ",", "Boolean", ">", "seen", "=", "Maps", ".", "newConcurrentMap", "(", ")", ";", "return", "resource", "->", "seen", ".", "putIfAbsent", "(", "function", ".", "apply", "(", "resource", ")", ",", "Boolean", ".", "TRUE", ")", "==", "null", ";", "}" ]
A predicate to filter out already seen resources by function. @param function The function to determine the resource value. @param <R> The Resource implementation. @param <X> The Value type. @return A stateful predicate.
[ "A", "predicate", "to", "filter", "out", "already", "seen", "resources", "by", "function", "." ]
1db0e8d2c76459d22c7d4b0ba99c18f74748f6fd
https://github.com/StefanLiebenberg/kute/blob/1db0e8d2c76459d22c7d4b0ba99c18f74748f6fd/kute-core/src/main/java/slieb/kute/KutePredicates.java#L92-L95
152,954
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/lock/ClientLockManager.java
ClientLockManager.getRemoteLockSession
public RemoteLockSession getRemoteLockSession(SessionInfo sessionInfo) { if (m_lockServer == null) { // Haven't done any locks yet, hook up with the lock server. Application app = (Application)((Environment)m_owner).getDefaultApplication(); if (m_gbRemoteTaskServer) { String strServer = app.getAppServerName(); String strRemoteApp = DBParams.DEFAULT_REMOTE_LOCK; String strUserID = null; String strPassword = null; m_lockServer = (RemoteTask)app.createRemoteTask(strServer, strRemoteApp, strUserID, strPassword); } if (m_lockServer == null) { m_gbRemoteTaskServer = false; try { m_lockServer = new org.jbundle.base.remote.db.TaskSession(app); } catch (RemoteException ex) { ex.printStackTrace(); } } } RemoteLockSession remoteLockSession = (RemoteLockSession)sessionInfo.m_remoteLockSession; if (remoteLockSession == null) { // Setup the remote lock server try { if (m_gbRemoteTaskServer) { remoteLockSession = (RemoteLockSession)m_lockServer.makeRemoteSession(LockSession.class.getName()); } else { remoteLockSession = new LockSession((org.jbundle.base.remote.db.TaskSession)m_lockServer); } sessionInfo.m_remoteLockSession = remoteLockSession; } catch (RemoteException ex) { ex.printStackTrace(); } } return remoteLockSession; }
java
public RemoteLockSession getRemoteLockSession(SessionInfo sessionInfo) { if (m_lockServer == null) { // Haven't done any locks yet, hook up with the lock server. Application app = (Application)((Environment)m_owner).getDefaultApplication(); if (m_gbRemoteTaskServer) { String strServer = app.getAppServerName(); String strRemoteApp = DBParams.DEFAULT_REMOTE_LOCK; String strUserID = null; String strPassword = null; m_lockServer = (RemoteTask)app.createRemoteTask(strServer, strRemoteApp, strUserID, strPassword); } if (m_lockServer == null) { m_gbRemoteTaskServer = false; try { m_lockServer = new org.jbundle.base.remote.db.TaskSession(app); } catch (RemoteException ex) { ex.printStackTrace(); } } } RemoteLockSession remoteLockSession = (RemoteLockSession)sessionInfo.m_remoteLockSession; if (remoteLockSession == null) { // Setup the remote lock server try { if (m_gbRemoteTaskServer) { remoteLockSession = (RemoteLockSession)m_lockServer.makeRemoteSession(LockSession.class.getName()); } else { remoteLockSession = new LockSession((org.jbundle.base.remote.db.TaskSession)m_lockServer); } sessionInfo.m_remoteLockSession = remoteLockSession; } catch (RemoteException ex) { ex.printStackTrace(); } } return remoteLockSession; }
[ "public", "RemoteLockSession", "getRemoteLockSession", "(", "SessionInfo", "sessionInfo", ")", "{", "if", "(", "m_lockServer", "==", "null", ")", "{", "// Haven't done any locks yet, hook up with the lock server.", "Application", "app", "=", "(", "Application", ")", "(", "(", "Environment", ")", "m_owner", ")", ".", "getDefaultApplication", "(", ")", ";", "if", "(", "m_gbRemoteTaskServer", ")", "{", "String", "strServer", "=", "app", ".", "getAppServerName", "(", ")", ";", "String", "strRemoteApp", "=", "DBParams", ".", "DEFAULT_REMOTE_LOCK", ";", "String", "strUserID", "=", "null", ";", "String", "strPassword", "=", "null", ";", "m_lockServer", "=", "(", "RemoteTask", ")", "app", ".", "createRemoteTask", "(", "strServer", ",", "strRemoteApp", ",", "strUserID", ",", "strPassword", ")", ";", "}", "if", "(", "m_lockServer", "==", "null", ")", "{", "m_gbRemoteTaskServer", "=", "false", ";", "try", "{", "m_lockServer", "=", "new", "org", ".", "jbundle", ".", "base", ".", "remote", ".", "db", ".", "TaskSession", "(", "app", ")", ";", "}", "catch", "(", "RemoteException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "RemoteLockSession", "remoteLockSession", "=", "(", "RemoteLockSession", ")", "sessionInfo", ".", "m_remoteLockSession", ";", "if", "(", "remoteLockSession", "==", "null", ")", "{", "// Setup the remote lock server", "try", "{", "if", "(", "m_gbRemoteTaskServer", ")", "{", "remoteLockSession", "=", "(", "RemoteLockSession", ")", "m_lockServer", ".", "makeRemoteSession", "(", "LockSession", ".", "class", ".", "getName", "(", ")", ")", ";", "}", "else", "{", "remoteLockSession", "=", "new", "LockSession", "(", "(", "org", ".", "jbundle", ".", "base", ".", "remote", ".", "db", ".", "TaskSession", ")", "m_lockServer", ")", ";", "}", "sessionInfo", ".", "m_remoteLockSession", "=", "remoteLockSession", ";", "}", "catch", "(", "RemoteException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}", "return", "remoteLockSession", ";", "}" ]
Get the remote lock server. @return The remote lock server.
[ "Get", "the", "remote", "lock", "server", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/lock/ClientLockManager.java#L116-L157
152,955
mattbertolini/JXR-Ant
src/main/java/com/mattbertolini/jxr/ant/JxrTask.java
JxrTask.setInputEncoding
public void setInputEncoding(String inputEncoding) { this.log("Setting input encoding to " + inputEncoding, LogLevel.DEBUG.getLevel()); this.inputEncoding = inputEncoding; }
java
public void setInputEncoding(String inputEncoding) { this.log("Setting input encoding to " + inputEncoding, LogLevel.DEBUG.getLevel()); this.inputEncoding = inputEncoding; }
[ "public", "void", "setInputEncoding", "(", "String", "inputEncoding", ")", "{", "this", ".", "log", "(", "\"Setting input encoding to \"", "+", "inputEncoding", ",", "LogLevel", ".", "DEBUG", ".", "getLevel", "(", ")", ")", ";", "this", ".", "inputEncoding", "=", "inputEncoding", ";", "}" ]
Optional. Sets the file encoding to be used when reading the input files. Defaults to the system file encoding. @param inputEncoding The file encoding.
[ "Optional", ".", "Sets", "the", "file", "encoding", "to", "be", "used", "when", "reading", "the", "input", "files", ".", "Defaults", "to", "the", "system", "file", "encoding", "." ]
37ab703d0b38333a7d80ba130da5d76ebef6354b
https://github.com/mattbertolini/JXR-Ant/blob/37ab703d0b38333a7d80ba130da5d76ebef6354b/src/main/java/com/mattbertolini/jxr/ant/JxrTask.java#L196-L199
152,956
mattbertolini/JXR-Ant
src/main/java/com/mattbertolini/jxr/ant/JxrTask.java
JxrTask.setOutputEncoding
public void setOutputEncoding(String outputEncoding) { this.log("Setting output encoding to " + outputEncoding, LogLevel.DEBUG.getLevel()); this.outputEncoding = outputEncoding; }
java
public void setOutputEncoding(String outputEncoding) { this.log("Setting output encoding to " + outputEncoding, LogLevel.DEBUG.getLevel()); this.outputEncoding = outputEncoding; }
[ "public", "void", "setOutputEncoding", "(", "String", "outputEncoding", ")", "{", "this", ".", "log", "(", "\"Setting output encoding to \"", "+", "outputEncoding", ",", "LogLevel", ".", "DEBUG", ".", "getLevel", "(", ")", ")", ";", "this", ".", "outputEncoding", "=", "outputEncoding", ";", "}" ]
Optional. Set the file encoding of the generated files. Defaults to the system file encoding. @param outputEncoding The encoding to set.
[ "Optional", ".", "Set", "the", "file", "encoding", "of", "the", "generated", "files", ".", "Defaults", "to", "the", "system", "file", "encoding", "." ]
37ab703d0b38333a7d80ba130da5d76ebef6354b
https://github.com/mattbertolini/JXR-Ant/blob/37ab703d0b38333a7d80ba130da5d76ebef6354b/src/main/java/com/mattbertolini/jxr/ant/JxrTask.java#L214-L217
152,957
mattbertolini/JXR-Ant
src/main/java/com/mattbertolini/jxr/ant/JxrTask.java
JxrTask.setStylesheet
public void setStylesheet(FileResource stylesheet) { this.log("Setting custom stylesheet " + stylesheet.toString(), LogLevel.DEBUG.getLevel()); this.stylesheet = stylesheet; }
java
public void setStylesheet(FileResource stylesheet) { this.log("Setting custom stylesheet " + stylesheet.toString(), LogLevel.DEBUG.getLevel()); this.stylesheet = stylesheet; }
[ "public", "void", "setStylesheet", "(", "FileResource", "stylesheet", ")", "{", "this", ".", "log", "(", "\"Setting custom stylesheet \"", "+", "stylesheet", ".", "toString", "(", ")", ",", "LogLevel", ".", "DEBUG", ".", "getLevel", "(", ")", ")", ";", "this", ".", "stylesheet", "=", "stylesheet", ";", "}" ]
Optional. Set a custom stylesheet to be used @param stylesheet The custom stylesheet
[ "Optional", ".", "Set", "a", "custom", "stylesheet", "to", "be", "used" ]
37ab703d0b38333a7d80ba130da5d76ebef6354b
https://github.com/mattbertolini/JXR-Ant/blob/37ab703d0b38333a7d80ba130da5d76ebef6354b/src/main/java/com/mattbertolini/jxr/ant/JxrTask.java#L237-L240
152,958
OwlPlatform/java-owl-common
src/main/java/com/owlplatform/common/util/OnlineVariance.java
OnlineVariance.addValue
public float addValue(final float value) { long now = System.currentTimeMillis(); // If more than 15 seconds passed then clear the data since it is // too old at this point. if (now - this.last_time > this.ageGap) { this.reset(); } this.last_time = now; if (this.sizeHistory < this.maxHistory) { this.sum += value; this.sum_squares += Math.pow(value, 2); ++this.sizeHistory; } else { Float oldest_val = this.history.poll(); if (oldest_val != null) { this.sum = this.sum - oldest_val.floatValue() + value; this.sum_squares = this.sum_squares - (float)Math.pow(oldest_val.floatValue(),2) + (float)Math .pow(value, 2); } else { log.warn("Could not poll history to update variance."); } } this.history.offer(Float.valueOf(value)); float degrees_of_freedom = this.sizeHistory - 1; if (degrees_of_freedom < 1.0) { return 0f; } this.currentVariance = (this.sum_squares - ((float)Math.pow(this.sum,2) / this.sizeHistory)) / degrees_of_freedom; return this.currentVariance; }
java
public float addValue(final float value) { long now = System.currentTimeMillis(); // If more than 15 seconds passed then clear the data since it is // too old at this point. if (now - this.last_time > this.ageGap) { this.reset(); } this.last_time = now; if (this.sizeHistory < this.maxHistory) { this.sum += value; this.sum_squares += Math.pow(value, 2); ++this.sizeHistory; } else { Float oldest_val = this.history.poll(); if (oldest_val != null) { this.sum = this.sum - oldest_val.floatValue() + value; this.sum_squares = this.sum_squares - (float)Math.pow(oldest_val.floatValue(),2) + (float)Math .pow(value, 2); } else { log.warn("Could not poll history to update variance."); } } this.history.offer(Float.valueOf(value)); float degrees_of_freedom = this.sizeHistory - 1; if (degrees_of_freedom < 1.0) { return 0f; } this.currentVariance = (this.sum_squares - ((float)Math.pow(this.sum,2) / this.sizeHistory)) / degrees_of_freedom; return this.currentVariance; }
[ "public", "float", "addValue", "(", "final", "float", "value", ")", "{", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "// If more than 15 seconds passed then clear the data since it is", "// too old at this point.", "if", "(", "now", "-", "this", ".", "last_time", ">", "this", ".", "ageGap", ")", "{", "this", ".", "reset", "(", ")", ";", "}", "this", ".", "last_time", "=", "now", ";", "if", "(", "this", ".", "sizeHistory", "<", "this", ".", "maxHistory", ")", "{", "this", ".", "sum", "+=", "value", ";", "this", ".", "sum_squares", "+=", "Math", ".", "pow", "(", "value", ",", "2", ")", ";", "++", "this", ".", "sizeHistory", ";", "}", "else", "{", "Float", "oldest_val", "=", "this", ".", "history", ".", "poll", "(", ")", ";", "if", "(", "oldest_val", "!=", "null", ")", "{", "this", ".", "sum", "=", "this", ".", "sum", "-", "oldest_val", ".", "floatValue", "(", ")", "+", "value", ";", "this", ".", "sum_squares", "=", "this", ".", "sum_squares", "-", "(", "float", ")", "Math", ".", "pow", "(", "oldest_val", ".", "floatValue", "(", ")", ",", "2", ")", "+", "(", "float", ")", "Math", ".", "pow", "(", "value", ",", "2", ")", ";", "}", "else", "{", "log", ".", "warn", "(", "\"Could not poll history to update variance.\"", ")", ";", "}", "}", "this", ".", "history", ".", "offer", "(", "Float", ".", "valueOf", "(", "value", ")", ")", ";", "float", "degrees_of_freedom", "=", "this", ".", "sizeHistory", "-", "1", ";", "if", "(", "degrees_of_freedom", "<", "1.0", ")", "{", "return", "0f", ";", "}", "this", ".", "currentVariance", "=", "(", "this", ".", "sum_squares", "-", "(", "(", "float", ")", "Math", ".", "pow", "(", "this", ".", "sum", ",", "2", ")", "/", "this", ".", "sizeHistory", ")", ")", "/", "degrees_of_freedom", ";", "return", "this", ".", "currentVariance", ";", "}" ]
Adds a value to this variance. If the time between the previous addition and this addition exceeds the age gap for this object, then the variance will be reset to 0 before this value is added. @param value the value to add. @return the current computed online variance, or 0 if none is available (e.g., the initial value was added or a value was added after the age gap passed)
[ "Adds", "a", "value", "to", "this", "variance", ".", "If", "the", "time", "between", "the", "previous", "addition", "and", "this", "addition", "exceeds", "the", "age", "gap", "for", "this", "object", "then", "the", "variance", "will", "be", "reset", "to", "0", "before", "this", "value", "is", "added", "." ]
fe95d401914f4747253cef18ecf42179268367a2
https://github.com/OwlPlatform/java-owl-common/blob/fe95d401914f4747253cef18ecf42179268367a2/src/main/java/com/owlplatform/common/util/OnlineVariance.java#L149-L181
152,959
FitLayout/tools
src/main/java/org/fit/layout/tools/io/XMLOutputOperator.java
XMLOutputOperator.dumpTo
public void dumpTo(AreaTree tree, PrintWriter out) { if (produceHeader) out.println("<?xml version=\"1.0\"?>"); out.println("<areaTree base=\"" + HTMLEntities(tree.getRoot().getPage().getSourceURL().toString()) + "\">"); recursiveDump(tree.getRoot(), 1, out); out.println("</areaTree>"); }
java
public void dumpTo(AreaTree tree, PrintWriter out) { if (produceHeader) out.println("<?xml version=\"1.0\"?>"); out.println("<areaTree base=\"" + HTMLEntities(tree.getRoot().getPage().getSourceURL().toString()) + "\">"); recursiveDump(tree.getRoot(), 1, out); out.println("</areaTree>"); }
[ "public", "void", "dumpTo", "(", "AreaTree", "tree", ",", "PrintWriter", "out", ")", "{", "if", "(", "produceHeader", ")", "out", ".", "println", "(", "\"<?xml version=\\\"1.0\\\"?>\"", ")", ";", "out", ".", "println", "(", "\"<areaTree base=\\\"\"", "+", "HTMLEntities", "(", "tree", ".", "getRoot", "(", ")", ".", "getPage", "(", ")", ".", "getSourceURL", "(", ")", ".", "toString", "(", ")", ")", "+", "\"\\\">\"", ")", ";", "recursiveDump", "(", "tree", ".", "getRoot", "(", ")", ",", "1", ",", "out", ")", ";", "out", ".", "println", "(", "\"</areaTree>\"", ")", ";", "}" ]
Formats the complete tag tree to an output stream
[ "Formats", "the", "complete", "tag", "tree", "to", "an", "output", "stream" ]
43a8e3f4ddf21a031d3ab7247b8d37310bda4856
https://github.com/FitLayout/tools/blob/43a8e3f4ddf21a031d3ab7247b8d37310bda4856/src/main/java/org/fit/layout/tools/io/XMLOutputOperator.java#L133-L140
152,960
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/ReportUtilities.java
ReportUtilities.buildReportTable
public static String buildReportTable(final List<TopicErrorData> topicErrorDatas, final String tableTitle, final boolean showEditorLink, final ZanataDetails zanataDetails) { final List<String> tableHeaders = CollectionUtilities.toArrayList(new String[]{"Topic Link", "Topic Title", "Topic Tags"}); // Put the details into different tables final List<List<String>> rows = new ArrayList<List<String>>(); for (final TopicErrorData topicErrorData : topicErrorDatas) { final BaseTopicWrapper<?> topic = topicErrorData.getTopic(); final List<String> topicTitles; if (topic instanceof TranslatedTopicWrapper) { final TranslatedTopicWrapper translatedTopic = (TranslatedTopicWrapper) topic; if (!EntityUtilities.isDummyTopic(translatedTopic) && translatedTopic.getTopic() != null) { topicTitles = CollectionUtilities.toArrayList(DocBookUtilities.wrapInListItem(DocBookUtilities.wrapInPara( "[" + translatedTopic.getTopic().getLocale().getValue() + "] " + translatedTopic.getTopic().getTitle())), DocBookUtilities.wrapInListItem(DocBookUtilities.wrapInPara( "[" + translatedTopic.getLocale().getValue() + "] " + translatedTopic.getTitle()))); } else { topicTitles = CollectionUtilities.toArrayList( DocBookUtilities.wrapInListItem(DocBookUtilities.wrapInPara(topic.getTitle()))); } } else { topicTitles = CollectionUtilities.toArrayList( DocBookUtilities.wrapInListItem(DocBookUtilities.wrapInPara(topic.getTitle()))); } final String topicULink = createTopicTableLinks(topic, showEditorLink, zanataDetails); final String topicTitle = DocBookUtilities.wrapListItems(topicTitles); final String topicTags = buildItemizedTopicTagList(topic); rows.add(CollectionUtilities.toArrayList(new String[]{topicULink, topicTitle, topicTags})); } return rows.size() > 0 ? DocBookUtilities.wrapInTable(tableTitle, tableHeaders, rows) : ""; }
java
public static String buildReportTable(final List<TopicErrorData> topicErrorDatas, final String tableTitle, final boolean showEditorLink, final ZanataDetails zanataDetails) { final List<String> tableHeaders = CollectionUtilities.toArrayList(new String[]{"Topic Link", "Topic Title", "Topic Tags"}); // Put the details into different tables final List<List<String>> rows = new ArrayList<List<String>>(); for (final TopicErrorData topicErrorData : topicErrorDatas) { final BaseTopicWrapper<?> topic = topicErrorData.getTopic(); final List<String> topicTitles; if (topic instanceof TranslatedTopicWrapper) { final TranslatedTopicWrapper translatedTopic = (TranslatedTopicWrapper) topic; if (!EntityUtilities.isDummyTopic(translatedTopic) && translatedTopic.getTopic() != null) { topicTitles = CollectionUtilities.toArrayList(DocBookUtilities.wrapInListItem(DocBookUtilities.wrapInPara( "[" + translatedTopic.getTopic().getLocale().getValue() + "] " + translatedTopic.getTopic().getTitle())), DocBookUtilities.wrapInListItem(DocBookUtilities.wrapInPara( "[" + translatedTopic.getLocale().getValue() + "] " + translatedTopic.getTitle()))); } else { topicTitles = CollectionUtilities.toArrayList( DocBookUtilities.wrapInListItem(DocBookUtilities.wrapInPara(topic.getTitle()))); } } else { topicTitles = CollectionUtilities.toArrayList( DocBookUtilities.wrapInListItem(DocBookUtilities.wrapInPara(topic.getTitle()))); } final String topicULink = createTopicTableLinks(topic, showEditorLink, zanataDetails); final String topicTitle = DocBookUtilities.wrapListItems(topicTitles); final String topicTags = buildItemizedTopicTagList(topic); rows.add(CollectionUtilities.toArrayList(new String[]{topicULink, topicTitle, topicTags})); } return rows.size() > 0 ? DocBookUtilities.wrapInTable(tableTitle, tableHeaders, rows) : ""; }
[ "public", "static", "String", "buildReportTable", "(", "final", "List", "<", "TopicErrorData", ">", "topicErrorDatas", ",", "final", "String", "tableTitle", ",", "final", "boolean", "showEditorLink", ",", "final", "ZanataDetails", "zanataDetails", ")", "{", "final", "List", "<", "String", ">", "tableHeaders", "=", "CollectionUtilities", ".", "toArrayList", "(", "new", "String", "[", "]", "{", "\"Topic Link\"", ",", "\"Topic Title\"", ",", "\"Topic Tags\"", "}", ")", ";", "// Put the details into different tables", "final", "List", "<", "List", "<", "String", ">", ">", "rows", "=", "new", "ArrayList", "<", "List", "<", "String", ">", ">", "(", ")", ";", "for", "(", "final", "TopicErrorData", "topicErrorData", ":", "topicErrorDatas", ")", "{", "final", "BaseTopicWrapper", "<", "?", ">", "topic", "=", "topicErrorData", ".", "getTopic", "(", ")", ";", "final", "List", "<", "String", ">", "topicTitles", ";", "if", "(", "topic", "instanceof", "TranslatedTopicWrapper", ")", "{", "final", "TranslatedTopicWrapper", "translatedTopic", "=", "(", "TranslatedTopicWrapper", ")", "topic", ";", "if", "(", "!", "EntityUtilities", ".", "isDummyTopic", "(", "translatedTopic", ")", "&&", "translatedTopic", ".", "getTopic", "(", ")", "!=", "null", ")", "{", "topicTitles", "=", "CollectionUtilities", ".", "toArrayList", "(", "DocBookUtilities", ".", "wrapInListItem", "(", "DocBookUtilities", ".", "wrapInPara", "(", "\"[\"", "+", "translatedTopic", ".", "getTopic", "(", ")", ".", "getLocale", "(", ")", ".", "getValue", "(", ")", "+", "\"] \"", "+", "translatedTopic", ".", "getTopic", "(", ")", ".", "getTitle", "(", ")", ")", ")", ",", "DocBookUtilities", ".", "wrapInListItem", "(", "DocBookUtilities", ".", "wrapInPara", "(", "\"[\"", "+", "translatedTopic", ".", "getLocale", "(", ")", ".", "getValue", "(", ")", "+", "\"] \"", "+", "translatedTopic", ".", "getTitle", "(", ")", ")", ")", ")", ";", "}", "else", "{", "topicTitles", "=", "CollectionUtilities", ".", "toArrayList", "(", "DocBookUtilities", ".", "wrapInListItem", "(", "DocBookUtilities", ".", "wrapInPara", "(", "topic", ".", "getTitle", "(", ")", ")", ")", ")", ";", "}", "}", "else", "{", "topicTitles", "=", "CollectionUtilities", ".", "toArrayList", "(", "DocBookUtilities", ".", "wrapInListItem", "(", "DocBookUtilities", ".", "wrapInPara", "(", "topic", ".", "getTitle", "(", ")", ")", ")", ")", ";", "}", "final", "String", "topicULink", "=", "createTopicTableLinks", "(", "topic", ",", "showEditorLink", ",", "zanataDetails", ")", ";", "final", "String", "topicTitle", "=", "DocBookUtilities", ".", "wrapListItems", "(", "topicTitles", ")", ";", "final", "String", "topicTags", "=", "buildItemizedTopicTagList", "(", "topic", ")", ";", "rows", ".", "add", "(", "CollectionUtilities", ".", "toArrayList", "(", "new", "String", "[", "]", "{", "topicULink", ",", "topicTitle", ",", "topicTags", "}", ")", ")", ";", "}", "return", "rows", ".", "size", "(", ")", ">", "0", "?", "DocBookUtilities", ".", "wrapInTable", "(", "tableTitle", ",", "tableHeaders", ",", "rows", ")", ":", "\"\"", ";", "}" ]
Builds a Table to be used within a report. The table contains a link to the topic in Skynet, the topic Title and the list of tags for the topic. @param topicErrorDatas The list of TopicErrorData objects to use to build the table. @param tableTitle The title for the table. @return The table as a String.
[ "Builds", "a", "Table", "to", "be", "used", "within", "a", "report", ".", "The", "table", "contains", "a", "link", "to", "the", "topic", "in", "Skynet", "the", "topic", "Title", "and", "the", "list", "of", "tags", "for", "the", "topic", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/ReportUtilities.java#L52-L85
152,961
tsweets/jdefault
src/main/java/org/beer30/jdefault/JDefaultCode.java
JDefaultCode.isbn
public static String isbn() { StringBuffer stringBuffer = new StringBuffer("09"); stringBuffer.append(String.format("%06d", JDefaultNumber.randomIntBetweenTwoNumbers(0, 49999))); stringBuffer.append(String.format("%02d", JDefaultNumber.randomIntBetweenTwoNumbers(0, 99))); String numberString = stringBuffer.toString(); int number = Integer.parseInt(numberString); int sum = 0; for (int i = 2; i <= 10; i++) { int digit = number % 10; // rightmost digit sum = sum + i * digit; number = number / 10; } // Determine check digit, use X for 10 String checkDigit = null; if (sum % 11 == 1) { checkDigit = "X"; } else if (sum % 11 == 0) { checkDigit = "0"; } else { checkDigit = (11 - (sum % 11)) + ""; } // System.out.println("The full ISBN number is " + numberString+checkDigit); String returnString = stringBuffer.toString(); returnString = returnString.substring(0, 1) + "-" + returnString.substring(1, 7) + "-" + returnString.substring(7, 9) + "-" + checkDigit; return returnString; }
java
public static String isbn() { StringBuffer stringBuffer = new StringBuffer("09"); stringBuffer.append(String.format("%06d", JDefaultNumber.randomIntBetweenTwoNumbers(0, 49999))); stringBuffer.append(String.format("%02d", JDefaultNumber.randomIntBetweenTwoNumbers(0, 99))); String numberString = stringBuffer.toString(); int number = Integer.parseInt(numberString); int sum = 0; for (int i = 2; i <= 10; i++) { int digit = number % 10; // rightmost digit sum = sum + i * digit; number = number / 10; } // Determine check digit, use X for 10 String checkDigit = null; if (sum % 11 == 1) { checkDigit = "X"; } else if (sum % 11 == 0) { checkDigit = "0"; } else { checkDigit = (11 - (sum % 11)) + ""; } // System.out.println("The full ISBN number is " + numberString+checkDigit); String returnString = stringBuffer.toString(); returnString = returnString.substring(0, 1) + "-" + returnString.substring(1, 7) + "-" + returnString.substring(7, 9) + "-" + checkDigit; return returnString; }
[ "public", "static", "String", "isbn", "(", ")", "{", "StringBuffer", "stringBuffer", "=", "new", "StringBuffer", "(", "\"09\"", ")", ";", "stringBuffer", ".", "append", "(", "String", ".", "format", "(", "\"%06d\"", ",", "JDefaultNumber", ".", "randomIntBetweenTwoNumbers", "(", "0", ",", "49999", ")", ")", ")", ";", "stringBuffer", ".", "append", "(", "String", ".", "format", "(", "\"%02d\"", ",", "JDefaultNumber", ".", "randomIntBetweenTwoNumbers", "(", "0", ",", "99", ")", ")", ")", ";", "String", "numberString", "=", "stringBuffer", ".", "toString", "(", ")", ";", "int", "number", "=", "Integer", ".", "parseInt", "(", "numberString", ")", ";", "int", "sum", "=", "0", ";", "for", "(", "int", "i", "=", "2", ";", "i", "<=", "10", ";", "i", "++", ")", "{", "int", "digit", "=", "number", "%", "10", ";", "// rightmost digit", "sum", "=", "sum", "+", "i", "*", "digit", ";", "number", "=", "number", "/", "10", ";", "}", "// Determine check digit, use X for 10", "String", "checkDigit", "=", "null", ";", "if", "(", "sum", "%", "11", "==", "1", ")", "{", "checkDigit", "=", "\"X\"", ";", "}", "else", "if", "(", "sum", "%", "11", "==", "0", ")", "{", "checkDigit", "=", "\"0\"", ";", "}", "else", "{", "checkDigit", "=", "(", "11", "-", "(", "sum", "%", "11", ")", ")", "+", "\"\"", ";", "}", "// System.out.println(\"The full ISBN number is \" + numberString+checkDigit);", "String", "returnString", "=", "stringBuffer", ".", "toString", "(", ")", ";", "returnString", "=", "returnString", ".", "substring", "(", "0", ",", "1", ")", "+", "\"-\"", "+", "returnString", ".", "substring", "(", "1", ",", "7", ")", "+", "\"-\"", "+", "returnString", ".", "substring", "(", "7", ",", "9", ")", "+", "\"-\"", "+", "checkDigit", ";", "return", "returnString", ";", "}" ]
Generates an English Language Publisher Code in the range of 0-900000-xx-x to 0-949999-xx-x @return isbn as a string
[ "Generates", "an", "English", "Language", "Publisher", "Code", "in", "the", "range", "of", "0", "-", "900000", "-", "xx", "-", "x", "to", "0", "-", "949999", "-", "xx", "-", "x" ]
1793ab8e1337e930f31e362071db4af0c3978b70
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultCode.java#L34-L64
152,962
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.checkAndAddListInjections
protected void checkAndAddListInjections(final BuildData buildData, final Document doc, final ITopicNode topicNode, final Map<String, TranslationDetails> translations) { final DocBookXMLPreProcessor preProcessor = buildData.getXMLPreProcessor(); final List<Integer> types = Arrays.asList(DocBookXMLPreProcessor.ORDEREDLIST_INJECTION_POINT, DocBookXMLPreProcessor.ITEMIZEDLIST_INJECTION_POINT, DocBookXMLPreProcessor.LIST_INJECTION_POINT); final HashMap<org.w3c.dom.Node, InjectionListData> customInjections = new HashMap<org.w3c.dom.Node, InjectionListData>(); preProcessor.collectInjectionData(buildData.getContentSpec(), topicNode, new ArrayList<String>(), doc, buildData.getBuildDatabase(), new ArrayList<String>(), customInjections, buildData.isUseFixedUrls(), types); // Now convert the custom injection points for (final org.w3c.dom.Node customInjectionCommentNode : customInjections.keySet()) { final InjectionListData injectionListData = customInjections.get(customInjectionCommentNode); /* * this may not be true if we are not building all related topics */ if (injectionListData.listItems.size() != 0) { for (final List<Element> elements : injectionListData.listItems) { final Element para = doc.createElement("para"); for (final Element element : elements) { para.appendChild(element); } final String translationString = XMLUtilities.convertNodeToString(para, false); translations.put(translationString, new TranslationDetails(translationString, false, "para")); } } } }
java
protected void checkAndAddListInjections(final BuildData buildData, final Document doc, final ITopicNode topicNode, final Map<String, TranslationDetails> translations) { final DocBookXMLPreProcessor preProcessor = buildData.getXMLPreProcessor(); final List<Integer> types = Arrays.asList(DocBookXMLPreProcessor.ORDEREDLIST_INJECTION_POINT, DocBookXMLPreProcessor.ITEMIZEDLIST_INJECTION_POINT, DocBookXMLPreProcessor.LIST_INJECTION_POINT); final HashMap<org.w3c.dom.Node, InjectionListData> customInjections = new HashMap<org.w3c.dom.Node, InjectionListData>(); preProcessor.collectInjectionData(buildData.getContentSpec(), topicNode, new ArrayList<String>(), doc, buildData.getBuildDatabase(), new ArrayList<String>(), customInjections, buildData.isUseFixedUrls(), types); // Now convert the custom injection points for (final org.w3c.dom.Node customInjectionCommentNode : customInjections.keySet()) { final InjectionListData injectionListData = customInjections.get(customInjectionCommentNode); /* * this may not be true if we are not building all related topics */ if (injectionListData.listItems.size() != 0) { for (final List<Element> elements : injectionListData.listItems) { final Element para = doc.createElement("para"); for (final Element element : elements) { para.appendChild(element); } final String translationString = XMLUtilities.convertNodeToString(para, false); translations.put(translationString, new TranslationDetails(translationString, false, "para")); } } } }
[ "protected", "void", "checkAndAddListInjections", "(", "final", "BuildData", "buildData", ",", "final", "Document", "doc", ",", "final", "ITopicNode", "topicNode", ",", "final", "Map", "<", "String", ",", "TranslationDetails", ">", "translations", ")", "{", "final", "DocBookXMLPreProcessor", "preProcessor", "=", "buildData", ".", "getXMLPreProcessor", "(", ")", ";", "final", "List", "<", "Integer", ">", "types", "=", "Arrays", ".", "asList", "(", "DocBookXMLPreProcessor", ".", "ORDEREDLIST_INJECTION_POINT", ",", "DocBookXMLPreProcessor", ".", "ITEMIZEDLIST_INJECTION_POINT", ",", "DocBookXMLPreProcessor", ".", "LIST_INJECTION_POINT", ")", ";", "final", "HashMap", "<", "org", ".", "w3c", ".", "dom", ".", "Node", ",", "InjectionListData", ">", "customInjections", "=", "new", "HashMap", "<", "org", ".", "w3c", ".", "dom", ".", "Node", ",", "InjectionListData", ">", "(", ")", ";", "preProcessor", ".", "collectInjectionData", "(", "buildData", ".", "getContentSpec", "(", ")", ",", "topicNode", ",", "new", "ArrayList", "<", "String", ">", "(", ")", ",", "doc", ",", "buildData", ".", "getBuildDatabase", "(", ")", ",", "new", "ArrayList", "<", "String", ">", "(", ")", ",", "customInjections", ",", "buildData", ".", "isUseFixedUrls", "(", ")", ",", "types", ")", ";", "// Now convert the custom injection points", "for", "(", "final", "org", ".", "w3c", ".", "dom", ".", "Node", "customInjectionCommentNode", ":", "customInjections", ".", "keySet", "(", ")", ")", "{", "final", "InjectionListData", "injectionListData", "=", "customInjections", ".", "get", "(", "customInjectionCommentNode", ")", ";", "/*\n * this may not be true if we are not building all related topics\n */", "if", "(", "injectionListData", ".", "listItems", ".", "size", "(", ")", "!=", "0", ")", "{", "for", "(", "final", "List", "<", "Element", ">", "elements", ":", "injectionListData", ".", "listItems", ")", "{", "final", "Element", "para", "=", "doc", ".", "createElement", "(", "\"para\"", ")", ";", "for", "(", "final", "Element", "element", ":", "elements", ")", "{", "para", ".", "appendChild", "(", "element", ")", ";", "}", "final", "String", "translationString", "=", "XMLUtilities", ".", "convertNodeToString", "(", "para", ",", "false", ")", ";", "translations", ".", "put", "(", "translationString", ",", "new", "TranslationDetails", "(", "translationString", ",", "false", ",", "\"para\"", ")", ")", ";", "}", "}", "}", "}" ]
Checks to see if any list injections have been used and if so adds the translation xrefs. @param buildData Information and data structures for the build. @param doc The DOM Document to look for list injections in. @param topicNode The topic to get the injections for. @param translations The mapping of original strings to translation strings, that will be used to build the po/pot files.
[ "Checks", "to", "see", "if", "any", "list", "injections", "have", "been", "used", "and", "if", "so", "adds", "the", "translation", "xrefs", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L447-L477
152,963
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.formatTranslationString
protected String formatTranslationString(POBuildData buildData, final String translationString) { try { final Document doc = TopicUtilities.convertXMLStringToDocument("<temp>" + translationString + "</temp>", buildData.getDocBookVersion().getId()); return XMLUtilities.convertNodeToString(doc.getDocumentElement(), false); } catch (Exception e) { return translationString; } }
java
protected String formatTranslationString(POBuildData buildData, final String translationString) { try { final Document doc = TopicUtilities.convertXMLStringToDocument("<temp>" + translationString + "</temp>", buildData.getDocBookVersion().getId()); return XMLUtilities.convertNodeToString(doc.getDocumentElement(), false); } catch (Exception e) { return translationString; } }
[ "protected", "String", "formatTranslationString", "(", "POBuildData", "buildData", ",", "final", "String", "translationString", ")", "{", "try", "{", "final", "Document", "doc", "=", "TopicUtilities", ".", "convertXMLStringToDocument", "(", "\"<temp>\"", "+", "translationString", "+", "\"</temp>\"", ",", "buildData", ".", "getDocBookVersion", "(", ")", ".", "getId", "(", ")", ")", ";", "return", "XMLUtilities", ".", "convertNodeToString", "(", "doc", ".", "getDocumentElement", "(", ")", ",", "false", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "translationString", ";", "}", "}" ]
Formats a string so that it will be compatible with publicans expectations. @param buildData Information and data structures for the build. @param translationString The string to be formatted. @return The formatted string.
[ "Formats", "a", "string", "so", "that", "it", "will", "be", "compatible", "with", "publicans", "expectations", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1083-L1092
152,964
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.processPOTopicInjections
protected void processPOTopicInjections(final POBuildData buildData, final SpecTopic specTopic, final Map<String, TranslationDetails> translations) { // Prerequisites addStringsFromTopicRelationships(buildData, specTopic.getPrerequisiteRelationships(), DocBookXMLPreProcessor.PREREQUISITE_PROPERTY, DocBookXMLPreProcessor.ROLE_PREREQUISITE, translations); // See also addStringsFromTopicRelationships(buildData, specTopic.getRelatedRelationships(), DocBookXMLPreProcessor.SEE_ALSO_PROPERTY, DocBookXMLPreProcessor.ROLE_SEE_ALSO, translations); // Link List addStringsFromTopicRelationships(buildData, specTopic.getLinkListRelationships(), null, DocBookXMLPreProcessor.ROLE_LINK_LIST, translations); // Previous final List<Relationship> prevRelationships = specTopic.getPreviousRelationships(); if (prevRelationships.size() > 1) { addStringsFromProcessRelationships(buildData, specTopic, prevRelationships, DocBookXMLPreProcessor.PREVIOUS_STEPS_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_TITLE_LINK, translations); } else { addStringsFromProcessRelationships(buildData, specTopic, prevRelationships, DocBookXMLPreProcessor.PREVIOUS_STEP_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_TITLE_LINK, translations); } // Next final List<Relationship> nextRelationships = specTopic.getNextRelationships(); if (nextRelationships.size() > 1) { addStringsFromProcessRelationships(buildData, specTopic, nextRelationships, DocBookXMLPreProcessor.NEXT_STEPS_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_TITLE_LINK, translations); } else { addStringsFromProcessRelationships(buildData, specTopic, nextRelationships, DocBookXMLPreProcessor.NEXT_STEP_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_TITLE_LINK, translations); } }
java
protected void processPOTopicInjections(final POBuildData buildData, final SpecTopic specTopic, final Map<String, TranslationDetails> translations) { // Prerequisites addStringsFromTopicRelationships(buildData, specTopic.getPrerequisiteRelationships(), DocBookXMLPreProcessor.PREREQUISITE_PROPERTY, DocBookXMLPreProcessor.ROLE_PREREQUISITE, translations); // See also addStringsFromTopicRelationships(buildData, specTopic.getRelatedRelationships(), DocBookXMLPreProcessor.SEE_ALSO_PROPERTY, DocBookXMLPreProcessor.ROLE_SEE_ALSO, translations); // Link List addStringsFromTopicRelationships(buildData, specTopic.getLinkListRelationships(), null, DocBookXMLPreProcessor.ROLE_LINK_LIST, translations); // Previous final List<Relationship> prevRelationships = specTopic.getPreviousRelationships(); if (prevRelationships.size() > 1) { addStringsFromProcessRelationships(buildData, specTopic, prevRelationships, DocBookXMLPreProcessor.PREVIOUS_STEPS_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_TITLE_LINK, translations); } else { addStringsFromProcessRelationships(buildData, specTopic, prevRelationships, DocBookXMLPreProcessor.PREVIOUS_STEP_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_PREVIOUS_TITLE_LINK, translations); } // Next final List<Relationship> nextRelationships = specTopic.getNextRelationships(); if (nextRelationships.size() > 1) { addStringsFromProcessRelationships(buildData, specTopic, nextRelationships, DocBookXMLPreProcessor.NEXT_STEPS_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_TITLE_LINK, translations); } else { addStringsFromProcessRelationships(buildData, specTopic, nextRelationships, DocBookXMLPreProcessor.NEXT_STEP_PROPERTY, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_LINK, DocBookXMLPreProcessor.ROLE_PROCESS_NEXT_TITLE_LINK, translations); } }
[ "protected", "void", "processPOTopicInjections", "(", "final", "POBuildData", "buildData", ",", "final", "SpecTopic", "specTopic", ",", "final", "Map", "<", "String", ",", "TranslationDetails", ">", "translations", ")", "{", "// Prerequisites", "addStringsFromTopicRelationships", "(", "buildData", ",", "specTopic", ".", "getPrerequisiteRelationships", "(", ")", ",", "DocBookXMLPreProcessor", ".", "PREREQUISITE_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_PREREQUISITE", ",", "translations", ")", ";", "// See also", "addStringsFromTopicRelationships", "(", "buildData", ",", "specTopic", ".", "getRelatedRelationships", "(", ")", ",", "DocBookXMLPreProcessor", ".", "SEE_ALSO_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_SEE_ALSO", ",", "translations", ")", ";", "// Link List", "addStringsFromTopicRelationships", "(", "buildData", ",", "specTopic", ".", "getLinkListRelationships", "(", ")", ",", "null", ",", "DocBookXMLPreProcessor", ".", "ROLE_LINK_LIST", ",", "translations", ")", ";", "// Previous", "final", "List", "<", "Relationship", ">", "prevRelationships", "=", "specTopic", ".", "getPreviousRelationships", "(", ")", ";", "if", "(", "prevRelationships", ".", "size", "(", ")", ">", "1", ")", "{", "addStringsFromProcessRelationships", "(", "buildData", ",", "specTopic", ",", "prevRelationships", ",", "DocBookXMLPreProcessor", ".", "PREVIOUS_STEPS_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_PREVIOUS_LINK", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_PREVIOUS_TITLE_LINK", ",", "translations", ")", ";", "}", "else", "{", "addStringsFromProcessRelationships", "(", "buildData", ",", "specTopic", ",", "prevRelationships", ",", "DocBookXMLPreProcessor", ".", "PREVIOUS_STEP_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_PREVIOUS_LINK", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_PREVIOUS_TITLE_LINK", ",", "translations", ")", ";", "}", "// Next", "final", "List", "<", "Relationship", ">", "nextRelationships", "=", "specTopic", ".", "getNextRelationships", "(", ")", ";", "if", "(", "nextRelationships", ".", "size", "(", ")", ">", "1", ")", "{", "addStringsFromProcessRelationships", "(", "buildData", ",", "specTopic", ",", "nextRelationships", ",", "DocBookXMLPreProcessor", ".", "NEXT_STEPS_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_NEXT_LINK", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_NEXT_TITLE_LINK", ",", "translations", ")", ";", "}", "else", "{", "addStringsFromProcessRelationships", "(", "buildData", ",", "specTopic", ",", "nextRelationships", ",", "DocBookXMLPreProcessor", ".", "NEXT_STEP_PROPERTY", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_NEXT_LINK", ",", "DocBookXMLPreProcessor", ".", "ROLE_PROCESS_NEXT_TITLE_LINK", ",", "translations", ")", ";", "}", "}" ]
Process a spec topic and add any translation strings for it. @param buildData Information and data structures for the build. @param specTopic The spec topic to process any injections for. @param translations The mapping of original strings to translation strings, that will be used to build the po/pot files.
[ "Process", "a", "spec", "topic", "and", "add", "any", "translation", "strings", "for", "it", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1101-L1138
152,965
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.addStringsFromTopicRelationships
protected void addStringsFromTopicRelationships(final POBuildData buildData, final List<Relationship> relationships, final String key, final String roleName, final Map<String, TranslationDetails> translations) { if (!relationships.isEmpty()) { if (key != null) { addStringsForConstant(buildData, key, "title", translations); } addStringsFromRelationships(buildData, relationships, roleName, translations); } }
java
protected void addStringsFromTopicRelationships(final POBuildData buildData, final List<Relationship> relationships, final String key, final String roleName, final Map<String, TranslationDetails> translations) { if (!relationships.isEmpty()) { if (key != null) { addStringsForConstant(buildData, key, "title", translations); } addStringsFromRelationships(buildData, relationships, roleName, translations); } }
[ "protected", "void", "addStringsFromTopicRelationships", "(", "final", "POBuildData", "buildData", ",", "final", "List", "<", "Relationship", ">", "relationships", ",", "final", "String", "key", ",", "final", "String", "roleName", ",", "final", "Map", "<", "String", ",", "TranslationDetails", ">", "translations", ")", "{", "if", "(", "!", "relationships", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "key", "!=", "null", ")", "{", "addStringsForConstant", "(", "buildData", ",", "key", ",", "\"title\"", ",", "translations", ")", ";", "}", "addStringsFromRelationships", "(", "buildData", ",", "relationships", ",", "roleName", ",", "translations", ")", ";", "}", "}" ]
Add the translation strings from a list of relationships for a specific topic. @param buildData Information and data structures for the build. @param relationships The list of relationships to add strings for. @param key The constants key to be used for the relationship list. @param roleName The role name to be used on the relationship xrefs. @param translations The mapping of original strings to translation strings, that will be used to build the po/pot files.
[ "Add", "the", "translation", "strings", "from", "a", "list", "of", "relationships", "for", "a", "specific", "topic", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1149-L1159
152,966
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.addStringsFromProcessRelationships
protected void addStringsFromProcessRelationships(final POBuildData buildData, final SpecTopic specTopic, final List<Relationship> relationships, final String key, final String roleName, final String titleRoleName, final Map<String, TranslationDetails> translations) { if (!relationships.isEmpty()) { if (key != null) { final boolean useFixedUrls = buildData.isUseFixedUrls(); // Get the process title name final Level container = (Level) specTopic.getParent(); String translatedTitle = container.getTitle(); boolean fuzzy = true; if (buildData.getTranslationMap().containsKey("CS" + buildData.getContentSpec().getId())) { final Map<String, TranslationDetails> containerTranslations = buildData.getTranslationMap().get( "CS" + buildData.getContentSpec().getId()); if (containerTranslations.containsKey(container.getTitle())) { final TranslationDetails translationDetails = containerTranslations.get(container.getTitle()); translatedTitle = translationDetails.getTranslation(); if (translatedTitle != null) { fuzzy = translationDetails.isFuzzy(); } } } // Build up the link final String titleLinkId = ((Level) specTopic.getParent()).getUniqueLinkId(useFixedUrls); final String originalTitleLink = DocBookUtilities.buildLink(titleLinkId, titleRoleName, container.getTitle()); final String originalString = buildData.getConstants().getString(key); final String translationString = buildData.getTranslationConstants().getString(key); final String fixedOriginalString = String.format(originalString, originalTitleLink); // Add the translation if (!originalString.equals(translationString)) { final String translatedTitleLink = DocBookUtilities.buildLink(titleLinkId, titleRoleName, translatedTitle); final String fixedTranslationString = String.format(translationString, translatedTitleLink); translations.put(fixedOriginalString, new TranslationDetails(fixedTranslationString, fuzzy, "title")); } else { translations.put(fixedOriginalString, new TranslationDetails(null, fuzzy, "title")); } } addStringsFromRelationships(buildData, relationships, roleName, translations); } }
java
protected void addStringsFromProcessRelationships(final POBuildData buildData, final SpecTopic specTopic, final List<Relationship> relationships, final String key, final String roleName, final String titleRoleName, final Map<String, TranslationDetails> translations) { if (!relationships.isEmpty()) { if (key != null) { final boolean useFixedUrls = buildData.isUseFixedUrls(); // Get the process title name final Level container = (Level) specTopic.getParent(); String translatedTitle = container.getTitle(); boolean fuzzy = true; if (buildData.getTranslationMap().containsKey("CS" + buildData.getContentSpec().getId())) { final Map<String, TranslationDetails> containerTranslations = buildData.getTranslationMap().get( "CS" + buildData.getContentSpec().getId()); if (containerTranslations.containsKey(container.getTitle())) { final TranslationDetails translationDetails = containerTranslations.get(container.getTitle()); translatedTitle = translationDetails.getTranslation(); if (translatedTitle != null) { fuzzy = translationDetails.isFuzzy(); } } } // Build up the link final String titleLinkId = ((Level) specTopic.getParent()).getUniqueLinkId(useFixedUrls); final String originalTitleLink = DocBookUtilities.buildLink(titleLinkId, titleRoleName, container.getTitle()); final String originalString = buildData.getConstants().getString(key); final String translationString = buildData.getTranslationConstants().getString(key); final String fixedOriginalString = String.format(originalString, originalTitleLink); // Add the translation if (!originalString.equals(translationString)) { final String translatedTitleLink = DocBookUtilities.buildLink(titleLinkId, titleRoleName, translatedTitle); final String fixedTranslationString = String.format(translationString, translatedTitleLink); translations.put(fixedOriginalString, new TranslationDetails(fixedTranslationString, fuzzy, "title")); } else { translations.put(fixedOriginalString, new TranslationDetails(null, fuzzy, "title")); } } addStringsFromRelationships(buildData, relationships, roleName, translations); } }
[ "protected", "void", "addStringsFromProcessRelationships", "(", "final", "POBuildData", "buildData", ",", "final", "SpecTopic", "specTopic", ",", "final", "List", "<", "Relationship", ">", "relationships", ",", "final", "String", "key", ",", "final", "String", "roleName", ",", "final", "String", "titleRoleName", ",", "final", "Map", "<", "String", ",", "TranslationDetails", ">", "translations", ")", "{", "if", "(", "!", "relationships", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "key", "!=", "null", ")", "{", "final", "boolean", "useFixedUrls", "=", "buildData", ".", "isUseFixedUrls", "(", ")", ";", "// Get the process title name", "final", "Level", "container", "=", "(", "Level", ")", "specTopic", ".", "getParent", "(", ")", ";", "String", "translatedTitle", "=", "container", ".", "getTitle", "(", ")", ";", "boolean", "fuzzy", "=", "true", ";", "if", "(", "buildData", ".", "getTranslationMap", "(", ")", ".", "containsKey", "(", "\"CS\"", "+", "buildData", ".", "getContentSpec", "(", ")", ".", "getId", "(", ")", ")", ")", "{", "final", "Map", "<", "String", ",", "TranslationDetails", ">", "containerTranslations", "=", "buildData", ".", "getTranslationMap", "(", ")", ".", "get", "(", "\"CS\"", "+", "buildData", ".", "getContentSpec", "(", ")", ".", "getId", "(", ")", ")", ";", "if", "(", "containerTranslations", ".", "containsKey", "(", "container", ".", "getTitle", "(", ")", ")", ")", "{", "final", "TranslationDetails", "translationDetails", "=", "containerTranslations", ".", "get", "(", "container", ".", "getTitle", "(", ")", ")", ";", "translatedTitle", "=", "translationDetails", ".", "getTranslation", "(", ")", ";", "if", "(", "translatedTitle", "!=", "null", ")", "{", "fuzzy", "=", "translationDetails", ".", "isFuzzy", "(", ")", ";", "}", "}", "}", "// Build up the link", "final", "String", "titleLinkId", "=", "(", "(", "Level", ")", "specTopic", ".", "getParent", "(", ")", ")", ".", "getUniqueLinkId", "(", "useFixedUrls", ")", ";", "final", "String", "originalTitleLink", "=", "DocBookUtilities", ".", "buildLink", "(", "titleLinkId", ",", "titleRoleName", ",", "container", ".", "getTitle", "(", ")", ")", ";", "final", "String", "originalString", "=", "buildData", ".", "getConstants", "(", ")", ".", "getString", "(", "key", ")", ";", "final", "String", "translationString", "=", "buildData", ".", "getTranslationConstants", "(", ")", ".", "getString", "(", "key", ")", ";", "final", "String", "fixedOriginalString", "=", "String", ".", "format", "(", "originalString", ",", "originalTitleLink", ")", ";", "// Add the translation", "if", "(", "!", "originalString", ".", "equals", "(", "translationString", ")", ")", "{", "final", "String", "translatedTitleLink", "=", "DocBookUtilities", ".", "buildLink", "(", "titleLinkId", ",", "titleRoleName", ",", "translatedTitle", ")", ";", "final", "String", "fixedTranslationString", "=", "String", ".", "format", "(", "translationString", ",", "translatedTitleLink", ")", ";", "translations", ".", "put", "(", "fixedOriginalString", ",", "new", "TranslationDetails", "(", "fixedTranslationString", ",", "fuzzy", ",", "\"title\"", ")", ")", ";", "}", "else", "{", "translations", ".", "put", "(", "fixedOriginalString", ",", "new", "TranslationDetails", "(", "null", ",", "fuzzy", ",", "\"title\"", ")", ")", ";", "}", "}", "addStringsFromRelationships", "(", "buildData", ",", "relationships", ",", "roleName", ",", "translations", ")", ";", "}", "}" ]
Add the translation strings from a list of relationships for a specific topic in a process. @param buildData Information and data structures for the build. @param specTopic The spec topic that the relationships belong to. @param relationships The list of relationships to add strings for. @param key The constants key to be used for the relationship list. @param roleName The role name to be used on the relationship xrefs. @param titleRoleName The role name to be used on the process relationship titles xref. @param translations The mapping of original strings to translation strings, that will be used to build the po/pot files.
[ "Add", "the", "translation", "strings", "from", "a", "list", "of", "relationships", "for", "a", "specific", "topic", "in", "a", "process", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1172-L1215
152,967
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.addStringsFromRelationships
protected void addStringsFromRelationships(final BuildData buildData, final List<Relationship> relationships, final String roleName, final Map<String, TranslationDetails> translations) { final boolean useFixedUrls = buildData.isUseFixedUrls(); for (final Relationship relationship : relationships) { final SpecNode relatedNode; if (relationship instanceof TopicRelationship) { relatedNode = ((TopicRelationship) relationship).getSecondaryRelationship(); } else { relatedNode = ((TargetRelationship) relationship).getSecondaryRelationship(); } final String xrefString = DocBookUtilities.buildXRef(relatedNode.getUniqueLinkId(useFixedUrls), roleName); translations.put(xrefString, new TranslationDetails(xrefString, false, "para")); } }
java
protected void addStringsFromRelationships(final BuildData buildData, final List<Relationship> relationships, final String roleName, final Map<String, TranslationDetails> translations) { final boolean useFixedUrls = buildData.isUseFixedUrls(); for (final Relationship relationship : relationships) { final SpecNode relatedNode; if (relationship instanceof TopicRelationship) { relatedNode = ((TopicRelationship) relationship).getSecondaryRelationship(); } else { relatedNode = ((TargetRelationship) relationship).getSecondaryRelationship(); } final String xrefString = DocBookUtilities.buildXRef(relatedNode.getUniqueLinkId(useFixedUrls), roleName); translations.put(xrefString, new TranslationDetails(xrefString, false, "para")); } }
[ "protected", "void", "addStringsFromRelationships", "(", "final", "BuildData", "buildData", ",", "final", "List", "<", "Relationship", ">", "relationships", ",", "final", "String", "roleName", ",", "final", "Map", "<", "String", ",", "TranslationDetails", ">", "translations", ")", "{", "final", "boolean", "useFixedUrls", "=", "buildData", ".", "isUseFixedUrls", "(", ")", ";", "for", "(", "final", "Relationship", "relationship", ":", "relationships", ")", "{", "final", "SpecNode", "relatedNode", ";", "if", "(", "relationship", "instanceof", "TopicRelationship", ")", "{", "relatedNode", "=", "(", "(", "TopicRelationship", ")", "relationship", ")", ".", "getSecondaryRelationship", "(", ")", ";", "}", "else", "{", "relatedNode", "=", "(", "(", "TargetRelationship", ")", "relationship", ")", ".", "getSecondaryRelationship", "(", ")", ";", "}", "final", "String", "xrefString", "=", "DocBookUtilities", ".", "buildXRef", "(", "relatedNode", ".", "getUniqueLinkId", "(", "useFixedUrls", ")", ",", "roleName", ")", ";", "translations", ".", "put", "(", "xrefString", ",", "new", "TranslationDetails", "(", "xrefString", ",", "false", ",", "\"para\"", ")", ")", ";", "}", "}" ]
Add the translation strings from a list of relationships. @param buildData Information and data structures for the build. @param relationships The list of relationships to add strings for. @param roleName The role name to be used on the relationship xrefs. @param translations The mapping of original strings to translation strings, that will be used to build the po/pot files.
[ "Add", "the", "translation", "strings", "from", "a", "list", "of", "relationships", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1225-L1240
152,968
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.processPOTopicBugLink
protected void processPOTopicBugLink(final POBuildData buildData, final SpecTopic specTopic, final Map<String, TranslationDetails> translations) throws BuildProcessingException { try { final DocBookXMLPreProcessor preProcessor = buildData.getXMLPreProcessor(); final String bugLinkUrl = preProcessor.getBugLinkUrl(buildData, specTopic); processPOBugLinks(buildData, preProcessor, bugLinkUrl, translations); } catch (BugLinkException e) { throw new BuildProcessingException(e); } catch (Exception e) { throw new BuildProcessingException("Failed to insert Bug Links into the DOM Document", e); } }
java
protected void processPOTopicBugLink(final POBuildData buildData, final SpecTopic specTopic, final Map<String, TranslationDetails> translations) throws BuildProcessingException { try { final DocBookXMLPreProcessor preProcessor = buildData.getXMLPreProcessor(); final String bugLinkUrl = preProcessor.getBugLinkUrl(buildData, specTopic); processPOBugLinks(buildData, preProcessor, bugLinkUrl, translations); } catch (BugLinkException e) { throw new BuildProcessingException(e); } catch (Exception e) { throw new BuildProcessingException("Failed to insert Bug Links into the DOM Document", e); } }
[ "protected", "void", "processPOTopicBugLink", "(", "final", "POBuildData", "buildData", ",", "final", "SpecTopic", "specTopic", ",", "final", "Map", "<", "String", ",", "TranslationDetails", ">", "translations", ")", "throws", "BuildProcessingException", "{", "try", "{", "final", "DocBookXMLPreProcessor", "preProcessor", "=", "buildData", ".", "getXMLPreProcessor", "(", ")", ";", "final", "String", "bugLinkUrl", "=", "preProcessor", ".", "getBugLinkUrl", "(", "buildData", ",", "specTopic", ")", ";", "processPOBugLinks", "(", "buildData", ",", "preProcessor", ",", "bugLinkUrl", ",", "translations", ")", ";", "}", "catch", "(", "BugLinkException", "e", ")", "{", "throw", "new", "BuildProcessingException", "(", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "BuildProcessingException", "(", "\"Failed to insert Bug Links into the DOM Document\"", ",", "e", ")", ";", "}", "}" ]
Add any bug link strings for a specific topic. @param buildData Information and data structures for the build. @param specTopic The spec topic to create any bug link translation strings for. @param translations The mapping of original strings to translation strings, that will be used to build the po/pot files. @throws BuildProcessingException Thrown if the bug links cannot be created.
[ "Add", "any", "bug", "link", "strings", "for", "a", "specific", "topic", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1250-L1262
152,969
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.processPOInitialContentBugLink
protected void processPOInitialContentBugLink(final POBuildData buildData, final InitialContent initialContent, final Map<String, TranslationDetails> translations) throws BuildProcessingException { try { final DocBookXMLPreProcessor preProcessor = buildData.getXMLPreProcessor(); final String bugLinkUrl = preProcessor.getBugLinkUrl(buildData, initialContent); processPOBugLinks(buildData, preProcessor, bugLinkUrl, translations); } catch (BugLinkException e) { throw new BuildProcessingException(e); } catch (Exception e) { throw new BuildProcessingException("Failed to insert Bug Links into the DOM Document", e); } }
java
protected void processPOInitialContentBugLink(final POBuildData buildData, final InitialContent initialContent, final Map<String, TranslationDetails> translations) throws BuildProcessingException { try { final DocBookXMLPreProcessor preProcessor = buildData.getXMLPreProcessor(); final String bugLinkUrl = preProcessor.getBugLinkUrl(buildData, initialContent); processPOBugLinks(buildData, preProcessor, bugLinkUrl, translations); } catch (BugLinkException e) { throw new BuildProcessingException(e); } catch (Exception e) { throw new BuildProcessingException("Failed to insert Bug Links into the DOM Document", e); } }
[ "protected", "void", "processPOInitialContentBugLink", "(", "final", "POBuildData", "buildData", ",", "final", "InitialContent", "initialContent", ",", "final", "Map", "<", "String", ",", "TranslationDetails", ">", "translations", ")", "throws", "BuildProcessingException", "{", "try", "{", "final", "DocBookXMLPreProcessor", "preProcessor", "=", "buildData", ".", "getXMLPreProcessor", "(", ")", ";", "final", "String", "bugLinkUrl", "=", "preProcessor", ".", "getBugLinkUrl", "(", "buildData", ",", "initialContent", ")", ";", "processPOBugLinks", "(", "buildData", ",", "preProcessor", ",", "bugLinkUrl", ",", "translations", ")", ";", "}", "catch", "(", "BugLinkException", "e", ")", "{", "throw", "new", "BuildProcessingException", "(", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "BuildProcessingException", "(", "\"Failed to insert Bug Links into the DOM Document\"", ",", "e", ")", ";", "}", "}" ]
Add any bug link strings for a specific initial content container. @param buildData Information and data structures for the build. @param initialContent The initial content to create any bug link translation strings for. @param translations The mapping of original strings to translation strings, that will be used to build the po/pot files. @throws BuildProcessingException Thrown if the bug links cannot be created.
[ "Add", "any", "bug", "link", "strings", "for", "a", "specific", "initial", "content", "container", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1272-L1284
152,970
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.processPOBugLinks
protected void processPOBugLinks(final POBuildData buildData, final DocBookXMLPreProcessor preProcessor, final String bugLinkUrl, final Map<String, TranslationDetails> translations) { final String originalString = buildData.getConstants().getString("REPORT_A_BUG"); final String translationString = buildData.getTranslationConstants().getString("REPORT_A_BUG"); final String originalLink = preProcessor.createExternalLinkElement(buildData.getDocBookVersion(), originalString, bugLinkUrl); // Check to see if the report a bug text has translations if (originalString.equals(translationString)) { translations.put(originalLink, new TranslationDetails(null, false, "para")); } else { final String translatedLink = preProcessor.createExternalLinkElement(buildData.getDocBookVersion(), translationString, bugLinkUrl); translations.put(originalLink, new TranslationDetails(translatedLink, false, "para")); } }
java
protected void processPOBugLinks(final POBuildData buildData, final DocBookXMLPreProcessor preProcessor, final String bugLinkUrl, final Map<String, TranslationDetails> translations) { final String originalString = buildData.getConstants().getString("REPORT_A_BUG"); final String translationString = buildData.getTranslationConstants().getString("REPORT_A_BUG"); final String originalLink = preProcessor.createExternalLinkElement(buildData.getDocBookVersion(), originalString, bugLinkUrl); // Check to see if the report a bug text has translations if (originalString.equals(translationString)) { translations.put(originalLink, new TranslationDetails(null, false, "para")); } else { final String translatedLink = preProcessor.createExternalLinkElement(buildData.getDocBookVersion(), translationString, bugLinkUrl); translations.put(originalLink, new TranslationDetails(translatedLink, false, "para")); } }
[ "protected", "void", "processPOBugLinks", "(", "final", "POBuildData", "buildData", ",", "final", "DocBookXMLPreProcessor", "preProcessor", ",", "final", "String", "bugLinkUrl", ",", "final", "Map", "<", "String", ",", "TranslationDetails", ">", "translations", ")", "{", "final", "String", "originalString", "=", "buildData", ".", "getConstants", "(", ")", ".", "getString", "(", "\"REPORT_A_BUG\"", ")", ";", "final", "String", "translationString", "=", "buildData", ".", "getTranslationConstants", "(", ")", ".", "getString", "(", "\"REPORT_A_BUG\"", ")", ";", "final", "String", "originalLink", "=", "preProcessor", ".", "createExternalLinkElement", "(", "buildData", ".", "getDocBookVersion", "(", ")", ",", "originalString", ",", "bugLinkUrl", ")", ";", "// Check to see if the report a bug text has translations", "if", "(", "originalString", ".", "equals", "(", "translationString", ")", ")", "{", "translations", ".", "put", "(", "originalLink", ",", "new", "TranslationDetails", "(", "null", ",", "false", ",", "\"para\"", ")", ")", ";", "}", "else", "{", "final", "String", "translatedLink", "=", "preProcessor", ".", "createExternalLinkElement", "(", "buildData", ".", "getDocBookVersion", "(", ")", ",", "translationString", ",", "bugLinkUrl", ")", ";", "translations", ".", "put", "(", "originalLink", ",", "new", "TranslationDetails", "(", "translatedLink", ",", "false", ",", "\"para\"", ")", ")", ";", "}", "}" ]
Creates the strings for a specific bug link url. @param buildData Information and data structures for the build. @param preProcessor The {@link DocBookXMLPreProcessor} instance to use to create the bug links. @param bugLinkUrl The bug link url. @param translations The mapping of original strings to translation strings, that will be used to build the po/pot files.
[ "Creates", "the", "strings", "for", "a", "specific", "bug", "link", "url", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1294-L1310
152,971
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.createBasePOFile
protected StringBuilder createBasePOFile(final BuildData buildData) { final String formattedDate = POT_DATE_FORMAT.format(buildData.getBuildDate()); return new StringBuilder("# \n") .append("# AUTHOR <EMAIL@ADDRESS>, YEAR.\n") .append("#\n") .append("msgid \"\"\n") .append("msgstr \"\"\n") .append("\"Project-Id-Version: 0\\n\"\n") .append("\"POT-Creation-Date: ").append(formattedDate).append("\\n\"\n") .append("\"PO-Revision-Date: ").append(formattedDate).append("\\n\"\n") .append("\"Last-Translator: Automatically generated\\n\"\n") .append("\"Language-Team: None\\n\"\n") .append("\"MIME-Version: 1.0\\n\"\n") .append("\"Content-Type: application/x-pressgang-ccms; charset=").append(ENCODING).append("\\n\"\n") .append("\"Content-Transfer-Encoding: 8bit\\n\"\n"); }
java
protected StringBuilder createBasePOFile(final BuildData buildData) { final String formattedDate = POT_DATE_FORMAT.format(buildData.getBuildDate()); return new StringBuilder("# \n") .append("# AUTHOR <EMAIL@ADDRESS>, YEAR.\n") .append("#\n") .append("msgid \"\"\n") .append("msgstr \"\"\n") .append("\"Project-Id-Version: 0\\n\"\n") .append("\"POT-Creation-Date: ").append(formattedDate).append("\\n\"\n") .append("\"PO-Revision-Date: ").append(formattedDate).append("\\n\"\n") .append("\"Last-Translator: Automatically generated\\n\"\n") .append("\"Language-Team: None\\n\"\n") .append("\"MIME-Version: 1.0\\n\"\n") .append("\"Content-Type: application/x-pressgang-ccms; charset=").append(ENCODING).append("\\n\"\n") .append("\"Content-Transfer-Encoding: 8bit\\n\"\n"); }
[ "protected", "StringBuilder", "createBasePOFile", "(", "final", "BuildData", "buildData", ")", "{", "final", "String", "formattedDate", "=", "POT_DATE_FORMAT", ".", "format", "(", "buildData", ".", "getBuildDate", "(", ")", ")", ";", "return", "new", "StringBuilder", "(", "\"# \\n\"", ")", ".", "append", "(", "\"# AUTHOR <EMAIL@ADDRESS>, YEAR.\\n\"", ")", ".", "append", "(", "\"#\\n\"", ")", ".", "append", "(", "\"msgid \\\"\\\"\\n\"", ")", ".", "append", "(", "\"msgstr \\\"\\\"\\n\"", ")", ".", "append", "(", "\"\\\"Project-Id-Version: 0\\\\n\\\"\\n\"", ")", ".", "append", "(", "\"\\\"POT-Creation-Date: \"", ")", ".", "append", "(", "formattedDate", ")", ".", "append", "(", "\"\\\\n\\\"\\n\"", ")", ".", "append", "(", "\"\\\"PO-Revision-Date: \"", ")", ".", "append", "(", "formattedDate", ")", ".", "append", "(", "\"\\\\n\\\"\\n\"", ")", ".", "append", "(", "\"\\\"Last-Translator: Automatically generated\\\\n\\\"\\n\"", ")", ".", "append", "(", "\"\\\"Language-Team: None\\\\n\\\"\\n\"", ")", ".", "append", "(", "\"\\\"MIME-Version: 1.0\\\\n\\\"\\n\"", ")", ".", "append", "(", "\"\\\"Content-Type: application/x-pressgang-ccms; charset=\"", ")", ".", "append", "(", "ENCODING", ")", ".", "append", "(", "\"\\\\n\\\"\\n\"", ")", ".", "append", "(", "\"\\\"Content-Transfer-Encoding: 8bit\\\\n\\\"\\n\"", ")", ";", "}" ]
Create the base initial content required for all PO and POT files. @param buildData Information and data structures for the build. @return A {@link StringBuilder} instance initialised with the base content required for a PO/POT file.
[ "Create", "the", "base", "initial", "content", "required", "for", "all", "PO", "and", "POT", "files", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1427-L1443
152,972
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.addPOTEntry
protected void addPOTEntry(final String tag, final String source, final StringBuilder potFile) { addPOEntry(tag, source, "", false, potFile); }
java
protected void addPOTEntry(final String tag, final String source, final StringBuilder potFile) { addPOEntry(tag, source, "", false, potFile); }
[ "protected", "void", "addPOTEntry", "(", "final", "String", "tag", ",", "final", "String", "source", ",", "final", "StringBuilder", "potFile", ")", "{", "addPOEntry", "(", "tag", ",", "source", ",", "\"\"", ",", "false", ",", "potFile", ")", ";", "}" ]
Add an entry to a POT file. @param tag The XML element name. @param source The original source string. @param potFile The POT file to add to.
[ "Add", "an", "entry", "to", "a", "POT", "file", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1452-L1454
152,973
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.addPOEntry
protected void addPOEntry(final String tag, final String source, final String translation, final boolean fuzzy, final StringBuilder poFile) { // perform a check to make sure the source isn't an empty string, as this could be the case after removing the comments if (source == null || source.length() == 0) return; poFile.append("\n"); if (!isNullOrEmpty(tag)) { poFile.append("#. Tag: ").append(tag).append("\n"); } if (fuzzy) { poFile.append("#, fuzzy\n"); } poFile.append("#, no-c-format\n") .append("msgid \"").append(escapeForPOFile(source, true)).append("\"\n") .append("msgstr \"").append(escapeForPOFile(translation, false)).append("\"\n"); }
java
protected void addPOEntry(final String tag, final String source, final String translation, final boolean fuzzy, final StringBuilder poFile) { // perform a check to make sure the source isn't an empty string, as this could be the case after removing the comments if (source == null || source.length() == 0) return; poFile.append("\n"); if (!isNullOrEmpty(tag)) { poFile.append("#. Tag: ").append(tag).append("\n"); } if (fuzzy) { poFile.append("#, fuzzy\n"); } poFile.append("#, no-c-format\n") .append("msgid \"").append(escapeForPOFile(source, true)).append("\"\n") .append("msgstr \"").append(escapeForPOFile(translation, false)).append("\"\n"); }
[ "protected", "void", "addPOEntry", "(", "final", "String", "tag", ",", "final", "String", "source", ",", "final", "String", "translation", ",", "final", "boolean", "fuzzy", ",", "final", "StringBuilder", "poFile", ")", "{", "// perform a check to make sure the source isn't an empty string, as this could be the case after removing the comments", "if", "(", "source", "==", "null", "||", "source", ".", "length", "(", ")", "==", "0", ")", "return", ";", "poFile", ".", "append", "(", "\"\\n\"", ")", ";", "if", "(", "!", "isNullOrEmpty", "(", "tag", ")", ")", "{", "poFile", ".", "append", "(", "\"#. Tag: \"", ")", ".", "append", "(", "tag", ")", ".", "append", "(", "\"\\n\"", ")", ";", "}", "if", "(", "fuzzy", ")", "{", "poFile", ".", "append", "(", "\"#, fuzzy\\n\"", ")", ";", "}", "poFile", ".", "append", "(", "\"#, no-c-format\\n\"", ")", ".", "append", "(", "\"msgid \\\"\"", ")", ".", "append", "(", "escapeForPOFile", "(", "source", ",", "true", ")", ")", ".", "append", "(", "\"\\\"\\n\"", ")", ".", "append", "(", "\"msgstr \\\"\"", ")", ".", "append", "(", "escapeForPOFile", "(", "translation", ",", "false", ")", ")", ".", "append", "(", "\"\\\"\\n\"", ")", ";", "}" ]
Add an entry to a PO file. @param tag The XML element name. @param source The original source string. @param translation The translated string. @param fuzzy If the translation is fuzzy. @param poFile The PO file to add to.
[ "Add", "an", "entry", "to", "a", "PO", "file", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1465-L1480
152,974
NessComputing/components-ness-scopes
src/main/java/com/nesscomputing/scopes/threaddelegate/ThreadDelegatedContext.java
ThreadDelegatedContext.putIfAbsent
@SuppressWarnings("PMD.UnnecessaryLocalBeforeReturn") <T> T putIfAbsent(@Nonnull final Key<T> key, @Nonnull final Provider<T> valueComputer) throws InterruptedException, ExecutionException { Preconditions.checkArgument(key != null, "Key must not be null!"); // Fast path, if the value exists, return it as fast as possible Future<?> oldValue = contents.get(key); if (oldValue != null) { @SuppressWarnings("unchecked") T value = (T) oldValue.get(); return value; } FutureTask<T> task = new FutureTask<>(new Callable<T>() { @Override public T call() throws Exception { T value = valueComputer.get(); // Register the value if it listens to scoping events if (value instanceof ScopeListener) { final ScopeListener listener = (ScopeListener) value; listeners.add(listener); // Send an "enter" event to notify the listener that it was put in scope. listener.event(ScopeEvent.ENTER); } return value; } }); Future<?> existingTask = contents.putIfAbsent(key, task); if (existingTask == null) { // Now our task is in the map, so run it task.run(); return task.get(); } else { // Someone else beat us to it, make sure to throw our task away and use theirs @SuppressWarnings("unchecked") T newValue = (T) existingTask.get(); return newValue; } }
java
@SuppressWarnings("PMD.UnnecessaryLocalBeforeReturn") <T> T putIfAbsent(@Nonnull final Key<T> key, @Nonnull final Provider<T> valueComputer) throws InterruptedException, ExecutionException { Preconditions.checkArgument(key != null, "Key must not be null!"); // Fast path, if the value exists, return it as fast as possible Future<?> oldValue = contents.get(key); if (oldValue != null) { @SuppressWarnings("unchecked") T value = (T) oldValue.get(); return value; } FutureTask<T> task = new FutureTask<>(new Callable<T>() { @Override public T call() throws Exception { T value = valueComputer.get(); // Register the value if it listens to scoping events if (value instanceof ScopeListener) { final ScopeListener listener = (ScopeListener) value; listeners.add(listener); // Send an "enter" event to notify the listener that it was put in scope. listener.event(ScopeEvent.ENTER); } return value; } }); Future<?> existingTask = contents.putIfAbsent(key, task); if (existingTask == null) { // Now our task is in the map, so run it task.run(); return task.get(); } else { // Someone else beat us to it, make sure to throw our task away and use theirs @SuppressWarnings("unchecked") T newValue = (T) existingTask.get(); return newValue; } }
[ "@", "SuppressWarnings", "(", "\"PMD.UnnecessaryLocalBeforeReturn\"", ")", "<", "T", ">", "T", "putIfAbsent", "(", "@", "Nonnull", "final", "Key", "<", "T", ">", "key", ",", "@", "Nonnull", "final", "Provider", "<", "T", ">", "valueComputer", ")", "throws", "InterruptedException", ",", "ExecutionException", "{", "Preconditions", ".", "checkArgument", "(", "key", "!=", "null", ",", "\"Key must not be null!\"", ")", ";", "// Fast path, if the value exists, return it as fast as possible", "Future", "<", "?", ">", "oldValue", "=", "contents", ".", "get", "(", "key", ")", ";", "if", "(", "oldValue", "!=", "null", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "T", "value", "=", "(", "T", ")", "oldValue", ".", "get", "(", ")", ";", "return", "value", ";", "}", "FutureTask", "<", "T", ">", "task", "=", "new", "FutureTask", "<>", "(", "new", "Callable", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "T", "call", "(", ")", "throws", "Exception", "{", "T", "value", "=", "valueComputer", ".", "get", "(", ")", ";", "// Register the value if it listens to scoping events", "if", "(", "value", "instanceof", "ScopeListener", ")", "{", "final", "ScopeListener", "listener", "=", "(", "ScopeListener", ")", "value", ";", "listeners", ".", "add", "(", "listener", ")", ";", "// Send an \"enter\" event to notify the listener that it was put in scope.", "listener", ".", "event", "(", "ScopeEvent", ".", "ENTER", ")", ";", "}", "return", "value", ";", "}", "}", ")", ";", "Future", "<", "?", ">", "existingTask", "=", "contents", ".", "putIfAbsent", "(", "key", ",", "task", ")", ";", "if", "(", "existingTask", "==", "null", ")", "{", "// Now our task is in the map, so run it", "task", ".", "run", "(", ")", ";", "return", "task", ".", "get", "(", ")", ";", "}", "else", "{", "// Someone else beat us to it, make sure to throw our task away and use theirs", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "T", "newValue", "=", "(", "T", ")", "existingTask", ".", "get", "(", ")", ";", "return", "newValue", ";", "}", "}" ]
Compute and enter a value into the context unless the value has already been computed. @param key the key to associate this value with @param valueComputer the Provider that will compute the value if necessary @return the old value, if it already existed, or the freshly computed value
[ "Compute", "and", "enter", "a", "value", "into", "the", "context", "unless", "the", "value", "has", "already", "been", "computed", "." ]
f055ea4897b0cca9ee6dc815b7a42c0dc53ffbd4
https://github.com/NessComputing/components-ness-scopes/blob/f055ea4897b0cca9ee6dc815b7a42c0dc53ffbd4/src/main/java/com/nesscomputing/scopes/threaddelegate/ThreadDelegatedContext.java#L74-L117
152,975
jbundle/jbundle
app/program/db/src/main/java/org/jbundle/app/program/db/IncludeScopeField.java
IncludeScopeField.includeThis
public boolean includeThis(ClassProjectModel.CodeType codeType, boolean hasAnInterface) { int scope = (int)(this.getValue() + 0.5); int target = 0; if (codeType == ClassProjectModel.CodeType.THICK) target = LogicFile.INCLUDE_THICK; if (codeType == ClassProjectModel.CodeType.THIN) target = LogicFile.INCLUDE_THIN; if (codeType == ClassProjectModel.CodeType.INTERFACE) target = LogicFile.INCLUDE_INTERFACE; if ((hasAnInterface) && ((scope & LogicFile.INCLUDE_INTERFACE) != 0) && (codeType != ClassProjectModel.CodeType.INTERFACE)) return false; // If this has already been included in the interface, don't include it here if ((!hasAnInterface) && (scope == LogicFile.INCLUDE_INTERFACE) && (codeType == ClassProjectModel.CodeType.THICK)) return true; // If there isn't going to be an interface class, make sure it is included in thick return ((target & scope) != 0); }
java
public boolean includeThis(ClassProjectModel.CodeType codeType, boolean hasAnInterface) { int scope = (int)(this.getValue() + 0.5); int target = 0; if (codeType == ClassProjectModel.CodeType.THICK) target = LogicFile.INCLUDE_THICK; if (codeType == ClassProjectModel.CodeType.THIN) target = LogicFile.INCLUDE_THIN; if (codeType == ClassProjectModel.CodeType.INTERFACE) target = LogicFile.INCLUDE_INTERFACE; if ((hasAnInterface) && ((scope & LogicFile.INCLUDE_INTERFACE) != 0) && (codeType != ClassProjectModel.CodeType.INTERFACE)) return false; // If this has already been included in the interface, don't include it here if ((!hasAnInterface) && (scope == LogicFile.INCLUDE_INTERFACE) && (codeType == ClassProjectModel.CodeType.THICK)) return true; // If there isn't going to be an interface class, make sure it is included in thick return ((target & scope) != 0); }
[ "public", "boolean", "includeThis", "(", "ClassProjectModel", ".", "CodeType", "codeType", ",", "boolean", "hasAnInterface", ")", "{", "int", "scope", "=", "(", "int", ")", "(", "this", ".", "getValue", "(", ")", "+", "0.5", ")", ";", "int", "target", "=", "0", ";", "if", "(", "codeType", "==", "ClassProjectModel", ".", "CodeType", ".", "THICK", ")", "target", "=", "LogicFile", ".", "INCLUDE_THICK", ";", "if", "(", "codeType", "==", "ClassProjectModel", ".", "CodeType", ".", "THIN", ")", "target", "=", "LogicFile", ".", "INCLUDE_THIN", ";", "if", "(", "codeType", "==", "ClassProjectModel", ".", "CodeType", ".", "INTERFACE", ")", "target", "=", "LogicFile", ".", "INCLUDE_INTERFACE", ";", "if", "(", "(", "hasAnInterface", ")", "&&", "(", "(", "scope", "&", "LogicFile", ".", "INCLUDE_INTERFACE", ")", "!=", "0", ")", "&&", "(", "codeType", "!=", "ClassProjectModel", ".", "CodeType", ".", "INTERFACE", ")", ")", "return", "false", ";", "// If this has already been included in the interface, don't include it here", "if", "(", "(", "!", "hasAnInterface", ")", "&&", "(", "scope", "==", "LogicFile", ".", "INCLUDE_INTERFACE", ")", "&&", "(", "codeType", "==", "ClassProjectModel", ".", "CodeType", ".", "THICK", ")", ")", "return", "true", ";", "// If there isn't going to be an interface class, make sure it is included in thick", "return", "(", "(", "target", "&", "scope", ")", "!=", "0", ")", ";", "}" ]
IncludeThis Method.
[ "IncludeThis", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/IncludeScopeField.java#L100-L116
152,976
kirgor/enklib
rest/src/main/java/com/kirgor/enklib/rest/RESTClient.java
RESTClient.getWithListResult
public <T> EntityResponse<List<T>> getWithListResult(Class<T> entityClass, String path, Map<String, String> params, Map<String, String> headers) throws IOException, RESTException { HttpGet httpGet = buildHttpGet(path, params); return parseListEntityResponse(entityClass, getHttpResponse(httpGet, headers)); }
java
public <T> EntityResponse<List<T>> getWithListResult(Class<T> entityClass, String path, Map<String, String> params, Map<String, String> headers) throws IOException, RESTException { HttpGet httpGet = buildHttpGet(path, params); return parseListEntityResponse(entityClass, getHttpResponse(httpGet, headers)); }
[ "public", "<", "T", ">", "EntityResponse", "<", "List", "<", "T", ">", ">", "getWithListResult", "(", "Class", "<", "T", ">", "entityClass", ",", "String", "path", ",", "Map", "<", "String", ",", "String", ">", "params", ",", "Map", "<", "String", ",", "String", ">", "headers", ")", "throws", "IOException", ",", "RESTException", "{", "HttpGet", "httpGet", "=", "buildHttpGet", "(", "path", ",", "params", ")", ";", "return", "parseListEntityResponse", "(", "entityClass", ",", "getHttpResponse", "(", "httpGet", ",", "headers", ")", ")", ";", "}" ]
Performs GET request, while expected response entity is a list of specified type. @param entityClass Class, which contains expected response entity fields. @param path Request path. @param params Map of URL query params. @param headers Map of HTTP request headers. @param <T> Type of class, which contains expected response entity fields. @throws IOException If error during HTTP connection or entity parsing occurs. @throws RESTException If HTTP response code is non OK.
[ "Performs", "GET", "request", "while", "expected", "response", "entity", "is", "a", "list", "of", "specified", "type", "." ]
8a24db296dc43db5d8fe509cf64ace0a0c7be8f2
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/rest/src/main/java/com/kirgor/enklib/rest/RESTClient.java#L106-L109
152,977
kirgor/enklib
rest/src/main/java/com/kirgor/enklib/rest/RESTClient.java
RESTClient.postWithListResult
public <T> EntityResponse<List<T>> postWithListResult(Class<T> entityClass, String path, Object payload, Map<String, String> headers) throws IOException, RESTException { return postWithListResultInternal(entityClass, payload, new HttpPost(baseUrl + path), headers); }
java
public <T> EntityResponse<List<T>> postWithListResult(Class<T> entityClass, String path, Object payload, Map<String, String> headers) throws IOException, RESTException { return postWithListResultInternal(entityClass, payload, new HttpPost(baseUrl + path), headers); }
[ "public", "<", "T", ">", "EntityResponse", "<", "List", "<", "T", ">", ">", "postWithListResult", "(", "Class", "<", "T", ">", "entityClass", ",", "String", "path", ",", "Object", "payload", ",", "Map", "<", "String", ",", "String", ">", "headers", ")", "throws", "IOException", ",", "RESTException", "{", "return", "postWithListResultInternal", "(", "entityClass", ",", "payload", ",", "new", "HttpPost", "(", "baseUrl", "+", "path", ")", ",", "headers", ")", ";", "}" ]
Performs POST request, while expected response entity is a list of specified type. @param entityClass Class, which contains expected response entity fields. @param path Request path. @param payload Entity, which will be used as request payload. @param headers Map of HTTP request headers. @param <T> Type of class, which contains expected response entity fields. @throws IOException If error during HTTP connection or entity parsing occurs. @throws RESTException If HTTP response code is non OK.
[ "Performs", "POST", "request", "while", "expected", "response", "entity", "is", "a", "list", "of", "specified", "type", "." ]
8a24db296dc43db5d8fe509cf64ace0a0c7be8f2
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/rest/src/main/java/com/kirgor/enklib/rest/RESTClient.java#L262-L264
152,978
kirgor/enklib
rest/src/main/java/com/kirgor/enklib/rest/RESTClient.java
RESTClient.deleteWithListResult
public <T> EntityResponse<List<T>> deleteWithListResult(Class<T> entityClass, String path, Map<String, String> headers) throws IOException, RESTException { return parseListEntityResponse(entityClass, getHttpResponse(new HttpDelete(baseUrl + path), headers)); }
java
public <T> EntityResponse<List<T>> deleteWithListResult(Class<T> entityClass, String path, Map<String, String> headers) throws IOException, RESTException { return parseListEntityResponse(entityClass, getHttpResponse(new HttpDelete(baseUrl + path), headers)); }
[ "public", "<", "T", ">", "EntityResponse", "<", "List", "<", "T", ">", ">", "deleteWithListResult", "(", "Class", "<", "T", ">", "entityClass", ",", "String", "path", ",", "Map", "<", "String", ",", "String", ">", "headers", ")", "throws", "IOException", ",", "RESTException", "{", "return", "parseListEntityResponse", "(", "entityClass", ",", "getHttpResponse", "(", "new", "HttpDelete", "(", "baseUrl", "+", "path", ")", ",", "headers", ")", ")", ";", "}" ]
Performs DELETE request, while expected response entity is a list of specified type. @param entityClass Class, which contains expected response entity fields. @param path Request path. @param headers Map of HTTP request headers. @param <T> Type of class, which contains expected response entity fields. @throws IOException If error during HTTP connection or entity parsing occurs. @throws RESTException If HTTP response code is non OK.
[ "Performs", "DELETE", "request", "while", "expected", "response", "entity", "is", "a", "list", "of", "specified", "type", "." ]
8a24db296dc43db5d8fe509cf64ace0a0c7be8f2
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/rest/src/main/java/com/kirgor/enklib/rest/RESTClient.java#L554-L556
152,979
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.setId
public void setId(final String id) { // Set the DBId as well if it isn't a new id if (id.matches(CSConstants.EXISTING_TOPIC_ID_REGEX)) { DBId = Integer.parseInt(id); } this.id = id; }
java
public void setId(final String id) { // Set the DBId as well if it isn't a new id if (id.matches(CSConstants.EXISTING_TOPIC_ID_REGEX)) { DBId = Integer.parseInt(id); } this.id = id; }
[ "public", "void", "setId", "(", "final", "String", "id", ")", "{", "// Set the DBId as well if it isn't a new id", "if", "(", "id", ".", "matches", "(", "CSConstants", ".", "EXISTING_TOPIC_ID_REGEX", ")", ")", "{", "DBId", "=", "Integer", ".", "parseInt", "(", "id", ")", ";", "}", "this", ".", "id", "=", "id", ";", "}" ]
Set the ID for the Content Specification Topic. @param id The Content Specification Topic ID.
[ "Set", "the", "ID", "for", "the", "Content", "Specification", "Topic", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L123-L129
152,980
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getTopicRelationships
public List<TopicRelationship> getTopicRelationships() { ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(topicRelationships); for (final TargetRelationship relationship : topicTargetRelationships) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } return relationships; }
java
public List<TopicRelationship> getTopicRelationships() { ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(topicRelationships); for (final TargetRelationship relationship : topicTargetRelationships) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } return relationships; }
[ "public", "List", "<", "TopicRelationship", ">", "getTopicRelationships", "(", ")", "{", "ArrayList", "<", "TopicRelationship", ">", "relationships", "=", "new", "ArrayList", "<", "TopicRelationship", ">", "(", "topicRelationships", ")", ";", "for", "(", "final", "TargetRelationship", "relationship", ":", "topicTargetRelationships", ")", "{", "relationships", ".", "add", "(", "new", "TopicRelationship", "(", "relationship", ".", "getPrimaryRelationship", "(", ")", ",", "(", "SpecTopic", ")", "relationship", ".", "getSecondaryRelationship", "(", ")", ",", "relationship", ".", "getType", "(", ")", ")", ")", ";", "}", "return", "relationships", ";", "}" ]
Gets the list of Topic to Topic relationships. @return An ArrayList of TopicRelationship's or an empty array if none are found.
[ "Gets", "the", "list", "of", "Topic", "to", "Topic", "relationships", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L266-L273
152,981
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getTargetRelationships
public List<TargetRelationship> getTargetRelationships() { final List<TargetRelationship> relationships = new ArrayList<TargetRelationship>(levelRelationships); relationships.addAll(topicTargetRelationships); return relationships; }
java
public List<TargetRelationship> getTargetRelationships() { final List<TargetRelationship> relationships = new ArrayList<TargetRelationship>(levelRelationships); relationships.addAll(topicTargetRelationships); return relationships; }
[ "public", "List", "<", "TargetRelationship", ">", "getTargetRelationships", "(", ")", "{", "final", "List", "<", "TargetRelationship", ">", "relationships", "=", "new", "ArrayList", "<", "TargetRelationship", ">", "(", "levelRelationships", ")", ";", "relationships", ".", "addAll", "(", "topicTargetRelationships", ")", ";", "return", "relationships", ";", "}" ]
Gets the list of Target relationships. @return A List of TargetRelationship's or an empty array if none are found.
[ "Gets", "the", "list", "of", "Target", "relationships", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L280-L284
152,982
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getRelatedTopicRelationships
public List<TopicRelationship> getRelatedTopicRelationships() { final ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(); /* Check the topic to topic relationships for related relationships */ for (final TopicRelationship relationship : topicRelationships) { if (relationship.getType() == RelationshipType.REFER_TO) { relationships.add(relationship); } } /* Check the topic to target relationships for related relationships */ for (final TargetRelationship relationship : topicTargetRelationships) { if (relationship.getType() == RelationshipType.REFER_TO) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } } return relationships; }
java
public List<TopicRelationship> getRelatedTopicRelationships() { final ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(); /* Check the topic to topic relationships for related relationships */ for (final TopicRelationship relationship : topicRelationships) { if (relationship.getType() == RelationshipType.REFER_TO) { relationships.add(relationship); } } /* Check the topic to target relationships for related relationships */ for (final TargetRelationship relationship : topicTargetRelationships) { if (relationship.getType() == RelationshipType.REFER_TO) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } } return relationships; }
[ "public", "List", "<", "TopicRelationship", ">", "getRelatedTopicRelationships", "(", ")", "{", "final", "ArrayList", "<", "TopicRelationship", ">", "relationships", "=", "new", "ArrayList", "<", "TopicRelationship", ">", "(", ")", ";", "/* Check the topic to topic relationships for related relationships */", "for", "(", "final", "TopicRelationship", "relationship", ":", "topicRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "REFER_TO", ")", "{", "relationships", ".", "add", "(", "relationship", ")", ";", "}", "}", "/* Check the topic to target relationships for related relationships */", "for", "(", "final", "TargetRelationship", "relationship", ":", "topicTargetRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "REFER_TO", ")", "{", "relationships", ".", "add", "(", "new", "TopicRelationship", "(", "relationship", ".", "getPrimaryRelationship", "(", ")", ",", "(", "SpecTopic", ")", "relationship", ".", "getSecondaryRelationship", "(", ")", ",", "relationship", ".", "getType", "(", ")", ")", ")", ";", "}", "}", "return", "relationships", ";", "}" ]
Gets the list of Topic Relationships for this topic whose type is "RELATED". @return A list of related topic relationships
[ "Gets", "the", "list", "of", "Topic", "Relationships", "for", "this", "topic", "whose", "type", "is", "RELATED", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L291-L307
152,983
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getRelatedLevelRelationships
public List<TargetRelationship> getRelatedLevelRelationships() { final ArrayList<TargetRelationship> relationships = new ArrayList<TargetRelationship>(); for (final TargetRelationship relationship : levelRelationships) { if (relationship.getType() == RelationshipType.REFER_TO) { relationships.add(relationship); } } return relationships; }
java
public List<TargetRelationship> getRelatedLevelRelationships() { final ArrayList<TargetRelationship> relationships = new ArrayList<TargetRelationship>(); for (final TargetRelationship relationship : levelRelationships) { if (relationship.getType() == RelationshipType.REFER_TO) { relationships.add(relationship); } } return relationships; }
[ "public", "List", "<", "TargetRelationship", ">", "getRelatedLevelRelationships", "(", ")", "{", "final", "ArrayList", "<", "TargetRelationship", ">", "relationships", "=", "new", "ArrayList", "<", "TargetRelationship", ">", "(", ")", ";", "for", "(", "final", "TargetRelationship", "relationship", ":", "levelRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "REFER_TO", ")", "{", "relationships", ".", "add", "(", "relationship", ")", ";", "}", "}", "return", "relationships", ";", "}" ]
Gets the list of Level Relationships for this topic whose type is "RELATED". @return A list of related level relationships
[ "Gets", "the", "list", "of", "Level", "Relationships", "for", "this", "topic", "whose", "type", "is", "RELATED", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L314-L322
152,984
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getPrerequisiteTopicRelationships
public List<TopicRelationship> getPrerequisiteTopicRelationships() { final ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(); for (final TopicRelationship relationship : topicRelationships) { if (relationship.getType() == RelationshipType.PREREQUISITE) { relationships.add(relationship); } } for (final TargetRelationship relationship : topicTargetRelationships) { if (relationship.getType() == RelationshipType.PREREQUISITE) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } } return relationships; }
java
public List<TopicRelationship> getPrerequisiteTopicRelationships() { final ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(); for (final TopicRelationship relationship : topicRelationships) { if (relationship.getType() == RelationshipType.PREREQUISITE) { relationships.add(relationship); } } for (final TargetRelationship relationship : topicTargetRelationships) { if (relationship.getType() == RelationshipType.PREREQUISITE) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } } return relationships; }
[ "public", "List", "<", "TopicRelationship", ">", "getPrerequisiteTopicRelationships", "(", ")", "{", "final", "ArrayList", "<", "TopicRelationship", ">", "relationships", "=", "new", "ArrayList", "<", "TopicRelationship", ">", "(", ")", ";", "for", "(", "final", "TopicRelationship", "relationship", ":", "topicRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "PREREQUISITE", ")", "{", "relationships", ".", "add", "(", "relationship", ")", ";", "}", "}", "for", "(", "final", "TargetRelationship", "relationship", ":", "topicTargetRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "PREREQUISITE", ")", "{", "relationships", ".", "add", "(", "new", "TopicRelationship", "(", "relationship", ".", "getPrimaryRelationship", "(", ")", ",", "(", "SpecTopic", ")", "relationship", ".", "getSecondaryRelationship", "(", ")", ",", "relationship", ".", "getType", "(", ")", ")", ")", ";", "}", "}", "return", "relationships", ";", "}" ]
Gets the list of Topic Relationships for this topic whose type is "PREREQUISITE". @return A list of prerequisite topic relationships
[ "Gets", "the", "list", "of", "Topic", "Relationships", "for", "this", "topic", "whose", "type", "is", "PREREQUISITE", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L329-L343
152,985
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getPrerequisiteLevelRelationships
public List<TargetRelationship> getPrerequisiteLevelRelationships() { final ArrayList<TargetRelationship> relationships = new ArrayList<TargetRelationship>(); for (final TargetRelationship relationship : levelRelationships) { if (relationship.getType() == RelationshipType.PREREQUISITE) { relationships.add(relationship); } } return relationships; }
java
public List<TargetRelationship> getPrerequisiteLevelRelationships() { final ArrayList<TargetRelationship> relationships = new ArrayList<TargetRelationship>(); for (final TargetRelationship relationship : levelRelationships) { if (relationship.getType() == RelationshipType.PREREQUISITE) { relationships.add(relationship); } } return relationships; }
[ "public", "List", "<", "TargetRelationship", ">", "getPrerequisiteLevelRelationships", "(", ")", "{", "final", "ArrayList", "<", "TargetRelationship", ">", "relationships", "=", "new", "ArrayList", "<", "TargetRelationship", ">", "(", ")", ";", "for", "(", "final", "TargetRelationship", "relationship", ":", "levelRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "PREREQUISITE", ")", "{", "relationships", ".", "add", "(", "relationship", ")", ";", "}", "}", "return", "relationships", ";", "}" ]
Gets the list of Level Relationships for this topic whose type is "PREREQUISITE". @return A list of prerequisite level relationships
[ "Gets", "the", "list", "of", "Level", "Relationships", "for", "this", "topic", "whose", "type", "is", "PREREQUISITE", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L350-L358
152,986
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getLinkListTopicRelationships
public List<TopicRelationship> getLinkListTopicRelationships() { final ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(); for (final TopicRelationship relationship : topicRelationships) { if (relationship.getType() == RelationshipType.LINKLIST) { relationships.add(relationship); } } for (final TargetRelationship relationship : topicTargetRelationships) { if (relationship.getType() == RelationshipType.LINKLIST) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } } return relationships; }
java
public List<TopicRelationship> getLinkListTopicRelationships() { final ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(); for (final TopicRelationship relationship : topicRelationships) { if (relationship.getType() == RelationshipType.LINKLIST) { relationships.add(relationship); } } for (final TargetRelationship relationship : topicTargetRelationships) { if (relationship.getType() == RelationshipType.LINKLIST) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } } return relationships; }
[ "public", "List", "<", "TopicRelationship", ">", "getLinkListTopicRelationships", "(", ")", "{", "final", "ArrayList", "<", "TopicRelationship", ">", "relationships", "=", "new", "ArrayList", "<", "TopicRelationship", ">", "(", ")", ";", "for", "(", "final", "TopicRelationship", "relationship", ":", "topicRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "LINKLIST", ")", "{", "relationships", ".", "add", "(", "relationship", ")", ";", "}", "}", "for", "(", "final", "TargetRelationship", "relationship", ":", "topicTargetRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "LINKLIST", ")", "{", "relationships", ".", "add", "(", "new", "TopicRelationship", "(", "relationship", ".", "getPrimaryRelationship", "(", ")", ",", "(", "SpecTopic", ")", "relationship", ".", "getSecondaryRelationship", "(", ")", ",", "relationship", ".", "getType", "(", ")", ")", ")", ";", "}", "}", "return", "relationships", ";", "}" ]
Gets the list of Topic Relationships for this topic whose type is "LINKLIST". @return A list of link list topic relationships
[ "Gets", "the", "list", "of", "Topic", "Relationships", "for", "this", "topic", "whose", "type", "is", "LINKLIST", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L365-L379
152,987
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getLinkListLevelRelationships
public List<TargetRelationship> getLinkListLevelRelationships() { final ArrayList<TargetRelationship> relationships = new ArrayList<TargetRelationship>(); for (final TargetRelationship relationship : levelRelationships) { if (relationship.getType() == RelationshipType.LINKLIST) { relationships.add(relationship); } } return relationships; }
java
public List<TargetRelationship> getLinkListLevelRelationships() { final ArrayList<TargetRelationship> relationships = new ArrayList<TargetRelationship>(); for (final TargetRelationship relationship : levelRelationships) { if (relationship.getType() == RelationshipType.LINKLIST) { relationships.add(relationship); } } return relationships; }
[ "public", "List", "<", "TargetRelationship", ">", "getLinkListLevelRelationships", "(", ")", "{", "final", "ArrayList", "<", "TargetRelationship", ">", "relationships", "=", "new", "ArrayList", "<", "TargetRelationship", ">", "(", ")", ";", "for", "(", "final", "TargetRelationship", "relationship", ":", "levelRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "LINKLIST", ")", "{", "relationships", ".", "add", "(", "relationship", ")", ";", "}", "}", "return", "relationships", ";", "}" ]
Gets the list of Level Relationships for this topic whose type is "LINKLIST". @return A list of link list level relationships
[ "Gets", "the", "list", "of", "Level", "Relationships", "for", "this", "topic", "whose", "type", "is", "LINKLIST", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L386-L394
152,988
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getNextTopicRelationships
public List<TopicRelationship> getNextTopicRelationships() { ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(); for (TopicRelationship relationship : topicRelationships) { if (relationship.getType() == RelationshipType.NEXT) { relationships.add(relationship); } } for (TargetRelationship relationship : topicTargetRelationships) { if (relationship.getType() == RelationshipType.NEXT) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } } return relationships; }
java
public List<TopicRelationship> getNextTopicRelationships() { ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(); for (TopicRelationship relationship : topicRelationships) { if (relationship.getType() == RelationshipType.NEXT) { relationships.add(relationship); } } for (TargetRelationship relationship : topicTargetRelationships) { if (relationship.getType() == RelationshipType.NEXT) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } } return relationships; }
[ "public", "List", "<", "TopicRelationship", ">", "getNextTopicRelationships", "(", ")", "{", "ArrayList", "<", "TopicRelationship", ">", "relationships", "=", "new", "ArrayList", "<", "TopicRelationship", ">", "(", ")", ";", "for", "(", "TopicRelationship", "relationship", ":", "topicRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "NEXT", ")", "{", "relationships", ".", "add", "(", "relationship", ")", ";", "}", "}", "for", "(", "TargetRelationship", "relationship", ":", "topicTargetRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "NEXT", ")", "{", "relationships", ".", "add", "(", "new", "TopicRelationship", "(", "relationship", ".", "getPrimaryRelationship", "(", ")", ",", "(", "SpecTopic", ")", "relationship", ".", "getSecondaryRelationship", "(", ")", ",", "relationship", ".", "getType", "(", ")", ")", ")", ";", "}", "}", "return", "relationships", ";", "}" ]
Gets the list of Topic Relationships for this topic whose type is "NEXT". @return A list of next topic relationships
[ "Gets", "the", "list", "of", "Topic", "Relationships", "for", "this", "topic", "whose", "type", "is", "NEXT", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L401-L415
152,989
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getPrevTopicRelationships
public List<TopicRelationship> getPrevTopicRelationships() { ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(); for (TopicRelationship relationship : topicRelationships) { if (relationship.getType() == RelationshipType.PREVIOUS) { relationships.add(relationship); } } for (TargetRelationship relationship : topicTargetRelationships) { if (relationship.getType() == RelationshipType.PREVIOUS) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } } return relationships; }
java
public List<TopicRelationship> getPrevTopicRelationships() { ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(); for (TopicRelationship relationship : topicRelationships) { if (relationship.getType() == RelationshipType.PREVIOUS) { relationships.add(relationship); } } for (TargetRelationship relationship : topicTargetRelationships) { if (relationship.getType() == RelationshipType.PREVIOUS) { relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(), relationship.getType())); } } return relationships; }
[ "public", "List", "<", "TopicRelationship", ">", "getPrevTopicRelationships", "(", ")", "{", "ArrayList", "<", "TopicRelationship", ">", "relationships", "=", "new", "ArrayList", "<", "TopicRelationship", ">", "(", ")", ";", "for", "(", "TopicRelationship", "relationship", ":", "topicRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "PREVIOUS", ")", "{", "relationships", ".", "add", "(", "relationship", ")", ";", "}", "}", "for", "(", "TargetRelationship", "relationship", ":", "topicTargetRelationships", ")", "{", "if", "(", "relationship", ".", "getType", "(", ")", "==", "RelationshipType", ".", "PREVIOUS", ")", "{", "relationships", ".", "add", "(", "new", "TopicRelationship", "(", "relationship", ".", "getPrimaryRelationship", "(", ")", ",", "(", "SpecTopic", ")", "relationship", ".", "getSecondaryRelationship", "(", ")", ",", "relationship", ".", "getType", "(", ")", ")", ")", ";", "}", "}", "return", "relationships", ";", "}" ]
Gets the list of Topic Relationships for this topic whose type is "PREVIOUS". @return A list of previous topic relationships
[ "Gets", "the", "list", "of", "Topic", "Relationships", "for", "this", "topic", "whose", "type", "is", "PREVIOUS", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L422-L436
152,990
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java
SpecTopic.getClosestTopic
public SpecTopic getClosestTopic(final SpecTopic topic, final boolean checkParentNode) { /* * Check this topic to see if it is the topic we are looking for */ if (this == topic || getId().equals(topic.getId())) return this; /* * If we still haven't found the closest node then check this nodes parents. */ if (getParent() != null) { if (getParent() instanceof Level) { return ((Level) getParent()).getClosestTopic(topic, checkParentNode); } else if (getParent() instanceof KeyValueNode) { return ((KeyValueNode) getParent()).getParent().getBaseLevel().getClosestTopic(topic, checkParentNode); } } return null; }
java
public SpecTopic getClosestTopic(final SpecTopic topic, final boolean checkParentNode) { /* * Check this topic to see if it is the topic we are looking for */ if (this == topic || getId().equals(topic.getId())) return this; /* * If we still haven't found the closest node then check this nodes parents. */ if (getParent() != null) { if (getParent() instanceof Level) { return ((Level) getParent()).getClosestTopic(topic, checkParentNode); } else if (getParent() instanceof KeyValueNode) { return ((KeyValueNode) getParent()).getParent().getBaseLevel().getClosestTopic(topic, checkParentNode); } } return null; }
[ "public", "SpecTopic", "getClosestTopic", "(", "final", "SpecTopic", "topic", ",", "final", "boolean", "checkParentNode", ")", "{", "/*\n * Check this topic to see if it is the topic we are looking for\n */", "if", "(", "this", "==", "topic", "||", "getId", "(", ")", ".", "equals", "(", "topic", ".", "getId", "(", ")", ")", ")", "return", "this", ";", "/*\n * If we still haven't found the closest node then check this nodes parents.\n */", "if", "(", "getParent", "(", ")", "!=", "null", ")", "{", "if", "(", "getParent", "(", ")", "instanceof", "Level", ")", "{", "return", "(", "(", "Level", ")", "getParent", "(", ")", ")", ".", "getClosestTopic", "(", "topic", ",", "checkParentNode", ")", ";", "}", "else", "if", "(", "getParent", "(", ")", "instanceof", "KeyValueNode", ")", "{", "return", "(", "(", "KeyValueNode", ")", "getParent", "(", ")", ")", ".", "getParent", "(", ")", ".", "getBaseLevel", "(", ")", ".", "getClosestTopic", "(", "topic", ",", "checkParentNode", ")", ";", "}", "}", "return", "null", ";", "}" ]
Finds the closest node in the contents of a level @param topic The node we need to find the closest match for @return
[ "Finds", "the", "closest", "node", "in", "the", "contents", "of", "a", "level" ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/SpecTopic.java#L529-L547
152,991
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/filter/FieldFilterBuilder.java
FieldFilterBuilder.add
private void add(FieldFilter filter) { switch(operator) { case NOT: filters.add(new NegationFieldFilter(filter)); operator = Operator.NONE; break; case OR: filters.set(filters.size() - 1, new OrFieldFilter(filters.get(filters.size() - 1), filter)); operator = Operator.NONE; break; default: filters.add(filter); break; } }
java
private void add(FieldFilter filter) { switch(operator) { case NOT: filters.add(new NegationFieldFilter(filter)); operator = Operator.NONE; break; case OR: filters.set(filters.size() - 1, new OrFieldFilter(filters.get(filters.size() - 1), filter)); operator = Operator.NONE; break; default: filters.add(filter); break; } }
[ "private", "void", "add", "(", "FieldFilter", "filter", ")", "{", "switch", "(", "operator", ")", "{", "case", "NOT", ":", "filters", ".", "add", "(", "new", "NegationFieldFilter", "(", "filter", ")", ")", ";", "operator", "=", "Operator", ".", "NONE", ";", "break", ";", "case", "OR", ":", "filters", ".", "set", "(", "filters", ".", "size", "(", ")", "-", "1", ",", "new", "OrFieldFilter", "(", "filters", ".", "get", "(", "filters", ".", "size", "(", ")", "-", "1", ")", ",", "filter", ")", ")", ";", "operator", "=", "Operator", ".", "NONE", ";", "break", ";", "default", ":", "filters", ".", "add", "(", "filter", ")", ";", "break", ";", "}", "}" ]
Adds a filter and applies the current operator. @param filter Filter to add.
[ "Adds", "a", "filter", "and", "applies", "the", "current", "operator", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/filter/FieldFilterBuilder.java#L48-L63
152,992
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/filter/FieldFilterBuilder.java
FieldFilterBuilder.isDefault
public FieldFilterBuilder isDefault() { add(new NegationFieldFilter(new ModifierFieldFilter(Modifier.PUBLIC & Modifier.PROTECTED & Modifier.PRIVATE))); return this; }
java
public FieldFilterBuilder isDefault() { add(new NegationFieldFilter(new ModifierFieldFilter(Modifier.PUBLIC & Modifier.PROTECTED & Modifier.PRIVATE))); return this; }
[ "public", "FieldFilterBuilder", "isDefault", "(", ")", "{", "add", "(", "new", "NegationFieldFilter", "(", "new", "ModifierFieldFilter", "(", "Modifier", ".", "PUBLIC", "&", "Modifier", ".", "PROTECTED", "&", "Modifier", ".", "PRIVATE", ")", ")", ")", ";", "return", "this", ";", "}" ]
Filter fields with default access. @return This builder to support method chaining.
[ "Filter", "fields", "with", "default", "access", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/filter/FieldFilterBuilder.java#L249-L252
152,993
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/filter/FieldFilterBuilder.java
FieldFilterBuilder.build
public FieldFilter build() throws IllegalStateException { if (filters.isEmpty()) { throw new IllegalStateException("No field filters configured!"); } if (filters.size() == 1) { return filters.get(0); } FieldFilter[] fieldFilters = new FieldFilter[filters.size()]; filters.toArray(fieldFilters); return new FieldFilterList(fieldFilters); }
java
public FieldFilter build() throws IllegalStateException { if (filters.isEmpty()) { throw new IllegalStateException("No field filters configured!"); } if (filters.size() == 1) { return filters.get(0); } FieldFilter[] fieldFilters = new FieldFilter[filters.size()]; filters.toArray(fieldFilters); return new FieldFilterList(fieldFilters); }
[ "public", "FieldFilter", "build", "(", ")", "throws", "IllegalStateException", "{", "if", "(", "filters", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"No field filters configured!\"", ")", ";", "}", "if", "(", "filters", ".", "size", "(", ")", "==", "1", ")", "{", "return", "filters", ".", "get", "(", "0", ")", ";", "}", "FieldFilter", "[", "]", "fieldFilters", "=", "new", "FieldFilter", "[", "filters", ".", "size", "(", ")", "]", ";", "filters", ".", "toArray", "(", "fieldFilters", ")", ";", "return", "new", "FieldFilterList", "(", "fieldFilters", ")", ";", "}" ]
Build and returns a FieldFilter. @return FieldFilter built. @throws IllegalStateException if no filter was added before build() was invoked.
[ "Build", "and", "returns", "a", "FieldFilter", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/filter/FieldFilterBuilder.java#L273-L283
152,994
js-lib-com/commons
src/main/java/js/converter/LocaleConverter.java
LocaleConverter.asObject
@Override public <T> T asObject(String string, Class<T> valueType) throws IllegalArgumentException { // at this point value type is guaranteed to be a Locale int dashIndex = string.indexOf('-'); if (dashIndex == -1) { throw new IllegalArgumentException(String.format("Cannot convert |%s| to locale instance.", string)); } return (T) new Locale(string.substring(0, dashIndex), string.substring(dashIndex + 1)); }
java
@Override public <T> T asObject(String string, Class<T> valueType) throws IllegalArgumentException { // at this point value type is guaranteed to be a Locale int dashIndex = string.indexOf('-'); if (dashIndex == -1) { throw new IllegalArgumentException(String.format("Cannot convert |%s| to locale instance.", string)); } return (T) new Locale(string.substring(0, dashIndex), string.substring(dashIndex + 1)); }
[ "@", "Override", "public", "<", "T", ">", "T", "asObject", "(", "String", "string", ",", "Class", "<", "T", ">", "valueType", ")", "throws", "IllegalArgumentException", "{", "// at this point value type is guaranteed to be a Locale\r", "int", "dashIndex", "=", "string", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "dashIndex", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Cannot convert |%s| to locale instance.\"", ",", "string", ")", ")", ";", "}", "return", "(", "T", ")", "new", "Locale", "(", "string", ".", "substring", "(", "0", ",", "dashIndex", ")", ",", "string", ".", "substring", "(", "dashIndex", "+", "1", ")", ")", ";", "}" ]
Create locale instance from ISO-639 language and ISO-3166 country code, for example en-US. @throws IllegalArgumentException if given string argument is not well formatted.
[ "Create", "locale", "instance", "from", "ISO", "-", "639", "language", "and", "ISO", "-", "3166", "country", "code", "for", "example", "en", "-", "US", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/LocaleConverter.java#L24-L32
152,995
js-lib-com/commons
src/main/java/js/converter/LocaleConverter.java
LocaleConverter.asString
@Override public String asString(Object object) { // at this point object is guaranteed to be a Locale instance Locale locale = (Locale) object; StringBuilder builder = new StringBuilder(5); builder.append(locale.getLanguage()); builder.append('-'); builder.append(locale.getCountry()); return builder.toString(); }
java
@Override public String asString(Object object) { // at this point object is guaranteed to be a Locale instance Locale locale = (Locale) object; StringBuilder builder = new StringBuilder(5); builder.append(locale.getLanguage()); builder.append('-'); builder.append(locale.getCountry()); return builder.toString(); }
[ "@", "Override", "public", "String", "asString", "(", "Object", "object", ")", "{", "// at this point object is guaranteed to be a Locale instance\r", "Locale", "locale", "=", "(", "Locale", ")", "object", ";", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "5", ")", ";", "builder", ".", "append", "(", "locale", ".", "getLanguage", "(", ")", ")", ";", "builder", ".", "append", "(", "'", "'", ")", ";", "builder", ".", "append", "(", "locale", ".", "getCountry", "(", ")", ")", ";", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Return locale instance ISO-639 language and ISO-3166 country code, for example en-US.
[ "Return", "locale", "instance", "ISO", "-", "639", "language", "and", "ISO", "-", "3166", "country", "code", "for", "example", "en", "-", "US", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/LocaleConverter.java#L35-L44
152,996
tvesalainen/util
rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java
RPMBuilder.setPreInstallation
@Override public RPMBuilder setPreInstallation(String script, String interpreter) { addString(RPMTAG_PREIN, script); addString(RPMTAG_PREINPROG, interpreter); ensureBinSh(); return this; }
java
@Override public RPMBuilder setPreInstallation(String script, String interpreter) { addString(RPMTAG_PREIN, script); addString(RPMTAG_PREINPROG, interpreter); ensureBinSh(); return this; }
[ "@", "Override", "public", "RPMBuilder", "setPreInstallation", "(", "String", "script", ",", "String", "interpreter", ")", "{", "addString", "(", "RPMTAG_PREIN", ",", "script", ")", ";", "addString", "(", "RPMTAG_PREINPROG", ",", "interpreter", ")", ";", "ensureBinSh", "(", ")", ";", "return", "this", ";", "}" ]
Set RPMTAG_PREIN and RPMTAG_PREINPROG @param script @param interpreter @return
[ "Set", "RPMTAG_PREIN", "and", "RPMTAG_PREINPROG" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java#L189-L196
152,997
tvesalainen/util
rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java
RPMBuilder.setPostInstallation
@Override public RPMBuilder setPostInstallation(String script, String interpreter) { addString(RPMTAG_POSTIN, script); addString(RPMTAG_POSTINPROG, interpreter); ensureBinSh(); return this; }
java
@Override public RPMBuilder setPostInstallation(String script, String interpreter) { addString(RPMTAG_POSTIN, script); addString(RPMTAG_POSTINPROG, interpreter); ensureBinSh(); return this; }
[ "@", "Override", "public", "RPMBuilder", "setPostInstallation", "(", "String", "script", ",", "String", "interpreter", ")", "{", "addString", "(", "RPMTAG_POSTIN", ",", "script", ")", ";", "addString", "(", "RPMTAG_POSTINPROG", ",", "interpreter", ")", ";", "ensureBinSh", "(", ")", ";", "return", "this", ";", "}" ]
Set RPMTAG_POSTIN and RPMTAG_POSTINPROG @param script @param interpreter @return
[ "Set", "RPMTAG_POSTIN", "and", "RPMTAG_POSTINPROG" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java#L203-L210
152,998
tvesalainen/util
rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java
RPMBuilder.setPreUnInstallation
@Override public RPMBuilder setPreUnInstallation(String script, String interpreter) { addString(RPMTAG_PREUN, script); addString(RPMTAG_PREUNPROG, interpreter); ensureBinSh(); return this; }
java
@Override public RPMBuilder setPreUnInstallation(String script, String interpreter) { addString(RPMTAG_PREUN, script); addString(RPMTAG_PREUNPROG, interpreter); ensureBinSh(); return this; }
[ "@", "Override", "public", "RPMBuilder", "setPreUnInstallation", "(", "String", "script", ",", "String", "interpreter", ")", "{", "addString", "(", "RPMTAG_PREUN", ",", "script", ")", ";", "addString", "(", "RPMTAG_PREUNPROG", ",", "interpreter", ")", ";", "ensureBinSh", "(", ")", ";", "return", "this", ";", "}" ]
Set RPMTAG_PREUN and RPMTAG_PREUNPROG @param script @param interpreter @return
[ "Set", "RPMTAG_PREUN", "and", "RPMTAG_PREUNPROG" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java#L217-L224
152,999
tvesalainen/util
rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java
RPMBuilder.setPostUnInstallation
@Override public RPMBuilder setPostUnInstallation(String script, String interpreter) { addString(RPMTAG_POSTUN, script); addString(RPMTAG_POSTUNPROG, interpreter); ensureBinSh(); return this; }
java
@Override public RPMBuilder setPostUnInstallation(String script, String interpreter) { addString(RPMTAG_POSTUN, script); addString(RPMTAG_POSTUNPROG, interpreter); ensureBinSh(); return this; }
[ "@", "Override", "public", "RPMBuilder", "setPostUnInstallation", "(", "String", "script", ",", "String", "interpreter", ")", "{", "addString", "(", "RPMTAG_POSTUN", ",", "script", ")", ";", "addString", "(", "RPMTAG_POSTUNPROG", ",", "interpreter", ")", ";", "ensureBinSh", "(", ")", ";", "return", "this", ";", "}" ]
Set RPMTAG_POSTUN and RPMTAG_POSTUNPROG @param script @param interpreter @return
[ "Set", "RPMTAG_POSTUN", "and", "RPMTAG_POSTUNPROG" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java#L231-L238