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
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.deepHashCode
public static int deepHashCode(final Object obj) { if (obj == null) { return 0; } if (obj.getClass().isArray()) { return typeOf(obj.getClass()).deepHashCode(obj); } return obj.hashCode(); }
java
public static int deepHashCode(final Object obj) { if (obj == null) { return 0; } if (obj.getClass().isArray()) { return typeOf(obj.getClass()).deepHashCode(obj); } return obj.hashCode(); }
[ "public", "static", "int", "deepHashCode", "(", "final", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "return", "0", ";", "}", "if", "(", "obj", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "return", "typ...
Method deepHashCode. @param obj @return int
[ "Method", "deepHashCode", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L7595-L7605
train
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.deepToString
public static String deepToString(final Object obj) { if (obj == null) { return NULL_STRING; } if (obj.getClass().isArray()) { return typeOf(obj.getClass()).deepToString(obj); } return obj.toString(); }
java
public static String deepToString(final Object obj) { if (obj == null) { return NULL_STRING; } if (obj.getClass().isArray()) { return typeOf(obj.getClass()).deepToString(obj); } return obj.toString(); }
[ "public", "static", "String", "deepToString", "(", "final", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "return", "NULL_STRING", ";", "}", "if", "(", "obj", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "re...
Method deepToString. @param obj @return int
[ "Method", "deepToString", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L7986-L7996
train
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.repeatEach
public static <T> List<T> repeatEach(final Collection<T> c, final int n) { N.checkArgNotNegative(n, "n"); if (n == 0 || isNullOrEmpty(c)) { return new ArrayList<T>(); } final List<T> result = new ArrayList<>(c.size() * n); for (T e : c) { for ...
java
public static <T> List<T> repeatEach(final Collection<T> c, final int n) { N.checkArgNotNegative(n, "n"); if (n == 0 || isNullOrEmpty(c)) { return new ArrayList<T>(); } final List<T> result = new ArrayList<>(c.size() * n); for (T e : c) { for ...
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "repeatEach", "(", "final", "Collection", "<", "T", ">", "c", ",", "final", "int", "n", ")", "{", "N", ".", "checkArgNotNegative", "(", "n", ",", "\"n\"", ")", ";", "if", "(", "n", "==", ...
Repeats the elements in the specified Collection one by one. <pre> <code> Seq.nRepeat(N.asList(1, 2, 3), 2) => [1, 1, 2, 2, 3, 3] </code> </pre> @param c @param n @return
[ "Repeats", "the", "elements", "in", "the", "specified", "Collection", "one", "by", "one", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L9839-L9855
train
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.repeatEachToSize
public static <T> List<T> repeatEachToSize(final Collection<T> c, final int size) { N.checkArgNotNegative(size, "size"); checkArgument(size == 0 || notNullOrEmpty(c), "Collection can not be empty or null when size > 0"); if (size == 0 || isNullOrEmpty(c)) { return new ArrayList...
java
public static <T> List<T> repeatEachToSize(final Collection<T> c, final int size) { N.checkArgNotNegative(size, "size"); checkArgument(size == 0 || notNullOrEmpty(c), "Collection can not be empty or null when size > 0"); if (size == 0 || isNullOrEmpty(c)) { return new ArrayList...
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "repeatEachToSize", "(", "final", "Collection", "<", "T", ">", "c", ",", "final", "int", "size", ")", "{", "N", ".", "checkArgNotNegative", "(", "size", ",", "\"size\"", ")", ";", "checkArgument...
Repeats the elements in the specified Collection one by one till reach the specified size. <pre> <code> Seq.nRepeatToSize(N.asList(1, 2, 3), 5) => [1, 1, 2, 2, 3] </code> </pre> @param c @param size @return
[ "Repeats", "the", "elements", "in", "the", "specified", "Collection", "one", "by", "one", "till", "reach", "the", "specified", "size", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L9896-L9920
train
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.max
public static <T> T max(final Collection<? extends T> c, final int from, final int to, Comparator<? super T> cmp) { checkFromToIndex(from, to, size(c)); if (N.isNullOrEmpty(c) || to - from < 1 || from >= c.size()) { throw new IllegalArgumentException("The size of collection can not be n...
java
public static <T> T max(final Collection<? extends T> c, final int from, final int to, Comparator<? super T> cmp) { checkFromToIndex(from, to, size(c)); if (N.isNullOrEmpty(c) || to - from < 1 || from >= c.size()) { throw new IllegalArgumentException("The size of collection can not be n...
[ "public", "static", "<", "T", ">", "T", "max", "(", "final", "Collection", "<", "?", "extends", "T", ">", "c", ",", "final", "int", "from", ",", "final", "int", "to", ",", "Comparator", "<", "?", "super", "T", ">", "cmp", ")", "{", "checkFromToInde...
Returns the maximum element in the collection. @param c @param from @param to @param cmp @return the maximum value in the Collection
[ "Returns", "the", "maximum", "element", "in", "the", "collection", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L26190-L26241
train
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/SQLConnectionManager.java
SQLConnectionManager.newConnection
private synchronized PoolableConnection newConnection() { synchronized (xpool) { if (xpool.size() >= maxActive) { return null; } try { PoolableConnection conn = null; if (xpool.size() < minIdle) { ...
java
private synchronized PoolableConnection newConnection() { synchronized (xpool) { if (xpool.size() >= maxActive) { return null; } try { PoolableConnection conn = null; if (xpool.size() < minIdle) { ...
[ "private", "synchronized", "PoolableConnection", "newConnection", "(", ")", "{", "synchronized", "(", "xpool", ")", "{", "if", "(", "xpool", ".", "size", "(", ")", ">=", "maxActive", ")", "{", "return", "null", ";", "}", "try", "{", "PoolableConnection", "...
Method newConnection. @param liveTime @param maxIdleTime @return PoolableConnection
[ "Method", "newConnection", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/SQLConnectionManager.java#L352-L383
train
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/SQLConnectionManager.java
SQLConnectionManager.initPool
private void initPool() { if (logger.isWarnEnabled()) { logger.warn("Start to initialize connection pool with url: " + url + " ..."); } for (int i = 0; (i < initialSize) && (xpool.size() < initialSize); i++) { pool.lock(); try { if (...
java
private void initPool() { if (logger.isWarnEnabled()) { logger.warn("Start to initialize connection pool with url: " + url + " ..."); } for (int i = 0; (i < initialSize) && (xpool.size() < initialSize); i++) { pool.lock(); try { if (...
[ "private", "void", "initPool", "(", ")", "{", "if", "(", "logger", ".", "isWarnEnabled", "(", ")", ")", "{", "logger", ".", "warn", "(", "\"Start to initialize connection pool with url: \"", "+", "url", "+", "\" ...\"", ")", ";", "}", "for", "(", "int", "i...
Method initPool.
[ "Method", "initPool", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/SQLConnectionManager.java#L399-L427
train
landawn/AbacusUtil
src/com/landawn/abacus/util/ClassUtil.java
ClassUtil.registerXMLBindingClassForPropGetSetMethod
public static void registerXMLBindingClassForPropGetSetMethod(final Class<?> cls) { if (registeredXMLBindingClassList.containsKey(cls)) { return; } synchronized (entityDeclaredPropGetMethodPool) { registeredXMLBindingClassList.put(cls, false); if (en...
java
public static void registerXMLBindingClassForPropGetSetMethod(final Class<?> cls) { if (registeredXMLBindingClassList.containsKey(cls)) { return; } synchronized (entityDeclaredPropGetMethodPool) { registeredXMLBindingClassList.put(cls, false); if (en...
[ "public", "static", "void", "registerXMLBindingClassForPropGetSetMethod", "(", "final", "Class", "<", "?", ">", "cls", ")", "{", "if", "(", "registeredXMLBindingClassList", ".", "containsKey", "(", "cls", ")", ")", "{", "return", ";", "}", "synchronized", "(", ...
The property maybe only has get method if its type is collection or map by xml binding specificatio Otherwise, it will be ignored if not registered by calling this method. @param cls
[ "The", "property", "maybe", "only", "has", "get", "method", "if", "its", "type", "is", "collection", "or", "map", "by", "xml", "binding", "specificatio", "Otherwise", "it", "will", "be", "ignored", "if", "not", "registered", "by", "calling", "this", "method"...
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ClassUtil.java#L447-L463
train
landawn/AbacusUtil
src/com/landawn/abacus/util/ClassUtil.java
ClassUtil.getAllInterfaces
public static Set<Class<?>> getAllInterfaces(final Class<?> cls) { final Set<Class<?>> interfacesFound = new LinkedHashSet<>(); getAllInterfaces(cls, interfacesFound); return interfacesFound; }
java
public static Set<Class<?>> getAllInterfaces(final Class<?> cls) { final Set<Class<?>> interfacesFound = new LinkedHashSet<>(); getAllInterfaces(cls, interfacesFound); return interfacesFound; }
[ "public", "static", "Set", "<", "Class", "<", "?", ">", ">", "getAllInterfaces", "(", "final", "Class", "<", "?", ">", "cls", ")", "{", "final", "Set", "<", "Class", "<", "?", ">", ">", "interfacesFound", "=", "new", "LinkedHashSet", "<>", "(", ")", ...
Copied from Apache Commons Lang under Apache License v2. <p>Gets a {@code List} of all interfaces implemented by the given class and its super classes.</p> <p>The order is determined by looking through each interface in turn as declared in the source file and following its hierarchy up. Then each superclass is consid...
[ "Copied", "from", "Apache", "Commons", "Lang", "under", "Apache", "License", "v2", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ClassUtil.java#L691-L697
train
landawn/AbacusUtil
src/com/landawn/abacus/util/ClassUtil.java
ClassUtil.getPropNameList
public static List<String> getPropNameList(final Class<?> cls) { List<String> propNameList = entityDeclaredPropNameListPool.get(cls); if (propNameList == null) { loadPropGetSetMethodList(cls); propNameList = entityDeclaredPropNameListPool.get(cls); } ret...
java
public static List<String> getPropNameList(final Class<?> cls) { List<String> propNameList = entityDeclaredPropNameListPool.get(cls); if (propNameList == null) { loadPropGetSetMethodList(cls); propNameList = entityDeclaredPropNameListPool.get(cls); } ret...
[ "public", "static", "List", "<", "String", ">", "getPropNameList", "(", "final", "Class", "<", "?", ">", "cls", ")", "{", "List", "<", "String", ">", "propNameList", "=", "entityDeclaredPropNameListPool", ".", "get", "(", "cls", ")", ";", "if", "(", "pro...
Returns an immutable entity property name List by the specified class. @param cls @return
[ "Returns", "an", "immutable", "entity", "property", "name", "List", "by", "the", "specified", "class", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ClassUtil.java#L1308-L1317
train
landawn/AbacusUtil
src/com/landawn/abacus/util/Multimap.java
Multimap.totalCountOfValues
public int totalCountOfValues() { int count = 0; for (V v : valueMap.values()) { count += v.size(); } return count; }
java
public int totalCountOfValues() { int count = 0; for (V v : valueMap.values()) { count += v.size(); } return count; }
[ "public", "int", "totalCountOfValues", "(", ")", "{", "int", "count", "=", "0", ";", "for", "(", "V", "v", ":", "valueMap", ".", "values", "(", ")", ")", "{", "count", "+=", "v", ".", "size", "(", ")", ";", "}", "return", "count", ";", "}" ]
Returns the total count of all the elements in all values. @return
[ "Returns", "the", "total", "count", "of", "all", "the", "elements", "in", "all", "values", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Multimap.java#L1395-L1403
train
landawn/AbacusUtil
src/com/landawn/abacus/util/IOUtil.java
IOUtil.skip
public static long skip(final InputStream input, final long toSkip) throws UncheckedIOException { if (toSkip < 0) { throw new IllegalArgumentException("Skip count must be non-negative, actual: " + toSkip); } else if (toSkip == 0) { return 0; } final byte[]...
java
public static long skip(final InputStream input, final long toSkip) throws UncheckedIOException { if (toSkip < 0) { throw new IllegalArgumentException("Skip count must be non-negative, actual: " + toSkip); } else if (toSkip == 0) { return 0; } final byte[]...
[ "public", "static", "long", "skip", "(", "final", "InputStream", "input", ",", "final", "long", "toSkip", ")", "throws", "UncheckedIOException", "{", "if", "(", "toSkip", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Skip count must be ...
Return the count of skipped bytes. @param input @param toSkip @return
[ "Return", "the", "count", "of", "skipped", "bytes", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/IOUtil.java#L2212-L2240
train
landawn/AbacusUtil
src/com/landawn/abacus/util/IOUtil.java
IOUtil.estimateLineCount
private static long estimateLineCount(final File file, final int byReadingLineNum) throws UncheckedIOException { final Holder<ZipFile> outputZipFile = new Holder<>(); InputStream is = null; BufferedReader br = null; try { is = openFile(outputZipFile, file); ...
java
private static long estimateLineCount(final File file, final int byReadingLineNum) throws UncheckedIOException { final Holder<ZipFile> outputZipFile = new Holder<>(); InputStream is = null; BufferedReader br = null; try { is = openFile(outputZipFile, file); ...
[ "private", "static", "long", "estimateLineCount", "(", "final", "File", "file", ",", "final", "int", "byReadingLineNum", ")", "throws", "UncheckedIOException", "{", "final", "Holder", "<", "ZipFile", ">", "outputZipFile", "=", "new", "Holder", "<>", "(", ")", ...
Estimate the total line count of the file by reading the specified line count ahead. @param file @param byReadingLineNum @return
[ "Estimate", "the", "total", "line", "count", "of", "the", "file", "by", "reading", "the", "specified", "line", "count", "ahead", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/IOUtil.java#L3468-L3496
train
landawn/AbacusUtil
src/com/landawn/abacus/util/IOUtil.java
IOUtil.merge
public static long merge(final Collection<File> sourceFiles, final File destFile) throws UncheckedIOException { final byte[] buf = Objectory.createByteArrayBuffer(); long totalCount = 0; OutputStream output = null; try { output = new FileOutputStream(destFile); ...
java
public static long merge(final Collection<File> sourceFiles, final File destFile) throws UncheckedIOException { final byte[] buf = Objectory.createByteArrayBuffer(); long totalCount = 0; OutputStream output = null; try { output = new FileOutputStream(destFile); ...
[ "public", "static", "long", "merge", "(", "final", "Collection", "<", "File", ">", "sourceFiles", ",", "final", "File", "destFile", ")", "throws", "UncheckedIOException", "{", "final", "byte", "[", "]", "buf", "=", "Objectory", ".", "createByteArrayBuffer", "(...
Merge the specified source files into the destination file. @param sourceFiles @param destFile @return the total bytes have been merged into the destination file.
[ "Merge", "the", "specified", "source", "files", "into", "the", "destination", "file", "." ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/IOUtil.java#L3509-L3544
train
landawn/AbacusUtil
src/com/landawn/abacus/util/IOUtil.java
IOUtil.decodeUrl
private static String decodeUrl(final String url) { String decoded = url; if (url != null && url.indexOf('%') >= 0) { final int n = url.length(); final StringBuffer buffer = new StringBuffer(); final ByteBuffer bytes = ByteBuffer.allocate(n); for (in...
java
private static String decodeUrl(final String url) { String decoded = url; if (url != null && url.indexOf('%') >= 0) { final int n = url.length(); final StringBuffer buffer = new StringBuffer(); final ByteBuffer bytes = ByteBuffer.allocate(n); for (in...
[ "private", "static", "String", "decodeUrl", "(", "final", "String", "url", ")", "{", "String", "decoded", "=", "url", ";", "if", "(", "url", "!=", "null", "&&", "url", ".", "indexOf", "(", "'", "'", ")", ">=", "0", ")", "{", "final", "int", "n", ...
unavoidable until Java 7
[ "unavoidable", "until", "Java", "7" ]
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/IOUtil.java#L3698-L3729
train
landawn/AbacusUtil
src/com/landawn/abacus/util/stream/Stream.java
Stream.zip
public static <R> Stream<R> zip(final ShortStream a, final ShortStream b, final ShortBiFunction<R> zipFunction) { return zip(a.iteratorEx(), b.iteratorEx(), zipFunction).onClose(newCloseHandler(N.asList(a, b))); }
java
public static <R> Stream<R> zip(final ShortStream a, final ShortStream b, final ShortBiFunction<R> zipFunction) { return zip(a.iteratorEx(), b.iteratorEx(), zipFunction).onClose(newCloseHandler(N.asList(a, b))); }
[ "public", "static", "<", "R", ">", "Stream", "<", "R", ">", "zip", "(", "final", "ShortStream", "a", ",", "final", "ShortStream", "b", ",", "final", "ShortBiFunction", "<", "R", ">", "zipFunction", ")", "{", "return", "zip", "(", "a", ".", "iteratorEx"...
Zip together the "a" and "b" streams until one of them runs out of values. Each pair of values is combined into a single value using the supplied zipFunction function. @param a @param b @return
[ "Zip", "together", "the", "a", "and", "b", "streams", "until", "one", "of", "them", "runs", "out", "of", "values", ".", "Each", "pair", "of", "values", "is", "combined", "into", "a", "single", "value", "using", "the", "supplied", "zipFunction", "function",...
544b7720175d15e9329f83dd22a8cc5fa4515e12
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Stream.java#L5278-L5280
train
os72/protoc-jar
src/main/java/com/github/os72/protocjar/MavenUtil.java
MavenUtil.getReleaseDownloadUrl
static URLSpec getReleaseDownloadUrl(String path, MavenSettings settings) throws IOException { String url = settings.mCentralUrl; if (settings.mMirrorUrl != null) url = settings.mMirrorUrl; return new URLSpec(url + path, settings.mProxyHost, settings.mProxyPort); }
java
static URLSpec getReleaseDownloadUrl(String path, MavenSettings settings) throws IOException { String url = settings.mCentralUrl; if (settings.mMirrorUrl != null) url = settings.mMirrorUrl; return new URLSpec(url + path, settings.mProxyHost, settings.mProxyPort); }
[ "static", "URLSpec", "getReleaseDownloadUrl", "(", "String", "path", ",", "MavenSettings", "settings", ")", "throws", "IOException", "{", "String", "url", "=", "settings", ".", "mCentralUrl", ";", "if", "(", "settings", ".", "mMirrorUrl", "!=", "null", ")", "u...
get release download URL
[ "get", "release", "download", "URL" ]
ed71cba81c36023c23c1a18ecd060de8ee917b88
https://github.com/os72/protoc-jar/blob/ed71cba81c36023c23c1a18ecd060de8ee917b88/src/main/java/com/github/os72/protocjar/MavenUtil.java#L41-L45
train
os72/protoc-jar
src/main/java/com/github/os72/protocjar/MavenUtil.java
MavenUtil.getSnapshotDownloadUrl
static URLSpec getSnapshotDownloadUrl(String path, MavenSettings settings) throws IOException { String url = settings.mSnapshotUrl; return new URLSpec(url + path, settings.mProxyHost, settings.mProxyPort); }
java
static URLSpec getSnapshotDownloadUrl(String path, MavenSettings settings) throws IOException { String url = settings.mSnapshotUrl; return new URLSpec(url + path, settings.mProxyHost, settings.mProxyPort); }
[ "static", "URLSpec", "getSnapshotDownloadUrl", "(", "String", "path", ",", "MavenSettings", "settings", ")", "throws", "IOException", "{", "String", "url", "=", "settings", ".", "mSnapshotUrl", ";", "return", "new", "URLSpec", "(", "url", "+", "path", ",", "se...
get snapshot download URL
[ "get", "snapshot", "download", "URL" ]
ed71cba81c36023c23c1a18ecd060de8ee917b88
https://github.com/os72/protoc-jar/blob/ed71cba81c36023c23c1a18ecd060de8ee917b88/src/main/java/com/github/os72/protocjar/MavenUtil.java#L47-L50
train
os72/protoc-jar
src/main/java/com/github/os72/protocjar/MavenUtil.java
MavenUtil.getMavenSettings
static MavenSettings getMavenSettings() { try { String homeDir = System.getProperty("user.home"); return parseMavenSettings(new File(homeDir, ".m2/settings.xml")); } catch (Exception e) { log(e); } return new MavenSettings(); }
java
static MavenSettings getMavenSettings() { try { String homeDir = System.getProperty("user.home"); return parseMavenSettings(new File(homeDir, ".m2/settings.xml")); } catch (Exception e) { log(e); } return new MavenSettings(); }
[ "static", "MavenSettings", "getMavenSettings", "(", ")", "{", "try", "{", "String", "homeDir", "=", "System", ".", "getProperty", "(", "\"user.home\"", ")", ";", "return", "parseMavenSettings", "(", "new", "File", "(", "homeDir", ",", "\".m2/settings.xml\"", ")"...
get maven settings
[ "get", "maven", "settings" ]
ed71cba81c36023c23c1a18ecd060de8ee917b88
https://github.com/os72/protoc-jar/blob/ed71cba81c36023c23c1a18ecd060de8ee917b88/src/main/java/com/github/os72/protocjar/MavenUtil.java#L53-L62
train
os72/protoc-jar
src/main/java/com/github/os72/protocjar/MavenUtil.java
MavenUtil.parseMavenSettings
static MavenSettings parseMavenSettings(File settingsFile) throws IOException { MavenSettings settings = new MavenSettings(); try { DocumentBuilder xmlBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document xmlDoc = xmlBuilder.parse(settingsFile); NodeList mirrorList = xmlDoc.getD...
java
static MavenSettings parseMavenSettings(File settingsFile) throws IOException { MavenSettings settings = new MavenSettings(); try { DocumentBuilder xmlBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document xmlDoc = xmlBuilder.parse(settingsFile); NodeList mirrorList = xmlDoc.getD...
[ "static", "MavenSettings", "parseMavenSettings", "(", "File", "settingsFile", ")", "throws", "IOException", "{", "MavenSettings", "settings", "=", "new", "MavenSettings", "(", ")", ";", "try", "{", "DocumentBuilder", "xmlBuilder", "=", "DocumentBuilderFactory", ".", ...
parse maven settings.xml
[ "parse", "maven", "settings", ".", "xml" ]
ed71cba81c36023c23c1a18ecd060de8ee917b88
https://github.com/os72/protoc-jar/blob/ed71cba81c36023c23c1a18ecd060de8ee917b88/src/main/java/com/github/os72/protocjar/MavenUtil.java#L65-L100
train
os72/protoc-jar
src/main/java/com/github/os72/protocjar/MavenUtil.java
MavenUtil.parseSnapshotExeName
static String parseSnapshotExeName(File mdFile) throws IOException { String exeName = null; try { String clsStr = Protoc.getPlatformClassifier(); DocumentBuilder xmlBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document xmlDoc = xmlBuilder.parse(mdFile); NodeList versions = xmlDoc...
java
static String parseSnapshotExeName(File mdFile) throws IOException { String exeName = null; try { String clsStr = Protoc.getPlatformClassifier(); DocumentBuilder xmlBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document xmlDoc = xmlBuilder.parse(mdFile); NodeList versions = xmlDoc...
[ "static", "String", "parseSnapshotExeName", "(", "File", "mdFile", ")", "throws", "IOException", "{", "String", "exeName", "=", "null", ";", "try", "{", "String", "clsStr", "=", "Protoc", ".", "getPlatformClassifier", "(", ")", ";", "DocumentBuilder", "xmlBuilde...
parse snapshot exe name from maven-metadata.xml
[ "parse", "snapshot", "exe", "name", "from", "maven", "-", "metadata", ".", "xml" ]
ed71cba81c36023c23c1a18ecd060de8ee917b88
https://github.com/os72/protoc-jar/blob/ed71cba81c36023c23c1a18ecd060de8ee917b88/src/main/java/com/github/os72/protocjar/MavenUtil.java#L127-L153
train
vladmihalcea/db-util
src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java
SQLStatementCountValidator.assertSelectCount
public static void assertSelectCount(long expectedSelectCount) { QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedSelectCount = queryCount.getSelect(); if (expectedSelectCount != recordedSelectCount) { throw new SQLSelectCountMismatchException(expectedSelectCoun...
java
public static void assertSelectCount(long expectedSelectCount) { QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedSelectCount = queryCount.getSelect(); if (expectedSelectCount != recordedSelectCount) { throw new SQLSelectCountMismatchException(expectedSelectCoun...
[ "public", "static", "void", "assertSelectCount", "(", "long", "expectedSelectCount", ")", "{", "QueryCount", "queryCount", "=", "QueryCountHolder", ".", "getGrandTotal", "(", ")", ";", "long", "recordedSelectCount", "=", "queryCount", ".", "getSelect", "(", ")", "...
Assert select statement count @param expectedSelectCount expected select statement count
[ "Assert", "select", "statement", "count" ]
81c8c8421253c9869db1d4e221668d7afbd69fd0
https://github.com/vladmihalcea/db-util/blob/81c8c8421253c9869db1d4e221668d7afbd69fd0/src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java#L51-L57
train
vladmihalcea/db-util
src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java
SQLStatementCountValidator.assertInsertCount
public static void assertInsertCount(long expectedInsertCount) { QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedInsertCount = queryCount.getInsert(); if (expectedInsertCount != recordedInsertCount) { throw new SQLInsertCountMismatchException(expectedInsertCoun...
java
public static void assertInsertCount(long expectedInsertCount) { QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedInsertCount = queryCount.getInsert(); if (expectedInsertCount != recordedInsertCount) { throw new SQLInsertCountMismatchException(expectedInsertCoun...
[ "public", "static", "void", "assertInsertCount", "(", "long", "expectedInsertCount", ")", "{", "QueryCount", "queryCount", "=", "QueryCountHolder", ".", "getGrandTotal", "(", ")", ";", "long", "recordedInsertCount", "=", "queryCount", ".", "getInsert", "(", ")", "...
Assert insert statement count @param expectedInsertCount expected insert statement count
[ "Assert", "insert", "statement", "count" ]
81c8c8421253c9869db1d4e221668d7afbd69fd0
https://github.com/vladmihalcea/db-util/blob/81c8c8421253c9869db1d4e221668d7afbd69fd0/src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java#L78-L84
train
vladmihalcea/db-util
src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java
SQLStatementCountValidator.assertUpdateCount
public static void assertUpdateCount(long expectedUpdateCount) { QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedUpdateCount = queryCount.getUpdate(); if (expectedUpdateCount != recordedUpdateCount) { throw new SQLUpdateCountMismatchException(expectedUpdateCoun...
java
public static void assertUpdateCount(long expectedUpdateCount) { QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedUpdateCount = queryCount.getUpdate(); if (expectedUpdateCount != recordedUpdateCount) { throw new SQLUpdateCountMismatchException(expectedUpdateCoun...
[ "public", "static", "void", "assertUpdateCount", "(", "long", "expectedUpdateCount", ")", "{", "QueryCount", "queryCount", "=", "QueryCountHolder", ".", "getGrandTotal", "(", ")", ";", "long", "recordedUpdateCount", "=", "queryCount", ".", "getUpdate", "(", ")", "...
Assert update statement count @param expectedUpdateCount expected update statement count
[ "Assert", "update", "statement", "count" ]
81c8c8421253c9869db1d4e221668d7afbd69fd0
https://github.com/vladmihalcea/db-util/blob/81c8c8421253c9869db1d4e221668d7afbd69fd0/src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java#L105-L111
train
vladmihalcea/db-util
src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java
SQLStatementCountValidator.assertDeleteCount
public static void assertDeleteCount(long expectedDeleteCount) { QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedDeleteCount = queryCount.getDelete(); if (expectedDeleteCount != recordedDeleteCount) { throw new SQLDeleteCountMismatchException(expectedDeleteCoun...
java
public static void assertDeleteCount(long expectedDeleteCount) { QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedDeleteCount = queryCount.getDelete(); if (expectedDeleteCount != recordedDeleteCount) { throw new SQLDeleteCountMismatchException(expectedDeleteCoun...
[ "public", "static", "void", "assertDeleteCount", "(", "long", "expectedDeleteCount", ")", "{", "QueryCount", "queryCount", "=", "QueryCountHolder", ".", "getGrandTotal", "(", ")", ";", "long", "recordedDeleteCount", "=", "queryCount", ".", "getDelete", "(", ")", "...
Assert delete statement count @param expectedDeleteCount expected delete statement count
[ "Assert", "delete", "statement", "count" ]
81c8c8421253c9869db1d4e221668d7afbd69fd0
https://github.com/vladmihalcea/db-util/blob/81c8c8421253c9869db1d4e221668d7afbd69fd0/src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java#L132-L138
train
eldur/jwbf
src/main/java/net/sourceforge/jwbf/mediawiki/bots/MediaWikiBot.java
MediaWikiBot.login
public void login(String username, String passwd, String domain) { this.login = getPerformedAction(new PostLogin(username, passwd, domain)).getLoginData(); loginChangeUserInfo = true; if (getVersion() == Version.UNKNOWN) { loginChangeVersion = true; } }
java
public void login(String username, String passwd, String domain) { this.login = getPerformedAction(new PostLogin(username, passwd, domain)).getLoginData(); loginChangeUserInfo = true; if (getVersion() == Version.UNKNOWN) { loginChangeVersion = true; } }
[ "public", "void", "login", "(", "String", "username", ",", "String", "passwd", ",", "String", "domain", ")", "{", "this", ".", "login", "=", "getPerformedAction", "(", "new", "PostLogin", "(", "username", ",", "passwd", ",", "domain", ")", ")", ".", "get...
Performs a Login. @param username the username @param passwd the password @param domain login domain (Special for LDAPAuth extention to authenticate against LDAP users) @see PostLogin
[ "Performs", "a", "Login", "." ]
ee17ea2fa5a26f17c8332a094b2db86dd596d1ff
https://github.com/eldur/jwbf/blob/ee17ea2fa5a26f17c8332a094b2db86dd596d1ff/src/main/java/net/sourceforge/jwbf/mediawiki/bots/MediaWikiBot.java#L138-L144
train
eldur/jwbf
src/main/java/net/sourceforge/jwbf/mediawiki/bots/MediaWikiBot.java
MediaWikiBot.delete
public void delete(String title, String reason) { getPerformedAction(new PostDelete(getUserinfo(), title, reason)); }
java
public void delete(String title, String reason) { getPerformedAction(new PostDelete(getUserinfo(), title, reason)); }
[ "public", "void", "delete", "(", "String", "title", ",", "String", "reason", ")", "{", "getPerformedAction", "(", "new", "PostDelete", "(", "getUserinfo", "(", ")", ",", "title", ",", "reason", ")", ")", ";", "}" ]
deletes an article with a reason
[ "deletes", "an", "article", "with", "a", "reason" ]
ee17ea2fa5a26f17c8332a094b2db86dd596d1ff
https://github.com/eldur/jwbf/blob/ee17ea2fa5a26f17c8332a094b2db86dd596d1ff/src/main/java/net/sourceforge/jwbf/mediawiki/bots/MediaWikiBot.java#L272-L274
train
eldur/jwbf
src/main/java/net/sourceforge/jwbf/mediawiki/actions/queries/WatchResponse.java
WatchResponse.getEditType
private EditType getEditType(String typeName) { for (EditType type : EditType.values()) { if (type.toString().equals(typeName)) { return type; } } return null; }
java
private EditType getEditType(String typeName) { for (EditType type : EditType.values()) { if (type.toString().equals(typeName)) { return type; } } return null; }
[ "private", "EditType", "getEditType", "(", "String", "typeName", ")", "{", "for", "(", "EditType", "type", ":", "EditType", ".", "values", "(", ")", ")", "{", "if", "(", "type", ".", "toString", "(", ")", ".", "equals", "(", "typeName", ")", ")", "{"...
Create a EditType from the name type used by MW @param typeName the name returned by MW @return the editType
[ "Create", "a", "EditType", "from", "the", "name", "type", "used", "by", "MW" ]
ee17ea2fa5a26f17c8332a094b2db86dd596d1ff
https://github.com/eldur/jwbf/blob/ee17ea2fa5a26f17c8332a094b2db86dd596d1ff/src/main/java/net/sourceforge/jwbf/mediawiki/actions/queries/WatchResponse.java#L89-L96
train
eldur/jwbf
src/main/java/net/sourceforge/jwbf/mediawiki/actions/queries/AllPageTitles.java
AllPageTitles.parseElements
@Override protected ImmutableList<String> parseElements(String s) { ImmutableList.Builder<String> titles = ImmutableList.builder(); Optional<XmlElement> child = XmlConverter.getChildOpt(s, "query", "allpages"); if (child.isPresent()) { for (XmlElement pageElement : child.get().getChildren("p")) { ...
java
@Override protected ImmutableList<String> parseElements(String s) { ImmutableList.Builder<String> titles = ImmutableList.builder(); Optional<XmlElement> child = XmlConverter.getChildOpt(s, "query", "allpages"); if (child.isPresent()) { for (XmlElement pageElement : child.get().getChildren("p")) { ...
[ "@", "Override", "protected", "ImmutableList", "<", "String", ">", "parseElements", "(", "String", "s", ")", "{", "ImmutableList", ".", "Builder", "<", "String", ">", "titles", "=", "ImmutableList", ".", "builder", "(", ")", ";", "Optional", "<", "XmlElement...
Picks the article name from a MediaWiki api response. @param s text for parsing @return a
[ "Picks", "the", "article", "name", "from", "a", "MediaWiki", "api", "response", "." ]
ee17ea2fa5a26f17c8332a094b2db86dd596d1ff
https://github.com/eldur/jwbf/blob/ee17ea2fa5a26f17c8332a094b2db86dd596d1ff/src/main/java/net/sourceforge/jwbf/mediawiki/actions/queries/AllPageTitles.java#L139-L151
train
eldur/jwbf
src/main/java/net/sourceforge/jwbf/mapper/XmlConverter.java
XmlConverter.getErrorElement
static Optional<XmlElement> getErrorElement(XmlElement rootXmlElement) { Optional<XmlElement> elem = rootXmlElement.getChildOpt("error"); if (elem.isPresent()) { ApiException error = elem.transform(toApiException()).get(); log.error(error.getCode() + ": " + error.getValue()); } return elem; ...
java
static Optional<XmlElement> getErrorElement(XmlElement rootXmlElement) { Optional<XmlElement> elem = rootXmlElement.getChildOpt("error"); if (elem.isPresent()) { ApiException error = elem.transform(toApiException()).get(); log.error(error.getCode() + ": " + error.getValue()); } return elem; ...
[ "static", "Optional", "<", "XmlElement", ">", "getErrorElement", "(", "XmlElement", "rootXmlElement", ")", "{", "Optional", "<", "XmlElement", ">", "elem", "=", "rootXmlElement", ".", "getChildOpt", "(", "\"error\"", ")", ";", "if", "(", "elem", ".", "isPresen...
Determines if the given XML Document contains an error message which then would printed by the logger. @param rootXmlElement XML <code>Document</code> @return error element
[ "Determines", "if", "the", "given", "XML", "Document", "contains", "an", "error", "message", "which", "then", "would", "printed", "by", "the", "logger", "." ]
ee17ea2fa5a26f17c8332a094b2db86dd596d1ff
https://github.com/eldur/jwbf/blob/ee17ea2fa5a26f17c8332a094b2db86dd596d1ff/src/main/java/net/sourceforge/jwbf/mapper/XmlConverter.java#L97-L104
train
eldur/jwbf
src/main/java/net/sourceforge/jwbf/mediawiki/actions/queries/BaseQuery.java
BaseQuery.parseXmlHasMore
@Deprecated protected Optional<String> parseXmlHasMore( String xml, String elementName, String attributeKey, String newContinueKey) { XmlElement rootElement = XmlConverter.getRootElement(xml); Optional<XmlElement> aContinue = rootElement.getChildOpt("continue"); if (aContinue.isPresent()) { re...
java
@Deprecated protected Optional<String> parseXmlHasMore( String xml, String elementName, String attributeKey, String newContinueKey) { XmlElement rootElement = XmlConverter.getRootElement(xml); Optional<XmlElement> aContinue = rootElement.getChildOpt("continue"); if (aContinue.isPresent()) { re...
[ "@", "Deprecated", "protected", "Optional", "<", "String", ">", "parseXmlHasMore", "(", "String", "xml", ",", "String", "elementName", ",", "String", "attributeKey", ",", "String", "newContinueKey", ")", "{", "XmlElement", "rootElement", "=", "XmlConverter", ".", ...
XML related methods will be removed.
[ "XML", "related", "methods", "will", "be", "removed", "." ]
ee17ea2fa5a26f17c8332a094b2db86dd596d1ff
https://github.com/eldur/jwbf/blob/ee17ea2fa5a26f17c8332a094b2db86dd596d1ff/src/main/java/net/sourceforge/jwbf/mediawiki/actions/queries/BaseQuery.java#L101-L113
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/reference/AtomicSharedReference.java
AtomicSharedReference.map
public synchronized @Nullable <Z> Z map(Function<T, Z> f) { if (ref == null) { return f.apply(null); } else { return f.apply(ref.get()); } }
java
public synchronized @Nullable <Z> Z map(Function<T, Z> f) { if (ref == null) { return f.apply(null); } else { return f.apply(ref.get()); } }
[ "public", "synchronized", "@", "Nullable", "<", "Z", ">", "Z", "map", "(", "Function", "<", "T", ",", "Z", ">", "f", ")", "{", "if", "(", "ref", "==", "null", ")", "{", "return", "f", ".", "apply", "(", "null", ")", ";", "}", "else", "{", "re...
Call some function f on the reference we are storing. Saving the value of T after this call returns is COMPLETELY UNSAFE. Don't do it. @param f lambda(T x) @param <Z> Return type; &lt;? extends Object&gt; @return result of f
[ "Call", "some", "function", "f", "on", "the", "reference", "we", "are", "storing", ".", "Saving", "the", "value", "of", "T", "after", "this", "call", "returns", "is", "COMPLETELY", "UNSAFE", ".", "Don", "t", "do", "it", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/reference/AtomicSharedReference.java#L131-L137
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/reference/AtomicSharedReference.java
AtomicSharedReference.mapWithCopy
public @Nullable <Z> Z mapWithCopy(Function<T, Z> f) throws IOException { final @Nullable SharedReference<T> localRef = getCopy(); try { if (localRef == null) { return f.apply(null); } else { return f.apply(localRef.get()); } } ...
java
public @Nullable <Z> Z mapWithCopy(Function<T, Z> f) throws IOException { final @Nullable SharedReference<T> localRef = getCopy(); try { if (localRef == null) { return f.apply(null); } else { return f.apply(localRef.get()); } } ...
[ "public", "@", "Nullable", "<", "Z", ">", "Z", "mapWithCopy", "(", "Function", "<", "T", ",", "Z", ">", "f", ")", "throws", "IOException", "{", "final", "@", "Nullable", "SharedReference", "<", "T", ">", "localRef", "=", "getCopy", "(", ")", ";", "tr...
Call some function f on a threadsafe copy of the reference we are storing. Should be used if you expect the function to take a while to run. Saving the value of T after this call returns is COMPLETELY UNSAFE. Don't do it. @param f lambda(T x) @param <Z> Return type; &lt;? extends Object&gt; @return result of f @thro...
[ "Call", "some", "function", "f", "on", "a", "threadsafe", "copy", "of", "the", "reference", "we", "are", "storing", ".", "Should", "be", "used", "if", "you", "expect", "the", "function", "to", "take", "a", "while", "to", "run", ".", "Saving", "the", "v...
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/reference/AtomicSharedReference.java#L149-L160
train
indeedeng/util
io/src/main/java/com/indeed/util/io/Files.java
Files.writeDataToTempFileOrDie
@Nonnull private static File writeDataToTempFileOrDie(@Nonnull final OutputStreamCallback callback, @Nonnull final File targetFile, @Nonnull final Logger log) throws IOException { Preconditions.checkNotNull...
java
@Nonnull private static File writeDataToTempFileOrDie(@Nonnull final OutputStreamCallback callback, @Nonnull final File targetFile, @Nonnull final Logger log) throws IOException { Preconditions.checkNotNull...
[ "@", "Nonnull", "private", "static", "File", "writeDataToTempFileOrDie", "(", "@", "Nonnull", "final", "OutputStreamCallback", "callback", ",", "@", "Nonnull", "final", "File", "targetFile", ",", "@", "Nonnull", "final", "Logger", "log", ")", "throws", "IOExceptio...
return a reference to a temp file that contains the written + flushed + fsynced + closed data
[ "return", "a", "reference", "to", "a", "temp", "file", "that", "contains", "the", "written", "+", "flushed", "+", "fsynced", "+", "closed", "data" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/Files.java#L159-L199
train
indeedeng/util
io/src/main/java/com/indeed/util/io/Files.java
Files.writeObjectToFile
@Deprecated public static boolean writeObjectToFile(Object obj, String file) { try { writeObjectToFileOrDie(obj, file, LOGGER); return true; } catch (Exception e) { LOGGER.error(e.getClass() + ": writeObjectToFile(" + file + ") encountered exception: " + e.g...
java
@Deprecated public static boolean writeObjectToFile(Object obj, String file) { try { writeObjectToFileOrDie(obj, file, LOGGER); return true; } catch (Exception e) { LOGGER.error(e.getClass() + ": writeObjectToFile(" + file + ") encountered exception: " + e.g...
[ "@", "Deprecated", "public", "static", "boolean", "writeObjectToFile", "(", "Object", "obj", ",", "String", "file", ")", "{", "try", "{", "writeObjectToFileOrDie", "(", "obj", ",", "file", ",", "LOGGER", ")", ";", "return", "true", ";", "}", "catch", "(", ...
Writes an object to a file. @return true if the file was successfully written, false otherwise @deprecated use {@link #writeObjectToFileOrDie(Object, String, org.apache.log4j.Logger)} instead
[ "Writes", "an", "object", "to", "a", "file", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/Files.java#L335-L344
train
indeedeng/util
io/src/main/java/com/indeed/util/io/Files.java
Files.arrayCompare
private static boolean arrayCompare(byte[] a, int offset1, byte[] a2, int offset2, int length) { for (int i = 0; i < length; i++) { if (a[offset1++] != a2[offset2++]) return false; } return true; }
java
private static boolean arrayCompare(byte[] a, int offset1, byte[] a2, int offset2, int length) { for (int i = 0; i < length; i++) { if (a[offset1++] != a2[offset2++]) return false; } return true; }
[ "private", "static", "boolean", "arrayCompare", "(", "byte", "[", "]", "a", ",", "int", "offset1", ",", "byte", "[", "]", "a2", ",", "int", "offset2", ",", "int", "length", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";",...
Returns true if the array chunks are equal, false otherwise.
[ "Returns", "true", "if", "the", "array", "chunks", "are", "equal", "false", "otherwise", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/Files.java#L406-L411
train
indeedeng/util
urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java
ParseUtils.parseTimestampFromUIDString
public static long parseTimestampFromUIDString(String s, final int start, final int end) { long ret = 0; for (int i = start; i < end && i < start + 9; i++) { ret <<= 5; char c = s.charAt(i); if (c >= '0' && c <= '9') { ret |= c - '0'; } els...
java
public static long parseTimestampFromUIDString(String s, final int start, final int end) { long ret = 0; for (int i = start; i < end && i < start + 9; i++) { ret <<= 5; char c = s.charAt(i); if (c >= '0' && c <= '9') { ret |= c - '0'; } els...
[ "public", "static", "long", "parseTimestampFromUIDString", "(", "String", "s", ",", "final", "int", "start", ",", "final", "int", "end", ")", "{", "long", "ret", "=", "0", ";", "for", "(", "int", "i", "=", "start", ";", "i", "<", "end", "&&", "i", ...
Parses out the timestamp portion of the uid Strings used in the logrepo
[ "Parses", "out", "the", "timestamp", "portion", "of", "the", "uid", "Strings", "used", "in", "the", "logrepo" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java#L180-L196
train
indeedeng/util
mmap/src/main/java/com/indeed/util/mmap/MMapBuffer.java
MMapBuffer.advise
public void advise(long position, long length) throws IOException { final long ap = address+position; final long a = (ap)/PAGE_SIZE*PAGE_SIZE; final long l = Math.min(length+(ap-a), address+memory.length()-ap); final int err = madvise(a, l); if (err != 0) { throw new ...
java
public void advise(long position, long length) throws IOException { final long ap = address+position; final long a = (ap)/PAGE_SIZE*PAGE_SIZE; final long l = Math.min(length+(ap-a), address+memory.length()-ap); final int err = madvise(a, l); if (err != 0) { throw new ...
[ "public", "void", "advise", "(", "long", "position", ",", "long", "length", ")", "throws", "IOException", "{", "final", "long", "ap", "=", "address", "+", "position", ";", "final", "long", "a", "=", "(", "ap", ")", "/", "PAGE_SIZE", "*", "PAGE_SIZE", "...
this is not particularly useful, the syscall takes forever
[ "this", "is", "not", "particularly", "useful", "the", "syscall", "takes", "forever" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/mmap/src/main/java/com/indeed/util/mmap/MMapBuffer.java#L162-L170
train
indeedeng/util
mmap/src/main/java/com/indeed/util/mmap/MMapBuffer.java
MMapBuffer.madviseDontNeedTrackedBuffers
@Deprecated public static void madviseDontNeedTrackedBuffers() { if (openBuffersTracker == null) { return; } openBuffersTracker.forEachOpenTrackedBuffer(new Function<MMapBuffer, Void>() { @Override public Void apply(final MMapBuffer b) { /...
java
@Deprecated public static void madviseDontNeedTrackedBuffers() { if (openBuffersTracker == null) { return; } openBuffersTracker.forEachOpenTrackedBuffer(new Function<MMapBuffer, Void>() { @Override public Void apply(final MMapBuffer b) { /...
[ "@", "Deprecated", "public", "static", "void", "madviseDontNeedTrackedBuffers", "(", ")", "{", "if", "(", "openBuffersTracker", "==", "null", ")", "{", "return", ";", "}", "openBuffersTracker", ".", "forEachOpenTrackedBuffer", "(", "new", "Function", "<", "MMapBuf...
If open buffers tracking is enabled, calls madvise with MADV_DONTNEED for all tracked buffers. If open buffers tracking is disabled, does nothing. This can reduce resident set size of the process, but may significantly affect performance. See madvise(2) for more info. DO NOT USE THIS unless you know what you're doing...
[ "If", "open", "buffers", "tracking", "is", "enabled", "calls", "madvise", "with", "MADV_DONTNEED", "for", "all", "tracked", "buffers", ".", "If", "open", "buffers", "tracking", "is", "disabled", "does", "nothing", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/mmap/src/main/java/com/indeed/util/mmap/MMapBuffer.java#L247-L261
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/DataLoadTimer.java
DataLoadTimer.isLoadedDataSuccessfullyRecently
public boolean isLoadedDataSuccessfullyRecently() { final Integer timeSinceLastError = getSecondsSinceLastFailedLoad(); final Integer timeSinceLastSuccess = getSecondsSinceLastLoad(); if (timeSinceLastSuccess == null) { return false; // never loaded data, so must be FAIL } ...
java
public boolean isLoadedDataSuccessfullyRecently() { final Integer timeSinceLastError = getSecondsSinceLastFailedLoad(); final Integer timeSinceLastSuccess = getSecondsSinceLastLoad(); if (timeSinceLastSuccess == null) { return false; // never loaded data, so must be FAIL } ...
[ "public", "boolean", "isLoadedDataSuccessfullyRecently", "(", ")", "{", "final", "Integer", "timeSinceLastError", "=", "getSecondsSinceLastFailedLoad", "(", ")", ";", "final", "Integer", "timeSinceLastSuccess", "=", "getSecondsSinceLastLoad", "(", ")", ";", "if", "(", ...
useful for artifact-based healthchecks
[ "useful", "for", "artifact", "-", "based", "healthchecks" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/DataLoadTimer.java#L64-L74
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.getQuicksortableIntArray
public static Quicksortable getQuicksortableIntArray(final int [] array) { return new Quicksortable() { public void swap(int i, int j) { int t = array[i]; array[i] = array[j]; array[j] = t; } public int compare(int a, int b) { ...
java
public static Quicksortable getQuicksortableIntArray(final int [] array) { return new Quicksortable() { public void swap(int i, int j) { int t = array[i]; array[i] = array[j]; array[j] = t; } public int compare(int a, int b) { ...
[ "public", "static", "Quicksortable", "getQuicksortableIntArray", "(", "final", "int", "[", "]", "array", ")", "{", "return", "new", "Quicksortable", "(", ")", "{", "public", "void", "swap", "(", "int", "i", ",", "int", "j", ")", "{", "int", "t", "=", "...
the sorting code contained in this class was copied from Arrays.java and then modified
[ "the", "sorting", "code", "contained", "in", "this", "class", "was", "copied", "from", "Arrays", ".", "java", "and", "then", "modified" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L15-L30
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.sort1
private static void sort1(Quicksortable q, int off, int k, int len) { // we don't care about anything >= to k if (off >= k) return; // Insertion sort on smallest arrays if (len < 7) { for (int i = off; i < len + off; i++) for (int j = i; j > off &&...
java
private static void sort1(Quicksortable q, int off, int k, int len) { // we don't care about anything >= to k if (off >= k) return; // Insertion sort on smallest arrays if (len < 7) { for (int i = off; i < len + off; i++) for (int j = i; j > off &&...
[ "private", "static", "void", "sort1", "(", "Quicksortable", "q", ",", "int", "off", ",", "int", "k", ",", "int", "len", ")", "{", "// we don't care about anything >= to k", "if", "(", "off", ">=", "k", ")", "return", ";", "// Insertion sort on smallest arrays", ...
Sorts the specified sub-array of integers into ascending order. @param q The quicksortable to sort. @param off The offset to start at. @param k The length of q. @param len The number of elements to sort.
[ "Sorts", "the", "specified", "sub", "-", "array", "of", "integers", "into", "ascending", "order", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L151-L211
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.heapSort
public static void heapSort(Quicksortable q, int size) { q = reverseQuicksortable(q); makeHeap(q, size); sortheap(q, size); }
java
public static void heapSort(Quicksortable q, int size) { q = reverseQuicksortable(q); makeHeap(q, size); sortheap(q, size); }
[ "public", "static", "void", "heapSort", "(", "Quicksortable", "q", ",", "int", "size", ")", "{", "q", "=", "reverseQuicksortable", "(", "q", ")", ";", "makeHeap", "(", "q", ",", "size", ")", ";", "sortheap", "(", "q", ",", "size", ")", ";", "}" ]
sorts the elements in q using the heapsort method @param q The quicksortable to heapsort. @param size The size of the quicksortable.
[ "sorts", "the", "elements", "in", "q", "using", "the", "heapsort", "method" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L241-L245
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.sortheap
private static void sortheap(Quicksortable q, int size) { for (int i = size-1; i >= 1; i--) { q.swap(0, i); heapifyDown(q, 0, i); } }
java
private static void sortheap(Quicksortable q, int size) { for (int i = size-1; i >= 1; i--) { q.swap(0, i); heapifyDown(q, 0, i); } }
[ "private", "static", "void", "sortheap", "(", "Quicksortable", "q", ",", "int", "size", ")", "{", "for", "(", "int", "i", "=", "size", "-", "1", ";", "i", ">=", "1", ";", "i", "--", ")", "{", "q", ".", "swap", "(", "0", ",", "i", ")", ";", ...
sorts the heap stored in q @param q The quicksortable to heapsort. @param size The size of the quicksortable.
[ "sorts", "the", "heap", "stored", "in", "q" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L253-L258
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.partialSortUsingHeap
public static void partialSortUsingHeap(Quicksortable q, int k, int size) { Quicksortable revq = reverseQuicksortable(q); makeHeap(revq, k); for (int i = k; i < size; i++) { if (q.compare(0, i) > 0) { q.swap(0, i); heapifyDown(revq, 0, k); ...
java
public static void partialSortUsingHeap(Quicksortable q, int k, int size) { Quicksortable revq = reverseQuicksortable(q); makeHeap(revq, k); for (int i = k; i < size; i++) { if (q.compare(0, i) > 0) { q.swap(0, i); heapifyDown(revq, 0, k); ...
[ "public", "static", "void", "partialSortUsingHeap", "(", "Quicksortable", "q", ",", "int", "k", ",", "int", "size", ")", "{", "Quicksortable", "revq", "=", "reverseQuicksortable", "(", "q", ")", ";", "makeHeap", "(", "revq", ",", "k", ")", ";", "for", "(...
finds the lowest k elements of q and stores them in sorted order at the beginning of q by using a heap of size k @param q The quicksortable to heapsort. @param k The number of elements to sort at the beginning of the quicksortable. @param size The size of the quicksortable.
[ "finds", "the", "lowest", "k", "elements", "of", "q", "and", "stores", "them", "in", "sorted", "order", "at", "the", "beginning", "of", "q", "by", "using", "a", "heap", "of", "size", "k" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L269-L279
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.partialHeapSort
public static void partialHeapSort(Quicksortable q, int k, int size) { makeHeap(q, size); for (int i = 0; i < k; i++) { q.swap(0, size-i-1); heapifyDown(q, 0, size-i-1); } vecswap(q, 0, size-k, k); reverse(q, k); }
java
public static void partialHeapSort(Quicksortable q, int k, int size) { makeHeap(q, size); for (int i = 0; i < k; i++) { q.swap(0, size-i-1); heapifyDown(q, 0, size-i-1); } vecswap(q, 0, size-k, k); reverse(q, k); }
[ "public", "static", "void", "partialHeapSort", "(", "Quicksortable", "q", ",", "int", "k", ",", "int", "size", ")", "{", "makeHeap", "(", "q", ",", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "k", ";", "i", "++", ")", "{"...
finds the lowest k elements of q and stores them in sorted order at the beginning of q by turning q into a heap. @param q The quicksortable to heapsort. @param k The number of elements to sort at the beginning of the quicksortable. @param size The size of the quicksortable.
[ "finds", "the", "lowest", "k", "elements", "of", "q", "and", "stores", "them", "in", "sorted", "order", "at", "the", "beginning", "of", "q", "by", "turning", "q", "into", "a", "heap", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L290-L298
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.makeHeap
public static void makeHeap(Quicksortable q, int size) { for (int i = (size-1)/2; i >= 0; i--) { heapifyDown(q, i, size); } }
java
public static void makeHeap(Quicksortable q, int size) { for (int i = (size-1)/2; i >= 0; i--) { heapifyDown(q, i, size); } }
[ "public", "static", "void", "makeHeap", "(", "Quicksortable", "q", ",", "int", "size", ")", "{", "for", "(", "int", "i", "=", "(", "size", "-", "1", ")", "/", "2", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "heapifyDown", "(", "q", ",", "...
Makes a heap with the elements [0, size) of q @param q The quicksortable to transform into a heap. @param size The size of the quicksortable.
[ "Makes", "a", "heap", "with", "the", "elements", "[", "0", "size", ")", "of", "q" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L307-L311
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.popHeap
public static void popHeap(Quicksortable q, int size) { q.swap(0, size-1); heapifyDown(q, 0, size-1); }
java
public static void popHeap(Quicksortable q, int size) { q.swap(0, size-1); heapifyDown(q, 0, size-1); }
[ "public", "static", "void", "popHeap", "(", "Quicksortable", "q", ",", "int", "size", ")", "{", "q", ".", "swap", "(", "0", ",", "size", "-", "1", ")", ";", "heapifyDown", "(", "q", ",", "0", ",", "size", "-", "1", ")", ";", "}" ]
Pops the lowest element off the heap and stores it in the last element @param q The quicksortable to heapify down. @param size The size of the quicksortable.
[ "Pops", "the", "lowest", "element", "off", "the", "heap", "and", "stores", "it", "in", "the", "last", "element" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L330-L333
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.topK
public static void topK(Quicksortable qs, int totalSize, int k) { if (k > totalSize) k = totalSize; makeHeap(qs, k); for (int i = k; i < totalSize; i++) { // compare each element to the root of the heap if (qs.compare(i, 0) > 0) { // if it's greater, swap ...
java
public static void topK(Quicksortable qs, int totalSize, int k) { if (k > totalSize) k = totalSize; makeHeap(qs, k); for (int i = k; i < totalSize; i++) { // compare each element to the root of the heap if (qs.compare(i, 0) > 0) { // if it's greater, swap ...
[ "public", "static", "void", "topK", "(", "Quicksortable", "qs", ",", "int", "totalSize", ",", "int", "k", ")", "{", "if", "(", "k", ">", "totalSize", ")", "k", "=", "totalSize", ";", "makeHeap", "(", "qs", ",", "k", ")", ";", "for", "(", "int", "...
in an unspecified order
[ "in", "an", "unspecified", "order" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L364-L377
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.binarySearch
public static int binarySearch(Quicksortable qs, int size) { int low = 0; int high = size-1; while (low <= high) { int mid = (low + high) >> 1; int cmp = qs.compare(mid, -1); if (cmp < 0) low = mid + 1; else if (cmp > 0) h...
java
public static int binarySearch(Quicksortable qs, int size) { int low = 0; int high = size-1; while (low <= high) { int mid = (low + high) >> 1; int cmp = qs.compare(mid, -1); if (cmp < 0) low = mid + 1; else if (cmp > 0) h...
[ "public", "static", "int", "binarySearch", "(", "Quicksortable", "qs", ",", "int", "size", ")", "{", "int", "low", "=", "0", ";", "int", "high", "=", "size", "-", "1", ";", "while", "(", "low", "<=", "high", ")", "{", "int", "mid", "=", "(", "low...
the compare function on Quicksortable will always pass -1 as the second index, swap function is never called
[ "the", "compare", "function", "on", "Quicksortable", "will", "always", "pass", "-", "1", "as", "the", "second", "index", "swap", "function", "is", "never", "called" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L381-L397
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/time/StoppedClock.java
StoppedClock.plus
public final long plus(final long value, @Nonnull final TimeUnit timeUnit) { return this.millis.addAndGet(timeUnit.toMillis(value)); }
java
public final long plus(final long value, @Nonnull final TimeUnit timeUnit) { return this.millis.addAndGet(timeUnit.toMillis(value)); }
[ "public", "final", "long", "plus", "(", "final", "long", "value", ",", "@", "Nonnull", "final", "TimeUnit", "timeUnit", ")", "{", "return", "this", ".", "millis", ".", "addAndGet", "(", "timeUnit", ".", "toMillis", "(", "value", ")", ")", ";", "}" ]
Add the specified amount of time to the current clock. @param value The numeric value to add to the clock after converting based on the provided {@code timeUnit}. @param timeUnit The time unit that {@code value} is measured in. @return The time after being adjusted by the provided offset.
[ "Add", "the", "specified", "amount", "of", "time", "to", "the", "current", "clock", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/time/StoppedClock.java#L48-L50
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/TreeTimer.java
TreeTimer.findMaxTime
private static long findMaxTime(Node n) { long max = Long.MIN_VALUE; for (Map.Entry<String, Node> entry : n.children.entrySet()) { max = Math.max(max, entry.getValue().time); } return max; }
java
private static long findMaxTime(Node n) { long max = Long.MIN_VALUE; for (Map.Entry<String, Node> entry : n.children.entrySet()) { max = Math.max(max, entry.getValue().time); } return max; }
[ "private", "static", "long", "findMaxTime", "(", "Node", "n", ")", "{", "long", "max", "=", "Long", ".", "MIN_VALUE", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Node", ">", "entry", ":", "n", ".", "children", ".", "entrySet", "(", "...
used for aligning output for prettier printing
[ "used", "for", "aligning", "output", "for", "prettier", "printing" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/TreeTimer.java#L58-L64
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/threads/ThreadSafeBitSet.java
ThreadSafeBitSet.and
public final void and(ThreadSafeBitSet other) { if (other.size != size) throw new IllegalArgumentException("BitSets must be of equal size"); for (int i = 0; i < bits.length; i++) { bits[i] &= other.bits[i]; } }
java
public final void and(ThreadSafeBitSet other) { if (other.size != size) throw new IllegalArgumentException("BitSets must be of equal size"); for (int i = 0; i < bits.length; i++) { bits[i] &= other.bits[i]; } }
[ "public", "final", "void", "and", "(", "ThreadSafeBitSet", "other", ")", "{", "if", "(", "other", ".", "size", "!=", "size", ")", "throw", "new", "IllegalArgumentException", "(", "\"BitSets must be of equal size\"", ")", ";", "for", "(", "int", "i", "=", "0"...
basically same as java's BitSet.and
[ "basically", "same", "as", "java", "s", "BitSet", ".", "and" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/threads/ThreadSafeBitSet.java#L86-L91
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/threads/ThreadSafeBitSet.java
ThreadSafeBitSet.or
public final void or(ThreadSafeBitSet other) { if (other.size != size) throw new IllegalArgumentException("BitSets must be of equal size"); for (int i = 0; i < bits.length; i++) { bits[i] |= other.bits[i]; } }
java
public final void or(ThreadSafeBitSet other) { if (other.size != size) throw new IllegalArgumentException("BitSets must be of equal size"); for (int i = 0; i < bits.length; i++) { bits[i] |= other.bits[i]; } }
[ "public", "final", "void", "or", "(", "ThreadSafeBitSet", "other", ")", "{", "if", "(", "other", ".", "size", "!=", "size", ")", "throw", "new", "IllegalArgumentException", "(", "\"BitSets must be of equal size\"", ")", ";", "for", "(", "int", "i", "=", "0",...
this = this | other, bitwise @param other The bit set to or with.
[ "this", "=", "this", "|", "other", "bitwise" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/threads/ThreadSafeBitSet.java#L98-L103
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/threads/ThreadSafeBitSet.java
ThreadSafeBitSet.xor
public final void xor(ThreadSafeBitSet other) { if (other.size != size) throw new IllegalArgumentException("BitSets must be of equal size"); for (int i = 0; i < bits.length; i++) { bits[i] ^= other.bits[i]; } }
java
public final void xor(ThreadSafeBitSet other) { if (other.size != size) throw new IllegalArgumentException("BitSets must be of equal size"); for (int i = 0; i < bits.length; i++) { bits[i] ^= other.bits[i]; } }
[ "public", "final", "void", "xor", "(", "ThreadSafeBitSet", "other", ")", "{", "if", "(", "other", ".", "size", "!=", "size", ")", "throw", "new", "IllegalArgumentException", "(", "\"BitSets must be of equal size\"", ")", ";", "for", "(", "int", "i", "=", "0"...
this = this ^ other, bitwise @param other The bit set to xor with.
[ "this", "=", "this", "^", "other", "bitwise" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/threads/ThreadSafeBitSet.java#L110-L115
train
indeedeng/util
io/src/main/java/com/indeed/util/io/Directories.java
Directories.count
@Nonnegative public static int count(@Nonnull final Path dir) throws IOException { try (final DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) { return Iterables.size(stream); } catch (DirectoryIteratorException ex) { // I/O error encounted during the iteration, ...
java
@Nonnegative public static int count(@Nonnull final Path dir) throws IOException { try (final DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) { return Iterables.size(stream); } catch (DirectoryIteratorException ex) { // I/O error encounted during the iteration, ...
[ "@", "Nonnegative", "public", "static", "int", "count", "(", "@", "Nonnull", "final", "Path", "dir", ")", "throws", "IOException", "{", "try", "(", "final", "DirectoryStream", "<", "Path", ">", "stream", "=", "Files", ".", "newDirectoryStream", "(", "dir", ...
Count the number of entries in a directory. @param dir directory to evaluate @return number of inodes under it. @throws IOException
[ "Count", "the", "number", "of", "entries", "in", "a", "directory", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/Directories.java#L29-L37
train
indeedeng/util
io/src/main/java/com/indeed/util/io/SafeFiles.java
SafeFiles.rename
public static void rename(final Path oldName, final Path newName) throws IOException { checkNotNull(oldName); checkNotNull(newName); final boolean sameDir = Files.isSameFile(oldName.getParent(), newName.getParent()); // rename the file Files.move(oldName, newName, StandardCopyO...
java
public static void rename(final Path oldName, final Path newName) throws IOException { checkNotNull(oldName); checkNotNull(newName); final boolean sameDir = Files.isSameFile(oldName.getParent(), newName.getParent()); // rename the file Files.move(oldName, newName, StandardCopyO...
[ "public", "static", "void", "rename", "(", "final", "Path", "oldName", ",", "final", "Path", "newName", ")", "throws", "IOException", "{", "checkNotNull", "(", "oldName", ")", ";", "checkNotNull", "(", "newName", ")", ";", "final", "boolean", "sameDir", "=",...
Perform an atomic rename of oldName -&gt; newName and fsync the containing directory. This is only truly fsync-safe if both files are in the same directory, but it will at least try to do the right thing if the files are in different directories. @param oldName original file @param newName new file @throws IOException...
[ "Perform", "an", "atomic", "rename", "of", "oldName", "-", "&gt", ";", "newName", "and", "fsync", "the", "containing", "directory", ".", "This", "is", "only", "truly", "fsync", "-", "safe", "if", "both", "files", "are", "in", "the", "same", "directory", ...
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/SafeFiles.java#L52-L67
train
indeedeng/util
io/src/main/java/com/indeed/util/io/SafeFiles.java
SafeFiles.ensureDirectoryExists
public static void ensureDirectoryExists(final Path path) throws IOException { if (Files.exists(path)) { if (!Files.isDirectory(path)) { throw new IOException("path is not a directory: " + path); } // probably should fsync parent here just to be sure, but that...
java
public static void ensureDirectoryExists(final Path path) throws IOException { if (Files.exists(path)) { if (!Files.isDirectory(path)) { throw new IOException("path is not a directory: " + path); } // probably should fsync parent here just to be sure, but that...
[ "public", "static", "void", "ensureDirectoryExists", "(", "final", "Path", "path", ")", "throws", "IOException", "{", "if", "(", "Files", ".", "exists", "(", "path", ")", ")", "{", "if", "(", "!", "Files", ".", "isDirectory", "(", "path", ")", ")", "{"...
Create a directory if it does not already exist. Fails if the path exists and is NOT a directory. Will fsync the parent directory inode. @param path path to ensure is a directory. @throws IOException In the event that the path is not a directory.
[ "Create", "a", "directory", "if", "it", "does", "not", "already", "exist", ".", "Fails", "if", "the", "path", "exists", "and", "is", "NOT", "a", "directory", ".", "Will", "fsync", "the", "parent", "directory", "inode", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/SafeFiles.java#L76-L86
train
indeedeng/util
io/src/main/java/com/indeed/util/io/SafeFiles.java
SafeFiles.fsyncRecursive
@Nonnegative public static int fsyncRecursive(final Path root) throws IOException { final FsyncingSimpleFileVisitor visitor = new FsyncingSimpleFileVisitor(); Files.walkFileTree(root, visitor); return visitor.getFileCount(); }
java
@Nonnegative public static int fsyncRecursive(final Path root) throws IOException { final FsyncingSimpleFileVisitor visitor = new FsyncingSimpleFileVisitor(); Files.walkFileTree(root, visitor); return visitor.getFileCount(); }
[ "@", "Nonnegative", "public", "static", "int", "fsyncRecursive", "(", "final", "Path", "root", ")", "throws", "IOException", "{", "final", "FsyncingSimpleFileVisitor", "visitor", "=", "new", "FsyncingSimpleFileVisitor", "(", ")", ";", "Files", ".", "walkFileTree", ...
Walk a directory tree and Fsync both Directory and File inodes. This does NOT follow symlinks and does not attempt to fsync anything other than Directory or NormalFiles. @param root directory to start the traversal. @return number of NormalFiles fsynced (not including directories). @throws IOException in the event tha...
[ "Walk", "a", "directory", "tree", "and", "Fsync", "both", "Directory", "and", "File", "inodes", ".", "This", "does", "NOT", "follow", "symlinks", "and", "does", "not", "attempt", "to", "fsync", "anything", "other", "than", "Directory", "or", "NormalFiles", "...
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/SafeFiles.java#L96-L101
train
indeedeng/util
io/src/main/java/com/indeed/util/io/SafeFiles.java
SafeFiles.fsync
public static void fsync(final Path path) throws IOException { if (! Files.isDirectory(path) && ! Files.isRegularFile(path)) { throw new IllegalArgumentException("fsync is only supported for regular files and directories: " + path); } try (final FileChannel channel = FileChannel.ope...
java
public static void fsync(final Path path) throws IOException { if (! Files.isDirectory(path) && ! Files.isRegularFile(path)) { throw new IllegalArgumentException("fsync is only supported for regular files and directories: " + path); } try (final FileChannel channel = FileChannel.ope...
[ "public", "static", "void", "fsync", "(", "final", "Path", "path", ")", "throws", "IOException", "{", "if", "(", "!", "Files", ".", "isDirectory", "(", "path", ")", "&&", "!", "Files", ".", "isRegularFile", "(", "path", ")", ")", "{", "throw", "new", ...
Fsync a single path. Please only call this on things that are Directories or NormalFiles. @param path path to fsync @throws IOException in the event that we could not fsync the provided path.
[ "Fsync", "a", "single", "path", ".", "Please", "only", "call", "this", "on", "things", "that", "are", "Directories", "or", "NormalFiles", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/SafeFiles.java#L138-L146
train
indeedeng/util
io/src/main/java/com/indeed/util/io/SafeFiles.java
SafeFiles.fsyncLineage
private static void fsyncLineage(final Path path) throws IOException { Path cursor = path.toRealPath(); while (cursor != null) { fsync(cursor); cursor = cursor.getParent(); } }
java
private static void fsyncLineage(final Path path) throws IOException { Path cursor = path.toRealPath(); while (cursor != null) { fsync(cursor); cursor = cursor.getParent(); } }
[ "private", "static", "void", "fsyncLineage", "(", "final", "Path", "path", ")", "throws", "IOException", "{", "Path", "cursor", "=", "path", ".", "toRealPath", "(", ")", ";", "while", "(", "cursor", "!=", "null", ")", "{", "fsync", "(", "cursor", ")", ...
Fsync a path and all parents all the way up to the fs root. @param path The path that we want to fsync.
[ "Fsync", "a", "path", "and", "all", "parents", "all", "the", "way", "up", "to", "the", "fs", "root", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/SafeFiles.java#L153-L159
train
indeedeng/util
io/src/main/java/com/indeed/util/io/SafeFiles.java
SafeFiles.writeUTF8
public static void writeUTF8(final String value, final Path path) throws IOException { write(value.getBytes(Charsets.UTF_8), path); }
java
public static void writeUTF8(final String value, final Path path) throws IOException { write(value.getBytes(Charsets.UTF_8), path); }
[ "public", "static", "void", "writeUTF8", "(", "final", "String", "value", ",", "final", "Path", "path", ")", "throws", "IOException", "{", "write", "(", "value", ".", "getBytes", "(", "Charsets", ".", "UTF_8", ")", ",", "path", ")", ";", "}" ]
Write the string to a temporary file, fsync the file, then atomically rename to the target path. On error it will make a best-effort to erase the temporary file. @param value string value to write to file as UTF8 bytes @param path path to write out to @throws IOException in the event that the data could not be written...
[ "Write", "the", "string", "to", "a", "temporary", "file", "fsync", "the", "file", "then", "atomically", "rename", "to", "the", "target", "path", ".", "On", "error", "it", "will", "make", "a", "best", "-", "effort", "to", "erase", "the", "temporary", "fil...
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/SafeFiles.java#L169-L171
train
indeedeng/util
io/src/main/java/com/indeed/util/io/SafeFiles.java
SafeFiles.write
public static void write(final byte[] data, final Path path) throws IOException { try (final SafeOutputStream out = createAtomicFile(path)) { out.write(ByteBuffer.wrap(data)); out.commit(); } }
java
public static void write(final byte[] data, final Path path) throws IOException { try (final SafeOutputStream out = createAtomicFile(path)) { out.write(ByteBuffer.wrap(data)); out.commit(); } }
[ "public", "static", "void", "write", "(", "final", "byte", "[", "]", "data", ",", "final", "Path", "path", ")", "throws", "IOException", "{", "try", "(", "final", "SafeOutputStream", "out", "=", "createAtomicFile", "(", "path", ")", ")", "{", "out", ".",...
Write the bytes to a temporary file, fsync the file, then atomically rename to the target path. On error it will make a best-effort to erase the temporary file. @param data binary value to write to file @param path path to write out to @throws IOException in the event that the data could not be written to the path.
[ "Write", "the", "bytes", "to", "a", "temporary", "file", "fsync", "the", "file", "then", "atomically", "rename", "to", "the", "target", "path", ".", "On", "error", "it", "will", "make", "a", "best", "-", "effort", "to", "erase", "the", "temporary", "file...
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/SafeFiles.java#L181-L186
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/NetUtils.java
NetUtils.determineHostName
@Nonnull public static String determineHostName() throws UnknownHostException { if (!OPT_HOSTNAME.isPresent()) { final String hostName = InetAddress.getLocalHost().getHostName(); if (Strings.isNullOrEmpty(hostName)) { throw new UnknownHostException("Unable to lookup l...
java
@Nonnull public static String determineHostName() throws UnknownHostException { if (!OPT_HOSTNAME.isPresent()) { final String hostName = InetAddress.getLocalHost().getHostName(); if (Strings.isNullOrEmpty(hostName)) { throw new UnknownHostException("Unable to lookup l...
[ "@", "Nonnull", "public", "static", "String", "determineHostName", "(", ")", "throws", "UnknownHostException", "{", "if", "(", "!", "OPT_HOSTNAME", ".", "isPresent", "(", ")", ")", "{", "final", "String", "hostName", "=", "InetAddress", ".", "getLocalHost", "(...
Determine the hostname of the machine that we are on. Do not allow, blank or 0.0.0.0 as valid hostnames. The host name will be save into the OPT_HOSTNAME static variable. We should not have to worry about threading, because the worst that should happen is multiple threads lookup the hostname at the same time, and its ...
[ "Determine", "the", "hostname", "of", "the", "machine", "that", "we", "are", "on", ".", "Do", "not", "allow", "blank", "or", "0", ".", "0", ".", "0", ".", "0", "as", "valid", "hostnames", ".", "The", "host", "name", "will", "be", "save", "into", "t...
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/NetUtils.java#L37-L52
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/NetUtils.java
NetUtils.determineHostName
@Nonnull public static String determineHostName(@Nonnull final String defaultValue) { checkNotNull(defaultValue, "Unable to use default value of null for hostname"); if (!OPT_HOSTNAME.isPresent()) { try { return determineHostName(); // this will get and save it. ...
java
@Nonnull public static String determineHostName(@Nonnull final String defaultValue) { checkNotNull(defaultValue, "Unable to use default value of null for hostname"); if (!OPT_HOSTNAME.isPresent()) { try { return determineHostName(); // this will get and save it. ...
[ "@", "Nonnull", "public", "static", "String", "determineHostName", "(", "@", "Nonnull", "final", "String", "defaultValue", ")", "{", "checkNotNull", "(", "defaultValue", ",", "\"Unable to use default value of null for hostname\"", ")", ";", "if", "(", "!", "OPT_HOSTNA...
Same as determineHostName, but will use default value instead of throwing UnknownHostException @param defaultValue The default hostname to use in the event one is not preset. @return The detected hostname if present, or the default value.
[ "Same", "as", "determineHostName", "but", "will", "use", "default", "value", "instead", "of", "throwing", "UnknownHostException" ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/NetUtils.java#L60-L71
train
indeedeng/util
util-core/src/main/java/com/indeed/util/core/NetUtils.java
NetUtils.determineIpAddress
@Nullable public static String determineIpAddress() throws SocketException { SocketException caughtException = null; for (final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); networkInterfaces.hasMoreElements();) { try { final N...
java
@Nullable public static String determineIpAddress() throws SocketException { SocketException caughtException = null; for (final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); networkInterfaces.hasMoreElements();) { try { final N...
[ "@", "Nullable", "public", "static", "String", "determineIpAddress", "(", ")", "throws", "SocketException", "{", "SocketException", "caughtException", "=", "null", ";", "for", "(", "final", "Enumeration", "<", "NetworkInterface", ">", "networkInterfaces", "=", "Netw...
Make a best effort to determine the IP address of this machine. @return The ip address of the machine if we could determine it. Null otherwise. @throws SocketException In the event that we fail to extract an ip from a network interface.
[ "Make", "a", "best", "effort", "to", "determine", "the", "IP", "address", "of", "this", "machine", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/NetUtils.java#L81-L109
train
indeedeng/util
varexport/src/main/java/com/indeed/util/varexport/VarExporter.java
VarExporter.forNamespace
public static synchronized VarExporter forNamespace(@Nonnull final Class<?> clazz, final boolean declaredFieldsOnly) { return getInstance(clazz.getSimpleName(), clazz, declaredFieldsOnly); }
java
public static synchronized VarExporter forNamespace(@Nonnull final Class<?> clazz, final boolean declaredFieldsOnly) { return getInstance(clazz.getSimpleName(), clazz, declaredFieldsOnly); }
[ "public", "static", "synchronized", "VarExporter", "forNamespace", "(", "@", "Nonnull", "final", "Class", "<", "?", ">", "clazz", ",", "final", "boolean", "declaredFieldsOnly", ")", "{", "return", "getInstance", "(", "clazz", ".", "getSimpleName", "(", ")", ",...
Load an exporter with a specified class. @param clazz Class type from which variables will be exported. @param declaredFieldsOnly if true, will not export any variable belonging to superclasses of {@code clazz}. @return exporter for the given class will be created if never before accessed.
[ "Load", "an", "exporter", "with", "a", "specified", "class", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/varexport/src/main/java/com/indeed/util/varexport/VarExporter.java#L88-L90
train
indeedeng/util
varexport/src/main/java/com/indeed/util/varexport/VarExporter.java
VarExporter.getValue
@SuppressWarnings("unchecked") public <T> T getValue(final String variableName) { final Variable variable = getVariable(variableName); return (variable == null) ? null : (T) variable.getValue(); }
java
@SuppressWarnings("unchecked") public <T> T getValue(final String variableName) { final Variable variable = getVariable(variableName); return (variable == null) ? null : (T) variable.getValue(); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "getValue", "(", "final", "String", "variableName", ")", "{", "final", "Variable", "variable", "=", "getVariable", "(", "variableName", ")", ";", "return", "(", "variable", "==...
Load the current value of a given variable. @param variableName The name of the variable we are looking up. @param <T> The data type of the exported variable. @return Null if the variable was not found. The value otherwise.
[ "Load", "the", "current", "value", "of", "a", "given", "variable", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/varexport/src/main/java/com/indeed/util/varexport/VarExporter.java#L324-L328
train
indeedeng/util
varexport/src/main/java/com/indeed/util/varexport/VarExporter.java
VarExporter.getVariable
@Override @SuppressWarnings("unchecked") public <T> Variable<T> getVariable(final String variableName) { final String[] subTokens = getSubVariableTokens(variableName); if (subTokens != null) { final Variable<T> sub = getSubVariable(subTokens[0], subTokens[1]); if (sub != ...
java
@Override @SuppressWarnings("unchecked") public <T> Variable<T> getVariable(final String variableName) { final String[] subTokens = getSubVariableTokens(variableName); if (subTokens != null) { final Variable<T> sub = getSubVariable(subTokens[0], subTokens[1]); if (sub != ...
[ "@", "Override", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "Variable", "<", "T", ">", "getVariable", "(", "final", "String", "variableName", ")", "{", "final", "String", "[", "]", "subTokens", "=", "getSubVariableTokens", "...
Load the dynamic variable object. @param variableName name of variable @param <T> The data type of the exported variable. @return Null if the variable was not found. The value otherwise.
[ "Load", "the", "dynamic", "variable", "object", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/varexport/src/main/java/com/indeed/util/varexport/VarExporter.java#L336-L351
train
indeedeng/util
varexport/src/main/java/com/indeed/util/varexport/VarExporter.java
VarExporter.visitVariables
@Override public void visitVariables(VariableVisitor visitor) { // build a collection of live variables in a synchronized block final List<Variable> variablesCopy; synchronized (variables) { variablesCopy = Lists.newArrayListWithExpectedSize(variables.size()); final I...
java
@Override public void visitVariables(VariableVisitor visitor) { // build a collection of live variables in a synchronized block final List<Variable> variablesCopy; synchronized (variables) { variablesCopy = Lists.newArrayListWithExpectedSize(variables.size()); final I...
[ "@", "Override", "public", "void", "visitVariables", "(", "VariableVisitor", "visitor", ")", "{", "// build a collection of live variables in a synchronized block", "final", "List", "<", "Variable", ">", "variablesCopy", ";", "synchronized", "(", "variables", ")", "{", ...
Visit all the values exported by this exporter. @param visitor visitor to receive visit callbacks
[ "Visit", "all", "the", "values", "exported", "by", "this", "exporter", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/varexport/src/main/java/com/indeed/util/varexport/VarExporter.java#L357-L395
train
indeedeng/util
varexport/src/main/java/com/indeed/util/varexport/VarExporter.java
VarExporter.dumpJson
public void dumpJson(final PrintWriter out) { out.append("{"); visitVariables(new Visitor() { int count = 0; public void visit(Variable var) { if (count++ > 0) { out.append(", "); } out.append(var.getName()).append("='").append(String.valueOf(var....
java
public void dumpJson(final PrintWriter out) { out.append("{"); visitVariables(new Visitor() { int count = 0; public void visit(Variable var) { if (count++ > 0) { out.append(", "); } out.append(var.getName()).append("='").append(String.valueOf(var....
[ "public", "void", "dumpJson", "(", "final", "PrintWriter", "out", ")", "{", "out", ".", "append", "(", "\"{\"", ")", ";", "visitVariables", "(", "new", "Visitor", "(", ")", "{", "int", "count", "=", "0", ";", "public", "void", "visit", "(", "Variable",...
Write all variables as a JSON object. Will not escape names or values. All values are written as Strings. @param out writer
[ "Write", "all", "variables", "as", "a", "JSON", "object", ".", "Will", "not", "escape", "names", "or", "values", ".", "All", "values", "are", "written", "as", "Strings", "." ]
332008426cf14b57e7fc3e817d9423e3f84fb922
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/varexport/src/main/java/com/indeed/util/varexport/VarExporter.java#L427-L438
train
la-team/light-admin
lightadmin-core/src/main/java/org/lightadmin/core/persistence/support/DynamicDomainObjectMerger.java
DynamicDomainObjectMerger.merge
@Override public void merge(final Object from, final Object target, final NullHandlingPolicy nullPolicy) { if (from == null || target == null) { return; } final BeanWrapper fromWrapper = beanWrapper(from); final BeanWrapper targetWrapper = beanWrapper(target); f...
java
@Override public void merge(final Object from, final Object target, final NullHandlingPolicy nullPolicy) { if (from == null || target == null) { return; } final BeanWrapper fromWrapper = beanWrapper(from); final BeanWrapper targetWrapper = beanWrapper(target); f...
[ "@", "Override", "public", "void", "merge", "(", "final", "Object", "from", ",", "final", "Object", "target", ",", "final", "NullHandlingPolicy", "nullPolicy", ")", "{", "if", "(", "from", "==", "null", "||", "target", "==", "null", ")", "{", "return", "...
Merges the given target object into the source one. @param from can be {@literal null}. @param target can be {@literal null}. @param nullPolicy how to handle {@literal null} values in the source object.
[ "Merges", "the", "given", "target", "object", "into", "the", "source", "one", "." ]
2d8875f3dcfb0ed10fcabd92be50d36032f28bf3
https://github.com/la-team/light-admin/blob/2d8875f3dcfb0ed10fcabd92be50d36032f28bf3/lightadmin-core/src/main/java/org/lightadmin/core/persistence/support/DynamicDomainObjectMerger.java#L59-L131
train
dnsjava/dnsjava
org/xbill/DNS/OPTRecord.java
OPTRecord.getOptions
public List getOptions(int code) { if (options == null) return Collections.EMPTY_LIST; List list = Collections.EMPTY_LIST; for (Iterator it = options.iterator(); it.hasNext(); ) { EDNSOption opt = (EDNSOption) it.next(); if (opt.getCode() == code) { if (list == Collections.EMPTY_LIST) list = new ArrayLi...
java
public List getOptions(int code) { if (options == null) return Collections.EMPTY_LIST; List list = Collections.EMPTY_LIST; for (Iterator it = options.iterator(); it.hasNext(); ) { EDNSOption opt = (EDNSOption) it.next(); if (opt.getCode() == code) { if (list == Collections.EMPTY_LIST) list = new ArrayLi...
[ "public", "List", "getOptions", "(", "int", "code", ")", "{", "if", "(", "options", "==", "null", ")", "return", "Collections", ".", "EMPTY_LIST", ";", "List", "list", "=", "Collections", ".", "EMPTY_LIST", ";", "for", "(", "Iterator", "it", "=", "option...
Gets all options in the OPTRecord with a specific code. This returns a list of EDNSOptions.
[ "Gets", "all", "options", "in", "the", "OPTRecord", "with", "a", "specific", "code", ".", "This", "returns", "a", "list", "of", "EDNSOptions", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/OPTRecord.java#L175-L189
train
dnsjava/dnsjava
org/xbill/DNS/Zone.java
Zone.findExactMatch
public RRset findExactMatch(Name name, int type) { Object types = exactName(name); if (types == null) return null; return oneRRset(types, type); }
java
public RRset findExactMatch(Name name, int type) { Object types = exactName(name); if (types == null) return null; return oneRRset(types, type); }
[ "public", "RRset", "findExactMatch", "(", "Name", "name", ",", "int", "type", ")", "{", "Object", "types", "=", "exactName", "(", "name", ")", ";", "if", "(", "types", "==", "null", ")", "return", "null", ";", "return", "oneRRset", "(", "types", ",", ...
Looks up Records in the zone, finding exact matches only. @param name The name to look up @param type The type to look up @return The matching RRset @see RRset
[ "Looks", "up", "Records", "in", "the", "zone", "finding", "exact", "matches", "only", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Zone.java#L444-L450
train
dnsjava/dnsjava
org/xbill/DNS/Zone.java
Zone.addRRset
public void addRRset(RRset rrset) { Name name = rrset.getName(); addRRset(name, rrset); }
java
public void addRRset(RRset rrset) { Name name = rrset.getName(); addRRset(name, rrset); }
[ "public", "void", "addRRset", "(", "RRset", "rrset", ")", "{", "Name", "name", "=", "rrset", ".", "getName", "(", ")", ";", "addRRset", "(", "name", ",", "rrset", ")", ";", "}" ]
Adds an RRset to the Zone @param rrset The RRset to be added @see RRset
[ "Adds", "an", "RRset", "to", "the", "Zone" ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Zone.java#L457-L461
train
dnsjava/dnsjava
org/xbill/DNS/Zone.java
Zone.addRecord
public void addRecord(Record r) { Name name = r.getName(); int rtype = r.getRRsetType(); synchronized (this) { RRset rrset = findRRset(name, rtype); if (rrset == null) { rrset = new RRset(r); addRRset(name, rrset); } else { rrset.addRR(r); } } }
java
public void addRecord(Record r) { Name name = r.getName(); int rtype = r.getRRsetType(); synchronized (this) { RRset rrset = findRRset(name, rtype); if (rrset == null) { rrset = new RRset(r); addRRset(name, rrset); } else { rrset.addRR(r); } } }
[ "public", "void", "addRecord", "(", "Record", "r", ")", "{", "Name", "name", "=", "r", ".", "getName", "(", ")", ";", "int", "rtype", "=", "r", ".", "getRRsetType", "(", ")", ";", "synchronized", "(", "this", ")", "{", "RRset", "rrset", "=", "findR...
Adds a Record to the Zone @param r The record to be added @see Record
[ "Adds", "a", "Record", "to", "the", "Zone" ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Zone.java#L468-L481
train
dnsjava/dnsjava
org/xbill/DNS/Zone.java
Zone.removeRecord
public void removeRecord(Record r) { Name name = r.getName(); int rtype = r.getRRsetType(); synchronized (this) { RRset rrset = findRRset(name, rtype); if (rrset == null) return; if (rrset.size() == 1 && rrset.first().equals(r)) removeRRset(name, rtype); else rrset.deleteRR(r); } }
java
public void removeRecord(Record r) { Name name = r.getName(); int rtype = r.getRRsetType(); synchronized (this) { RRset rrset = findRRset(name, rtype); if (rrset == null) return; if (rrset.size() == 1 && rrset.first().equals(r)) removeRRset(name, rtype); else rrset.deleteRR(r); } }
[ "public", "void", "removeRecord", "(", "Record", "r", ")", "{", "Name", "name", "=", "r", ".", "getName", "(", ")", ";", "int", "rtype", "=", "r", ".", "getRRsetType", "(", ")", ";", "synchronized", "(", "this", ")", "{", "RRset", "rrset", "=", "fi...
Removes a record from the Zone @param r The record to be removed @see Record
[ "Removes", "a", "record", "from", "the", "Zone" ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Zone.java#L488-L501
train
dnsjava/dnsjava
org/xbill/DNS/Zone.java
Zone.toMasterFile
public synchronized String toMasterFile() { Iterator zentries = data.entrySet().iterator(); StringBuffer sb = new StringBuffer(); nodeToString(sb, originNode); while (zentries.hasNext()) { Map.Entry entry = (Map.Entry) zentries.next(); if (!origin.equals(entry.getKey())) nodeToString(sb, entry.getValue()); ...
java
public synchronized String toMasterFile() { Iterator zentries = data.entrySet().iterator(); StringBuffer sb = new StringBuffer(); nodeToString(sb, originNode); while (zentries.hasNext()) { Map.Entry entry = (Map.Entry) zentries.next(); if (!origin.equals(entry.getKey())) nodeToString(sb, entry.getValue()); ...
[ "public", "synchronized", "String", "toMasterFile", "(", ")", "{", "Iterator", "zentries", "=", "data", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "nodeToString", "(", "sb", ...
Returns the contents of the Zone in master file format.
[ "Returns", "the", "contents", "of", "the", "Zone", "in", "master", "file", "format", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Zone.java#L538-L549
train
dnsjava/dnsjava
org/xbill/DNS/utils/base64.java
base64.formatString
public static String formatString(byte [] b, int lineLength, String prefix, boolean addClose) { String s = toString(b); StringBuffer sb = new StringBuffer(); for (int i = 0; i < s.length(); i += lineLength) { sb.append (prefix); if (i + lineLength >= s.length()) { sb.append(s.substring(i)); if (addClose) ...
java
public static String formatString(byte [] b, int lineLength, String prefix, boolean addClose) { String s = toString(b); StringBuffer sb = new StringBuffer(); for (int i = 0; i < s.length(); i += lineLength) { sb.append (prefix); if (i + lineLength >= s.length()) { sb.append(s.substring(i)); if (addClose) ...
[ "public", "static", "String", "formatString", "(", "byte", "[", "]", "b", ",", "int", "lineLength", ",", "String", "prefix", ",", "boolean", "addClose", ")", "{", "String", "s", "=", "toString", "(", "b", ")", ";", "StringBuffer", "sb", "=", "new", "St...
Formats data into a nicely formatted base64 encoded String @param b An array containing binary data @param lineLength The number of characters per line @param prefix A string prefixing the characters on each line @param addClose Whether to add a close parenthesis or not @return A String representing the formatted outpu...
[ "Formats", "data", "into", "a", "nicely", "formatted", "base64", "encoded", "String" ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/utils/base64.java#L69-L86
train
dnsjava/dnsjava
org/xbill/DNS/utils/base64.java
base64.fromString
public static byte [] fromString(String str) { ByteArrayOutputStream bs = new ByteArrayOutputStream(); byte [] raw = str.getBytes(); for (int i = 0; i < raw.length; i++) { if (!Character.isWhitespace((char)raw[i])) bs.write(raw[i]); } byte [] in = bs.toByteArray(); if (in.length % 4 != 0) { return null; }...
java
public static byte [] fromString(String str) { ByteArrayOutputStream bs = new ByteArrayOutputStream(); byte [] raw = str.getBytes(); for (int i = 0; i < raw.length; i++) { if (!Character.isWhitespace((char)raw[i])) bs.write(raw[i]); } byte [] in = bs.toByteArray(); if (in.length % 4 != 0) { return null; }...
[ "public", "static", "byte", "[", "]", "fromString", "(", "String", "str", ")", "{", "ByteArrayOutputStream", "bs", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "byte", "[", "]", "raw", "=", "str", ".", "getBytes", "(", ")", ";", "for", "(", "int...
Convert a base64-encoded String to binary data @param str A String containing the encoded data @return An array containing the binary data, or null if the string is invalid
[ "Convert", "a", "base64", "-", "encoded", "String", "to", "binary", "data" ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/utils/base64.java#L94-L143
train
dnsjava/dnsjava
org/xbill/DNS/TTL.java
TTL.parse
public static long parse(String s, boolean clamp) { if (s == null || s.length() == 0 || !Character.isDigit(s.charAt(0))) throw new NumberFormatException(); long value = 0; long ttl = 0; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); long oldvalue = value; if (Character.isDigit(c)) { value =...
java
public static long parse(String s, boolean clamp) { if (s == null || s.length() == 0 || !Character.isDigit(s.charAt(0))) throw new NumberFormatException(); long value = 0; long ttl = 0; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); long oldvalue = value; if (Character.isDigit(c)) { value =...
[ "public", "static", "long", "parse", "(", "String", "s", ",", "boolean", "clamp", ")", "{", "if", "(", "s", "==", "null", "||", "s", ".", "length", "(", ")", "==", "0", "||", "!", "Character", ".", "isDigit", "(", "s", ".", "charAt", "(", "0", ...
Parses a TTL-like value, which can either be expressed as a number or a BIND-style string with numbers and units. @param s The string representing the numeric value. @param clamp Whether to clamp values in the range [MAX_VALUE + 1, 2^32 -1] to MAX_VALUE. This should be donw for TTLs, but not other values which can be ...
[ "Parses", "a", "TTL", "-", "like", "value", "which", "can", "either", "be", "expressed", "as", "a", "number", "or", "a", "BIND", "-", "style", "string", "with", "numbers", "and", "units", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/TTL.java#L36-L72
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.newQuery
public static Message newQuery(Record r) { Message m = new Message(); m.header.setOpcode(Opcode.QUERY); m.header.setFlag(Flags.RD); m.addRecord(r, Section.QUESTION); return m; }
java
public static Message newQuery(Record r) { Message m = new Message(); m.header.setOpcode(Opcode.QUERY); m.header.setFlag(Flags.RD); m.addRecord(r, Section.QUESTION); return m; }
[ "public", "static", "Message", "newQuery", "(", "Record", "r", ")", "{", "Message", "m", "=", "new", "Message", "(", ")", ";", "m", ".", "header", ".", "setOpcode", "(", "Opcode", ".", "QUERY", ")", ";", "m", ".", "header", ".", "setFlag", "(", "Fl...
Creates a new Message with a random Message ID suitable for sending as a query. @param r A record containing the question
[ "Creates", "a", "new", "Message", "with", "a", "random", "Message", "ID", "suitable", "for", "sending", "as", "a", "query", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L80-L87
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.addRecord
public void addRecord(Record r, int section) { if (sections[section] == null) sections[section] = new LinkedList(); header.incCount(section); sections[section].add(r); }
java
public void addRecord(Record r, int section) { if (sections[section] == null) sections[section] = new LinkedList(); header.incCount(section); sections[section].add(r); }
[ "public", "void", "addRecord", "(", "Record", "r", ",", "int", "section", ")", "{", "if", "(", "sections", "[", "section", "]", "==", "null", ")", "sections", "[", "section", "]", "=", "new", "LinkedList", "(", ")", ";", "header", ".", "incCount", "(...
Adds a record to a section of the Message, and adjusts the header. @see Record @see Section
[ "Adds", "a", "record", "to", "a", "section", "of", "the", "Message", "and", "adjusts", "the", "header", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L171-L177
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.removeRecord
public boolean removeRecord(Record r, int section) { if (sections[section] != null && sections[section].remove(r)) { header.decCount(section); return true; } else return false; }
java
public boolean removeRecord(Record r, int section) { if (sections[section] != null && sections[section].remove(r)) { header.decCount(section); return true; } else return false; }
[ "public", "boolean", "removeRecord", "(", "Record", "r", ",", "int", "section", ")", "{", "if", "(", "sections", "[", "section", "]", "!=", "null", "&&", "sections", "[", "section", "]", ".", "remove", "(", "r", ")", ")", "{", "header", ".", "decCoun...
Removes a record from a section of the Message, and adjusts the header. @see Record @see Section
[ "Removes", "a", "record", "from", "a", "section", "of", "the", "Message", "and", "adjusts", "the", "header", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L184-L192
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.findRecord
public boolean findRecord(Record r, int section) { return (sections[section] != null && sections[section].contains(r)); }
java
public boolean findRecord(Record r, int section) { return (sections[section] != null && sections[section].contains(r)); }
[ "public", "boolean", "findRecord", "(", "Record", "r", ",", "int", "section", ")", "{", "return", "(", "sections", "[", "section", "]", "!=", "null", "&&", "sections", "[", "section", "]", ".", "contains", "(", "r", ")", ")", ";", "}" ]
Determines if the given record is already present in the given section. @see Record @see Section
[ "Determines", "if", "the", "given", "record", "is", "already", "present", "in", "the", "given", "section", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L210-L213
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.findRecord
public boolean findRecord(Record r) { for (int i = Section.ANSWER; i <= Section.ADDITIONAL; i++) if (sections[i] != null && sections[i].contains(r)) return true; return false; }
java
public boolean findRecord(Record r) { for (int i = Section.ANSWER; i <= Section.ADDITIONAL; i++) if (sections[i] != null && sections[i].contains(r)) return true; return false; }
[ "public", "boolean", "findRecord", "(", "Record", "r", ")", "{", "for", "(", "int", "i", "=", "Section", ".", "ANSWER", ";", "i", "<=", "Section", ".", "ADDITIONAL", ";", "i", "++", ")", "if", "(", "sections", "[", "i", "]", "!=", "null", "&&", "...
Determines if the given record is already present in any section. @see Record @see Section
[ "Determines", "if", "the", "given", "record", "is", "already", "present", "in", "any", "section", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L220-L226
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.findRRset
public boolean findRRset(Name name, int type, int section) { if (sections[section] == null) return false; for (int i = 0; i < sections[section].size(); i++) { Record r = (Record) sections[section].get(i); if (r.getType() == type && name.equals(r.getName())) return true; } return false; }
java
public boolean findRRset(Name name, int type, int section) { if (sections[section] == null) return false; for (int i = 0; i < sections[section].size(); i++) { Record r = (Record) sections[section].get(i); if (r.getType() == type && name.equals(r.getName())) return true; } return false; }
[ "public", "boolean", "findRRset", "(", "Name", "name", ",", "int", "type", ",", "int", "section", ")", "{", "if", "(", "sections", "[", "section", "]", "==", "null", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s...
Determines if an RRset with the given name and type is already present in the given section. @see RRset @see Section
[ "Determines", "if", "an", "RRset", "with", "the", "given", "name", "and", "type", "is", "already", "present", "in", "the", "given", "section", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L234-L244
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.findRRset
public boolean findRRset(Name name, int type) { return (findRRset(name, type, Section.ANSWER) || findRRset(name, type, Section.AUTHORITY) || findRRset(name, type, Section.ADDITIONAL)); }
java
public boolean findRRset(Name name, int type) { return (findRRset(name, type, Section.ANSWER) || findRRset(name, type, Section.AUTHORITY) || findRRset(name, type, Section.ADDITIONAL)); }
[ "public", "boolean", "findRRset", "(", "Name", "name", ",", "int", "type", ")", "{", "return", "(", "findRRset", "(", "name", ",", "type", ",", "Section", ".", "ANSWER", ")", "||", "findRRset", "(", "name", ",", "type", ",", "Section", ".", "AUTHORITY"...
Determines if an RRset with the given name and type is already present in any section. @see RRset @see Section
[ "Determines", "if", "an", "RRset", "with", "the", "given", "name", "and", "type", "is", "already", "present", "in", "any", "section", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L252-L257
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.getQuestion
public Record getQuestion() { List l = sections[Section.QUESTION]; if (l == null || l.size() == 0) return null; return (Record) l.get(0); }
java
public Record getQuestion() { List l = sections[Section.QUESTION]; if (l == null || l.size() == 0) return null; return (Record) l.get(0); }
[ "public", "Record", "getQuestion", "(", ")", "{", "List", "l", "=", "sections", "[", "Section", ".", "QUESTION", "]", ";", "if", "(", "l", "==", "null", "||", "l", ".", "size", "(", ")", "==", "0", ")", "return", "null", ";", "return", "(", "Reco...
Returns the first record in the QUESTION section. @see Record @see Section
[ "Returns", "the", "first", "record", "in", "the", "QUESTION", "section", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L264-L270
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.getTSIG
public TSIGRecord getTSIG() { int count = header.getCount(Section.ADDITIONAL); if (count == 0) return null; List l = sections[Section.ADDITIONAL]; Record rec = (Record) l.get(count - 1); if (rec.type != Type.TSIG) return null; return (TSIGRecord) rec; }
java
public TSIGRecord getTSIG() { int count = header.getCount(Section.ADDITIONAL); if (count == 0) return null; List l = sections[Section.ADDITIONAL]; Record rec = (Record) l.get(count - 1); if (rec.type != Type.TSIG) return null; return (TSIGRecord) rec; }
[ "public", "TSIGRecord", "getTSIG", "(", ")", "{", "int", "count", "=", "header", ".", "getCount", "(", "Section", ".", "ADDITIONAL", ")", ";", "if", "(", "count", "==", "0", ")", "return", "null", ";", "List", "l", "=", "sections", "[", "Section", "....
Returns the TSIG record from the ADDITIONAL section, if one is present. @see TSIGRecord @see TSIG @see Section
[ "Returns", "the", "TSIG", "record", "from", "the", "ADDITIONAL", "section", "if", "one", "is", "present", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L278-L288
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.getOPT
public OPTRecord getOPT() { Record [] additional = getSectionArray(Section.ADDITIONAL); for (int i = 0; i < additional.length; i++) if (additional[i] instanceof OPTRecord) return (OPTRecord) additional[i]; return null; }
java
public OPTRecord getOPT() { Record [] additional = getSectionArray(Section.ADDITIONAL); for (int i = 0; i < additional.length; i++) if (additional[i] instanceof OPTRecord) return (OPTRecord) additional[i]; return null; }
[ "public", "OPTRecord", "getOPT", "(", ")", "{", "Record", "[", "]", "additional", "=", "getSectionArray", "(", "Section", ".", "ADDITIONAL", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "additional", ".", "length", ";", "i", "++", ")", ...
Returns the OPT record from the ADDITIONAL section, if one is present. @see OPTRecord @see Section
[ "Returns", "the", "OPT", "record", "from", "the", "ADDITIONAL", "section", "if", "one", "is", "present", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L315-L322
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.getSectionArray
public Record [] getSectionArray(int section) { if (sections[section] == null) return emptyRecordArray; List l = sections[section]; return (Record []) l.toArray(new Record[l.size()]); }
java
public Record [] getSectionArray(int section) { if (sections[section] == null) return emptyRecordArray; List l = sections[section]; return (Record []) l.toArray(new Record[l.size()]); }
[ "public", "Record", "[", "]", "getSectionArray", "(", "int", "section", ")", "{", "if", "(", "sections", "[", "section", "]", "==", "null", ")", "return", "emptyRecordArray", ";", "List", "l", "=", "sections", "[", "section", "]", ";", "return", "(", "...
Returns an array containing all records in the given section, or an empty array if the section is empty. @see Record @see Section
[ "Returns", "an", "array", "containing", "all", "records", "in", "the", "given", "section", "or", "an", "empty", "array", "if", "the", "section", "is", "empty", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L343-L349
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.getSectionRRsets
public RRset [] getSectionRRsets(int section) { if (sections[section] == null) return emptyRRsetArray; List sets = new LinkedList(); Record [] recs = getSectionArray(section); Set hash = new HashSet(); for (int i = 0; i < recs.length; i++) { Name name = recs[i].getName(); boolean newset = true; if (hash.co...
java
public RRset [] getSectionRRsets(int section) { if (sections[section] == null) return emptyRRsetArray; List sets = new LinkedList(); Record [] recs = getSectionArray(section); Set hash = new HashSet(); for (int i = 0; i < recs.length; i++) { Name name = recs[i].getName(); boolean newset = true; if (hash.co...
[ "public", "RRset", "[", "]", "getSectionRRsets", "(", "int", "section", ")", "{", "if", "(", "sections", "[", "section", "]", "==", "null", ")", "return", "emptyRRsetArray", ";", "List", "sets", "=", "new", "LinkedList", "(", ")", ";", "Record", "[", "...
Returns an array containing all records in the given section grouped into RRsets. @see RRset @see Section
[ "Returns", "an", "array", "containing", "all", "records", "in", "the", "given", "section", "grouped", "into", "RRsets", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L364-L394
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.toWire
public byte [] toWire() { DNSOutput out = new DNSOutput(); toWire(out); size = out.current(); return out.toByteArray(); }
java
public byte [] toWire() { DNSOutput out = new DNSOutput(); toWire(out); size = out.current(); return out.toByteArray(); }
[ "public", "byte", "[", "]", "toWire", "(", ")", "{", "DNSOutput", "out", "=", "new", "DNSOutput", "(", ")", ";", "toWire", "(", "out", ")", ";", "size", "=", "out", ".", "current", "(", ")", ";", "return", "out", ".", "toByteArray", "(", ")", ";"...
Returns an array containing the wire format representation of the Message.
[ "Returns", "an", "array", "containing", "the", "wire", "format", "representation", "of", "the", "Message", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L508-L514
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.setTSIG
public void setTSIG(TSIG key, int error, TSIGRecord querytsig) { this.tsigkey = key; this.tsigerror = error; this.querytsig = querytsig; }
java
public void setTSIG(TSIG key, int error, TSIGRecord querytsig) { this.tsigkey = key; this.tsigerror = error; this.querytsig = querytsig; }
[ "public", "void", "setTSIG", "(", "TSIG", "key", ",", "int", "error", ",", "TSIGRecord", "querytsig", ")", "{", "this", ".", "tsigkey", "=", "key", ";", "this", ".", "tsigerror", "=", "error", ";", "this", ".", "querytsig", "=", "querytsig", ";", "}" ]
Sets the TSIG key and other necessary information to sign a message. @param key The TSIG key. @param error The value of the TSIG error field. @param querytsig If this is a response, the TSIG from the request.
[ "Sets", "the", "TSIG", "key", "and", "other", "necessary", "information", "to", "sign", "a", "message", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L543-L548
train
dnsjava/dnsjava
org/xbill/DNS/Message.java
Message.sectionToString
public String sectionToString(int i) { if (i > 3) return null; StringBuffer sb = new StringBuffer(); Record [] records = getSectionArray(i); for (int j = 0; j < records.length; j++) { Record rec = records[j]; if (i == Section.QUESTION) { sb.append(";;\t" + rec.name); sb.append(", type = " + Type.strin...
java
public String sectionToString(int i) { if (i > 3) return null; StringBuffer sb = new StringBuffer(); Record [] records = getSectionArray(i); for (int j = 0; j < records.length; j++) { Record rec = records[j]; if (i == Section.QUESTION) { sb.append(";;\t" + rec.name); sb.append(", type = " + Type.strin...
[ "public", "String", "sectionToString", "(", "int", "i", ")", "{", "if", "(", "i", ">", "3", ")", "return", "null", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "Record", "[", "]", "records", "=", "getSectionArray", "(", "i", ...
Converts the given section of the Message to a String. @see Section
[ "Converts", "the", "given", "section", "of", "the", "Message", "to", "a", "String", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L563-L583
train
dnsjava/dnsjava
org/xbill/DNS/TXTBase.java
TXTBase.rrToString
String rrToString() { StringBuffer sb = new StringBuffer(); Iterator it = strings.iterator(); while (it.hasNext()) { byte [] array = (byte []) it.next(); sb.append(byteArrayToString(array, true)); if (it.hasNext()) sb.append(" "); } return sb.toString(); }
java
String rrToString() { StringBuffer sb = new StringBuffer(); Iterator it = strings.iterator(); while (it.hasNext()) { byte [] array = (byte []) it.next(); sb.append(byteArrayToString(array, true)); if (it.hasNext()) sb.append(" "); } return sb.toString(); }
[ "String", "rrToString", "(", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "Iterator", "it", "=", "strings", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "byte", "[", "]", "arr...
converts to a String
[ "converts", "to", "a", "String" ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/TXTBase.java#L80-L91
train
dnsjava/dnsjava
org/xbill/DNS/ZoneTransferIn.java
ZoneTransferIn.isCurrent
public boolean isCurrent() { BasicHandler handler = getBasicHandler(); return (handler.axfr == null && handler.ixfr == null); }
java
public boolean isCurrent() { BasicHandler handler = getBasicHandler(); return (handler.axfr == null && handler.ixfr == null); }
[ "public", "boolean", "isCurrent", "(", ")", "{", "BasicHandler", "handler", "=", "getBasicHandler", "(", ")", ";", "return", "(", "handler", ".", "axfr", "==", "null", "&&", "handler", ".", "ixfr", "==", "null", ")", ";", "}" ]
Returns true if the response indicates that the zone is up to date. This will be true only if an IXFR was performed. @throws IllegalArgumentException The transfer used the callback interface, so the response was not stored.
[ "Returns", "true", "if", "the", "response", "indicates", "that", "the", "zone", "is", "up", "to", "date", ".", "This", "will", "be", "true", "only", "if", "an", "IXFR", "was", "performed", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/ZoneTransferIn.java#L672-L676
train
dnsjava/dnsjava
org/xbill/DNS/TSIG.java
TSIG.apply
public void apply(Message m, int error, TSIGRecord old) { Record r = generate(m, m.toWire(), error, old); m.addRecord(r, Section.ADDITIONAL); m.tsigState = Message.TSIG_SIGNED; }
java
public void apply(Message m, int error, TSIGRecord old) { Record r = generate(m, m.toWire(), error, old); m.addRecord(r, Section.ADDITIONAL); m.tsigState = Message.TSIG_SIGNED; }
[ "public", "void", "apply", "(", "Message", "m", ",", "int", "error", ",", "TSIGRecord", "old", ")", "{", "Record", "r", "=", "generate", "(", "m", ",", "m", ".", "toWire", "(", ")", ",", "error", ",", "old", ")", ";", "m", ".", "addRecord", "(", ...
Generates a TSIG record with a specific error for a message and adds it to the message. @param m The message @param error The error @param old If this message is a response, the TSIG from the request
[ "Generates", "a", "TSIG", "record", "with", "a", "specific", "error", "for", "a", "message", "and", "adds", "it", "to", "the", "message", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/TSIG.java#L350-L355
train
dnsjava/dnsjava
org/xbill/DNS/Mnemonic.java
Mnemonic.toInteger
public static Integer toInteger(int val) { if (val >= 0 && val < cachedInts.length) return (cachedInts[val]); return new Integer(val); }
java
public static Integer toInteger(int val) { if (val >= 0 && val < cachedInts.length) return (cachedInts[val]); return new Integer(val); }
[ "public", "static", "Integer", "toInteger", "(", "int", "val", ")", "{", "if", "(", "val", ">=", "0", "&&", "val", "<", "cachedInts", ".", "length", ")", "return", "(", "cachedInts", "[", "val", "]", ")", ";", "return", "new", "Integer", "(", "val", ...
Converts an int into a possibly cached Integer.
[ "Converts", "an", "int", "into", "a", "possibly", "cached", "Integer", "." ]
d97b6a0685d59143372bb392ab591dd8dd840b61
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Mnemonic.java#L83-L88
train