repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java
DynamicURLClassLoader.defineClass
protected Class<?> defineClass(String name, sun.misc.Resource res) throws IOException { final int i = name.lastIndexOf('.'); final URL url = res.getCodeSourceURL(); if (i != -1) { final String pkgname = name.substring(0, i); // Check if package already loaded. final Package pkg = getPackage(pkgname); final Manifest man = res.getManifest(); if (pkg != null) { // Package found, so check package sealing. if (pkg.isSealed()) { // Verify that code source URL is the same. if (!pkg.isSealed(url)) { throw new SecurityException(Locale.getString("E1", pkgname)); //$NON-NLS-1$ } } else { // Make sure we are not attempting to seal the package // at this code source URL. if ((man != null) && isSealed(pkgname, man)) { throw new SecurityException(Locale.getString("E2", pkgname)); //$NON-NLS-1$ } } } else { if (man != null) { definePackage(pkgname, man, url); } else { definePackage(pkgname, null, null, null, null, null, null, null); } } } // Now read the class bytes and define the class final java.nio.ByteBuffer bb = res.getByteBuffer(); if (bb != null) { // Use (direct) ByteBuffer: final CodeSigner[] signers = res.getCodeSigners(); final CodeSource cs = new CodeSource(url, signers); return defineClass(name, bb, cs); } final byte[] b = res.getBytes(); // must read certificates AFTER reading bytes. final CodeSigner[] signers = res.getCodeSigners(); final CodeSource cs = new CodeSource(url, signers); return defineClass(name, b, 0, b.length, cs); }
java
protected Class<?> defineClass(String name, sun.misc.Resource res) throws IOException { final int i = name.lastIndexOf('.'); final URL url = res.getCodeSourceURL(); if (i != -1) { final String pkgname = name.substring(0, i); // Check if package already loaded. final Package pkg = getPackage(pkgname); final Manifest man = res.getManifest(); if (pkg != null) { // Package found, so check package sealing. if (pkg.isSealed()) { // Verify that code source URL is the same. if (!pkg.isSealed(url)) { throw new SecurityException(Locale.getString("E1", pkgname)); //$NON-NLS-1$ } } else { // Make sure we are not attempting to seal the package // at this code source URL. if ((man != null) && isSealed(pkgname, man)) { throw new SecurityException(Locale.getString("E2", pkgname)); //$NON-NLS-1$ } } } else { if (man != null) { definePackage(pkgname, man, url); } else { definePackage(pkgname, null, null, null, null, null, null, null); } } } // Now read the class bytes and define the class final java.nio.ByteBuffer bb = res.getByteBuffer(); if (bb != null) { // Use (direct) ByteBuffer: final CodeSigner[] signers = res.getCodeSigners(); final CodeSource cs = new CodeSource(url, signers); return defineClass(name, bb, cs); } final byte[] b = res.getBytes(); // must read certificates AFTER reading bytes. final CodeSigner[] signers = res.getCodeSigners(); final CodeSource cs = new CodeSource(url, signers); return defineClass(name, b, 0, b.length, cs); }
[ "protected", "Class", "<", "?", ">", "defineClass", "(", "String", "name", ",", "sun", ".", "misc", ".", "Resource", "res", ")", "throws", "IOException", "{", "final", "int", "i", "=", "name", ".", "lastIndexOf", "(", "'", "'", ")", ";", "final", "UR...
Defines a Class using the class bytes obtained from the specified Resource. The resulting Class must be resolved before it can be used. @param name is the name of the class to define @param res is the resource from which the class byte-code could be obtained @return the loaded class. @throws IOException in case the byte-code was unavailable.
[ "Defines", "a", "Class", "using", "the", "class", "bytes", "obtained", "from", "the", "specified", "Resource", ".", "The", "resulting", "Class", "must", "be", "resolved", "before", "it", "can", "be", "used", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java#L211-L256
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java
DynamicURLClassLoader.definePackage
@SuppressWarnings("checkstyle:npathcomplexity") protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException { final String path = name.replace('.', '/').concat("/"); //$NON-NLS-1$ String specTitle = null; String specVersion = null; String specVendor = null; String implTitle = null; String implVersion = null; String implVendor = null; String sealed = null; URL sealBase = null; Attributes attr = man.getAttributes(path); if (attr != null) { specTitle = attr.getValue(Name.SPECIFICATION_TITLE); specVersion = attr.getValue(Name.SPECIFICATION_VERSION); specVendor = attr.getValue(Name.SPECIFICATION_VENDOR); implTitle = attr.getValue(Name.IMPLEMENTATION_TITLE); implVersion = attr.getValue(Name.IMPLEMENTATION_VERSION); implVendor = attr.getValue(Name.IMPLEMENTATION_VENDOR); sealed = attr.getValue(Name.SEALED); } attr = man.getMainAttributes(); if (attr != null) { if (specTitle == null) { specTitle = attr.getValue(Name.SPECIFICATION_TITLE); } if (specVersion == null) { specVersion = attr.getValue(Name.SPECIFICATION_VERSION); } if (specVendor == null) { specVendor = attr.getValue(Name.SPECIFICATION_VENDOR); } if (implTitle == null) { implTitle = attr.getValue(Name.IMPLEMENTATION_TITLE); } if (implVersion == null) { implVersion = attr.getValue(Name.IMPLEMENTATION_VERSION); } if (implVendor == null) { implVendor = attr.getValue(Name.IMPLEMENTATION_VENDOR); } if (sealed == null) { sealed = attr.getValue(Name.SEALED); } } if ("true".equalsIgnoreCase(sealed)) { //$NON-NLS-1$ sealBase = url; } return definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); }
java
@SuppressWarnings("checkstyle:npathcomplexity") protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException { final String path = name.replace('.', '/').concat("/"); //$NON-NLS-1$ String specTitle = null; String specVersion = null; String specVendor = null; String implTitle = null; String implVersion = null; String implVendor = null; String sealed = null; URL sealBase = null; Attributes attr = man.getAttributes(path); if (attr != null) { specTitle = attr.getValue(Name.SPECIFICATION_TITLE); specVersion = attr.getValue(Name.SPECIFICATION_VERSION); specVendor = attr.getValue(Name.SPECIFICATION_VENDOR); implTitle = attr.getValue(Name.IMPLEMENTATION_TITLE); implVersion = attr.getValue(Name.IMPLEMENTATION_VERSION); implVendor = attr.getValue(Name.IMPLEMENTATION_VENDOR); sealed = attr.getValue(Name.SEALED); } attr = man.getMainAttributes(); if (attr != null) { if (specTitle == null) { specTitle = attr.getValue(Name.SPECIFICATION_TITLE); } if (specVersion == null) { specVersion = attr.getValue(Name.SPECIFICATION_VERSION); } if (specVendor == null) { specVendor = attr.getValue(Name.SPECIFICATION_VENDOR); } if (implTitle == null) { implTitle = attr.getValue(Name.IMPLEMENTATION_TITLE); } if (implVersion == null) { implVersion = attr.getValue(Name.IMPLEMENTATION_VERSION); } if (implVendor == null) { implVendor = attr.getValue(Name.IMPLEMENTATION_VENDOR); } if (sealed == null) { sealed = attr.getValue(Name.SEALED); } } if ("true".equalsIgnoreCase(sealed)) { //$NON-NLS-1$ sealBase = url; } return definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); }
[ "@", "SuppressWarnings", "(", "\"checkstyle:npathcomplexity\"", ")", "protected", "Package", "definePackage", "(", "String", "name", ",", "Manifest", "man", ",", "URL", "url", ")", "throws", "IllegalArgumentException", "{", "final", "String", "path", "=", "name", ...
Defines a new package by name in this ClassLoader. The attributes contained in the specified Manifest will be used to obtain package version and sealing information. For sealed packages, the additional URL specifies the code source URL from which the package was loaded. @param name the package name @param man the Manifest containing package version and sealing information @param url the code source url for the package, or null if none @exception IllegalArgumentException if the package name duplicates an existing package either in this class loader or one of its ancestors @return the newly defined Package object
[ "Defines", "a", "new", "package", "by", "name", "in", "this", "ClassLoader", ".", "The", "attributes", "contained", "in", "the", "specified", "Manifest", "will", "be", "used", "to", "obtain", "package", "version", "and", "sealing", "information", ".", "For", ...
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java#L273-L324
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java
DynamicURLClassLoader.findResource
@Override @Pure public URL findResource(final String name) { /* * The same restriction to finding classes applies to resources */ final URL url = AccessController.doPrivileged(new PrivilegedAction<URL>() { @Override public URL run() { return DynamicURLClassLoader.this.ucp.findResource(name, true); } }, this.acc); return url != null ? this.ucp.checkURL(url) : null; }
java
@Override @Pure public URL findResource(final String name) { /* * The same restriction to finding classes applies to resources */ final URL url = AccessController.doPrivileged(new PrivilegedAction<URL>() { @Override public URL run() { return DynamicURLClassLoader.this.ucp.findResource(name, true); } }, this.acc); return url != null ? this.ucp.checkURL(url) : null; }
[ "@", "Override", "@", "Pure", "public", "URL", "findResource", "(", "final", "String", "name", ")", "{", "/*\n\t\t * The same restriction to finding classes applies to resources\n\t\t */", "final", "URL", "url", "=", "AccessController", ".", "doPrivileged", "(", "new", ...
Finds the resource with the specified name on the URL search path. @param name the name of the resource @return a <code>URL</code> for the resource, or <code>null</code> if the resource could not be found.
[ "Finds", "the", "resource", "with", "the", "specified", "name", "on", "the", "URL", "search", "path", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java#L353-L367
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java
DynamicURLClassLoader.findResources
@Override @Pure public Enumeration<URL> findResources(final String name) throws IOException { final Enumeration<?> e = this.ucp.findResources(name, true); return new Enumeration<URL>() { private URL url; private boolean next() { if (this.url != null) { return true; } do { final URL u = AccessController.doPrivileged(new PrivilegedAction<URL>() { @Override public URL run() { if (!e.hasMoreElements()) { return null; } return (URL) e.nextElement(); } }, DynamicURLClassLoader.this.acc); if (u == null) { break; } this.url = DynamicURLClassLoader.this.ucp.checkURL(u); } while (this.url == null); return this.url != null; } @Override public URL nextElement() { if (!next()) { throw new NoSuchElementException(); } final URL u = this.url; this.url = null; return u; } @Override public boolean hasMoreElements() { return next(); } }; }
java
@Override @Pure public Enumeration<URL> findResources(final String name) throws IOException { final Enumeration<?> e = this.ucp.findResources(name, true); return new Enumeration<URL>() { private URL url; private boolean next() { if (this.url != null) { return true; } do { final URL u = AccessController.doPrivileged(new PrivilegedAction<URL>() { @Override public URL run() { if (!e.hasMoreElements()) { return null; } return (URL) e.nextElement(); } }, DynamicURLClassLoader.this.acc); if (u == null) { break; } this.url = DynamicURLClassLoader.this.ucp.checkURL(u); } while (this.url == null); return this.url != null; } @Override public URL nextElement() { if (!next()) { throw new NoSuchElementException(); } final URL u = this.url; this.url = null; return u; } @Override public boolean hasMoreElements() { return next(); } }; }
[ "@", "Override", "@", "Pure", "public", "Enumeration", "<", "URL", ">", "findResources", "(", "final", "String", "name", ")", "throws", "IOException", "{", "final", "Enumeration", "<", "?", ">", "e", "=", "this", ".", "ucp", ".", "findResources", "(", "n...
Returns an Enumeration of URLs representing all of the resources on the URL search path having the specified name. @param name the resource name @exception IOException if an I/O exception occurs @return an <code>Enumeration</code> of <code>URL</code>s
[ "Returns", "an", "Enumeration", "of", "URLs", "representing", "all", "of", "the", "resources", "on", "the", "URL", "search", "path", "having", "the", "specified", "name", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java#L377-L424
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java
DynamicURLClassLoader.getPermissions
@Override protected PermissionCollection getPermissions(CodeSource codesource) { final PermissionCollection perms = super.getPermissions(codesource); final URL url = codesource.getLocation(); Permission permission; URLConnection urlConnection; try { urlConnection = url.openConnection(); permission = urlConnection.getPermission(); } catch (IOException ioe) { permission = null; urlConnection = null; } if ((permission != null) && (permission instanceof FilePermission)) { // if the permission has a separator char on the end, // it means the codebase is a directory, and we need // to add an additional permission to read recursively String path = permission.getName(); if (path.endsWith(File.separator)) { path += "-"; //$NON-NLS-1$ permission = new FilePermission(path, sun.security.util.SecurityConstants.FILE_READ_ACTION); } } else if ((permission == null) && (URISchemeType.FILE.isURL(url))) { String path = url.getFile().replace('/', File.separatorChar); path = sun.net.www.ParseUtil.decode(path); if (path.endsWith(File.separator)) { path += "-"; //$NON-NLS-1$ } permission = new FilePermission(path, sun.security.util.SecurityConstants.FILE_READ_ACTION); } else { URL locUrl = url; if (urlConnection instanceof JarURLConnection) { locUrl = ((JarURLConnection) urlConnection).getJarFileURL(); } String host = locUrl.getHost(); if (host == null) { host = "localhost"; //$NON-NLS-1$ } permission = new SocketPermission(host, sun.security.util.SecurityConstants.SOCKET_CONNECT_ACCEPT_ACTION); } // make sure the person that created this class loader // would have this permission final SecurityManager sm = System.getSecurityManager(); if (sm != null) { final Permission fp = permission; AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() throws SecurityException { sm.checkPermission(fp); return null; } }, this.acc); } perms.add(permission); return perms; }
java
@Override protected PermissionCollection getPermissions(CodeSource codesource) { final PermissionCollection perms = super.getPermissions(codesource); final URL url = codesource.getLocation(); Permission permission; URLConnection urlConnection; try { urlConnection = url.openConnection(); permission = urlConnection.getPermission(); } catch (IOException ioe) { permission = null; urlConnection = null; } if ((permission != null) && (permission instanceof FilePermission)) { // if the permission has a separator char on the end, // it means the codebase is a directory, and we need // to add an additional permission to read recursively String path = permission.getName(); if (path.endsWith(File.separator)) { path += "-"; //$NON-NLS-1$ permission = new FilePermission(path, sun.security.util.SecurityConstants.FILE_READ_ACTION); } } else if ((permission == null) && (URISchemeType.FILE.isURL(url))) { String path = url.getFile().replace('/', File.separatorChar); path = sun.net.www.ParseUtil.decode(path); if (path.endsWith(File.separator)) { path += "-"; //$NON-NLS-1$ } permission = new FilePermission(path, sun.security.util.SecurityConstants.FILE_READ_ACTION); } else { URL locUrl = url; if (urlConnection instanceof JarURLConnection) { locUrl = ((JarURLConnection) urlConnection).getJarFileURL(); } String host = locUrl.getHost(); if (host == null) { host = "localhost"; //$NON-NLS-1$ } permission = new SocketPermission(host, sun.security.util.SecurityConstants.SOCKET_CONNECT_ACCEPT_ACTION); } // make sure the person that created this class loader // would have this permission final SecurityManager sm = System.getSecurityManager(); if (sm != null) { final Permission fp = permission; AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() throws SecurityException { sm.checkPermission(fp); return null; } }, this.acc); } perms.add(permission); return perms; }
[ "@", "Override", "protected", "PermissionCollection", "getPermissions", "(", "CodeSource", "codesource", ")", "{", "final", "PermissionCollection", "perms", "=", "super", ".", "getPermissions", "(", "codesource", ")", ";", "final", "URL", "url", "=", "codesource", ...
Returns the permissions for the given codesource object. The implementation of this method first calls super.getPermissions and then adds permissions based on the URL of the codesource. <p>If the protocol is "file" and the path specifies a file, then permission to read that file is granted. If protocol is "file" and the path is a directory, permission is granted to read all files and (recursively) all files and subdirectories contained in that directory. <p>If the protocol is not "file", then to connect to and accept connections from the URL's host is granted. @param codesource the codesource @return the permissions granted to the codesource
[ "Returns", "the", "permissions", "for", "the", "given", "codesource", "object", ".", "The", "implementation", "of", "this", "method", "first", "calls", "super", ".", "getPermissions", "and", "then", "adds", "permissions", "based", "on", "the", "URL", "of", "th...
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java#L443-L505
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java
DynamicURLClassLoader.mergeClassPath
private static URL[] mergeClassPath(URL... urls) { final String path = System.getProperty("java.class.path"); //$NON-NLS-1$ final String separator = System.getProperty("path.separator"); //$NON-NLS-1$ final String[] parts = path.split(Pattern.quote(separator)); final URL[] u = new URL[parts.length + urls.length]; for (int i = 0; i < parts.length; ++i) { try { u[i] = new File(parts[i]).toURI().toURL(); } catch (MalformedURLException exception) { // ignore exception } } System.arraycopy(urls, 0, u, parts.length, urls.length); return u; }
java
private static URL[] mergeClassPath(URL... urls) { final String path = System.getProperty("java.class.path"); //$NON-NLS-1$ final String separator = System.getProperty("path.separator"); //$NON-NLS-1$ final String[] parts = path.split(Pattern.quote(separator)); final URL[] u = new URL[parts.length + urls.length]; for (int i = 0; i < parts.length; ++i) { try { u[i] = new File(parts[i]).toURI().toURL(); } catch (MalformedURLException exception) { // ignore exception } } System.arraycopy(urls, 0, u, parts.length, urls.length); return u; }
[ "private", "static", "URL", "[", "]", "mergeClassPath", "(", "URL", "...", "urls", ")", "{", "final", "String", "path", "=", "System", ".", "getProperty", "(", "\"java.class.path\"", ")", ";", "//$NON-NLS-1$", "final", "String", "separator", "=", "System", "...
Merge the specified URLs to the current classpath.
[ "Merge", "the", "specified", "URLs", "to", "the", "current", "classpath", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java#L537-L551
train
gallandarakhneorg/afc
core/util/src/main/java/org/arakhne/afc/util/ListUtil.java
ListUtil.remove
public static <E> int remove(List<E> list, Comparator<? super E> comparator, E data) { assert list != null; assert comparator != null; assert data != null; int first = 0; int last = list.size() - 1; while (last >= first) { final int center = (first + last) / 2; final E dt = list.get(center); final int cmpR = comparator.compare(data, dt); if (cmpR == 0) { list.remove(center); return center; } else if (cmpR < 0) { last = center - 1; } else { first = center + 1; } } return -1; }
java
public static <E> int remove(List<E> list, Comparator<? super E> comparator, E data) { assert list != null; assert comparator != null; assert data != null; int first = 0; int last = list.size() - 1; while (last >= first) { final int center = (first + last) / 2; final E dt = list.get(center); final int cmpR = comparator.compare(data, dt); if (cmpR == 0) { list.remove(center); return center; } else if (cmpR < 0) { last = center - 1; } else { first = center + 1; } } return -1; }
[ "public", "static", "<", "E", ">", "int", "remove", "(", "List", "<", "E", ">", "list", ",", "Comparator", "<", "?", "super", "E", ">", "comparator", ",", "E", "data", ")", "{", "assert", "list", "!=", "null", ";", "assert", "comparator", "!=", "nu...
Remove the given element from the list using a dichotomic algorithm. <p>This function ensure that the comparator is invoked as: <code>comparator(data, dataAlreadyInList)</code>. @param <E> is the type of the elements in the list. @param list is the list to change. @param comparator is the comparator of elements. @param data is the data to remove. @return the index at which the element was removed in the list; or <code>-1</code> if the element was not removed.
[ "Remove", "the", "given", "element", "from", "the", "list", "using", "a", "dichotomic", "algorithm", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/ListUtil.java#L58-L78
train
gallandarakhneorg/afc
core/util/src/main/java/org/arakhne/afc/util/ListUtil.java
ListUtil.addIfAbsent
@Inline(value = "add($1, $2, $3, false, false)") public static <E> int addIfAbsent(List<E> list, Comparator<? super E> comparator, E data) { return add(list, comparator, data, false, false); }
java
@Inline(value = "add($1, $2, $3, false, false)") public static <E> int addIfAbsent(List<E> list, Comparator<? super E> comparator, E data) { return add(list, comparator, data, false, false); }
[ "@", "Inline", "(", "value", "=", "\"add($1, $2, $3, false, false)\"", ")", "public", "static", "<", "E", ">", "int", "addIfAbsent", "(", "List", "<", "E", ">", "list", ",", "Comparator", "<", "?", "super", "E", ">", "comparator", ",", "E", "data", ")", ...
Add the given element in the main list using a dichotomic algorithm if the element is not already present. <p>This function ensure that the comparator is invoked as: <code>comparator(data, dataAlreadyInList)</code>. @param <E> is the type of the elements in the list. @param list is the list to change. @param comparator is the comparator of elements. @param data is the data to insert. @return the index where the element was inserted, or <code>-1</code> if the element was not inserted. @since 14.0
[ "Add", "the", "given", "element", "in", "the", "main", "list", "using", "a", "dichotomic", "algorithm", "if", "the", "element", "is", "not", "already", "present", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/ListUtil.java#L92-L95
train
gallandarakhneorg/afc
core/util/src/main/java/org/arakhne/afc/util/ListUtil.java
ListUtil.add
public static <E> int add(List<E> list, Comparator<? super E> comparator, E data, boolean allowMultipleOccurencesOfSameValue, boolean allowReplacement) { assert list != null; assert comparator != null; assert data != null; int first = 0; int last = list.size() - 1; while (last >= first) { final int center = (first + last) / 2; final E dt = list.get(center); final int cmpR = comparator.compare(data, dt); if (cmpR == 0 && !allowMultipleOccurencesOfSameValue) { if (allowReplacement) { list.set(center, data); return center; } return -1; } if (cmpR < 0) { last = center - 1; } else { first = center + 1; } } list.add(first, data); return first; }
java
public static <E> int add(List<E> list, Comparator<? super E> comparator, E data, boolean allowMultipleOccurencesOfSameValue, boolean allowReplacement) { assert list != null; assert comparator != null; assert data != null; int first = 0; int last = list.size() - 1; while (last >= first) { final int center = (first + last) / 2; final E dt = list.get(center); final int cmpR = comparator.compare(data, dt); if (cmpR == 0 && !allowMultipleOccurencesOfSameValue) { if (allowReplacement) { list.set(center, data); return center; } return -1; } if (cmpR < 0) { last = center - 1; } else { first = center + 1; } } list.add(first, data); return first; }
[ "public", "static", "<", "E", ">", "int", "add", "(", "List", "<", "E", ">", "list", ",", "Comparator", "<", "?", "super", "E", ">", "comparator", ",", "E", "data", ",", "boolean", "allowMultipleOccurencesOfSameValue", ",", "boolean", "allowReplacement", "...
Add the given element in the main list using a dichotomic algorithm. <p>This function ensure that the comparator is invoked as: <code>comparator(data, dataAlreadyInList)</code>. @param <E> is the type of the elements in the list. @param list is the list to change. @param comparator is the comparator of elements. @param data is the data to insert. @param allowMultipleOccurencesOfSameValue indicates if multiple occurrences of the same value are allowed in the list. @param allowReplacement indicates if the given {@code elt} may replace the found element. @return the index where the element was inserted, or <code>-1</code> if the element was not inserted.
[ "Add", "the", "given", "element", "in", "the", "main", "list", "using", "a", "dichotomic", "algorithm", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/ListUtil.java#L112-L138
train
gallandarakhneorg/afc
core/util/src/main/java/org/arakhne/afc/util/ListUtil.java
ListUtil.contains
@Pure public static <E> boolean contains(List<E> list, Comparator<? super E> comparator, E data) { assert list != null; assert comparator != null; assert data != null; int first = 0; int last = list.size() - 1; while (last >= first) { final int center = (first + last) / 2; final E dt = list.get(center); final int cmpR = comparator.compare(data, dt); if (cmpR == 0) { return true; } else if (cmpR < 0) { last = center - 1; } else { first = center + 1; } } return false; }
java
@Pure public static <E> boolean contains(List<E> list, Comparator<? super E> comparator, E data) { assert list != null; assert comparator != null; assert data != null; int first = 0; int last = list.size() - 1; while (last >= first) { final int center = (first + last) / 2; final E dt = list.get(center); final int cmpR = comparator.compare(data, dt); if (cmpR == 0) { return true; } else if (cmpR < 0) { last = center - 1; } else { first = center + 1; } } return false; }
[ "@", "Pure", "public", "static", "<", "E", ">", "boolean", "contains", "(", "List", "<", "E", ">", "list", ",", "Comparator", "<", "?", "super", "E", ">", "comparator", ",", "E", "data", ")", "{", "assert", "list", "!=", "null", ";", "assert", "com...
Replies if the given element is inside the list, using a dichotomic algorithm. <p>This function ensure that the comparator is invoked as: <code>comparator(data, dataAlreadyInList)</code>. @param <E> is the type of the elements in the list. @param list is the list to explore. @param comparator is the comparator of elements. @param data is the data to search for. @return <code>true</code> if the data is inside the list, otherwise <code>false</code>
[ "Replies", "if", "the", "given", "element", "is", "inside", "the", "list", "using", "a", "dichotomic", "algorithm", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/ListUtil.java#L150-L170
train
gallandarakhneorg/afc
core/util/src/main/java/org/arakhne/afc/util/ListUtil.java
ListUtil.reverseIterator
public static <T> Iterator<T> reverseIterator(final List<T> list) { return new Iterator<T>() { private int next = list.size() - 1; @Override @Pure public boolean hasNext() { return this.next >= 0; } @Override public T next() { final int n = this.next; --this.next; try { return list.get(n); } catch (IndexOutOfBoundsException exception) { throw new NoSuchElementException(); } } }; }
java
public static <T> Iterator<T> reverseIterator(final List<T> list) { return new Iterator<T>() { private int next = list.size() - 1; @Override @Pure public boolean hasNext() { return this.next >= 0; } @Override public T next() { final int n = this.next; --this.next; try { return list.get(n); } catch (IndexOutOfBoundsException exception) { throw new NoSuchElementException(); } } }; }
[ "public", "static", "<", "T", ">", "Iterator", "<", "T", ">", "reverseIterator", "(", "final", "List", "<", "T", ">", "list", ")", "{", "return", "new", "Iterator", "<", "T", ">", "(", ")", "{", "private", "int", "next", "=", "list", ".", "size", ...
Replies an iterator that goes from end to start of the given list. <p>The replied iterator dos not support removals. @param <T> the type of the list elements. @param list the list. @return the reverse iterator. @since 14.0
[ "Replies", "an", "iterator", "that", "goes", "from", "end", "to", "start", "of", "the", "given", "list", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/ListUtil.java#L554-L577
train
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeClassWithDefault
@Pure public static Class<?> getAttributeClassWithDefault(Node document, boolean caseSensitive, Class<?> defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); final String v = getAttributeValue(document, caseSensitive, 0, path); if (v != null && !v.isEmpty()) { try { final ClassLoader loader = ClassLoaderFinder.findClassLoader(); return loader.loadClass(v); } catch (Throwable e) { // } } return defaultValue; }
java
@Pure public static Class<?> getAttributeClassWithDefault(Node document, boolean caseSensitive, Class<?> defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); final String v = getAttributeValue(document, caseSensitive, 0, path); if (v != null && !v.isEmpty()) { try { final ClassLoader loader = ClassLoaderFinder.findClassLoader(); return loader.loadClass(v); } catch (Throwable e) { // } } return defaultValue; }
[ "@", "Pure", "public", "static", "Class", "<", "?", ">", "getAttributeClassWithDefault", "(", "Node", "document", ",", "boolean", "caseSensitive", ",", "Class", "<", "?", ">", "defaultValue", ",", "String", "...", "path", ")", "{", "assert", "document", "!="...
Read a java class. @param document is the XML document to explore. @param caseSensitive indicates of the {@code path}'s components are case sensitive. @param defaultValue is the default value replied if no attribute was found. @param path is the list of and ended by the attribute's name. @return the java class or <code>defaultValue</code> if none.
[ "Read", "a", "java", "class", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L382-L396
train
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getChild
@Pure public static <T extends Node> T getChild(Node parent, Class<T> type) { assert parent != null : AssertMessages.notNullParameter(0); assert type != null : AssertMessages.notNullParameter(1); final NodeList children = parent.getChildNodes(); final int len = children.getLength(); for (int i = 0; i < len; ++i) { final Node child = children.item(i); if (type.isInstance(child)) { return type.cast(child); } } return null; }
java
@Pure public static <T extends Node> T getChild(Node parent, Class<T> type) { assert parent != null : AssertMessages.notNullParameter(0); assert type != null : AssertMessages.notNullParameter(1); final NodeList children = parent.getChildNodes(); final int len = children.getLength(); for (int i = 0; i < len; ++i) { final Node child = children.item(i); if (type.isInstance(child)) { return type.cast(child); } } return null; }
[ "@", "Pure", "public", "static", "<", "T", "extends", "Node", ">", "T", "getChild", "(", "Node", "parent", ",", "Class", "<", "T", ">", "type", ")", "{", "assert", "parent", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ...
Replies the first child node that has the specified type. @param <T> is the type of the desired child @param parent is the element from which the child must be extracted. @param type is the type of the desired child @return the child node or <code>null</code> if none.
[ "Replies", "the", "first", "child", "node", "that", "has", "the", "specified", "type", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1305-L1318
train
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getDocumentFor
@Pure public static Document getDocumentFor(Node node) { Node localnode = node; while (localnode != null) { if (localnode instanceof Document) { return (Document) localnode; } localnode = localnode.getParentNode(); } return null; }
java
@Pure public static Document getDocumentFor(Node node) { Node localnode = node; while (localnode != null) { if (localnode instanceof Document) { return (Document) localnode; } localnode = localnode.getParentNode(); } return null; }
[ "@", "Pure", "public", "static", "Document", "getDocumentFor", "(", "Node", "node", ")", "{", "Node", "localnode", "=", "node", ";", "while", "(", "localnode", "!=", "null", ")", "{", "if", "(", "localnode", "instanceof", "Document", ")", "{", "return", ...
Replies the XML Document that is containing the given node. @param node the node. @return the Document in which the given node is, or <code>null</code> if not found.
[ "Replies", "the", "XML", "Document", "that", "is", "containing", "the", "given", "node", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1326-L1336
train
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getText
@Pure public static String getText(Node document, String... path) { assert document != null : AssertMessages.notNullParameter(0); Node parentNode = getNodeFromPath(document, path); if (parentNode == null) { parentNode = document; } final StringBuilder text = new StringBuilder(); final NodeList children = parentNode.getChildNodes(); final int len = children.getLength(); for (int i = 0; i < len; ++i) { final Node child = children.item(i); if (child instanceof Text) { text.append(((Text) child).getWholeText()); } } if (text.length() > 0) { return text.toString(); } return null; }
java
@Pure public static String getText(Node document, String... path) { assert document != null : AssertMessages.notNullParameter(0); Node parentNode = getNodeFromPath(document, path); if (parentNode == null) { parentNode = document; } final StringBuilder text = new StringBuilder(); final NodeList children = parentNode.getChildNodes(); final int len = children.getLength(); for (int i = 0; i < len; ++i) { final Node child = children.item(i); if (child instanceof Text) { text.append(((Text) child).getWholeText()); } } if (text.length() > 0) { return text.toString(); } return null; }
[ "@", "Pure", "public", "static", "String", "getText", "(", "Node", "document", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ";", "Node", "parentNode", "=", "getNo...
Replies the text inside the node at the specified path. <p>The path is an ordered list of tag's names and ended by the name of the desired node. Be careful about the fact that the names are case sensitives. @param document is the XML document to explore. @param path is the list of names. This path may be empty. @return the text or <code>null</code> if the node was not found in the document or the text inside was empty.
[ "Replies", "the", "text", "inside", "the", "node", "at", "the", "specified", "path", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1674-L1694
train
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.iterate
@Pure public static Iterator<Node> iterate(Node parent, String nodeName) { assert parent != null : AssertMessages.notNullParameter(0); assert nodeName != null && !nodeName.isEmpty() : AssertMessages.notNullParameter(0); return new NameBasedIterator(parent, nodeName); }
java
@Pure public static Iterator<Node> iterate(Node parent, String nodeName) { assert parent != null : AssertMessages.notNullParameter(0); assert nodeName != null && !nodeName.isEmpty() : AssertMessages.notNullParameter(0); return new NameBasedIterator(parent, nodeName); }
[ "@", "Pure", "public", "static", "Iterator", "<", "Node", ">", "iterate", "(", "Node", "parent", ",", "String", "nodeName", ")", "{", "assert", "parent", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ";", "assert", "nodeName"...
Replies an iterator on nodes that have the specified node name. @param parent is the node from which the children must be extracted. @param nodeName is the name of the extracted nodes @return the iterator on the parents.
[ "Replies", "an", "iterator", "on", "nodes", "that", "have", "the", "specified", "node", "name", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1702-L1707
train
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.parseObject
@Pure public static Object parseObject(String xmlSerializedObject) throws IOException, ClassNotFoundException { assert xmlSerializedObject != null : AssertMessages.notNullParameter(0); try (ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(xmlSerializedObject))) { final ObjectInputStream ois = new ObjectInputStream(bais); return ois.readObject(); } }
java
@Pure public static Object parseObject(String xmlSerializedObject) throws IOException, ClassNotFoundException { assert xmlSerializedObject != null : AssertMessages.notNullParameter(0); try (ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(xmlSerializedObject))) { final ObjectInputStream ois = new ObjectInputStream(bais); return ois.readObject(); } }
[ "@", "Pure", "public", "static", "Object", "parseObject", "(", "String", "xmlSerializedObject", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "assert", "xmlSerializedObject", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ...
Deserialize an object from the given XML string. @param xmlSerializedObject is the string which is containing the serialized object. @return the serialized object extracted from the XML string. @throws IOException if something wrong append during deserialization. @throws ClassNotFoundException is thrown when the class for the deserialized object is not found.
[ "Deserialize", "an", "object", "from", "the", "given", "XML", "string", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1811-L1818
train
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.parseString
@Pure public static byte[] parseString(String text) { return Base64.getDecoder().decode(Strings.nullToEmpty(text).trim()); }
java
@Pure public static byte[] parseString(String text) { return Base64.getDecoder().decode(Strings.nullToEmpty(text).trim()); }
[ "@", "Pure", "public", "static", "byte", "[", "]", "parseString", "(", "String", "text", ")", "{", "return", "Base64", ".", "getDecoder", "(", ")", ".", "decode", "(", "Strings", ".", "nullToEmpty", "(", "text", ")", ".", "trim", "(", ")", ")", ";", ...
Parse a Base64 string with contains a set of bytes. @param text is the string to uudecode @return the decoding result @see #toString(byte[])
[ "Parse", "a", "Base64", "string", "with", "contains", "a", "set", "of", "bytes", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1826-L1829
train
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.parseXML
@Pure public static Document parseXML(String xmlString) { assert xmlString != null : AssertMessages.notNullParameter(0); try { return readXML(new StringReader(xmlString)); } catch (Exception e) { // } return null; }
java
@Pure public static Document parseXML(String xmlString) { assert xmlString != null : AssertMessages.notNullParameter(0); try { return readXML(new StringReader(xmlString)); } catch (Exception e) { // } return null; }
[ "@", "Pure", "public", "static", "Document", "parseXML", "(", "String", "xmlString", ")", "{", "assert", "xmlString", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ";", "try", "{", "return", "readXML", "(", "new", "StringReader...
Parse a string representation of an XML document. @param xmlString is the string representation of the XML document. @return the document or <code>null</code> in case of error.
[ "Parse", "a", "string", "representation", "of", "an", "XML", "document", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1836-L1845
train
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.writeResources
public static void writeResources(Element node, XMLResources resources, XMLBuilder builder) { if (resources != null) { final Element resourcesNode = builder.createElement(NODE_RESOURCES); for (final java.util.Map.Entry<Long, Entry> pair : resources.getPairs().entrySet()) { final Entry e = pair.getValue(); if (e.isURL()) { final Element resourceNode = builder.createElement(NODE_RESOURCE); resourceNode.setAttribute(ATTR_ID, XMLResources.getStringIdentifier(pair.getKey())); resourceNode.setAttribute(ATTR_URL, e.getURL().toExternalForm()); resourceNode.setAttribute(ATTR_MIMETYPE, e.getMimeType()); resourcesNode.appendChild(resourceNode); } else if (e.isFile()) { final Element resourceNode = builder.createElement(NODE_RESOURCE); resourceNode.setAttribute(ATTR_ID, XMLResources.getStringIdentifier(pair.getKey())); final File file = e.getFile(); final StringBuilder url = new StringBuilder(); url.append("file:"); //$NON-NLS-1$ boolean addSlash = false; for (final String elt : FileSystem.split(file)) { try { if (addSlash) { url.append("/"); //$NON-NLS-1$ } url.append(URLEncoder.encode(elt, Charset.defaultCharset().name())); } catch (UnsupportedEncodingException e1) { throw new Error(e1); } addSlash = true; } resourceNode.setAttribute(ATTR_FILE, url.toString()); resourceNode.setAttribute(ATTR_MIMETYPE, e.getMimeType()); resourcesNode.appendChild(resourceNode); } else if (e.isEmbeddedData()) { final Element resourceNode = builder.createElement(NODE_RESOURCE); resourceNode.setAttribute(ATTR_ID, XMLResources.getStringIdentifier(pair.getKey())); resourceNode.setAttribute(ATTR_MIMETYPE, e.getMimeType()); final byte[] data = e.getEmbeddedData(); final CDATASection cdata = builder.createCDATASection(toString(data)); resourceNode.appendChild(cdata); resourcesNode.appendChild(resourceNode); } } if (resourcesNode.getChildNodes().getLength() > 0) { node.appendChild(resourcesNode); } } }
java
public static void writeResources(Element node, XMLResources resources, XMLBuilder builder) { if (resources != null) { final Element resourcesNode = builder.createElement(NODE_RESOURCES); for (final java.util.Map.Entry<Long, Entry> pair : resources.getPairs().entrySet()) { final Entry e = pair.getValue(); if (e.isURL()) { final Element resourceNode = builder.createElement(NODE_RESOURCE); resourceNode.setAttribute(ATTR_ID, XMLResources.getStringIdentifier(pair.getKey())); resourceNode.setAttribute(ATTR_URL, e.getURL().toExternalForm()); resourceNode.setAttribute(ATTR_MIMETYPE, e.getMimeType()); resourcesNode.appendChild(resourceNode); } else if (e.isFile()) { final Element resourceNode = builder.createElement(NODE_RESOURCE); resourceNode.setAttribute(ATTR_ID, XMLResources.getStringIdentifier(pair.getKey())); final File file = e.getFile(); final StringBuilder url = new StringBuilder(); url.append("file:"); //$NON-NLS-1$ boolean addSlash = false; for (final String elt : FileSystem.split(file)) { try { if (addSlash) { url.append("/"); //$NON-NLS-1$ } url.append(URLEncoder.encode(elt, Charset.defaultCharset().name())); } catch (UnsupportedEncodingException e1) { throw new Error(e1); } addSlash = true; } resourceNode.setAttribute(ATTR_FILE, url.toString()); resourceNode.setAttribute(ATTR_MIMETYPE, e.getMimeType()); resourcesNode.appendChild(resourceNode); } else if (e.isEmbeddedData()) { final Element resourceNode = builder.createElement(NODE_RESOURCE); resourceNode.setAttribute(ATTR_ID, XMLResources.getStringIdentifier(pair.getKey())); resourceNode.setAttribute(ATTR_MIMETYPE, e.getMimeType()); final byte[] data = e.getEmbeddedData(); final CDATASection cdata = builder.createCDATASection(toString(data)); resourceNode.appendChild(cdata); resourcesNode.appendChild(resourceNode); } } if (resourcesNode.getChildNodes().getLength() > 0) { node.appendChild(resourcesNode); } } }
[ "public", "static", "void", "writeResources", "(", "Element", "node", ",", "XMLResources", "resources", ",", "XMLBuilder", "builder", ")", "{", "if", "(", "resources", "!=", "null", ")", "{", "final", "Element", "resourcesNode", "=", "builder", ".", "createEle...
Write the given resources into the given XML node. @param node is the XML node to fill. @param resources are the resources to put out. @param builder is the tool to create XML nodes.
[ "Write", "the", "given", "resources", "into", "the", "given", "XML", "node", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L2476-L2522
train
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.readResourceURL
@Pure public static URL readResourceURL(Element node, XMLResources resources, String... path) { final String stringValue = getAttributeValue(node, path); if (XMLResources.isStringIdentifier(stringValue)) { try { final long id = XMLResources.getNumericalIdentifier(stringValue); return resources.getResourceURL(id); } catch (Throwable exception) { // } } return null; }
java
@Pure public static URL readResourceURL(Element node, XMLResources resources, String... path) { final String stringValue = getAttributeValue(node, path); if (XMLResources.isStringIdentifier(stringValue)) { try { final long id = XMLResources.getNumericalIdentifier(stringValue); return resources.getResourceURL(id); } catch (Throwable exception) { // } } return null; }
[ "@", "Pure", "public", "static", "URL", "readResourceURL", "(", "Element", "node", ",", "XMLResources", "resources", ",", "String", "...", "path", ")", "{", "final", "String", "stringValue", "=", "getAttributeValue", "(", "node", ",", "path", ")", ";", "if",...
Replies the resource URL that is contained inside the XML attribute defined in the given node and with the given XML path. @param node is the XML node to read. @param resources is the collection of resources to read. @param path is the XML path, relative to the node, of the attribute. The last element of the array is the name of the attribute. @return the resource URL, or <code>null</code> if it cannot be retrieved.
[ "Replies", "the", "resource", "URL", "that", "is", "contained", "inside", "the", "XML", "attribute", "defined", "in", "the", "given", "node", "and", "with", "the", "given", "XML", "path", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L2604-L2616
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/caller/StackTraceCaller.java
StackTraceCaller.getTraceElementAt
protected static StackTraceElement getTraceElementAt(int level) { if (level < 0) { return null; } try { final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); int j = -1; boolean found = false; Class<?> type; for (int i = 0; i < stackTrace.length; ++i) { if (found) { if ((i - j) == level) { return stackTrace[i]; } } else { type = loadClass(stackTrace[i].getClassName()); if (type != null && Caller.class.isAssignableFrom(type)) { j = i + 1; } else if (j >= 0) { // First ocurrence of a class in the stack, after the // inner invocation of StackTraceCaller found = true; if ((i - j) == level) { return stackTrace[i]; } } } } } catch (AssertionError e) { throw e; } catch (Throwable exception) { // } return null; }
java
protected static StackTraceElement getTraceElementAt(int level) { if (level < 0) { return null; } try { final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); int j = -1; boolean found = false; Class<?> type; for (int i = 0; i < stackTrace.length; ++i) { if (found) { if ((i - j) == level) { return stackTrace[i]; } } else { type = loadClass(stackTrace[i].getClassName()); if (type != null && Caller.class.isAssignableFrom(type)) { j = i + 1; } else if (j >= 0) { // First ocurrence of a class in the stack, after the // inner invocation of StackTraceCaller found = true; if ((i - j) == level) { return stackTrace[i]; } } } } } catch (AssertionError e) { throw e; } catch (Throwable exception) { // } return null; }
[ "protected", "static", "StackTraceElement", "getTraceElementAt", "(", "int", "level", ")", "{", "if", "(", "level", "<", "0", ")", "{", "return", "null", ";", "}", "try", "{", "final", "StackTraceElement", "[", "]", "stackTrace", "=", "Thread", ".", "curre...
Replies the stack trace element for the given level. <p>The given {@code level} permits to specify which class to reply: <ul> <li>{@code 0}: the class where is defined the function ({@code f<sub>0</sub>}) that has called one function of {@code Caller}</li> <li>{@code 1}: the class where is defined the function ({@code f<sub>1</sub>}) that has called {@code f<sub>0</sub>}</li> <li>{@code 2}: the class where is defined the function ({@code f<sub>2</sub>}) that has called {@code f<sub>1</sub>}</li> <li>etc.</li> </ul> @param level is the desired level. @return the stack trace element; or {@code null}.
[ "Replies", "the", "stack", "trace", "element", "for", "the", "given", "level", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/caller/StackTraceCaller.java#L64-L98
train
gallandarakhneorg/afc
core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/NaryTreeNode.java
NaryTreeNode.moveTo
public boolean moveTo(N newParent) { if (newParent == null) { return false; } return moveTo(newParent, newParent.getChildCount()); }
java
public boolean moveTo(N newParent) { if (newParent == null) { return false; } return moveTo(newParent, newParent.getChildCount()); }
[ "public", "boolean", "moveTo", "(", "N", "newParent", ")", "{", "if", "(", "newParent", "==", "null", ")", "{", "return", "false", ";", "}", "return", "moveTo", "(", "newParent", ",", "newParent", ".", "getChildCount", "(", ")", ")", ";", "}" ]
Move this node in the given new parent node. <p>This function adds this node at the end of the list of the children of the new parent node. <p>This function is preferred to a sequence of calls to {@link #removeFromParent()} and {@link #setChildAt(int, NaryTreeNode)} because it fires a limited set of events dedicated to the move the node. @param newParent is the new parent for this node. @return <code>true</code> on success, otherwise <code>false</code>.
[ "Move", "this", "node", "in", "the", "given", "new", "parent", "node", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/NaryTreeNode.java#L221-L226
train
gallandarakhneorg/afc
core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/NaryTreeNode.java
NaryTreeNode.addChild
public final boolean addChild(int index, N newChild) { if (newChild == null) { return false; } final int count = (this.children == null) ? 0 : this.children.size(); final N oldParent = newChild.getParentNode(); if (oldParent != this && oldParent != null) { newChild.removeFromParent(); } final int insertionIndex; if (this.children == null) { this.children = newInternalList(index + 1); } if (index < count) { // set the element insertionIndex = Math.max(index, 0); this.children.add(insertionIndex, newChild); } else { // Resize the array insertionIndex = this.children.size(); this.children.add(newChild); } ++this.notNullChildCount; newChild.setParentNodeReference(toN(), true); firePropertyChildAdded(insertionIndex, newChild); return true; }
java
public final boolean addChild(int index, N newChild) { if (newChild == null) { return false; } final int count = (this.children == null) ? 0 : this.children.size(); final N oldParent = newChild.getParentNode(); if (oldParent != this && oldParent != null) { newChild.removeFromParent(); } final int insertionIndex; if (this.children == null) { this.children = newInternalList(index + 1); } if (index < count) { // set the element insertionIndex = Math.max(index, 0); this.children.add(insertionIndex, newChild); } else { // Resize the array insertionIndex = this.children.size(); this.children.add(newChild); } ++this.notNullChildCount; newChild.setParentNodeReference(toN(), true); firePropertyChildAdded(insertionIndex, newChild); return true; }
[ "public", "final", "boolean", "addChild", "(", "int", "index", ",", "N", "newChild", ")", "{", "if", "(", "newChild", "==", "null", ")", "{", "return", "false", ";", "}", "final", "int", "count", "=", "(", "this", ".", "children", "==", "null", ")", ...
Add a child node at the specified index. @param index is the insertion index. @param newChild is the new child to insert. @return <code>true</code> on success, otherwise <code>false</code>
[ "Add", "a", "child", "node", "at", "the", "specified", "index", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/NaryTreeNode.java#L341-L375
train
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/scoring/Scoreds.java
Scoreds.ByScoreThenByItem
public static final <T extends Comparable<T>> Ordering<Scored<T>> ByScoreThenByItem( Ordering<T> itemOrdering) { final Ordering<Scored<T>> byItem = itemOrdering.onResultOf(Scoreds.<T>itemsOnly()); final Ordering<Scored<T>> byScore = Scoreds.<T>ByScoreOnly(); return Ordering.compound(ImmutableList.of(byScore, byItem)); }
java
public static final <T extends Comparable<T>> Ordering<Scored<T>> ByScoreThenByItem( Ordering<T> itemOrdering) { final Ordering<Scored<T>> byItem = itemOrdering.onResultOf(Scoreds.<T>itemsOnly()); final Ordering<Scored<T>> byScore = Scoreds.<T>ByScoreOnly(); return Ordering.compound(ImmutableList.of(byScore, byItem)); }
[ "public", "static", "final", "<", "T", "extends", "Comparable", "<", "T", ">", ">", "Ordering", "<", "Scored", "<", "T", ">", ">", "ByScoreThenByItem", "(", "Ordering", "<", "T", ">", "itemOrdering", ")", "{", "final", "Ordering", "<", "Scored", "<", "...
Comparator which compares Scoreds first by score, then by item, where the item ordering to use is explicitly specified.
[ "Comparator", "which", "compares", "Scoreds", "first", "by", "score", "then", "by", "item", "where", "the", "item", "ordering", "to", "use", "is", "explicitly", "specified", "." ]
d618652674d647867306e2e4b987a21b7c29c015
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/scoring/Scoreds.java#L117-L123
train
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/scoring/Scoreds.java
Scoreds.ByScoreThenByItem
public static final <T extends Comparable<T>> Ordering<Scored<T>> ByScoreThenByItem() { final Ordering<Scored<T>> byItem = Scoreds.<T>ByItemOnly(); final Ordering<Scored<T>> byScore = Scoreds.<T>ByScoreOnly(); return Ordering.compound(ImmutableList.of(byScore, byItem)); }
java
public static final <T extends Comparable<T>> Ordering<Scored<T>> ByScoreThenByItem() { final Ordering<Scored<T>> byItem = Scoreds.<T>ByItemOnly(); final Ordering<Scored<T>> byScore = Scoreds.<T>ByScoreOnly(); return Ordering.compound(ImmutableList.of(byScore, byItem)); }
[ "public", "static", "final", "<", "T", "extends", "Comparable", "<", "T", ">", ">", "Ordering", "<", "Scored", "<", "T", ">", ">", "ByScoreThenByItem", "(", ")", "{", "final", "Ordering", "<", "Scored", "<", "T", ">", ">", "byItem", "=", "Scoreds", "...
Comparator which compares Scoreds first by score, then by item.
[ "Comparator", "which", "compares", "Scoreds", "first", "by", "score", "then", "by", "item", "." ]
d618652674d647867306e2e4b987a21b7c29c015
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/scoring/Scoreds.java#L128-L133
train
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/actions/OpenFileAction.java
OpenFileAction.onFileChoose
protected void onFileChoose(JFileChooser fileChooser, ActionEvent actionEvent) { final int returnVal = fileChooser.showOpenDialog(parent); if (returnVal == JFileChooser.APPROVE_OPTION) { final File file = fileChooser.getSelectedFile(); onApproveOption(file, actionEvent); } else { onCancel(actionEvent); } }
java
protected void onFileChoose(JFileChooser fileChooser, ActionEvent actionEvent) { final int returnVal = fileChooser.showOpenDialog(parent); if (returnVal == JFileChooser.APPROVE_OPTION) { final File file = fileChooser.getSelectedFile(); onApproveOption(file, actionEvent); } else { onCancel(actionEvent); } }
[ "protected", "void", "onFileChoose", "(", "JFileChooser", "fileChooser", ",", "ActionEvent", "actionEvent", ")", "{", "final", "int", "returnVal", "=", "fileChooser", ".", "showOpenDialog", "(", "parent", ")", ";", "if", "(", "returnVal", "==", "JFileChooser", "...
Callback method to interact on file choose. @param fileChooser the file chooser @param actionEvent the action event
[ "Callback", "method", "to", "interact", "on", "file", "choose", "." ]
4045e85cabd8f0ce985cbfff134c3c9873930c79
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/actions/OpenFileAction.java#L105-L118
train
digitalfondue/stampo
src/main/java/ch/digitalfondue/stampo/processor/LayoutProcessor.java
LayoutProcessor.applyLayout
LayoutProcessorOutput applyLayout(FileResource resource, Locale locale, Map<String, Object> model) { Optional<Path> layout = findLayout(resource); return layout.map(Path::toString)// .map(Files::getFileExtension)// .map(layoutEngines::get) // .orElse(lParam -> new LayoutProcessorOutput(lParam.model.get("content").toString(), "none", lParam.layoutTemplate, lParam.locale)) .apply(new LayoutParameters(layout, resource.getPath(), locale, model)); }
java
LayoutProcessorOutput applyLayout(FileResource resource, Locale locale, Map<String, Object> model) { Optional<Path> layout = findLayout(resource); return layout.map(Path::toString)// .map(Files::getFileExtension)// .map(layoutEngines::get) // .orElse(lParam -> new LayoutProcessorOutput(lParam.model.get("content").toString(), "none", lParam.layoutTemplate, lParam.locale)) .apply(new LayoutParameters(layout, resource.getPath(), locale, model)); }
[ "LayoutProcessorOutput", "applyLayout", "(", "FileResource", "resource", ",", "Locale", "locale", ",", "Map", "<", "String", ",", "Object", ">", "model", ")", "{", "Optional", "<", "Path", ">", "layout", "=", "findLayout", "(", "resource", ")", ";", "return"...
has been found, the file will be copied as it is
[ "has", "been", "found", "the", "file", "will", "be", "copied", "as", "it", "is" ]
5a41f20acd9211cf3951c30d0e0825994ae95573
https://github.com/digitalfondue/stampo/blob/5a41f20acd9211cf3951c30d0e0825994ae95573/src/main/java/ch/digitalfondue/stampo/processor/LayoutProcessor.java#L57-L67
train
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/temporal/Timex2Time.java
Timex2Time.modifiedCopy
@Deprecated public Timex2Time modifiedCopy(final Modifier modifier) { return new Timex2Time(val, modifier, set, granularity, periodicity, anchorVal, anchorDir, nonSpecific); }
java
@Deprecated public Timex2Time modifiedCopy(final Modifier modifier) { return new Timex2Time(val, modifier, set, granularity, periodicity, anchorVal, anchorDir, nonSpecific); }
[ "@", "Deprecated", "public", "Timex2Time", "modifiedCopy", "(", "final", "Modifier", "modifier", ")", "{", "return", "new", "Timex2Time", "(", "val", ",", "modifier", ",", "set", ",", "granularity", ",", "periodicity", ",", "anchorVal", ",", "anchorDir", ",", ...
Returns a copy of this Timex which is the same except with the specified modifier @deprecated Use {@link #copyBuilder()} and {@link Builder#withModifier(Modifier)} instead
[ "Returns", "a", "copy", "of", "this", "Timex", "which", "is", "the", "same", "except", "with", "the", "specified", "modifier" ]
d618652674d647867306e2e4b987a21b7c29c015
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/temporal/Timex2Time.java#L221-L225
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java
MACNumber.parse
@Pure public static MACNumber[] parse(String addresses) { if ((addresses == null) || ("".equals(addresses))) { //$NON-NLS-1$ return new MACNumber[0]; } final String[] adrs = addresses.split(Pattern.quote(Character.toString(MACNUMBER_SEPARATOR))); final List<MACNumber> list = new ArrayList<>(); for (final String adr : adrs) { list.add(new MACNumber(adr)); } final MACNumber[] tab = new MACNumber[list.size()]; list.toArray(tab); list.clear(); return tab; }
java
@Pure public static MACNumber[] parse(String addresses) { if ((addresses == null) || ("".equals(addresses))) { //$NON-NLS-1$ return new MACNumber[0]; } final String[] adrs = addresses.split(Pattern.quote(Character.toString(MACNUMBER_SEPARATOR))); final List<MACNumber> list = new ArrayList<>(); for (final String adr : adrs) { list.add(new MACNumber(adr)); } final MACNumber[] tab = new MACNumber[list.size()]; list.toArray(tab); list.clear(); return tab; }
[ "@", "Pure", "public", "static", "MACNumber", "[", "]", "parse", "(", "String", "addresses", ")", "{", "if", "(", "(", "addresses", "==", "null", ")", "||", "(", "\"\"", ".", "equals", "(", "addresses", ")", ")", ")", "{", "//$NON-NLS-1$", "return", ...
Parse the specified string an repleis the corresponding MAC numbers. @param addresses is the string to parse @return a list of addresses. @throws IllegalArgumentException is the argument has not the right syntax.
[ "Parse", "the", "specified", "string", "an", "repleis", "the", "corresponding", "MAC", "numbers", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java#L126-L140
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java
MACNumber.join
@Pure public static String join(MACNumber... addresses) { if ((addresses == null) || (addresses.length == 0)) { return null; } final StringBuilder buf = new StringBuilder(); for (final MACNumber number : addresses) { if (buf.length() > 0) { buf.append(MACNUMBER_SEPARATOR); } buf.append(number); } return buf.toString(); }
java
@Pure public static String join(MACNumber... addresses) { if ((addresses == null) || (addresses.length == 0)) { return null; } final StringBuilder buf = new StringBuilder(); for (final MACNumber number : addresses) { if (buf.length() > 0) { buf.append(MACNUMBER_SEPARATOR); } buf.append(number); } return buf.toString(); }
[ "@", "Pure", "public", "static", "String", "join", "(", "MACNumber", "...", "addresses", ")", "{", "if", "(", "(", "addresses", "==", "null", ")", "||", "(", "addresses", ".", "length", "==", "0", ")", ")", "{", "return", "null", ";", "}", "final", ...
Join the specified MAC numbers to reply a string. @param addresses is the list of mac addresses to join. @return the joined string.
[ "Join", "the", "specified", "MAC", "numbers", "to", "reply", "a", "string", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java#L169-L182
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java
MACNumber.getAllAdapters
@Pure public static Collection<MACNumber> getAllAdapters() { final List<MACNumber> av = new ArrayList<>(); final Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException exception) { return av; } if (interfaces != null) { NetworkInterface inter; while (interfaces.hasMoreElements()) { inter = interfaces.nextElement(); try { final byte[] addr = inter.getHardwareAddress(); if (addr != null) { av.add(new MACNumber(addr)); } } catch (SocketException exception) { // Continue to the next loop. } } } return av; }
java
@Pure public static Collection<MACNumber> getAllAdapters() { final List<MACNumber> av = new ArrayList<>(); final Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException exception) { return av; } if (interfaces != null) { NetworkInterface inter; while (interfaces.hasMoreElements()) { inter = interfaces.nextElement(); try { final byte[] addr = inter.getHardwareAddress(); if (addr != null) { av.add(new MACNumber(addr)); } } catch (SocketException exception) { // Continue to the next loop. } } } return av; }
[ "@", "Pure", "public", "static", "Collection", "<", "MACNumber", ">", "getAllAdapters", "(", ")", "{", "final", "List", "<", "MACNumber", ">", "av", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "Enumeration", "<", "NetworkInterface", ">", "interf...
Get all of the ethernet addresses associated with the local machine. <p>This method will try and find ALL of the ethernet adapters which are currently available on the system. This is heavily OS dependent and may not be supported on all platforms. When not supported, you should still get back a collection with the {@link #getPrimaryAdapter primary adapter} in it. @return the list of MAC numbers associated to the physical devices. @see #getPrimaryAdapter
[ "Get", "all", "of", "the", "ethernet", "addresses", "associated", "with", "the", "local", "machine", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java#L195-L219
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java
MACNumber.getAllMappings
@Pure public static Map<InetAddress, MACNumber> getAllMappings() { final Map<InetAddress, MACNumber> av = new HashMap<>(); final Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException exception) { return av; } if (interfaces != null) { NetworkInterface inter; MACNumber mac; InetAddress inet; while (interfaces.hasMoreElements()) { inter = interfaces.nextElement(); try { final byte[] addr = inter.getHardwareAddress(); if (addr != null) { mac = new MACNumber(addr); final Enumeration<InetAddress> inets = inter.getInetAddresses(); while (inets.hasMoreElements()) { inet = inets.nextElement(); av.put(inet, mac); } } } catch (SocketException exception) { // Continue to the next loop. } } } return av; }
java
@Pure public static Map<InetAddress, MACNumber> getAllMappings() { final Map<InetAddress, MACNumber> av = new HashMap<>(); final Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException exception) { return av; } if (interfaces != null) { NetworkInterface inter; MACNumber mac; InetAddress inet; while (interfaces.hasMoreElements()) { inter = interfaces.nextElement(); try { final byte[] addr = inter.getHardwareAddress(); if (addr != null) { mac = new MACNumber(addr); final Enumeration<InetAddress> inets = inter.getInetAddresses(); while (inets.hasMoreElements()) { inet = inets.nextElement(); av.put(inet, mac); } } } catch (SocketException exception) { // Continue to the next loop. } } } return av; }
[ "@", "Pure", "public", "static", "Map", "<", "InetAddress", ",", "MACNumber", ">", "getAllMappings", "(", ")", "{", "final", "Map", "<", "InetAddress", ",", "MACNumber", ">", "av", "=", "new", "HashMap", "<>", "(", ")", ";", "final", "Enumeration", "<", ...
Get all of the internet address and ethernet address mappings on the local machine. <p>This method will try and find ALL of the ethernet adapters which are currently available on the system. This is heavily OS dependent and may not be supported on all platforms. When not supported, you should still get back a collection with the {@link #getPrimaryAdapterAddresses primary adapter} in it. @return the map internet address and ethernet address mapping. @see #getPrimaryAdapterAddresses
[ "Get", "all", "of", "the", "internet", "address", "and", "ethernet", "address", "mappings", "on", "the", "local", "machine", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java#L233-L264
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java
MACNumber.getPrimaryAdapter
@Pure public static MACNumber getPrimaryAdapter() { final Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException exception) { return null; } if (interfaces != null) { NetworkInterface inter; while (interfaces.hasMoreElements()) { inter = interfaces.nextElement(); try { final byte[] addr = inter.getHardwareAddress(); if (addr != null) { return new MACNumber(addr); } } catch (SocketException exception) { // Continue to the next loop. } } } return null; }
java
@Pure public static MACNumber getPrimaryAdapter() { final Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException exception) { return null; } if (interfaces != null) { NetworkInterface inter; while (interfaces.hasMoreElements()) { inter = interfaces.nextElement(); try { final byte[] addr = inter.getHardwareAddress(); if (addr != null) { return new MACNumber(addr); } } catch (SocketException exception) { // Continue to the next loop. } } } return null; }
[ "@", "Pure", "public", "static", "MACNumber", "getPrimaryAdapter", "(", ")", "{", "final", "Enumeration", "<", "NetworkInterface", ">", "interfaces", ";", "try", "{", "interfaces", "=", "NetworkInterface", ".", "getNetworkInterfaces", "(", ")", ";", "}", "catch"...
Try to determine the primary ethernet address of the machine. @return the primary MACNumber or <code>null</code>
[ "Try", "to", "determine", "the", "primary", "ethernet", "address", "of", "the", "machine", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java#L270-L293
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java
MACNumber.getPrimaryAdapterAddresses
@Pure public static Collection<InetAddress> getPrimaryAdapterAddresses() { final Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException exception) { return Collections.emptyList(); } if (interfaces != null) { NetworkInterface inter; while (interfaces.hasMoreElements()) { inter = interfaces.nextElement(); try { final byte[] addr = inter.getHardwareAddress(); if (addr != null) { final Collection<InetAddress> inetList = new ArrayList<>(); final Enumeration<InetAddress> inets = inter.getInetAddresses(); while (inets.hasMoreElements()) { inetList.add(inets.nextElement()); } return inetList; } } catch (SocketException exception) { // Continue to the next loop. } } } return Collections.emptyList(); }
java
@Pure public static Collection<InetAddress> getPrimaryAdapterAddresses() { final Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException exception) { return Collections.emptyList(); } if (interfaces != null) { NetworkInterface inter; while (interfaces.hasMoreElements()) { inter = interfaces.nextElement(); try { final byte[] addr = inter.getHardwareAddress(); if (addr != null) { final Collection<InetAddress> inetList = new ArrayList<>(); final Enumeration<InetAddress> inets = inter.getInetAddresses(); while (inets.hasMoreElements()) { inetList.add(inets.nextElement()); } return inetList; } } catch (SocketException exception) { // Continue to the next loop. } } } return Collections.emptyList(); }
[ "@", "Pure", "public", "static", "Collection", "<", "InetAddress", ">", "getPrimaryAdapterAddresses", "(", ")", "{", "final", "Enumeration", "<", "NetworkInterface", ">", "interfaces", ";", "try", "{", "interfaces", "=", "NetworkInterface", ".", "getNetworkInterface...
Try to determine the primary ethernet address of the machine and replies the associated internet addresses. @return the internet addresses of the primary network interface.
[ "Try", "to", "determine", "the", "primary", "ethernet", "address", "of", "the", "machine", "and", "replies", "the", "associated", "internet", "addresses", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java#L300-L328
train
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java
MACNumber.isNull
@Pure public boolean isNull() { for (int i = 0; i < this.bytes.length; ++i) { if (this.bytes[i] != 0) { return false; } } return true; }
java
@Pure public boolean isNull() { for (int i = 0; i < this.bytes.length; ++i) { if (this.bytes[i] != 0) { return false; } } return true; }
[ "@", "Pure", "public", "boolean", "isNull", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "bytes", ".", "length", ";", "++", "i", ")", "{", "if", "(", "this", ".", "bytes", "[", "i", "]", "!=", "0", ")", "{", ...
Replies if all the MAC address number are equal to zero. @return <code>true</code> if all the bytes are zero. @see #NULL
[ "Replies", "if", "all", "the", "MAC", "address", "number", "are", "equal", "to", "zero", "." ]
0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/MACNumber.java#L385-L393
train
hltcoe/annotated-nyt
src/main/java/edu/jhu/hlt/annotatednyt/AnnotatedNYTDocument.java
AnnotatedNYTDocument.getSourcePath
public Optional<Path> getSourcePath() { File f = this.nytdoc.getSourceFile(); return f == null ? Optional.empty() : Optional.of(f.toPath()); }
java
public Optional<Path> getSourcePath() { File f = this.nytdoc.getSourceFile(); return f == null ? Optional.empty() : Optional.of(f.toPath()); }
[ "public", "Optional", "<", "Path", ">", "getSourcePath", "(", ")", "{", "File", "f", "=", "this", ".", "nytdoc", ".", "getSourceFile", "(", ")", ";", "return", "f", "==", "null", "?", "Optional", ".", "empty", "(", ")", ":", "Optional", ".", "of", ...
Accessor for the sourceFile property. @return the sourceFile
[ "Accessor", "for", "the", "sourceFile", "property", "." ]
0a4daa97705591cefea9de61614770ae2665a48e
https://github.com/hltcoe/annotated-nyt/blob/0a4daa97705591cefea9de61614770ae2665a48e/src/main/java/edu/jhu/hlt/annotatednyt/AnnotatedNYTDocument.java#L489-L492
train
hltcoe/annotated-nyt
src/main/java/edu/jhu/hlt/annotatednyt/AnnotatedNYTDocument.java
AnnotatedNYTDocument.getUrl
public Optional<URL> getUrl() { URL u = this.nytdoc.getUrl(); return Optional.ofNullable(u); }
java
public Optional<URL> getUrl() { URL u = this.nytdoc.getUrl(); return Optional.ofNullable(u); }
[ "public", "Optional", "<", "URL", ">", "getUrl", "(", ")", "{", "URL", "u", "=", "this", ".", "nytdoc", ".", "getUrl", "(", ")", ";", "return", "Optional", ".", "ofNullable", "(", "u", ")", ";", "}" ]
Accessor for the url property. @return the url
[ "Accessor", "for", "the", "url", "property", "." ]
0a4daa97705591cefea9de61614770ae2665a48e
https://github.com/hltcoe/annotated-nyt/blob/0a4daa97705591cefea9de61614770ae2665a48e/src/main/java/edu/jhu/hlt/annotatednyt/AnnotatedNYTDocument.java#L526-L529
train
khmarbaise/sapm
src/main/java/com/soebes/subversion/sapm/AuthorizationFile.java
AuthorizationFile.load
public void load(File authorizationFile) throws AuthorizationFileException { FileInputStream fis = null; try { fis = new FileInputStream(authorizationFile); ANTLRInputStream stream = new ANTLRInputStream(fis); SAFPLexer lexer = new SAFPLexer(stream); CommonTokenStream tokens = new CommonTokenStream(lexer); SAFPParser parser = new SAFPParser(tokens); parser.prog(); setAccessRules(parser.getAccessRules()); setGroups(parser.getGroups()); setAliases(parser.getAliases()); } catch (FileNotFoundException e) { throw new AuthorizationFileException("FileNotFoundException: ", e); } catch (IOException e) { throw new AuthorizationFileException("IOException: ", e); } catch (RecognitionException e) { throw new AuthorizationFileException("Parser problem: ", e); } finally { try { fis.close(); } catch (IOException e) { throw new AuthorizationFileException("IOExcetion during close: ", e); } } }
java
public void load(File authorizationFile) throws AuthorizationFileException { FileInputStream fis = null; try { fis = new FileInputStream(authorizationFile); ANTLRInputStream stream = new ANTLRInputStream(fis); SAFPLexer lexer = new SAFPLexer(stream); CommonTokenStream tokens = new CommonTokenStream(lexer); SAFPParser parser = new SAFPParser(tokens); parser.prog(); setAccessRules(parser.getAccessRules()); setGroups(parser.getGroups()); setAliases(parser.getAliases()); } catch (FileNotFoundException e) { throw new AuthorizationFileException("FileNotFoundException: ", e); } catch (IOException e) { throw new AuthorizationFileException("IOException: ", e); } catch (RecognitionException e) { throw new AuthorizationFileException("Parser problem: ", e); } finally { try { fis.close(); } catch (IOException e) { throw new AuthorizationFileException("IOExcetion during close: ", e); } } }
[ "public", "void", "load", "(", "File", "authorizationFile", ")", "throws", "AuthorizationFileException", "{", "FileInputStream", "fis", "=", "null", ";", "try", "{", "fis", "=", "new", "FileInputStream", "(", "authorizationFile", ")", ";", "ANTLRInputStream", "str...
Load the authorization file. @param authorizationFile The file you would like to load. @throws AuthorizationFileException in case of a problem like file not found, IOException or parser problem (syntax error in the authorization file).
[ "Load", "the", "authorization", "file", "." ]
b5da5b0d8929324f03cb3a4233a3534813f93eea
https://github.com/khmarbaise/sapm/blob/b5da5b0d8929324f03cb3a4233a3534813f93eea/src/main/java/com/soebes/subversion/sapm/AuthorizationFile.java#L60-L85
train
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/key/KeyStoreExtensions.java
KeyStoreExtensions.deleteAlias
public static void deleteAlias(final File keystoreFile, String alias, final String password) throws NoSuchAlgorithmException, CertificateException, FileNotFoundException, KeyStoreException, IOException { KeyStore keyStore = KeyStoreFactory.newKeyStore(KeystoreType.JKS.name(), password, keystoreFile); keyStore.deleteEntry(alias); keyStore.store(new FileOutputStream(keystoreFile), password.toCharArray()); }
java
public static void deleteAlias(final File keystoreFile, String alias, final String password) throws NoSuchAlgorithmException, CertificateException, FileNotFoundException, KeyStoreException, IOException { KeyStore keyStore = KeyStoreFactory.newKeyStore(KeystoreType.JKS.name(), password, keystoreFile); keyStore.deleteEntry(alias); keyStore.store(new FileOutputStream(keystoreFile), password.toCharArray()); }
[ "public", "static", "void", "deleteAlias", "(", "final", "File", "keystoreFile", ",", "String", "alias", ",", "final", "String", "password", ")", "throws", "NoSuchAlgorithmException", ",", "CertificateException", ",", "FileNotFoundException", ",", "KeyStoreException", ...
Delete the given alias from the given keystore file. @param keystoreFile the keystore file @param alias the alias @param password the password @throws NoSuchAlgorithmException the no such algorithm exception @throws CertificateException the certificate exception @throws FileNotFoundException the file not found exception @throws KeyStoreException the key store exception @throws IOException Signals that an I/O exception has occurred.
[ "Delete", "the", "given", "alias", "from", "the", "given", "keystore", "file", "." ]
7f51ef5e4457e24de7ff391f10bfc5609e6f1a34
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/KeyStoreExtensions.java#L67-L76
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/gzip/CompressFilterSettings.java
CompressFilterSettings.setResponseCompressionEnabled
@Nonnull public static EChange setResponseCompressionEnabled (final boolean bResponseCompressionEnabled) { return s_aRWLock.writeLocked ( () -> { if (s_bResponseCompressionEnabled == bResponseCompressionEnabled) return EChange.UNCHANGED; s_bResponseCompressionEnabled = bResponseCompressionEnabled; LOGGER.info ("CompressFilter responseCompressionEnabled=" + bResponseCompressionEnabled); return EChange.CHANGED; }); }
java
@Nonnull public static EChange setResponseCompressionEnabled (final boolean bResponseCompressionEnabled) { return s_aRWLock.writeLocked ( () -> { if (s_bResponseCompressionEnabled == bResponseCompressionEnabled) return EChange.UNCHANGED; s_bResponseCompressionEnabled = bResponseCompressionEnabled; LOGGER.info ("CompressFilter responseCompressionEnabled=" + bResponseCompressionEnabled); return EChange.CHANGED; }); }
[ "@", "Nonnull", "public", "static", "EChange", "setResponseCompressionEnabled", "(", "final", "boolean", "bResponseCompressionEnabled", ")", "{", "return", "s_aRWLock", ".", "writeLocked", "(", "(", ")", "->", "{", "if", "(", "s_bResponseCompressionEnabled", "==", "...
Enable or disable the overall compression. @param bResponseCompressionEnabled <code>true</code> to enable it, <code>false</code> to disable it @return {@link EChange}
[ "Enable", "or", "disable", "the", "overall", "compression", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/gzip/CompressFilterSettings.java#L78-L88
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/gzip/CompressFilterSettings.java
CompressFilterSettings.setDebugModeEnabled
@Nonnull public static EChange setDebugModeEnabled (final boolean bDebugModeEnabled) { return s_aRWLock.writeLocked ( () -> { if (s_bDebugModeEnabled == bDebugModeEnabled) return EChange.UNCHANGED; s_bDebugModeEnabled = bDebugModeEnabled; LOGGER.info ("CompressFilter debugMode=" + bDebugModeEnabled); return EChange.CHANGED; }); }
java
@Nonnull public static EChange setDebugModeEnabled (final boolean bDebugModeEnabled) { return s_aRWLock.writeLocked ( () -> { if (s_bDebugModeEnabled == bDebugModeEnabled) return EChange.UNCHANGED; s_bDebugModeEnabled = bDebugModeEnabled; LOGGER.info ("CompressFilter debugMode=" + bDebugModeEnabled); return EChange.CHANGED; }); }
[ "@", "Nonnull", "public", "static", "EChange", "setDebugModeEnabled", "(", "final", "boolean", "bDebugModeEnabled", ")", "{", "return", "s_aRWLock", ".", "writeLocked", "(", "(", ")", "->", "{", "if", "(", "s_bDebugModeEnabled", "==", "bDebugModeEnabled", ")", "...
Enable or disable debug mode @param bDebugModeEnabled <code>true</code> to enable it, <code>false</code> to disable it @return {@link EChange}
[ "Enable", "or", "disable", "debug", "mode" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/gzip/CompressFilterSettings.java#L204-L214
train
googlegenomics/gatk-tools-java
src/main/java/com/google/cloud/genomics/gatk/common/rest/GenomicsConverter.java
GenomicsConverter.makeSAMFileHeader
@Override public SAMFileHeader makeSAMFileHeader(ReadGroupSet readGroupSet, List<Reference> references) { return ReadUtils.makeSAMFileHeader(readGroupSet, references); }
java
@Override public SAMFileHeader makeSAMFileHeader(ReadGroupSet readGroupSet, List<Reference> references) { return ReadUtils.makeSAMFileHeader(readGroupSet, references); }
[ "@", "Override", "public", "SAMFileHeader", "makeSAMFileHeader", "(", "ReadGroupSet", "readGroupSet", ",", "List", "<", "Reference", ">", "references", ")", "{", "return", "ReadUtils", ".", "makeSAMFileHeader", "(", "readGroupSet", ",", "references", ")", ";", "}"...
Generates a SAMFileHeader from a ReadGroupSet and Reference metadata
[ "Generates", "a", "SAMFileHeader", "from", "a", "ReadGroupSet", "and", "Reference", "metadata" ]
5521664e8d6274b113962659f2737c27cc361065
https://github.com/googlegenomics/gatk-tools-java/blob/5521664e8d6274b113962659f2737c27cc361065/src/main/java/com/google/cloud/genomics/gatk/common/rest/GenomicsConverter.java#L49-L53
train
khmarbaise/sapm
src/main/java/com/soebes/subversion/sapm/Users.java
Users.hasUser
public boolean hasUser(String userName) { boolean result = false; for (User item : getUsersList()) { if (item.getName().equals(userName)) { result = true; } } return result; }
java
public boolean hasUser(String userName) { boolean result = false; for (User item : getUsersList()) { if (item.getName().equals(userName)) { result = true; } } return result; }
[ "public", "boolean", "hasUser", "(", "String", "userName", ")", "{", "boolean", "result", "=", "false", ";", "for", "(", "User", "item", ":", "getUsersList", "(", ")", ")", "{", "if", "(", "item", ".", "getName", "(", ")", ".", "equals", "(", "userNa...
Check to see if a given user name is within the list of users. Checking will be done case sensitive. @param userName The name of the user which should be checked for. @return true if the user has been found false otherwise.
[ "Check", "to", "see", "if", "a", "given", "user", "name", "is", "within", "the", "list", "of", "users", ".", "Checking", "will", "be", "done", "case", "sensitive", "." ]
b5da5b0d8929324f03cb3a4233a3534813f93eea
https://github.com/khmarbaise/sapm/blob/b5da5b0d8929324f03cb3a4233a3534813f93eea/src/main/java/com/soebes/subversion/sapm/Users.java#L64-L72
train
khmarbaise/sapm
src/main/java/com/soebes/subversion/sapm/Users.java
Users.getUser
public User getUser(String userName) { User result = null; for (User item : getUsersList()) { if (item.getName().equals(userName)) { result = item; } } return result; }
java
public User getUser(String userName) { User result = null; for (User item : getUsersList()) { if (item.getName().equals(userName)) { result = item; } } return result; }
[ "public", "User", "getUser", "(", "String", "userName", ")", "{", "User", "result", "=", "null", ";", "for", "(", "User", "item", ":", "getUsersList", "(", ")", ")", "{", "if", "(", "item", ".", "getName", "(", ")", ".", "equals", "(", "userName", ...
Get the particular User instance if the user can be found. Null otherwise. @param userName The name for which we search in the list of users. @return The instance of the particular user or null otherwise.
[ "Get", "the", "particular", "User", "instance", "if", "the", "user", "can", "be", "found", ".", "Null", "otherwise", "." ]
b5da5b0d8929324f03cb3a4233a3534813f93eea
https://github.com/khmarbaise/sapm/blob/b5da5b0d8929324f03cb3a4233a3534813f93eea/src/main/java/com/soebes/subversion/sapm/Users.java#L82-L90
train
phax/ph-web
ph-http/src/main/java/com/helger/http/csp/CSP2SourceList.java
CSP2SourceList.addScheme
@Nonnull public CSP2SourceList addScheme (@Nonnull @Nonempty final String sScheme) { ValueEnforcer.notEmpty (sScheme, "Scheme"); ValueEnforcer.isTrue (sScheme.length () > 1 && sScheme.endsWith (":"), () -> "Passed scheme '" + sScheme + "' is invalid!"); m_aList.add (sScheme); return this; }
java
@Nonnull public CSP2SourceList addScheme (@Nonnull @Nonempty final String sScheme) { ValueEnforcer.notEmpty (sScheme, "Scheme"); ValueEnforcer.isTrue (sScheme.length () > 1 && sScheme.endsWith (":"), () -> "Passed scheme '" + sScheme + "' is invalid!"); m_aList.add (sScheme); return this; }
[ "@", "Nonnull", "public", "CSP2SourceList", "addScheme", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sScheme", ")", "{", "ValueEnforcer", ".", "notEmpty", "(", "sScheme", ",", "\"Scheme\"", ")", ";", "ValueEnforcer", ".", "isTrue", "(", "sScheme"...
Add a scheme @param sScheme Scheme in the format <code>scheme ":"</code> @return this
[ "Add", "a", "scheme" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-http/src/main/java/com/helger/http/csp/CSP2SourceList.java#L73-L81
train
phax/ph-web
ph-httpclient/src/main/java/com/helger/httpclient/HttpClientFactory.java
HttpClientFactory.setProxy
public final void setProxy (@Nullable final HttpHost aProxy, @Nullable final Credentials aProxyCredentials) { m_aProxy = aProxy; m_aProxyCredentials = aProxyCredentials; }
java
public final void setProxy (@Nullable final HttpHost aProxy, @Nullable final Credentials aProxyCredentials) { m_aProxy = aProxy; m_aProxyCredentials = aProxyCredentials; }
[ "public", "final", "void", "setProxy", "(", "@", "Nullable", "final", "HttpHost", "aProxy", ",", "@", "Nullable", "final", "Credentials", "aProxyCredentials", ")", "{", "m_aProxy", "=", "aProxy", ";", "m_aProxyCredentials", "=", "aProxyCredentials", ";", "}" ]
Set proxy host and proxy credentials. @param aProxy The proxy host to be used. May be <code>null</code>. @param aProxyCredentials The proxy server credentials to be used. May be <code>null</code>. They are only used if a proxy host is present! Usually they are of type {@link org.apache.http.auth.UsernamePasswordCredentials}. @since 8.8.0 @see #setProxy(HttpHost)
[ "Set", "proxy", "host", "and", "proxy", "credentials", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-httpclient/src/main/java/com/helger/httpclient/HttpClientFactory.java#L350-L354
train
phax/ph-web
ph-httpclient/src/main/java/com/helger/httpclient/HttpClientFactory.java
HttpClientFactory.setRetries
@Nonnull public final HttpClientFactory setRetries (@Nonnegative final int nRetries) { ValueEnforcer.isGE0 (nRetries, "Retries"); m_nRetries = nRetries; return this; }
java
@Nonnull public final HttpClientFactory setRetries (@Nonnegative final int nRetries) { ValueEnforcer.isGE0 (nRetries, "Retries"); m_nRetries = nRetries; return this; }
[ "@", "Nonnull", "public", "final", "HttpClientFactory", "setRetries", "(", "@", "Nonnegative", "final", "int", "nRetries", ")", "{", "ValueEnforcer", ".", "isGE0", "(", "nRetries", ",", "\"Retries\"", ")", ";", "m_nRetries", "=", "nRetries", ";", "return", "th...
Set the number of internal retries. @param nRetries Retries to use. Must be &ge; 0. @return this for chaining @since 9.0.0
[ "Set", "the", "number", "of", "internal", "retries", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-httpclient/src/main/java/com/helger/httpclient/HttpClientFactory.java#L410-L416
train
phax/ph-web
ph-httpclient/src/main/java/com/helger/httpclient/HttpClientFactory.java
HttpClientFactory.setRetryMode
@Nonnull public final HttpClientFactory setRetryMode (@Nonnull final ERetryMode eRetryMode) { ValueEnforcer.notNull (eRetryMode, "RetryMode"); m_eRetryMode = eRetryMode; return this; }
java
@Nonnull public final HttpClientFactory setRetryMode (@Nonnull final ERetryMode eRetryMode) { ValueEnforcer.notNull (eRetryMode, "RetryMode"); m_eRetryMode = eRetryMode; return this; }
[ "@", "Nonnull", "public", "final", "HttpClientFactory", "setRetryMode", "(", "@", "Nonnull", "final", "ERetryMode", "eRetryMode", ")", "{", "ValueEnforcer", ".", "notNull", "(", "eRetryMode", ",", "\"RetryMode\"", ")", ";", "m_eRetryMode", "=", "eRetryMode", ";", ...
Set the retry mode to use. @param eRetryMode Retry mode to use. Must not be <code>null</code>. @return this for chaining @since 9.0.0
[ "Set", "the", "retry", "mode", "to", "use", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-httpclient/src/main/java/com/helger/httpclient/HttpClientFactory.java#L437-L443
train
phax/ph-web
ph-network/src/main/java/com/helger/network/dns/DNSResolver.java
DNSResolver.dnsResolve
@Nullable public static String dnsResolve (@Nonnull final String sHostName) { final InetAddress aAddress = resolveByName (sHostName); if (aAddress == null) return null; return new IPV4Addr (aAddress.getAddress ()).getAsString (); }
java
@Nullable public static String dnsResolve (@Nonnull final String sHostName) { final InetAddress aAddress = resolveByName (sHostName); if (aAddress == null) return null; return new IPV4Addr (aAddress.getAddress ()).getAsString (); }
[ "@", "Nullable", "public", "static", "String", "dnsResolve", "(", "@", "Nonnull", "final", "String", "sHostName", ")", "{", "final", "InetAddress", "aAddress", "=", "resolveByName", "(", "sHostName", ")", ";", "if", "(", "aAddress", "==", "null", ")", "retur...
JavaScript callback function! Do not rename! @param sHostName The host name. @return The resolved IP address as String or <code>null</code> if the host name could not be resolved.
[ "JavaScript", "callback", "function!", "Do", "not", "rename!" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-network/src/main/java/com/helger/network/dns/DNSResolver.java#L69-L76
train
phax/ph-web
ph-xservlet/src/main/java/com/helger/xservlet/AbstractXFilter.java
AbstractXFilter.onFilterBefore
@Nonnull @OverrideOnDemand public EContinue onFilterBefore (@Nonnull final HttpServletRequest aHttpRequest, @Nonnull final HttpServletResponse aHttpResponse, @Nonnull final IRequestWebScope aRequestScope) throws IOException, ServletException { // By default continue return EContinue.CONTINUE; }
java
@Nonnull @OverrideOnDemand public EContinue onFilterBefore (@Nonnull final HttpServletRequest aHttpRequest, @Nonnull final HttpServletResponse aHttpResponse, @Nonnull final IRequestWebScope aRequestScope) throws IOException, ServletException { // By default continue return EContinue.CONTINUE; }
[ "@", "Nonnull", "@", "OverrideOnDemand", "public", "EContinue", "onFilterBefore", "(", "@", "Nonnull", "final", "HttpServletRequest", "aHttpRequest", ",", "@", "Nonnull", "final", "HttpServletResponse", "aHttpResponse", ",", "@", "Nonnull", "final", "IRequestWebScope", ...
Invoked before the rest of the request is processed. @param aHttpRequest The HTTP request. Never <code>null</code>. @param aHttpResponse The HTTP response. Never <code>null</code>. @param aRequestScope Current request scope. Never <code>null</code>. @return {@link EContinue#CONTINUE} to continue processing the request, {@link EContinue#BREAK} otherwise. @throws IOException In case of IO error @throws ServletException In case of business level error
[ "Invoked", "before", "the", "rest", "of", "the", "request", "is", "processed", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-xservlet/src/main/java/com/helger/xservlet/AbstractXFilter.java#L132-L140
train
phax/ph-web
ph-http/src/main/java/com/helger/http/AcceptMimeTypeList.java
AcceptMimeTypeList.supportsMimeType
public boolean supportsMimeType (@Nullable final IMimeType aMimeType) { if (aMimeType == null) return false; return getQValueOfMimeType (aMimeType).isAboveMinimumQuality (); }
java
public boolean supportsMimeType (@Nullable final IMimeType aMimeType) { if (aMimeType == null) return false; return getQValueOfMimeType (aMimeType).isAboveMinimumQuality (); }
[ "public", "boolean", "supportsMimeType", "(", "@", "Nullable", "final", "IMimeType", "aMimeType", ")", "{", "if", "(", "aMimeType", "==", "null", ")", "return", "false", ";", "return", "getQValueOfMimeType", "(", "aMimeType", ")", ".", "isAboveMinimumQuality", "...
Check if the passed MIME type is supported, incl. fallback handling @param aMimeType The MIME type to check. May be <code>null</code>. @return <code>true</code> if it is supported, <code>false</code> if not
[ "Check", "if", "the", "passed", "MIME", "type", "is", "supported", "incl", ".", "fallback", "handling" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-http/src/main/java/com/helger/http/AcceptMimeTypeList.java#L131-L136
train
googlegenomics/gatk-tools-java
src/main/java/com/google/cloud/genomics/gatk/common/GenomicsDataSourceFactory.java
GenomicsDataSourceFactory.configure
public void configure(String rootUrl, Settings settings) { Data<Read, ReadGroupSet, Reference> data = dataSources.get(rootUrl); if (data == null) { data = new Data<Read, ReadGroupSet, Reference>(settings, null); dataSources.put(rootUrl, data); } else { data.settings = settings; } }
java
public void configure(String rootUrl, Settings settings) { Data<Read, ReadGroupSet, Reference> data = dataSources.get(rootUrl); if (data == null) { data = new Data<Read, ReadGroupSet, Reference>(settings, null); dataSources.put(rootUrl, data); } else { data.settings = settings; } }
[ "public", "void", "configure", "(", "String", "rootUrl", ",", "Settings", "settings", ")", "{", "Data", "<", "Read", ",", "ReadGroupSet", ",", "Reference", ">", "data", "=", "dataSources", ".", "get", "(", "rootUrl", ")", ";", "if", "(", "data", "==", ...
Sets the settings for a given root url, that will be used for creating the data source. Has no effect if the data source has already been created.
[ "Sets", "the", "settings", "for", "a", "given", "root", "url", "that", "will", "be", "used", "for", "creating", "the", "data", "source", ".", "Has", "no", "effect", "if", "the", "data", "source", "has", "already", "been", "created", "." ]
5521664e8d6274b113962659f2737c27cc361065
https://github.com/googlegenomics/gatk-tools-java/blob/5521664e8d6274b113962659f2737c27cc361065/src/main/java/com/google/cloud/genomics/gatk/common/GenomicsDataSourceFactory.java#L66-L74
train
googlegenomics/gatk-tools-java
src/main/java/com/google/cloud/genomics/gatk/common/GenomicsDataSourceFactory.java
GenomicsDataSourceFactory.get
public GenomicsDataSource<Read, ReadGroupSet, Reference> get(String rootUrl) { Data<Read, ReadGroupSet, Reference> data = dataSources.get(rootUrl); if (data == null) { data = new Data<Read, ReadGroupSet, Reference>(new Settings(), null); dataSources.put(rootUrl, data); } if (data.dataSource == null) { data.dataSource = makeDataSource(rootUrl, data.settings); } return data.dataSource; }
java
public GenomicsDataSource<Read, ReadGroupSet, Reference> get(String rootUrl) { Data<Read, ReadGroupSet, Reference> data = dataSources.get(rootUrl); if (data == null) { data = new Data<Read, ReadGroupSet, Reference>(new Settings(), null); dataSources.put(rootUrl, data); } if (data.dataSource == null) { data.dataSource = makeDataSource(rootUrl, data.settings); } return data.dataSource; }
[ "public", "GenomicsDataSource", "<", "Read", ",", "ReadGroupSet", ",", "Reference", ">", "get", "(", "String", "rootUrl", ")", "{", "Data", "<", "Read", ",", "ReadGroupSet", ",", "Reference", ">", "data", "=", "dataSources", ".", "get", "(", "rootUrl", ")"...
Lazily creates and returns the data source for a given root url.
[ "Lazily", "creates", "and", "returns", "the", "data", "source", "for", "a", "given", "root", "url", "." ]
5521664e8d6274b113962659f2737c27cc361065
https://github.com/googlegenomics/gatk-tools-java/blob/5521664e8d6274b113962659f2737c27cc361065/src/main/java/com/google/cloud/genomics/gatk/common/GenomicsDataSourceFactory.java#L79-L89
train
phax/ph-web
ph-smtp/src/main/java/com/helger/smtp/settings/SMTPSettings.java
SMTPSettings.setConnectionTimeoutMilliSecs
@Nonnull public EChange setConnectionTimeoutMilliSecs (final long nMilliSecs) { if (m_nConnectionTimeoutMilliSecs == nMilliSecs) return EChange.UNCHANGED; m_nConnectionTimeoutMilliSecs = nMilliSecs; return EChange.CHANGED; }
java
@Nonnull public EChange setConnectionTimeoutMilliSecs (final long nMilliSecs) { if (m_nConnectionTimeoutMilliSecs == nMilliSecs) return EChange.UNCHANGED; m_nConnectionTimeoutMilliSecs = nMilliSecs; return EChange.CHANGED; }
[ "@", "Nonnull", "public", "EChange", "setConnectionTimeoutMilliSecs", "(", "final", "long", "nMilliSecs", ")", "{", "if", "(", "m_nConnectionTimeoutMilliSecs", "==", "nMilliSecs", ")", "return", "EChange", ".", "UNCHANGED", ";", "m_nConnectionTimeoutMilliSecs", "=", "...
Set the connection timeout in milliseconds. Values &le; 0 are interpreted as indefinite timeout which is not recommended! @param nMilliSecs The milliseconds timeout @return {@link EChange}
[ "Set", "the", "connection", "timeout", "in", "milliseconds", ".", "Values", "&le", ";", "0", "are", "interpreted", "as", "indefinite", "timeout", "which", "is", "not", "recommended!" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-smtp/src/main/java/com/helger/smtp/settings/SMTPSettings.java#L327-L334
train
phax/ph-web
ph-smtp/src/main/java/com/helger/smtp/settings/SMTPSettings.java
SMTPSettings.setTimeoutMilliSecs
@Nonnull public EChange setTimeoutMilliSecs (final long nMilliSecs) { if (m_nTimeoutMilliSecs == nMilliSecs) return EChange.UNCHANGED; m_nTimeoutMilliSecs = nMilliSecs; return EChange.CHANGED; }
java
@Nonnull public EChange setTimeoutMilliSecs (final long nMilliSecs) { if (m_nTimeoutMilliSecs == nMilliSecs) return EChange.UNCHANGED; m_nTimeoutMilliSecs = nMilliSecs; return EChange.CHANGED; }
[ "@", "Nonnull", "public", "EChange", "setTimeoutMilliSecs", "(", "final", "long", "nMilliSecs", ")", "{", "if", "(", "m_nTimeoutMilliSecs", "==", "nMilliSecs", ")", "return", "EChange", ".", "UNCHANGED", ";", "m_nTimeoutMilliSecs", "=", "nMilliSecs", ";", "return"...
Set the socket timeout in milliseconds. Values &le; 0 are interpreted as indefinite timeout which is not recommended! @param nMilliSecs The milliseconds timeout @return {@link EChange}
[ "Set", "the", "socket", "timeout", "in", "milliseconds", ".", "Values", "&le", ";", "0", "are", "interpreted", "as", "indefinite", "timeout", "which", "is", "not", "recommended!" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-smtp/src/main/java/com/helger/smtp/settings/SMTPSettings.java#L349-L356
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/ResponseHelper.java
ResponseHelper.getResponseHeaderMap
@Nonnull @ReturnsMutableCopy public static HttpHeaderMap getResponseHeaderMap (@Nonnull final HttpServletResponse aHttpResponse) { ValueEnforcer.notNull (aHttpResponse, "HttpResponse"); final HttpHeaderMap ret = new HttpHeaderMap (); for (final String sName : aHttpResponse.getHeaderNames ()) for (final String sValue : aHttpResponse.getHeaders (sName)) ret.addHeader (sName, sValue); return ret; }
java
@Nonnull @ReturnsMutableCopy public static HttpHeaderMap getResponseHeaderMap (@Nonnull final HttpServletResponse aHttpResponse) { ValueEnforcer.notNull (aHttpResponse, "HttpResponse"); final HttpHeaderMap ret = new HttpHeaderMap (); for (final String sName : aHttpResponse.getHeaderNames ()) for (final String sValue : aHttpResponse.getHeaders (sName)) ret.addHeader (sName, sValue); return ret; }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "static", "HttpHeaderMap", "getResponseHeaderMap", "(", "@", "Nonnull", "final", "HttpServletResponse", "aHttpResponse", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aHttpResponse", ",", "\"HttpResponse\"", ")", ...
Get a complete response header map as a copy. @param aHttpResponse The source HTTP response. May not be <code>null</code>. @return Never <code>null</code>. @since 8.7.3
[ "Get", "a", "complete", "response", "header", "map", "as", "a", "copy", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/ResponseHelper.java#L201-L212
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java
UnifiedResponse.setContentAndCharset
@Nonnull public final UnifiedResponse setContentAndCharset (@Nonnull final String sContent, @Nonnull final Charset aCharset) { ValueEnforcer.notNull (sContent, "Content"); setCharset (aCharset); setContent (sContent.getBytes (aCharset)); return this; }
java
@Nonnull public final UnifiedResponse setContentAndCharset (@Nonnull final String sContent, @Nonnull final Charset aCharset) { ValueEnforcer.notNull (sContent, "Content"); setCharset (aCharset); setContent (sContent.getBytes (aCharset)); return this; }
[ "@", "Nonnull", "public", "final", "UnifiedResponse", "setContentAndCharset", "(", "@", "Nonnull", "final", "String", "sContent", ",", "@", "Nonnull", "final", "Charset", "aCharset", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sContent", ",", "\"Content\"", ...
Utility method to set content and charset at once. @param sContent The response content string. May not be <code>null</code>. @param aCharset The charset to use. May not be <code>null</code>. @return this
[ "Utility", "method", "to", "set", "content", "and", "charset", "at", "once", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java#L415-L422
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java
UnifiedResponse.setContent
@Nonnull public final UnifiedResponse setContent (@Nonnull final IHasInputStream aISP) { ValueEnforcer.notNull (aISP, "InputStreamProvider"); if (hasContent ()) logInfo ("Overwriting content with content provider!"); m_aContentArray = null; m_nContentArrayOfs = -1; m_nContentArrayLength = -1; m_aContentISP = aISP; return this; }
java
@Nonnull public final UnifiedResponse setContent (@Nonnull final IHasInputStream aISP) { ValueEnforcer.notNull (aISP, "InputStreamProvider"); if (hasContent ()) logInfo ("Overwriting content with content provider!"); m_aContentArray = null; m_nContentArrayOfs = -1; m_nContentArrayLength = -1; m_aContentISP = aISP; return this; }
[ "@", "Nonnull", "public", "final", "UnifiedResponse", "setContent", "(", "@", "Nonnull", "final", "IHasInputStream", "aISP", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aISP", ",", "\"InputStreamProvider\"", ")", ";", "if", "(", "hasContent", "(", ")", ")...
Set the response content provider. @param aISP The content provider to be used. May not be <code>null</code>. @return this
[ "Set", "the", "response", "content", "provider", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java#L477-L488
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java
UnifiedResponse.setContentDispositionFilename
@Nonnull public final UnifiedResponse setContentDispositionFilename (@Nonnull @Nonempty final String sFilename) { ValueEnforcer.notEmpty (sFilename, "Filename"); // Ensure that a valid filename is used // -> Strip all paths and replace all invalid characters final String sFilenameToUse = FilenameHelper.getWithoutPath (FilenameHelper.getAsSecureValidFilename (sFilename)); if (!sFilename.equals (sFilenameToUse)) logWarn ("Content-Dispostion filename was internally modified from '" + sFilename + "' to '" + sFilenameToUse + "'"); // Disabled because of the extended UTF-8 handling (RFC 5987) if (false) { // Check if encoding as ISO-8859-1 is possible if (m_aContentDispositionEncoder == null) m_aContentDispositionEncoder = StandardCharsets.ISO_8859_1.newEncoder (); if (!m_aContentDispositionEncoder.canEncode (sFilenameToUse)) logError ("Content-Dispostion filename '" + sFilenameToUse + "' cannot be encoded to ISO-8859-1!"); } // Are we overwriting? if (m_sContentDispositionFilename != null) logInfo ("Overwriting Content-Dispostion filename from '" + m_sContentDispositionFilename + "' to '" + sFilenameToUse + "'"); // No URL encoding necessary. // Filename must be in ISO-8859-1 // See http://greenbytes.de/tech/tc2231/ m_sContentDispositionFilename = sFilenameToUse; return this; }
java
@Nonnull public final UnifiedResponse setContentDispositionFilename (@Nonnull @Nonempty final String sFilename) { ValueEnforcer.notEmpty (sFilename, "Filename"); // Ensure that a valid filename is used // -> Strip all paths and replace all invalid characters final String sFilenameToUse = FilenameHelper.getWithoutPath (FilenameHelper.getAsSecureValidFilename (sFilename)); if (!sFilename.equals (sFilenameToUse)) logWarn ("Content-Dispostion filename was internally modified from '" + sFilename + "' to '" + sFilenameToUse + "'"); // Disabled because of the extended UTF-8 handling (RFC 5987) if (false) { // Check if encoding as ISO-8859-1 is possible if (m_aContentDispositionEncoder == null) m_aContentDispositionEncoder = StandardCharsets.ISO_8859_1.newEncoder (); if (!m_aContentDispositionEncoder.canEncode (sFilenameToUse)) logError ("Content-Dispostion filename '" + sFilenameToUse + "' cannot be encoded to ISO-8859-1!"); } // Are we overwriting? if (m_sContentDispositionFilename != null) logInfo ("Overwriting Content-Dispostion filename from '" + m_sContentDispositionFilename + "' to '" + sFilenameToUse + "'"); // No URL encoding necessary. // Filename must be in ISO-8859-1 // See http://greenbytes.de/tech/tc2231/ m_sContentDispositionFilename = sFilenameToUse; return this; }
[ "@", "Nonnull", "public", "final", "UnifiedResponse", "setContentDispositionFilename", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sFilename", ")", "{", "ValueEnforcer", ".", "notEmpty", "(", "sFilename", ",", "\"Filename\"", ")", ";", "// Ensure that ...
Set the content disposition filename for attachment download. @param sFilename The filename for attachment download to use. May neither be <code>null</code> nor empty. @return this @see #removeContentDispositionFilename()
[ "Set", "the", "content", "disposition", "filename", "for", "attachment", "download", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java#L623-L661
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java
UnifiedResponse.removeCaching
@Nonnull public final UnifiedResponse removeCaching () { // Remove any eventually set headers removeExpires (); removeCacheControl (); removeETag (); removeLastModified (); m_aResponseHeaderMap.removeHeaders (CHttpHeader.PRAGMA); return this; }
java
@Nonnull public final UnifiedResponse removeCaching () { // Remove any eventually set headers removeExpires (); removeCacheControl (); removeETag (); removeLastModified (); m_aResponseHeaderMap.removeHeaders (CHttpHeader.PRAGMA); return this; }
[ "@", "Nonnull", "public", "final", "UnifiedResponse", "removeCaching", "(", ")", "{", "// Remove any eventually set headers", "removeExpires", "(", ")", ";", "removeCacheControl", "(", ")", ";", "removeETag", "(", ")", ";", "removeLastModified", "(", ")", ";", "m_...
Remove all settings and headers relevant to caching. @return this for chaining
[ "Remove", "all", "settings", "and", "headers", "relevant", "to", "caching", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java#L746-L756
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java
UnifiedResponse.disableCaching
@Nonnull public final UnifiedResponse disableCaching () { // Remove any eventually set headers removeCaching (); if (m_eHttpVersion.is10 ()) { // Set to expire far in the past for HTTP/1.0. m_aResponseHeaderMap.setHeader (CHttpHeader.EXPIRES, ResponseHelperSettings.EXPIRES_NEVER_STRING); // Set standard HTTP/1.0 no-cache header. m_aResponseHeaderMap.setHeader (CHttpHeader.PRAGMA, "no-cache"); } else { final CacheControlBuilder aCacheControlBuilder = new CacheControlBuilder ().setNoStore (true) .setNoCache (true) .setMustRevalidate (true) .setProxyRevalidate (true); // Set IE extended HTTP/1.1 no-cache headers. // http://aspnetresources.com/blog/cache_control_extensions // Disabled because: // http://blogs.msdn.com/b/ieinternals/archive/2009/07/20/using-post_2d00_check-and-pre_2d00_check-cache-directives.aspx if (false) aCacheControlBuilder.addExtension ("post-check=0").addExtension ("pre-check=0"); setCacheControl (aCacheControlBuilder); } return this; }
java
@Nonnull public final UnifiedResponse disableCaching () { // Remove any eventually set headers removeCaching (); if (m_eHttpVersion.is10 ()) { // Set to expire far in the past for HTTP/1.0. m_aResponseHeaderMap.setHeader (CHttpHeader.EXPIRES, ResponseHelperSettings.EXPIRES_NEVER_STRING); // Set standard HTTP/1.0 no-cache header. m_aResponseHeaderMap.setHeader (CHttpHeader.PRAGMA, "no-cache"); } else { final CacheControlBuilder aCacheControlBuilder = new CacheControlBuilder ().setNoStore (true) .setNoCache (true) .setMustRevalidate (true) .setProxyRevalidate (true); // Set IE extended HTTP/1.1 no-cache headers. // http://aspnetresources.com/blog/cache_control_extensions // Disabled because: // http://blogs.msdn.com/b/ieinternals/archive/2009/07/20/using-post_2d00_check-and-pre_2d00_check-cache-directives.aspx if (false) aCacheControlBuilder.addExtension ("post-check=0").addExtension ("pre-check=0"); setCacheControl (aCacheControlBuilder); } return this; }
[ "@", "Nonnull", "public", "final", "UnifiedResponse", "disableCaching", "(", ")", "{", "// Remove any eventually set headers", "removeCaching", "(", ")", ";", "if", "(", "m_eHttpVersion", ".", "is10", "(", ")", ")", "{", "// Set to expire far in the past for HTTP/1.0.",...
A utility method that disables caching for this response. @return this
[ "A", "utility", "method", "that", "disables", "caching", "for", "this", "response", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java#L763-L794
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java
UnifiedResponse.enableCaching
@Nonnull public final UnifiedResponse enableCaching (@Nonnegative final int nSeconds) { ValueEnforcer.isGT0 (nSeconds, "Seconds"); // Remove any eventually set headers // Note: don't remove Last-Modified and ETag! removeExpires (); removeCacheControl (); m_aResponseHeaderMap.removeHeaders (CHttpHeader.PRAGMA); if (m_eHttpVersion.is10 ()) { m_aResponseHeaderMap.setDateHeader (CHttpHeader.EXPIRES, PDTFactory.getCurrentLocalDateTime ().plusSeconds (nSeconds)); } else { final CacheControlBuilder aCacheControlBuilder = new CacheControlBuilder ().setPublic (true) .setMaxAgeSeconds (nSeconds); setCacheControl (aCacheControlBuilder); } return this; }
java
@Nonnull public final UnifiedResponse enableCaching (@Nonnegative final int nSeconds) { ValueEnforcer.isGT0 (nSeconds, "Seconds"); // Remove any eventually set headers // Note: don't remove Last-Modified and ETag! removeExpires (); removeCacheControl (); m_aResponseHeaderMap.removeHeaders (CHttpHeader.PRAGMA); if (m_eHttpVersion.is10 ()) { m_aResponseHeaderMap.setDateHeader (CHttpHeader.EXPIRES, PDTFactory.getCurrentLocalDateTime ().plusSeconds (nSeconds)); } else { final CacheControlBuilder aCacheControlBuilder = new CacheControlBuilder ().setPublic (true) .setMaxAgeSeconds (nSeconds); setCacheControl (aCacheControlBuilder); } return this; }
[ "@", "Nonnull", "public", "final", "UnifiedResponse", "enableCaching", "(", "@", "Nonnegative", "final", "int", "nSeconds", ")", "{", "ValueEnforcer", ".", "isGT0", "(", "nSeconds", ",", "\"Seconds\"", ")", ";", "// Remove any eventually set headers", "// Note: don't ...
Enable caching of this resource for the specified number of seconds. @param nSeconds The number of seconds caching is allowed. Must be &gt; 0. @return this
[ "Enable", "caching", "of", "this", "resource", "for", "the", "specified", "number", "of", "seconds", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java#L803-L826
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java
UnifiedResponse.setStatusUnauthorized
@Nonnull public final UnifiedResponse setStatusUnauthorized (@Nullable final String sAuthenticate) { _setStatus (HttpServletResponse.SC_UNAUTHORIZED); if (StringHelper.hasText (sAuthenticate)) m_aResponseHeaderMap.setHeader (CHttpHeader.WWW_AUTHENTICATE, sAuthenticate); return this; }
java
@Nonnull public final UnifiedResponse setStatusUnauthorized (@Nullable final String sAuthenticate) { _setStatus (HttpServletResponse.SC_UNAUTHORIZED); if (StringHelper.hasText (sAuthenticate)) m_aResponseHeaderMap.setHeader (CHttpHeader.WWW_AUTHENTICATE, sAuthenticate); return this; }
[ "@", "Nonnull", "public", "final", "UnifiedResponse", "setStatusUnauthorized", "(", "@", "Nullable", "final", "String", "sAuthenticate", ")", "{", "_setStatus", "(", "HttpServletResponse", ".", "SC_UNAUTHORIZED", ")", ";", "if", "(", "StringHelper", ".", "hasText", ...
Special handling for returning status code 401 UNAUTHORIZED. @param sAuthenticate The string to be used for the {@link CHttpHeader#WWW_AUTHENTICATE} response header. May be <code>null</code> or empty. @return this
[ "Special", "handling", "for", "returning", "status", "code", "401", "UNAUTHORIZED", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java#L876-L883
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java
UnifiedResponse.setCustomResponseHeaders
public final void setCustomResponseHeaders (@Nullable final HttpHeaderMap aOther) { m_aResponseHeaderMap.removeAll (); if (aOther != null) m_aResponseHeaderMap.setAllHeaders (aOther); }
java
public final void setCustomResponseHeaders (@Nullable final HttpHeaderMap aOther) { m_aResponseHeaderMap.removeAll (); if (aOther != null) m_aResponseHeaderMap.setAllHeaders (aOther); }
[ "public", "final", "void", "setCustomResponseHeaders", "(", "@", "Nullable", "final", "HttpHeaderMap", "aOther", ")", "{", "m_aResponseHeaderMap", ".", "removeAll", "(", ")", ";", "if", "(", "aOther", "!=", "null", ")", "m_aResponseHeaderMap", ".", "setAllHeaders"...
Set many custom headers at once. All existing headers are unconditionally removed. @param aOther The headers to be set. May be <code>null</code>.
[ "Set", "many", "custom", "headers", "at", "once", ".", "All", "existing", "headers", "are", "unconditionally", "removed", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java#L1221-L1226
train
hmsonline/json-transformer
src/main/java/com/hmsonline/json/transformer/JsonTransformerFactory.java
JsonTransformerFactory.factory
static private JsonTransformer factory(Object jsonObject) throws InvalidTransformerException { if (jsonObject instanceof JSONObject) { return factory((JSONObject)jsonObject); } else if (jsonObject instanceof JSONArray) { return factory((JSONArray)jsonObject); } else if (jsonObject instanceof String) { return factoryAction((String)jsonObject); } throw new InvalidTransformerException("Not supported transformer type: " + jsonObject); }
java
static private JsonTransformer factory(Object jsonObject) throws InvalidTransformerException { if (jsonObject instanceof JSONObject) { return factory((JSONObject)jsonObject); } else if (jsonObject instanceof JSONArray) { return factory((JSONArray)jsonObject); } else if (jsonObject instanceof String) { return factoryAction((String)jsonObject); } throw new InvalidTransformerException("Not supported transformer type: " + jsonObject); }
[ "static", "private", "JsonTransformer", "factory", "(", "Object", "jsonObject", ")", "throws", "InvalidTransformerException", "{", "if", "(", "jsonObject", "instanceof", "JSONObject", ")", "{", "return", "factory", "(", "(", "JSONObject", ")", "jsonObject", ")", "...
Convenient private method
[ "Convenient", "private", "method" ]
4c739170db8b30a166066436af71c14288c65a4e
https://github.com/hmsonline/json-transformer/blob/4c739170db8b30a166066436af71c14288c65a4e/src/main/java/com/hmsonline/json/transformer/JsonTransformerFactory.java#L49-L61
train
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/mock/MockHttpServletRequest.java
MockHttpServletRequest.invalidate
public void invalidate () { if (m_bInvalidated) throw new IllegalStateException ("Request scope already invalidated!"); m_bInvalidated = true; if (m_aServletContext != null) { final ServletRequestEvent aSRE = new ServletRequestEvent (m_aServletContext, this); for (final ServletRequestListener aListener : MockHttpListener.getAllServletRequestListeners ()) aListener.requestDestroyed (aSRE); } close (); clearAttributes (); }
java
public void invalidate () { if (m_bInvalidated) throw new IllegalStateException ("Request scope already invalidated!"); m_bInvalidated = true; if (m_aServletContext != null) { final ServletRequestEvent aSRE = new ServletRequestEvent (m_aServletContext, this); for (final ServletRequestListener aListener : MockHttpListener.getAllServletRequestListeners ()) aListener.requestDestroyed (aSRE); } close (); clearAttributes (); }
[ "public", "void", "invalidate", "(", ")", "{", "if", "(", "m_bInvalidated", ")", "throw", "new", "IllegalStateException", "(", "\"Request scope already invalidated!\"", ")", ";", "m_bInvalidated", "=", "true", ";", "if", "(", "m_aServletContext", "!=", "null", ")"...
Invalidate this request, clearing its state and invoking all HTTP event listener. @see #close() @see #clearAttributes()
[ "Invalidate", "this", "request", "clearing", "its", "state", "and", "invoking", "all", "HTTP", "event", "listener", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/mock/MockHttpServletRequest.java#L260-L275
train
phax/ph-web
ph-http/src/main/java/com/helger/http/AcceptEncodingList.java
AcceptEncodingList.getQValueOfEncoding
@Nonnull public QValue getQValueOfEncoding (@Nonnull final String sEncoding) { ValueEnforcer.notNull (sEncoding, "Encoding"); // Direct search encoding QValue aQuality = m_aMap.get (_unify (sEncoding)); if (aQuality == null) { // If not explicitly given, check for "*" aQuality = m_aMap.get (AcceptEncodingHandler.ANY_ENCODING); if (aQuality == null) { // Neither encoding nor "*" is present // -> assume minimum quality return QValue.MIN_QVALUE; } } return aQuality; }
java
@Nonnull public QValue getQValueOfEncoding (@Nonnull final String sEncoding) { ValueEnforcer.notNull (sEncoding, "Encoding"); // Direct search encoding QValue aQuality = m_aMap.get (_unify (sEncoding)); if (aQuality == null) { // If not explicitly given, check for "*" aQuality = m_aMap.get (AcceptEncodingHandler.ANY_ENCODING); if (aQuality == null) { // Neither encoding nor "*" is present // -> assume minimum quality return QValue.MIN_QVALUE; } } return aQuality; }
[ "@", "Nonnull", "public", "QValue", "getQValueOfEncoding", "(", "@", "Nonnull", "final", "String", "sEncoding", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sEncoding", ",", "\"Encoding\"", ")", ";", "// Direct search encoding", "QValue", "aQuality", "=", "m_a...
Return the associated quality of the given encoding. @param sEncoding The encoding name to query. May not be <code>null</code>. @return The matching {@link QValue} and never <code>null</code>.
[ "Return", "the", "associated", "quality", "of", "the", "given", "encoding", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-http/src/main/java/com/helger/http/AcceptEncodingList.java#L58-L77
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/Material.java
Material.bind
public void bind() { program.use(); if (textures != null) { final TIntObjectIterator<Texture> iterator = textures.iterator(); while (iterator.hasNext()) { iterator.advance(); // Bind the texture to the unit final int unit = iterator.key(); iterator.value().bind(unit); // Bind the shader sampler uniform to the unit program.bindSampler(unit); } } }
java
public void bind() { program.use(); if (textures != null) { final TIntObjectIterator<Texture> iterator = textures.iterator(); while (iterator.hasNext()) { iterator.advance(); // Bind the texture to the unit final int unit = iterator.key(); iterator.value().bind(unit); // Bind the shader sampler uniform to the unit program.bindSampler(unit); } } }
[ "public", "void", "bind", "(", ")", "{", "program", ".", "use", "(", ")", ";", "if", "(", "textures", "!=", "null", ")", "{", "final", "TIntObjectIterator", "<", "Texture", ">", "iterator", "=", "textures", ".", "iterator", "(", ")", ";", "while", "(...
Binds the material to the OpenGL context.
[ "Binds", "the", "material", "to", "the", "OpenGL", "context", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/Material.java#L63-L76
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/Material.java
Material.setProgram
public void setProgram(Program program) { if (program == null) { throw new IllegalStateException("Program cannot be null"); } program.checkCreated(); this.program = program; }
java
public void setProgram(Program program) { if (program == null) { throw new IllegalStateException("Program cannot be null"); } program.checkCreated(); this.program = program; }
[ "public", "void", "setProgram", "(", "Program", "program", ")", "{", "if", "(", "program", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Program cannot be null\"", ")", ";", "}", "program", ".", "checkCreated", "(", ")", ";", "this...
Sets the program to be used by this material to shade the models. @param program The program to use
[ "Sets", "the", "program", "to", "be", "used", "by", "this", "material", "to", "shade", "the", "models", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/Material.java#L101-L107
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/Material.java
Material.addTexture
public void addTexture(int unit, Texture texture) { if (texture == null) { throw new IllegalStateException("Texture cannot be null"); } texture.checkCreated(); if (textures == null) { textures = new TIntObjectHashMap<>(); } textures.put(unit, texture); }
java
public void addTexture(int unit, Texture texture) { if (texture == null) { throw new IllegalStateException("Texture cannot be null"); } texture.checkCreated(); if (textures == null) { textures = new TIntObjectHashMap<>(); } textures.put(unit, texture); }
[ "public", "void", "addTexture", "(", "int", "unit", ",", "Texture", "texture", ")", "{", "if", "(", "texture", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Texture cannot be null\"", ")", ";", "}", "texture", ".", "checkCreated", ...
Adds a texture to the material. If a texture is a already present in the same unit as this one, it will be replaced. @param unit The unit to add the texture to @param texture The texture to add
[ "Adds", "a", "texture", "to", "the", "material", ".", "If", "a", "texture", "is", "a", "already", "present", "in", "the", "same", "unit", "as", "this", "one", "it", "will", "be", "replaced", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/Material.java#L124-L133
train
googlegenomics/gatk-tools-java
src/main/java/com/google/cloud/genomics/gatk/common/grpc/UnmappedReads.java
UnmappedReads.maybeAddRead
@Override public boolean maybeAddRead(Read read) { if (!isUnmappedMateOfMappedRead(read)) { return false; } final String reference = read.getNextMatePosition().getReferenceName(); String key = getReadKey(read); Map<String, ArrayList<Read>> reads = unmappedReads.get(reference); if (reads == null) { reads = new HashMap<String, ArrayList<Read>>(); unmappedReads.put(reference, reads); } ArrayList<Read> mates = reads.get(key); if (mates == null) { mates = new ArrayList<Read>(); reads.put(key, mates); } if (getReadCount() < MAX_READS) { mates.add(read); readCount++; return true; } else { LOG.warning("Reached the limit of in-memory unmapped mates for injection."); } return false; }
java
@Override public boolean maybeAddRead(Read read) { if (!isUnmappedMateOfMappedRead(read)) { return false; } final String reference = read.getNextMatePosition().getReferenceName(); String key = getReadKey(read); Map<String, ArrayList<Read>> reads = unmappedReads.get(reference); if (reads == null) { reads = new HashMap<String, ArrayList<Read>>(); unmappedReads.put(reference, reads); } ArrayList<Read> mates = reads.get(key); if (mates == null) { mates = new ArrayList<Read>(); reads.put(key, mates); } if (getReadCount() < MAX_READS) { mates.add(read); readCount++; return true; } else { LOG.warning("Reached the limit of in-memory unmapped mates for injection."); } return false; }
[ "@", "Override", "public", "boolean", "maybeAddRead", "(", "Read", "read", ")", "{", "if", "(", "!", "isUnmappedMateOfMappedRead", "(", "read", ")", ")", "{", "return", "false", ";", "}", "final", "String", "reference", "=", "read", ".", "getNextMatePosition...
Checks and adds the read if we need to remember it for injection. Returns true if the read was added.
[ "Checks", "and", "adds", "the", "read", "if", "we", "need", "to", "remember", "it", "for", "injection", ".", "Returns", "true", "if", "the", "read", "was", "added", "." ]
5521664e8d6274b113962659f2737c27cc361065
https://github.com/googlegenomics/gatk-tools-java/blob/5521664e8d6274b113962659f2737c27cc361065/src/main/java/com/google/cloud/genomics/gatk/common/grpc/UnmappedReads.java#L56-L81
train
googlegenomics/gatk-tools-java
src/main/java/com/google/cloud/genomics/gatk/common/grpc/UnmappedReads.java
UnmappedReads.getUnmappedMates
@Override public ArrayList<Read> getUnmappedMates(Read read) { if (read.getNumberReads() < 2 || (read.hasNextMatePosition() && read.getNextMatePosition() != null) || !read.hasAlignment() || read.getAlignment() == null || !read.getAlignment().hasPosition() || read.getAlignment().getPosition() == null || read.getAlignment().getPosition().getReferenceName() == null || read.getAlignment().getPosition().getReferenceName().isEmpty() || read.getFragmentName() == null || read.getFragmentName().isEmpty()) { return null; } final String reference = read.getAlignment().getPosition().getReferenceName(); final String key = getReadKey(read); Map<String, ArrayList<Read>> reads = unmappedReads.get(reference); if (reads != null) { final ArrayList<Read> mates = reads.get(key); if (mates != null && mates.size() > 1) { Collections.sort(mates, matesComparator); } return mates; } return null; }
java
@Override public ArrayList<Read> getUnmappedMates(Read read) { if (read.getNumberReads() < 2 || (read.hasNextMatePosition() && read.getNextMatePosition() != null) || !read.hasAlignment() || read.getAlignment() == null || !read.getAlignment().hasPosition() || read.getAlignment().getPosition() == null || read.getAlignment().getPosition().getReferenceName() == null || read.getAlignment().getPosition().getReferenceName().isEmpty() || read.getFragmentName() == null || read.getFragmentName().isEmpty()) { return null; } final String reference = read.getAlignment().getPosition().getReferenceName(); final String key = getReadKey(read); Map<String, ArrayList<Read>> reads = unmappedReads.get(reference); if (reads != null) { final ArrayList<Read> mates = reads.get(key); if (mates != null && mates.size() > 1) { Collections.sort(mates, matesComparator); } return mates; } return null; }
[ "@", "Override", "public", "ArrayList", "<", "Read", ">", "getUnmappedMates", "(", "Read", "read", ")", "{", "if", "(", "read", ".", "getNumberReads", "(", ")", "<", "2", "||", "(", "read", ".", "hasNextMatePosition", "(", ")", "&&", "read", ".", "getN...
Checks if the passed read has unmapped mates that need to be injected and if so - returns them. The returned list is sorted by read number to handle the case of multi-read fragments.
[ "Checks", "if", "the", "passed", "read", "has", "unmapped", "mates", "that", "need", "to", "be", "injected", "and", "if", "so", "-", "returns", "them", ".", "The", "returned", "list", "is", "sorted", "by", "read", "number", "to", "handle", "the", "case",...
5521664e8d6274b113962659f2737c27cc361065
https://github.com/googlegenomics/gatk-tools-java/blob/5521664e8d6274b113962659f2737c27cc361065/src/main/java/com/google/cloud/genomics/gatk/common/grpc/UnmappedReads.java#L88-L110
train
phax/ph-web
ph-web/src/main/java/com/helger/web/scope/mgr/WebScopeManager.java
WebScopeManager.setSessionPassivationAllowed
public static void setSessionPassivationAllowed (final boolean bSessionPassivationAllowed) { s_aSessionPassivationAllowed.set (bSessionPassivationAllowed); if (LOGGER.isInfoEnabled ()) LOGGER.info ("Session passivation is now " + (bSessionPassivationAllowed ? "enabled" : "disabled")); // For passivation to work, the session scopes may not be invalidated at the // end of the global scope! final ScopeSessionManager aSSM = ScopeSessionManager.getInstance (); aSSM.setDestroyAllSessionsOnScopeEnd (!bSessionPassivationAllowed); aSSM.setEndAllSessionsOnScopeEnd (!bSessionPassivationAllowed); // Ensure that all session web scopes have the activator set or removed for (final ISessionWebScope aSessionWebScope : WebScopeSessionManager.getAllSessionWebScopes ()) { final HttpSession aHttpSession = aSessionWebScope.getSession (); if (bSessionPassivationAllowed) { // Ensure the activator is present if (aHttpSession.getAttribute (SESSION_ATTR_SESSION_SCOPE_ACTIVATOR) == null) aHttpSession.setAttribute (SESSION_ATTR_SESSION_SCOPE_ACTIVATOR, new SessionWebScopeActivator (aSessionWebScope)); } else { // Ensure the activator is not present aHttpSession.removeAttribute (SESSION_ATTR_SESSION_SCOPE_ACTIVATOR); } } }
java
public static void setSessionPassivationAllowed (final boolean bSessionPassivationAllowed) { s_aSessionPassivationAllowed.set (bSessionPassivationAllowed); if (LOGGER.isInfoEnabled ()) LOGGER.info ("Session passivation is now " + (bSessionPassivationAllowed ? "enabled" : "disabled")); // For passivation to work, the session scopes may not be invalidated at the // end of the global scope! final ScopeSessionManager aSSM = ScopeSessionManager.getInstance (); aSSM.setDestroyAllSessionsOnScopeEnd (!bSessionPassivationAllowed); aSSM.setEndAllSessionsOnScopeEnd (!bSessionPassivationAllowed); // Ensure that all session web scopes have the activator set or removed for (final ISessionWebScope aSessionWebScope : WebScopeSessionManager.getAllSessionWebScopes ()) { final HttpSession aHttpSession = aSessionWebScope.getSession (); if (bSessionPassivationAllowed) { // Ensure the activator is present if (aHttpSession.getAttribute (SESSION_ATTR_SESSION_SCOPE_ACTIVATOR) == null) aHttpSession.setAttribute (SESSION_ATTR_SESSION_SCOPE_ACTIVATOR, new SessionWebScopeActivator (aSessionWebScope)); } else { // Ensure the activator is not present aHttpSession.removeAttribute (SESSION_ATTR_SESSION_SCOPE_ACTIVATOR); } } }
[ "public", "static", "void", "setSessionPassivationAllowed", "(", "final", "boolean", "bSessionPassivationAllowed", ")", "{", "s_aSessionPassivationAllowed", ".", "set", "(", "bSessionPassivationAllowed", ")", ";", "if", "(", "LOGGER", ".", "isInfoEnabled", "(", ")", "...
Allow or disallow session passivation @param bSessionPassivationAllowed <code>true</code> to enable session passivation, <code>false</code> to disable it
[ "Allow", "or", "disallow", "session", "passivation" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/scope/mgr/WebScopeManager.java#L95-L124
train
phax/ph-web
ph-web/src/main/java/com/helger/web/scope/mgr/WebScopeManager.java
WebScopeManager.internalGetOrCreateSessionScope
@Nullable @DevelopersNote ("This is only for project-internal use!") public static ISessionWebScope internalGetOrCreateSessionScope (@Nonnull final HttpSession aHttpSession, final boolean bCreateIfNotExisting, final boolean bItsOkayToCreateANewScope) { ValueEnforcer.notNull (aHttpSession, "HttpSession"); // Do we already have a session web scope for the session? final String sSessionID = aHttpSession.getId (); ISessionScope aSessionWebScope = ScopeSessionManager.getInstance ().getSessionScopeOfID (sSessionID); if (aSessionWebScope == null && bCreateIfNotExisting) { if (!bItsOkayToCreateANewScope) { // This can e.g. happen in tests, when there are no registered // listeners for session events! if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Creating a new session web scope for ID '" + sSessionID + "' but there should already be one!" + " Check your HttpSessionListener implementation."); } // Create a new session scope aSessionWebScope = onSessionBegin (aHttpSession); } try { return (ISessionWebScope) aSessionWebScope; } catch (final ClassCastException ex) { throw new IllegalStateException ("Session scope object is not a web scope but: " + aSessionWebScope, ex); } }
java
@Nullable @DevelopersNote ("This is only for project-internal use!") public static ISessionWebScope internalGetOrCreateSessionScope (@Nonnull final HttpSession aHttpSession, final boolean bCreateIfNotExisting, final boolean bItsOkayToCreateANewScope) { ValueEnforcer.notNull (aHttpSession, "HttpSession"); // Do we already have a session web scope for the session? final String sSessionID = aHttpSession.getId (); ISessionScope aSessionWebScope = ScopeSessionManager.getInstance ().getSessionScopeOfID (sSessionID); if (aSessionWebScope == null && bCreateIfNotExisting) { if (!bItsOkayToCreateANewScope) { // This can e.g. happen in tests, when there are no registered // listeners for session events! if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Creating a new session web scope for ID '" + sSessionID + "' but there should already be one!" + " Check your HttpSessionListener implementation."); } // Create a new session scope aSessionWebScope = onSessionBegin (aHttpSession); } try { return (ISessionWebScope) aSessionWebScope; } catch (final ClassCastException ex) { throw new IllegalStateException ("Session scope object is not a web scope but: " + aSessionWebScope, ex); } }
[ "@", "Nullable", "@", "DevelopersNote", "(", "\"This is only for project-internal use!\"", ")", "public", "static", "ISessionWebScope", "internalGetOrCreateSessionScope", "(", "@", "Nonnull", "final", "HttpSession", "aHttpSession", ",", "final", "boolean", "bCreateIfNotExisti...
Internal method which does the main logic for session web scope creation @param aHttpSession The underlying HTTP session @param bCreateIfNotExisting if <code>true</code> if a new session web scope is created, if none is present @param bItsOkayToCreateANewScope if <code>true</code> no warning is emitted, if a new session scope must be created. This is e.g. used when renewing a session or when activating a previously passivated session. @return <code>null</code> if no session scope is present, and bCreateIfNotExisting is false
[ "Internal", "method", "which", "does", "the", "main", "logic", "for", "session", "web", "scope", "creation" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/scope/mgr/WebScopeManager.java#L253-L289
train
phax/ph-web
ph-web/src/main/java/com/helger/web/scope/mgr/WebScopeManager.java
WebScopeManager.internalGetSessionScope
@Nullable @DevelopersNote ("This is only for project-internal use!") public static ISessionWebScope internalGetSessionScope (final boolean bCreateIfNotExisting, final boolean bItsOkayToCreateANewSession) { // Try to to resolve the current request scope final IRequestWebScope aRequestScope = getRequestScopeOrNull (); return internalGetSessionScope (aRequestScope, bCreateIfNotExisting, bItsOkayToCreateANewSession); }
java
@Nullable @DevelopersNote ("This is only for project-internal use!") public static ISessionWebScope internalGetSessionScope (final boolean bCreateIfNotExisting, final boolean bItsOkayToCreateANewSession) { // Try to to resolve the current request scope final IRequestWebScope aRequestScope = getRequestScopeOrNull (); return internalGetSessionScope (aRequestScope, bCreateIfNotExisting, bItsOkayToCreateANewSession); }
[ "@", "Nullable", "@", "DevelopersNote", "(", "\"This is only for project-internal use!\"", ")", "public", "static", "ISessionWebScope", "internalGetSessionScope", "(", "final", "boolean", "bCreateIfNotExisting", ",", "final", "boolean", "bItsOkayToCreateANewSession", ")", "{"...
Get the session scope from the current request scope. @param bCreateIfNotExisting if <code>true</code> a new session scope (and a new HTTP session if required) is created if none is existing so far. @param bItsOkayToCreateANewSession if <code>true</code> no warning is emitted, if a new session scope must be created. This is e.g. used when renewing a session. @return <code>null</code> if no session scope is present, and none should be created.
[ "Get", "the", "session", "scope", "from", "the", "current", "request", "scope", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/scope/mgr/WebScopeManager.java#L331-L339
train
phax/ph-web
ph-web/src/main/java/com/helger/web/scope/mgr/WebScopeManager.java
WebScopeManager.internalGetSessionScope
@Nullable @DevelopersNote ("This is only for project-internal use!") public static ISessionWebScope internalGetSessionScope (@Nullable final IRequestWebScope aRequestScope, final boolean bCreateIfNotExisting, final boolean bItsOkayToCreateANewSession) { // Try to to resolve the current request scope if (aRequestScope != null) { // Check if we have an HTTP session object final HttpSession aHttpSession = aRequestScope.getSession (bCreateIfNotExisting); if (aHttpSession != null) return internalGetOrCreateSessionScope (aHttpSession, bCreateIfNotExisting, bItsOkayToCreateANewSession); } else { // If we want a session scope, we expect the return value to be non-null! if (bCreateIfNotExisting) throw new IllegalStateException ("No request scope is present, so no session scope can be retrieved!"); } return null; }
java
@Nullable @DevelopersNote ("This is only for project-internal use!") public static ISessionWebScope internalGetSessionScope (@Nullable final IRequestWebScope aRequestScope, final boolean bCreateIfNotExisting, final boolean bItsOkayToCreateANewSession) { // Try to to resolve the current request scope if (aRequestScope != null) { // Check if we have an HTTP session object final HttpSession aHttpSession = aRequestScope.getSession (bCreateIfNotExisting); if (aHttpSession != null) return internalGetOrCreateSessionScope (aHttpSession, bCreateIfNotExisting, bItsOkayToCreateANewSession); } else { // If we want a session scope, we expect the return value to be non-null! if (bCreateIfNotExisting) throw new IllegalStateException ("No request scope is present, so no session scope can be retrieved!"); } return null; }
[ "@", "Nullable", "@", "DevelopersNote", "(", "\"This is only for project-internal use!\"", ")", "public", "static", "ISessionWebScope", "internalGetSessionScope", "(", "@", "Nullable", "final", "IRequestWebScope", "aRequestScope", ",", "final", "boolean", "bCreateIfNotExistin...
Get the session scope of the provided request scope. @param aRequestScope The request scope it is about. May be <code>null</code>. @param bCreateIfNotExisting if <code>true</code> a new session scope (and a new HTTP session if required) is created if none is existing so far. @param bItsOkayToCreateANewSession if <code>true</code> no warning is emitted, if a new session scope must be created. This is e.g. used when renewing a session. @return <code>null</code> if no session scope is present, and none should be created.
[ "Get", "the", "session", "scope", "of", "the", "provided", "request", "scope", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/scope/mgr/WebScopeManager.java#L355-L376
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java
VertexData.getIndicesBuffer
public ByteBuffer getIndicesBuffer() { final ByteBuffer buffer = CausticUtil.createByteBuffer(indices.size() * DataType.INT.getByteSize()); for (int i = 0; i < indices.size(); i++) { buffer.putInt(indices.get(i)); } buffer.flip(); return buffer; }
java
public ByteBuffer getIndicesBuffer() { final ByteBuffer buffer = CausticUtil.createByteBuffer(indices.size() * DataType.INT.getByteSize()); for (int i = 0; i < indices.size(); i++) { buffer.putInt(indices.get(i)); } buffer.flip(); return buffer; }
[ "public", "ByteBuffer", "getIndicesBuffer", "(", ")", "{", "final", "ByteBuffer", "buffer", "=", "CausticUtil", ".", "createByteBuffer", "(", "indices", ".", "size", "(", ")", "*", "DataType", ".", "INT", ".", "getByteSize", "(", ")", ")", ";", "for", "(",...
Returns a byte buffer containing all the current indices. @return A buffer of the indices
[ "Returns", "a", "byte", "buffer", "containing", "all", "the", "current", "indices", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java#L77-L84
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java
VertexData.addAttribute
public void addAttribute(int index, VertexAttribute attribute) { attributes.put(index, attribute); nameToIndex.put(attribute.getName(), index); }
java
public void addAttribute(int index, VertexAttribute attribute) { attributes.put(index, attribute); nameToIndex.put(attribute.getName(), index); }
[ "public", "void", "addAttribute", "(", "int", "index", ",", "VertexAttribute", "attribute", ")", "{", "attributes", ".", "put", "(", "index", ",", "attribute", ")", ";", "nameToIndex", ".", "put", "(", "attribute", ".", "getName", "(", ")", ",", "index", ...
Adds an attribute. @param index The attribute index @param attribute The attribute to add
[ "Adds", "an", "attribute", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java#L92-L95
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java
VertexData.getAttributeSize
public int getAttributeSize(int index) { final VertexAttribute attribute = getAttribute(index); if (attribute == null) { return -1; } return attribute.getSize(); }
java
public int getAttributeSize(int index) { final VertexAttribute attribute = getAttribute(index); if (attribute == null) { return -1; } return attribute.getSize(); }
[ "public", "int", "getAttributeSize", "(", "int", "index", ")", "{", "final", "VertexAttribute", "attribute", "=", "getAttribute", "(", "index", ")", ";", "if", "(", "attribute", "==", "null", ")", "{", "return", "-", "1", ";", "}", "return", "attribute", ...
Returns the size of the attribute at the provided index, or -1 if none can be found. @param index The index to lookup @return The size of the attribute, or -1 if none can be found
[ "Returns", "the", "size", "of", "the", "attribute", "at", "the", "provided", "index", "or", "-", "1", "if", "none", "can", "be", "found", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java#L182-L188
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java
VertexData.getAttributeType
public DataType getAttributeType(int index) { final VertexAttribute attribute = getAttribute(index); if (attribute == null) { return null; } return attribute.getType(); }
java
public DataType getAttributeType(int index) { final VertexAttribute attribute = getAttribute(index); if (attribute == null) { return null; } return attribute.getType(); }
[ "public", "DataType", "getAttributeType", "(", "int", "index", ")", "{", "final", "VertexAttribute", "attribute", "=", "getAttribute", "(", "index", ")", ";", "if", "(", "attribute", "==", "null", ")", "{", "return", "null", ";", "}", "return", "attribute", ...
Returns the type of the attribute at the provided index, or null if none can be found. @param index The index to lookup @return The type of the attribute, or null if none can be found
[ "Returns", "the", "type", "of", "the", "attribute", "at", "the", "provided", "index", "or", "null", "if", "none", "can", "be", "found", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java#L206-L212
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java
VertexData.getAttributeName
public String getAttributeName(int index) { final VertexAttribute attribute = getAttribute(index); if (attribute == null) { return null; } return attribute.getName(); }
java
public String getAttributeName(int index) { final VertexAttribute attribute = getAttribute(index); if (attribute == null) { return null; } return attribute.getName(); }
[ "public", "String", "getAttributeName", "(", "int", "index", ")", "{", "final", "VertexAttribute", "attribute", "=", "getAttribute", "(", "index", ")", ";", "if", "(", "attribute", "==", "null", ")", "{", "return", "null", ";", "}", "return", "attribute", ...
Returns the name of the attribute at the provided index, or null if none can be found. @param index The index to lookup @return The name of the attribute, or null if none can be found
[ "Returns", "the", "name", "of", "the", "attribute", "at", "the", "provided", "index", "or", "null", "if", "none", "can", "be", "found", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java#L220-L226
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java
VertexData.getAttributeBuffer
public ByteBuffer getAttributeBuffer(int index) { final VertexAttribute attribute = getAttribute(index); if (attribute == null) { return null; } return attribute.getData(); }
java
public ByteBuffer getAttributeBuffer(int index) { final VertexAttribute attribute = getAttribute(index); if (attribute == null) { return null; } return attribute.getData(); }
[ "public", "ByteBuffer", "getAttributeBuffer", "(", "int", "index", ")", "{", "final", "VertexAttribute", "attribute", "=", "getAttribute", "(", "index", ")", ";", "if", "(", "attribute", "==", "null", ")", "{", "return", "null", ";", "}", "return", "attribut...
Returns the buffer for the attribute at the provided index, or null if none can be found. The buffer is returned filled and ready for reading. @param index The index to lookup @return The attribute buffer, filled and flipped
[ "Returns", "the", "buffer", "for", "the", "attribute", "at", "the", "provided", "index", "or", "null", "if", "none", "can", "be", "found", ".", "The", "buffer", "is", "returned", "filled", "and", "ready", "for", "reading", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java#L262-L268
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java
VertexData.copy
public void copy(VertexData data) { clear(); indices.addAll(data.indices); final TIntObjectIterator<VertexAttribute> iterator = data.attributes.iterator(); while (iterator.hasNext()) { iterator.advance(); attributes.put(iterator.key(), iterator.value().clone()); } nameToIndex.putAll(data.nameToIndex); }
java
public void copy(VertexData data) { clear(); indices.addAll(data.indices); final TIntObjectIterator<VertexAttribute> iterator = data.attributes.iterator(); while (iterator.hasNext()) { iterator.advance(); attributes.put(iterator.key(), iterator.value().clone()); } nameToIndex.putAll(data.nameToIndex); }
[ "public", "void", "copy", "(", "VertexData", "data", ")", "{", "clear", "(", ")", ";", "indices", ".", "addAll", "(", "data", ".", "indices", ")", ";", "final", "TIntObjectIterator", "<", "VertexAttribute", ">", "iterator", "=", "data", ".", "attributes", ...
Replaces the contents of this vertex data by the provided one. This is a deep copy. The vertex attribute are each individually cloned. @param data The data to copy.
[ "Replaces", "the", "contents", "of", "this", "vertex", "data", "by", "the", "provided", "one", ".", "This", "is", "a", "deep", "copy", ".", "The", "vertex", "attribute", "are", "each", "individually", "cloned", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/data/VertexData.java#L284-L293
train
phax/ph-web
ph-http/src/main/java/com/helger/http/AcceptLanguageList.java
AcceptLanguageList.getQValueOfLanguage
@Nonnull public QValue getQValueOfLanguage (@Nonnull final String sLanguage) { ValueEnforcer.notNull (sLanguage, "Language"); // Find language direct QValue aQuality = m_aMap.get (_unify (sLanguage)); if (aQuality == null) { // If not explicitly given, check for "*" aQuality = m_aMap.get (AcceptLanguageHandler.ANY_LANGUAGE); if (aQuality == null) { // Neither language nor "*" is present // -> assume minimum quality return QValue.MIN_QVALUE; } } return aQuality; }
java
@Nonnull public QValue getQValueOfLanguage (@Nonnull final String sLanguage) { ValueEnforcer.notNull (sLanguage, "Language"); // Find language direct QValue aQuality = m_aMap.get (_unify (sLanguage)); if (aQuality == null) { // If not explicitly given, check for "*" aQuality = m_aMap.get (AcceptLanguageHandler.ANY_LANGUAGE); if (aQuality == null) { // Neither language nor "*" is present // -> assume minimum quality return QValue.MIN_QVALUE; } } return aQuality; }
[ "@", "Nonnull", "public", "QValue", "getQValueOfLanguage", "(", "@", "Nonnull", "final", "String", "sLanguage", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sLanguage", ",", "\"Language\"", ")", ";", "// Find language direct", "QValue", "aQuality", "=", "m_aMa...
Return the associated quality of the given language. @param sLanguage The language name to query. May not be <code>null</code>. @return The associated {@link QValue}. Never <code>null</code>.
[ "Return", "the", "associated", "quality", "of", "the", "given", "language", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-http/src/main/java/com/helger/http/AcceptLanguageList.java#L55-L74
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/model/Model.java
Model.setVertexArray
public void setVertexArray(VertexArray vertexArray) { if (vertexArray == null) { throw new IllegalArgumentException("Vertex array cannot be null"); } vertexArray.checkCreated(); this.vertexArray = vertexArray; }
java
public void setVertexArray(VertexArray vertexArray) { if (vertexArray == null) { throw new IllegalArgumentException("Vertex array cannot be null"); } vertexArray.checkCreated(); this.vertexArray = vertexArray; }
[ "public", "void", "setVertexArray", "(", "VertexArray", "vertexArray", ")", "{", "if", "(", "vertexArray", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Vertex array cannot be null\"", ")", ";", "}", "vertexArray", ".", "checkCreated", ...
Sets the vertex array for this model. @param vertexArray The vertex array to use
[ "Sets", "the", "vertex", "array", "for", "this", "model", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/model/Model.java#L125-L131
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/model/Model.java
Model.getMatrix
public Matrix4f getMatrix() { if (updateMatrix) { final Matrix4f matrix = Matrix4f.createScaling(scale.toVector4(1)).rotate(rotation).translate(position); if (parent == null) { this.matrix = matrix; } else { childMatrix = matrix; } updateMatrix = false; } if (parent != null) { final Matrix4f parentMatrix = parent.getMatrix(); if (parentMatrix != lastParentMatrix) { matrix = parentMatrix.mul(childMatrix); lastParentMatrix = parentMatrix; } } return matrix; }
java
public Matrix4f getMatrix() { if (updateMatrix) { final Matrix4f matrix = Matrix4f.createScaling(scale.toVector4(1)).rotate(rotation).translate(position); if (parent == null) { this.matrix = matrix; } else { childMatrix = matrix; } updateMatrix = false; } if (parent != null) { final Matrix4f parentMatrix = parent.getMatrix(); if (parentMatrix != lastParentMatrix) { matrix = parentMatrix.mul(childMatrix); lastParentMatrix = parentMatrix; } } return matrix; }
[ "public", "Matrix4f", "getMatrix", "(", ")", "{", "if", "(", "updateMatrix", ")", "{", "final", "Matrix4f", "matrix", "=", "Matrix4f", ".", "createScaling", "(", "scale", ".", "toVector4", "(", "1", ")", ")", ".", "rotate", "(", "rotation", ")", ".", "...
Returns the transformation matrix that represent the model's current scale, rotation and position. @return The transformation matrix
[ "Returns", "the", "transformation", "matrix", "that", "represent", "the", "model", "s", "current", "scale", "rotation", "and", "position", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/model/Model.java#L159-L177
train
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/model/Model.java
Model.setParent
public void setParent(Model parent) { if (parent == this) { throw new IllegalArgumentException("The model can't be its own parent"); } if (parent == null) { this.parent.children.remove(this); } else { parent.children.add(this); } this.parent = parent; }
java
public void setParent(Model parent) { if (parent == this) { throw new IllegalArgumentException("The model can't be its own parent"); } if (parent == null) { this.parent.children.remove(this); } else { parent.children.add(this); } this.parent = parent; }
[ "public", "void", "setParent", "(", "Model", "parent", ")", "{", "if", "(", "parent", "==", "this", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The model can't be its own parent\"", ")", ";", "}", "if", "(", "parent", "==", "null", ")", "{"...
Sets the parent model. This model's position, rotation and scale will be relative to that model if not null. @param parent The parent model, or null for no parent
[ "Sets", "the", "parent", "model", ".", "This", "model", "s", "position", "rotation", "and", "scale", "will", "be", "relative", "to", "that", "model", "if", "not", "null", "." ]
88652fcf0621ce158a0e92ce4c570ed6b1f6fca9
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/model/Model.java#L277-L287
train
khmarbaise/sapm
src/main/java/com/soebes/subversion/sapm/Aliases.java
Aliases.hasAlias
public boolean hasAlias(String aliasName) { boolean result = false; for (Alias item : getAliasesList()) { if (item.getName().equals(aliasName)) { result = true; } } return result; }
java
public boolean hasAlias(String aliasName) { boolean result = false; for (Alias item : getAliasesList()) { if (item.getName().equals(aliasName)) { result = true; } } return result; }
[ "public", "boolean", "hasAlias", "(", "String", "aliasName", ")", "{", "boolean", "result", "=", "false", ";", "for", "(", "Alias", "item", ":", "getAliasesList", "(", ")", ")", "{", "if", "(", "item", ".", "getName", "(", ")", ".", "equals", "(", "a...
Check if the given alias exists in the list of aliases or not. @param aliasName The alias name which will be checked for. @return true if the alias has been found false otherwise.
[ "Check", "if", "the", "given", "alias", "exists", "in", "the", "list", "of", "aliases", "or", "not", "." ]
b5da5b0d8929324f03cb3a4233a3534813f93eea
https://github.com/khmarbaise/sapm/blob/b5da5b0d8929324f03cb3a4233a3534813f93eea/src/main/java/com/soebes/subversion/sapm/Aliases.java#L56-L65
train
phax/ph-web
ph-web/src/main/java/com/helger/web/encoding/RFC2047Helper.java
RFC2047Helper.encode
@Nullable public static String encode (@Nullable final String sValue, @Nonnull final Charset aCharset, final ECodec eCodec) { if (sValue == null) return null; try { switch (eCodec) { case Q: return new RFC1522QCodec (aCharset).getEncoded (sValue); case B: default: return new RFC1522BCodec (aCharset).getEncoded (sValue); } } catch (final Exception ex) { return sValue; } }
java
@Nullable public static String encode (@Nullable final String sValue, @Nonnull final Charset aCharset, final ECodec eCodec) { if (sValue == null) return null; try { switch (eCodec) { case Q: return new RFC1522QCodec (aCharset).getEncoded (sValue); case B: default: return new RFC1522BCodec (aCharset).getEncoded (sValue); } } catch (final Exception ex) { return sValue; } }
[ "@", "Nullable", "public", "static", "String", "encode", "(", "@", "Nullable", "final", "String", "sValue", ",", "@", "Nonnull", "final", "Charset", "aCharset", ",", "final", "ECodec", "eCodec", ")", "{", "if", "(", "sValue", "==", "null", ")", "return", ...
Used to encode a string as specified by RFC 2047 @param sValue The string to encode @param aCharset The character set to use for the encoding @param eCodec Codec type @return Encoded String
[ "Used", "to", "encode", "a", "string", "as", "specified", "by", "RFC", "2047" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/encoding/RFC2047Helper.java#L80-L101
train
phax/ph-web
ph-web/src/main/java/com/helger/web/encoding/RFC2047Helper.java
RFC2047Helper.decode
@Nullable public static String decode (@Nullable final String sValue) { if (sValue == null) return null; try { // try BCodec first return new RFC1522BCodec ().getDecoded (sValue); } catch (final DecodeException de) { // try QCodec next try { return new RFC1522QCodec ().getDecoded (sValue); } catch (final Exception ex) { return sValue; } } catch (final Exception e) { return sValue; } }
java
@Nullable public static String decode (@Nullable final String sValue) { if (sValue == null) return null; try { // try BCodec first return new RFC1522BCodec ().getDecoded (sValue); } catch (final DecodeException de) { // try QCodec next try { return new RFC1522QCodec ().getDecoded (sValue); } catch (final Exception ex) { return sValue; } } catch (final Exception e) { return sValue; } }
[ "@", "Nullable", "public", "static", "String", "decode", "(", "@", "Nullable", "final", "String", "sValue", ")", "{", "if", "(", "sValue", "==", "null", ")", "return", "null", ";", "try", "{", "// try BCodec first", "return", "new", "RFC1522BCodec", "(", "...
Used to decode a string as specified by RFC 2047 @param sValue The encoded string @return Decoded String
[ "Used", "to", "decode", "a", "string", "as", "specified", "by", "RFC", "2047" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/encoding/RFC2047Helper.java#L110-L137
train
phax/ph-web
ph-xservlet/src/main/java/com/helger/xservlet/requesttrack/RequestTracker.java
RequestTracker.addRequest
public static void addRequest (@Nonnull @Nonempty final String sRequestID, @Nonnull final IRequestWebScope aRequestScope) { getInstance ().m_aRequestTrackingMgr.addRequest (sRequestID, aRequestScope, s_aParallelRunningCallbacks); }
java
public static void addRequest (@Nonnull @Nonempty final String sRequestID, @Nonnull final IRequestWebScope aRequestScope) { getInstance ().m_aRequestTrackingMgr.addRequest (sRequestID, aRequestScope, s_aParallelRunningCallbacks); }
[ "public", "static", "void", "addRequest", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sRequestID", ",", "@", "Nonnull", "final", "IRequestWebScope", "aRequestScope", ")", "{", "getInstance", "(", ")", ".", "m_aRequestTrackingMgr", ".", "addRequest", ...
Add new request to the tracking @param sRequestID The unique request ID. @param aRequestScope The request scope itself.
[ "Add", "new", "request", "to", "the", "tracking" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-xservlet/src/main/java/com/helger/xservlet/requesttrack/RequestTracker.java#L166-L170
train
phax/ph-web
ph-xservlet/src/main/java/com/helger/xservlet/requesttrack/RequestTracker.java
RequestTracker.removeRequest
public static void removeRequest (@Nonnull @Nonempty final String sRequestID) { final RequestTracker aTracker = getGlobalSingletonIfInstantiated (RequestTracker.class); if (aTracker != null) aTracker.m_aRequestTrackingMgr.removeRequest (sRequestID, s_aParallelRunningCallbacks); }
java
public static void removeRequest (@Nonnull @Nonempty final String sRequestID) { final RequestTracker aTracker = getGlobalSingletonIfInstantiated (RequestTracker.class); if (aTracker != null) aTracker.m_aRequestTrackingMgr.removeRequest (sRequestID, s_aParallelRunningCallbacks); }
[ "public", "static", "void", "removeRequest", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sRequestID", ")", "{", "final", "RequestTracker", "aTracker", "=", "getGlobalSingletonIfInstantiated", "(", "RequestTracker", ".", "class", ")", ";", "if", "(", ...
Remove a request from the tracking. @param sRequestID The request ID.
[ "Remove", "a", "request", "from", "the", "tracking", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-xservlet/src/main/java/com/helger/xservlet/requesttrack/RequestTracker.java#L178-L183
train
phax/ph-web
ph-smtp/src/main/java/com/helger/smtp/scope/ScopedMailAPI.java
ScopedMailAPI.queueMail
@Nonnull public ESuccess queueMail (@Nonnull final ISMTPSettings aSMTPSettings, @Nonnull final IMutableEmailData aMailData) { return MailAPI.queueMail (aSMTPSettings, aMailData); }
java
@Nonnull public ESuccess queueMail (@Nonnull final ISMTPSettings aSMTPSettings, @Nonnull final IMutableEmailData aMailData) { return MailAPI.queueMail (aSMTPSettings, aMailData); }
[ "@", "Nonnull", "public", "ESuccess", "queueMail", "(", "@", "Nonnull", "final", "ISMTPSettings", "aSMTPSettings", ",", "@", "Nonnull", "final", "IMutableEmailData", "aMailData", ")", "{", "return", "MailAPI", ".", "queueMail", "(", "aSMTPSettings", ",", "aMailDat...
Unconditionally queue a mail @param aSMTPSettings The SMTP settings to use. May not be <code>null</code>. @param aMailData The data of the email to be send. May not be <code>null</code>. @return {@link ESuccess}
[ "Unconditionally", "queue", "a", "mail" ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-smtp/src/main/java/com/helger/smtp/scope/ScopedMailAPI.java#L88-L92
train
phax/ph-web
ph-smtp/src/main/java/com/helger/smtp/scope/ScopedMailAPI.java
ScopedMailAPI.queueMails
@Nonnegative public int queueMails (@Nonnull final ISMTPSettings aSMTPSettings, @Nonnull final Collection <? extends IMutableEmailData> aMailDataList) { return MailAPI.queueMails (aSMTPSettings, aMailDataList); }
java
@Nonnegative public int queueMails (@Nonnull final ISMTPSettings aSMTPSettings, @Nonnull final Collection <? extends IMutableEmailData> aMailDataList) { return MailAPI.queueMails (aSMTPSettings, aMailDataList); }
[ "@", "Nonnegative", "public", "int", "queueMails", "(", "@", "Nonnull", "final", "ISMTPSettings", "aSMTPSettings", ",", "@", "Nonnull", "final", "Collection", "<", "?", "extends", "IMutableEmailData", ">", "aMailDataList", ")", "{", "return", "MailAPI", ".", "qu...
Queue multiple mails at once. @param aSMTPSettings The SMTP settings to be used. @param aMailDataList The mail messages to queue. May not be <code>null</code>. @return The number of queued emails. Always &ge; 0. Maximum value is the number of {@link IMutableEmailData} objects in the argument.
[ "Queue", "multiple", "mails", "at", "once", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-smtp/src/main/java/com/helger/smtp/scope/ScopedMailAPI.java#L104-L109
train
phax/ph-web
ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java
EmailAddressValidator.setPerformMXRecordCheck
public static void setPerformMXRecordCheck (final boolean bPerformMXRecordCheck) { s_aPerformMXRecordCheck.set (bPerformMXRecordCheck); if (LOGGER.isInfoEnabled ()) LOGGER.info ("Email address record check is " + (bPerformMXRecordCheck ? "enabled" : "disabled")); }
java
public static void setPerformMXRecordCheck (final boolean bPerformMXRecordCheck) { s_aPerformMXRecordCheck.set (bPerformMXRecordCheck); if (LOGGER.isInfoEnabled ()) LOGGER.info ("Email address record check is " + (bPerformMXRecordCheck ? "enabled" : "disabled")); }
[ "public", "static", "void", "setPerformMXRecordCheck", "(", "final", "boolean", "bPerformMXRecordCheck", ")", "{", "s_aPerformMXRecordCheck", ".", "set", "(", "bPerformMXRecordCheck", ")", ";", "if", "(", "LOGGER", ".", "isInfoEnabled", "(", ")", ")", "LOGGER", "....
Set the global "check MX record" flag. @param bPerformMXRecordCheck <code>true</code> to enable, <code>false</code> otherwise.
[ "Set", "the", "global", "check", "MX", "record", "flag", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java#L57-L63
train
phax/ph-web
ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java
EmailAddressValidator._hasMXRecord
private static boolean _hasMXRecord (@Nonnull final String sHostName) { try { final Record [] aRecords = new Lookup (sHostName, Type.MX).run (); return aRecords != null && aRecords.length > 0; } catch (final Exception ex) { // Do not log this message, as this method is potentially called very // often! if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Failed to check for MX record on host '" + sHostName + "': " + ex.getClass ().getName () + " - " + ex.getMessage ()); return false; } }
java
private static boolean _hasMXRecord (@Nonnull final String sHostName) { try { final Record [] aRecords = new Lookup (sHostName, Type.MX).run (); return aRecords != null && aRecords.length > 0; } catch (final Exception ex) { // Do not log this message, as this method is potentially called very // often! if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Failed to check for MX record on host '" + sHostName + "': " + ex.getClass ().getName () + " - " + ex.getMessage ()); return false; } }
[ "private", "static", "boolean", "_hasMXRecord", "(", "@", "Nonnull", "final", "String", "sHostName", ")", "{", "try", "{", "final", "Record", "[", "]", "aRecords", "=", "new", "Lookup", "(", "sHostName", ",", "Type", ".", "MX", ")", ".", "run", "(", ")...
Check if the passed host name has an MX record. @param sHostName The host name to check. @return <code>true</code> if an MX record was found, <code>false</code> if not (or if an exception occurred)
[ "Check", "if", "the", "passed", "host", "name", "has", "an", "MX", "record", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java#L81-L101
train
phax/ph-web
ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java
EmailAddressValidator.isValid
public static boolean isValid (@Nullable final String sEmail) { return s_aPerformMXRecordCheck.get () ? isValidWithMXCheck (sEmail) : EmailAddressHelper.isValid (sEmail); }
java
public static boolean isValid (@Nullable final String sEmail) { return s_aPerformMXRecordCheck.get () ? isValidWithMXCheck (sEmail) : EmailAddressHelper.isValid (sEmail); }
[ "public", "static", "boolean", "isValid", "(", "@", "Nullable", "final", "String", "sEmail", ")", "{", "return", "s_aPerformMXRecordCheck", ".", "get", "(", ")", "?", "isValidWithMXCheck", "(", "sEmail", ")", ":", "EmailAddressHelper", ".", "isValid", "(", "sE...
Checks if a value is a valid e-mail address. Depending on the global value for the MX record check the check is performed incl. the MX record check or without. @param sEmail The value validation is being performed on. A <code>null</code> value is considered invalid. @return <code>true</code> if the email address is valid, <code>false</code> otherwise. @see #isPerformMXRecordCheck() @see #setPerformMXRecordCheck(boolean)
[ "Checks", "if", "a", "value", "is", "a", "valid", "e", "-", "mail", "address", ".", "Depending", "on", "the", "global", "value", "for", "the", "MX", "record", "check", "the", "check", "is", "performed", "incl", ".", "the", "MX", "record", "check", "or"...
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java#L116-L119
train
phax/ph-web
ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java
EmailAddressValidator.isValidWithMXCheck
public static boolean isValidWithMXCheck (@Nullable final String sEmail) { // First check without MX if (!EmailAddressHelper.isValid (sEmail)) return false; final String sUnifiedEmail = EmailAddressHelper.getUnifiedEmailAddress (sEmail); // MX record checking final int i = sUnifiedEmail.indexOf ('@'); final String sHostName = sUnifiedEmail.substring (i + 1); return _hasMXRecord (sHostName); }
java
public static boolean isValidWithMXCheck (@Nullable final String sEmail) { // First check without MX if (!EmailAddressHelper.isValid (sEmail)) return false; final String sUnifiedEmail = EmailAddressHelper.getUnifiedEmailAddress (sEmail); // MX record checking final int i = sUnifiedEmail.indexOf ('@'); final String sHostName = sUnifiedEmail.substring (i + 1); return _hasMXRecord (sHostName); }
[ "public", "static", "boolean", "isValidWithMXCheck", "(", "@", "Nullable", "final", "String", "sEmail", ")", "{", "// First check without MX", "if", "(", "!", "EmailAddressHelper", ".", "isValid", "(", "sEmail", ")", ")", "return", "false", ";", "final", "String...
Checks if a value is a valid e-mail address according to a complex regular expression. Additionally an MX record lookup is performed to see whether this host provides SMTP services. @param sEmail The value validation is being performed on. A <code>null</code> value is considered invalid. @return <code>true</code> if the email address is valid, <code>false</code> otherwise.
[ "Checks", "if", "a", "value", "is", "a", "valid", "e", "-", "mail", "address", "according", "to", "a", "complex", "regular", "expression", ".", "Additionally", "an", "MX", "record", "lookup", "is", "performed", "to", "see", "whether", "this", "host", "prov...
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java#L132-L144
train
phax/ph-web
ph-httpclient/src/main/java/com/helger/httpclient/response/ExtendedHttpResponseException.java
ExtendedHttpResponseException.getResponseBodyAsString
@Nullable public String getResponseBodyAsString (@Nonnull final Charset aCharset) { return m_aResponseBody == null ? null : new String (m_aResponseBody, aCharset); }
java
@Nullable public String getResponseBodyAsString (@Nonnull final Charset aCharset) { return m_aResponseBody == null ? null : new String (m_aResponseBody, aCharset); }
[ "@", "Nullable", "public", "String", "getResponseBodyAsString", "(", "@", "Nonnull", "final", "Charset", "aCharset", ")", "{", "return", "m_aResponseBody", "==", "null", "?", "null", ":", "new", "String", "(", "m_aResponseBody", ",", "aCharset", ")", ";", "}" ...
Get the response body as a string in the provided charset. @param aCharset The charset to use. May not be <code>null</code>. @return <code>null</code> if no response body is present.
[ "Get", "the", "response", "body", "as", "a", "string", "in", "the", "provided", "charset", "." ]
d445fd25184605b62682c93c9782409acf0ae813
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-httpclient/src/main/java/com/helger/httpclient/response/ExtendedHttpResponseException.java#L148-L152
train