repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
jMotif/SAX
src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java
EuclideanDistance.distance2
public long distance2(int[] point1, int[] point2) throws Exception { """ Calculates the square of the Euclidean distance between two multidimensional points represented by integer vectors. @param point1 The first point. @param point2 The second point. @return The Euclidean distance. @throws Exception In the case of error. """ if (point1.length == point2.length) { long sum = 0; for (int i = 0; i < point1.length; i++) { sum = sum + (point2[i] - point1[i]) * (point2[i] - point1[i]); } return sum; } else { throw new Exception("Exception in Euclidean distance: array lengths are not equal"); } }
java
public long distance2(int[] point1, int[] point2) throws Exception { if (point1.length == point2.length) { long sum = 0; for (int i = 0; i < point1.length; i++) { sum = sum + (point2[i] - point1[i]) * (point2[i] - point1[i]); } return sum; } else { throw new Exception("Exception in Euclidean distance: array lengths are not equal"); } }
[ "public", "long", "distance2", "(", "int", "[", "]", "point1", ",", "int", "[", "]", "point2", ")", "throws", "Exception", "{", "if", "(", "point1", ".", "length", "==", "point2", ".", "length", ")", "{", "long", "sum", "=", "0", ";", "for", "(", ...
Calculates the square of the Euclidean distance between two multidimensional points represented by integer vectors. @param point1 The first point. @param point2 The second point. @return The Euclidean distance. @throws Exception In the case of error.
[ "Calculates", "the", "square", "of", "the", "Euclidean", "distance", "between", "two", "multidimensional", "points", "represented", "by", "integer", "vectors", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/distance/EuclideanDistance.java#L98-L109
jblas-project/jblas
src/main/java/org/jblas/Eigen.java
Eigen.symmetricGeneralizedEigenvalues
public static FloatMatrix symmetricGeneralizedEigenvalues(FloatMatrix A, FloatMatrix B, float vl, float vu) { """ Computes selected eigenvalues of the real generalized symmetric-definite eigenproblem of the form A x = L B x or, equivalently, (A - L B)x = 0. Here A and B are assumed to be symmetric and B is also positive definite. The selection is based on the given range of values for the desired eigenvalues. <p/> The range is half open: (vl,vu]. @param A symmetric Matrix A. Only the upper triangle will be considered. @param B symmetric Matrix B. Only the upper triangle will be considered. @param vl lower bound of the smallest eigenvalue to return @param vu upper bound of the largest eigenvalue to return @throws IllegalArgumentException if <code>vl &gt; vu</code> @throws NoEigenResultException if no eigevalues are found for the selected range: (vl,vu] @return a vector of eigenvalues L """ A.assertSquare(); B.assertSquare(); A.assertSameSize(B); if (vu <= vl) { throw new IllegalArgumentException("Bound exception: make sure vu > vl"); } float abstol = (float) 1e-9; // What is a good tolerance? int[] m = new int[1]; FloatMatrix W = new FloatMatrix(A.rows); FloatMatrix Z = new FloatMatrix(A.rows, A.rows); SimpleBlas.sygvx(1, 'N', 'V', 'U', A.dup(), B.dup(), vl, vu, 0, 0, abstol, m, W, Z); if (m[0] == 0) { throw new NoEigenResultException("No eigenvalues found for selected range"); } return W.get(new IntervalRange(0, m[0]), 0); }
java
public static FloatMatrix symmetricGeneralizedEigenvalues(FloatMatrix A, FloatMatrix B, float vl, float vu) { A.assertSquare(); B.assertSquare(); A.assertSameSize(B); if (vu <= vl) { throw new IllegalArgumentException("Bound exception: make sure vu > vl"); } float abstol = (float) 1e-9; // What is a good tolerance? int[] m = new int[1]; FloatMatrix W = new FloatMatrix(A.rows); FloatMatrix Z = new FloatMatrix(A.rows, A.rows); SimpleBlas.sygvx(1, 'N', 'V', 'U', A.dup(), B.dup(), vl, vu, 0, 0, abstol, m, W, Z); if (m[0] == 0) { throw new NoEigenResultException("No eigenvalues found for selected range"); } return W.get(new IntervalRange(0, m[0]), 0); }
[ "public", "static", "FloatMatrix", "symmetricGeneralizedEigenvalues", "(", "FloatMatrix", "A", ",", "FloatMatrix", "B", ",", "float", "vl", ",", "float", "vu", ")", "{", "A", ".", "assertSquare", "(", ")", ";", "B", ".", "assertSquare", "(", ")", ";", "A",...
Computes selected eigenvalues of the real generalized symmetric-definite eigenproblem of the form A x = L B x or, equivalently, (A - L B)x = 0. Here A and B are assumed to be symmetric and B is also positive definite. The selection is based on the given range of values for the desired eigenvalues. <p/> The range is half open: (vl,vu]. @param A symmetric Matrix A. Only the upper triangle will be considered. @param B symmetric Matrix B. Only the upper triangle will be considered. @param vl lower bound of the smallest eigenvalue to return @param vu upper bound of the largest eigenvalue to return @throws IllegalArgumentException if <code>vl &gt; vu</code> @throws NoEigenResultException if no eigevalues are found for the selected range: (vl,vu] @return a vector of eigenvalues L
[ "Computes", "selected", "eigenvalues", "of", "the", "real", "generalized", "symmetric", "-", "definite", "eigenproblem", "of", "the", "form", "A", "x", "=", "L", "B", "x", "or", "equivalently", "(", "A", "-", "L", "B", ")", "x", "=", "0", ".", "Here", ...
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/Eigen.java#L437-L453
deeplearning4j/deeplearning4j
datavec/datavec-perf/src/main/java/org/datavec/perf/timing/IOTiming.java
IOTiming.averageFileRead
public static TimingStatistics averageFileRead(long nTimes, RecordReader recordReader, File file, INDArrayCreationFunction function) throws Exception { """ Returns statistics for components of a datavec pipeline averaged over the specified number of times @param nTimes the number of times to run the pipeline for averaging @param recordReader the record reader @param file the file to read @param function the function @return the averaged {@link TimingStatistics} for input/output on a record reader and ndarray creation (based on the given function @throws Exception """ TimingStatistics timingStatistics = null; for(int i = 0; i < nTimes; i++) { TimingStatistics timingStatistics1 = timeNDArrayCreation(recordReader,new BufferedInputStream(new FileInputStream(file)),function); if(timingStatistics == null) timingStatistics = timingStatistics1; else { timingStatistics = timingStatistics.add(timingStatistics1); } } return timingStatistics.average(nTimes); }
java
public static TimingStatistics averageFileRead(long nTimes, RecordReader recordReader, File file, INDArrayCreationFunction function) throws Exception { TimingStatistics timingStatistics = null; for(int i = 0; i < nTimes; i++) { TimingStatistics timingStatistics1 = timeNDArrayCreation(recordReader,new BufferedInputStream(new FileInputStream(file)),function); if(timingStatistics == null) timingStatistics = timingStatistics1; else { timingStatistics = timingStatistics.add(timingStatistics1); } } return timingStatistics.average(nTimes); }
[ "public", "static", "TimingStatistics", "averageFileRead", "(", "long", "nTimes", ",", "RecordReader", "recordReader", ",", "File", "file", ",", "INDArrayCreationFunction", "function", ")", "throws", "Exception", "{", "TimingStatistics", "timingStatistics", "=", "null",...
Returns statistics for components of a datavec pipeline averaged over the specified number of times @param nTimes the number of times to run the pipeline for averaging @param recordReader the record reader @param file the file to read @param function the function @return the averaged {@link TimingStatistics} for input/output on a record reader and ndarray creation (based on the given function @throws Exception
[ "Returns", "statistics", "for", "components", "of", "a", "datavec", "pipeline", "averaged", "over", "the", "specified", "number", "of", "times" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-perf/src/main/java/org/datavec/perf/timing/IOTiming.java#L59-L72
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java
ExceptionSoftener.throwOrHandle
public static <X extends Throwable> void throwOrHandle(final X e, final Predicate<X> p, final Consumer<X> handler) { """ Throw the exception as upwards if the predicate holds, otherwise pass to the handler @param e Exception @param p Predicate to check exception should be thrown or not @param handler Handles exceptions that should not be thrown """ if (p.test(e)) throw ExceptionSoftener.<RuntimeException> uncheck(e); else handler.accept(e); }
java
public static <X extends Throwable> void throwOrHandle(final X e, final Predicate<X> p, final Consumer<X> handler) { if (p.test(e)) throw ExceptionSoftener.<RuntimeException> uncheck(e); else handler.accept(e); }
[ "public", "static", "<", "X", "extends", "Throwable", ">", "void", "throwOrHandle", "(", "final", "X", "e", ",", "final", "Predicate", "<", "X", ">", "p", ",", "final", "Consumer", "<", "X", ">", "handler", ")", "{", "if", "(", "p", ".", "test", "(...
Throw the exception as upwards if the predicate holds, otherwise pass to the handler @param e Exception @param p Predicate to check exception should be thrown or not @param handler Handles exceptions that should not be thrown
[ "Throw", "the", "exception", "as", "upwards", "if", "the", "predicate", "holds", "otherwise", "pass", "to", "the", "handler" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java#L692-L697
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.updateStatisticsForVBC
@Override public void updateStatisticsForVBC(com.ibm.websphere.cache.CacheEntry cacheEntry, boolean directive) { """ This method needs to change if cache provider supports PMI and CacheStatisticsListener. """ // TODO needs to change if cache provider supports PMI and CacheStatisticsListener final String methodName = "updateStatisticsForVBC()"; Object id = null; if (cacheEntry != null) { id = cacheEntry.getIdObject(); } if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id + " directive=" + directive); } }
java
@Override public void updateStatisticsForVBC(com.ibm.websphere.cache.CacheEntry cacheEntry, boolean directive) { // TODO needs to change if cache provider supports PMI and CacheStatisticsListener final String methodName = "updateStatisticsForVBC()"; Object id = null; if (cacheEntry != null) { id = cacheEntry.getIdObject(); } if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id + " directive=" + directive); } }
[ "@", "Override", "public", "void", "updateStatisticsForVBC", "(", "com", ".", "ibm", ".", "websphere", ".", "cache", ".", "CacheEntry", "cacheEntry", ",", "boolean", "directive", ")", "{", "// TODO needs to change if cache provider supports PMI and CacheStatisticsListener",...
This method needs to change if cache provider supports PMI and CacheStatisticsListener.
[ "This", "method", "needs", "to", "change", "if", "cache", "provider", "supports", "PMI", "and", "CacheStatisticsListener", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L1497-L1508
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.isTimeInRange
@SuppressWarnings("deprecation") public static boolean isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d) { """ Tells you if the date part of a datetime is in a certain time range. """ d = new java.sql.Time(d.getHours(), d.getMinutes(), d.getSeconds()); if (start == null || end == null) { return false; } if (start.before(end) && (!(d.after(start) && d.before(end)))) { return false; } if (end.before(start) && (!(d.after(end) || d.before(start)))) { return false; } return true; }
java
@SuppressWarnings("deprecation") public static boolean isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d) { d = new java.sql.Time(d.getHours(), d.getMinutes(), d.getSeconds()); if (start == null || end == null) { return false; } if (start.before(end) && (!(d.after(start) && d.before(end)))) { return false; } if (end.before(start) && (!(d.after(end) || d.before(start)))) { return false; } return true; }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "boolean", "isTimeInRange", "(", "java", ".", "sql", ".", "Time", "start", ",", "java", ".", "sql", ".", "Time", "end", ",", "java", ".", "util", ".", "Date", "d", ")", "{", "d",...
Tells you if the date part of a datetime is in a certain time range.
[ "Tells", "you", "if", "the", "date", "part", "of", "a", "datetime", "is", "in", "a", "certain", "time", "range", "." ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L410-L426
rometools/rome
rome/src/main/java/com/rometools/rome/io/impl/RSS090Parser.java
RSS090Parser.parseItem
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) { """ Parses an item element of an RSS document looking for item information. <p/> It reads title and link out of the 'item' element. <p/> @param rssRoot the root element of the RSS document in case it's needed for context. @param eItem the item element to parse. @return the parsed RSSItem bean. """ final Item item = new Item(); final Element title = eItem.getChild("title", getRSSNamespace()); if (title != null) { item.setTitle(title.getText()); } final Element link = eItem.getChild("link", getRSSNamespace()); if (link != null) { item.setLink(link.getText()); item.setUri(link.getText()); } item.setModules(parseItemModules(eItem, locale)); final List<Element> foreignMarkup = extractForeignMarkup(eItem, item, getRSSNamespace()); // content:encoded elements are treated special, without a module, they have to be removed // from the foreign markup to avoid duplication in case of read/write. Note that this fix // will break if a content module is used final Iterator<Element> iterator = foreignMarkup.iterator(); while (iterator.hasNext()) { final Element element = iterator.next(); final Namespace eNamespace = element.getNamespace(); final String eName = element.getName(); if (getContentNamespace().equals(eNamespace) && eName.equals("encoded")) { iterator.remove(); } } if (!foreignMarkup.isEmpty()) { item.setForeignMarkup(foreignMarkup); } return item; }
java
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) { final Item item = new Item(); final Element title = eItem.getChild("title", getRSSNamespace()); if (title != null) { item.setTitle(title.getText()); } final Element link = eItem.getChild("link", getRSSNamespace()); if (link != null) { item.setLink(link.getText()); item.setUri(link.getText()); } item.setModules(parseItemModules(eItem, locale)); final List<Element> foreignMarkup = extractForeignMarkup(eItem, item, getRSSNamespace()); // content:encoded elements are treated special, without a module, they have to be removed // from the foreign markup to avoid duplication in case of read/write. Note that this fix // will break if a content module is used final Iterator<Element> iterator = foreignMarkup.iterator(); while (iterator.hasNext()) { final Element element = iterator.next(); final Namespace eNamespace = element.getNamespace(); final String eName = element.getName(); if (getContentNamespace().equals(eNamespace) && eName.equals("encoded")) { iterator.remove(); } } if (!foreignMarkup.isEmpty()) { item.setForeignMarkup(foreignMarkup); } return item; }
[ "protected", "Item", "parseItem", "(", "final", "Element", "rssRoot", ",", "final", "Element", "eItem", ",", "final", "Locale", "locale", ")", "{", "final", "Item", "item", "=", "new", "Item", "(", ")", ";", "final", "Element", "title", "=", "eItem", "."...
Parses an item element of an RSS document looking for item information. <p/> It reads title and link out of the 'item' element. <p/> @param rssRoot the root element of the RSS document in case it's needed for context. @param eItem the item element to parse. @return the parsed RSSItem bean.
[ "Parses", "an", "item", "element", "of", "an", "RSS", "document", "looking", "for", "item", "information", ".", "<p", "/", ">", "It", "reads", "title", "and", "link", "out", "of", "the", "item", "element", ".", "<p", "/", ">" ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/RSS090Parser.java#L293-L329
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/MbeanImplCodeGen.java
MbeanImplCodeGen.writeClassBody
@Override public void writeClassBody(Definition def, Writer out) throws IOException { """ Output class @param def definition @param out Writer @throws IOException ioException """ int indent = 1; out.write("public class " + getClassName(def) + " implements " + def.getMbeanInterfaceClass()); writeLeftCurlyBracket(out, 0); writeVars(def, out, indent); writeEol(out); writeMBeanLifecycle(def, out, indent); writeEol(out); writeMethods(def, out, indent); writeEol(out); writeGetConnection(def, out, indent); writeRightCurlyBracket(out, 0); }
java
@Override public void writeClassBody(Definition def, Writer out) throws IOException { int indent = 1; out.write("public class " + getClassName(def) + " implements " + def.getMbeanInterfaceClass()); writeLeftCurlyBracket(out, 0); writeVars(def, out, indent); writeEol(out); writeMBeanLifecycle(def, out, indent); writeEol(out); writeMethods(def, out, indent); writeEol(out); writeGetConnection(def, out, indent); writeRightCurlyBracket(out, 0); }
[ "@", "Override", "public", "void", "writeClassBody", "(", "Definition", "def", ",", "Writer", "out", ")", "throws", "IOException", "{", "int", "indent", "=", "1", ";", "out", ".", "write", "(", "\"public class \"", "+", "getClassName", "(", "def", ")", "+"...
Output class @param def definition @param out Writer @throws IOException ioException
[ "Output", "class" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/MbeanImplCodeGen.java#L46-L62
alibaba/transmittable-thread-local
src/main/java/com/alibaba/ttl/TtlCallable.java
TtlCallable.gets
@Nonnull public static <T> List<TtlCallable<T>> gets(@Nullable Collection<? extends Callable<T>> tasks) { """ wrap input {@link Callable} Collection to {@link TtlCallable} Collection. @param tasks task to be wrapped @return Wrapped {@link Callable} """ return gets(tasks, false, false); }
java
@Nonnull public static <T> List<TtlCallable<T>> gets(@Nullable Collection<? extends Callable<T>> tasks) { return gets(tasks, false, false); }
[ "@", "Nonnull", "public", "static", "<", "T", ">", "List", "<", "TtlCallable", "<", "T", ">", ">", "gets", "(", "@", "Nullable", "Collection", "<", "?", "extends", "Callable", "<", "T", ">", ">", "tasks", ")", "{", "return", "gets", "(", "tasks", "...
wrap input {@link Callable} Collection to {@link TtlCallable} Collection. @param tasks task to be wrapped @return Wrapped {@link Callable}
[ "wrap", "input", "{", "@link", "Callable", "}", "Collection", "to", "{", "@link", "TtlCallable", "}", "Collection", "." ]
train
https://github.com/alibaba/transmittable-thread-local/blob/30b4d99cdb7064b4c1797d2e40bfa07adce8e7f9/src/main/java/com/alibaba/ttl/TtlCallable.java#L140-L143
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Invoker.java
Invoker.getFieldIgnoreCase
public static Field getFieldIgnoreCase(Class c, String name) throws NoSuchFieldException { """ same like method getField from Class but ignore case from field name @param c class to search the field @param name name to search @return Matching Field @throws NoSuchFieldException """ Field[] fields = c.getFields(); for (int i = 0; i < fields.length; i++) { Field f = fields[i]; // Same Name if (f.getName().equalsIgnoreCase(name)) { return f; } } throw new NoSuchFieldException("Field doesn't exist"); }
java
public static Field getFieldIgnoreCase(Class c, String name) throws NoSuchFieldException { Field[] fields = c.getFields(); for (int i = 0; i < fields.length; i++) { Field f = fields[i]; // Same Name if (f.getName().equalsIgnoreCase(name)) { return f; } } throw new NoSuchFieldException("Field doesn't exist"); }
[ "public", "static", "Field", "getFieldIgnoreCase", "(", "Class", "c", ",", "String", "name", ")", "throws", "NoSuchFieldException", "{", "Field", "[", "]", "fields", "=", "c", ".", "getFields", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i",...
same like method getField from Class but ignore case from field name @param c class to search the field @param name name to search @return Matching Field @throws NoSuchFieldException
[ "same", "like", "method", "getField", "from", "Class", "but", "ignore", "case", "from", "field", "name" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L388-L398
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/HashUtils.java
HashUtils.messageDigest
public static byte[] messageDigest(String value) { """ 换算法? MD5 SHA-1 MurMurHash??? @param value the value @return the byte [] """ MessageDigest md5; try { md5 = MessageDigest.getInstance("MD5"); md5.update(value.getBytes("UTF-8")); return md5.digest(); } catch (NoSuchAlgorithmException e) { throw new SofaRpcRuntimeException("No such algorithm named md5", e); } catch (UnsupportedEncodingException e) { throw new SofaRpcRuntimeException("Unsupported encoding of" + value, e); } }
java
public static byte[] messageDigest(String value) { MessageDigest md5; try { md5 = MessageDigest.getInstance("MD5"); md5.update(value.getBytes("UTF-8")); return md5.digest(); } catch (NoSuchAlgorithmException e) { throw new SofaRpcRuntimeException("No such algorithm named md5", e); } catch (UnsupportedEncodingException e) { throw new SofaRpcRuntimeException("Unsupported encoding of" + value, e); } }
[ "public", "static", "byte", "[", "]", "messageDigest", "(", "String", "value", ")", "{", "MessageDigest", "md5", ";", "try", "{", "md5", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ";", "md5", ".", "update", "(", "value", ".", "getByte...
换算法? MD5 SHA-1 MurMurHash??? @param value the value @return the byte []
[ "换算法?", "MD5", "SHA", "-", "1", "MurMurHash???" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/HashUtils.java#L37-L48
alipay/sofa-rpc
extension-impl/codec-sofa-hessian/src/main/java/com/alipay/sofa/rpc/codec/sofahessian/BlackListFileLoader.java
BlackListFileLoader.readToList
private static void readToList(InputStream input, String encoding, List<String> blackPrefixList) { """ 读文件,将结果丢入List @param input 输入流程 @param encoding 编码 @param blackPrefixList 保持黑名单前缀的List """ InputStreamReader reader = null; BufferedReader bufferedReader = null; try { reader = new InputStreamReader(input, encoding); bufferedReader = new BufferedReader(reader); String lineText; while ((lineText = bufferedReader.readLine()) != null) { String pkg = lineText.trim(); if (pkg.length() > 0) { blackPrefixList.add(pkg); } } } catch (IOException e) { if (LOGGER.isWarnEnabled()) { LOGGER.warn(e.getMessage(), e); } } finally { closeQuietly(bufferedReader); closeQuietly(reader); } }
java
private static void readToList(InputStream input, String encoding, List<String> blackPrefixList) { InputStreamReader reader = null; BufferedReader bufferedReader = null; try { reader = new InputStreamReader(input, encoding); bufferedReader = new BufferedReader(reader); String lineText; while ((lineText = bufferedReader.readLine()) != null) { String pkg = lineText.trim(); if (pkg.length() > 0) { blackPrefixList.add(pkg); } } } catch (IOException e) { if (LOGGER.isWarnEnabled()) { LOGGER.warn(e.getMessage(), e); } } finally { closeQuietly(bufferedReader); closeQuietly(reader); } }
[ "private", "static", "void", "readToList", "(", "InputStream", "input", ",", "String", "encoding", ",", "List", "<", "String", ">", "blackPrefixList", ")", "{", "InputStreamReader", "reader", "=", "null", ";", "BufferedReader", "bufferedReader", "=", "null", ";"...
读文件,将结果丢入List @param input 输入流程 @param encoding 编码 @param blackPrefixList 保持黑名单前缀的List
[ "读文件,将结果丢入List" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/codec-sofa-hessian/src/main/java/com/alipay/sofa/rpc/codec/sofahessian/BlackListFileLoader.java#L77-L98
RestComm/sip-servlets
sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/SipNetworkInterfaceManagerImpl.java
SipNetworkInterfaceManagerImpl.checkPortRange
public static int checkPortRange(int port, String transport) { """ Checks if the port is in the UDP-TCP port numbers (0-65355) range otherwise defaulting to 5060 if UDP, TCP or SCTP or to 5061 if TLS @param port port to check @return the smae port number if in range, otherwise 5060 if UDP, TCP or SCTP or to 5061 if TLS """ if(port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER) { if((ListeningPoint.TLS).equalsIgnoreCase(transport)) { return ListeningPoint.PORT_5061; } else { return ListeningPoint.PORT_5060; } } else { return port; } }
java
public static int checkPortRange(int port, String transport) { if(port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER) { if((ListeningPoint.TLS).equalsIgnoreCase(transport)) { return ListeningPoint.PORT_5061; } else { return ListeningPoint.PORT_5060; } } else { return port; } }
[ "public", "static", "int", "checkPortRange", "(", "int", "port", ",", "String", "transport", ")", "{", "if", "(", "port", "<", "MIN_PORT_NUMBER", "||", "port", ">", "MAX_PORT_NUMBER", ")", "{", "if", "(", "(", "ListeningPoint", ".", "TLS", ")", ".", "equ...
Checks if the port is in the UDP-TCP port numbers (0-65355) range otherwise defaulting to 5060 if UDP, TCP or SCTP or to 5061 if TLS @param port port to check @return the smae port number if in range, otherwise 5060 if UDP, TCP or SCTP or to 5061 if TLS
[ "Checks", "if", "the", "port", "is", "in", "the", "UDP", "-", "TCP", "port", "numbers", "(", "0", "-", "65355", ")", "range", "otherwise", "defaulting", "to", "5060", "if", "UDP", "TCP", "or", "SCTP", "or", "to", "5061", "if", "TLS" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/SipNetworkInterfaceManagerImpl.java#L412-L423
mpetazzoni/ttorrent
common/src/main/java/com/turn/ttorrent/common/creation/MetadataBuilder.java
MetadataBuilder.addDataSource
public MetadataBuilder addDataSource(@NotNull InputStream dataSource, String path) { """ add custom source in torrent with custom path. Path can be separated with any slash. """ addDataSource(dataSource, path, true); return this; }
java
public MetadataBuilder addDataSource(@NotNull InputStream dataSource, String path) { addDataSource(dataSource, path, true); return this; }
[ "public", "MetadataBuilder", "addDataSource", "(", "@", "NotNull", "InputStream", "dataSource", ",", "String", "path", ")", "{", "addDataSource", "(", "dataSource", ",", "path", ",", "true", ")", ";", "return", "this", ";", "}" ]
add custom source in torrent with custom path. Path can be separated with any slash.
[ "add", "custom", "source", "in", "torrent", "with", "custom", "path", ".", "Path", "can", "be", "separated", "with", "any", "slash", "." ]
train
https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/common/src/main/java/com/turn/ttorrent/common/creation/MetadataBuilder.java#L207-L210
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java
JavaScriptUtils.getUnencodedHtmlCookieString
public String getUnencodedHtmlCookieString(String name, String value, Map<String, String> cookieProperties) { """ Creates and returns a JavaScript line for setting a cookie with the specified name, value, and cookie properties. Note: The properties will be HTML-encoded but the name and value will not be. """ return createHtmlCookieString(name, value, cookieProperties, false); }
java
public String getUnencodedHtmlCookieString(String name, String value, Map<String, String> cookieProperties) { return createHtmlCookieString(name, value, cookieProperties, false); }
[ "public", "String", "getUnencodedHtmlCookieString", "(", "String", "name", ",", "String", "value", ",", "Map", "<", "String", ",", "String", ">", "cookieProperties", ")", "{", "return", "createHtmlCookieString", "(", "name", ",", "value", ",", "cookieProperties", ...
Creates and returns a JavaScript line for setting a cookie with the specified name, value, and cookie properties. Note: The properties will be HTML-encoded but the name and value will not be.
[ "Creates", "and", "returns", "a", "JavaScript", "line", "for", "setting", "a", "cookie", "with", "the", "specified", "name", "value", "and", "cookie", "properties", ".", "Note", ":", "The", "properties", "will", "be", "HTML", "-", "encoded", "but", "the", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java#L99-L101
ontop/ontop
mapping/sql/owlapi/src/main/java/it/unibz/inf/ontop/spec/mapping/bootstrap/impl/DirectMappingEngine.java
DirectMappingEngine.bootstrapMappings
private SQLPPMapping bootstrapMappings(SQLPPMapping ppMapping) throws SQLException, DuplicateMappingException { """ * extract mappings from given datasource, and insert them into the pre-processed mapping Duplicate Exception may happen, since mapping id is generated randomly and same id may occur """ if (ppMapping == null) { throw new IllegalArgumentException("Model should not be null"); } try (Connection conn = LocalJDBCConnectionUtils.createConnection(settings)) { RDBMetadata metadata = RDBMetadataExtractionTools.createMetadata(conn, typeFactory, jdbcTypeMapper); // this operation is EXPENSIVE RDBMetadataExtractionTools.loadMetadata(metadata, conn, null); return bootstrapMappings(metadata, ppMapping); } }
java
private SQLPPMapping bootstrapMappings(SQLPPMapping ppMapping) throws SQLException, DuplicateMappingException { if (ppMapping == null) { throw new IllegalArgumentException("Model should not be null"); } try (Connection conn = LocalJDBCConnectionUtils.createConnection(settings)) { RDBMetadata metadata = RDBMetadataExtractionTools.createMetadata(conn, typeFactory, jdbcTypeMapper); // this operation is EXPENSIVE RDBMetadataExtractionTools.loadMetadata(metadata, conn, null); return bootstrapMappings(metadata, ppMapping); } }
[ "private", "SQLPPMapping", "bootstrapMappings", "(", "SQLPPMapping", "ppMapping", ")", "throws", "SQLException", ",", "DuplicateMappingException", "{", "if", "(", "ppMapping", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Model should not b...
* extract mappings from given datasource, and insert them into the pre-processed mapping Duplicate Exception may happen, since mapping id is generated randomly and same id may occur
[ "*", "extract", "mappings", "from", "given", "datasource", "and", "insert", "them", "into", "the", "pre", "-", "processed", "mapping" ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/mapping/sql/owlapi/src/main/java/it/unibz/inf/ontop/spec/mapping/bootstrap/impl/DirectMappingEngine.java#L238-L249
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.deleteAndUnlockPersistentStream
private void deleteAndUnlockPersistentStream(StreamInfo sinfo, ArrayList valueTicks) throws MessageStoreException, SIRollbackException, SIConnectionLostException, SIIncorrectCallException, SIResourceException, SIErrorException { """ remove the persistent ticks and the itemstream and started-flush item """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteAndUnlockPersistentStream", new Object[]{sinfo, valueTicks}); // create a transaction, and delete all AOValue ticks, unlock the persistent locks, // and then remove sinfo.itemStream, and sinfo.item LocalTransaction tran = getLocalTransaction(); cleanupTicks(sinfo, tran, valueTicks); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(tran); sinfo.itemStream.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.itemStream.remove(msTran, controlItemLockID); if (sinfo.item != null) { sinfo.item.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.item.remove(msTran, controlItemLockID); } tran.commit(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteAndUnlockPersistentStream"); }
java
private void deleteAndUnlockPersistentStream(StreamInfo sinfo, ArrayList valueTicks) throws MessageStoreException, SIRollbackException, SIConnectionLostException, SIIncorrectCallException, SIResourceException, SIErrorException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "deleteAndUnlockPersistentStream", new Object[]{sinfo, valueTicks}); // create a transaction, and delete all AOValue ticks, unlock the persistent locks, // and then remove sinfo.itemStream, and sinfo.item LocalTransaction tran = getLocalTransaction(); cleanupTicks(sinfo, tran, valueTicks); Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(tran); sinfo.itemStream.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.itemStream.remove(msTran, controlItemLockID); if (sinfo.item != null) { sinfo.item.lockItemIfAvailable(controlItemLockID); // will always be available sinfo.item.remove(msTran, controlItemLockID); } tran.commit(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "deleteAndUnlockPersistentStream"); }
[ "private", "void", "deleteAndUnlockPersistentStream", "(", "StreamInfo", "sinfo", ",", "ArrayList", "valueTicks", ")", "throws", "MessageStoreException", ",", "SIRollbackException", ",", "SIConnectionLostException", ",", "SIIncorrectCallException", ",", "SIResourceException", ...
remove the persistent ticks and the itemstream and started-flush item
[ "remove", "the", "persistent", "ticks", "and", "the", "itemstream", "and", "started", "-", "flush", "item" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L3207-L3230
GenesysPureEngage/authentication-client-java
src/main/java/com/genesys/authentication/AuthenticationApi.java
AuthenticationApi.getUserInfo
public CloudUserDetails getUserInfo(String authorization) throws AuthenticationApiException { """ Get user information by access token Get information about a user by their OAuth 2 access token. @param authorization The OAuth 2 bearer access token. For example: \&quot;Authorization: bearer a4b5da75-a584-4053-9227-0f0ab23ff06e\&quot; (required) @return CloudUserDetails @throws AuthenticationApiException if the call is unsuccessful. """ try { return authenticationApi.getInfo1(authorization); } catch (ApiException e) { throw new AuthenticationApiException("Error getting userinfo", e); } }
java
public CloudUserDetails getUserInfo(String authorization) throws AuthenticationApiException { try { return authenticationApi.getInfo1(authorization); } catch (ApiException e) { throw new AuthenticationApiException("Error getting userinfo", e); } }
[ "public", "CloudUserDetails", "getUserInfo", "(", "String", "authorization", ")", "throws", "AuthenticationApiException", "{", "try", "{", "return", "authenticationApi", ".", "getInfo1", "(", "authorization", ")", ";", "}", "catch", "(", "ApiException", "e", ")", ...
Get user information by access token Get information about a user by their OAuth 2 access token. @param authorization The OAuth 2 bearer access token. For example: \&quot;Authorization: bearer a4b5da75-a584-4053-9227-0f0ab23ff06e\&quot; (required) @return CloudUserDetails @throws AuthenticationApiException if the call is unsuccessful.
[ "Get", "user", "information", "by", "access", "token", "Get", "information", "about", "a", "user", "by", "their", "OAuth", "2", "access", "token", "." ]
train
https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/authentication/AuthenticationApi.java#L103-L109
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java
StandardDirectoryAgentServer.handleUDPSrvRqst
protected void handleUDPSrvRqst(SrvRqst srvRqst, InetSocketAddress localAddress, InetSocketAddress remoteAddress) { """ Handles a unicast UDP SrvRqst message arrived to this directory agent. <br /> This directory agent will reply with a list of matching services. @param srvRqst the SrvRqst message to handle @param localAddress the address on this server on which the message arrived @param remoteAddress the address on the remote client from which the message was sent @see #handleMulticastSrvRqst(SrvRqst, InetSocketAddress, InetSocketAddress) @see #handleTCPSrvRqst(SrvRqst, Socket) @see #matchServices(ServiceType, String, Scopes, String) """ // Match scopes, RFC 2608, 11.1 if (!scopes.weakMatch(srvRqst.getScopes())) { udpSrvRply.perform(localAddress, remoteAddress, srvRqst, SLPError.SCOPE_NOT_SUPPORTED); return; } ServiceType serviceType = srvRqst.getServiceType(); List<ServiceInfo> matchingServices = matchServices(serviceType, srvRqst.getLanguage(), srvRqst.getScopes(), srvRqst.getFilter()); if (logger.isLoggable(Level.FINE)) logger.fine("DirectoryAgent " + this + " returning " + matchingServices.size() + " services of type " + serviceType); udpSrvRply.perform(localAddress, remoteAddress, srvRqst, matchingServices); }
java
protected void handleUDPSrvRqst(SrvRqst srvRqst, InetSocketAddress localAddress, InetSocketAddress remoteAddress) { // Match scopes, RFC 2608, 11.1 if (!scopes.weakMatch(srvRqst.getScopes())) { udpSrvRply.perform(localAddress, remoteAddress, srvRqst, SLPError.SCOPE_NOT_SUPPORTED); return; } ServiceType serviceType = srvRqst.getServiceType(); List<ServiceInfo> matchingServices = matchServices(serviceType, srvRqst.getLanguage(), srvRqst.getScopes(), srvRqst.getFilter()); if (logger.isLoggable(Level.FINE)) logger.fine("DirectoryAgent " + this + " returning " + matchingServices.size() + " services of type " + serviceType); udpSrvRply.perform(localAddress, remoteAddress, srvRqst, matchingServices); }
[ "protected", "void", "handleUDPSrvRqst", "(", "SrvRqst", "srvRqst", ",", "InetSocketAddress", "localAddress", ",", "InetSocketAddress", "remoteAddress", ")", "{", "// Match scopes, RFC 2608, 11.1", "if", "(", "!", "scopes", ".", "weakMatch", "(", "srvRqst", ".", "getS...
Handles a unicast UDP SrvRqst message arrived to this directory agent. <br /> This directory agent will reply with a list of matching services. @param srvRqst the SrvRqst message to handle @param localAddress the address on this server on which the message arrived @param remoteAddress the address on the remote client from which the message was sent @see #handleMulticastSrvRqst(SrvRqst, InetSocketAddress, InetSocketAddress) @see #handleTCPSrvRqst(SrvRqst, Socket) @see #matchServices(ServiceType, String, Scopes, String)
[ "Handles", "a", "unicast", "UDP", "SrvRqst", "message", "arrived", "to", "this", "directory", "agent", ".", "<br", "/", ">", "This", "directory", "agent", "will", "reply", "with", "a", "list", "of", "matching", "services", "." ]
train
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java#L457-L471
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/config/PropertiesIO.java
PropertiesIO.store
public static void store(String absolutePath, Properties configs) throws IOException { """ Write into properties file. @param absolutePath absolute path in file system. @param configs all configs to write. @throws java.io.IOException """ OutputStream outStream = null; try { outStream = new FileOutputStream(new File(absolutePath)); configs.store(outStream, null); } finally { try { if (outStream != null) { outStream.close(); } } catch (IOException ignore) { // do nothing. } } }
java
public static void store(String absolutePath, Properties configs) throws IOException { OutputStream outStream = null; try { outStream = new FileOutputStream(new File(absolutePath)); configs.store(outStream, null); } finally { try { if (outStream != null) { outStream.close(); } } catch (IOException ignore) { // do nothing. } } }
[ "public", "static", "void", "store", "(", "String", "absolutePath", ",", "Properties", "configs", ")", "throws", "IOException", "{", "OutputStream", "outStream", "=", "null", ";", "try", "{", "outStream", "=", "new", "FileOutputStream", "(", "new", "File", "("...
Write into properties file. @param absolutePath absolute path in file system. @param configs all configs to write. @throws java.io.IOException
[ "Write", "into", "properties", "file", "." ]
train
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/PropertiesIO.java#L88-L102
Azure/azure-sdk-for-java
cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java
AccountsInner.updateAsync
public Observable<CognitiveServicesAccountInner> updateAsync(String resourceGroupName, String accountName, Sku sku, Map<String, String> tags) { """ Updates a Cognitive Services account. @param resourceGroupName The name of the resource group within the user's subscription. @param accountName The name of Cognitive Services account. @param sku Gets or sets the SKU of the resource. @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CognitiveServicesAccountInner object """ return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags).map(new Func1<ServiceResponse<CognitiveServicesAccountInner>, CognitiveServicesAccountInner>() { @Override public CognitiveServicesAccountInner call(ServiceResponse<CognitiveServicesAccountInner> response) { return response.body(); } }); }
java
public Observable<CognitiveServicesAccountInner> updateAsync(String resourceGroupName, String accountName, Sku sku, Map<String, String> tags) { return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags).map(new Func1<ServiceResponse<CognitiveServicesAccountInner>, CognitiveServicesAccountInner>() { @Override public CognitiveServicesAccountInner call(ServiceResponse<CognitiveServicesAccountInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CognitiveServicesAccountInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "Sku", "sku", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateWithServiceResp...
Updates a Cognitive Services account. @param resourceGroupName The name of the resource group within the user's subscription. @param accountName The name of Cognitive Services account. @param sku Gets or sets the SKU of the resource. @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CognitiveServicesAccountInner object
[ "Updates", "a", "Cognitive", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java#L345-L352
liferay/com-liferay-commerce
commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java
CommerceDiscountPersistenceImpl.findByGroupId
@Override public List<CommerceDiscount> findByGroupId(long groupId, int start, int end) { """ Returns a range of all the commerce discounts where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceDiscountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of commerce discounts @param end the upper bound of the range of commerce discounts (not inclusive) @return the range of matching commerce discounts """ return findByGroupId(groupId, start, end, null); }
java
@Override public List<CommerceDiscount> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceDiscount", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce discounts where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceDiscountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of commerce discounts @param end the upper bound of the range of commerce discounts (not inclusive) @return the range of matching commerce discounts
[ "Returns", "a", "range", "of", "all", "the", "commerce", "discounts", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java#L1535-L1538
cdk/cdk
base/data/src/main/java/org/openscience/cdk/formula/AdductFormula.java
AdductFormula.isTheSame
private boolean isTheSame(IIsotope isotopeOne, IIsotope isotopeTwo) { """ Compare to IIsotope. The method doesn't compare instance but if they have the same symbol, natural abundance and exact mass. @param isotopeOne The first Isotope to compare @param isotopeTwo The second Isotope to compare @return True, if both isotope are the same """ // XXX: floating point comparision! if (!Objects.equals(isotopeOne.getSymbol(), isotopeTwo.getSymbol())) return false; if (!Objects.equals(isotopeOne.getNaturalAbundance(), isotopeTwo.getNaturalAbundance())) return false; if (!Objects.equals(isotopeOne.getExactMass(), isotopeTwo.getExactMass())) return false; return true; }
java
private boolean isTheSame(IIsotope isotopeOne, IIsotope isotopeTwo) { // XXX: floating point comparision! if (!Objects.equals(isotopeOne.getSymbol(), isotopeTwo.getSymbol())) return false; if (!Objects.equals(isotopeOne.getNaturalAbundance(), isotopeTwo.getNaturalAbundance())) return false; if (!Objects.equals(isotopeOne.getExactMass(), isotopeTwo.getExactMass())) return false; return true; }
[ "private", "boolean", "isTheSame", "(", "IIsotope", "isotopeOne", ",", "IIsotope", "isotopeTwo", ")", "{", "// XXX: floating point comparision!", "if", "(", "!", "Objects", ".", "equals", "(", "isotopeOne", ".", "getSymbol", "(", ")", ",", "isotopeTwo", ".", "ge...
Compare to IIsotope. The method doesn't compare instance but if they have the same symbol, natural abundance and exact mass. @param isotopeOne The first Isotope to compare @param isotopeTwo The second Isotope to compare @return True, if both isotope are the same
[ "Compare", "to", "IIsotope", ".", "The", "method", "doesn", "t", "compare", "instance", "but", "if", "they", "have", "the", "same", "symbol", "natural", "abundance", "and", "exact", "mass", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/data/src/main/java/org/openscience/cdk/formula/AdductFormula.java#L345-L352
pravega/pravega
segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/HierarchyUtils.java
HierarchyUtils.getPath
static String getPath(int nodeId, int depth) { """ Gets a hierarchical path using the value of nodeId to construct the intermediate paths. Examples: * nodeId = 1234, depth = 3 -> /4/3/2/1234 * nodeId = 1234, depth = 0 -> /1234 * nodeId = 1234, depth = 6 -> /4/3/2/1/0/0/1234 @param nodeId The node id to create the path for. @param depth The hierarchy depth (0 means flat). @return The hierarchical path. """ StringBuilder pathBuilder = new StringBuilder(); int value = nodeId; for (int i = 0; i < depth; i++) { int r = value % DIVISOR; value = value / DIVISOR; pathBuilder.append(SEPARATOR).append(r); } return pathBuilder.append(SEPARATOR).append(nodeId).toString(); }
java
static String getPath(int nodeId, int depth) { StringBuilder pathBuilder = new StringBuilder(); int value = nodeId; for (int i = 0; i < depth; i++) { int r = value % DIVISOR; value = value / DIVISOR; pathBuilder.append(SEPARATOR).append(r); } return pathBuilder.append(SEPARATOR).append(nodeId).toString(); }
[ "static", "String", "getPath", "(", "int", "nodeId", ",", "int", "depth", ")", "{", "StringBuilder", "pathBuilder", "=", "new", "StringBuilder", "(", ")", ";", "int", "value", "=", "nodeId", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dept...
Gets a hierarchical path using the value of nodeId to construct the intermediate paths. Examples: * nodeId = 1234, depth = 3 -> /4/3/2/1234 * nodeId = 1234, depth = 0 -> /1234 * nodeId = 1234, depth = 6 -> /4/3/2/1/0/0/1234 @param nodeId The node id to create the path for. @param depth The hierarchy depth (0 means flat). @return The hierarchical path.
[ "Gets", "a", "hierarchical", "path", "using", "the", "value", "of", "nodeId", "to", "construct", "the", "intermediate", "paths", ".", "Examples", ":", "*", "nodeId", "=", "1234", "depth", "=", "3", "-", ">", "/", "4", "/", "3", "/", "2", "/", "1234",...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/HierarchyUtils.java#L37-L47
fozziethebeat/S-Space
opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java
LatentRelationalAnalysis.initializeIndex
public static void initializeIndex(String indexDir, String dataDir) { """ Initializes an index given the index directory and data directory. @param indexDir a {@code String} containing the directory where the index will be stored @param dataDir a {@code String} containing the directory where the data is found """ File indexDir_f = new File(indexDir); File dataDir_f = new File(dataDir); long start = new Date().getTime(); try { int numIndexed = index(indexDir_f, dataDir_f); long end = new Date().getTime(); System.err.println("Indexing " + numIndexed + " files took " + (end -start) + " milliseconds"); } catch (IOException e) { System.err.println("Unable to index "+indexDir_f+": "+e.getMessage()); } }
java
public static void initializeIndex(String indexDir, String dataDir) { File indexDir_f = new File(indexDir); File dataDir_f = new File(dataDir); long start = new Date().getTime(); try { int numIndexed = index(indexDir_f, dataDir_f); long end = new Date().getTime(); System.err.println("Indexing " + numIndexed + " files took " + (end -start) + " milliseconds"); } catch (IOException e) { System.err.println("Unable to index "+indexDir_f+": "+e.getMessage()); } }
[ "public", "static", "void", "initializeIndex", "(", "String", "indexDir", ",", "String", "dataDir", ")", "{", "File", "indexDir_f", "=", "new", "File", "(", "indexDir", ")", ";", "File", "dataDir_f", "=", "new", "File", "(", "dataDir", ")", ";", "long", ...
Initializes an index given the index directory and data directory. @param indexDir a {@code String} containing the directory where the index will be stored @param dataDir a {@code String} containing the directory where the data is found
[ "Initializes", "an", "index", "given", "the", "index", "directory", "and", "data", "directory", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java#L289-L302
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java
CmsSitemapController.disableModelPage
public void disableModelPage(final CmsUUID id, final boolean disable) { """ Disables the given model page entry within the configuration.<p> @param id the entry id @param disable <code>true</code> to disable the entry """ CmsRpcAction<Void> action = new CmsRpcAction<Void>() { @Override public void execute() { start(200, true); getService().disableModelPage(getEntryPoint(), id, disable, this); } @Override protected void onResponse(Void result) { stop(false); CmsSitemapView.getInstance().updateModelPageDisabledState(id, disable); } }; action.execute(); }
java
public void disableModelPage(final CmsUUID id, final boolean disable) { CmsRpcAction<Void> action = new CmsRpcAction<Void>() { @Override public void execute() { start(200, true); getService().disableModelPage(getEntryPoint(), id, disable, this); } @Override protected void onResponse(Void result) { stop(false); CmsSitemapView.getInstance().updateModelPageDisabledState(id, disable); } }; action.execute(); }
[ "public", "void", "disableModelPage", "(", "final", "CmsUUID", "id", ",", "final", "boolean", "disable", ")", "{", "CmsRpcAction", "<", "Void", ">", "action", "=", "new", "CmsRpcAction", "<", "Void", ">", "(", ")", "{", "@", "Override", "public", "void", ...
Disables the given model page entry within the configuration.<p> @param id the entry id @param disable <code>true</code> to disable the entry
[ "Disables", "the", "given", "model", "page", "entry", "within", "the", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L783-L804
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.readToText
public String readToText() { """ Read response body to string. return empty string if response has no body """ Charset charset = getCharset(); try (InputStream in = body(); Reader reader = new InputStreamReader(in, charset)) { return Readers.readAll(reader); } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
java
public String readToText() { Charset charset = getCharset(); try (InputStream in = body(); Reader reader = new InputStreamReader(in, charset)) { return Readers.readAll(reader); } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
[ "public", "String", "readToText", "(", ")", "{", "Charset", "charset", "=", "getCharset", "(", ")", ";", "try", "(", "InputStream", "in", "=", "body", "(", ")", ";", "Reader", "reader", "=", "new", "InputStreamReader", "(", "in", ",", "charset", ")", "...
Read response body to string. return empty string if response has no body
[ "Read", "response", "body", "to", "string", ".", "return", "empty", "string", "if", "response", "has", "no", "body" ]
train
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L115-L125
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.fixDiscouragedFieldName
@Fix(org.eclipse.xtext.xbase.validation.IssueCodes.VARIABLE_NAME_DISCOURAGED) public void fixDiscouragedFieldName(final Issue issue, IssueResolutionAcceptor acceptor) { """ Quick fix for "disallowed variable name". @param issue the issue. @param acceptor the quick fix acceptor. """ MemberRemoveModification.accept(this, issue, acceptor); }
java
@Fix(org.eclipse.xtext.xbase.validation.IssueCodes.VARIABLE_NAME_DISCOURAGED) public void fixDiscouragedFieldName(final Issue issue, IssueResolutionAcceptor acceptor) { MemberRemoveModification.accept(this, issue, acceptor); }
[ "@", "Fix", "(", "org", ".", "eclipse", ".", "xtext", ".", "xbase", ".", "validation", ".", "IssueCodes", ".", "VARIABLE_NAME_DISCOURAGED", ")", "public", "void", "fixDiscouragedFieldName", "(", "final", "Issue", "issue", ",", "IssueResolutionAcceptor", "acceptor"...
Quick fix for "disallowed variable name". @param issue the issue. @param acceptor the quick fix acceptor.
[ "Quick", "fix", "for", "disallowed", "variable", "name", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L708-L711
alkacon/opencms-core
src/org/opencms/util/CmsHtml2TextConverter.java
CmsHtml2TextConverter.appendLinebreak
private void appendLinebreak(int count, boolean force) { """ Appends line breaks.<p> @param count the number of line breaks @param force if the line break should be forced """ if (m_appendBr) { if (m_storedBrCount > count) { count = m_storedBrCount; } m_storedBrCount = 0; if (force) { m_brCount = 0; } while (m_brCount < count) { m_result.append("\r\n"); m_brCount++; } m_lineLength = m_indent; } else { while (m_storedBrCount < count) { m_storedBrCount++; } } }
java
private void appendLinebreak(int count, boolean force) { if (m_appendBr) { if (m_storedBrCount > count) { count = m_storedBrCount; } m_storedBrCount = 0; if (force) { m_brCount = 0; } while (m_brCount < count) { m_result.append("\r\n"); m_brCount++; } m_lineLength = m_indent; } else { while (m_storedBrCount < count) { m_storedBrCount++; } } }
[ "private", "void", "appendLinebreak", "(", "int", "count", ",", "boolean", "force", ")", "{", "if", "(", "m_appendBr", ")", "{", "if", "(", "m_storedBrCount", ">", "count", ")", "{", "count", "=", "m_storedBrCount", ";", "}", "m_storedBrCount", "=", "0", ...
Appends line breaks.<p> @param count the number of line breaks @param force if the line break should be forced
[ "Appends", "line", "breaks", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsHtml2TextConverter.java#L176-L196
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/storage/CompressedRamStorage.java
CompressedRamStorage.storeIfAbsent
@Override public boolean storeIfAbsent(T key, INDArray object) { """ Store object into storage, if it doesn't exist @param key @param object @return Returns TRUE if store operation was applied, FALSE otherwise """ try { if (emulateIsAbsent) lock.writeLock().lock(); if (compressedEntries.containsKey(key)) { return false; } else { store(key, object); return true; } } finally { if (emulateIsAbsent) lock.writeLock().unlock(); } }
java
@Override public boolean storeIfAbsent(T key, INDArray object) { try { if (emulateIsAbsent) lock.writeLock().lock(); if (compressedEntries.containsKey(key)) { return false; } else { store(key, object); return true; } } finally { if (emulateIsAbsent) lock.writeLock().unlock(); } }
[ "@", "Override", "public", "boolean", "storeIfAbsent", "(", "T", "key", ",", "INDArray", "object", ")", "{", "try", "{", "if", "(", "emulateIsAbsent", ")", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "if", "(", "compressedEntries", ...
Store object into storage, if it doesn't exist @param key @param object @return Returns TRUE if store operation was applied, FALSE otherwise
[ "Store", "object", "into", "storage", "if", "it", "doesn", "t", "exist" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/storage/CompressedRamStorage.java#L121-L137
osglworks/java-tool
src/main/java/org/osgl/util/IO.java
IO.registerInputStreamHandler
public static void registerInputStreamHandler(MimeType.Trait trait, InputStreamHandler handler) { """ Register an {@link InputStreamHandler} with all {@link MimeType mime types} by {@link MimeType.Trait}. @param trait the trait of mimetype @param handler the input stream handler """ $.requireNotNull(handler); List<MimeType> mimeTypes = MimeType.filterByTrait(trait); for (MimeType mimeType : mimeTypes) { registerInputStreamHandler(mimeType, handler); } }
java
public static void registerInputStreamHandler(MimeType.Trait trait, InputStreamHandler handler) { $.requireNotNull(handler); List<MimeType> mimeTypes = MimeType.filterByTrait(trait); for (MimeType mimeType : mimeTypes) { registerInputStreamHandler(mimeType, handler); } }
[ "public", "static", "void", "registerInputStreamHandler", "(", "MimeType", ".", "Trait", "trait", ",", "InputStreamHandler", "handler", ")", "{", "$", ".", "requireNotNull", "(", "handler", ")", ";", "List", "<", "MimeType", ">", "mimeTypes", "=", "MimeType", ...
Register an {@link InputStreamHandler} with all {@link MimeType mime types} by {@link MimeType.Trait}. @param trait the trait of mimetype @param handler the input stream handler
[ "Register", "an", "{", "@link", "InputStreamHandler", "}", "with", "all", "{", "@link", "MimeType", "mime", "types", "}", "by", "{", "@link", "MimeType", ".", "Trait", "}", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/IO.java#L179-L185
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/breadcrumbs/BreadcrumbsRenderer.java
BreadcrumbsRenderer.encodeEnd
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { """ This methods generates the HTML code of the current b:breadcrumbs. <code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code> to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called to generate the rest of the HTML code. @param context the FacesContext. @param component the current b:breadcrumbs. @throws IOException thrown if something goes wrong when writing the HTML code. """ if (!component.isRendered()) { return; } ResponseWriter rw = context.getResponseWriter(); // End point / current page UIComponent end = component.getFacet("end"); if (end != null) { rw.startElement("li", component); end.encodeAll(context); rw.endElement("li"); } rw.endElement("ol"); Tooltip.activateTooltips(context, component); }
java
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } ResponseWriter rw = context.getResponseWriter(); // End point / current page UIComponent end = component.getFacet("end"); if (end != null) { rw.startElement("li", component); end.encodeAll(context); rw.endElement("li"); } rw.endElement("ol"); Tooltip.activateTooltips(context, component); }
[ "@", "Override", "public", "void", "encodeEnd", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "if", "(", "!", "component", ".", "isRendered", "(", ")", ")", "{", "return", ";", "}", "ResponseWriter", "rw"...
This methods generates the HTML code of the current b:breadcrumbs. <code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code> to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called to generate the rest of the HTML code. @param context the FacesContext. @param component the current b:breadcrumbs. @throws IOException thrown if something goes wrong when writing the HTML code.
[ "This", "methods", "generates", "the", "HTML", "code", "of", "the", "current", "b", ":", "breadcrumbs", ".", "<code", ">", "encodeBegin<", "/", "code", ">", "generates", "the", "start", "of", "the", "component", ".", "After", "the", "the", "JSF", "framewor...
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/breadcrumbs/BreadcrumbsRenderer.java#L91-L108
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/BigtableExtendedScan.java
BigtableExtendedScan.addRange
public void addRange(byte[] startRow, byte[] stopRow) { """ Adds a range to scan. This is similar to calling a combination of {@link Scan#setStartRow(byte[])} and {@link Scan#setStopRow(byte[])}. Other ranges can be constructed by creating a {@link RowRange} and calling {@link #addRange(RowRange)} @param startRow a byte array. @param stopRow a byte array. """ addRange(RowRange.newBuilder() .setStartKeyClosed(ByteStringer.wrap(startRow)) .setEndKeyOpen(ByteStringer.wrap(stopRow)) .build()); }
java
public void addRange(byte[] startRow, byte[] stopRow) { addRange(RowRange.newBuilder() .setStartKeyClosed(ByteStringer.wrap(startRow)) .setEndKeyOpen(ByteStringer.wrap(stopRow)) .build()); }
[ "public", "void", "addRange", "(", "byte", "[", "]", "startRow", ",", "byte", "[", "]", "stopRow", ")", "{", "addRange", "(", "RowRange", ".", "newBuilder", "(", ")", ".", "setStartKeyClosed", "(", "ByteStringer", ".", "wrap", "(", "startRow", ")", ")", ...
Adds a range to scan. This is similar to calling a combination of {@link Scan#setStartRow(byte[])} and {@link Scan#setStopRow(byte[])}. Other ranges can be constructed by creating a {@link RowRange} and calling {@link #addRange(RowRange)} @param startRow a byte array. @param stopRow a byte array.
[ "Adds", "a", "range", "to", "scan", ".", "This", "is", "similar", "to", "calling", "a", "combination", "of", "{" ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/BigtableExtendedScan.java#L73-L78
wisdom-framework/wisdom
core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java
Result.render
public Result render(String padding, JsonNode node) { """ Sets the content of the current result to the JSONP response using the given padding (callback). It also sets the content-type header to JavaScript and the charset to UTF-8. @param node the content @return the current result """ this.content = new RenderableJsonP(padding, node); setContentType(MimeTypes.JAVASCRIPT); charset = Charsets.UTF_8; return this; }
java
public Result render(String padding, JsonNode node) { this.content = new RenderableJsonP(padding, node); setContentType(MimeTypes.JAVASCRIPT); charset = Charsets.UTF_8; return this; }
[ "public", "Result", "render", "(", "String", "padding", ",", "JsonNode", "node", ")", "{", "this", ".", "content", "=", "new", "RenderableJsonP", "(", "padding", ",", "node", ")", ";", "setContentType", "(", "MimeTypes", ".", "JAVASCRIPT", ")", ";", "chars...
Sets the content of the current result to the JSONP response using the given padding (callback). It also sets the content-type header to JavaScript and the charset to UTF-8. @param node the content @return the current result
[ "Sets", "the", "content", "of", "the", "current", "result", "to", "the", "JSONP", "response", "using", "the", "given", "padding", "(", "callback", ")", ".", "It", "also", "sets", "the", "content", "-", "type", "header", "to", "JavaScript", "and", "the", ...
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java#L141-L146
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java
TupleGenerator.createPropertyProviders
private MultiValuedMap<String,VarBindingDef> createPropertyProviders( FunctionInputDef inputDef) { """ Return a map that associates each value property with the set of bindings that provide it. """ propertyProviders_ = MultiMapUtils.newListValuedHashMap(); for( VarDefIterator varDefs = new VarDefIterator( inputDef.getVarDefs()); varDefs.hasNext(); ) { VarDef varDef = varDefs.next(); for( Iterator<VarValueDef> values = varDef.getValidValues(); values.hasNext(); ) { VarValueDef value = values.next(); if( value.hasProperties()) { VarBindingDef binding = new VarBindingDef( varDef, value); for( Iterator<String> properties = value.getProperties().iterator(); properties.hasNext(); ) { propertyProviders_.put( properties.next(), binding); } } } } return propertyProviders_; }
java
private MultiValuedMap<String,VarBindingDef> createPropertyProviders( FunctionInputDef inputDef) { propertyProviders_ = MultiMapUtils.newListValuedHashMap(); for( VarDefIterator varDefs = new VarDefIterator( inputDef.getVarDefs()); varDefs.hasNext(); ) { VarDef varDef = varDefs.next(); for( Iterator<VarValueDef> values = varDef.getValidValues(); values.hasNext(); ) { VarValueDef value = values.next(); if( value.hasProperties()) { VarBindingDef binding = new VarBindingDef( varDef, value); for( Iterator<String> properties = value.getProperties().iterator(); properties.hasNext(); ) { propertyProviders_.put( properties.next(), binding); } } } } return propertyProviders_; }
[ "private", "MultiValuedMap", "<", "String", ",", "VarBindingDef", ">", "createPropertyProviders", "(", "FunctionInputDef", "inputDef", ")", "{", "propertyProviders_", "=", "MultiMapUtils", ".", "newListValuedHashMap", "(", ")", ";", "for", "(", "VarDefIterator", "varD...
Return a map that associates each value property with the set of bindings that provide it.
[ "Return", "a", "map", "that", "associates", "each", "value", "property", "with", "the", "set", "of", "bindings", "that", "provide", "it", "." ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java#L733-L754
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.switchFrame
protected void switchFrame(PageElement element, Object... args) throws FailureException, TechnicalException { """ Switches to the given frame. @param element The PageElement representing a frame. @param args list of arguments to format the found selector with @throws TechnicalException is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_SWITCH_FRAME} message (with screenshot, with exception) @throws FailureException if the scenario encounters a functional error """ try { Context.waitUntil(ExpectedConditions.frameToBeAvailableAndSwitchToIt(Utilities.getLocator(element, args))); } catch (final Exception e) { new Result.Failure<>(element, Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_SWITCH_FRAME), element, element.getPage().getApplication()), true, element.getPage().getCallBack()); } }
java
protected void switchFrame(PageElement element, Object... args) throws FailureException, TechnicalException { try { Context.waitUntil(ExpectedConditions.frameToBeAvailableAndSwitchToIt(Utilities.getLocator(element, args))); } catch (final Exception e) { new Result.Failure<>(element, Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_SWITCH_FRAME), element, element.getPage().getApplication()), true, element.getPage().getCallBack()); } }
[ "protected", "void", "switchFrame", "(", "PageElement", "element", ",", "Object", "...", "args", ")", "throws", "FailureException", ",", "TechnicalException", "{", "try", "{", "Context", ".", "waitUntil", "(", "ExpectedConditions", ".", "frameToBeAvailableAndSwitchToI...
Switches to the given frame. @param element The PageElement representing a frame. @param args list of arguments to format the found selector with @throws TechnicalException is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_SWITCH_FRAME} message (with screenshot, with exception) @throws FailureException if the scenario encounters a functional error
[ "Switches", "to", "the", "given", "frame", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L769-L776
jbundle/jbundle
app/program/screen/src/main/java/org/jbundle/app/program/resource/screen/ResourceGridScreen.java
ResourceGridScreen.doCommand
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { """ Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success. """ if (strCommand.equalsIgnoreCase(MenuConstants.FORMDETAIL)) return (this.onForm(null, ScreenConstants.DETAIL_MODE, true, iCommandOptions, null) != null); else return super.doCommand(strCommand, sourceSField, iCommandOptions); }
java
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (strCommand.equalsIgnoreCase(MenuConstants.FORMDETAIL)) return (this.onForm(null, ScreenConstants.DETAIL_MODE, true, iCommandOptions, null) != null); else return super.doCommand(strCommand, sourceSField, iCommandOptions); }
[ "public", "boolean", "doCommand", "(", "String", "strCommand", ",", "ScreenField", "sourceSField", ",", "int", "iCommandOptions", ")", "{", "if", "(", "strCommand", ".", "equalsIgnoreCase", "(", "MenuConstants", ".", "FORMDETAIL", ")", ")", "return", "(", "this"...
Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success.
[ "Process", "the", "command", ".", "<br", "/", ">", "Step", "1", "-", "Process", "the", "command", "if", "possible", "and", "return", "true", "if", "processed", ".", "<br", "/", ">", "Step", "2", "-", "If", "I", "can", "t", "process", "pass", "to", ...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/resource/screen/ResourceGridScreen.java#L165-L171
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java
BoxAuthentication.logoutAllUsers
public synchronized void logoutAllUsers(Context context) { """ Log out all users. After logging out, all authentication information will be gone. @param context current context """ getAuthInfoMap(context); for (String userId : mCurrentAccessInfo.keySet()) { BoxSession session = new BoxSession(context, userId); logout(session); } authStorage.clearAuthInfoMap(context); }
java
public synchronized void logoutAllUsers(Context context) { getAuthInfoMap(context); for (String userId : mCurrentAccessInfo.keySet()) { BoxSession session = new BoxSession(context, userId); logout(session); } authStorage.clearAuthInfoMap(context); }
[ "public", "synchronized", "void", "logoutAllUsers", "(", "Context", "context", ")", "{", "getAuthInfoMap", "(", "context", ")", ";", "for", "(", "String", "userId", ":", "mCurrentAccessInfo", ".", "keySet", "(", ")", ")", "{", "BoxSession", "session", "=", "...
Log out all users. After logging out, all authentication information will be gone. @param context current context
[ "Log", "out", "all", "users", ".", "After", "logging", "out", "all", "authentication", "information", "will", "be", "gone", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L275-L283
sagiegurari/fax4j
src/main/java/org/fax4j/bridge/http/MultiPartHTTPRequestParser.java
MultiPartHTTPRequestParser.getContentPartAsString
protected String getContentPartAsString(Map<String,ContentPart<?>> contentPartsMap,String parameter) { """ This function returns the content part string value. @param contentPartsMap The content parts map @param parameter The part parameter name @return The part string value """ //get part String stringValue=null; ContentPart<?> contentPart=contentPartsMap.get(parameter); if(contentPart!=null) { ContentPartType contentPartType=contentPart.getType(); Object content=contentPart.getContent(); if(content!=null) { switch(contentPartType) { case STRING: stringValue=(String)content; break; case BINARY: byte[] data=(byte[])content; String encoding=IOHelper.getDefaultEncoding(); try { stringValue=new String(data,encoding); } catch(UnsupportedEncodingException exception) { throw new FaxException("Unable to convert binary data to string for parameter: "+parameter,exception); } break; default: throw new FaxException("Unsupported content part type: "+contentPartType); } } } return stringValue; }
java
protected String getContentPartAsString(Map<String,ContentPart<?>> contentPartsMap,String parameter) { //get part String stringValue=null; ContentPart<?> contentPart=contentPartsMap.get(parameter); if(contentPart!=null) { ContentPartType contentPartType=contentPart.getType(); Object content=contentPart.getContent(); if(content!=null) { switch(contentPartType) { case STRING: stringValue=(String)content; break; case BINARY: byte[] data=(byte[])content; String encoding=IOHelper.getDefaultEncoding(); try { stringValue=new String(data,encoding); } catch(UnsupportedEncodingException exception) { throw new FaxException("Unable to convert binary data to string for parameter: "+parameter,exception); } break; default: throw new FaxException("Unsupported content part type: "+contentPartType); } } } return stringValue; }
[ "protected", "String", "getContentPartAsString", "(", "Map", "<", "String", ",", "ContentPart", "<", "?", ">", ">", "contentPartsMap", ",", "String", "parameter", ")", "{", "//get part", "String", "stringValue", "=", "null", ";", "ContentPart", "<", "?", ">", ...
This function returns the content part string value. @param contentPartsMap The content parts map @param parameter The part parameter name @return The part string value
[ "This", "function", "returns", "the", "content", "part", "string", "value", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/bridge/http/MultiPartHTTPRequestParser.java#L340-L375
ehcache/ehcache3
core/src/main/java/org/ehcache/core/EhcacheManager.java
EhcacheManager.removeCache
private void removeCache(final String alias, final boolean removeFromConfig) { """ Closes and removes a cache, by alias, from this cache manager. @param alias the alias of the cache to remove @param removeFromConfig if {@code true}, the cache configuration is altered to remove the cache """ statusTransitioner.checkAvailable(); final CacheHolder cacheHolder = caches.remove(alias); if(cacheHolder != null) { final InternalCache<?, ?> ehcache = cacheHolder.retrieve(cacheHolder.keyType, cacheHolder.valueType); if (ehcache != null) { if (removeFromConfig) { configuration.removeCacheConfiguration(alias); } if (!statusTransitioner.isTransitioning()) { for (CacheManagerListener listener : listeners) { listener.cacheRemoved(alias, ehcache); } } ehcache.close(); closeEhcache(alias, ehcache); } LOGGER.info("Cache '{}' removed from {}.", alias, simpleName); } }
java
private void removeCache(final String alias, final boolean removeFromConfig) { statusTransitioner.checkAvailable(); final CacheHolder cacheHolder = caches.remove(alias); if(cacheHolder != null) { final InternalCache<?, ?> ehcache = cacheHolder.retrieve(cacheHolder.keyType, cacheHolder.valueType); if (ehcache != null) { if (removeFromConfig) { configuration.removeCacheConfiguration(alias); } if (!statusTransitioner.isTransitioning()) { for (CacheManagerListener listener : listeners) { listener.cacheRemoved(alias, ehcache); } } ehcache.close(); closeEhcache(alias, ehcache); } LOGGER.info("Cache '{}' removed from {}.", alias, simpleName); } }
[ "private", "void", "removeCache", "(", "final", "String", "alias", ",", "final", "boolean", "removeFromConfig", ")", "{", "statusTransitioner", ".", "checkAvailable", "(", ")", ";", "final", "CacheHolder", "cacheHolder", "=", "caches", ".", "remove", "(", "alias...
Closes and removes a cache, by alias, from this cache manager. @param alias the alias of the cache to remove @param removeFromConfig if {@code true}, the cache configuration is altered to remove the cache
[ "Closes", "and", "removes", "a", "cache", "by", "alias", "from", "this", "cache", "manager", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/core/src/main/java/org/ehcache/core/EhcacheManager.java#L199-L220
mapsforge/mapsforge
mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java
PoiWriter.tagsToString
String tagsToString(Map<String, String> tagMap) { """ Convert tags to a string representation using '\r' delimiter. """ StringBuilder sb = new StringBuilder(); for (String key : tagMap.keySet()) { // Skip some tags if (key.equalsIgnoreCase("created_by")) { continue; } if (sb.length() > 0) { sb.append('\r'); } sb.append(key).append('=').append(tagMap.get(key)); } return sb.toString(); }
java
String tagsToString(Map<String, String> tagMap) { StringBuilder sb = new StringBuilder(); for (String key : tagMap.keySet()) { // Skip some tags if (key.equalsIgnoreCase("created_by")) { continue; } if (sb.length() > 0) { sb.append('\r'); } sb.append(key).append('=').append(tagMap.get(key)); } return sb.toString(); }
[ "String", "tagsToString", "(", "Map", "<", "String", ",", "String", ">", "tagMap", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "key", ":", "tagMap", ".", "keySet", "(", ")", ")", "{", "// Skip some...
Convert tags to a string representation using '\r' delimiter.
[ "Convert", "tags", "to", "a", "string", "representation", "using", "\\", "r", "delimiter", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi-writer/src/main/java/org/mapsforge/poi/writer/PoiWriter.java#L597-L610
JodaOrg/joda-time
src/main/java/org/joda/time/YearMonth.java
YearMonth.withChronologyRetainFields
public YearMonth withChronologyRetainFields(Chronology newChronology) { """ Returns a copy of this year-month with the specified chronology. This instance is immutable and unaffected by this method call. <p> This method retains the values of the fields, thus the result will typically refer to a different instant. <p> The time zone of the specified chronology is ignored, as YearMonth operates without a time zone. @param newChronology the new chronology, null means ISO @return a copy of this year-month with a different chronology, never null @throws IllegalArgumentException if the values are invalid for the new chronology """ newChronology = DateTimeUtils.getChronology(newChronology); newChronology = newChronology.withUTC(); if (newChronology == getChronology()) { return this; } else { YearMonth newYearMonth = new YearMonth(this, newChronology); newChronology.validate(newYearMonth, getValues()); return newYearMonth; } }
java
public YearMonth withChronologyRetainFields(Chronology newChronology) { newChronology = DateTimeUtils.getChronology(newChronology); newChronology = newChronology.withUTC(); if (newChronology == getChronology()) { return this; } else { YearMonth newYearMonth = new YearMonth(this, newChronology); newChronology.validate(newYearMonth, getValues()); return newYearMonth; } }
[ "public", "YearMonth", "withChronologyRetainFields", "(", "Chronology", "newChronology", ")", "{", "newChronology", "=", "DateTimeUtils", ".", "getChronology", "(", "newChronology", ")", ";", "newChronology", "=", "newChronology", ".", "withUTC", "(", ")", ";", "if"...
Returns a copy of this year-month with the specified chronology. This instance is immutable and unaffected by this method call. <p> This method retains the values of the fields, thus the result will typically refer to a different instant. <p> The time zone of the specified chronology is ignored, as YearMonth operates without a time zone. @param newChronology the new chronology, null means ISO @return a copy of this year-month with a different chronology, never null @throws IllegalArgumentException if the values are invalid for the new chronology
[ "Returns", "a", "copy", "of", "this", "year", "-", "month", "with", "the", "specified", "chronology", ".", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", ".", "<p", ">", "This", "method", "retains", "the", "valu...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/YearMonth.java#L447-L457
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
JenkinsServer.getJobXml
public String getJobXml(FolderJob folder, String jobName) throws IOException { """ Get the xml description of an existing job. @param jobName name of the job. @param folder {@link FolderJob} @return the new job object @throws IOException in case of an error. """ return client.get(UrlUtils.toJobBaseUrl(folder, jobName) + "/config.xml"); }
java
public String getJobXml(FolderJob folder, String jobName) throws IOException { return client.get(UrlUtils.toJobBaseUrl(folder, jobName) + "/config.xml"); }
[ "public", "String", "getJobXml", "(", "FolderJob", "folder", ",", "String", "jobName", ")", "throws", "IOException", "{", "return", "client", ".", "get", "(", "UrlUtils", ".", "toJobBaseUrl", "(", "folder", ",", "jobName", ")", "+", "\"/config.xml\"", ")", "...
Get the xml description of an existing job. @param jobName name of the job. @param folder {@link FolderJob} @return the new job object @throws IOException in case of an error.
[ "Get", "the", "xml", "description", "of", "an", "existing", "job", "." ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L523-L525
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/projects/CmsPublishProjectReport.java
CmsPublishProjectReport.startValidationThread
private void startValidationThread(CmsPublishList publishList) throws JspException { """ Starts the link validation thread for the project.<p> @param publishList the list of resources to publish @throws JspException if something goes wrong """ try { CmsRelationsValidatorThread thread = new CmsRelationsValidatorThread(getCms(), publishList, getSettings()); thread.start(); setParamThread(thread.getUUID().toString()); setParamThreadHasNext(CmsStringUtil.TRUE); setParamAction(REPORT_BEGIN); // set the key name for the continue checkbox setParamReportContinueKey(Messages.GUI_PUBLISH_CONTINUE_BROKEN_LINKS_0); } catch (Throwable e) { // error while link validation, show error screen includeErrorpage(this, e); } }
java
private void startValidationThread(CmsPublishList publishList) throws JspException { try { CmsRelationsValidatorThread thread = new CmsRelationsValidatorThread(getCms(), publishList, getSettings()); thread.start(); setParamThread(thread.getUUID().toString()); setParamThreadHasNext(CmsStringUtil.TRUE); setParamAction(REPORT_BEGIN); // set the key name for the continue checkbox setParamReportContinueKey(Messages.GUI_PUBLISH_CONTINUE_BROKEN_LINKS_0); } catch (Throwable e) { // error while link validation, show error screen includeErrorpage(this, e); } }
[ "private", "void", "startValidationThread", "(", "CmsPublishList", "publishList", ")", "throws", "JspException", "{", "try", "{", "CmsRelationsValidatorThread", "thread", "=", "new", "CmsRelationsValidatorThread", "(", "getCms", "(", ")", ",", "publishList", ",", "get...
Starts the link validation thread for the project.<p> @param publishList the list of resources to publish @throws JspException if something goes wrong
[ "Starts", "the", "link", "validation", "thread", "for", "the", "project", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/projects/CmsPublishProjectReport.java#L215-L232
kaichunlin/android-transition
core/src/main/java/com/kaichunlin/transition/AbstractTransitionBuilder.java
AbstractTransitionBuilder.transitInt
public T transitInt(int propertyId, int... vals) { """ Transits a float property from the start value to the end value. @param propertyId @param vals @return self """ String property = getPropertyName(propertyId); mHolders.put(propertyId, PropertyValuesHolder.ofInt(property, vals)); mShadowHolders.put(propertyId, ShadowValuesHolder.ofInt(property, vals)); return self(); }
java
public T transitInt(int propertyId, int... vals) { String property = getPropertyName(propertyId); mHolders.put(propertyId, PropertyValuesHolder.ofInt(property, vals)); mShadowHolders.put(propertyId, ShadowValuesHolder.ofInt(property, vals)); return self(); }
[ "public", "T", "transitInt", "(", "int", "propertyId", ",", "int", "...", "vals", ")", "{", "String", "property", "=", "getPropertyName", "(", "propertyId", ")", ";", "mHolders", ".", "put", "(", "propertyId", ",", "PropertyValuesHolder", ".", "ofInt", "(", ...
Transits a float property from the start value to the end value. @param propertyId @param vals @return self
[ "Transits", "a", "float", "property", "from", "the", "start", "value", "to", "the", "end", "value", "." ]
train
https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/AbstractTransitionBuilder.java#L656-L661
samskivert/pythagoras
src/main/java/pythagoras/i/Points.java
Points.manhattanDistance
public static int manhattanDistance (int x1, int y1, int x2, int y2) { """ Returns the Manhattan distance between the specified two points. """ return Math.abs(x2 - x1) + Math.abs(y2 - y1); }
java
public static int manhattanDistance (int x1, int y1, int x2, int y2) { return Math.abs(x2 - x1) + Math.abs(y2 - y1); }
[ "public", "static", "int", "manhattanDistance", "(", "int", "x1", ",", "int", "y1", ",", "int", "x2", ",", "int", "y2", ")", "{", "return", "Math", ".", "abs", "(", "x2", "-", "x1", ")", "+", "Math", ".", "abs", "(", "y2", "-", "y1", ")", ";", ...
Returns the Manhattan distance between the specified two points.
[ "Returns", "the", "Manhattan", "distance", "between", "the", "specified", "two", "points", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/i/Points.java#L32-L35
UrielCh/ovh-java-sdk
ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java
ApiOvhConnectivity.eligibility_search_buildingsByLine_POST
public OvhAsyncTaskArray<OvhBuilding> eligibility_search_buildingsByLine_POST(String lineNumber, OvhLineStatusEnum status) throws IOException { """ Get building references from a given line number REST: POST /connectivity/eligibility/search/buildingsByLine @param lineNumber [required] Line number @param status [required] Status of the line number """ String qPath = "/connectivity/eligibility/search/buildingsByLine"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "lineNumber", lineNumber); addBody(o, "status", status); String resp = execN(qPath, "POST", sb.toString(), o); return convertTo(resp, t1); }
java
public OvhAsyncTaskArray<OvhBuilding> eligibility_search_buildingsByLine_POST(String lineNumber, OvhLineStatusEnum status) throws IOException { String qPath = "/connectivity/eligibility/search/buildingsByLine"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "lineNumber", lineNumber); addBody(o, "status", status); String resp = execN(qPath, "POST", sb.toString(), o); return convertTo(resp, t1); }
[ "public", "OvhAsyncTaskArray", "<", "OvhBuilding", ">", "eligibility_search_buildingsByLine_POST", "(", "String", "lineNumber", ",", "OvhLineStatusEnum", "status", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/connectivity/eligibility/search/buildingsByLine\"",...
Get building references from a given line number REST: POST /connectivity/eligibility/search/buildingsByLine @param lineNumber [required] Line number @param status [required] Status of the line number
[ "Get", "building", "references", "from", "a", "given", "line", "number" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java#L139-L147
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/HybridRunbookWorkerGroupsInner.java
HybridRunbookWorkerGroupsInner.getAsync
public Observable<HybridRunbookWorkerGroupInner> getAsync(String resourceGroupName, String automationAccountName, String hybridRunbookWorkerGroupName) { """ Retrieve a hybrid runbook worker group. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param hybridRunbookWorkerGroupName The hybrid runbook worker group name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the HybridRunbookWorkerGroupInner object """ return getWithServiceResponseAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName).map(new Func1<ServiceResponse<HybridRunbookWorkerGroupInner>, HybridRunbookWorkerGroupInner>() { @Override public HybridRunbookWorkerGroupInner call(ServiceResponse<HybridRunbookWorkerGroupInner> response) { return response.body(); } }); }
java
public Observable<HybridRunbookWorkerGroupInner> getAsync(String resourceGroupName, String automationAccountName, String hybridRunbookWorkerGroupName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName).map(new Func1<ServiceResponse<HybridRunbookWorkerGroupInner>, HybridRunbookWorkerGroupInner>() { @Override public HybridRunbookWorkerGroupInner call(ServiceResponse<HybridRunbookWorkerGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "HybridRunbookWorkerGroupInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "hybridRunbookWorkerGroupName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName...
Retrieve a hybrid runbook worker group. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param hybridRunbookWorkerGroupName The hybrid runbook worker group name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the HybridRunbookWorkerGroupInner object
[ "Retrieve", "a", "hybrid", "runbook", "worker", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/HybridRunbookWorkerGroupsInner.java#L216-L223
trellis-ldp/trellis
core/http/src/main/java/org/trellisldp/http/impl/GetHandler.java
GetHandler.addMementoHeaders
public ResponseBuilder addMementoHeaders(final ResponseBuilder builder, final SortedSet<Instant> mementos) { """ Add the memento headers. @param builder the ResponseBuilder @param mementos the list of memento ranges @return the response builder """ // Only show memento links for the user-managed graph (not ACL) if (!ACL.equals(getRequest().getExt())) { builder.link(getIdentifier(), "original timegate") .links(MementoResource.getMementoLinks(getIdentifier(), mementos) .map(link -> MementoResource.filterLinkParams(link, !includeMementoDates)) .toArray(Link[]::new)); } return builder; }
java
public ResponseBuilder addMementoHeaders(final ResponseBuilder builder, final SortedSet<Instant> mementos) { // Only show memento links for the user-managed graph (not ACL) if (!ACL.equals(getRequest().getExt())) { builder.link(getIdentifier(), "original timegate") .links(MementoResource.getMementoLinks(getIdentifier(), mementos) .map(link -> MementoResource.filterLinkParams(link, !includeMementoDates)) .toArray(Link[]::new)); } return builder; }
[ "public", "ResponseBuilder", "addMementoHeaders", "(", "final", "ResponseBuilder", "builder", ",", "final", "SortedSet", "<", "Instant", ">", "mementos", ")", "{", "// Only show memento links for the user-managed graph (not ACL)", "if", "(", "!", "ACL", ".", "equals", "...
Add the memento headers. @param builder the ResponseBuilder @param mementos the list of memento ranges @return the response builder
[ "Add", "the", "memento", "headers", "." ]
train
https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/impl/GetHandler.java#L242-L251
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/crypto/CertUtils.java
CertUtils.isExpired
public static boolean isExpired(final X509CRL crl, final ZonedDateTime reference) { """ Determines whether the given CRL is expired by comparing the nextUpdate field with a given date. @param crl CRL to examine. @param reference Reference date for comparison. @return True if reference date is after CRL next update, false otherwise. """ return reference.isAfter(DateTimeUtils.zonedDateTimeOf(crl.getNextUpdate())); }
java
public static boolean isExpired(final X509CRL crl, final ZonedDateTime reference) { return reference.isAfter(DateTimeUtils.zonedDateTimeOf(crl.getNextUpdate())); }
[ "public", "static", "boolean", "isExpired", "(", "final", "X509CRL", "crl", ",", "final", "ZonedDateTime", "reference", ")", "{", "return", "reference", ".", "isAfter", "(", "DateTimeUtils", ".", "zonedDateTimeOf", "(", "crl", ".", "getNextUpdate", "(", ")", "...
Determines whether the given CRL is expired by comparing the nextUpdate field with a given date. @param crl CRL to examine. @param reference Reference date for comparison. @return True if reference date is after CRL next update, false otherwise.
[ "Determines", "whether", "the", "given", "CRL", "is", "expired", "by", "comparing", "the", "nextUpdate", "field", "with", "a", "given", "date", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/crypto/CertUtils.java#L55-L57
phoenixnap/springmvc-raml-plugin
src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/SchemaHelper.java
SchemaHelper.resolveSchema
public static String resolveSchema(String schema, RamlRoot document) { """ Utility method that will return a schema if the identifier is valid and exists in the raml file definition. @param schema The name of the schema to resolve @param document The Parent Raml Document @return The full schema if contained in the raml document or null if not found """ if (document == null || schema == null || schema.indexOf("{") != -1) { return null; } if (document.getSchemas() != null && !document.getSchemas().isEmpty()) { for (Map<String, String> map : document.getSchemas()) { if (map.containsKey(schema)) { return map.get(schema); } } } return null; }
java
public static String resolveSchema(String schema, RamlRoot document) { if (document == null || schema == null || schema.indexOf("{") != -1) { return null; } if (document.getSchemas() != null && !document.getSchemas().isEmpty()) { for (Map<String, String> map : document.getSchemas()) { if (map.containsKey(schema)) { return map.get(schema); } } } return null; }
[ "public", "static", "String", "resolveSchema", "(", "String", "schema", ",", "RamlRoot", "document", ")", "{", "if", "(", "document", "==", "null", "||", "schema", "==", "null", "||", "schema", ".", "indexOf", "(", "\"{\"", ")", "!=", "-", "1", ")", "{...
Utility method that will return a schema if the identifier is valid and exists in the raml file definition. @param schema The name of the schema to resolve @param document The Parent Raml Document @return The full schema if contained in the raml document or null if not found
[ "Utility", "method", "that", "will", "return", "a", "schema", "if", "the", "identifier", "is", "valid", "and", "exists", "in", "the", "raml", "file", "definition", "." ]
train
https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/SchemaHelper.java#L68-L80
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java
MarvinImage.getBufferedImage
public BufferedImage getBufferedImage(int width, int height, int type) { """ Resize and return the image passing the new height and width, but maintains width/height factor @param height @param width @return """ int wDif, hDif, fWidth = 0, fHeight = 0; double imgWidth, imgHeight; double factor; imgWidth = image.getWidth(); imgHeight = image.getHeight(); switch (type) { case PROPORTIONAL: wDif = (int) imgWidth - width; hDif = (int) imgHeight - height; if (wDif > hDif) { factor = width / imgWidth; } else { factor = height / imgHeight; } fWidth = (int) Math.floor(imgWidth * factor); fHeight = (int) Math.floor(imgHeight * factor); break; } return getBufferedImage(fWidth, fHeight); }
java
public BufferedImage getBufferedImage(int width, int height, int type) { int wDif, hDif, fWidth = 0, fHeight = 0; double imgWidth, imgHeight; double factor; imgWidth = image.getWidth(); imgHeight = image.getHeight(); switch (type) { case PROPORTIONAL: wDif = (int) imgWidth - width; hDif = (int) imgHeight - height; if (wDif > hDif) { factor = width / imgWidth; } else { factor = height / imgHeight; } fWidth = (int) Math.floor(imgWidth * factor); fHeight = (int) Math.floor(imgHeight * factor); break; } return getBufferedImage(fWidth, fHeight); }
[ "public", "BufferedImage", "getBufferedImage", "(", "int", "width", ",", "int", "height", ",", "int", "type", ")", "{", "int", "wDif", ",", "hDif", ",", "fWidth", "=", "0", ",", "fHeight", "=", "0", ";", "double", "imgWidth", ",", "imgHeight", ";", "do...
Resize and return the image passing the new height and width, but maintains width/height factor @param height @param width @return
[ "Resize", "and", "return", "the", "image", "passing", "the", "new", "height", "and", "width", "but", "maintains", "width", "/", "height", "factor" ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L497-L525
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.listWebAppsByHybridConnectionAsync
public Observable<Page<String>> listWebAppsByHybridConnectionAsync(final String resourceGroupName, final String name, final String namespaceName, final String relayName) { """ Get all apps that use a Hybrid Connection in an App Service Plan. Get all apps that use a Hybrid Connection in an App Service Plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param namespaceName Name of the Hybrid Connection namespace. @param relayName Name of the Hybrid Connection relay. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;String&gt; object """ return listWebAppsByHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName) .map(new Func1<ServiceResponse<Page<String>>, Page<String>>() { @Override public Page<String> call(ServiceResponse<Page<String>> response) { return response.body(); } }); }
java
public Observable<Page<String>> listWebAppsByHybridConnectionAsync(final String resourceGroupName, final String name, final String namespaceName, final String relayName) { return listWebAppsByHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName) .map(new Func1<ServiceResponse<Page<String>>, Page<String>>() { @Override public Page<String> call(ServiceResponse<Page<String>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "String", ">", ">", "listWebAppsByHybridConnectionAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ",", "final", "String", "namespaceName", ",", "final", "String", "relayName", ")", "{",...
Get all apps that use a Hybrid Connection in an App Service Plan. Get all apps that use a Hybrid Connection in an App Service Plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param namespaceName Name of the Hybrid Connection namespace. @param relayName Name of the Hybrid Connection relay. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;String&gt; object
[ "Get", "all", "apps", "that", "use", "a", "Hybrid", "Connection", "in", "an", "App", "Service", "Plan", ".", "Get", "all", "apps", "that", "use", "a", "Hybrid", "Connection", "in", "an", "App", "Service", "Plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1492-L1500
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
MapWidget.setScalebarEnabled
public void setScalebarEnabled(boolean enabled) { """ Enables or disables the scale bar. This setting has immediate effect on the map. @param enabled set status """ scaleBarEnabled = enabled; final String scaleBarId = "scalebar"; if (scaleBarEnabled) { if (!getMapAddons().containsKey(scaleBarId)) { ScaleBar scalebar = new ScaleBar(scaleBarId, this); scalebar.setVerticalAlignment(VerticalAlignment.BOTTOM); scalebar.setHorizontalMargin(2); scalebar.setVerticalMargin(2); scalebar.initialize(getMapModel().getMapInfo().getDisplayUnitType(), unitLength, new Coordinate(20, graphics.getHeight() - 25)); registerMapAddon(scalebar); } } else { unregisterMapAddon(addons.get(scaleBarId)); } }
java
public void setScalebarEnabled(boolean enabled) { scaleBarEnabled = enabled; final String scaleBarId = "scalebar"; if (scaleBarEnabled) { if (!getMapAddons().containsKey(scaleBarId)) { ScaleBar scalebar = new ScaleBar(scaleBarId, this); scalebar.setVerticalAlignment(VerticalAlignment.BOTTOM); scalebar.setHorizontalMargin(2); scalebar.setVerticalMargin(2); scalebar.initialize(getMapModel().getMapInfo().getDisplayUnitType(), unitLength, new Coordinate(20, graphics.getHeight() - 25)); registerMapAddon(scalebar); } } else { unregisterMapAddon(addons.get(scaleBarId)); } }
[ "public", "void", "setScalebarEnabled", "(", "boolean", "enabled", ")", "{", "scaleBarEnabled", "=", "enabled", ";", "final", "String", "scaleBarId", "=", "\"scalebar\"", ";", "if", "(", "scaleBarEnabled", ")", "{", "if", "(", "!", "getMapAddons", "(", ")", ...
Enables or disables the scale bar. This setting has immediate effect on the map. @param enabled set status
[ "Enables", "or", "disables", "the", "scale", "bar", ".", "This", "setting", "has", "immediate", "effect", "on", "the", "map", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L727-L744
protegeproject/jpaul
src/main/java/jpaul/DataStructs/DSUtil.java
DSUtil.mapColl
public static <E1,E2> Collection<E2> mapColl(Iterable<E1> coll, Map<E1,E2> map, Collection<E2> newColl) { """ Similar to teh other <code>mapColl</code> method, but the function is given as a map. This map is expected to map all elements from the entry collection <code>coll</code>. @see #mapColl(Iterable, Function, Collection) """ return mapColl(coll, map2fun(map), newColl); }
java
public static <E1,E2> Collection<E2> mapColl(Iterable<E1> coll, Map<E1,E2> map, Collection<E2> newColl) { return mapColl(coll, map2fun(map), newColl); }
[ "public", "static", "<", "E1", ",", "E2", ">", "Collection", "<", "E2", ">", "mapColl", "(", "Iterable", "<", "E1", ">", "coll", ",", "Map", "<", "E1", ",", "E2", ">", "map", ",", "Collection", "<", "E2", ">", "newColl", ")", "{", "return", "mapC...
Similar to teh other <code>mapColl</code> method, but the function is given as a map. This map is expected to map all elements from the entry collection <code>coll</code>. @see #mapColl(Iterable, Function, Collection)
[ "Similar", "to", "teh", "other", "<code", ">", "mapColl<", "/", "code", ">", "method", "but", "the", "function", "is", "given", "as", "a", "map", ".", "This", "map", "is", "expected", "to", "map", "all", "elements", "from", "the", "entry", "collection", ...
train
https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/DataStructs/DSUtil.java#L279-L281
apache/groovy
src/main/java/org/codehaus/groovy/classgen/InnerClassCompletionVisitor.java
InnerClassCompletionVisitor.addCompilationErrorOnCustomMethodNode
private void addCompilationErrorOnCustomMethodNode(InnerClassNode node, String methodName, Parameter[] parameters) { """ Adds a compilation error if a {@link MethodNode} with the given <tt>methodName</tt> and <tt>parameters</tt> exists in the {@link InnerClassNode}. """ MethodNode existingMethodNode = node.getMethod(methodName, parameters); // if there is a user-defined methodNode, add compiler error msg and continue if (existingMethodNode != null && !isSynthetic(existingMethodNode)) { addError("\"" +methodName + "\" implementations are not supported on static inner classes as " + "a synthetic version of \"" + methodName + "\" is added during compilation for the purpose " + "of outer class delegation.", existingMethodNode); } }
java
private void addCompilationErrorOnCustomMethodNode(InnerClassNode node, String methodName, Parameter[] parameters) { MethodNode existingMethodNode = node.getMethod(methodName, parameters); // if there is a user-defined methodNode, add compiler error msg and continue if (existingMethodNode != null && !isSynthetic(existingMethodNode)) { addError("\"" +methodName + "\" implementations are not supported on static inner classes as " + "a synthetic version of \"" + methodName + "\" is added during compilation for the purpose " + "of outer class delegation.", existingMethodNode); } }
[ "private", "void", "addCompilationErrorOnCustomMethodNode", "(", "InnerClassNode", "node", ",", "String", "methodName", ",", "Parameter", "[", "]", "parameters", ")", "{", "MethodNode", "existingMethodNode", "=", "node", ".", "getMethod", "(", "methodName", ",", "pa...
Adds a compilation error if a {@link MethodNode} with the given <tt>methodName</tt> and <tt>parameters</tt> exists in the {@link InnerClassNode}.
[ "Adds", "a", "compilation", "error", "if", "a", "{" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/InnerClassCompletionVisitor.java#L349-L358
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/output/CliPrinter.java
CliPrinter.printCommand
public void printCommand(CliCommand command) { """ Print a command (it's name, description and parameters). @param command Command to describe. """ final PrintContext context = new PrintContext(); // Print command name : description printIdentifiable(context, command); // Print each param name : description printIdentifiables(context, command.getParams()); }
java
public void printCommand(CliCommand command) { final PrintContext context = new PrintContext(); // Print command name : description printIdentifiable(context, command); // Print each param name : description printIdentifiables(context, command.getParams()); }
[ "public", "void", "printCommand", "(", "CliCommand", "command", ")", "{", "final", "PrintContext", "context", "=", "new", "PrintContext", "(", ")", ";", "// Print command name : description", "printIdentifiable", "(", "context", ",", "command", ")", ";", "// Print e...
Print a command (it's name, description and parameters). @param command Command to describe.
[ "Print", "a", "command", "(", "it", "s", "name", "description", "and", "parameters", ")", "." ]
train
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/output/CliPrinter.java#L132-L140
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java
InstantiateOperation.initiateByMethodName
private Object initiateByMethodName(Class<?> targetClass, String initMethodName, List<Object> objects) throws Exception { """ Tries to initiate an object of the target class through the given init method name with the given object as parameter. """ Method method = targetClass.getMethod(initMethodName, getClassList(objects)); if (Modifier.isStatic(method.getModifiers())) { return method.invoke(null, objects.toArray()); } else { return method.invoke(targetClass.newInstance(), objects.toArray()); } }
java
private Object initiateByMethodName(Class<?> targetClass, String initMethodName, List<Object> objects) throws Exception { Method method = targetClass.getMethod(initMethodName, getClassList(objects)); if (Modifier.isStatic(method.getModifiers())) { return method.invoke(null, objects.toArray()); } else { return method.invoke(targetClass.newInstance(), objects.toArray()); } }
[ "private", "Object", "initiateByMethodName", "(", "Class", "<", "?", ">", "targetClass", ",", "String", "initMethodName", ",", "List", "<", "Object", ">", "objects", ")", "throws", "Exception", "{", "Method", "method", "=", "targetClass", ".", "getMethod", "("...
Tries to initiate an object of the target class through the given init method name with the given object as parameter.
[ "Tries", "to", "initiate", "an", "object", "of", "the", "target", "class", "through", "the", "given", "init", "method", "name", "with", "the", "given", "object", "as", "parameter", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/InstantiateOperation.java#L103-L111
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java
WebUtils.putServiceIntoFlashScope
public static void putServiceIntoFlashScope(final RequestContext context, final Service service) { """ Put service into flashscope. @param context the context @param service the service """ context.getFlashScope().put(PARAMETER_SERVICE, service); }
java
public static void putServiceIntoFlashScope(final RequestContext context, final Service service) { context.getFlashScope().put(PARAMETER_SERVICE, service); }
[ "public", "static", "void", "putServiceIntoFlashScope", "(", "final", "RequestContext", "context", ",", "final", "Service", "service", ")", "{", "context", ".", "getFlashScope", "(", ")", ".", "put", "(", "PARAMETER_SERVICE", ",", "service", ")", ";", "}" ]
Put service into flashscope. @param context the context @param service the service
[ "Put", "service", "into", "flashscope", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L309-L311
telly/groundy
library/src/main/java/com/telly/groundy/DeviceStatus.java
DeviceStatus.keepCpuAwake
public static void keepCpuAwake(Context context, boolean awake) { """ Register a wake lock to power management in the device. @param context Context to use @param awake if true the device cpu will keep awake until false is called back. if true is passed several times only the first time after a false call will take effect, also if false is passed and previously the cpu was not turned on (true call) does nothing. """ if (cpuWakeLock == null) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); if (pm != null) { cpuWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); cpuWakeLock.setReferenceCounted(true); } } if (cpuWakeLock != null) { //May be null if pm is null if (awake) { cpuWakeLock.acquire(); L.d(TAG, "Adquired CPU lock"); } else if (cpuWakeLock.isHeld()) { cpuWakeLock.release(); L.d(TAG, "Released CPU lock"); } } }
java
public static void keepCpuAwake(Context context, boolean awake) { if (cpuWakeLock == null) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); if (pm != null) { cpuWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); cpuWakeLock.setReferenceCounted(true); } } if (cpuWakeLock != null) { //May be null if pm is null if (awake) { cpuWakeLock.acquire(); L.d(TAG, "Adquired CPU lock"); } else if (cpuWakeLock.isHeld()) { cpuWakeLock.release(); L.d(TAG, "Released CPU lock"); } } }
[ "public", "static", "void", "keepCpuAwake", "(", "Context", "context", ",", "boolean", "awake", ")", "{", "if", "(", "cpuWakeLock", "==", "null", ")", "{", "PowerManager", "pm", "=", "(", "PowerManager", ")", "context", ".", "getSystemService", "(", "Context...
Register a wake lock to power management in the device. @param context Context to use @param awake if true the device cpu will keep awake until false is called back. if true is passed several times only the first time after a false call will take effect, also if false is passed and previously the cpu was not turned on (true call) does nothing.
[ "Register", "a", "wake", "lock", "to", "power", "management", "in", "the", "device", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/DeviceStatus.java#L85-L103
google/closure-templates
java/src/com/google/template/soy/types/SoyTypeRegistry.java
SoyTypeRegistry.getOrCreateRecordType
public RecordType getOrCreateRecordType(Map<String, SoyType> fields) { """ Factory function which creates a record type, given a map of fields. This folds map types with identical key/value types together, so asking for the same key/value type twice will return a pointer to the same type object. @param fields The map containing field names and types. @return The record type. """ return recordTypes.intern(RecordType.of(fields)); }
java
public RecordType getOrCreateRecordType(Map<String, SoyType> fields) { return recordTypes.intern(RecordType.of(fields)); }
[ "public", "RecordType", "getOrCreateRecordType", "(", "Map", "<", "String", ",", "SoyType", ">", "fields", ")", "{", "return", "recordTypes", ".", "intern", "(", "RecordType", ".", "of", "(", "fields", ")", ")", ";", "}" ]
Factory function which creates a record type, given a map of fields. This folds map types with identical key/value types together, so asking for the same key/value type twice will return a pointer to the same type object. @param fields The map containing field names and types. @return The record type.
[ "Factory", "function", "which", "creates", "a", "record", "type", "given", "a", "map", "of", "fields", ".", "This", "folds", "map", "types", "with", "identical", "key", "/", "value", "types", "together", "so", "asking", "for", "the", "same", "key", "/", ...
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyTypeRegistry.java#L297-L299
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/ListInventoryEntriesResult.java
ListInventoryEntriesResult.withEntries
public ListInventoryEntriesResult withEntries(java.util.Collection<java.util.Map<String, String>> entries) { """ <p> A list of inventory items on the instance(s). </p> @param entries A list of inventory items on the instance(s). @return Returns a reference to this object so that method calls can be chained together. """ setEntries(entries); return this; }
java
public ListInventoryEntriesResult withEntries(java.util.Collection<java.util.Map<String, String>> entries) { setEntries(entries); return this; }
[ "public", "ListInventoryEntriesResult", "withEntries", "(", "java", ".", "util", ".", "Collection", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", ">", "entries", ")", "{", "setEntries", "(", "entries", ")", ";", "return", "this",...
<p> A list of inventory items on the instance(s). </p> @param entries A list of inventory items on the instance(s). @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "list", "of", "inventory", "items", "on", "the", "instance", "(", "s", ")", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/ListInventoryEntriesResult.java#L292-L295
hal/core
gui/src/main/java/org/jboss/as/console/client/domain/model/impl/ServerGroupDAOImpl.java
ServerGroupDAOImpl.model2ServerGroup
private ServerGroupRecord model2ServerGroup(String groupName, ModelNode model) { """ Turns a server group DMR model into a strongly typed entity @param groupName @param model @return """ ServerGroupRecord record = factory.serverGroup().as(); record.setName(groupName); record.setProfileName(model.get("profile").asString()); record.setSocketBinding(model.get("socket-binding-group").asString()); Jvm jvm = ModelAdapter.model2JVM(factory, model); if(jvm!=null) jvm.setInherited(false); // on this level they can't inherit from anyone record.setJvm(jvm); List<PropertyRecord> propertyRecords = ModelAdapter.model2Property(factory, model); record.setProperties(propertyRecords); return record; }
java
private ServerGroupRecord model2ServerGroup(String groupName, ModelNode model) { ServerGroupRecord record = factory.serverGroup().as(); record.setName(groupName); record.setProfileName(model.get("profile").asString()); record.setSocketBinding(model.get("socket-binding-group").asString()); Jvm jvm = ModelAdapter.model2JVM(factory, model); if(jvm!=null) jvm.setInherited(false); // on this level they can't inherit from anyone record.setJvm(jvm); List<PropertyRecord> propertyRecords = ModelAdapter.model2Property(factory, model); record.setProperties(propertyRecords); return record; }
[ "private", "ServerGroupRecord", "model2ServerGroup", "(", "String", "groupName", ",", "ModelNode", "model", ")", "{", "ServerGroupRecord", "record", "=", "factory", ".", "serverGroup", "(", ")", ".", "as", "(", ")", ";", "record", ".", "setName", "(", "groupNa...
Turns a server group DMR model into a strongly typed entity @param groupName @param model @return
[ "Turns", "a", "server", "group", "DMR", "model", "into", "a", "strongly", "typed", "entity" ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/domain/model/impl/ServerGroupDAOImpl.java#L217-L235
landawn/AbacusUtil
src/com/landawn/abacus/util/JdbcUtil.java
JdbcUtil.importData
public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count, final PreparedStatement stmt, final int batchSize, final int batchInterval) throws UncheckedSQLException { """ Imports the data from <code>DataSet</code> to database. @param dataset @param selectColumnNames @param offset @param count @param stmt the column order in the sql must be consistent with the column order in the DataSet. @return @throws UncheckedSQLException """ return importData(dataset, selectColumnNames, offset, count, Fn.alwaysTrue(), stmt, batchSize, batchInterval); }
java
public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count, final PreparedStatement stmt, final int batchSize, final int batchInterval) throws UncheckedSQLException { return importData(dataset, selectColumnNames, offset, count, Fn.alwaysTrue(), stmt, batchSize, batchInterval); }
[ "public", "static", "int", "importData", "(", "final", "DataSet", "dataset", ",", "final", "Collection", "<", "String", ">", "selectColumnNames", ",", "final", "int", "offset", ",", "final", "int", "count", ",", "final", "PreparedStatement", "stmt", ",", "fina...
Imports the data from <code>DataSet</code> to database. @param dataset @param selectColumnNames @param offset @param count @param stmt the column order in the sql must be consistent with the column order in the DataSet. @return @throws UncheckedSQLException
[ "Imports", "the", "data", "from", "<code", ">", "DataSet<", "/", "code", ">", "to", "database", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L2220-L2223
lastaflute/lastaflute
src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java
TypicalLoginAssist.createRememberMeKey
protected String createRememberMeKey(USER_ENTITY userEntity, USER_BEAN userBean) { """ Create remember-me key for the user. <br> You can change user key's structure by override. #change_user_key @param userEntity The selected entity of login user. (NotNull) @param userBean The user bean saved in session. (NotNull) @return The string expression for remember-me key. (NotNull) """ return String.valueOf(userBean.getUserId()); // as default (override if it needs) }
java
protected String createRememberMeKey(USER_ENTITY userEntity, USER_BEAN userBean) { return String.valueOf(userBean.getUserId()); // as default (override if it needs) }
[ "protected", "String", "createRememberMeKey", "(", "USER_ENTITY", "userEntity", ",", "USER_BEAN", "userBean", ")", "{", "return", "String", ".", "valueOf", "(", "userBean", ".", "getUserId", "(", ")", ")", ";", "// as default (override if it needs)", "}" ]
Create remember-me key for the user. <br> You can change user key's structure by override. #change_user_key @param userEntity The selected entity of login user. (NotNull) @param userBean The user bean saved in session. (NotNull) @return The string expression for remember-me key. (NotNull)
[ "Create", "remember", "-", "me", "key", "for", "the", "user", ".", "<br", ">", "You", "can", "change", "user", "key", "s", "structure", "by", "override", ".", "#change_user_key" ]
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java#L466-L468
sangupta/jerry-web
src/main/java/com/sangupta/jerry/web/filters/JavascriptReorderingFilter.java
JavascriptReorderingFilter.doFilter
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { """ Move all included JavaScript files to the end of <code>BODY</code> tag in the same order that they appeared in the original HTML response. @param servletRequest the incoming {@link ServletRequest} instance @param servletResponse the outgoing {@link ServletResponse} instance @param filterChain the {@link FilterChain} being executed @throws IOException if something fails @throws ServletException if something fails @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) """ // try and see if this request is for an HTML page HttpServletRequest request = (HttpServletRequest) servletRequest; String uri = request.getRequestURI(); final boolean htmlPage = isHtmlPage(uri); // if this is an HTML page, get the entire contents of the page // in a byte-stream if (!htmlPage) { LOGGER.debug("Not an HTML page for javascript reordering: {}", uri); filterChain.doFilter(servletRequest, servletResponse); return; } // run through a wrapper response object HttpServletResponseWrapperImpl wrapper = new HttpServletResponseWrapperImpl((HttpServletResponse) servletResponse); filterChain.doFilter(servletRequest, wrapper); // check if this is an HTML output if (!"text/html".equals(wrapper.getContentType())) { LOGGER.debug("Response content not HTML for javascript reordering: {}", uri); // just write the plain response // this is not HTML response wrapper.copyToResponse(servletResponse); return; } final long startTime = System.currentTimeMillis(); LOGGER.debug("Javascript reordering candidate found: {}", uri); writeReorderedHtml(wrapper, servletResponse); final long endTime = System.currentTimeMillis(); LOGGER.debug("Reordering javascript for url: {} took: {}ms", uri, (endTime - startTime)); }
java
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { // try and see if this request is for an HTML page HttpServletRequest request = (HttpServletRequest) servletRequest; String uri = request.getRequestURI(); final boolean htmlPage = isHtmlPage(uri); // if this is an HTML page, get the entire contents of the page // in a byte-stream if (!htmlPage) { LOGGER.debug("Not an HTML page for javascript reordering: {}", uri); filterChain.doFilter(servletRequest, servletResponse); return; } // run through a wrapper response object HttpServletResponseWrapperImpl wrapper = new HttpServletResponseWrapperImpl((HttpServletResponse) servletResponse); filterChain.doFilter(servletRequest, wrapper); // check if this is an HTML output if (!"text/html".equals(wrapper.getContentType())) { LOGGER.debug("Response content not HTML for javascript reordering: {}", uri); // just write the plain response // this is not HTML response wrapper.copyToResponse(servletResponse); return; } final long startTime = System.currentTimeMillis(); LOGGER.debug("Javascript reordering candidate found: {}", uri); writeReorderedHtml(wrapper, servletResponse); final long endTime = System.currentTimeMillis(); LOGGER.debug("Reordering javascript for url: {} took: {}ms", uri, (endTime - startTime)); }
[ "@", "Override", "public", "void", "doFilter", "(", "ServletRequest", "servletRequest", ",", "ServletResponse", "servletResponse", ",", "FilterChain", "filterChain", ")", "throws", "IOException", ",", "ServletException", "{", "// try and see if this request is for an HTML pag...
Move all included JavaScript files to the end of <code>BODY</code> tag in the same order that they appeared in the original HTML response. @param servletRequest the incoming {@link ServletRequest} instance @param servletResponse the outgoing {@link ServletResponse} instance @param filterChain the {@link FilterChain} being executed @throws IOException if something fails @throws ServletException if something fails @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
[ "Move", "all", "included", "JavaScript", "files", "to", "the", "end", "of", "<code", ">", "BODY<", "/", "code", ">", "tag", "in", "the", "same", "order", "that", "they", "appeared", "in", "the", "original", "HTML", "response", "." ]
train
https://github.com/sangupta/jerry-web/blob/f0d02a5d6e7d1c15292509ce588caf52a4ddb895/src/main/java/com/sangupta/jerry/web/filters/JavascriptReorderingFilter.java#L93-L130
pmwmedia/tinylog
benchmarks/src/main/java/org/tinylog/benchmarks/api/WritingBenchmark.java
WritingBenchmark.byteBufferFileChannel
@Benchmark @BenchmarkMode(Mode.AverageTime) public void byteBufferFileChannel(final Configuration configuration) throws IOException { """ Benchmarks writing via {@link FileChannel} with using a {@link ByteBuffer} for buffering. @param configuration Configuration with target file @throws IOException Failed to write to target file """ ByteBuffer buffer = ByteBuffer.allocate(BUFFER_CAPACITY); try (RandomAccessFile file = new RandomAccessFile(configuration.file, "rw")) { try (FileChannel channel = file.getChannel()) { for (long i = 0; i < LINES; ++i) { if (buffer.remaining() < DATA.length) { buffer.flip(); channel.write(buffer); buffer.clear(); } if (buffer.remaining() < DATA.length) { file.write(DATA); } else { buffer.put(DATA); } } if (buffer.position() > 0) { buffer.flip(); channel.write(buffer); } } } }
java
@Benchmark @BenchmarkMode(Mode.AverageTime) public void byteBufferFileChannel(final Configuration configuration) throws IOException { ByteBuffer buffer = ByteBuffer.allocate(BUFFER_CAPACITY); try (RandomAccessFile file = new RandomAccessFile(configuration.file, "rw")) { try (FileChannel channel = file.getChannel()) { for (long i = 0; i < LINES; ++i) { if (buffer.remaining() < DATA.length) { buffer.flip(); channel.write(buffer); buffer.clear(); } if (buffer.remaining() < DATA.length) { file.write(DATA); } else { buffer.put(DATA); } } if (buffer.position() > 0) { buffer.flip(); channel.write(buffer); } } } }
[ "@", "Benchmark", "@", "BenchmarkMode", "(", "Mode", ".", "AverageTime", ")", "public", "void", "byteBufferFileChannel", "(", "final", "Configuration", "configuration", ")", "throws", "IOException", "{", "ByteBuffer", "buffer", "=", "ByteBuffer", ".", "allocate", ...
Benchmarks writing via {@link FileChannel} with using a {@link ByteBuffer} for buffering. @param configuration Configuration with target file @throws IOException Failed to write to target file
[ "Benchmarks", "writing", "via", "{", "@link", "FileChannel", "}", "with", "using", "a", "{", "@link", "ByteBuffer", "}", "for", "buffering", "." ]
train
https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/benchmarks/src/main/java/org/tinylog/benchmarks/api/WritingBenchmark.java#L217-L244
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/BetaDistribution.java
BetaDistribution.regularizedIncBeta
public static double regularizedIncBeta(double x, double alpha, double beta) { """ Computes the regularized incomplete beta function I_x(a, b) which is also the CDF of the beta distribution. Based on the book "Numerical Recipes" @param alpha Parameter a @param beta Parameter b @param x Parameter x @return Value of the regularized incomplete beta function """ if(alpha <= 0.0 || beta <= 0.0 || Double.isNaN(alpha) || Double.isNaN(beta) || Double.isNaN(x)) { return Double.NaN; } if(x <= 0.0) { return 0.0; } if(x >= 1.0) { return 1.0; } if(alpha > SWITCH && beta > SWITCH) { return regularizedIncBetaQuadrature(alpha, beta, x); } double bt = FastMath.exp(-logBeta(alpha, beta) + alpha * FastMath.log(x) + beta * FastMath.log1p(-x)); return (x < (alpha + 1.0) / (alpha + beta + 2.0)) // ? bt * regularizedIncBetaCF(alpha, beta, x) / alpha // : 1.0 - bt * regularizedIncBetaCF(beta, alpha, 1.0 - x) / beta; }
java
public static double regularizedIncBeta(double x, double alpha, double beta) { if(alpha <= 0.0 || beta <= 0.0 || Double.isNaN(alpha) || Double.isNaN(beta) || Double.isNaN(x)) { return Double.NaN; } if(x <= 0.0) { return 0.0; } if(x >= 1.0) { return 1.0; } if(alpha > SWITCH && beta > SWITCH) { return regularizedIncBetaQuadrature(alpha, beta, x); } double bt = FastMath.exp(-logBeta(alpha, beta) + alpha * FastMath.log(x) + beta * FastMath.log1p(-x)); return (x < (alpha + 1.0) / (alpha + beta + 2.0)) // ? bt * regularizedIncBetaCF(alpha, beta, x) / alpha // : 1.0 - bt * regularizedIncBetaCF(beta, alpha, 1.0 - x) / beta; }
[ "public", "static", "double", "regularizedIncBeta", "(", "double", "x", ",", "double", "alpha", ",", "double", "beta", ")", "{", "if", "(", "alpha", "<=", "0.0", "||", "beta", "<=", "0.0", "||", "Double", ".", "isNaN", "(", "alpha", ")", "||", "Double"...
Computes the regularized incomplete beta function I_x(a, b) which is also the CDF of the beta distribution. Based on the book "Numerical Recipes" @param alpha Parameter a @param beta Parameter b @param x Parameter x @return Value of the regularized incomplete beta function
[ "Computes", "the", "regularized", "incomplete", "beta", "function", "I_x", "(", "a", "b", ")", "which", "is", "also", "the", "CDF", "of", "the", "beta", "distribution", ".", "Based", "on", "the", "book", "Numerical", "Recipes" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/BetaDistribution.java#L241-L258
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/query/values/JcElement.java
JcElement.numberProperty
public JcNumber numberProperty(String name) { """ <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div> <div color='red' style="font-size:18px;color:red"><i>access a named number property, return a <b>JcNumber</b></i></div> <br/> """ JcNumber ret = new JcNumber(name, this, OPERATOR.PropertyContainer.PROPERTY_ACCESS); QueryRecorder.recordInvocationConditional(this, "numberProperty", ret, QueryRecorder.literal(name)); return ret; }
java
public JcNumber numberProperty(String name) { JcNumber ret = new JcNumber(name, this, OPERATOR.PropertyContainer.PROPERTY_ACCESS); QueryRecorder.recordInvocationConditional(this, "numberProperty", ret, QueryRecorder.literal(name)); return ret; }
[ "public", "JcNumber", "numberProperty", "(", "String", "name", ")", "{", "JcNumber", "ret", "=", "new", "JcNumber", "(", "name", ",", "this", ",", "OPERATOR", ".", "PropertyContainer", ".", "PROPERTY_ACCESS", ")", ";", "QueryRecorder", ".", "recordInvocationCond...
<div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div> <div color='red' style="font-size:18px;color:red"><i>access a named number property, return a <b>JcNumber</b></i></div> <br/>
[ "<div", "color", "=", "red", "style", "=", "font", "-", "size", ":", "24px", ";", "color", ":", "red", ">", "<b", ">", "<i", ">", "<u", ">", "JCYPHER<", "/", "u", ">", "<", "/", "i", ">", "<", "/", "b", ">", "<", "/", "div", ">", "<div", ...
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcElement.java#L64-L68
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java
Bytes.toInt
public static int toInt(byte[] bytes, int offset, final int length) { """ Converts a byte array to an int value. @param bytes byte array @param offset offset into array @param length length of int (has to be {@link #SIZEOF_INT}) @return the int value @throws IllegalArgumentException if length is not {@link #SIZEOF_INT} or if there's not enough room in the array at the offset indicated. """ if (length != SIZEOF_INT || offset + length > bytes.length) { throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_INT); } int n = 0; for (int i = offset; i < (offset + length); i++) { n <<= 8; n ^= bytes[i] & 0xFF; } return n; }
java
public static int toInt(byte[] bytes, int offset, final int length) { if (length != SIZEOF_INT || offset + length > bytes.length) { throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_INT); } int n = 0; for (int i = offset; i < (offset + length); i++) { n <<= 8; n ^= bytes[i] & 0xFF; } return n; }
[ "public", "static", "int", "toInt", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "final", "int", "length", ")", "{", "if", "(", "length", "!=", "SIZEOF_INT", "||", "offset", "+", "length", ">", "bytes", ".", "length", ")", "{", "throw",...
Converts a byte array to an int value. @param bytes byte array @param offset offset into array @param length length of int (has to be {@link #SIZEOF_INT}) @return the int value @throws IllegalArgumentException if length is not {@link #SIZEOF_INT} or if there's not enough room in the array at the offset indicated.
[ "Converts", "a", "byte", "array", "to", "an", "int", "value", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L567-L577
NLPchina/ansj_seg
src/main/java/org/ansj/app/extracting/ExtractingTask.java
ExtractingTask._validate
private boolean _validate(Token token, Term term) { """ 验证term的名字或者词性是否符合条件 @param token @param term @return true, 不符合,false 符合 """ if (token == null) { return true; } Set<String> terms = token.getTerms(); if ((!terms.contains(Token.ALL)) && !terms.contains(term.getName()) && !(terms.contains(":" + term.getNatureStr()))) { return true; } boolean flag = token.getRegexs().size() != 0; for (String regex : token.getRegexs()) { if (term.getName().matches(regex)) { flag = false; break; } } return flag; }
java
private boolean _validate(Token token, Term term) { if (token == null) { return true; } Set<String> terms = token.getTerms(); if ((!terms.contains(Token.ALL)) && !terms.contains(term.getName()) && !(terms.contains(":" + term.getNatureStr()))) { return true; } boolean flag = token.getRegexs().size() != 0; for (String regex : token.getRegexs()) { if (term.getName().matches(regex)) { flag = false; break; } } return flag; }
[ "private", "boolean", "_validate", "(", "Token", "token", ",", "Term", "term", ")", "{", "if", "(", "token", "==", "null", ")", "{", "return", "true", ";", "}", "Set", "<", "String", ">", "terms", "=", "token", ".", "getTerms", "(", ")", ";", "if",...
验证term的名字或者词性是否符合条件 @param token @param term @return true, 不符合,false 符合
[ "验证term的名字或者词性是否符合条件" ]
train
https://github.com/NLPchina/ansj_seg/blob/1addfa08c9dc86872fcdb06c7f0955dd5d197585/src/main/java/org/ansj/app/extracting/ExtractingTask.java#L169-L190
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/IO.java
IO.createTempFile
public static File createTempFile(byte[] fileContents, String namePrefix, String extension) throws IOException { """ Stores the given contents into a temporary file @param fileContents the raw contents to store in the temporary file @param namePrefix the desired file name prefix (must be at least 3 characters long) @param extension the desired extension including the '.' character (use null for '.tmp') @return a {@link File} reference to the newly created temporary file @throws IOException if the temporary file creation fails """ Preconditions.checkNotNull(fileContents, "file contents missing"); File tempFile = File.createTempFile(namePrefix, extension); try (FileOutputStream fos = new FileOutputStream(tempFile)) { fos.write(fileContents); } return tempFile; }
java
public static File createTempFile(byte[] fileContents, String namePrefix, String extension) throws IOException { Preconditions.checkNotNull(fileContents, "file contents missing"); File tempFile = File.createTempFile(namePrefix, extension); try (FileOutputStream fos = new FileOutputStream(tempFile)) { fos.write(fileContents); } return tempFile; }
[ "public", "static", "File", "createTempFile", "(", "byte", "[", "]", "fileContents", ",", "String", "namePrefix", ",", "String", "extension", ")", "throws", "IOException", "{", "Preconditions", ".", "checkNotNull", "(", "fileContents", ",", "\"file contents missing\...
Stores the given contents into a temporary file @param fileContents the raw contents to store in the temporary file @param namePrefix the desired file name prefix (must be at least 3 characters long) @param extension the desired extension including the '.' character (use null for '.tmp') @return a {@link File} reference to the newly created temporary file @throws IOException if the temporary file creation fails
[ "Stores", "the", "given", "contents", "into", "a", "temporary", "file" ]
train
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/IO.java#L248-L255
skuzzle/jeve
jeve/src/main/java/de/skuzzle/jeve/stores/DefaultListenerStoreImpl.java
DefaultListenerStoreImpl.removeInternal
@Deprecated protected <T extends Listener> void removeInternal(Class<T> listenerClass, Iterator<Object> it) { """ Internal method for removing a single listener and notifying it about the removal. Prior to calling this method, the passed iterators {@link Iterator#hasNext() hasNext} method must hold <code>true</code>. @param <T> Type of the listener to remove @param listenerClass The class of the listener to remove. @param it Iterator which provides the next listener to remove. @deprecated Since 3.0.0 - Method not used anymore. Replaced by {@link #clearAll(Class, List, boolean)}. """ final Object next = it.next(); final T listener = listenerClass.cast(next); it.remove(); final RegistrationEvent e = new RegistrationEvent(this, listenerClass); listener.onUnregister(e); }
java
@Deprecated protected <T extends Listener> void removeInternal(Class<T> listenerClass, Iterator<Object> it) { final Object next = it.next(); final T listener = listenerClass.cast(next); it.remove(); final RegistrationEvent e = new RegistrationEvent(this, listenerClass); listener.onUnregister(e); }
[ "@", "Deprecated", "protected", "<", "T", "extends", "Listener", ">", "void", "removeInternal", "(", "Class", "<", "T", ">", "listenerClass", ",", "Iterator", "<", "Object", ">", "it", ")", "{", "final", "Object", "next", "=", "it", ".", "next", "(", "...
Internal method for removing a single listener and notifying it about the removal. Prior to calling this method, the passed iterators {@link Iterator#hasNext() hasNext} method must hold <code>true</code>. @param <T> Type of the listener to remove @param listenerClass The class of the listener to remove. @param it Iterator which provides the next listener to remove. @deprecated Since 3.0.0 - Method not used anymore. Replaced by {@link #clearAll(Class, List, boolean)}.
[ "Internal", "method", "for", "removing", "a", "single", "listener", "and", "notifying", "it", "about", "the", "removal", ".", "Prior", "to", "calling", "this", "method", "the", "passed", "iterators", "{", "@link", "Iterator#hasNext", "()", "hasNext", "}", "met...
train
https://github.com/skuzzle/jeve/blob/42cc18947c9c8596c34410336e4e375e9fcd7c47/jeve/src/main/java/de/skuzzle/jeve/stores/DefaultListenerStoreImpl.java#L142-L150
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/request/RequestHelper.java
RequestHelper.getUserAgent
@Nonnull public static IUserAgent getUserAgent (@Nonnull final HttpServletRequest aHttpRequest) { """ Get the user agent object from the given HTTP request. @param aHttpRequest The HTTP request to extract the information from. @return A non-<code>null</code> user agent object. """ IUserAgent aUserAgent = (IUserAgent) aHttpRequest.getAttribute (IUserAgent.class.getName ()); if (aUserAgent == null) { // Extract HTTP header from request final String sUserAgent = getHttpUserAgentStringFromRequest (aHttpRequest); aUserAgent = UserAgentDatabase.getParsedUserAgent (sUserAgent); if (aUserAgent == null) { LOGGER.warn ("No user agent was passed in the request!"); aUserAgent = new UserAgent ("", new UserAgentElementList ()); } ServletHelper.setRequestAttribute (aHttpRequest, IUserAgent.class.getName (), aUserAgent); } return aUserAgent; }
java
@Nonnull public static IUserAgent getUserAgent (@Nonnull final HttpServletRequest aHttpRequest) { IUserAgent aUserAgent = (IUserAgent) aHttpRequest.getAttribute (IUserAgent.class.getName ()); if (aUserAgent == null) { // Extract HTTP header from request final String sUserAgent = getHttpUserAgentStringFromRequest (aHttpRequest); aUserAgent = UserAgentDatabase.getParsedUserAgent (sUserAgent); if (aUserAgent == null) { LOGGER.warn ("No user agent was passed in the request!"); aUserAgent = new UserAgent ("", new UserAgentElementList ()); } ServletHelper.setRequestAttribute (aHttpRequest, IUserAgent.class.getName (), aUserAgent); } return aUserAgent; }
[ "@", "Nonnull", "public", "static", "IUserAgent", "getUserAgent", "(", "@", "Nonnull", "final", "HttpServletRequest", "aHttpRequest", ")", "{", "IUserAgent", "aUserAgent", "=", "(", "IUserAgent", ")", "aHttpRequest", ".", "getAttribute", "(", "IUserAgent", ".", "c...
Get the user agent object from the given HTTP request. @param aHttpRequest The HTTP request to extract the information from. @return A non-<code>null</code> user agent object.
[ "Get", "the", "user", "agent", "object", "from", "the", "given", "HTTP", "request", "." ]
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/request/RequestHelper.java#L857-L874
actframework/actframework
src/main/java/act/util/ClassNode.java
ClassNode.visitTree
public ClassNode visitTree($.Visitor<ClassNode> visitor, final boolean publicOnly, final boolean noAbstract) { """ Accept a visitor that visit all descendants of the class represetned by this `ClassNode` including this `ClassNode` itself. @param visitor the visitor @param publicOnly specify if only public class shall be visited @param noAbstract specify if abstract class can be visited @return this `ClassNode` instance """ return visitTree($.guardedVisitor(classNodeFilter(publicOnly, noAbstract), visitor)); }
java
public ClassNode visitTree($.Visitor<ClassNode> visitor, final boolean publicOnly, final boolean noAbstract) { return visitTree($.guardedVisitor(classNodeFilter(publicOnly, noAbstract), visitor)); }
[ "public", "ClassNode", "visitTree", "(", "$", ".", "Visitor", "<", "ClassNode", ">", "visitor", ",", "final", "boolean", "publicOnly", ",", "final", "boolean", "noAbstract", ")", "{", "return", "visitTree", "(", "$", ".", "guardedVisitor", "(", "classNodeFilte...
Accept a visitor that visit all descendants of the class represetned by this `ClassNode` including this `ClassNode` itself. @param visitor the visitor @param publicOnly specify if only public class shall be visited @param noAbstract specify if abstract class can be visited @return this `ClassNode` instance
[ "Accept", "a", "visitor", "that", "visit", "all", "descendants", "of", "the", "class", "represetned", "by", "this", "ClassNode", "including", "this", "ClassNode", "itself", "." ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/util/ClassNode.java#L218-L220
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.buildDummyCoverage
public static GridCoverage2D buildDummyCoverage() { """ Creates a useless {@link GridCoverage2D} that might be usefull as placeholder. @return the dummy grod coverage. """ HashMap<String, Double> envelopeParams = new HashMap<String, Double>(); envelopeParams.put(NORTH, 1.0); envelopeParams.put(SOUTH, 0.0); envelopeParams.put(WEST, 0.0); envelopeParams.put(EAST, 1.0); envelopeParams.put(XRES, 1.0); envelopeParams.put(YRES, 1.0); envelopeParams.put(ROWS, 1.0); envelopeParams.put(COLS, 1.0); double[][] dataMatrix = new double[1][1]; dataMatrix[0][0] = 0; WritableRaster writableRaster = createWritableRasterFromMatrix(dataMatrix, true); return buildCoverage("dummy", writableRaster, envelopeParams, DefaultGeographicCRS.WGS84); //$NON-NLS-1$ }
java
public static GridCoverage2D buildDummyCoverage() { HashMap<String, Double> envelopeParams = new HashMap<String, Double>(); envelopeParams.put(NORTH, 1.0); envelopeParams.put(SOUTH, 0.0); envelopeParams.put(WEST, 0.0); envelopeParams.put(EAST, 1.0); envelopeParams.put(XRES, 1.0); envelopeParams.put(YRES, 1.0); envelopeParams.put(ROWS, 1.0); envelopeParams.put(COLS, 1.0); double[][] dataMatrix = new double[1][1]; dataMatrix[0][0] = 0; WritableRaster writableRaster = createWritableRasterFromMatrix(dataMatrix, true); return buildCoverage("dummy", writableRaster, envelopeParams, DefaultGeographicCRS.WGS84); //$NON-NLS-1$ }
[ "public", "static", "GridCoverage2D", "buildDummyCoverage", "(", ")", "{", "HashMap", "<", "String", ",", "Double", ">", "envelopeParams", "=", "new", "HashMap", "<", "String", ",", "Double", ">", "(", ")", ";", "envelopeParams", ".", "put", "(", "NORTH", ...
Creates a useless {@link GridCoverage2D} that might be usefull as placeholder. @return the dummy grod coverage.
[ "Creates", "a", "useless", "{", "@link", "GridCoverage2D", "}", "that", "might", "be", "usefull", "as", "placeholder", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L916-L930
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/Shell.java
Shell.addAuxHandler
public void addAuxHandler(Object handler, String prefix) { """ This method is very similar to addMainHandler, except ShellFactory will pass all handlers registered with this method to all this shell's subshells. @see org.gearvrf.debug.cli.Shell#addMainHandler(java.lang.Object, java.lang.String) @param handler Object which should be registered as handler. @param prefix Prefix that should be prepended to all handler's command names. """ if (handler == null) { throw new NullPointerException(); } auxHandlers.put(prefix, handler); allHandlers.add(handler); addDeclaredMethods(handler, prefix); inputConverter.addDeclaredConverters(handler); outputConverter.addDeclaredConverters(handler); if (handler instanceof ShellDependent) { ((ShellDependent)handler).cliSetShell(this); } }
java
public void addAuxHandler(Object handler, String prefix) { if (handler == null) { throw new NullPointerException(); } auxHandlers.put(prefix, handler); allHandlers.add(handler); addDeclaredMethods(handler, prefix); inputConverter.addDeclaredConverters(handler); outputConverter.addDeclaredConverters(handler); if (handler instanceof ShellDependent) { ((ShellDependent)handler).cliSetShell(this); } }
[ "public", "void", "addAuxHandler", "(", "Object", "handler", ",", "String", "prefix", ")", "{", "if", "(", "handler", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "auxHandlers", ".", "put", "(", "prefix", ",", "hand...
This method is very similar to addMainHandler, except ShellFactory will pass all handlers registered with this method to all this shell's subshells. @see org.gearvrf.debug.cli.Shell#addMainHandler(java.lang.Object, java.lang.String) @param handler Object which should be registered as handler. @param prefix Prefix that should be prepended to all handler's command names.
[ "This", "method", "is", "very", "similar", "to", "addMainHandler", "except", "ShellFactory", "will", "pass", "all", "handlers", "registered", "with", "this", "method", "to", "all", "this", "shell", "s", "subshells", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/Shell.java#L164-L178
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEEJBInvocationInfoBase.java
TEEJBInvocationInfoBase.turnNullString2EmptyString
protected static String turnNullString2EmptyString(String str, String NullDefaultStr) { """ Helper method to convert a String object to its textual representation. If class is null, the <i>NullDefaultStr</i> is returned. """ return (str == null) ? NullDefaultStr : str; }
java
protected static String turnNullString2EmptyString(String str, String NullDefaultStr) { return (str == null) ? NullDefaultStr : str; }
[ "protected", "static", "String", "turnNullString2EmptyString", "(", "String", "str", ",", "String", "NullDefaultStr", ")", "{", "return", "(", "str", "==", "null", ")", "?", "NullDefaultStr", ":", "str", ";", "}" ]
Helper method to convert a String object to its textual representation. If class is null, the <i>NullDefaultStr</i> is returned.
[ "Helper", "method", "to", "convert", "a", "String", "object", "to", "its", "textual", "representation", ".", "If", "class", "is", "null", "the", "<i", ">", "NullDefaultStr<", "/", "i", ">", "is", "returned", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEEJBInvocationInfoBase.java#L43-L46
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java
DatePickerSettings.zGetDefaultBorderPropertiesList
private ArrayList<CalendarBorderProperties> zGetDefaultBorderPropertiesList() { """ zGetDefaultBorderPropertiesList, This creates and returns a list of default border properties for the calendar. The default border properties will be slightly different depending on whether or not the week numbers are currently displayed in the calendar. Technical notes: This does not save the default border properties to the date picker settings class. This does not clear the existing borders. This does not apply the border properties list to the calendar. This does not set the upper left corner calendar label to be visible or invisible. """ ArrayList<CalendarBorderProperties> results = new ArrayList<CalendarBorderProperties>(); Color defaultDateBoxBorderColor = new Color(99, 130, 191); Color defaultWeekdayEndcapsBorderColor = colorBackgroundWeekdayLabels; Color defaultWeekNumberEndcapsBorderColor = colorBackgroundWeekNumberLabels; // Set the borders properties for the date box. CalendarBorderProperties dateBoxBorderProperties = new CalendarBorderProperties( new Point(3, 3), new Point(5, 5), defaultDateBoxBorderColor, 1); results.add(dateBoxBorderProperties); // Set the borders properties for the weekday label endcaps. CalendarBorderProperties weekdayLabelBorderProperties = new CalendarBorderProperties( new Point(3, 2), new Point(5, 2), defaultWeekdayEndcapsBorderColor, 1); results.add(weekdayLabelBorderProperties); // Set the border properties for borders above and below the week numbers. // Note that the week number borders are only displayed when the week numbers are also // displayed. (This is true of any borders located in columns 1 and 2.) CalendarBorderProperties weekNumberBorderProperties = new CalendarBorderProperties( new Point(2, 3), new Point(2, 5), defaultWeekNumberEndcapsBorderColor, 1); results.add(weekNumberBorderProperties); // Return the results. return results; }
java
private ArrayList<CalendarBorderProperties> zGetDefaultBorderPropertiesList() { ArrayList<CalendarBorderProperties> results = new ArrayList<CalendarBorderProperties>(); Color defaultDateBoxBorderColor = new Color(99, 130, 191); Color defaultWeekdayEndcapsBorderColor = colorBackgroundWeekdayLabels; Color defaultWeekNumberEndcapsBorderColor = colorBackgroundWeekNumberLabels; // Set the borders properties for the date box. CalendarBorderProperties dateBoxBorderProperties = new CalendarBorderProperties( new Point(3, 3), new Point(5, 5), defaultDateBoxBorderColor, 1); results.add(dateBoxBorderProperties); // Set the borders properties for the weekday label endcaps. CalendarBorderProperties weekdayLabelBorderProperties = new CalendarBorderProperties( new Point(3, 2), new Point(5, 2), defaultWeekdayEndcapsBorderColor, 1); results.add(weekdayLabelBorderProperties); // Set the border properties for borders above and below the week numbers. // Note that the week number borders are only displayed when the week numbers are also // displayed. (This is true of any borders located in columns 1 and 2.) CalendarBorderProperties weekNumberBorderProperties = new CalendarBorderProperties( new Point(2, 3), new Point(2, 5), defaultWeekNumberEndcapsBorderColor, 1); results.add(weekNumberBorderProperties); // Return the results. return results; }
[ "private", "ArrayList", "<", "CalendarBorderProperties", ">", "zGetDefaultBorderPropertiesList", "(", ")", "{", "ArrayList", "<", "CalendarBorderProperties", ">", "results", "=", "new", "ArrayList", "<", "CalendarBorderProperties", ">", "(", ")", ";", "Color", "defaul...
zGetDefaultBorderPropertiesList, This creates and returns a list of default border properties for the calendar. The default border properties will be slightly different depending on whether or not the week numbers are currently displayed in the calendar. Technical notes: This does not save the default border properties to the date picker settings class. This does not clear the existing borders. This does not apply the border properties list to the calendar. This does not set the upper left corner calendar label to be visible or invisible.
[ "zGetDefaultBorderPropertiesList", "This", "creates", "and", "returns", "a", "list", "of", "default", "border", "properties", "for", "the", "calendar", ".", "The", "default", "border", "properties", "will", "be", "slightly", "different", "depending", "on", "whether"...
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java#L2292-L2313
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/doc/DocClient.java
DocClient.registerDocument
private RegisterDocumentResponse registerDocument(RegisterDocumentRequest request) { """ publish a Document. @param request The request object containing register infomation. @return A RegisterDocumentResponse object containing the information returned by Document. """ checkNotNull(request, "The parameter request should NOT be null."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, DOC); internalRequest.addParameter("register", null); String strJson = JsonUtils.toJsonString(request); byte[] requestJson = null; try { requestJson = strJson.getBytes(DEFAULT_ENCODING); } catch (UnsupportedEncodingException e) { throw new BceClientException("Unsupported encode.", e); } internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(requestJson.length)); internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE); internalRequest.setContent(RestartableInputStream.wrap(requestJson)); return invokeHttpClient(internalRequest, RegisterDocumentResponse.class); }
java
private RegisterDocumentResponse registerDocument(RegisterDocumentRequest request) { checkNotNull(request, "The parameter request should NOT be null."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, DOC); internalRequest.addParameter("register", null); String strJson = JsonUtils.toJsonString(request); byte[] requestJson = null; try { requestJson = strJson.getBytes(DEFAULT_ENCODING); } catch (UnsupportedEncodingException e) { throw new BceClientException("Unsupported encode.", e); } internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(requestJson.length)); internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE); internalRequest.setContent(RestartableInputStream.wrap(requestJson)); return invokeHttpClient(internalRequest, RegisterDocumentResponse.class); }
[ "private", "RegisterDocumentResponse", "registerDocument", "(", "RegisterDocumentRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "Ht...
publish a Document. @param request The request object containing register infomation. @return A RegisterDocumentResponse object containing the information returned by Document.
[ "publish", "a", "Document", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/doc/DocClient.java#L405-L422
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/StreamSet.java
StreamSet.getPersistentData
protected long getPersistentData(int priority, Reliability reliability) throws SIResourceException { """ Get the persistent data for a specific stream @param priority @param reliability @throws SIResourceException """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "getPersistentData", new Object[] { new Integer(priority), reliability }); long prefix = getSubset(reliability).getPersistentData(priority); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getPersistentData", new Long(prefix)); return prefix; }
java
protected long getPersistentData(int priority, Reliability reliability) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "getPersistentData", new Object[] { new Integer(priority), reliability }); long prefix = getSubset(reliability).getPersistentData(priority); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getPersistentData", new Long(prefix)); return prefix; }
[ "protected", "long", "getPersistentData", "(", "int", "priority", ",", "Reliability", "reliability", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "...
Get the persistent data for a specific stream @param priority @param reliability @throws SIResourceException
[ "Get", "the", "persistent", "data", "for", "a", "specific", "stream" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/StreamSet.java#L882-L896
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java
DefaultElementProducer.createElementByStyler
public <E extends Element> E createElementByStyler(Collection<? extends BaseStyler> stylers, Object data, Class<E> clazz) throws VectorPrintException { """ leaves object creation to the first styler in the list @param <E> @param stylers @param data @param clazz @return @throws VectorPrintException """ // pdfptable, Section and others do not have a default constructor, a styler creates it E e = null; return styleHelper.style(e, data, stylers); }
java
public <E extends Element> E createElementByStyler(Collection<? extends BaseStyler> stylers, Object data, Class<E> clazz) throws VectorPrintException { // pdfptable, Section and others do not have a default constructor, a styler creates it E e = null; return styleHelper.style(e, data, stylers); }
[ "public", "<", "E", "extends", "Element", ">", "E", "createElementByStyler", "(", "Collection", "<", "?", "extends", "BaseStyler", ">", "stylers", ",", "Object", "data", ",", "Class", "<", "E", ">", "clazz", ")", "throws", "VectorPrintException", "{", "// pd...
leaves object creation to the first styler in the list @param <E> @param stylers @param data @param clazz @return @throws VectorPrintException
[ "leaves", "object", "creation", "to", "the", "first", "styler", "in", "the", "list" ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L133-L138
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/ConvertBitmap.java
ConvertBitmap.grayToBitmap
public static void grayToBitmap( GrayU8 input , Bitmap output , byte[] storage) { """ Converts ImageGray into Bitmap. @see #declareStorage(android.graphics.Bitmap, byte[]) @param input Input gray scale image. @param output Output Bitmap image. @param storage Byte array used for internal storage. If null it will be declared internally. """ if( output.getWidth() != input.getWidth() || output.getHeight() != input.getHeight() ) { throw new IllegalArgumentException("Image shapes are not the same"); } if( storage == null ) storage = declareStorage(output,null); ImplConvertBitmap.grayToArray(input, storage,output.getConfig()); output.copyPixelsFromBuffer(ByteBuffer.wrap(storage)); }
java
public static void grayToBitmap( GrayU8 input , Bitmap output , byte[] storage) { if( output.getWidth() != input.getWidth() || output.getHeight() != input.getHeight() ) { throw new IllegalArgumentException("Image shapes are not the same"); } if( storage == null ) storage = declareStorage(output,null); ImplConvertBitmap.grayToArray(input, storage,output.getConfig()); output.copyPixelsFromBuffer(ByteBuffer.wrap(storage)); }
[ "public", "static", "void", "grayToBitmap", "(", "GrayU8", "input", ",", "Bitmap", "output", ",", "byte", "[", "]", "storage", ")", "{", "if", "(", "output", ".", "getWidth", "(", ")", "!=", "input", ".", "getWidth", "(", ")", "||", "output", ".", "g...
Converts ImageGray into Bitmap. @see #declareStorage(android.graphics.Bitmap, byte[]) @param input Input gray scale image. @param output Output Bitmap image. @param storage Byte array used for internal storage. If null it will be declared internally.
[ "Converts", "ImageGray", "into", "Bitmap", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/ConvertBitmap.java#L269-L279
liyiorg/weixin-popular
src/main/java/weixin/popular/api/CustomserviceAPI.java
CustomserviceAPI.msgrecordGetrecord
public static KFMsgRecord msgrecordGetrecord(String access_token, int endtime, int pageindex, int pagesize, int starttime) { """ 获取客服聊天记录 @param access_token access_token @param endtime 查询结束时间,UNIX时间戳,每次查询不能跨日查询 @param pageindex 查询第几页,从1开始 @param pagesize 每页大小,每页最多拉取50条 @param starttime 查询开始时间,UNIX时间戳 @return KFMsgRecord """ String jsonPostData = String.format("{\"endtime\":%1d,\"pageindex\":%2d,\"pagesize\":%3d,\"starttime\":%4d}", endtime, pageindex, pagesize, starttime); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/customservice/msgrecord/getrecord") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(jsonPostData, Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest, KFMsgRecord.class); }
java
public static KFMsgRecord msgrecordGetrecord(String access_token, int endtime, int pageindex, int pagesize, int starttime) { String jsonPostData = String.format("{\"endtime\":%1d,\"pageindex\":%2d,\"pagesize\":%3d,\"starttime\":%4d}", endtime, pageindex, pagesize, starttime); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/customservice/msgrecord/getrecord") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(jsonPostData, Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest, KFMsgRecord.class); }
[ "public", "static", "KFMsgRecord", "msgrecordGetrecord", "(", "String", "access_token", ",", "int", "endtime", ",", "int", "pageindex", ",", "int", "pagesize", ",", "int", "starttime", ")", "{", "String", "jsonPostData", "=", "String", ".", "format", "(", "\"{...
获取客服聊天记录 @param access_token access_token @param endtime 查询结束时间,UNIX时间戳,每次查询不能跨日查询 @param pageindex 查询第几页,从1开始 @param pagesize 每页大小,每页最多拉取50条 @param starttime 查询开始时间,UNIX时间戳 @return KFMsgRecord
[ "获取客服聊天记录" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/CustomserviceAPI.java#L235-L248
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsInner.java
ApplicationsInner.beginCreate
public ApplicationInner beginCreate(String resourceGroupName, String clusterName, String applicationName, ApplicationInner parameters) { """ Creates applications for the HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param applicationName The constant value for the application name. @param parameters The application create request. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ApplicationInner object if successful. """ return beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, applicationName, parameters).toBlocking().single().body(); }
java
public ApplicationInner beginCreate(String resourceGroupName, String clusterName, String applicationName, ApplicationInner parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, clusterName, applicationName, parameters).toBlocking().single().body(); }
[ "public", "ApplicationInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "applicationName", ",", "ApplicationInner", "parameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Creates applications for the HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param applicationName The constant value for the application name. @param parameters The application create request. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ApplicationInner object if successful.
[ "Creates", "applications", "for", "the", "HDInsight", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsInner.java#L406-L408
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.extractDiag
public static void extractDiag(ZMatrixRMaj src, ZMatrixRMaj dst ) { """ <p> Extracts the diagonal elements 'src' write it to the 'dst' vector. 'dst' can either be a row or column vector. <p> @param src Matrix whose diagonal elements are being extracted. Not modified. @param dst A vector the results will be written into. Modified. """ int N = Math.min(src.numRows, src.numCols); // reshape if it's not the right size if( !MatrixFeatures_ZDRM.isVector(dst) || dst.numCols*dst.numCols != N ) { dst.reshape(N,1); } for( int i = 0; i < N; i++ ) { int index = src.getIndex(i,i); dst.data[i*2] = src.data[index]; dst.data[i*2+1] = src.data[index+1]; } }
java
public static void extractDiag(ZMatrixRMaj src, ZMatrixRMaj dst ) { int N = Math.min(src.numRows, src.numCols); // reshape if it's not the right size if( !MatrixFeatures_ZDRM.isVector(dst) || dst.numCols*dst.numCols != N ) { dst.reshape(N,1); } for( int i = 0; i < N; i++ ) { int index = src.getIndex(i,i); dst.data[i*2] = src.data[index]; dst.data[i*2+1] = src.data[index+1]; } }
[ "public", "static", "void", "extractDiag", "(", "ZMatrixRMaj", "src", ",", "ZMatrixRMaj", "dst", ")", "{", "int", "N", "=", "Math", ".", "min", "(", "src", ".", "numRows", ",", "src", ".", "numCols", ")", ";", "// reshape if it's not the right size", "if", ...
<p> Extracts the diagonal elements 'src' write it to the 'dst' vector. 'dst' can either be a row or column vector. <p> @param src Matrix whose diagonal elements are being extracted. Not modified. @param dst A vector the results will be written into. Modified.
[ "<p", ">", "Extracts", "the", "diagonal", "elements", "src", "write", "it", "to", "the", "dst", "vector", ".", "dst", "can", "either", "be", "a", "row", "or", "column", "vector", ".", "<p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L122-L136
Atmosphere/wasync
wasync/src/main/java/org/atmosphere/wasync/util/TypeResolver.java
TypeResolver.buildTypeVariableMap
static void buildTypeVariableMap(final Type[] types, final Map<TypeVariable<?>, Type> map) { """ Populates the {@code map} with with variable/argument pairs for the given {@code types}. """ for (Type type : types) { if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; buildTypeVariableMap(parameterizedType, map); Type rawType = parameterizedType.getRawType(); if (rawType instanceof Class) buildTypeVariableMap(((Class<?>) rawType).getGenericInterfaces(), map); } else if (type instanceof Class) { buildTypeVariableMap(((Class<?>) type).getGenericInterfaces(), map); } } }
java
static void buildTypeVariableMap(final Type[] types, final Map<TypeVariable<?>, Type> map) { for (Type type : types) { if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; buildTypeVariableMap(parameterizedType, map); Type rawType = parameterizedType.getRawType(); if (rawType instanceof Class) buildTypeVariableMap(((Class<?>) rawType).getGenericInterfaces(), map); } else if (type instanceof Class) { buildTypeVariableMap(((Class<?>) type).getGenericInterfaces(), map); } } }
[ "static", "void", "buildTypeVariableMap", "(", "final", "Type", "[", "]", "types", ",", "final", "Map", "<", "TypeVariable", "<", "?", ">", ",", "Type", ">", "map", ")", "{", "for", "(", "Type", "type", ":", "types", ")", "{", "if", "(", "type", "i...
Populates the {@code map} with with variable/argument pairs for the given {@code types}.
[ "Populates", "the", "{" ]
train
https://github.com/Atmosphere/wasync/blob/0146828b2f5138d4cbb4872fcbfe7d6e1887ac14/wasync/src/main/java/org/atmosphere/wasync/util/TypeResolver.java#L255-L267
OpenLiberty/open-liberty
dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/OSGiInjectionScopeData.java
OSGiInjectionScopeData.addCompBinding
public void addCompBinding(String name, InjectionBinding<?> binding) { """ Add a non-env java:comp binding. @param name a name relative to java:comp """ if (!compLock.writeLock().isHeldByCurrentThread()) { throw new IllegalStateException(); } if (compBindings == null) { compBindings = new JavaColonNamespaceBindings<InjectionBinding<?>>(NamingConstants.JavaColonNamespace.COMP, InjectionBindingClassNameProvider.instance); } compBindings.bind(name, binding); }
java
public void addCompBinding(String name, InjectionBinding<?> binding) { if (!compLock.writeLock().isHeldByCurrentThread()) { throw new IllegalStateException(); } if (compBindings == null) { compBindings = new JavaColonNamespaceBindings<InjectionBinding<?>>(NamingConstants.JavaColonNamespace.COMP, InjectionBindingClassNameProvider.instance); } compBindings.bind(name, binding); }
[ "public", "void", "addCompBinding", "(", "String", "name", ",", "InjectionBinding", "<", "?", ">", "binding", ")", "{", "if", "(", "!", "compLock", ".", "writeLock", "(", ")", ".", "isHeldByCurrentThread", "(", ")", ")", "{", "throw", "new", "IllegalStateE...
Add a non-env java:comp binding. @param name a name relative to java:comp
[ "Add", "a", "non", "-", "env", "java", ":", "comp", "binding", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/OSGiInjectionScopeData.java#L220-L229
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java
IndexImage.getIndexedImage
public static BufferedImage getIndexedImage(BufferedImage pImage, int pNumberOfColors, Color pMatte, int pHints) { """ Converts the input image (must be {@code TYPE_INT_RGB} or {@code TYPE_INT_ARGB}) to an indexed image. Generating an adaptive palette with the given number of colors. Dithering, transparency and color selection is controlled with the {@code pHints}parameter. <p/> The image returned is a new image, the input image is not modified. @param pImage the BufferedImage to index @param pNumberOfColors the number of colors for the image @param pMatte the background color, used where the original image was transparent @param pHints hints that control output quality and speed. @return the indexed BufferedImage. The image will be of type {@code BufferedImage.TYPE_BYTE_INDEXED} or {@code BufferedImage.TYPE_BYTE_BINARY}, and use an {@code IndexColorModel}. @see #DITHER_DIFFUSION @see #DITHER_NONE @see #COLOR_SELECTION_FAST @see #COLOR_SELECTION_QUALITY @see #TRANSPARENCY_OPAQUE @see #TRANSPARENCY_BITMASK @see BufferedImage#TYPE_BYTE_INDEXED @see BufferedImage#TYPE_BYTE_BINARY @see IndexColorModel """ // NOTE: We need to apply matte before creating color model, otherwise we // won't have colors for potential faded transitions IndexColorModel icm; if (pMatte != null) { icm = getIndexColorModel(createSolid(pImage, pMatte), pNumberOfColors, pHints); } else { icm = getIndexColorModel(pImage, pNumberOfColors, pHints); } // If we found less colors, then no need to dither if ((pHints & DITHER_MASK) != DITHER_NONE && (icm.getMapSize() < pNumberOfColors)) { pHints = (pHints & ~DITHER_MASK) | DITHER_NONE; } return getIndexedImage(pImage, icm, pMatte, pHints); }
java
public static BufferedImage getIndexedImage(BufferedImage pImage, int pNumberOfColors, Color pMatte, int pHints) { // NOTE: We need to apply matte before creating color model, otherwise we // won't have colors for potential faded transitions IndexColorModel icm; if (pMatte != null) { icm = getIndexColorModel(createSolid(pImage, pMatte), pNumberOfColors, pHints); } else { icm = getIndexColorModel(pImage, pNumberOfColors, pHints); } // If we found less colors, then no need to dither if ((pHints & DITHER_MASK) != DITHER_NONE && (icm.getMapSize() < pNumberOfColors)) { pHints = (pHints & ~DITHER_MASK) | DITHER_NONE; } return getIndexedImage(pImage, icm, pMatte, pHints); }
[ "public", "static", "BufferedImage", "getIndexedImage", "(", "BufferedImage", "pImage", ",", "int", "pNumberOfColors", ",", "Color", "pMatte", ",", "int", "pHints", ")", "{", "// NOTE: We need to apply matte before creating color model, otherwise we\r", "// won't have colors fo...
Converts the input image (must be {@code TYPE_INT_RGB} or {@code TYPE_INT_ARGB}) to an indexed image. Generating an adaptive palette with the given number of colors. Dithering, transparency and color selection is controlled with the {@code pHints}parameter. <p/> The image returned is a new image, the input image is not modified. @param pImage the BufferedImage to index @param pNumberOfColors the number of colors for the image @param pMatte the background color, used where the original image was transparent @param pHints hints that control output quality and speed. @return the indexed BufferedImage. The image will be of type {@code BufferedImage.TYPE_BYTE_INDEXED} or {@code BufferedImage.TYPE_BYTE_BINARY}, and use an {@code IndexColorModel}. @see #DITHER_DIFFUSION @see #DITHER_NONE @see #COLOR_SELECTION_FAST @see #COLOR_SELECTION_QUALITY @see #TRANSPARENCY_OPAQUE @see #TRANSPARENCY_BITMASK @see BufferedImage#TYPE_BYTE_INDEXED @see BufferedImage#TYPE_BYTE_BINARY @see IndexColorModel
[ "Converts", "the", "input", "image", "(", "must", "be", "{", "@code", "TYPE_INT_RGB", "}", "or", "{", "@code", "TYPE_INT_ARGB", "}", ")", "to", "an", "indexed", "image", ".", "Generating", "an", "adaptive", "palette", "with", "the", "given", "number", "of"...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java#L930-L947
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/argval/PredefinedArgumentValidators.java
PredefinedArgumentValidators.inRange
public static ArgumentValidator inRange(int expectedMin, int expectedMax, String description) { """ Creates a {@link ArgumentValidator} which checks for _expectedMin <= #arguments <= expectedMax_. @param expectedMin the minimum number of expected arguments @param expectedMax the maximum number of expected arguments @param description any description @return an ArgumentValidator """ if (expectedMin > 0) return allOf( atLeast(expectedMin, description), atMost(expectedMax, description) ); return atMost(expectedMax, description); }
java
public static ArgumentValidator inRange(int expectedMin, int expectedMax, String description) { if (expectedMin > 0) return allOf( atLeast(expectedMin, description), atMost(expectedMax, description) ); return atMost(expectedMax, description); }
[ "public", "static", "ArgumentValidator", "inRange", "(", "int", "expectedMin", ",", "int", "expectedMax", ",", "String", "description", ")", "{", "if", "(", "expectedMin", ">", "0", ")", "return", "allOf", "(", "atLeast", "(", "expectedMin", ",", "description"...
Creates a {@link ArgumentValidator} which checks for _expectedMin <= #arguments <= expectedMax_. @param expectedMin the minimum number of expected arguments @param expectedMax the maximum number of expected arguments @param description any description @return an ArgumentValidator
[ "Creates", "a", "{", "@link", "ArgumentValidator", "}", "which", "checks", "for", "_expectedMin", "<", "=", "#arguments", "<", "=", "expectedMax_", "." ]
train
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/argval/PredefinedArgumentValidators.java#L227-L235
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/GeoPackageOverlayFactory.java
GeoPackageOverlayFactory.getCompositeOverlay
public static CompositeOverlay getCompositeOverlay(TileDao tileDao, BoundedOverlay overlay) { """ Create a composite overlay by first adding a tile overlay for the tile DAO followed by the provided overlay @param tileDao tile dao @param overlay bounded overlay @return composite overlay """ List<TileDao> tileDaos = new ArrayList<>(); tileDaos.add(tileDao); return getCompositeOverlay(tileDaos, overlay); }
java
public static CompositeOverlay getCompositeOverlay(TileDao tileDao, BoundedOverlay overlay) { List<TileDao> tileDaos = new ArrayList<>(); tileDaos.add(tileDao); return getCompositeOverlay(tileDaos, overlay); }
[ "public", "static", "CompositeOverlay", "getCompositeOverlay", "(", "TileDao", "tileDao", ",", "BoundedOverlay", "overlay", ")", "{", "List", "<", "TileDao", ">", "tileDaos", "=", "new", "ArrayList", "<>", "(", ")", ";", "tileDaos", ".", "add", "(", "tileDao",...
Create a composite overlay by first adding a tile overlay for the tile DAO followed by the provided overlay @param tileDao tile dao @param overlay bounded overlay @return composite overlay
[ "Create", "a", "composite", "overlay", "by", "first", "adding", "a", "tile", "overlay", "for", "the", "tile", "DAO", "followed", "by", "the", "provided", "overlay" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/GeoPackageOverlayFactory.java#L118-L122
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsInner.java
DatabaseRecommendedActionsInner.updateAsync
public Observable<RecommendedActionInner> updateAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, String recommendedActionName, RecommendedActionStateInfo state) { """ Updates a database recommended action. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @param advisorName The name of the Database Advisor. @param recommendedActionName The name of Database Recommended Action. @param state Gets the info of the current state the recommended action is in. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RecommendedActionInner object """ return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, state).map(new Func1<ServiceResponse<RecommendedActionInner>, RecommendedActionInner>() { @Override public RecommendedActionInner call(ServiceResponse<RecommendedActionInner> response) { return response.body(); } }); }
java
public Observable<RecommendedActionInner> updateAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, String recommendedActionName, RecommendedActionStateInfo state) { return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, state).map(new Func1<ServiceResponse<RecommendedActionInner>, RecommendedActionInner>() { @Override public RecommendedActionInner call(ServiceResponse<RecommendedActionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RecommendedActionInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "advisorName", ",", "String", "recommendedActionName", ",", "RecommendedActionStateInf...
Updates a database recommended action. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @param advisorName The name of the Database Advisor. @param recommendedActionName The name of Database Recommended Action. @param state Gets the info of the current state the recommended action is in. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RecommendedActionInner object
[ "Updates", "a", "database", "recommended", "action", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsInner.java#L327-L334
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/ArrayUtils.java
ArrayUtils.nullSafeArray
@NullSafe public static <T> T[] nullSafeArray(T[] array) { """ Null-safe method returning the array if not null otherwise returns an empty array. @param <T> Class type of the elements in the array. @param array array to evaluate. @return the array if not null otherwise an empty array. @see #nullSafeArray(Object[], Class) @see #componentType(Object[]) """ return nullSafeArray(array, componentType(array)); }
java
@NullSafe public static <T> T[] nullSafeArray(T[] array) { return nullSafeArray(array, componentType(array)); }
[ "@", "NullSafe", "public", "static", "<", "T", ">", "T", "[", "]", "nullSafeArray", "(", "T", "[", "]", "array", ")", "{", "return", "nullSafeArray", "(", "array", ",", "componentType", "(", "array", ")", ")", ";", "}" ]
Null-safe method returning the array if not null otherwise returns an empty array. @param <T> Class type of the elements in the array. @param array array to evaluate. @return the array if not null otherwise an empty array. @see #nullSafeArray(Object[], Class) @see #componentType(Object[])
[ "Null", "-", "safe", "method", "returning", "the", "array", "if", "not", "null", "otherwise", "returns", "an", "empty", "array", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L610-L613
landawn/AbacusUtil
src/com/landawn/abacus/eventBus/EventBus.java
EventBus.removeStickyEvent
public boolean removeStickyEvent(final Object event, final String eventId) { """ Remove the sticky event posted with the specified <code>eventId</code>. @param event @param eventId @return """ synchronized (stickyEventMap) { final String val = stickyEventMap.get(event); if (N.equals(val, eventId) && (val != null || stickyEventMap.containsKey(event))) { stickyEventMap.remove(event); this.mapOfStickyEvent = null; return true; } } return false; }
java
public boolean removeStickyEvent(final Object event, final String eventId) { synchronized (stickyEventMap) { final String val = stickyEventMap.get(event); if (N.equals(val, eventId) && (val != null || stickyEventMap.containsKey(event))) { stickyEventMap.remove(event); this.mapOfStickyEvent = null; return true; } } return false; }
[ "public", "boolean", "removeStickyEvent", "(", "final", "Object", "event", ",", "final", "String", "eventId", ")", "{", "synchronized", "(", "stickyEventMap", ")", "{", "final", "String", "val", "=", "stickyEventMap", ".", "get", "(", "event", ")", ";", "if"...
Remove the sticky event posted with the specified <code>eventId</code>. @param event @param eventId @return
[ "Remove", "the", "sticky", "event", "posted", "with", "the", "specified", "<code", ">", "eventId<", "/", "code", ">", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/eventBus/EventBus.java#L529-L542
kubernetes-client/java
kubernetes/src/main/java/io/kubernetes/client/ApiClient.java
ApiClient.executeAsync
public <T> void executeAsync(Call call, ApiCallback<T> callback) { """ {@link #executeAsync(Call, Type, ApiCallback)} @param <T> Type @param call An instance of the Call object @param callback ApiCallback&lt;T&gt; """ executeAsync(call, null, callback); }
java
public <T> void executeAsync(Call call, ApiCallback<T> callback) { executeAsync(call, null, callback); }
[ "public", "<", "T", ">", "void", "executeAsync", "(", "Call", "call", ",", "ApiCallback", "<", "T", ">", "callback", ")", "{", "executeAsync", "(", "call", ",", "null", ",", "callback", ")", ";", "}" ]
{@link #executeAsync(Call, Type, ApiCallback)} @param <T> Type @param call An instance of the Call object @param callback ApiCallback&lt;T&gt;
[ "{", "@link", "#executeAsync", "(", "Call", "Type", "ApiCallback", ")", "}" ]
train
https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/ApiClient.java#L816-L818
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java
MaxSAT.computeCostModel
public int computeCostModel(final LNGBooleanVector currentModel, int weight) { """ Computes the cost of a given model. The cost of a model is the sum of the weights of the unsatisfied soft clauses. If a weight is specified, then it only considers the sum of the weights of the unsatisfied soft clauses with the specified weight. @param currentModel the model @param weight the weight @return the cost of the given model """ assert currentModel.size() != 0; int currentCost = 0; for (int i = 0; i < nSoft(); i++) { boolean unsatisfied = true; for (int j = 0; j < softClauses.get(i).clause().size(); j++) { if (weight != Integer.MAX_VALUE && softClauses.get(i).weight() != weight) { unsatisfied = false; continue; } assert var(softClauses.get(i).clause().get(j)) < currentModel.size(); if ((sign(softClauses.get(i).clause().get(j)) && !currentModel.get(var(softClauses.get(i).clause().get(j)))) || (!sign(softClauses.get(i).clause().get(j)) && currentModel.get(var(softClauses.get(i).clause().get(j))))) { unsatisfied = false; break; } } if (unsatisfied) currentCost += softClauses.get(i).weight(); } return currentCost; }
java
public int computeCostModel(final LNGBooleanVector currentModel, int weight) { assert currentModel.size() != 0; int currentCost = 0; for (int i = 0; i < nSoft(); i++) { boolean unsatisfied = true; for (int j = 0; j < softClauses.get(i).clause().size(); j++) { if (weight != Integer.MAX_VALUE && softClauses.get(i).weight() != weight) { unsatisfied = false; continue; } assert var(softClauses.get(i).clause().get(j)) < currentModel.size(); if ((sign(softClauses.get(i).clause().get(j)) && !currentModel.get(var(softClauses.get(i).clause().get(j)))) || (!sign(softClauses.get(i).clause().get(j)) && currentModel.get(var(softClauses.get(i).clause().get(j))))) { unsatisfied = false; break; } } if (unsatisfied) currentCost += softClauses.get(i).weight(); } return currentCost; }
[ "public", "int", "computeCostModel", "(", "final", "LNGBooleanVector", "currentModel", ",", "int", "weight", ")", "{", "assert", "currentModel", ".", "size", "(", ")", "!=", "0", ";", "int", "currentCost", "=", "0", ";", "for", "(", "int", "i", "=", "0",...
Computes the cost of a given model. The cost of a model is the sum of the weights of the unsatisfied soft clauses. If a weight is specified, then it only considers the sum of the weights of the unsatisfied soft clauses with the specified weight. @param currentModel the model @param weight the weight @return the cost of the given model
[ "Computes", "the", "cost", "of", "a", "given", "model", ".", "The", "cost", "of", "a", "model", "is", "the", "sum", "of", "the", "weights", "of", "the", "unsatisfied", "soft", "clauses", ".", "If", "a", "weight", "is", "specified", "then", "it", "only"...
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/algorithms/MaxSAT.java#L345-L366
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/BarcodePDF417.java
BarcodePDF417.createAwtImage
public java.awt.Image createAwtImage(Color foreground, Color background) { """ Creates a <CODE>java.awt.Image</CODE>. @param foreground the color of the bars @param background the color of the background @return the image """ int f = foreground.getRGB(); int g = background.getRGB(); Canvas canvas = new Canvas(); paintCode(); int h = (int)yHeight; int pix[] = new int[bitColumns * codeRows * h]; int stride = (bitColumns + 7) / 8; int ptr = 0; for (int k = 0; k < codeRows; ++k) { int p = k * stride; for (int j = 0; j < bitColumns; ++j) { int b = outBits[p + (j / 8)] & 0xff; b <<= j % 8; pix[ptr++] = (b & 0x80) == 0 ? g : f; } for (int j = 1; j < h; ++j) { System.arraycopy(pix, ptr - bitColumns, pix, ptr + bitColumns * (j - 1), bitColumns); } ptr += bitColumns * (h - 1); } java.awt.Image img = canvas.createImage(new MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns)); return img; }
java
public java.awt.Image createAwtImage(Color foreground, Color background) { int f = foreground.getRGB(); int g = background.getRGB(); Canvas canvas = new Canvas(); paintCode(); int h = (int)yHeight; int pix[] = new int[bitColumns * codeRows * h]; int stride = (bitColumns + 7) / 8; int ptr = 0; for (int k = 0; k < codeRows; ++k) { int p = k * stride; for (int j = 0; j < bitColumns; ++j) { int b = outBits[p + (j / 8)] & 0xff; b <<= j % 8; pix[ptr++] = (b & 0x80) == 0 ? g : f; } for (int j = 1; j < h; ++j) { System.arraycopy(pix, ptr - bitColumns, pix, ptr + bitColumns * (j - 1), bitColumns); } ptr += bitColumns * (h - 1); } java.awt.Image img = canvas.createImage(new MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns)); return img; }
[ "public", "java", ".", "awt", ".", "Image", "createAwtImage", "(", "Color", "foreground", ",", "Color", "background", ")", "{", "int", "f", "=", "foreground", ".", "getRGB", "(", ")", ";", "int", "g", "=", "background", ".", "getRGB", "(", ")", ";", ...
Creates a <CODE>java.awt.Image</CODE>. @param foreground the color of the bars @param background the color of the background @return the image
[ "Creates", "a", "<CODE", ">", "java", ".", "awt", ".", "Image<", "/", "CODE", ">", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BarcodePDF417.java#L901-L926
jhunters/jprotobuf
android/src/main/java/com/baidu/bjf/remoting/protobuf/CodedConstant.java
CodedConstant.writeToList
public static void writeToList(CodedOutputStream out, int order, FieldType type, List list) throws IOException { """ write list to {@link CodedOutputStream} object. @param out target output stream to write @param order field order @param type field type @param list target list object to be serialized """ if (list == null) { return; } for (Object object : list) { writeObject(out, order, type, object, true); } }
java
public static void writeToList(CodedOutputStream out, int order, FieldType type, List list) throws IOException { if (list == null) { return; } for (Object object : list) { writeObject(out, order, type, object, true); } }
[ "public", "static", "void", "writeToList", "(", "CodedOutputStream", "out", ",", "int", "order", ",", "FieldType", "type", ",", "List", "list", ")", "throws", "IOException", "{", "if", "(", "list", "==", "null", ")", "{", "return", ";", "}", "for", "(", ...
write list to {@link CodedOutputStream} object. @param out target output stream to write @param order field order @param type field type @param list target list object to be serialized
[ "write", "list", "to", "{", "@link", "CodedOutputStream", "}", "object", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/android/src/main/java/com/baidu/bjf/remoting/protobuf/CodedConstant.java#L291-L299
hawkular/hawkular-agent
hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/protocol/platform/OshiPlatformCache.java
OshiPlatformCache.getProcessorMetric
public Double getProcessorMetric(String processorNumber, ID metricToCollect) { """ Returns the given metric's value, or null if there is no processor with the given number. @param processorNumber number of the processor, as a String @param metricToCollect the metric to collect @return the value of the metric, or null if there is no processor with the given number """ CentralProcessor processor = getProcessor(); if (processor == null) { return null; } int processorIndex; try { processorIndex = Integer.parseInt(processorNumber); if (processorIndex < 0 || processorIndex >= processor.getLogicalProcessorCount()) { return null; } } catch (Exception e) { return null; } if (PlatformMetricType.PROCESSOR_CPU_USAGE.getMetricTypeId().equals(metricToCollect)) { return processor.getProcessorCpuLoadBetweenTicks()[processorIndex]; } else { throw new UnsupportedOperationException("Invalid processor metric to collect: " + metricToCollect); } }
java
public Double getProcessorMetric(String processorNumber, ID metricToCollect) { CentralProcessor processor = getProcessor(); if (processor == null) { return null; } int processorIndex; try { processorIndex = Integer.parseInt(processorNumber); if (processorIndex < 0 || processorIndex >= processor.getLogicalProcessorCount()) { return null; } } catch (Exception e) { return null; } if (PlatformMetricType.PROCESSOR_CPU_USAGE.getMetricTypeId().equals(metricToCollect)) { return processor.getProcessorCpuLoadBetweenTicks()[processorIndex]; } else { throw new UnsupportedOperationException("Invalid processor metric to collect: " + metricToCollect); } }
[ "public", "Double", "getProcessorMetric", "(", "String", "processorNumber", ",", "ID", "metricToCollect", ")", "{", "CentralProcessor", "processor", "=", "getProcessor", "(", ")", ";", "if", "(", "processor", "==", "null", ")", "{", "return", "null", ";", "}",...
Returns the given metric's value, or null if there is no processor with the given number. @param processorNumber number of the processor, as a String @param metricToCollect the metric to collect @return the value of the metric, or null if there is no processor with the given number
[ "Returns", "the", "given", "metric", "s", "value", "or", "null", "if", "there", "is", "no", "processor", "with", "the", "given", "number", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/protocol/platform/OshiPlatformCache.java#L278-L300
dihedron/dihedron-commons
src/main/java/org/dihedron/core/strings/Strings.java
Strings.asString
public static String asString(Object object, String otherwise) { """ Returns the given object as a string, if not null, otherwise returns null. @param object the object to be safely converted to a string. @param otherwise if the object is null, return this value instead. @return the string representation of the object if not null, the default value passed in otherwise. """ return object != null ? object.toString() : otherwise; }
java
public static String asString(Object object, String otherwise) { return object != null ? object.toString() : otherwise; }
[ "public", "static", "String", "asString", "(", "Object", "object", ",", "String", "otherwise", ")", "{", "return", "object", "!=", "null", "?", "object", ".", "toString", "(", ")", ":", "otherwise", ";", "}" ]
Returns the given object as a string, if not null, otherwise returns null. @param object the object to be safely converted to a string. @param otherwise if the object is null, return this value instead. @return the string representation of the object if not null, the default value passed in otherwise.
[ "Returns", "the", "given", "object", "as", "a", "string", "if", "not", "null", "otherwise", "returns", "null", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/strings/Strings.java#L82-L84