repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/ByteArrayDiskQueue.java
ByteArrayDiskQueue.createNew
public static ByteArrayDiskQueue createNew(final File file, final int bufferSize, final boolean direct) throws IOException { return new ByteArrayDiskQueue(ByteDiskQueue.createNew(file, bufferSize, direct)); }
java
public static ByteArrayDiskQueue createNew(final File file, final int bufferSize, final boolean direct) throws IOException { return new ByteArrayDiskQueue(ByteDiskQueue.createNew(file, bufferSize, direct)); }
[ "public", "static", "ByteArrayDiskQueue", "createNew", "(", "final", "File", "file", ",", "final", "int", "bufferSize", ",", "final", "boolean", "direct", ")", "throws", "IOException", "{", "return", "new", "ByteArrayDiskQueue", "(", "ByteDiskQueue", ".", "createN...
Creates a new disk-based queue of byte arrays. @param file the file that will be used to dump the queue on disk. @param bufferSize the number of items in the circular buffer (will be possibly decreased so to be a power of two). @param direct whether the {@link ByteBuffer} used by this queue should be {@linkplain ByteBuffer#allocateDirect(int) allocated directly}. @see ByteDiskQueue#createNew(File, int, boolean)
[ "Creates", "a", "new", "disk", "-", "based", "queue", "of", "byte", "arrays", "." ]
train
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ByteArrayDiskQueue.java#L66-L68
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/CommonSteps.java
CommonSteps.selectCheckbox
@Conditioned @Lorsque("Je mets à jour la case à cocher '(.*)-(.*)' avec '(.*)'[\\.|\\?]") @Then("I update checkbox '(.*)-(.*)' with '(.*)'[\\.|\\?]") public void selectCheckbox(String page, String elementKey, boolean value, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException { selectCheckbox(Page.getInstance(page).getPageElementByKey('-' + elementKey), value); }
java
@Conditioned @Lorsque("Je mets à jour la case à cocher '(.*)-(.*)' avec '(.*)'[\\.|\\?]") @Then("I update checkbox '(.*)-(.*)' with '(.*)'[\\.|\\?]") public void selectCheckbox(String page, String elementKey, boolean value, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException { selectCheckbox(Page.getInstance(page).getPageElementByKey('-' + elementKey), value); }
[ "@", "Conditioned", "@", "Lorsque", "(", "\"Je mets à jour la case à cocher '(.*)-(.*)' avec '(.*)'[\\\\.|\\\\?]\")\r", "", "@", "Then", "(", "\"I update checkbox '(.*)-(.*)' with '(.*)'[\\\\.|\\\\?]\"", ")", "public", "void", "selectCheckbox", "(", "String", "page", ",", "Stri...
Updates the value of a html checkbox element with conditions. @param page The concerned page of elementKey @param elementKey The key of PageElement to select @param value To check or not ? @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws TechnicalException if the scenario encounters a technical error @throws FailureException if the scenario encounters a functional error
[ "Updates", "the", "value", "of", "a", "html", "checkbox", "element", "with", "conditions", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L889-L894
groovyfx-project/groovyfx
src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java
FXBindableASTTransformation.addJavaFXProperty
private void addJavaFXProperty(SourceUnit source, AnnotationNode node, ClassNode declaringClass, FieldNode field) { String fieldName = field.getName(); for (PropertyNode propertyNode : declaringClass.getProperties()) { if (propertyNode.getName().equals(fieldName)) { if (field.isStatic()) { String message = "@griffon.transform.FXBindable cannot annotate a static property."; generateSyntaxErrorMessage(source, node, message); } else { createPropertyGetterSetter(declaringClass, propertyNode); } return; } } String message = "@griffon.transform.FXBindable must be on a property, not a field. Try removing the private, " + "protected, or public modifier."; generateSyntaxErrorMessage(source, node, message); }
java
private void addJavaFXProperty(SourceUnit source, AnnotationNode node, ClassNode declaringClass, FieldNode field) { String fieldName = field.getName(); for (PropertyNode propertyNode : declaringClass.getProperties()) { if (propertyNode.getName().equals(fieldName)) { if (field.isStatic()) { String message = "@griffon.transform.FXBindable cannot annotate a static property."; generateSyntaxErrorMessage(source, node, message); } else { createPropertyGetterSetter(declaringClass, propertyNode); } return; } } String message = "@griffon.transform.FXBindable must be on a property, not a field. Try removing the private, " + "protected, or public modifier."; generateSyntaxErrorMessage(source, node, message); }
[ "private", "void", "addJavaFXProperty", "(", "SourceUnit", "source", ",", "AnnotationNode", "node", ",", "ClassNode", "declaringClass", ",", "FieldNode", "field", ")", "{", "String", "fieldName", "=", "field", ".", "getName", "(", ")", ";", "for", "(", "Proper...
Adds a JavaFX property to the class in place of the original Groovy property. A pair of synthetic getter/setter methods is generated to provide pseudo-access to the original property. @param source The SourceUnit in which the annotation was found @param node The node that was annotated @param declaringClass The class in which the annotation was found @param field The field upon which the annotation was placed
[ "Adds", "a", "JavaFX", "property", "to", "the", "class", "in", "place", "of", "the", "original", "Groovy", "property", ".", "A", "pair", "of", "synthetic", "getter", "/", "setter", "methods", "is", "generated", "to", "provide", "pseudo", "-", "access", "to...
train
https://github.com/groovyfx-project/groovyfx/blob/7067d76793601ce4de9c642d4c0c0e11db7907cb/src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java#L210-L227
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java
Bytes.putDouble
public static int putDouble(byte [] bytes, int offset, double d) { return putLong(bytes, offset, Double.doubleToLongBits(d)); }
java
public static int putDouble(byte [] bytes, int offset, double d) { return putLong(bytes, offset, Double.doubleToLongBits(d)); }
[ "public", "static", "int", "putDouble", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "double", "d", ")", "{", "return", "putLong", "(", "bytes", ",", "offset", ",", "Double", ".", "doubleToLongBits", "(", "d", ")", ")", ";", "}" ]
Put a double value out to the specified byte array position. @param bytes byte array @param offset offset to write to @param d value @return New offset into array <code>bytes</code>
[ "Put", "a", "double", "value", "out", "to", "the", "specified", "byte", "array", "position", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L508-L510
seam/faces
impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java
SecurityPhaseListener.getRestrictedPhaseIds
public PhaseIdType[] getRestrictedPhaseIds(Method restrictAtViewMethod, Annotation annotation) { PhaseIdType[] phaseIds; try { phaseIds = (PhaseIdType[]) restrictAtViewMethod.invoke(annotation); } catch (IllegalAccessException ex) { throw new IllegalArgumentException("restrictAtView method must be accessible", ex); } catch (InvocationTargetException ex) { throw new RuntimeException(ex); } return phaseIds; }
java
public PhaseIdType[] getRestrictedPhaseIds(Method restrictAtViewMethod, Annotation annotation) { PhaseIdType[] phaseIds; try { phaseIds = (PhaseIdType[]) restrictAtViewMethod.invoke(annotation); } catch (IllegalAccessException ex) { throw new IllegalArgumentException("restrictAtView method must be accessible", ex); } catch (InvocationTargetException ex) { throw new RuntimeException(ex); } return phaseIds; }
[ "public", "PhaseIdType", "[", "]", "getRestrictedPhaseIds", "(", "Method", "restrictAtViewMethod", ",", "Annotation", "annotation", ")", "{", "PhaseIdType", "[", "]", "phaseIds", ";", "try", "{", "phaseIds", "=", "(", "PhaseIdType", "[", "]", ")", "restrictAtVie...
Retrieve the default PhaseIdTypes defined by the restrictAtViewMethod in the annotation @param restrictAtViewMethod @param annotation @return PhaseIdTypes from the restrictAtViewMethod, null if empty
[ "Retrieve", "the", "default", "PhaseIdTypes", "defined", "by", "the", "restrictAtViewMethod", "in", "the", "annotation" ]
train
https://github.com/seam/faces/blob/2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3/impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java#L256-L266
HtmlUnit/htmlunit-cssparser
src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java
AbstractCSSParser.intValue
protected int intValue(final char op, final String s) { final int result = Integer.parseInt(s); if (op == '-') { return -1 * result; } return result; }
java
protected int intValue(final char op, final String s) { final int result = Integer.parseInt(s); if (op == '-') { return -1 * result; } return result; }
[ "protected", "int", "intValue", "(", "final", "char", "op", ",", "final", "String", "s", ")", "{", "final", "int", "result", "=", "Integer", ".", "parseInt", "(", "s", ")", ";", "if", "(", "op", "==", "'", "'", ")", "{", "return", "-", "1", "*", ...
Parses the sting into an integer. @param op the sign char @param s the string to parse @return the int value
[ "Parses", "the", "sting", "into", "an", "integer", "." ]
train
https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L752-L758
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
SourceToHTMLConverter.convertPackage
public void convertPackage(PackageDoc pd, DocPath outputdir) { if (pd == null) { return; } ClassDoc[] cds = pd.allClasses(); for (int i = 0; i < cds.length; i++) { // If -nodeprecated option is set and the class is marked as deprecated, // do not convert the package files to HTML. We do not check for // containing package deprecation since it is already check in // the calling method above. if (!(configuration.nodeprecated && Util.isDeprecated(cds[i]))) convertClass(cds[i], outputdir); } }
java
public void convertPackage(PackageDoc pd, DocPath outputdir) { if (pd == null) { return; } ClassDoc[] cds = pd.allClasses(); for (int i = 0; i < cds.length; i++) { // If -nodeprecated option is set and the class is marked as deprecated, // do not convert the package files to HTML. We do not check for // containing package deprecation since it is already check in // the calling method above. if (!(configuration.nodeprecated && Util.isDeprecated(cds[i]))) convertClass(cds[i], outputdir); } }
[ "public", "void", "convertPackage", "(", "PackageDoc", "pd", ",", "DocPath", "outputdir", ")", "{", "if", "(", "pd", "==", "null", ")", "{", "return", ";", "}", "ClassDoc", "[", "]", "cds", "=", "pd", ".", "allClasses", "(", ")", ";", "for", "(", "...
Convert the Classes in the given Package to an HTML. @param pd the Package to convert. @param outputdir the name of the directory to output to.
[ "Convert", "the", "Classes", "in", "the", "given", "Package", "to", "an", "HTML", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java#L122-L135
Frostman/dropbox4j
src/main/java/ru/frostman/dropbox/api/DropboxClient.java
DropboxClient.getMetadata
public Entry getMetadata(String path, int fileLimit, @Nullable String hash) { return getMetadata(path, fileLimit, hash, true); }
java
public Entry getMetadata(String path, int fileLimit, @Nullable String hash) { return getMetadata(path, fileLimit, hash, true); }
[ "public", "Entry", "getMetadata", "(", "String", "path", ",", "int", "fileLimit", ",", "@", "Nullable", "String", "hash", ")", "{", "return", "getMetadata", "(", "path", ",", "fileLimit", ",", "hash", ",", "true", ")", ";", "}" ]
Returns metadata information about specified resource with checking for its hash with specified max child entries count. If nothing changes (hash isn't changed) then 304 will returns. @param path to file or directory @param fileLimit max child entries count @param hash to check smth changed @return metadata of specified resource @see Entry
[ "Returns", "metadata", "information", "about", "specified", "resource", "with", "checking", "for", "its", "hash", "with", "specified", "max", "child", "entries", "count", ".", "If", "nothing", "changes", "(", "hash", "isn", "t", "changed", ")", "then", "304", ...
train
https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L150-L152
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.serviceName_configurations_obfuscatedEmails_PUT
public ArrayList<OvhObfuscatedEmails> serviceName_configurations_obfuscatedEmails_PUT(String serviceName, OvhContactAllTypesEnum[] contacts) throws IOException { String qPath = "/domain/{serviceName}/configurations/obfuscatedEmails"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "contacts", contacts); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, t9); }
java
public ArrayList<OvhObfuscatedEmails> serviceName_configurations_obfuscatedEmails_PUT(String serviceName, OvhContactAllTypesEnum[] contacts) throws IOException { String qPath = "/domain/{serviceName}/configurations/obfuscatedEmails"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "contacts", contacts); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, t9); }
[ "public", "ArrayList", "<", "OvhObfuscatedEmails", ">", "serviceName_configurations_obfuscatedEmails_PUT", "(", "String", "serviceName", ",", "OvhContactAllTypesEnum", "[", "]", "contacts", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/{serviceName}/...
Save a new obfuscated emails configuration REST: PUT /domain/{serviceName}/configurations/obfuscatedEmails @param contacts [required] Contact types where obfuscated emails can be activated @param serviceName [required] The internal name of your domain
[ "Save", "a", "new", "obfuscated", "emails", "configuration" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1591-L1598
JodaOrg/joda-convert
src/main/java/org/joda/convert/StringConvert.java
StringConvert.findFromStringMethod
private Method findFromStringMethod(Class<?> cls, String methodName) { Method m; try { m = cls.getMethod(methodName, String.class); } catch (NoSuchMethodException ex) { try { m = cls.getMethod(methodName, CharSequence.class); } catch (NoSuchMethodException ex2) { throw new IllegalArgumentException("Method not found", ex2); } } if (Modifier.isStatic(m.getModifiers()) == false) { throw new IllegalArgumentException("Method must be static: " + methodName); } return m; }
java
private Method findFromStringMethod(Class<?> cls, String methodName) { Method m; try { m = cls.getMethod(methodName, String.class); } catch (NoSuchMethodException ex) { try { m = cls.getMethod(methodName, CharSequence.class); } catch (NoSuchMethodException ex2) { throw new IllegalArgumentException("Method not found", ex2); } } if (Modifier.isStatic(m.getModifiers()) == false) { throw new IllegalArgumentException("Method must be static: " + methodName); } return m; }
[ "private", "Method", "findFromStringMethod", "(", "Class", "<", "?", ">", "cls", ",", "String", "methodName", ")", "{", "Method", "m", ";", "try", "{", "m", "=", "cls", ".", "getMethod", "(", "methodName", ",", "String", ".", "class", ")", ";", "}", ...
Finds the conversion method. @param cls the class to find a method for, not null @param methodName the name of the method to find, not null @return the method to call, null means use {@code toString}
[ "Finds", "the", "conversion", "method", "." ]
train
https://github.com/JodaOrg/joda-convert/blob/266bd825f4550590d5dafdf4225c548559e0633b/src/main/java/org/joda/convert/StringConvert.java#L816-L831
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLStreamHandler.java
URLStreamHandler.sameFile
protected boolean sameFile(URL u1, URL u2) { // Compare the protocols. if (!((u1.getProtocol() == u2.getProtocol()) || (u1.getProtocol() != null && u1.getProtocol().equalsIgnoreCase(u2.getProtocol())))) return false; // Compare the files. if (!(u1.getFile() == u2.getFile() || (u1.getFile() != null && u1.getFile().equals(u2.getFile())))) return false; // Compare the ports. int port1, port2; try { port1 = (u1.getPort() != -1) ? u1.getPort() : ((URLStreamHandler) u1.getHandler()).getDefaultPort(); port2 = (u2.getPort() != -1) ? u2.getPort() : ((URLStreamHandler) u2.getHandler()).getDefaultPort(); if (port1 != port2) return false; } catch (MalformedURLException e) { return false; } // Compare the hosts. if (!hostsEqual(u1, u2)) return false; return true; }
java
protected boolean sameFile(URL u1, URL u2) { // Compare the protocols. if (!((u1.getProtocol() == u2.getProtocol()) || (u1.getProtocol() != null && u1.getProtocol().equalsIgnoreCase(u2.getProtocol())))) return false; // Compare the files. if (!(u1.getFile() == u2.getFile() || (u1.getFile() != null && u1.getFile().equals(u2.getFile())))) return false; // Compare the ports. int port1, port2; try { port1 = (u1.getPort() != -1) ? u1.getPort() : ((URLStreamHandler) u1.getHandler()).getDefaultPort(); port2 = (u2.getPort() != -1) ? u2.getPort() : ((URLStreamHandler) u2.getHandler()).getDefaultPort(); if (port1 != port2) return false; } catch (MalformedURLException e) { return false; } // Compare the hosts. if (!hostsEqual(u1, u2)) return false; return true; }
[ "protected", "boolean", "sameFile", "(", "URL", "u1", ",", "URL", "u2", ")", "{", "// Compare the protocols.", "if", "(", "!", "(", "(", "u1", ".", "getProtocol", "(", ")", "==", "u2", ".", "getProtocol", "(", ")", ")", "||", "(", "u1", ".", "getProt...
Compare two urls to see whether they refer to the same file, i.e., having the same protocol, host, port, and path. This method requires that none of its arguments is null. This is guaranteed by the fact that it is only called indirectly by java.net.URL class. @param u1 a URL object @param u2 a URL object @return true if u1 and u2 refer to the same file @since 1.3
[ "Compare", "two", "urls", "to", "see", "whether", "they", "refer", "to", "the", "same", "file", "i", ".", "e", ".", "having", "the", "same", "protocol", "host", "port", "and", "path", ".", "This", "method", "requires", "that", "none", "of", "its", "arg...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLStreamHandler.java#L414-L444
broadinstitute/barclay
src/main/java/org/broadinstitute/barclay/argparser/CommandLineArgumentParser.java
CommandLineArgumentParser.loadArgumentsFile
private List<String> loadArgumentsFile(final String argumentsFile) { List<String> args = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new FileReader(argumentsFile))){ String line; while ((line = reader.readLine()) != null) { if (!line.startsWith(ARGUMENT_FILE_COMMENT) && !line.trim().isEmpty()) { args.addAll(Arrays.asList(StringUtils.split(line))); } } } catch (final IOException e) { throw new CommandLineException("I/O error loading arguments file:" + argumentsFile, e); } return args; }
java
private List<String> loadArgumentsFile(final String argumentsFile) { List<String> args = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new FileReader(argumentsFile))){ String line; while ((line = reader.readLine()) != null) { if (!line.startsWith(ARGUMENT_FILE_COMMENT) && !line.trim().isEmpty()) { args.addAll(Arrays.asList(StringUtils.split(line))); } } } catch (final IOException e) { throw new CommandLineException("I/O error loading arguments file:" + argumentsFile, e); } return args; }
[ "private", "List", "<", "String", ">", "loadArgumentsFile", "(", "final", "String", "argumentsFile", ")", "{", "List", "<", "String", ">", "args", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "(", "BufferedReader", "reader", "=", "new", "BufferedRe...
Read an argument file and return a list of the args contained in it A line that starts with {@link #ARGUMENT_FILE_COMMENT} is ignored. @param argumentsFile a text file containing args @return false if a fatal error occurred
[ "Read", "an", "argument", "file", "and", "return", "a", "list", "of", "the", "args", "contained", "in", "it", "A", "line", "that", "starts", "with", "{", "@link", "#ARGUMENT_FILE_COMMENT", "}", "is", "ignored", "." ]
train
https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/argparser/CommandLineArgumentParser.java#L662-L675
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.readCSV
static public WorkSheet readCSV(InputStream is, char delimiter) throws Exception { CompactCharSequence[][] data = getAllValuesCompactCharSequence(is, delimiter); WorkSheet workSheet = new WorkSheet(data); workSheet.setMetaDataColumnsAfterColumn(); workSheet.setMetaDataRowsAfterRow(); return workSheet; }
java
static public WorkSheet readCSV(InputStream is, char delimiter) throws Exception { CompactCharSequence[][] data = getAllValuesCompactCharSequence(is, delimiter); WorkSheet workSheet = new WorkSheet(data); workSheet.setMetaDataColumnsAfterColumn(); workSheet.setMetaDataRowsAfterRow(); return workSheet; }
[ "static", "public", "WorkSheet", "readCSV", "(", "InputStream", "is", ",", "char", "delimiter", ")", "throws", "Exception", "{", "CompactCharSequence", "[", "]", "[", "]", "data", "=", "getAllValuesCompactCharSequence", "(", "is", ",", "delimiter", ")", ";", "...
Read a CSV/Tab delimited file where you pass in the delimiter @param f @param delimiter @return @throws Exception
[ "Read", "a", "CSV", "/", "Tab", "delimited", "file", "where", "you", "pass", "in", "the", "delimiter" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1472-L1481
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/DerivativeChecker.java
DerivativeChecker.jacobianR
public static <S extends DMatrix> boolean jacobianR( FunctionNtoM func , FunctionNtoMxN<S> jacobian , double param[] , double tol ) { return jacobianR(func,jacobian,param,tol,Math.sqrt(UtilEjml.EPS)); }
java
public static <S extends DMatrix> boolean jacobianR( FunctionNtoM func , FunctionNtoMxN<S> jacobian , double param[] , double tol ) { return jacobianR(func,jacobian,param,tol,Math.sqrt(UtilEjml.EPS)); }
[ "public", "static", "<", "S", "extends", "DMatrix", ">", "boolean", "jacobianR", "(", "FunctionNtoM", "func", ",", "FunctionNtoMxN", "<", "S", ">", "jacobian", ",", "double", "param", "[", "]", ",", "double", "tol", ")", "{", "return", "jacobianR", "(", ...
Checks the jacobian using a relative error threshold. @param tol fractional difference
[ "Checks", "the", "jacobian", "using", "a", "relative", "error", "threshold", "." ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/DerivativeChecker.java#L177-L182
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java
GlobalizationPreferences.setNumberFormat
public GlobalizationPreferences setNumberFormat(int style, NumberFormat format) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify immutable object"); } if (numberFormats == null) { numberFormats = new NumberFormat[NF_LIMIT]; } numberFormats[style] = (NumberFormat) format.clone(); // for safety return this; }
java
public GlobalizationPreferences setNumberFormat(int style, NumberFormat format) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify immutable object"); } if (numberFormats == null) { numberFormats = new NumberFormat[NF_LIMIT]; } numberFormats[style] = (NumberFormat) format.clone(); // for safety return this; }
[ "public", "GlobalizationPreferences", "setNumberFormat", "(", "int", "style", ",", "NumberFormat", "format", ")", "{", "if", "(", "isFrozen", "(", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Attempt to modify immutable object\"", ")", ";", ...
Sets a number format explicitly. Overrides the general locale settings. @param style NF_NUMBER, NF_CURRENCY, NF_PERCENT, NF_SCIENTIFIC, NF_INTEGER @param format The number format @return this, for chaining @hide draft / provisional / internal are hidden on Android
[ "Sets", "a", "number", "format", "explicitly", ".", "Overrides", "the", "general", "locale", "settings", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L715-L724
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_service_serviceName_PUT
public void billingAccount_service_serviceName_PUT(String billingAccount, String serviceName, OvhTelephonyService body) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_service_serviceName_PUT(String billingAccount, String serviceName, OvhTelephonyService body) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_service_serviceName_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhTelephonyService", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/service/{serviceName}\"", "...
Alter this object properties REST: PUT /telephony/{billingAccount}/service/{serviceName} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3789-L3793
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageManager.java
ImageManager.getImage
public BufferedImage getImage (String path, Colorization[] zations) { return getImage(null, path, zations); }
java
public BufferedImage getImage (String path, Colorization[] zations) { return getImage(null, path, zations); }
[ "public", "BufferedImage", "getImage", "(", "String", "path", ",", "Colorization", "[", "]", "zations", ")", "{", "return", "getImage", "(", "null", ",", "path", ",", "zations", ")", ";", "}" ]
Like {@link #getImage(String)} but the specified colorizations are applied to the image before it is returned.
[ "Like", "{" ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L182-L185
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/TransactionRequestProcessor.java
TransactionRequestProcessor.isValid
private boolean isValid(TransactionWrite write, AdvancedCache<byte[], byte[]> readCache) { if (write.skipRead()) { if (isTrace) { log.tracef("Operation %s wasn't read.", write); } return true; } CacheEntry<byte[], byte[]> entry = readCache.getCacheEntry(write.key); if (write.wasNonExisting()) { if (isTrace) { log.tracef("Key didn't exist for operation %s. Entry is %s", write, entry); } return entry == null || entry.getValue() == null; } if (isTrace) { log.tracef("Checking version for operation %s. Entry is %s", write, entry); } return entry != null && write.versionRead == MetadataUtils.extractVersion(entry); }
java
private boolean isValid(TransactionWrite write, AdvancedCache<byte[], byte[]> readCache) { if (write.skipRead()) { if (isTrace) { log.tracef("Operation %s wasn't read.", write); } return true; } CacheEntry<byte[], byte[]> entry = readCache.getCacheEntry(write.key); if (write.wasNonExisting()) { if (isTrace) { log.tracef("Key didn't exist for operation %s. Entry is %s", write, entry); } return entry == null || entry.getValue() == null; } if (isTrace) { log.tracef("Checking version for operation %s. Entry is %s", write, entry); } return entry != null && write.versionRead == MetadataUtils.extractVersion(entry); }
[ "private", "boolean", "isValid", "(", "TransactionWrite", "write", ",", "AdvancedCache", "<", "byte", "[", "]", ",", "byte", "[", "]", ">", "readCache", ")", "{", "if", "(", "write", ".", "skipRead", "(", ")", ")", "{", "if", "(", "isTrace", ")", "{"...
Validates if the value read is still valid and the write operation can proceed.
[ "Validates", "if", "the", "value", "read", "is", "still", "valid", "and", "the", "write", "operation", "can", "proceed", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/TransactionRequestProcessor.java#L248-L266
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java
Functions.randomNumber
public static String randomNumber(Long length, boolean padding, TestContext context) { return new RandomNumberFunction().execute(Arrays.asList(String.valueOf(length), String.valueOf(padding)), context); }
java
public static String randomNumber(Long length, boolean padding, TestContext context) { return new RandomNumberFunction().execute(Arrays.asList(String.valueOf(length), String.valueOf(padding)), context); }
[ "public", "static", "String", "randomNumber", "(", "Long", "length", ",", "boolean", "padding", ",", "TestContext", "context", ")", "{", "return", "new", "RandomNumberFunction", "(", ")", ".", "execute", "(", "Arrays", ".", "asList", "(", "String", ".", "val...
Runs random number function with arguments. @param length @param padding @return
[ "Runs", "random", "number", "function", "with", "arguments", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java#L178-L180
mapsforge/mapsforge
mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/JTSUtils.java
JTSUtils.toJtsGeometry
public static Geometry toJtsGeometry(TDWay way, List<TDWay> innerWays) { if (way == null) { LOGGER.warning("way is null"); return null; } if (way.isForcePolygonLine()) { // may build a single line string if inner ways are empty return buildMultiLineString(way, innerWays); } if (way.getShape() != TDWay.LINE || innerWays != null && innerWays.size() > 0) { // Have to be careful here about polygons and lines again, the problem with // polygons is that a certain direction is forced, so we do not want to reverse // closed lines that are not meant to be polygons // may contain holes if inner ways are not empty Polygon polygon = buildPolygon(way, innerWays); if (polygon.isValid()) { return polygon; } return repairInvalidPolygon(polygon); } // not a closed line return buildLineString(way); }
java
public static Geometry toJtsGeometry(TDWay way, List<TDWay> innerWays) { if (way == null) { LOGGER.warning("way is null"); return null; } if (way.isForcePolygonLine()) { // may build a single line string if inner ways are empty return buildMultiLineString(way, innerWays); } if (way.getShape() != TDWay.LINE || innerWays != null && innerWays.size() > 0) { // Have to be careful here about polygons and lines again, the problem with // polygons is that a certain direction is forced, so we do not want to reverse // closed lines that are not meant to be polygons // may contain holes if inner ways are not empty Polygon polygon = buildPolygon(way, innerWays); if (polygon.isValid()) { return polygon; } return repairInvalidPolygon(polygon); } // not a closed line return buildLineString(way); }
[ "public", "static", "Geometry", "toJtsGeometry", "(", "TDWay", "way", ",", "List", "<", "TDWay", ">", "innerWays", ")", "{", "if", "(", "way", "==", "null", ")", "{", "LOGGER", ".", "warning", "(", "\"way is null\"", ")", ";", "return", "null", ";", "}...
Converts a way with potential inner ways to a JTS geometry. @param way the way @param innerWays the inner ways or null @return the JTS geometry
[ "Converts", "a", "way", "with", "potential", "inner", "ways", "to", "a", "JTS", "geometry", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/util/JTSUtils.java#L74-L98
tomgibara/bits
src/main/java/com/tomgibara/bits/BitVector.java
BitVector.fromBigInteger
public static final BitVector fromBigInteger(BigInteger bigInt) { if (bigInt == null) throw new IllegalArgumentException(); final int length = bigInt.bitLength(); return fromBigIntegerImpl(bigInt, length); }
java
public static final BitVector fromBigInteger(BigInteger bigInt) { if (bigInt == null) throw new IllegalArgumentException(); final int length = bigInt.bitLength(); return fromBigIntegerImpl(bigInt, length); }
[ "public", "static", "final", "BitVector", "fromBigInteger", "(", "BigInteger", "bigInt", ")", "{", "if", "(", "bigInt", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "final", "int", "length", "=", "bigInt", ".", "bitLength", "...
Creates a {@link BitVector} from a <code>BigInteger</code>. The bits of the integer copied into the new bit vector. The size of the returned {@link BitVector} is <code>bigInt.bitLength()</code>. Negative values are recorded using 2's complement encoding. No sign-bit is included in the returned {@link BitVector}. @param bigInt a big integer @return a {@link BitVector} initialized with the bits of the big integer @see #fromBigInteger(BigInteger, int) @see Bits#asStore(BigInteger)
[ "Creates", "a", "{", "@link", "BitVector", "}", "from", "a", "<code", ">", "BigInteger<", "/", "code", ">", ".", "The", "bits", "of", "the", "integer", "copied", "into", "the", "new", "bit", "vector", ".", "The", "size", "of", "the", "returned", "{", ...
train
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/BitVector.java#L113-L117
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/Kickflip.java
Kickflip.startMediaPlayerActivity
public static void startMediaPlayerActivity(Activity host, String streamUrl, boolean newTask) { Intent playbackIntent = new Intent(host, MediaPlayerActivity.class); playbackIntent.putExtra("mediaUrl", streamUrl); if (newTask) { playbackIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); } host.startActivity(playbackIntent); }
java
public static void startMediaPlayerActivity(Activity host, String streamUrl, boolean newTask) { Intent playbackIntent = new Intent(host, MediaPlayerActivity.class); playbackIntent.putExtra("mediaUrl", streamUrl); if (newTask) { playbackIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); } host.startActivity(playbackIntent); }
[ "public", "static", "void", "startMediaPlayerActivity", "(", "Activity", "host", ",", "String", "streamUrl", ",", "boolean", "newTask", ")", "{", "Intent", "playbackIntent", "=", "new", "Intent", "(", "host", ",", "MediaPlayerActivity", ".", "class", ")", ";", ...
Start {@link io.kickflip.sdk.activity.MediaPlayerActivity}. This Activity facilitates playing back a Kickflip broadcast. <p/> <b>Must be called after {@link Kickflip#setup(android.content.Context, String, String)} or {@link Kickflip#setup(android.content.Context, String, String, io.kickflip.sdk.api.KickflipCallback)}.</b> @param host the host {@link android.app.Activity} initiating this action @param streamUrl a path of format https://kickflip.io/<stream_id> or https://xxx.xxx/xxx.m3u8 @param newTask Whether this Activity should be started as part of a new task. If so, when this Activity finishes the host application will be concluded.
[ "Start", "{", "@link", "io", ".", "kickflip", ".", "sdk", ".", "activity", ".", "MediaPlayerActivity", "}", ".", "This", "Activity", "facilitates", "playing", "back", "a", "Kickflip", "broadcast", ".", "<p", "/", ">", "<b", ">", "Must", "be", "called", "...
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/Kickflip.java#L174-L181
spring-projects/spring-hateoas
src/main/java/org/springframework/hateoas/config/HateoasConfiguration.java
HateoasConfiguration.linkRelationMessageSource
@Bean public MessageSourceAccessor linkRelationMessageSource() { try { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasename("classpath:rest-messages"); return new MessageSourceAccessor(messageSource); } catch (Exception o_O) { throw new BeanCreationException("resourceDescriptionMessageSourceAccessor", "", o_O); } }
java
@Bean public MessageSourceAccessor linkRelationMessageSource() { try { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasename("classpath:rest-messages"); return new MessageSourceAccessor(messageSource); } catch (Exception o_O) { throw new BeanCreationException("resourceDescriptionMessageSourceAccessor", "", o_O); } }
[ "@", "Bean", "public", "MessageSourceAccessor", "linkRelationMessageSource", "(", ")", "{", "try", "{", "ReloadableResourceBundleMessageSource", "messageSource", "=", "new", "ReloadableResourceBundleMessageSource", "(", ")", ";", "messageSource", ".", "setBasename", "(", ...
The {@link MessageSourceAccessor} to provide messages for {@link ResourceDescription}s being rendered. @return
[ "The", "{", "@link", "MessageSourceAccessor", "}", "to", "provide", "messages", "for", "{", "@link", "ResourceDescription", "}", "s", "being", "rendered", "." ]
train
https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/config/HateoasConfiguration.java#L55-L68
OpenLiberty/open-liberty
dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixCompareCommandTask.java
IFixCompareCommandTask.findFixPackAparIds
private Set<String> findFixPackAparIds(File installLocation, CommandConsole console, ExecutionContext context) throws IllegalArgumentException, ZipException, IOException { // First need to work out what type of installation we have, is it an // archive or extracted? Set<String> fixPackAparIds; if (installLocation.isDirectory()) { // Extracted fixPackAparIds = readAparCsvFromExtractedInstall(installLocation); InstalledIFixInformation installedIFixes = findInstalledIFixes(installLocation, console, context.optionExists(VERBOSE_OPTION)); for (String apar : installedIFixes.validIFixes.keySet()) { fixPackAparIds.add(apar); } } else { String fileName = installLocation.getName(); if (!FileUtils.matchesFileExtension(".jar", fileName) && !FileUtils.matchesFileExtension(".zip", fileName)) { // We have a file that isn't an archive, can't proceed so return // an error message throw new IllegalArgumentException(getMessage("compare.install.not.zip.or.dir", installLocation.getAbsolutePath())); } // Archive fixPackAparIds = readAparCsvFromArchiveInstall(installLocation, console); } return fixPackAparIds; }
java
private Set<String> findFixPackAparIds(File installLocation, CommandConsole console, ExecutionContext context) throws IllegalArgumentException, ZipException, IOException { // First need to work out what type of installation we have, is it an // archive or extracted? Set<String> fixPackAparIds; if (installLocation.isDirectory()) { // Extracted fixPackAparIds = readAparCsvFromExtractedInstall(installLocation); InstalledIFixInformation installedIFixes = findInstalledIFixes(installLocation, console, context.optionExists(VERBOSE_OPTION)); for (String apar : installedIFixes.validIFixes.keySet()) { fixPackAparIds.add(apar); } } else { String fileName = installLocation.getName(); if (!FileUtils.matchesFileExtension(".jar", fileName) && !FileUtils.matchesFileExtension(".zip", fileName)) { // We have a file that isn't an archive, can't proceed so return // an error message throw new IllegalArgumentException(getMessage("compare.install.not.zip.or.dir", installLocation.getAbsolutePath())); } // Archive fixPackAparIds = readAparCsvFromArchiveInstall(installLocation, console); } return fixPackAparIds; }
[ "private", "Set", "<", "String", ">", "findFixPackAparIds", "(", "File", "installLocation", ",", "CommandConsole", "console", ",", "ExecutionContext", "context", ")", "throws", "IllegalArgumentException", ",", "ZipException", ",", "IOException", "{", "// First need to w...
This method will look in the wlp/lib/versions/aparIds.zip file for a file named aparIds.csv which it will then read to obtain a set of APARs that are included in this Fix Pack. @param installLocation The location of the installation file to get the APAR IDs from, it can be either an archive file (zip or jar) or an extracted installation. The file must exist @param context @param console @return A set included all of the APAR IDs that are included in this fix pack. Will be empty if no APARs are found. @throws IllegalArgumentException if the <code>installLocation</code> is neither a directory or archive or the aparId zip is not valid @throws IOException If something goes wrong reading the zip file @throws ZipException If something goes wrong reading the zip file
[ "This", "method", "will", "look", "in", "the", "wlp", "/", "lib", "/", "versions", "/", "aparIds", ".", "zip", "file", "for", "a", "file", "named", "aparIds", ".", "csv", "which", "it", "will", "then", "read", "to", "obtain", "a", "set", "of", "APARs...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixCompareCommandTask.java#L527-L551
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractFieldComparator.java
AbstractFieldComparator.getIndexReaders
private static void getIndexReaders(List<IndexReader> readers, IndexReader reader) { if (reader instanceof MultiIndexReader) { for (IndexReader r : ((MultiIndexReader)reader).getIndexReaders()) { getIndexReaders(readers, r); } } else { readers.add(reader); } }
java
private static void getIndexReaders(List<IndexReader> readers, IndexReader reader) { if (reader instanceof MultiIndexReader) { for (IndexReader r : ((MultiIndexReader)reader).getIndexReaders()) { getIndexReaders(readers, r); } } else { readers.add(reader); } }
[ "private", "static", "void", "getIndexReaders", "(", "List", "<", "IndexReader", ">", "readers", ",", "IndexReader", "reader", ")", "{", "if", "(", "reader", "instanceof", "MultiIndexReader", ")", "{", "for", "(", "IndexReader", "r", ":", "(", "(", "MultiInd...
Checks if <code>reader</code> is of type {@link MultiIndexReader} and if so calls itself recursively for each reader within the <code>MultiIndexReader</code> or otherwise adds the reader to the list. @param readers list of index readers. @param reader reader to decompose
[ "Checks", "if", "<code", ">", "reader<", "/", "code", ">", "is", "of", "type", "{", "@link", "MultiIndexReader", "}", "and", "if", "so", "calls", "itself", "recursively", "for", "each", "reader", "within", "the", "<code", ">", "MultiIndexReader<", "/", "co...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractFieldComparator.java#L142-L155
OpenTSDB/opentsdb
src/core/BatchedDataPoints.java
BatchedDataPoints.isInteger
private boolean isInteger(final int i, final int q_offset) { final short flags = Internal.getFlagsFromQualifier(batched_qualifier, q_offset); return (flags & Const.FLAG_FLOAT) == 0x0; }
java
private boolean isInteger(final int i, final int q_offset) { final short flags = Internal.getFlagsFromQualifier(batched_qualifier, q_offset); return (flags & Const.FLAG_FLOAT) == 0x0; }
[ "private", "boolean", "isInteger", "(", "final", "int", "i", ",", "final", "int", "q_offset", ")", "{", "final", "short", "flags", "=", "Internal", ".", "getFlagsFromQualifier", "(", "batched_qualifier", ",", "q_offset", ")", ";", "return", "(", "flags", "&"...
Tells whether or not the ith value is integer. Uses pre-computed qualifier offset. @param i @param q_offset qualifier offset @return
[ "Tells", "whether", "or", "not", "the", "ith", "value", "is", "integer", ".", "Uses", "pre", "-", "computed", "qualifier", "offset", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/BatchedDataPoints.java#L429-L432
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplPlain_CustomFieldSerializer.java
OWLLiteralImplPlain_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLLiteralImplPlain instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLLiteralImplPlain instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLLiteralImplPlain", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplPlain_CustomFieldSerializer.java#L87-L90
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseFactory.java
SQLDatabaseFactory.internalOpenSQLDatabase
private static SQLDatabase internalOpenSQLDatabase(File dbFile, KeyProvider provider) throws SQLException { boolean runningOnAndroid = Misc.isRunningOnAndroid(); boolean useSqlCipher = (provider.getEncryptionKey() != null); try { if (runningOnAndroid) { if (useSqlCipher) { return (SQLDatabase) Class.forName("com.cloudant.sync.internal.sqlite.android" + ".AndroidSQLCipherSQLite") .getMethod("open", File.class, KeyProvider.class) .invoke(null, new Object[]{dbFile, provider}); } else { return (SQLDatabase) Class.forName("com.cloudant.sync.internal.sqlite.android" + ".AndroidSQLite") .getMethod("open", File.class) .invoke(null, dbFile); } } else { if (useSqlCipher) { throw new UnsupportedOperationException("No SQLCipher-based database " + "implementation for Java SE"); } else { return (SQLDatabase) Class.forName("com.cloudant.sync.internal.sqlite" + ".sqlite4java.SQLiteWrapper") .getMethod("open", File.class) .invoke(null, dbFile); } } } catch (RuntimeException e){ throw e; } catch (Exception e) { logger.log(Level.SEVERE, "Failed to load database module", e); throw new SQLException("Failed to load database module", e); } }
java
private static SQLDatabase internalOpenSQLDatabase(File dbFile, KeyProvider provider) throws SQLException { boolean runningOnAndroid = Misc.isRunningOnAndroid(); boolean useSqlCipher = (provider.getEncryptionKey() != null); try { if (runningOnAndroid) { if (useSqlCipher) { return (SQLDatabase) Class.forName("com.cloudant.sync.internal.sqlite.android" + ".AndroidSQLCipherSQLite") .getMethod("open", File.class, KeyProvider.class) .invoke(null, new Object[]{dbFile, provider}); } else { return (SQLDatabase) Class.forName("com.cloudant.sync.internal.sqlite.android" + ".AndroidSQLite") .getMethod("open", File.class) .invoke(null, dbFile); } } else { if (useSqlCipher) { throw new UnsupportedOperationException("No SQLCipher-based database " + "implementation for Java SE"); } else { return (SQLDatabase) Class.forName("com.cloudant.sync.internal.sqlite" + ".sqlite4java.SQLiteWrapper") .getMethod("open", File.class) .invoke(null, dbFile); } } } catch (RuntimeException e){ throw e; } catch (Exception e) { logger.log(Level.SEVERE, "Failed to load database module", e); throw new SQLException("Failed to load database module", e); } }
[ "private", "static", "SQLDatabase", "internalOpenSQLDatabase", "(", "File", "dbFile", ",", "KeyProvider", "provider", ")", "throws", "SQLException", "{", "boolean", "runningOnAndroid", "=", "Misc", ".", "isRunningOnAndroid", "(", ")", ";", "boolean", "useSqlCipher", ...
Internal method for creating a SQLDatabase that allows a null filename to create an in-memory database which can be useful for performing checks, but creating in-memory databases is not permitted from outside of this class hence the private visibility. @param dbFile full file path of the db file or {@code null} for an in-memory database @param provider Key provider or {@link NullKeyProvider}. Must be {@link NullKeyProvider} if dbFilename is {@code null} i.e. for internal in-memory databases. @return {@code SQLDatabase} for the given filename @throws SQLException - if the database cannot be opened
[ "Internal", "method", "for", "creating", "a", "SQLDatabase", "that", "allows", "a", "null", "filename", "to", "create", "an", "in", "-", "memory", "database", "which", "can", "be", "useful", "for", "performing", "checks", "but", "creating", "in", "-", "memor...
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseFactory.java#L113-L149
hawkular/hawkular-agent
hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/protocol/platform/OshiPlatformCache.java
OshiPlatformCache.getPowerSourceMetric
public Double getPowerSourceMetric(String powerSourceName, ID metricToCollect) { Map<String, PowerSource> cache = getPowerSources(); PowerSource powerSource = cache.get(powerSourceName); if (powerSource == null) { return null; } if (PlatformMetricType.POWER_SOURCE_REMAINING_CAPACITY.getMetricTypeId().equals(metricToCollect)) { return powerSource.getRemainingCapacity(); } else if (PlatformMetricType.POWER_SOURCE_TIME_REMAINING.getMetricTypeId().equals(metricToCollect)) { return powerSource.getTimeRemaining(); } else { throw new UnsupportedOperationException("Invalid power source metric to collect: " + metricToCollect); } }
java
public Double getPowerSourceMetric(String powerSourceName, ID metricToCollect) { Map<String, PowerSource> cache = getPowerSources(); PowerSource powerSource = cache.get(powerSourceName); if (powerSource == null) { return null; } if (PlatformMetricType.POWER_SOURCE_REMAINING_CAPACITY.getMetricTypeId().equals(metricToCollect)) { return powerSource.getRemainingCapacity(); } else if (PlatformMetricType.POWER_SOURCE_TIME_REMAINING.getMetricTypeId().equals(metricToCollect)) { return powerSource.getTimeRemaining(); } else { throw new UnsupportedOperationException("Invalid power source metric to collect: " + metricToCollect); } }
[ "public", "Double", "getPowerSourceMetric", "(", "String", "powerSourceName", ",", "ID", "metricToCollect", ")", "{", "Map", "<", "String", ",", "PowerSource", ">", "cache", "=", "getPowerSources", "(", ")", ";", "PowerSource", "powerSource", "=", "cache", ".", ...
Returns the given metric's value, or null if there is no power source with the given name. @param powerSourceName name of power source @param metricToCollect the metric to collect @return the value of the metric, or null if there is no power source with the given name
[ "Returns", "the", "given", "metric", "s", "value", "or", "null", "if", "there", "is", "no", "power", "source", "with", "the", "given", "name", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/protocol/platform/OshiPlatformCache.java#L254-L269
Virtlink/commons-configuration2-jackson
src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java
JacksonConfiguration.toNode
private ImmutableNode toNode(final Builder builder, final Object obj) { assert !(obj instanceof List); if (obj instanceof Map) { return mapToNode(builder, (Map<String, Object>) obj); } else { return valueToNode(builder, obj); } }
java
private ImmutableNode toNode(final Builder builder, final Object obj) { assert !(obj instanceof List); if (obj instanceof Map) { return mapToNode(builder, (Map<String, Object>) obj); } else { return valueToNode(builder, obj); } }
[ "private", "ImmutableNode", "toNode", "(", "final", "Builder", "builder", ",", "final", "Object", "obj", ")", "{", "assert", "!", "(", "obj", "instanceof", "List", ")", ";", "if", "(", "obj", "instanceof", "Map", ")", "{", "return", "mapToNode", "(", "bu...
Creates a node for the specified object. @param builder The node builder. @param obj The object. @return The created node.
[ "Creates", "a", "node", "for", "the", "specified", "object", "." ]
train
https://github.com/Virtlink/commons-configuration2-jackson/blob/40474ab3c641fbbb4ccd9c97d4f7075c1644ef69/src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java#L144-L152
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/net/URLUtil.java
URLUtil.createUnCertifiedConnection
public static URLConnection createUnCertifiedConnection(URL url, Proxy proxy) throws IOException{ if(sc==null){ try{ SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, SSLUtil.DUMMY_TRUST_MANAGERS, new SecureRandom()); URLUtil.sc = sc; }catch(Exception ex){ throw new ImpossibleException(ex); } } URLConnection con = proxy==null ? url.openConnection() : url.openConnection(proxy); if("https".equals(url.getProtocol())){ HttpsURLConnection httpsCon = (HttpsURLConnection)con; httpsCon.setSSLSocketFactory(sc.getSocketFactory()); httpsCon.setHostnameVerifier(new HostnameVerifier(){ public boolean verify(String urlHostName, SSLSession session){ return true; } }); } return con; }
java
public static URLConnection createUnCertifiedConnection(URL url, Proxy proxy) throws IOException{ if(sc==null){ try{ SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, SSLUtil.DUMMY_TRUST_MANAGERS, new SecureRandom()); URLUtil.sc = sc; }catch(Exception ex){ throw new ImpossibleException(ex); } } URLConnection con = proxy==null ? url.openConnection() : url.openConnection(proxy); if("https".equals(url.getProtocol())){ HttpsURLConnection httpsCon = (HttpsURLConnection)con; httpsCon.setSSLSocketFactory(sc.getSocketFactory()); httpsCon.setHostnameVerifier(new HostnameVerifier(){ public boolean verify(String urlHostName, SSLSession session){ return true; } }); } return con; }
[ "public", "static", "URLConnection", "createUnCertifiedConnection", "(", "URL", "url", ",", "Proxy", "proxy", ")", "throws", "IOException", "{", "if", "(", "sc", "==", "null", ")", "{", "try", "{", "SSLContext", "sc", "=", "SSLContext", ".", "getInstance", "...
Creates connection to the specified url. If the protocol is <code>https</code> the connection created doesn't validate any certificates. @param url url to which connection has to be created @param proxy proxy to be used. can be null @return <code>URLConnection</code>. the connection is not yet connected @throws IOException if an I/O exception occurs
[ "Creates", "connection", "to", "the", "specified", "url", ".", "If", "the", "protocol", "is", "<code", ">", "https<", "/", "code", ">", "the", "connection", "created", "doesn", "t", "validate", "any", "certificates", "." ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/net/URLUtil.java#L156-L178
reactor/reactor-netty
src/main/java/reactor/netty/channel/BootstrapHandlers.java
BootstrapHandlers.updateLogSupport
public static Bootstrap updateLogSupport(Bootstrap b, LoggingHandler handler) { updateConfiguration(b, NettyPipeline.LoggingHandler, logConfiguration(handler, SSL_CLIENT_DEBUG)); return b; }
java
public static Bootstrap updateLogSupport(Bootstrap b, LoggingHandler handler) { updateConfiguration(b, NettyPipeline.LoggingHandler, logConfiguration(handler, SSL_CLIENT_DEBUG)); return b; }
[ "public", "static", "Bootstrap", "updateLogSupport", "(", "Bootstrap", "b", ",", "LoggingHandler", "handler", ")", "{", "updateConfiguration", "(", "b", ",", "NettyPipeline", ".", "LoggingHandler", ",", "logConfiguration", "(", "handler", ",", "SSL_CLIENT_DEBUG", ")...
Configure log support for a {@link Bootstrap} @param b the bootstrap to setup @param handler the logging handler to setup @return a mutated {@link Bootstrap}
[ "Configure", "log", "support", "for", "a", "{", "@link", "Bootstrap", "}" ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/channel/BootstrapHandlers.java#L362-L365
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
JenkinsServer.getView
public View getView(FolderJob folder, String name) throws IOException { try { View resultView = client.get(UrlUtils.toViewBaseUrl(folder, name) + "/", View.class); resultView.setClient(client); // TODO: Think about the following? Does there exists a simpler/more // elegant method? for (Job job : resultView.getJobs()) { job.setClient(client); } for (View view : resultView.getViews()) { view.setClient(client); } return resultView; } catch (HttpResponseException e) { LOGGER.debug("getView(folder={}, name={}) status={}", folder, name, e.getStatusCode()); if (e.getStatusCode() == HttpStatus.SC_NOT_FOUND) { // TODO: Think hard about this. return null; } throw e; } }
java
public View getView(FolderJob folder, String name) throws IOException { try { View resultView = client.get(UrlUtils.toViewBaseUrl(folder, name) + "/", View.class); resultView.setClient(client); // TODO: Think about the following? Does there exists a simpler/more // elegant method? for (Job job : resultView.getJobs()) { job.setClient(client); } for (View view : resultView.getViews()) { view.setClient(client); } return resultView; } catch (HttpResponseException e) { LOGGER.debug("getView(folder={}, name={}) status={}", folder, name, e.getStatusCode()); if (e.getStatusCode() == HttpStatus.SC_NOT_FOUND) { // TODO: Think hard about this. return null; } throw e; } }
[ "public", "View", "getView", "(", "FolderJob", "folder", ",", "String", "name", ")", "throws", "IOException", "{", "try", "{", "View", "resultView", "=", "client", ".", "get", "(", "UrlUtils", ".", "toViewBaseUrl", "(", "folder", ",", "name", ")", "+", "...
Get a single view object from the given folder @param folder The name of the folder. @param name name of the view in Jenkins @return the view object @throws IOException in case of an error.
[ "Get", "a", "single", "view", "object", "from", "the", "given", "folder" ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L239-L261
TakahikoKawasaki/nv-websocket-client
src/main/java/com/neovisionaries/ws/client/ReadingThread.java
ReadingThread.callOnFrameError
private void callOnFrameError(WebSocketException cause, WebSocketFrame frame) { mWebSocket.getListenerManager().callOnFrameError(cause, frame); }
java
private void callOnFrameError(WebSocketException cause, WebSocketFrame frame) { mWebSocket.getListenerManager().callOnFrameError(cause, frame); }
[ "private", "void", "callOnFrameError", "(", "WebSocketException", "cause", ",", "WebSocketFrame", "frame", ")", "{", "mWebSocket", ".", "getListenerManager", "(", ")", ".", "callOnFrameError", "(", "cause", ",", "frame", ")", ";", "}" ]
Call {@link WebSocketListener#onFrameError(WebSocket, WebSocketException, WebSocketFrame) onFrameError} method of the listeners.
[ "Call", "{" ]
train
https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/ReadingThread.java#L294-L297
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.lastIndexOf
public static int lastIndexOf(final CharSequence seq, final CharSequence searchSeq, final int startPos) { if (seq == null || searchSeq == null) { return INDEX_NOT_FOUND; } return CharSequenceUtils.lastIndexOf(seq, searchSeq, startPos); }
java
public static int lastIndexOf(final CharSequence seq, final CharSequence searchSeq, final int startPos) { if (seq == null || searchSeq == null) { return INDEX_NOT_FOUND; } return CharSequenceUtils.lastIndexOf(seq, searchSeq, startPos); }
[ "public", "static", "int", "lastIndexOf", "(", "final", "CharSequence", "seq", ",", "final", "CharSequence", "searchSeq", ",", "final", "int", "startPos", ")", "{", "if", "(", "seq", "==", "null", "||", "searchSeq", "==", "null", ")", "{", "return", "INDEX...
<p>Finds the last index within a CharSequence, handling {@code null}. This method uses {@link String#lastIndexOf(String, int)} if possible.</p> <p>A {@code null} CharSequence will return {@code -1}. A negative start position returns {@code -1}. An empty ("") search CharSequence always matches unless the start position is negative. A start position greater than the string length searches the whole string. The search starts at the startPos and works backwards; matches starting after the start position are ignored. </p> <pre> StringUtils.lastIndexOf(null, *, *) = -1 StringUtils.lastIndexOf(*, null, *) = -1 StringUtils.lastIndexOf("aabaabaa", "a", 8) = 7 StringUtils.lastIndexOf("aabaabaa", "b", 8) = 5 StringUtils.lastIndexOf("aabaabaa", "ab", 8) = 4 StringUtils.lastIndexOf("aabaabaa", "b", 9) = 5 StringUtils.lastIndexOf("aabaabaa", "b", -1) = -1 StringUtils.lastIndexOf("aabaabaa", "a", 0) = 0 StringUtils.lastIndexOf("aabaabaa", "b", 0) = -1 StringUtils.lastIndexOf("aabaabaa", "b", 1) = -1 StringUtils.lastIndexOf("aabaabaa", "b", 2) = 2 StringUtils.lastIndexOf("aabaabaa", "ba", 2) = -1 StringUtils.lastIndexOf("aabaabaa", "ba", 2) = 2 </pre> @param seq the CharSequence to check, may be null @param searchSeq the CharSequence to find, may be null @param startPos the start position, negative treated as zero @return the last index of the search CharSequence (always &le; startPos), -1 if no match or {@code null} string input @since 2.0 @since 3.0 Changed signature from lastIndexOf(String, String, int) to lastIndexOf(CharSequence, CharSequence, int)
[ "<p", ">", "Finds", "the", "last", "index", "within", "a", "CharSequence", "handling", "{", "@code", "null", "}", ".", "This", "method", "uses", "{", "@link", "String#lastIndexOf", "(", "String", "int", ")", "}", "if", "possible", ".", "<", "/", "p", "...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L1837-L1842
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getWithTrailing
@Nonnull public static String getWithTrailing (@Nullable final String sSrc, @Nonnegative final int nMinLen, final char cEnd) { return _getWithLeadingOrTrailing (sSrc, nMinLen, cEnd, false); }
java
@Nonnull public static String getWithTrailing (@Nullable final String sSrc, @Nonnegative final int nMinLen, final char cEnd) { return _getWithLeadingOrTrailing (sSrc, nMinLen, cEnd, false); }
[ "@", "Nonnull", "public", "static", "String", "getWithTrailing", "(", "@", "Nullable", "final", "String", "sSrc", ",", "@", "Nonnegative", "final", "int", "nMinLen", ",", "final", "char", "cEnd", ")", "{", "return", "_getWithLeadingOrTrailing", "(", "sSrc", ",...
Get a string that is filled at the end with the passed character until the minimum length is reached. If the input string is empty, the result is a string with the provided len only consisting of the passed characters. If the input String is longer than the provided length, it is returned unchanged. @param sSrc Source string. May be <code>null</code>. @param nMinLen Minimum length. Should be &gt; 0. @param cEnd The character to be used at the end @return A non-<code>null</code> string that has at least nLen chars
[ "Get", "a", "string", "that", "is", "filled", "at", "the", "end", "with", "the", "passed", "character", "until", "the", "minimum", "length", "is", "reached", ".", "If", "the", "input", "string", "is", "empty", "the", "result", "is", "a", "string", "with"...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L560-L564
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/internal/resilience/RobustResilienceStrategy.java
RobustResilienceStrategy.getFailure
@Override public V getFailure(K key, StoreAccessException e) { cleanup(key, e); return null; }
java
@Override public V getFailure(K key, StoreAccessException e) { cleanup(key, e); return null; }
[ "@", "Override", "public", "V", "getFailure", "(", "K", "key", ",", "StoreAccessException", "e", ")", "{", "cleanup", "(", "key", ",", "e", ")", ";", "return", "null", ";", "}" ]
Return null. @param key the key being retrieved @param e the triggered failure @return null
[ "Return", "null", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/RobustResilienceStrategy.java#L54-L58
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/PropertyDefinitionId.java
PropertyDefinitionId.fromString
public static PropertyDefinitionId fromString( String definition, NameFactory factory ) { String[] parts = definition.split("/"); String nodeTypeNameString = parts[0]; String propertyDefinitionNameString = parts[1]; Name nodeTypeName = factory.create(nodeTypeNameString); Name propertyDefinitionName = factory.create(propertyDefinitionNameString); int propertyType = org.modeshape.jcr.api.PropertyType.valueFromName(parts[2]); boolean allowsMultiple = parts[3].charAt(0) == '*'; return new PropertyDefinitionId(nodeTypeName, propertyDefinitionName, propertyType, allowsMultiple); }
java
public static PropertyDefinitionId fromString( String definition, NameFactory factory ) { String[] parts = definition.split("/"); String nodeTypeNameString = parts[0]; String propertyDefinitionNameString = parts[1]; Name nodeTypeName = factory.create(nodeTypeNameString); Name propertyDefinitionName = factory.create(propertyDefinitionNameString); int propertyType = org.modeshape.jcr.api.PropertyType.valueFromName(parts[2]); boolean allowsMultiple = parts[3].charAt(0) == '*'; return new PropertyDefinitionId(nodeTypeName, propertyDefinitionName, propertyType, allowsMultiple); }
[ "public", "static", "PropertyDefinitionId", "fromString", "(", "String", "definition", ",", "NameFactory", "factory", ")", "{", "String", "[", "]", "parts", "=", "definition", ".", "split", "(", "\"/\"", ")", ";", "String", "nodeTypeNameString", "=", "parts", ...
Parse the supplied string for of an identifer, and return the object form for that identifier. @param definition the {@link #getString() string form of the identifier}; may not be null @param factory the factory that should be used to create Name objects; may not be null @return the object form of the identifier; never null @throws ValueFormatException if the definition is not the valid format
[ "Parse", "the", "supplied", "string", "for", "of", "an", "identifer", "and", "return", "the", "object", "form", "for", "that", "identifier", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/PropertyDefinitionId.java#L147-L157
ManfredTremmel/gwt-bean-validators
gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/ObjectUtils.java
ObjectUtils.containsElement
public static boolean containsElement(@Nullable final Object[] array, final Object element) { if (array == null) { return false; } for (final Object arrayEle : array) { if (ObjectUtils.nullSafeEquals(arrayEle, element)) { return true; } } return false; }
java
public static boolean containsElement(@Nullable final Object[] array, final Object element) { if (array == null) { return false; } for (final Object arrayEle : array) { if (ObjectUtils.nullSafeEquals(arrayEle, element)) { return true; } } return false; }
[ "public", "static", "boolean", "containsElement", "(", "@", "Nullable", "final", "Object", "[", "]", "array", ",", "final", "Object", "element", ")", "{", "if", "(", "array", "==", "null", ")", "{", "return", "false", ";", "}", "for", "(", "final", "Ob...
Check whether the given array contains the given element. @param array the array to check (may be {@code null}, in which case the return value will always be {@code false}) @param element the element to check for @return whether the element has been found in the given array
[ "Check", "whether", "the", "given", "array", "contains", "the", "given", "element", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/ObjectUtils.java#L198-L208
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java
SARLEclipsePlugin.createStatus
public IStatus createStatus(int severity, int code, Throwable cause) { return createStatus(severity, code, null, cause); }
java
public IStatus createStatus(int severity, int code, Throwable cause) { return createStatus(severity, code, null, cause); }
[ "public", "IStatus", "createStatus", "(", "int", "severity", ",", "int", "code", ",", "Throwable", "cause", ")", "{", "return", "createStatus", "(", "severity", ",", "code", ",", "null", ",", "cause", ")", ";", "}" ]
Create a status. @param severity the severity level, see {@link IStatus}. @param code the code of the error. @param cause the cause of the problem. @return the status.
[ "Create", "a", "status", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java#L208-L210
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/jmx/MBeanServiceContainer.java
MBeanServiceContainer.getServiceValue
public <S> S getServiceValue(ServiceType type, String localName) { String globalName = composeLocalName(type, localName); ObjectName serviceName = getObjectName(globalName); return getServiceValue(serviceName); }
java
public <S> S getServiceValue(ServiceType type, String localName) { String globalName = composeLocalName(type, localName); ObjectName serviceName = getObjectName(globalName); return getServiceValue(serviceName); }
[ "public", "<", "S", ">", "S", "getServiceValue", "(", "ServiceType", "type", ",", "String", "localName", ")", "{", "String", "globalName", "=", "composeLocalName", "(", "type", ",", "localName", ")", ";", "ObjectName", "serviceName", "=", "getObjectName", "(",...
get the service value for a specific service by name or null if no such Service exists.
[ "get", "the", "service", "value", "for", "a", "specific", "service", "by", "name", "or", "null", "if", "no", "such", "Service", "exists", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/container/impl/jmx/MBeanServiceContainer.java#L209-L213
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
AutoRegisterActionServlet.getModuleConfig
protected ModuleConfig getModuleConfig( String modulePath, ServletRequest request, ServletResponse response ) throws IOException, ServletException { return ensureModuleRegistered(modulePath); }
java
protected ModuleConfig getModuleConfig( String modulePath, ServletRequest request, ServletResponse response ) throws IOException, ServletException { return ensureModuleRegistered(modulePath); }
[ "protected", "ModuleConfig", "getModuleConfig", "(", "String", "modulePath", ",", "ServletRequest", "request", ",", "ServletResponse", "response", ")", "throws", "IOException", ",", "ServletException", "{", "return", "ensureModuleRegistered", "(", "modulePath", ")", ";"...
Get the Struts ModuleConfig for the given module path. @deprecated Use {@link #ensureModuleRegistered} instead. @param modulePath the module path, from the request URI. @param request the current ServletRequest @param response the current HttpServletResponse @return the Struts ModuleConfig that corresponds with <code>modulePath</code> @throws IOException @throws ServletException
[ "Get", "the", "Struts", "ModuleConfig", "for", "the", "given", "module", "path", ".", "@deprecated", "Use", "{", "@link", "#ensureModuleRegistered", "}", "instead", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java#L724-L728
cdk/cdk
tool/formula/src/main/java/org/openscience/cdk/formula/rules/IsotopePatternRule.java
IsotopePatternRule.setParameters
@Override public void setParameters(Object[] params) throws CDKException { if (params.length != 2) throw new CDKException("IsotopePatternRule expects two parameter"); if (!(params[0] instanceof List)) throw new CDKException("The parameter one must be of type List<Double[]>"); if (!(params[1] instanceof Double)) throw new CDKException("The parameter two must be of type Double"); pattern = new IsotopePattern(); for (double[] listISO : (List<double[]>) params[0]) { pattern.addIsotope(new IsotopeContainer(listISO[0], listISO[1])); } is.seTolerance((Double) params[1]); }
java
@Override public void setParameters(Object[] params) throws CDKException { if (params.length != 2) throw new CDKException("IsotopePatternRule expects two parameter"); if (!(params[0] instanceof List)) throw new CDKException("The parameter one must be of type List<Double[]>"); if (!(params[1] instanceof Double)) throw new CDKException("The parameter two must be of type Double"); pattern = new IsotopePattern(); for (double[] listISO : (List<double[]>) params[0]) { pattern.addIsotope(new IsotopeContainer(listISO[0], listISO[1])); } is.seTolerance((Double) params[1]); }
[ "@", "Override", "public", "void", "setParameters", "(", "Object", "[", "]", "params", ")", "throws", "CDKException", "{", "if", "(", "params", ".", "length", "!=", "2", ")", "throw", "new", "CDKException", "(", "\"IsotopePatternRule expects two parameter\"", ")...
Sets the parameters attribute of the IsotopePatternRule object. @param params The new parameters value @throws CDKException Description of the Exception @see #getParameters
[ "Sets", "the", "parameters", "attribute", "of", "the", "IsotopePatternRule", "object", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/formula/rules/IsotopePatternRule.java#L88-L102
joelittlejohn/jsonschema2pojo
jsonschema2pojo-ant/src/main/java/org/jsonschema2pojo/ant/Jsonschema2PojoTask.java
Jsonschema2PojoTask.buildExtendedClassloader
private ClassLoader buildExtendedClassloader() { final List<URL> classpathUrls = new ArrayList<>(); for (String pathElement : getClasspath().list()) { try { classpathUrls.add(new File(pathElement).toURI().toURL()); } catch (MalformedURLException e) { throw new BuildException("Unable to use classpath entry as it could not be understood as a valid URL: " + pathElement, e); } } final ClassLoader parentClassloader = Thread.currentThread().getContextClassLoader(); return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return new URLClassLoader(classpathUrls.toArray(new URL[classpathUrls.size()]), parentClassloader); } }); }
java
private ClassLoader buildExtendedClassloader() { final List<URL> classpathUrls = new ArrayList<>(); for (String pathElement : getClasspath().list()) { try { classpathUrls.add(new File(pathElement).toURI().toURL()); } catch (MalformedURLException e) { throw new BuildException("Unable to use classpath entry as it could not be understood as a valid URL: " + pathElement, e); } } final ClassLoader parentClassloader = Thread.currentThread().getContextClassLoader(); return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return new URLClassLoader(classpathUrls.toArray(new URL[classpathUrls.size()]), parentClassloader); } }); }
[ "private", "ClassLoader", "buildExtendedClassloader", "(", ")", "{", "final", "List", "<", "URL", ">", "classpathUrls", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "pathElement", ":", "getClasspath", "(", ")", ".", "list", "(", ")",...
Build a classloader using the additional elements specified in <code>classpath</code> and <code>classpathRef</code>. @return a new classloader that includes the extra path elements found in the <code>classpath</code> and <code>classpathRef</code> config values
[ "Build", "a", "classloader", "using", "the", "additional", "elements", "specified", "in", "<code", ">", "classpath<", "/", "code", ">", "and", "<code", ">", "classpathRef<", "/", "code", ">", "." ]
train
https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-ant/src/main/java/org/jsonschema2pojo/ant/Jsonschema2PojoTask.java#L252-L270
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/form/SimpleFormValidator.java
SimpleFormValidator.valueGreaterThan
public FormInputValidator valueGreaterThan (VisValidatableTextField field, String errorMsg, float value) { return valueGreaterThan(field, errorMsg, value, false); }
java
public FormInputValidator valueGreaterThan (VisValidatableTextField field, String errorMsg, float value) { return valueGreaterThan(field, errorMsg, value, false); }
[ "public", "FormInputValidator", "valueGreaterThan", "(", "VisValidatableTextField", "field", ",", "String", "errorMsg", ",", "float", "value", ")", "{", "return", "valueGreaterThan", "(", "field", ",", "errorMsg", ",", "value", ",", "false", ")", ";", "}" ]
Validates if entered text is greater than entered number <p> Can be used in combination with {@link #integerNumber(VisValidatableTextField, String)} to only allows integers.
[ "Validates", "if", "entered", "text", "is", "greater", "than", "entered", "number", "<p", ">", "Can", "be", "used", "in", "combination", "with", "{" ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/form/SimpleFormValidator.java#L125-L127
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/ToastManager.java
ToastManager.show
public void show (final Toast toast, float timeSec) { Table toastMainTable = toast.getMainTable(); if (toastMainTable.getStage() != null) { remove(toast); } toasts.add(toast); toast.setToastManager(this); toast.fadeIn(); toastMainTable.pack(); root.addActor(toastMainTable); updateToastsPositions(); if (timeSec > 0) { Timer.Task fadeOutTask = new Timer.Task() { @Override public void run () { toast.fadeOut(); timersTasks.remove(toast); } }; timersTasks.put(toast, fadeOutTask); Timer.schedule(fadeOutTask, timeSec); } }
java
public void show (final Toast toast, float timeSec) { Table toastMainTable = toast.getMainTable(); if (toastMainTable.getStage() != null) { remove(toast); } toasts.add(toast); toast.setToastManager(this); toast.fadeIn(); toastMainTable.pack(); root.addActor(toastMainTable); updateToastsPositions(); if (timeSec > 0) { Timer.Task fadeOutTask = new Timer.Task() { @Override public void run () { toast.fadeOut(); timersTasks.remove(toast); } }; timersTasks.put(toast, fadeOutTask); Timer.schedule(fadeOutTask, timeSec); } }
[ "public", "void", "show", "(", "final", "Toast", "toast", ",", "float", "timeSec", ")", "{", "Table", "toastMainTable", "=", "toast", ".", "getMainTable", "(", ")", ";", "if", "(", "toastMainTable", ".", "getStage", "(", ")", "!=", "null", ")", "{", "r...
Displays toast. Toast will be displayed for given amount of seconds.
[ "Displays", "toast", ".", "Toast", "will", "be", "displayed", "for", "given", "amount", "of", "seconds", "." ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/ToastManager.java#L126-L151
stephenc/java-iso-tools
loop-fs-iso-impl/src/main/java/com/github/stephenc/javaisotools/loopfs/iso9660/Iso9660VolumeDescriptorSet.java
Iso9660VolumeDescriptorSet.deserializeCommon
private void deserializeCommon(byte[] descriptor) throws IOException { this.systemIdentifier = Util.getAChars(descriptor, 9, 32, this.encoding); this.volumeIdentifier = Util.getDChars(descriptor, 41, 32, this.encoding); this.volumeSetIdentifier = Util.getDChars(descriptor, 191, 128, this.encoding); this.rootDirectoryEntry = new Iso9660FileEntry(this.isoFile, descriptor, 157); }
java
private void deserializeCommon(byte[] descriptor) throws IOException { this.systemIdentifier = Util.getAChars(descriptor, 9, 32, this.encoding); this.volumeIdentifier = Util.getDChars(descriptor, 41, 32, this.encoding); this.volumeSetIdentifier = Util.getDChars(descriptor, 191, 128, this.encoding); this.rootDirectoryEntry = new Iso9660FileEntry(this.isoFile, descriptor, 157); }
[ "private", "void", "deserializeCommon", "(", "byte", "[", "]", "descriptor", ")", "throws", "IOException", "{", "this", ".", "systemIdentifier", "=", "Util", ".", "getAChars", "(", "descriptor", ",", "9", ",", "32", ",", "this", ".", "encoding", ")", ";", ...
Read the information common to primary and secondary volume descriptors. @param descriptor the volume descriptor bytes @throws IOException
[ "Read", "the", "information", "common", "to", "primary", "and", "secondary", "volume", "descriptors", "." ]
train
https://github.com/stephenc/java-iso-tools/blob/828c50b02eb311a14dde0dab43462a0d0c9dfb06/loop-fs-iso-impl/src/main/java/com/github/stephenc/javaisotools/loopfs/iso9660/Iso9660VolumeDescriptorSet.java#L194-L199
logic-ng/LogicNG
src/main/java/org/logicng/backbones/BackboneGeneration.java
BackboneGeneration.computePositive
public static Backbone computePositive(final Collection<Formula> formulas) { return compute(formulas, allVariablesInFormulas(formulas), BackboneType.ONLY_POSITIVE); }
java
public static Backbone computePositive(final Collection<Formula> formulas) { return compute(formulas, allVariablesInFormulas(formulas), BackboneType.ONLY_POSITIVE); }
[ "public", "static", "Backbone", "computePositive", "(", "final", "Collection", "<", "Formula", ">", "formulas", ")", "{", "return", "compute", "(", "formulas", ",", "allVariablesInFormulas", "(", "formulas", ")", ",", "BackboneType", ".", "ONLY_POSITIVE", ")", "...
Computes the positive backbone variables for a given collection of formulas. @param formulas the given collection of formulas @return the positive backbone or {@code null} if the formula is UNSAT
[ "Computes", "the", "positive", "backbone", "variables", "for", "a", "given", "collection", "of", "formulas", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/BackboneGeneration.java#L173-L175
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/conf/AccumuloTableProperties.java
AccumuloTableProperties.getLocalityGroups
public static Optional<Map<String, Set<String>>> getLocalityGroups(Map<String, Object> tableProperties) { requireNonNull(tableProperties); @SuppressWarnings("unchecked") String groupStr = (String) tableProperties.get(LOCALITY_GROUPS); if (groupStr == null) { return Optional.empty(); } ImmutableMap.Builder<String, Set<String>> groups = ImmutableMap.builder(); // Split all configured locality groups for (String group : PIPE_SPLITTER.split(groupStr)) { String[] locGroups = Iterables.toArray(COLON_SPLITTER.split(group), String.class); if (locGroups.length != 2) { throw new PrestoException(INVALID_TABLE_PROPERTY, "Locality groups string is malformed. See documentation for proper format."); } String grpName = locGroups[0]; ImmutableSet.Builder<String> colSet = ImmutableSet.builder(); for (String f : COMMA_SPLITTER.split(locGroups[1])) { colSet.add(f.toLowerCase(Locale.ENGLISH)); } groups.put(grpName.toLowerCase(Locale.ENGLISH), colSet.build()); } return Optional.of(groups.build()); }
java
public static Optional<Map<String, Set<String>>> getLocalityGroups(Map<String, Object> tableProperties) { requireNonNull(tableProperties); @SuppressWarnings("unchecked") String groupStr = (String) tableProperties.get(LOCALITY_GROUPS); if (groupStr == null) { return Optional.empty(); } ImmutableMap.Builder<String, Set<String>> groups = ImmutableMap.builder(); // Split all configured locality groups for (String group : PIPE_SPLITTER.split(groupStr)) { String[] locGroups = Iterables.toArray(COLON_SPLITTER.split(group), String.class); if (locGroups.length != 2) { throw new PrestoException(INVALID_TABLE_PROPERTY, "Locality groups string is malformed. See documentation for proper format."); } String grpName = locGroups[0]; ImmutableSet.Builder<String> colSet = ImmutableSet.builder(); for (String f : COMMA_SPLITTER.split(locGroups[1])) { colSet.add(f.toLowerCase(Locale.ENGLISH)); } groups.put(grpName.toLowerCase(Locale.ENGLISH), colSet.build()); } return Optional.of(groups.build()); }
[ "public", "static", "Optional", "<", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", ">", "getLocalityGroups", "(", "Map", "<", "String", ",", "Object", ">", "tableProperties", ")", "{", "requireNonNull", "(", "tableProperties", ")", ";", "@", ...
Gets the configured locality groups for the table, or Optional.empty() if not set. <p> All strings are lowercase. @param tableProperties The map of table properties @return Optional map of locality groups
[ "Gets", "the", "configured", "locality", "groups", "for", "the", "table", "or", "Optional", ".", "empty", "()", "if", "not", "set", ".", "<p", ">", "All", "strings", "are", "lowercase", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/conf/AccumuloTableProperties.java#L177-L208
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.methodHasParameters
public static Matcher<MethodTree> methodHasParameters( final List<Matcher<VariableTree>> variableMatcher) { return new Matcher<MethodTree>() { @Override public boolean matches(MethodTree methodTree, VisitorState state) { if (methodTree.getParameters().size() != variableMatcher.size()) { return false; } int paramIndex = 0; for (Matcher<VariableTree> eachVariableMatcher : variableMatcher) { if (!eachVariableMatcher.matches(methodTree.getParameters().get(paramIndex++), state)) { return false; } } return true; } }; }
java
public static Matcher<MethodTree> methodHasParameters( final List<Matcher<VariableTree>> variableMatcher) { return new Matcher<MethodTree>() { @Override public boolean matches(MethodTree methodTree, VisitorState state) { if (methodTree.getParameters().size() != variableMatcher.size()) { return false; } int paramIndex = 0; for (Matcher<VariableTree> eachVariableMatcher : variableMatcher) { if (!eachVariableMatcher.matches(methodTree.getParameters().get(paramIndex++), state)) { return false; } } return true; } }; }
[ "public", "static", "Matcher", "<", "MethodTree", ">", "methodHasParameters", "(", "final", "List", "<", "Matcher", "<", "VariableTree", ">", ">", "variableMatcher", ")", "{", "return", "new", "Matcher", "<", "MethodTree", ">", "(", ")", "{", "@", "Override"...
Matches an AST node that represents a method declaration, based on the list of variableMatchers. Applies the variableMatcher at index n to the parameter at index n and returns true iff they all match. Returns false if the number of variableMatchers provided does not match the number of parameters. <p>If you pass no variableMatchers, this will match methods with no parameters. @param variableMatcher a list of matchers to apply to the parameters of the method
[ "Matches", "an", "AST", "node", "that", "represents", "a", "method", "declaration", "based", "on", "the", "list", "of", "variableMatchers", ".", "Applies", "the", "variableMatcher", "at", "index", "n", "to", "the", "parameter", "at", "index", "n", "and", "re...
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L988-L1005
tvesalainen/util
util/src/main/java/org/vesalainen/ui/Transforms.java
Transforms.createScreenTransform
public static AffineTransform createScreenTransform(Rectangle2D userBounds, Rectangle2D screenBounds, boolean keepAspectRatio, AffineTransform transform) { double width = screenBounds.getWidth(); double height = screenBounds.getHeight(); double aspect = width / height; double xMin = userBounds.getMinX(); double yMin = userBounds.getMinY(); double xMax = userBounds.getMaxX(); double yMax = userBounds.getMaxY(); double xyWidth = xMax - xMin; double xyHeight = yMax - yMin; double scaleX; double scaleY; double xOff; double yOff; if (keepAspectRatio) { double xyAspect = xyWidth / xyHeight; if (aspect > xyAspect) { scaleX = scaleY = height / xyHeight; xOff = -scaleY*xMin + (width - scaleY*xyWidth) / 2.0; yOff = scaleY*yMin + height; } else { scaleX = scaleY = width / xyWidth; xOff = -scaleY*xMin; yOff = scaleY*yMin + height / 2.0 + scaleY*xyHeight / 2.0; } } else { scaleX = width / xyWidth; scaleY = height / xyHeight; xOff = -scaleX*xMin; yOff = scaleY*yMin + height / 2.0 + scaleY*xyHeight / 2.0; } transform.setTransform(scaleX, 0, 0, -scaleY, xOff, yOff); return transform; }
java
public static AffineTransform createScreenTransform(Rectangle2D userBounds, Rectangle2D screenBounds, boolean keepAspectRatio, AffineTransform transform) { double width = screenBounds.getWidth(); double height = screenBounds.getHeight(); double aspect = width / height; double xMin = userBounds.getMinX(); double yMin = userBounds.getMinY(); double xMax = userBounds.getMaxX(); double yMax = userBounds.getMaxY(); double xyWidth = xMax - xMin; double xyHeight = yMax - yMin; double scaleX; double scaleY; double xOff; double yOff; if (keepAspectRatio) { double xyAspect = xyWidth / xyHeight; if (aspect > xyAspect) { scaleX = scaleY = height / xyHeight; xOff = -scaleY*xMin + (width - scaleY*xyWidth) / 2.0; yOff = scaleY*yMin + height; } else { scaleX = scaleY = width / xyWidth; xOff = -scaleY*xMin; yOff = scaleY*yMin + height / 2.0 + scaleY*xyHeight / 2.0; } } else { scaleX = width / xyWidth; scaleY = height / xyHeight; xOff = -scaleX*xMin; yOff = scaleY*yMin + height / 2.0 + scaleY*xyHeight / 2.0; } transform.setTransform(scaleX, 0, 0, -scaleY, xOff, yOff); return transform; }
[ "public", "static", "AffineTransform", "createScreenTransform", "(", "Rectangle2D", "userBounds", ",", "Rectangle2D", "screenBounds", ",", "boolean", "keepAspectRatio", ",", "AffineTransform", "transform", ")", "{", "double", "width", "=", "screenBounds", ".", "getWidth...
Creates translation that translates userBounds in Cartesian coordinates to screenBound in screen coordinates. <p>In Cartesian y grows up while in screen y grows down @param userBounds @param screenBounds @param keepAspectRatio @param transform @return Returns parameter transform
[ "Creates", "translation", "that", "translates", "userBounds", "in", "Cartesian", "coordinates", "to", "screenBound", "in", "screen", "coordinates", ".", "<p", ">", "In", "Cartesian", "y", "grows", "up", "while", "in", "screen", "y", "grows", "down" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/Transforms.java#L57-L97
WASdev/standards.jsr352.jbatch
com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/impl/BatchKernelImpl.java
BatchKernelImpl.buildNewParallelPartitions
@Override public List<BatchPartitionWorkUnit> buildNewParallelPartitions(PartitionsBuilderConfig config) throws JobRestartException, JobStartException { List<JSLJob> jobModels = config.getJobModels(); Properties[] partitionPropertiesArray = config.getPartitionProperties(); List<BatchPartitionWorkUnit> batchWorkUnits = new ArrayList<BatchPartitionWorkUnit>(jobModels.size()); int instance = 0; for (JSLJob parallelJob : jobModels){ Properties partitionProps = (partitionPropertiesArray == null) ? null : partitionPropertiesArray[instance]; if (logger.isLoggable(Level.FINER)) { logger.finer("Starting execution for jobModel = " + parallelJob.toString()); } RuntimeJobExecution jobExecution = JobExecutionHelper.startPartition(parallelJob, partitionProps); jobExecution.setPartitionInstance(instance); if (logger.isLoggable(Level.FINE)) { logger.fine("JobExecution constructed: " + jobExecution); } BatchPartitionWorkUnit batchWork = new BatchPartitionWorkUnit(this, jobExecution, config); registerCurrentInstanceAndExecution(jobExecution, batchWork.getController()); batchWorkUnits.add(batchWork); instance++; } return batchWorkUnits; }
java
@Override public List<BatchPartitionWorkUnit> buildNewParallelPartitions(PartitionsBuilderConfig config) throws JobRestartException, JobStartException { List<JSLJob> jobModels = config.getJobModels(); Properties[] partitionPropertiesArray = config.getPartitionProperties(); List<BatchPartitionWorkUnit> batchWorkUnits = new ArrayList<BatchPartitionWorkUnit>(jobModels.size()); int instance = 0; for (JSLJob parallelJob : jobModels){ Properties partitionProps = (partitionPropertiesArray == null) ? null : partitionPropertiesArray[instance]; if (logger.isLoggable(Level.FINER)) { logger.finer("Starting execution for jobModel = " + parallelJob.toString()); } RuntimeJobExecution jobExecution = JobExecutionHelper.startPartition(parallelJob, partitionProps); jobExecution.setPartitionInstance(instance); if (logger.isLoggable(Level.FINE)) { logger.fine("JobExecution constructed: " + jobExecution); } BatchPartitionWorkUnit batchWork = new BatchPartitionWorkUnit(this, jobExecution, config); registerCurrentInstanceAndExecution(jobExecution, batchWork.getController()); batchWorkUnits.add(batchWork); instance++; } return batchWorkUnits; }
[ "@", "Override", "public", "List", "<", "BatchPartitionWorkUnit", ">", "buildNewParallelPartitions", "(", "PartitionsBuilderConfig", "config", ")", "throws", "JobRestartException", ",", "JobStartException", "{", "List", "<", "JSLJob", ">", "jobModels", "=", "config", ...
Build a list of batch work units and set them up in STARTING state but don't start them yet.
[ "Build", "a", "list", "of", "batch", "work", "units", "and", "set", "them", "up", "in", "STARTING", "state", "but", "don", "t", "start", "them", "yet", "." ]
train
https://github.com/WASdev/standards.jsr352.jbatch/blob/e267e79dccd4f0bd4bf9c2abc41a8a47b65be28f/com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/impl/BatchKernelImpl.java#L268-L299
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.findByC_S
@Override public CPInstance findByC_S(long CPDefinitionId, String sku) throws NoSuchCPInstanceException { CPInstance cpInstance = fetchByC_S(CPDefinitionId, sku); if (cpInstance == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("CPDefinitionId="); msg.append(CPDefinitionId); msg.append(", sku="); msg.append(sku); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPInstanceException(msg.toString()); } return cpInstance; }
java
@Override public CPInstance findByC_S(long CPDefinitionId, String sku) throws NoSuchCPInstanceException { CPInstance cpInstance = fetchByC_S(CPDefinitionId, sku); if (cpInstance == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("CPDefinitionId="); msg.append(CPDefinitionId); msg.append(", sku="); msg.append(sku); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPInstanceException(msg.toString()); } return cpInstance; }
[ "@", "Override", "public", "CPInstance", "findByC_S", "(", "long", "CPDefinitionId", ",", "String", "sku", ")", "throws", "NoSuchCPInstanceException", "{", "CPInstance", "cpInstance", "=", "fetchByC_S", "(", "CPDefinitionId", ",", "sku", ")", ";", "if", "(", "cp...
Returns the cp instance where CPDefinitionId = &#63; and sku = &#63; or throws a {@link NoSuchCPInstanceException} if it could not be found. @param CPDefinitionId the cp definition ID @param sku the sku @return the matching cp instance @throws NoSuchCPInstanceException if a matching cp instance could not be found
[ "Returns", "the", "cp", "instance", "where", "CPDefinitionId", "=", "&#63", ";", "and", "sku", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPInstanceException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L4334-L4360
UrielCh/ovh-java-sdk
ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java
ApiOvhMsServices.serviceName_account_userPrincipalName_mfa_disable_POST
public OvhTask serviceName_account_userPrincipalName_mfa_disable_POST(String serviceName, String userPrincipalName, Long period) throws IOException { String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/mfa/disable"; StringBuilder sb = path(qPath, serviceName, userPrincipalName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "period", period); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_account_userPrincipalName_mfa_disable_POST(String serviceName, String userPrincipalName, Long period) throws IOException { String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/mfa/disable"; StringBuilder sb = path(qPath, serviceName, userPrincipalName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "period", period); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_account_userPrincipalName_mfa_disable_POST", "(", "String", "serviceName", ",", "String", "userPrincipalName", ",", "Long", "period", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/msServices/{serviceName}/account/{userPrincipal...
Disable Multi Factor Authentication for a period of time REST: POST /msServices/{serviceName}/account/{userPrincipalName}/mfa/disable @param period [required] Multi Factor Authentication disable period in hours @param serviceName [required] The internal name of your Active Directory organization @param userPrincipalName [required] User Principal Name API beta
[ "Disable", "Multi", "Factor", "Authentication", "for", "a", "period", "of", "time" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java#L304-L311
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java
EbeanQueryChannelService.createQuery
@Override public <T> Query<T> createQuery(Class<T> entityType, Object queryObject) { Assert.notNull(entityType, "entityType must not null"); Assert.notNull(queryObject, "queryObject must not null"); return query(entityType, queryObject); }
java
@Override public <T> Query<T> createQuery(Class<T> entityType, Object queryObject) { Assert.notNull(entityType, "entityType must not null"); Assert.notNull(queryObject, "queryObject must not null"); return query(entityType, queryObject); }
[ "@", "Override", "public", "<", "T", ">", "Query", "<", "T", ">", "createQuery", "(", "Class", "<", "T", ">", "entityType", ",", "Object", "queryObject", ")", "{", "Assert", ".", "notNull", "(", "entityType", ",", "\"entityType must not null\"", ")", ";", ...
Return an object relational query for finding a List, Set, Map or single entity bean. @return the Query.
[ "Return", "an", "object", "relational", "query", "for", "finding", "a", "List", "Set", "Map", "or", "single", "entity", "bean", "." ]
train
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/querychannel/EbeanQueryChannelService.java#L388-L393
actframework/actframework
src/main/java/act/ws/WebSocketConnectionManager.java
WebSocketConnectionManager.sendJsonToUser
public void sendJsonToUser(Object data, String username) { sendToUser(JSON.toJSONString(data), username); }
java
public void sendJsonToUser(Object data, String username) { sendToUser(JSON.toJSONString(data), username); }
[ "public", "void", "sendJsonToUser", "(", "Object", "data", ",", "String", "username", ")", "{", "sendToUser", "(", "JSON", ".", "toJSONString", "(", "data", ")", ",", "username", ")", ";", "}" ]
Send JSON representation of given data object to all connections of a user @param data the data object @param username the username
[ "Send", "JSON", "representation", "of", "given", "data", "object", "to", "all", "connections", "of", "a", "user" ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketConnectionManager.java#L210-L212
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UPropertyAliases.java
UPropertyAliases.getPropertyValueName
public String getPropertyValueName(int property, int value, int nameChoice) { int valueMapIndex=findProperty(property); if(valueMapIndex==0) { throw new IllegalArgumentException( "Invalid property enum "+property+" (0x"+Integer.toHexString(property)+")"); } int nameGroupOffset=findPropertyValueNameGroup(valueMaps[valueMapIndex+1], value); if(nameGroupOffset==0) { throw new IllegalArgumentException( "Property "+property+" (0x"+Integer.toHexString(property)+ ") does not have named values"); } return getName(nameGroupOffset, nameChoice); }
java
public String getPropertyValueName(int property, int value, int nameChoice) { int valueMapIndex=findProperty(property); if(valueMapIndex==0) { throw new IllegalArgumentException( "Invalid property enum "+property+" (0x"+Integer.toHexString(property)+")"); } int nameGroupOffset=findPropertyValueNameGroup(valueMaps[valueMapIndex+1], value); if(nameGroupOffset==0) { throw new IllegalArgumentException( "Property "+property+" (0x"+Integer.toHexString(property)+ ") does not have named values"); } return getName(nameGroupOffset, nameChoice); }
[ "public", "String", "getPropertyValueName", "(", "int", "property", ",", "int", "value", ",", "int", "nameChoice", ")", "{", "int", "valueMapIndex", "=", "findProperty", "(", "property", ")", ";", "if", "(", "valueMapIndex", "==", "0", ")", "{", "throw", "...
Returns a value name given a property enum and a value enum. Multiple names may be available for each value; the nameChoice selects among them.
[ "Returns", "a", "value", "name", "given", "a", "property", "enum", "and", "a", "value", "enum", ".", "Multiple", "names", "may", "be", "available", "for", "each", "value", ";", "the", "nameChoice", "selects", "among", "them", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UPropertyAliases.java#L257-L270
google/identity-toolkit-java-client
src/main/java/com/google/identitytoolkit/GitkitClient.java
GitkitClient.verifyPassword
public GitkitUser verifyPassword(String email, String password, String pendingIdToken, String captchaResponse) throws GitkitClientException, GitkitServerException { try { JSONObject result = rpcHelper.verifyPassword(email, password, pendingIdToken, captchaResponse); return jsonToUser(result); } catch (JSONException e) { throw new GitkitServerException(e); } }
java
public GitkitUser verifyPassword(String email, String password, String pendingIdToken, String captchaResponse) throws GitkitClientException, GitkitServerException { try { JSONObject result = rpcHelper.verifyPassword(email, password, pendingIdToken, captchaResponse); return jsonToUser(result); } catch (JSONException e) { throw new GitkitServerException(e); } }
[ "public", "GitkitUser", "verifyPassword", "(", "String", "email", ",", "String", "password", ",", "String", "pendingIdToken", ",", "String", "captchaResponse", ")", "throws", "GitkitClientException", ",", "GitkitServerException", "{", "try", "{", "JSONObject", "result...
Verifies the user entered password at Gitkit server. @param email The email of the user @param password The password inputed by the user @param pendingIdToken The GITKit token for the non-trusted IDP, which is to be confirmed by the user @param captchaResponse Response to the captcha @return Gitkit user if password is valid. @throws GitkitClientException for invalid request @throws GitkitServerException for server error
[ "Verifies", "the", "user", "entered", "password", "at", "Gitkit", "server", "." ]
train
https://github.com/google/identity-toolkit-java-client/blob/61dda1aabbd541ad5e431e840fd266bfca5f8a4a/src/main/java/com/google/identitytoolkit/GitkitClient.java#L231-L239
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipAssert.java
SipAssert.assertRequestNotReceived
public static void assertRequestNotReceived(String msg, String method, MessageListener obj) { assertNotNull("Null assert object passed in", obj); assertFalse(msg, requestReceived(method, obj)); }
java
public static void assertRequestNotReceived(String msg, String method, MessageListener obj) { assertNotNull("Null assert object passed in", obj); assertFalse(msg, requestReceived(method, obj)); }
[ "public", "static", "void", "assertRequestNotReceived", "(", "String", "msg", ",", "String", "method", ",", "MessageListener", "obj", ")", "{", "assertNotNull", "(", "\"Null assert object passed in\"", ",", "obj", ")", ";", "assertFalse", "(", "msg", ",", "request...
Asserts that the given message listener object has not received a request with the indicated request method. Assertion failure output includes the given message text. @param msg message text to output if the assertion fails. @param method The request method to verify absent (eg, SipRequest.BYE) @param obj The MessageListener object (ie, SipCall, Subscription, etc.).
[ "Asserts", "that", "the", "given", "message", "listener", "object", "has", "not", "received", "a", "request", "with", "the", "indicated", "request", "method", ".", "Assertion", "failure", "output", "includes", "the", "given", "message", "text", "." ]
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L519-L522
killme2008/xmemcached
src/main/java/com/google/code/yanf4j/buffer/IoBuffer.java
IoBuffer.allocate
public static IoBuffer allocate(int capacity, boolean direct) { if (capacity < 0) { throw new IllegalArgumentException("capacity: " + capacity); } return allocator.allocate(capacity, direct); }
java
public static IoBuffer allocate(int capacity, boolean direct) { if (capacity < 0) { throw new IllegalArgumentException("capacity: " + capacity); } return allocator.allocate(capacity, direct); }
[ "public", "static", "IoBuffer", "allocate", "(", "int", "capacity", ",", "boolean", "direct", ")", "{", "if", "(", "capacity", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"capacity: \"", "+", "capacity", ")", ";", "}", "return", ...
Returns the buffer which is capable of the specified size. @param capacity the capacity of the buffer @param direct <tt>true</tt> to get a direct buffer, <tt>false</tt> to get a heap buffer.
[ "Returns", "the", "buffer", "which", "is", "capable", "of", "the", "specified", "size", "." ]
train
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/com/google/code/yanf4j/buffer/IoBuffer.java#L201-L207
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/jdbc/cloud/storage/StageInfo.java
StageInfo.createStageInfo
public static StageInfo createStageInfo(String locationType, String location, Map credentials, String region, String endPoint, String storageAccount) throws IllegalArgumentException { StageType stageType; // Ensure that all the required parameters are specified switch (locationType) { case "AZURE": stageType = StageType.AZURE; if (!isSpecified(location) || !isSpecified(endPoint) || !isSpecified(storageAccount) || credentials == null) { throw new IllegalArgumentException("Incomplete parameters specified for Azure stage"); } break; case "S3": stageType = StageType.S3; if (!isSpecified(location) || !isSpecified(region) || credentials == null) { throw new IllegalArgumentException("Incomplete parameters specified for S3 stage"); } break; case "LOCAL_FS": stageType = StageType.LOCAL_FS; if (!isSpecified(location)) { throw new IllegalArgumentException("Incomplete parameters specific for local stage"); } break; default: throw new IllegalArgumentException("Invalid stage type: " + locationType); } return new StageInfo(stageType, location, credentials, region, endPoint, storageAccount); }
java
public static StageInfo createStageInfo(String locationType, String location, Map credentials, String region, String endPoint, String storageAccount) throws IllegalArgumentException { StageType stageType; // Ensure that all the required parameters are specified switch (locationType) { case "AZURE": stageType = StageType.AZURE; if (!isSpecified(location) || !isSpecified(endPoint) || !isSpecified(storageAccount) || credentials == null) { throw new IllegalArgumentException("Incomplete parameters specified for Azure stage"); } break; case "S3": stageType = StageType.S3; if (!isSpecified(location) || !isSpecified(region) || credentials == null) { throw new IllegalArgumentException("Incomplete parameters specified for S3 stage"); } break; case "LOCAL_FS": stageType = StageType.LOCAL_FS; if (!isSpecified(location)) { throw new IllegalArgumentException("Incomplete parameters specific for local stage"); } break; default: throw new IllegalArgumentException("Invalid stage type: " + locationType); } return new StageInfo(stageType, location, credentials, region, endPoint, storageAccount); }
[ "public", "static", "StageInfo", "createStageInfo", "(", "String", "locationType", ",", "String", "location", ",", "Map", "credentials", ",", "String", "region", ",", "String", "endPoint", ",", "String", "storageAccount", ")", "throws", "IllegalArgumentException", "...
/* Creates a StageInfo object Validates that the necessary Stage info arguments are specified @param locationType the type of stage, i.e. AZURE/S3 @param location The container/bucket @param credentials Map of cloud provider credentials @param region The geographic region where the stage is located (S3 only) @param endPoint The Azure Storage end point (Azure only) @param storageAccount The Azure Storage account (azure only) @throws IllegalArgumentException one or more parameters required were missing
[ "/", "*", "Creates", "a", "StageInfo", "object", "Validates", "that", "the", "necessary", "Stage", "info", "arguments", "are", "specified" ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StageInfo.java#L38-L75
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java
BoxApiFile.getAddTaggedCommentRequest
public BoxRequestsFile.AddTaggedCommentToFile getAddTaggedCommentRequest(String fileId, String taggedMessage) { BoxRequestsFile.AddTaggedCommentToFile request = new BoxRequestsFile.AddTaggedCommentToFile( fileId, taggedMessage, getCommentUrl(), mSession); return request; }
java
public BoxRequestsFile.AddTaggedCommentToFile getAddTaggedCommentRequest(String fileId, String taggedMessage) { BoxRequestsFile.AddTaggedCommentToFile request = new BoxRequestsFile.AddTaggedCommentToFile( fileId, taggedMessage, getCommentUrl(), mSession); return request; }
[ "public", "BoxRequestsFile", ".", "AddTaggedCommentToFile", "getAddTaggedCommentRequest", "(", "String", "fileId", ",", "String", "taggedMessage", ")", "{", "BoxRequestsFile", ".", "AddTaggedCommentToFile", "request", "=", "new", "BoxRequestsFile", ".", "AddTaggedCommentToF...
Gets a request for adding a comment with tags that mention users. The server will notify mentioned users of the comment. Tagged users must be collaborators of the parent folder. Format for adding a tag @[userid:username], E.g. "Hello @[12345:Jane Doe]" will create a comment 'Hello Jane Doe', and notify Jane that she has been mentioned. @param fileId id of the file to add the comment to @param taggedMessage message for the comment that will be added @return request to add a comment to a file
[ "Gets", "a", "request", "for", "adding", "a", "comment", "with", "tags", "that", "mention", "users", ".", "The", "server", "will", "notify", "mentioned", "users", "of", "the", "comment", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L299-L303
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.getCRC
private static long getCRC(InputStream is) throws IOException { CheckedInputStream check = new CheckedInputStream(is, new CRC32()); BufferedInputStream in = new BufferedInputStream(check); while (in.read() != -1) { // Read file in completely } long crc = check.getChecksum().getValue(); return crc; }
java
private static long getCRC(InputStream is) throws IOException { CheckedInputStream check = new CheckedInputStream(is, new CRC32()); BufferedInputStream in = new BufferedInputStream(check); while (in.read() != -1) { // Read file in completely } long crc = check.getChecksum().getValue(); return crc; }
[ "private", "static", "long", "getCRC", "(", "InputStream", "is", ")", "throws", "IOException", "{", "CheckedInputStream", "check", "=", "new", "CheckedInputStream", "(", "is", ",", "new", "CRC32", "(", ")", ")", ";", "BufferedInputStream", "in", "=", "new", ...
Get the CRC of a file from an InputStream @param is The input stream to obtain the CRC from @return a long representing the CRC value of the data read from the supplied input stream @throws IOException
[ "Get", "the", "CRC", "of", "a", "file", "from", "an", "InputStream" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L1548-L1556
EsupPortail/esup-smsu-api
src/main/java/org/esupportail/smsuapi/services/sms/ackmanagement/AckManagerBusiness.java
AckManagerBusiness.putPhoneNumberInBlackList
private void putPhoneNumberInBlackList(final String phoneNumber, final Application application ) { // if phone number is not already in the bl (it should not append) put the phone number // put the phone number in the black list if (daoService.isPhoneNumberInBlackList(phoneNumber)) return; logger.debug("Adding to black list : \n" + " - Phone number : " + phoneNumber + "\n" + " - Application id : " + application.getId() + "\n"); final Date currentDate = new Date(System.currentTimeMillis()); daoService.addBlacklist(new Blacklist(application, currentDate, phoneNumber)); }
java
private void putPhoneNumberInBlackList(final String phoneNumber, final Application application ) { // if phone number is not already in the bl (it should not append) put the phone number // put the phone number in the black list if (daoService.isPhoneNumberInBlackList(phoneNumber)) return; logger.debug("Adding to black list : \n" + " - Phone number : " + phoneNumber + "\n" + " - Application id : " + application.getId() + "\n"); final Date currentDate = new Date(System.currentTimeMillis()); daoService.addBlacklist(new Blacklist(application, currentDate, phoneNumber)); }
[ "private", "void", "putPhoneNumberInBlackList", "(", "final", "String", "phoneNumber", ",", "final", "Application", "application", ")", "{", "// if phone number is not already in the bl (it should not append) put the phone number\r", "// put the phone number in the black list\r", "if",...
Put a number in black list. @param phoneNumber @param application
[ "Put", "a", "number", "in", "black", "list", "." ]
train
https://github.com/EsupPortail/esup-smsu-api/blob/7b6a4388065adfd84655dbc83f37080874953b20/src/main/java/org/esupportail/smsuapi/services/sms/ackmanagement/AckManagerBusiness.java#L69-L79
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ListUtil.java
ListUtil.listToArrayRemoveEmpty
public static Array listToArrayRemoveEmpty(String list, char delimiter) { int len = list.length(); ArrayImpl array = new ArrayImpl(); if (len == 0) return array; int last = 0; for (int i = 0; i < len; i++) { if (list.charAt(i) == delimiter) { if (last < i) array.appendEL(list.substring(last, i)); last = i + 1; } } if (last < len) array.appendEL(list.substring(last)); return array; }
java
public static Array listToArrayRemoveEmpty(String list, char delimiter) { int len = list.length(); ArrayImpl array = new ArrayImpl(); if (len == 0) return array; int last = 0; for (int i = 0; i < len; i++) { if (list.charAt(i) == delimiter) { if (last < i) array.appendEL(list.substring(last, i)); last = i + 1; } } if (last < len) array.appendEL(list.substring(last)); return array; }
[ "public", "static", "Array", "listToArrayRemoveEmpty", "(", "String", "list", ",", "char", "delimiter", ")", "{", "int", "len", "=", "list", ".", "length", "(", ")", ";", "ArrayImpl", "array", "=", "new", "ArrayImpl", "(", ")", ";", "if", "(", "len", "...
casts a list to Array object remove Empty Elements @param list list to cast @param delimiter delimter of the list @return Array Object
[ "casts", "a", "list", "to", "Array", "object", "remove", "Empty", "Elements" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ListUtil.java#L247-L262
jdereg/java-util
src/main/java/com/cedarsoftware/util/UrlUtilities.java
UrlUtilities.getContentFromUrl
@Deprecated public static byte[] getContentFromUrl(URL url, Map inCookies, Map outCookies, Proxy proxy, boolean allowAllCerts) { return getContentFromUrl(url, inCookies, outCookies, allowAllCerts); }
java
@Deprecated public static byte[] getContentFromUrl(URL url, Map inCookies, Map outCookies, Proxy proxy, boolean allowAllCerts) { return getContentFromUrl(url, inCookies, outCookies, allowAllCerts); }
[ "@", "Deprecated", "public", "static", "byte", "[", "]", "getContentFromUrl", "(", "URL", "url", ",", "Map", "inCookies", ",", "Map", "outCookies", ",", "Proxy", "proxy", ",", "boolean", "allowAllCerts", ")", "{", "return", "getContentFromUrl", "(", "url", "...
Get content from the passed in URL. This code will open a connection to the passed in server, fetch the requested content, and return it as a byte[]. Anyone using the proxy calls such as this one should have that managed by the jvm with -D parameters: http.proxyHost http.proxyPort (default: 80) http.nonProxyHosts (should always include localhost) https.proxyHost https.proxyPort Example: -Dhttp.proxyHost=proxy.example.org -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy.example.org -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=*.foo.com|localhost|*.td.afg @param url URL to hit @param inCookies Map of session cookies (or null if not needed) @param outCookies Map of session cookies (or null if not needed) @param proxy Proxy server to create connection (or null if not needed) @return byte[] of content fetched from URL. @deprecated As of release 1.13.0, replaced by {@link #getContentFromUrl(String, java.util.Map, java.util.Map, boolean)}
[ "Get", "content", "from", "the", "passed", "in", "URL", ".", "This", "code", "will", "open", "a", "connection", "to", "the", "passed", "in", "server", "fetch", "the", "requested", "content", "and", "return", "it", "as", "a", "byte", "[]", "." ]
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/UrlUtilities.java#L860-L864
andriusvelykis/reflow-maven-skin
reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java
HtmlTool.addClass
public String addClass(String content, String selector, List<String> classNames, int amount) { Element body = parseContent(content); List<Element> elements = body.select(selector); if (amount >= 0) { // limit to the indicated amount elements = elements.subList(0, Math.min(amount, elements.size())); } if (elements.size() > 0) { for (Element element : elements) { for (String className : classNames) { element.addClass(className); } } return body.html(); } else { // nothing to update return content; } }
java
public String addClass(String content, String selector, List<String> classNames, int amount) { Element body = parseContent(content); List<Element> elements = body.select(selector); if (amount >= 0) { // limit to the indicated amount elements = elements.subList(0, Math.min(amount, elements.size())); } if (elements.size() > 0) { for (Element element : elements) { for (String className : classNames) { element.addClass(className); } } return body.html(); } else { // nothing to update return content; } }
[ "public", "String", "addClass", "(", "String", "content", ",", "String", "selector", ",", "List", "<", "String", ">", "classNames", ",", "int", "amount", ")", "{", "Element", "body", "=", "parseContent", "(", "content", ")", ";", "List", "<", "Element", ...
Adds given class names to the elements in HTML. @param content HTML content to modify @param selector CSS selector for elements to add classes to @param classNames Names of classes to add to the selected elements @param amount Maximum number of elements to modify @return HTML content with modified elements. If no elements are found, the original content is returned. @since 1.0
[ "Adds", "given", "class", "names", "to", "the", "elements", "in", "HTML", "." ]
train
https://github.com/andriusvelykis/reflow-maven-skin/blob/01170ae1426a1adfe7cc9c199e77aaa2ecb37ef2/reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java#L658-L681
spring-projects/spring-boot
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java
ResourceUtils.getUrls
public static List<String> getUrls(String path, ClassLoader classLoader) { if (classLoader == null) { classLoader = ClassUtils.getDefaultClassLoader(); } path = StringUtils.cleanPath(path); try { return getUrlsFromWildcardPath(path, classLoader); } catch (Exception ex) { throw new IllegalArgumentException( "Cannot create URL from path [" + path + "]", ex); } }
java
public static List<String> getUrls(String path, ClassLoader classLoader) { if (classLoader == null) { classLoader = ClassUtils.getDefaultClassLoader(); } path = StringUtils.cleanPath(path); try { return getUrlsFromWildcardPath(path, classLoader); } catch (Exception ex) { throw new IllegalArgumentException( "Cannot create URL from path [" + path + "]", ex); } }
[ "public", "static", "List", "<", "String", ">", "getUrls", "(", "String", "path", ",", "ClassLoader", "classLoader", ")", "{", "if", "(", "classLoader", "==", "null", ")", "{", "classLoader", "=", "ClassUtils", ".", "getDefaultClassLoader", "(", ")", ";", ...
Return URLs from a given source path. Source paths can be simple file locations (/some/file.java) or wildcard patterns (/some/**). Additionally the prefixes "file:", "classpath:" and "classpath*:" can be used for specific path types. @param path the source path @param classLoader the class loader or {@code null} to use the default @return a list of URLs
[ "Return", "URLs", "from", "a", "given", "source", "path", ".", "Source", "paths", "can", "be", "simple", "file", "locations", "(", "/", "some", "/", "file", ".", "java", ")", "or", "wildcard", "patterns", "(", "/", "some", "/", "**", ")", ".", "Addit...
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java#L68-L80
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java
BeetlUtil.render
public static String render(String path, String templateFileName, Map<String, Object> bindingMap) { if (FileUtil.isAbsolutePath(path)) { return render(getFileTemplate(path, templateFileName), bindingMap); } else { return render(getClassPathTemplate(path, templateFileName), bindingMap); } }
java
public static String render(String path, String templateFileName, Map<String, Object> bindingMap) { if (FileUtil.isAbsolutePath(path)) { return render(getFileTemplate(path, templateFileName), bindingMap); } else { return render(getClassPathTemplate(path, templateFileName), bindingMap); } }
[ "public", "static", "String", "render", "(", "String", "path", ",", "String", "templateFileName", ",", "Map", "<", "String", ",", "Object", ">", "bindingMap", ")", "{", "if", "(", "FileUtil", ".", "isAbsolutePath", "(", "path", ")", ")", "{", "return", "...
渲染模板,如果为相对路径,则渲染ClassPath模板,否则渲染本地文件模板 @param path 路径 @param templateFileName 模板文件名 @param bindingMap 绑定参数 @return 渲染后的内容 @since 3.2.0
[ "渲染模板,如果为相对路径,则渲染ClassPath模板,否则渲染本地文件模板" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java#L195-L201
samskivert/samskivert
src/main/java/com/samskivert/util/ListUtil.java
ListUtil.clearRef
public static Object clearRef (Object[] list, Object element) { return clear(REFERENCE_COMP, list, element); }
java
public static Object clearRef (Object[] list, Object element) { return clear(REFERENCE_COMP, list, element); }
[ "public", "static", "Object", "clearRef", "(", "Object", "[", "]", "list", ",", "Object", "element", ")", "{", "return", "clear", "(", "REFERENCE_COMP", ",", "list", ",", "element", ")", ";", "}" ]
Clears out the first element that is referentially equal to the supplied element (<code>list[idx] == element</code>). @return the element that was removed or null if it was not found.
[ "Clears", "out", "the", "first", "element", "that", "is", "referentially", "equal", "to", "the", "supplied", "element", "(", "<code", ">", "list", "[", "idx", "]", "==", "element<", "/", "code", ">", ")", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ListUtil.java#L329-L332
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/recognition/ExampleColorHistogramLookup.java
ExampleColorHistogramLookup.coupledHueSat
public static List<double[]> coupledHueSat( List<String> images ) { List<double[]> points = new ArrayList<>(); Planar<GrayF32> rgb = new Planar<>(GrayF32.class,1,1,3); Planar<GrayF32> hsv = new Planar<>(GrayF32.class,1,1,3); for( String path : images ) { BufferedImage buffered = UtilImageIO.loadImage(path); if( buffered == null ) throw new RuntimeException("Can't load image!"); rgb.reshape(buffered.getWidth(), buffered.getHeight()); hsv.reshape(buffered.getWidth(), buffered.getHeight()); ConvertBufferedImage.convertFrom(buffered, rgb, true); ColorHsv.rgbToHsv(rgb, hsv); Planar<GrayF32> hs = hsv.partialSpectrum(0,1); // The number of bins is an important parameter. Try adjusting it Histogram_F64 histogram = new Histogram_F64(12,12); histogram.setRange(0, 0, 2.0*Math.PI); // range of hue is from 0 to 2PI histogram.setRange(1, 0, 1.0); // range of saturation is from 0 to 1 // Compute the histogram GHistogramFeatureOps.histogram(hs,histogram); UtilFeature.normalizeL2(histogram); // normalize so that image size doesn't matter points.add(histogram.value); } return points; }
java
public static List<double[]> coupledHueSat( List<String> images ) { List<double[]> points = new ArrayList<>(); Planar<GrayF32> rgb = new Planar<>(GrayF32.class,1,1,3); Planar<GrayF32> hsv = new Planar<>(GrayF32.class,1,1,3); for( String path : images ) { BufferedImage buffered = UtilImageIO.loadImage(path); if( buffered == null ) throw new RuntimeException("Can't load image!"); rgb.reshape(buffered.getWidth(), buffered.getHeight()); hsv.reshape(buffered.getWidth(), buffered.getHeight()); ConvertBufferedImage.convertFrom(buffered, rgb, true); ColorHsv.rgbToHsv(rgb, hsv); Planar<GrayF32> hs = hsv.partialSpectrum(0,1); // The number of bins is an important parameter. Try adjusting it Histogram_F64 histogram = new Histogram_F64(12,12); histogram.setRange(0, 0, 2.0*Math.PI); // range of hue is from 0 to 2PI histogram.setRange(1, 0, 1.0); // range of saturation is from 0 to 1 // Compute the histogram GHistogramFeatureOps.histogram(hs,histogram); UtilFeature.normalizeL2(histogram); // normalize so that image size doesn't matter points.add(histogram.value); } return points; }
[ "public", "static", "List", "<", "double", "[", "]", ">", "coupledHueSat", "(", "List", "<", "String", ">", "images", ")", "{", "List", "<", "double", "[", "]", ">", "points", "=", "new", "ArrayList", "<>", "(", ")", ";", "Planar", "<", "GrayF32", ...
HSV stores color information in Hue and Saturation while intensity is in Value. This computes a 2D histogram from hue and saturation only, which makes it lighting independent.
[ "HSV", "stores", "color", "information", "in", "Hue", "and", "Saturation", "while", "intensity", "is", "in", "Value", ".", "This", "computes", "a", "2D", "histogram", "from", "hue", "and", "saturation", "only", "which", "makes", "it", "lighting", "independent"...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/recognition/ExampleColorHistogramLookup.java#L70-L102
lessthanoptimal/ejml
main/ejml-simple/src/org/ejml/equation/Equation.java
Equation.createVariableInferred
private Variable createVariableInferred(TokenList.Token t0, Variable variableRight) { Variable result; if( t0.getType() == Type.WORD ) { switch( variableRight.getType()) { case MATRIX: alias(new DMatrixRMaj(1,1),t0.getWord()); break; case SCALAR: if( variableRight instanceof VariableInteger) { alias(0,t0.getWord()); } else { alias(1.0,t0.getWord()); } break; case INTEGER_SEQUENCE: alias((IntegerSequence)null,t0.getWord()); break; default: throw new RuntimeException("Type not supported for assignment: "+variableRight.getType()); } result = variables.get(t0.getWord()); } else { result = t0.getVariable(); } return result; }
java
private Variable createVariableInferred(TokenList.Token t0, Variable variableRight) { Variable result; if( t0.getType() == Type.WORD ) { switch( variableRight.getType()) { case MATRIX: alias(new DMatrixRMaj(1,1),t0.getWord()); break; case SCALAR: if( variableRight instanceof VariableInteger) { alias(0,t0.getWord()); } else { alias(1.0,t0.getWord()); } break; case INTEGER_SEQUENCE: alias((IntegerSequence)null,t0.getWord()); break; default: throw new RuntimeException("Type not supported for assignment: "+variableRight.getType()); } result = variables.get(t0.getWord()); } else { result = t0.getVariable(); } return result; }
[ "private", "Variable", "createVariableInferred", "(", "TokenList", ".", "Token", "t0", ",", "Variable", "variableRight", ")", "{", "Variable", "result", ";", "if", "(", "t0", ".", "getType", "(", ")", "==", "Type", ".", "WORD", ")", "{", "switch", "(", "...
Infer the type of and create a new output variable using the results from the right side of the equation. If the type is already known just return that.
[ "Infer", "the", "type", "of", "and", "create", "a", "new", "output", "variable", "using", "the", "results", "from", "the", "right", "side", "of", "the", "equation", ".", "If", "the", "type", "is", "already", "known", "just", "return", "that", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L584-L614
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/Section.java
Section.renderAttribute
private void renderAttribute(InternalStringBuilder buf, String name, String value) { assert (name != null); if (value == null) return; buf.append(" "); buf.append(name); buf.append("=\""); buf.append(value); buf.append("\""); }
java
private void renderAttribute(InternalStringBuilder buf, String name, String value) { assert (name != null); if (value == null) return; buf.append(" "); buf.append(name); buf.append("=\""); buf.append(value); buf.append("\""); }
[ "private", "void", "renderAttribute", "(", "InternalStringBuilder", "buf", ",", "String", "name", ",", "String", "value", ")", "{", "assert", "(", "name", "!=", "null", ")", ";", "if", "(", "value", "==", "null", ")", "return", ";", "buf", ".", "append",...
This method will write append an attribute value to a InternalStringBuilder. The method assumes that the attr is not <code>null</code>. If the value is <code>null</code> the attribute will not be appended to the <code>InternalStringBuilder</code>.
[ "This", "method", "will", "write", "append", "an", "attribute", "value", "to", "a", "InternalStringBuilder", ".", "The", "method", "assumes", "that", "the", "attr", "is", "not", "<code", ">", "null<", "/", "code", ">", ".", "If", "the", "value", "is", "<...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/Section.java#L352-L363
dadoonet/elasticsearch-beyonder
src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java
TemplateElasticsearchUpdater.removeTemplate
public static void removeTemplate(RestClient client, String template) throws Exception { logger.trace("removeTemplate({})", template); client.performRequest(new Request("DELETE", "/_template/" + template)); logger.trace("/removeTemplate({})", template); }
java
public static void removeTemplate(RestClient client, String template) throws Exception { logger.trace("removeTemplate({})", template); client.performRequest(new Request("DELETE", "/_template/" + template)); logger.trace("/removeTemplate({})", template); }
[ "public", "static", "void", "removeTemplate", "(", "RestClient", "client", ",", "String", "template", ")", "throws", "Exception", "{", "logger", ".", "trace", "(", "\"removeTemplate({})\"", ",", "template", ")", ";", "client", ".", "performRequest", "(", "new", ...
Remove a template @param client Elasticsearch client @param template template name @throws Exception if something goes wrong
[ "Remove", "a", "template" ]
train
https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java#L241-L245
Kurento/kurento-module-creator
src/main/java/com/github/zafarkhaja/semver/VersionParser.java
VersionParser.parseVersionCore
private NormalVersion parseVersionCore() { int major = Integer.parseInt(numericIdentifier()); consumeNextCharacter(CharType.DOT); int minor = Integer.parseInt(numericIdentifier()); consumeNextCharacter(CharType.DOT); int patch = Integer.parseInt(numericIdentifier()); return new NormalVersion(major, minor, patch); }
java
private NormalVersion parseVersionCore() { int major = Integer.parseInt(numericIdentifier()); consumeNextCharacter(CharType.DOT); int minor = Integer.parseInt(numericIdentifier()); consumeNextCharacter(CharType.DOT); int patch = Integer.parseInt(numericIdentifier()); return new NormalVersion(major, minor, patch); }
[ "private", "NormalVersion", "parseVersionCore", "(", ")", "{", "int", "major", "=", "Integer", ".", "parseInt", "(", "numericIdentifier", "(", ")", ")", ";", "consumeNextCharacter", "(", "CharType", ".", "DOT", ")", ";", "int", "minor", "=", "Integer", ".", ...
Parses the {@literal <version core>} non-terminal. <pre> {@literal <version core> ::= <major> "." <minor> "." <patch> } </pre> @return a valid normal version object
[ "Parses", "the", "{", "@literal", "<version", "core", ">", "}", "non", "-", "terminal", "." ]
train
https://github.com/Kurento/kurento-module-creator/blob/c371516c665b902b5476433496a5aefcbca86d64/src/main/java/com/github/zafarkhaja/semver/VersionParser.java#L269-L276
duracloud/duracloud
durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java
SpaceRest.getSpace
@Path("/{spaceID}") @GET @Produces(XML) public Response getSpace(@PathParam("spaceID") String spaceID, @QueryParam("storeID") String storeID, @QueryParam("prefix") String prefix, @QueryParam("maxResults") long maxResults, @QueryParam("marker") String marker) { StringBuilder msg = new StringBuilder("getting space contents("); msg.append(spaceID); msg.append(", "); msg.append(storeID); msg.append(", "); msg.append(prefix); msg.append(", "); msg.append(maxResults); msg.append(", "); msg.append(marker); msg.append(")"); try { log.debug(msg.toString()); return doGetSpace(spaceID, storeID, prefix, maxResults, marker); } catch (ResourceNotFoundException e) { return responseNotFound(msg.toString(), e, NOT_FOUND); } catch (ResourceException e) { return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR); } catch (Exception e) { return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR); } }
java
@Path("/{spaceID}") @GET @Produces(XML) public Response getSpace(@PathParam("spaceID") String spaceID, @QueryParam("storeID") String storeID, @QueryParam("prefix") String prefix, @QueryParam("maxResults") long maxResults, @QueryParam("marker") String marker) { StringBuilder msg = new StringBuilder("getting space contents("); msg.append(spaceID); msg.append(", "); msg.append(storeID); msg.append(", "); msg.append(prefix); msg.append(", "); msg.append(maxResults); msg.append(", "); msg.append(marker); msg.append(")"); try { log.debug(msg.toString()); return doGetSpace(spaceID, storeID, prefix, maxResults, marker); } catch (ResourceNotFoundException e) { return responseNotFound(msg.toString(), e, NOT_FOUND); } catch (ResourceException e) { return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR); } catch (Exception e) { return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR); } }
[ "@", "Path", "(", "\"/{spaceID}\"", ")", "@", "GET", "@", "Produces", "(", "XML", ")", "public", "Response", "getSpace", "(", "@", "PathParam", "(", "\"spaceID\"", ")", "String", "spaceID", ",", "@", "QueryParam", "(", "\"storeID\"", ")", "String", "storeI...
see SpaceResource.getSpaceProperties(String, String); see SpaceResource.getSpaceContents(String, String); @return 200 response with XML listing of space content and space properties included as header values
[ "see", "SpaceResource", ".", "getSpaceProperties", "(", "String", "String", ")", ";", "see", "SpaceResource", ".", "getSpaceContents", "(", "String", "String", ")", ";" ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java#L92-L125
amzn/ion-java
src/com/amazon/ion/Timestamp.java
Timestamp.forMinute
public static Timestamp forMinute(int year, int month, int day, int hour, int minute, Integer offset) { return new Timestamp(year, month, day, hour, minute, offset); }
java
public static Timestamp forMinute(int year, int month, int day, int hour, int minute, Integer offset) { return new Timestamp(year, month, day, hour, minute, offset); }
[ "public", "static", "Timestamp", "forMinute", "(", "int", "year", ",", "int", "month", ",", "int", "day", ",", "int", "hour", ",", "int", "minute", ",", "Integer", "offset", ")", "{", "return", "new", "Timestamp", "(", "year", ",", "month", ",", "day",...
Returns a Timestamp, precise to the minute, with a given local offset. <p> This is equivalent to the corresponding Ion value {@code YYYY-MM-DDThh:mm+-oo:oo}, where {@code oo:oo} represents the hour and minutes of the local offset from UTC. @param offset the local offset from UTC, measured in minutes; may be {@code null} to represent an unknown local offset
[ "Returns", "a", "Timestamp", "precise", "to", "the", "minute", "with", "a", "given", "local", "offset", ".", "<p", ">", "This", "is", "equivalent", "to", "the", "corresponding", "Ion", "value", "{", "@code", "YYYY", "-", "MM", "-", "DDThh", ":", "mm", ...
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L1268-L1273
WolfgangFahl/Mediawiki-Japi
src/main/java/com/bitplan/mediawiki/japi/Mediawiki.java
Mediawiki.getPages
public List<Page> getPages(List<String> titleList) throws Exception { String rvprop = "content|ids|timestamp"; List<Page> result = this.getPages(titleList, rvprop); return result; }
java
public List<Page> getPages(List<String> titleList) throws Exception { String rvprop = "content|ids|timestamp"; List<Page> result = this.getPages(titleList, rvprop); return result; }
[ "public", "List", "<", "Page", ">", "getPages", "(", "List", "<", "String", ">", "titleList", ")", "throws", "Exception", "{", "String", "rvprop", "=", "\"content|ids|timestamp\"", ";", "List", "<", "Page", ">", "result", "=", "this", ".", "getPages", "(",...
get a list of pages for the given titles see <a href='http://www.mediawiki.org/wiki/API:Query'>API:Query</a> @param titleList @return @throws Exception
[ "get", "a", "list", "of", "pages", "for", "the", "given", "titles", "see", "<a", "href", "=", "http", ":", "//", "www", ".", "mediawiki", ".", "org", "/", "wiki", "/", "API", ":", "Query", ">", "API", ":", "Query<", "/", "a", ">" ]
train
https://github.com/WolfgangFahl/Mediawiki-Japi/blob/78d0177ebfe02eb05da5550839727861f1e888a5/src/main/java/com/bitplan/mediawiki/japi/Mediawiki.java#L872-L876
liuyukuai/commons
commons-core/src/main/java/com/itxiaoer/commons/core/date/LocalDateUtil.java
LocalDateUtil.untilDays
public static List<LocalDate> untilDays(String startDate, String endDate, String pattern) { return untilDays(parse(startDate, pattern), parse(endDate, pattern)); }
java
public static List<LocalDate> untilDays(String startDate, String endDate, String pattern) { return untilDays(parse(startDate, pattern), parse(endDate, pattern)); }
[ "public", "static", "List", "<", "LocalDate", ">", "untilDays", "(", "String", "startDate", ",", "String", "endDate", ",", "String", "pattern", ")", "{", "return", "untilDays", "(", "parse", "(", "startDate", ",", "pattern", ")", ",", "parse", "(", "endDat...
计算两个时间内的日期 @param startDate 开始时间 @param endDate 结束时间 @param pattern 日期格式 @return 日期集合
[ "计算两个时间内的日期" ]
train
https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/date/LocalDateUtil.java#L142-L144
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java
CachedRemoteTable.get
public Object get(int iRowIndex, int iRowCount) throws DBException, RemoteException { return this.cacheGetMove(iRowIndex, iRowCount, iRowIndex, true); }
java
public Object get(int iRowIndex, int iRowCount) throws DBException, RemoteException { return this.cacheGetMove(iRowIndex, iRowCount, iRowIndex, true); }
[ "public", "Object", "get", "(", "int", "iRowIndex", ",", "int", "iRowCount", ")", "throws", "DBException", ",", "RemoteException", "{", "return", "this", ".", "cacheGetMove", "(", "iRowIndex", ",", "iRowCount", ",", "iRowIndex", ",", "true", ")", ";", "}" ]
Receive this relative record in the table. <p>Note: This is usually used only by thin clients, as thick clients have the code to fake absolute access. @param iRowIndex The row to retrieve. @param iRowCount The number of rows to retrieve (Used only by EjbCachedTable). @return The record(s) or an error code as an Integer. @exception Exception File exception.
[ "Receive", "this", "relative", "record", "in", "the", "table", ".", "<p", ">", "Note", ":", "This", "is", "usually", "used", "only", "by", "thin", "clients", "as", "thick", "clients", "have", "the", "code", "to", "fake", "absolute", "access", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java#L511-L514
zafarkhaja/jsemver
src/main/java/com/github/zafarkhaja/semver/MetadataVersion.java
MetadataVersion.compareIdentifiers
private int compareIdentifiers(String ident1, String ident2) { if (isInt(ident1) && isInt(ident2)) { return Integer.parseInt(ident1) - Integer.parseInt(ident2); } else { return ident1.compareTo(ident2); } }
java
private int compareIdentifiers(String ident1, String ident2) { if (isInt(ident1) && isInt(ident2)) { return Integer.parseInt(ident1) - Integer.parseInt(ident2); } else { return ident1.compareTo(ident2); } }
[ "private", "int", "compareIdentifiers", "(", "String", "ident1", ",", "String", "ident2", ")", "{", "if", "(", "isInt", "(", "ident1", ")", "&&", "isInt", "(", "ident2", ")", ")", "{", "return", "Integer", ".", "parseInt", "(", "ident1", ")", "-", "Int...
Compares two identifiers. @param ident1 the first identifier @param ident2 the second identifier @return integer result of comparison compatible with the {@code Comparable.compareTo} method
[ "Compares", "two", "identifiers", "." ]
train
https://github.com/zafarkhaja/jsemver/blob/1f4996ea3dab06193c378fd66fd4f8fdc8334cc6/src/main/java/com/github/zafarkhaja/semver/MetadataVersion.java#L229-L235
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/Indexer.java
Indexer.between
public String between(int leftIndex, int rightIndex) { String result = this.target4Sub.substring(reviseL(leftIndex), reviseR(rightIndex)); return isResetMode ? result : (this.target4Sub = result); }
java
public String between(int leftIndex, int rightIndex) { String result = this.target4Sub.substring(reviseL(leftIndex), reviseR(rightIndex)); return isResetMode ? result : (this.target4Sub = result); }
[ "public", "String", "between", "(", "int", "leftIndex", ",", "int", "rightIndex", ")", "{", "String", "result", "=", "this", ".", "target4Sub", ".", "substring", "(", "reviseL", "(", "leftIndex", ")", ",", "reviseR", "(", "rightIndex", ")", ")", ";", "re...
Returns a new string that is a substring of delegate string @param leftIndex @param rightIndex @return
[ "Returns", "a", "new", "string", "that", "is", "a", "substring", "of", "delegate", "string" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Indexer.java#L30-L33
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/HillClimberWindowTinyLfuPolicy.java
HillClimberWindowTinyLfuPolicy.onMiss
private void onMiss(long key) { Node node = new Node(key, WINDOW); node.appendToTail(headWindow); data.put(key, node); windowSize++; evict(); }
java
private void onMiss(long key) { Node node = new Node(key, WINDOW); node.appendToTail(headWindow); data.put(key, node); windowSize++; evict(); }
[ "private", "void", "onMiss", "(", "long", "key", ")", "{", "Node", "node", "=", "new", "Node", "(", "key", ",", "WINDOW", ")", ";", "node", ".", "appendToTail", "(", "headWindow", ")", ";", "data", ".", "put", "(", "key", ",", "node", ")", ";", "...
Adds the entry to the admission window, evicting if necessary.
[ "Adds", "the", "entry", "to", "the", "admission", "window", "evicting", "if", "necessary", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/HillClimberWindowTinyLfuPolicy.java#L149-L155
davetcc/tcMenu
tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/controller/OSXAdapter.java
OSXAdapter.setPreferencesHandler
public static void setPreferencesHandler(Object target, Method prefsHandler) { boolean enablePrefsMenu = (target != null && prefsHandler != null); if (enablePrefsMenu) { setHandler(new OSXAdapter("handlePreferences", target, prefsHandler)); } // If we're setting a handler, enable the Preferences menu item by calling // com.apple.eawt.Application reflectively try { Method enablePrefsMethod = macOSXApplication.getClass().getDeclaredMethod("setEnabledPreferencesMenu", new Class[] { boolean.class }); enablePrefsMethod.invoke(macOSXApplication, new Object[] { Boolean.valueOf(enablePrefsMenu) }); } catch (Exception ex) { System.err.println("OSXAdapter could not access the About Menu"); ex.printStackTrace(); } }
java
public static void setPreferencesHandler(Object target, Method prefsHandler) { boolean enablePrefsMenu = (target != null && prefsHandler != null); if (enablePrefsMenu) { setHandler(new OSXAdapter("handlePreferences", target, prefsHandler)); } // If we're setting a handler, enable the Preferences menu item by calling // com.apple.eawt.Application reflectively try { Method enablePrefsMethod = macOSXApplication.getClass().getDeclaredMethod("setEnabledPreferencesMenu", new Class[] { boolean.class }); enablePrefsMethod.invoke(macOSXApplication, new Object[] { Boolean.valueOf(enablePrefsMenu) }); } catch (Exception ex) { System.err.println("OSXAdapter could not access the About Menu"); ex.printStackTrace(); } }
[ "public", "static", "void", "setPreferencesHandler", "(", "Object", "target", ",", "Method", "prefsHandler", ")", "{", "boolean", "enablePrefsMenu", "=", "(", "target", "!=", "null", "&&", "prefsHandler", "!=", "null", ")", ";", "if", "(", "enablePrefsMenu", "...
They will be called when the Preferences menu item is selected from the application menu
[ "They", "will", "be", "called", "when", "the", "Preferences", "menu", "item", "is", "selected", "from", "the", "application", "menu" ]
train
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/controller/OSXAdapter.java#L109-L123
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hoiio/HoiioFaxClientSpi.java
HoiioFaxClientSpi.updateHTTPResponseHandlerConfiguration
@Override protected void updateHTTPResponseHandlerConfiguration(Map<String,String> configuration) { //get property part String propertyPart=this.getPropertyPart(); //modify configuration configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.SUBMIT_JSON_OUTPUT_PROPERTY_KEY.toString(),propertyPart),"txn_ref"); configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.ERROR_DETECTION_PATH_PROPERTY_KEY.toString(),propertyPart),"status"); configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.ERROR_DETECTION_VALUE_PROPERTY_KEY.toString(),propertyPart),"error_"); configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.GET_STATUS_JSON_OUTPUT_PROPERTY_KEY.toString(),propertyPart),"fax_status"); configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.IN_PROGRESS_STATUS_MAPPING_PROPERTY_KEY.toString(),propertyPart),"ongoing"); configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.ERROR_STATUS_MAPPING_PROPERTY_KEY.toString(),propertyPart),"unanswered;failed;busy"); }
java
@Override protected void updateHTTPResponseHandlerConfiguration(Map<String,String> configuration) { //get property part String propertyPart=this.getPropertyPart(); //modify configuration configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.SUBMIT_JSON_OUTPUT_PROPERTY_KEY.toString(),propertyPart),"txn_ref"); configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.ERROR_DETECTION_PATH_PROPERTY_KEY.toString(),propertyPart),"status"); configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.ERROR_DETECTION_VALUE_PROPERTY_KEY.toString(),propertyPart),"error_"); configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.GET_STATUS_JSON_OUTPUT_PROPERTY_KEY.toString(),propertyPart),"fax_status"); configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.IN_PROGRESS_STATUS_MAPPING_PROPERTY_KEY.toString(),propertyPart),"ongoing"); configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.ERROR_STATUS_MAPPING_PROPERTY_KEY.toString(),propertyPart),"unanswered;failed;busy"); }
[ "@", "Override", "protected", "void", "updateHTTPResponseHandlerConfiguration", "(", "Map", "<", "String", ",", "String", ">", "configuration", ")", "{", "//get property part", "String", "propertyPart", "=", "this", ".", "getPropertyPart", "(", ")", ";", "//modify c...
Hook for extending classes. @param configuration The response handler configuration
[ "Hook", "for", "extending", "classes", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hoiio/HoiioFaxClientSpi.java#L202-L215
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RemoteResultCollector.java
RemoteResultCollector.getLogLists
public RemoteAllResults getLogLists(LogQueryBean logQueryBean, RepositoryPointer after) throws LogRepositoryException { RemoteAllResults result = new RemoteAllResults(logQueryBean); Iterable<ServerInstanceLogRecordList> lists; if (after == null) { lists = logReader.getLogLists(logQueryBean); } else { lists = logReader.getLogLists(after, logQueryBean); } for (ServerInstanceLogRecordList instance: lists) { result.addInstance(instance.getStartTime()); } return result; }
java
public RemoteAllResults getLogLists(LogQueryBean logQueryBean, RepositoryPointer after) throws LogRepositoryException { RemoteAllResults result = new RemoteAllResults(logQueryBean); Iterable<ServerInstanceLogRecordList> lists; if (after == null) { lists = logReader.getLogLists(logQueryBean); } else { lists = logReader.getLogLists(after, logQueryBean); } for (ServerInstanceLogRecordList instance: lists) { result.addInstance(instance.getStartTime()); } return result; }
[ "public", "RemoteAllResults", "getLogLists", "(", "LogQueryBean", "logQueryBean", ",", "RepositoryPointer", "after", ")", "throws", "LogRepositoryException", "{", "RemoteAllResults", "result", "=", "new", "RemoteAllResults", "(", "logQueryBean", ")", ";", "Iterable", "<...
retrieves results for all server instances in the repository. @param logQueryBean query indicator @param after starting location of instances to be return. @return Set of all server instances satisfying the query request. @throws LogRepositoryException indicating that an error occurred while reading list of instances from the server.
[ "retrieves", "results", "for", "all", "server", "instances", "in", "the", "repository", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RemoteResultCollector.java#L45-L57
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java
Agg.denseRank
public static <T> Collector<T, ?, Optional<Long>> denseRank(T value, Comparator<? super T> comparator) { return denseRankBy(value, t -> t, comparator); }
java
public static <T> Collector<T, ?, Optional<Long>> denseRank(T value, Comparator<? super T> comparator) { return denseRankBy(value, t -> t, comparator); }
[ "public", "static", "<", "T", ">", "Collector", "<", "T", ",", "?", ",", "Optional", "<", "Long", ">", ">", "denseRank", "(", "T", "value", ",", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "return", "denseRankBy", "(", "value",...
Get a {@link Collector} that calculates the <code>DENSE_RANK()</code> function given a specific ordering.
[ "Get", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L706-L708
LearnLib/automatalib
incremental/src/main/java/net/automatalib/incremental/dfa/dag/IncrementalPCDFADAGBuilder.java
IncrementalPCDFADAGBuilder.createSuffix
private State createSuffix(Word<? extends I> suffix, boolean accepting) { State last; Acceptance intermediate; if (!accepting) { if (sink == null) { sink = new State(null); } last = sink; intermediate = Acceptance.DONT_KNOW; } else { StateSignature sig = new StateSignature(alphabetSize, Acceptance.TRUE); last = replaceOrRegister(sig); intermediate = Acceptance.TRUE; } int len = suffix.length(); for (int i = len - 1; i >= 0; i--) { StateSignature sig = new StateSignature(alphabetSize, intermediate); I sym = suffix.getSymbol(i); int idx = inputAlphabet.getSymbolIndex(sym); sig.successors.array[idx] = last; last = replaceOrRegister(sig); } return last; }
java
private State createSuffix(Word<? extends I> suffix, boolean accepting) { State last; Acceptance intermediate; if (!accepting) { if (sink == null) { sink = new State(null); } last = sink; intermediate = Acceptance.DONT_KNOW; } else { StateSignature sig = new StateSignature(alphabetSize, Acceptance.TRUE); last = replaceOrRegister(sig); intermediate = Acceptance.TRUE; } int len = suffix.length(); for (int i = len - 1; i >= 0; i--) { StateSignature sig = new StateSignature(alphabetSize, intermediate); I sym = suffix.getSymbol(i); int idx = inputAlphabet.getSymbolIndex(sym); sig.successors.array[idx] = last; last = replaceOrRegister(sig); } return last; }
[ "private", "State", "createSuffix", "(", "Word", "<", "?", "extends", "I", ">", "suffix", ",", "boolean", "accepting", ")", "{", "State", "last", ";", "Acceptance", "intermediate", ";", "if", "(", "!", "accepting", ")", "{", "if", "(", "sink", "==", "n...
Creates a suffix state sequence, i.e., a linear sequence of states connected by transitions labeled by the letters of the given suffix word. @param suffix the suffix word @param accepting whether or not the final state should be accepting @return the first state in the sequence
[ "Creates", "a", "suffix", "state", "sequence", "i", ".", "e", ".", "a", "linear", "sequence", "of", "states", "connected", "by", "transitions", "labeled", "by", "the", "letters", "of", "the", "given", "suffix", "word", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/incremental/src/main/java/net/automatalib/incremental/dfa/dag/IncrementalPCDFADAGBuilder.java#L251-L276
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/cluster/NodeServiceImpl.java
NodeServiceImpl.markAsAlive
@Override public void markAsAlive(Node node, boolean isMaster, String restTransportAddress) { node.getFields().put("last_seen", Tools.getUTCTimestamp()); node.getFields().put("is_master", isMaster); node.getFields().put("transport_address", restTransportAddress); try { save(node); } catch (ValidationException e) { throw new RuntimeException("Validation failed.", e); } }
java
@Override public void markAsAlive(Node node, boolean isMaster, String restTransportAddress) { node.getFields().put("last_seen", Tools.getUTCTimestamp()); node.getFields().put("is_master", isMaster); node.getFields().put("transport_address", restTransportAddress); try { save(node); } catch (ValidationException e) { throw new RuntimeException("Validation failed.", e); } }
[ "@", "Override", "public", "void", "markAsAlive", "(", "Node", "node", ",", "boolean", "isMaster", ",", "String", "restTransportAddress", ")", "{", "node", ".", "getFields", "(", ")", ".", "put", "(", "\"last_seen\"", ",", "Tools", ".", "getUTCTimestamp", "(...
Mark this node as alive and probably update some settings that may have changed since last server boot. @param isMaster @param restTransportAddress
[ "Mark", "this", "node", "as", "alive", "and", "probably", "update", "some", "settings", "that", "may", "have", "changed", "since", "last", "server", "boot", "." ]
train
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/cluster/NodeServiceImpl.java#L129-L139
kuujo/vertigo
core/src/main/java/net/kuujo/vertigo/Vertigo.java
Vertigo.deployCluster
public Vertigo deployCluster(String cluster, int nodes, Handler<AsyncResult<Cluster>> doneHandler) { return deployCluster(cluster, null, nodes, doneHandler); }
java
public Vertigo deployCluster(String cluster, int nodes, Handler<AsyncResult<Cluster>> doneHandler) { return deployCluster(cluster, null, nodes, doneHandler); }
[ "public", "Vertigo", "deployCluster", "(", "String", "cluster", ",", "int", "nodes", ",", "Handler", "<", "AsyncResult", "<", "Cluster", ">", ">", "doneHandler", ")", "{", "return", "deployCluster", "(", "cluster", ",", "null", ",", "nodes", ",", "doneHandle...
Deploys multiple nodes within a cluster at the given address. @param cluster The cluster event bus address. @param nodes The number of nodes to deploy. @param doneHandler An asynchronous handler to be called once the cluster has been deployed. The handler will be called with a {@link Cluster} which can be used to manage networks running in the cluster. @return The Vertigo instance.
[ "Deploys", "multiple", "nodes", "within", "a", "cluster", "at", "the", "given", "address", "." ]
train
https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/Vertigo.java#L248-L250
ios-driver/ios-driver
server/src/main/java/org/uiautomation/ios/utils/ZipUtils.java
ZipUtils.extractAppFromURL
public static File extractAppFromURL(URL url) throws IOException { String fileName = url.toExternalForm().substring(url.toExternalForm().lastIndexOf('/') + 1); File tmpDir = createTmpDir("iosd"); log.fine("tmpDir: " + tmpDir.getAbsolutePath()); File downloadedFile = new File(tmpDir, fileName); FileUtils.copyURLToFile(url, downloadedFile); if (fileName.endsWith(".ipa")) return downloadedFile; unzip(downloadedFile, tmpDir); for (File file: tmpDir.listFiles()) { if (file.getName().endsWith(".app")) { return file; } } throw new WebDriverException("cannot extract .app/.ipa from " + url); }
java
public static File extractAppFromURL(URL url) throws IOException { String fileName = url.toExternalForm().substring(url.toExternalForm().lastIndexOf('/') + 1); File tmpDir = createTmpDir("iosd"); log.fine("tmpDir: " + tmpDir.getAbsolutePath()); File downloadedFile = new File(tmpDir, fileName); FileUtils.copyURLToFile(url, downloadedFile); if (fileName.endsWith(".ipa")) return downloadedFile; unzip(downloadedFile, tmpDir); for (File file: tmpDir.listFiles()) { if (file.getName().endsWith(".app")) { return file; } } throw new WebDriverException("cannot extract .app/.ipa from " + url); }
[ "public", "static", "File", "extractAppFromURL", "(", "URL", "url", ")", "throws", "IOException", "{", "String", "fileName", "=", "url", ".", "toExternalForm", "(", ")", ".", "substring", "(", "url", ".", "toExternalForm", "(", ")", ".", "lastIndexOf", "(", ...
Downloads zip from from url, extracts it into tmp dir and returns path to extracted directory @param url url to zipped .app or .ipa @return .app or .ipa file
[ "Downloads", "zip", "from", "from", "url", "extracts", "it", "into", "tmp", "dir", "and", "returns", "path", "to", "extracted", "directory" ]
train
https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/utils/ZipUtils.java#L40-L61
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/util/PropertyUtils.java
PropertyUtils.setProperty
public static void setProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { if (bean == null) { throw new IllegalArgumentException("No bean specified"); } if (name == null) { throw new IllegalArgumentException("No name specified"); } // Retrieve the property setter method for the specified property PropertyDescriptor descriptor = getPropertyDescriptor(bean, name); if (descriptor == null) { throw new NoSuchMethodException("Unknown property '" + name + "'"); } Method writeMethod = descriptor.getWriteMethod(); if (writeMethod == null) { throw new NoSuchMethodException("Property '" + name + "' has no setter method"); } // Call the property setter method Object values[] = new Object[1]; values[0] = value; invokeMethod(writeMethod, bean, values); }
java
public static void setProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { if (bean == null) { throw new IllegalArgumentException("No bean specified"); } if (name == null) { throw new IllegalArgumentException("No name specified"); } // Retrieve the property setter method for the specified property PropertyDescriptor descriptor = getPropertyDescriptor(bean, name); if (descriptor == null) { throw new NoSuchMethodException("Unknown property '" + name + "'"); } Method writeMethod = descriptor.getWriteMethod(); if (writeMethod == null) { throw new NoSuchMethodException("Property '" + name + "' has no setter method"); } // Call the property setter method Object values[] = new Object[1]; values[0] = value; invokeMethod(writeMethod, bean, values); }
[ "public", "static", "void", "setProperty", "(", "Object", "bean", ",", "String", "name", ",", "Object", "value", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", ",", "NoSuchMethodException", "{", "if", "(", "bean", "==", "null", ")", "...
Set the value of the specified simple property of the specified bean, with no type conversions. @param bean Bean whose property is to be modified @param name Name of the property to be modified @param value Value to which the property should be set @exception IllegalAccessException if the caller does not have access to the property accessor method @exception IllegalArgumentException if <code>bean</code> or <code>name</code> is null @exception IllegalArgumentException if the property name is nested or indexed @exception InvocationTargetException if the property accessor method throws an exception @exception NoSuchMethodException if an accessor method for this propety cannot be found
[ "Set", "the", "value", "of", "the", "specified", "simple", "property", "of", "the", "specified", "bean", "with", "no", "type", "conversions", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/util/PropertyUtils.java#L191-L217
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.getFragmentInMinutes
@GwtIncompatible("incompatible method") public static long getFragmentInMinutes(final Calendar calendar, final int fragment) { return getFragment(calendar, fragment, TimeUnit.MINUTES); }
java
@GwtIncompatible("incompatible method") public static long getFragmentInMinutes(final Calendar calendar, final int fragment) { return getFragment(calendar, fragment, TimeUnit.MINUTES); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "long", "getFragmentInMinutes", "(", "final", "Calendar", "calendar", ",", "final", "int", "fragment", ")", "{", "return", "getFragment", "(", "calendar", ",", "fragment", ",", "TimeU...
<p>Returns the number of minutes within the fragment. All datefields greater than the fragment will be ignored.</p> <p>Asking the minutes of any date will only return the number of minutes of the current hour (resulting in a number between 0 and 59). This method will retrieve the number of minutes for any fragment. For example, if you want to calculate the number of minutes past this month, your fragment is Calendar.MONTH. The result will be all minutes of the past day(s) and hour(s).</p> <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND A fragment less than or equal to a MINUTE field will return 0.</p> <ul> <li>January 1, 2008 7:15:10.538 with Calendar.HOUR_OF_DAY as fragment will return 15 (equivalent to calendar.get(Calendar.MINUTES))</li> <li>January 6, 2008 7:15:10.538 with Calendar.HOUR_OF_DAY as fragment will return 15 (equivalent to calendar.get(Calendar.MINUTES))</li> <li>January 1, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 15</li> <li>January 6, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 435 (7*60 + 15)</li> <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0 (a millisecond cannot be split in minutes)</li> </ul> @param calendar the calendar to work with, not null @param fragment the {@code Calendar} field part of calendar to calculate @return number of minutes within the fragment of date @throws IllegalArgumentException if the date is <code>null</code> or fragment is not supported @since 2.4
[ "<p", ">", "Returns", "the", "number", "of", "minutes", "within", "the", "fragment", ".", "All", "datefields", "greater", "than", "the", "fragment", "will", "be", "ignored", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L1568-L1571
lamydev/Android-Notification
core/src/zemin/notification/NotificationBoard.java
NotificationBoard.setBodyMargin
public void setBodyMargin(int l, int t, int r, int b) { mBody.setMargin(l, t, r, b); }
java
public void setBodyMargin(int l, int t, int r, int b) { mBody.setMargin(l, t, r, b); }
[ "public", "void", "setBodyMargin", "(", "int", "l", ",", "int", "t", ",", "int", "r", ",", "int", "b", ")", "{", "mBody", ".", "setMargin", "(", "l", ",", "t", ",", "r", ",", "b", ")", ";", "}" ]
Set the margin of the body. @param l @param t @param r @param b
[ "Set", "the", "margin", "of", "the", "body", "." ]
train
https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationBoard.java#L580-L582
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckMethodAdapter.java
CheckMethodAdapter.checkDesc
static void checkDesc(final String desc, final boolean canBeVoid) { int end = checkDesc(desc, 0, canBeVoid); if (end != desc.length()) { throw new IllegalArgumentException("Invalid descriptor: " + desc); } }
java
static void checkDesc(final String desc, final boolean canBeVoid) { int end = checkDesc(desc, 0, canBeVoid); if (end != desc.length()) { throw new IllegalArgumentException("Invalid descriptor: " + desc); } }
[ "static", "void", "checkDesc", "(", "final", "String", "desc", ",", "final", "boolean", "canBeVoid", ")", "{", "int", "end", "=", "checkDesc", "(", "desc", ",", "0", ",", "canBeVoid", ")", ";", "if", "(", "end", "!=", "desc", ".", "length", "(", ")",...
Checks that the given string is a valid type descriptor. @param desc the string to be checked. @param canBeVoid <tt>true</tt> if <tt>V</tt> can be considered valid.
[ "Checks", "that", "the", "given", "string", "is", "a", "valid", "type", "descriptor", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckMethodAdapter.java#L1367-L1372
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/SmartsheetFactory.java
SmartsheetFactory.createDefaultGovAccountClient
public static Smartsheet createDefaultGovAccountClient(String accessToken) { SmartsheetImpl smartsheet = new SmartsheetImpl(GOV_BASE_URI, accessToken); return smartsheet; }
java
public static Smartsheet createDefaultGovAccountClient(String accessToken) { SmartsheetImpl smartsheet = new SmartsheetImpl(GOV_BASE_URI, accessToken); return smartsheet; }
[ "public", "static", "Smartsheet", "createDefaultGovAccountClient", "(", "String", "accessToken", ")", "{", "SmartsheetImpl", "smartsheet", "=", "new", "SmartsheetImpl", "(", "GOV_BASE_URI", ",", "accessToken", ")", ";", "return", "smartsheet", ";", "}" ]
<p>Creates a Smartsheet client with default parameters using the Smartsheetgov URI.</p> @param accessToken @return the Smartsheet client
[ "<p", ">", "Creates", "a", "Smartsheet", "client", "with", "default", "parameters", "using", "the", "Smartsheetgov", "URI", ".", "<", "/", "p", ">" ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/SmartsheetFactory.java#L84-L87
VoltDB/voltdb
third_party/java/src/au/com/bytecode/opencsv_voltpatches/CSVParser.java
CSVParser.isNextCharacterEscapable
protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i) { return inQuotes // we are in quotes, therefore there can be escaped quotes in here. && nextLine.length() > (i + 1) // there is indeed another character to check. && (nextLine.charAt(i + 1) == quotechar || nextLine.charAt(i + 1) == this.escape); }
java
protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i) { return inQuotes // we are in quotes, therefore there can be escaped quotes in here. && nextLine.length() > (i + 1) // there is indeed another character to check. && (nextLine.charAt(i + 1) == quotechar || nextLine.charAt(i + 1) == this.escape); }
[ "protected", "boolean", "isNextCharacterEscapable", "(", "String", "nextLine", ",", "boolean", "inQuotes", ",", "int", "i", ")", "{", "return", "inQuotes", "// we are in quotes, therefore there can be escaped quotes in here.\r", "&&", "nextLine", ".", "length", "(", ")", ...
precondition: the current character is an escape @param nextLine the current line @param inQuotes true if the current context is quoted @param i current index in line @return true if the following character is a quote
[ "precondition", ":", "the", "current", "character", "is", "an", "escape" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/au/com/bytecode/opencsv_voltpatches/CSVParser.java#L316-L320
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplace.java
CmsWorkplace.bodyStart
public String bodyStart(String className, String parameters) { return pageBody(HTML_START, className, parameters); }
java
public String bodyStart(String className, String parameters) { return pageBody(HTML_START, className, parameters); }
[ "public", "String", "bodyStart", "(", "String", "className", ",", "String", "parameters", ")", "{", "return", "pageBody", "(", "HTML_START", ",", "className", ",", "parameters", ")", ";", "}" ]
Builds the start html of the body.<p> @param className optional class attribute to add to the body tag @param parameters optional parameters to add to the body tag @return the start html of the body
[ "Builds", "the", "start", "html", "of", "the", "body", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L1094-L1097
dadoonet/elasticsearch-beyonder
src/main/java/fr/pilato/elasticsearch/tools/SettingsFinder.java
SettingsFinder.findJsonFiles
@Deprecated protected static ArrayList<String> findJsonFiles(Path root, String subdir) throws IOException { logger.debug("Looking for json files in classpath under [{}/{}].", root, subdir); final ArrayList<String> jsonFiles = new ArrayList<>(); final Path indexDir = root.resolve(subdir); if (Files.exists(indexDir)) { Files.walkFileTree(indexDir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { // We have now files. They could be type, settings, templates... String jsonFile = indexDir.relativize(file).toString(); if (jsonFile.equals(Defaults.IndexSettingsFileName) || jsonFile.equals(Defaults.UpdateIndexSettingsFileName)) { logger.trace("ignoring: [{}]", jsonFile); return CONTINUE; } jsonFile = jsonFile.substring(0, jsonFile.lastIndexOf(Defaults.JsonFileExtension)); jsonFiles.add(jsonFile); logger.trace("json found: [{}]", jsonFile); return CONTINUE; } }); } else { logger.trace("[{}] does not exist in [{}].", subdir, root); } return jsonFiles; }
java
@Deprecated protected static ArrayList<String> findJsonFiles(Path root, String subdir) throws IOException { logger.debug("Looking for json files in classpath under [{}/{}].", root, subdir); final ArrayList<String> jsonFiles = new ArrayList<>(); final Path indexDir = root.resolve(subdir); if (Files.exists(indexDir)) { Files.walkFileTree(indexDir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { // We have now files. They could be type, settings, templates... String jsonFile = indexDir.relativize(file).toString(); if (jsonFile.equals(Defaults.IndexSettingsFileName) || jsonFile.equals(Defaults.UpdateIndexSettingsFileName)) { logger.trace("ignoring: [{}]", jsonFile); return CONTINUE; } jsonFile = jsonFile.substring(0, jsonFile.lastIndexOf(Defaults.JsonFileExtension)); jsonFiles.add(jsonFile); logger.trace("json found: [{}]", jsonFile); return CONTINUE; } }); } else { logger.trace("[{}] does not exist in [{}].", subdir, root); } return jsonFiles; }
[ "@", "Deprecated", "protected", "static", "ArrayList", "<", "String", ">", "findJsonFiles", "(", "Path", "root", ",", "String", "subdir", ")", "throws", "IOException", "{", "logger", ".", "debug", "(", "\"Looking for json files in classpath under [{}/{}].\"", ",", "...
Find all types within an index @param root dir within the classpath @param subdir subdir name @return A list of found JSON files @deprecated Sounds like it's not used. We will remove it @throws IOException if something goes wrong
[ "Find", "all", "types", "within", "an", "index" ]
train
https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/SettingsFinder.java#L69-L99
Arnauld/org.technbolts.junit
src/main/java/org/technbolts/junit/runners/FrameworkMethodRunner.java
FrameworkMethodRunner.methodInvoker
protected Statement methodInvoker(FrameworkMethod method, Object test) { return new ParameterizedInvokeMethod(method, test, methodArgs); }
java
protected Statement methodInvoker(FrameworkMethod method, Object test) { return new ParameterizedInvokeMethod(method, test, methodArgs); }
[ "protected", "Statement", "methodInvoker", "(", "FrameworkMethod", "method", ",", "Object", "test", ")", "{", "return", "new", "ParameterizedInvokeMethod", "(", "method", ",", "test", ",", "methodArgs", ")", ";", "}" ]
Returns a {@link Statement} that invokes {@code method} on {@code test}
[ "Returns", "a", "{" ]
train
https://github.com/Arnauld/org.technbolts.junit/blob/90fb8032bbbcaf25f266693a4bdd3bde8dcc37a9/src/main/java/org/technbolts/junit/runners/FrameworkMethodRunner.java#L162-L164