repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractOverlayFormComponentInterceptor.java
AbstractOverlayFormComponentInterceptor.processComponent
@Override public final void processComponent(String propertyName, final JComponent component) { """ Creates an overlay handler for the given property name and component and installs the overlay. @param propertyName the property name. @param component the component. @see OverlayService#installOverlay(JComponent, JComponent) """ final AbstractOverlayHandler overlayHandler = this.createOverlayHandler(propertyName, component); // Wait until has parent and overlay is correctly installed final PropertyChangeListener wait4ParentListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { final JComponent targetComponent = overlayHandler.getTargetComponent(); final JComponent overlay = overlayHandler.getOverlay(); // Install overlay final int position = AbstractOverlayFormComponentInterceptor.this.getPosition(); final Boolean success = AbstractOverlayFormComponentInterceptor.this.// getOverlayService().installOverlay(targetComponent, overlay, position, null); if (success) { targetComponent.removePropertyChangeListener(// AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, this); } } }; component.addPropertyChangeListener(// AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, wait4ParentListener); }
java
@Override public final void processComponent(String propertyName, final JComponent component) { final AbstractOverlayHandler overlayHandler = this.createOverlayHandler(propertyName, component); // Wait until has parent and overlay is correctly installed final PropertyChangeListener wait4ParentListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { final JComponent targetComponent = overlayHandler.getTargetComponent(); final JComponent overlay = overlayHandler.getOverlay(); // Install overlay final int position = AbstractOverlayFormComponentInterceptor.this.getPosition(); final Boolean success = AbstractOverlayFormComponentInterceptor.this.// getOverlayService().installOverlay(targetComponent, overlay, position, null); if (success) { targetComponent.removePropertyChangeListener(// AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, this); } } }; component.addPropertyChangeListener(// AbstractOverlayFormComponentInterceptor.ANCESTOR_PROPERTY, wait4ParentListener); }
[ "@", "Override", "public", "final", "void", "processComponent", "(", "String", "propertyName", ",", "final", "JComponent", "component", ")", "{", "final", "AbstractOverlayHandler", "overlayHandler", "=", "this", ".", "createOverlayHandler", "(", "propertyName", ",", "component", ")", ";", "// Wait until has parent and overlay is correctly installed", "final", "PropertyChangeListener", "wait4ParentListener", "=", "new", "PropertyChangeListener", "(", ")", "{", "public", "void", "propertyChange", "(", "PropertyChangeEvent", "e", ")", "{", "final", "JComponent", "targetComponent", "=", "overlayHandler", ".", "getTargetComponent", "(", ")", ";", "final", "JComponent", "overlay", "=", "overlayHandler", ".", "getOverlay", "(", ")", ";", "// Install overlay", "final", "int", "position", "=", "AbstractOverlayFormComponentInterceptor", ".", "this", ".", "getPosition", "(", ")", ";", "final", "Boolean", "success", "=", "AbstractOverlayFormComponentInterceptor", ".", "this", ".", "//", "getOverlayService", "(", ")", ".", "installOverlay", "(", "targetComponent", ",", "overlay", ",", "position", ",", "null", ")", ";", "if", "(", "success", ")", "{", "targetComponent", ".", "removePropertyChangeListener", "(", "//", "AbstractOverlayFormComponentInterceptor", ".", "ANCESTOR_PROPERTY", ",", "this", ")", ";", "}", "}", "}", ";", "component", ".", "addPropertyChangeListener", "(", "//", "AbstractOverlayFormComponentInterceptor", ".", "ANCESTOR_PROPERTY", ",", "wait4ParentListener", ")", ";", "}" ]
Creates an overlay handler for the given property name and component and installs the overlay. @param propertyName the property name. @param component the component. @see OverlayService#installOverlay(JComponent, JComponent)
[ "Creates", "an", "overlay", "handler", "for", "the", "given", "property", "name", "and", "component", "and", "installs", "the", "overlay", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/AbstractOverlayFormComponentInterceptor.java#L89-L116
mapbox/mapbox-java
services-geojson/src/main/java/com/mapbox/geojson/Feature.java
Feature.toJson
@Override public String toJson() { """ This takes the currently defined values found inside this instance and converts it to a GeoJson string. @return a JSON string which represents this Feature @since 1.0.0 """ Gson gson = new GsonBuilder() .registerTypeAdapterFactory(GeoJsonAdapterFactory.create()) .registerTypeAdapterFactory(GeometryAdapterFactory.create()) .create(); // Empty properties -> should not appear in json string Feature feature = this; if (properties().size() == 0) { feature = new Feature(TYPE, bbox(), id(), geometry(), null); } return gson.toJson(feature); }
java
@Override public String toJson() { Gson gson = new GsonBuilder() .registerTypeAdapterFactory(GeoJsonAdapterFactory.create()) .registerTypeAdapterFactory(GeometryAdapterFactory.create()) .create(); // Empty properties -> should not appear in json string Feature feature = this; if (properties().size() == 0) { feature = new Feature(TYPE, bbox(), id(), geometry(), null); } return gson.toJson(feature); }
[ "@", "Override", "public", "String", "toJson", "(", ")", "{", "Gson", "gson", "=", "new", "GsonBuilder", "(", ")", ".", "registerTypeAdapterFactory", "(", "GeoJsonAdapterFactory", ".", "create", "(", ")", ")", ".", "registerTypeAdapterFactory", "(", "GeometryAdapterFactory", ".", "create", "(", ")", ")", ".", "create", "(", ")", ";", "// Empty properties -> should not appear in json string", "Feature", "feature", "=", "this", ";", "if", "(", "properties", "(", ")", ".", "size", "(", ")", "==", "0", ")", "{", "feature", "=", "new", "Feature", "(", "TYPE", ",", "bbox", "(", ")", ",", "id", "(", ")", ",", "geometry", "(", ")", ",", "null", ")", ";", "}", "return", "gson", ".", "toJson", "(", "feature", ")", ";", "}" ]
This takes the currently defined values found inside this instance and converts it to a GeoJson string. @return a JSON string which represents this Feature @since 1.0.0
[ "This", "takes", "the", "currently", "defined", "values", "found", "inside", "this", "instance", "and", "converts", "it", "to", "a", "GeoJson", "string", "." ]
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L271-L287
osglworks/java-tool
src/main/java/org/osgl/util/E.java
E.invalidConfiguration
public static ConfigurationException invalidConfiguration(Throwable cause, String message, Object... args) { """ Throws out a {@link ConfigurationException} with cause and message specified. @param cause the cause of the configuration error. @param message the error message format pattern. @param args the error message format arguments. """ throw new ConfigurationException(cause, message, args); }
java
public static ConfigurationException invalidConfiguration(Throwable cause, String message, Object... args) { throw new ConfigurationException(cause, message, args); }
[ "public", "static", "ConfigurationException", "invalidConfiguration", "(", "Throwable", "cause", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "throw", "new", "ConfigurationException", "(", "cause", ",", "message", ",", "args", ")", ";", "}" ]
Throws out a {@link ConfigurationException} with cause and message specified. @param cause the cause of the configuration error. @param message the error message format pattern. @param args the error message format arguments.
[ "Throws", "out", "a", "{" ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L299-L301
dwdyer/uncommons-maths
demo/src/java/main/org/uncommons/maths/demo/BinomialDistribution.java
BinomialDistribution.getExpectedProbability
private double getExpectedProbability(int successes) { """ This is the probability mass function (http://en.wikipedia.org/wiki/Probability_mass_function) of the Binomial distribution represented by this number generator. @param successes The number of successful trials to determine the probability for. @return The probability of obtaining the specified number of successful trials given the current values of n and p. """ double prob = Math.pow(p, successes) * Math.pow(1 - p, n - successes); BigDecimal coefficient = new BigDecimal(binomialCoefficient(n, successes)); return coefficient.multiply(new BigDecimal(prob)).doubleValue(); }
java
private double getExpectedProbability(int successes) { double prob = Math.pow(p, successes) * Math.pow(1 - p, n - successes); BigDecimal coefficient = new BigDecimal(binomialCoefficient(n, successes)); return coefficient.multiply(new BigDecimal(prob)).doubleValue(); }
[ "private", "double", "getExpectedProbability", "(", "int", "successes", ")", "{", "double", "prob", "=", "Math", ".", "pow", "(", "p", ",", "successes", ")", "*", "Math", ".", "pow", "(", "1", "-", "p", ",", "n", "-", "successes", ")", ";", "BigDecimal", "coefficient", "=", "new", "BigDecimal", "(", "binomialCoefficient", "(", "n", ",", "successes", ")", ")", ";", "return", "coefficient", ".", "multiply", "(", "new", "BigDecimal", "(", "prob", ")", ")", ".", "doubleValue", "(", ")", ";", "}" ]
This is the probability mass function (http://en.wikipedia.org/wiki/Probability_mass_function) of the Binomial distribution represented by this number generator. @param successes The number of successful trials to determine the probability for. @return The probability of obtaining the specified number of successful trials given the current values of n and p.
[ "This", "is", "the", "probability", "mass", "function", "(", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Probability_mass_function", ")", "of", "the", "Binomial", "distribution", "represented", "by", "this", "number", "generator", "." ]
train
https://github.com/dwdyer/uncommons-maths/blob/b7ba13aea70625bb7f37c856783a29e17e354964/demo/src/java/main/org/uncommons/maths/demo/BinomialDistribution.java#L62-L67
hdbeukel/james-core
src/main/java/org/jamesframework/core/search/LocalSearch.java
LocalSearch.updateCurrentAndBestSolution
protected boolean updateCurrentAndBestSolution(SolutionType solution) { """ Update the current and best solution during search. The given solution is evaluated and validated, followed by an update of the current solution (also if it is invalid). Conversely, the best solution is only updated if the given solution is valid and improves over the best solution found so far. @param solution new current solution @return <code>true</code> if the best solution has been updated """ return updateCurrentAndBestSolution(solution, getProblem().evaluate(solution), getProblem().validate(solution)); }
java
protected boolean updateCurrentAndBestSolution(SolutionType solution){ return updateCurrentAndBestSolution(solution, getProblem().evaluate(solution), getProblem().validate(solution)); }
[ "protected", "boolean", "updateCurrentAndBestSolution", "(", "SolutionType", "solution", ")", "{", "return", "updateCurrentAndBestSolution", "(", "solution", ",", "getProblem", "(", ")", ".", "evaluate", "(", "solution", ")", ",", "getProblem", "(", ")", ".", "validate", "(", "solution", ")", ")", ";", "}" ]
Update the current and best solution during search. The given solution is evaluated and validated, followed by an update of the current solution (also if it is invalid). Conversely, the best solution is only updated if the given solution is valid and improves over the best solution found so far. @param solution new current solution @return <code>true</code> if the best solution has been updated
[ "Update", "the", "current", "and", "best", "solution", "during", "search", ".", "The", "given", "solution", "is", "evaluated", "and", "validated", "followed", "by", "an", "update", "of", "the", "current", "solution", "(", "also", "if", "it", "is", "invalid", ")", ".", "Conversely", "the", "best", "solution", "is", "only", "updated", "if", "the", "given", "solution", "is", "valid", "and", "improves", "over", "the", "best", "solution", "found", "so", "far", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/LocalSearch.java#L263-L265
lastaflute/lasta-di
src/main/java/org/lastaflute/di/util/LdiSrl.java
LdiSrl.indexOfFirst
public static IndexOfInfo indexOfFirst(final String str, final String... delimiters) { """ Get the index of the first-found delimiter. <pre> indexOfFirst("foo.bar/baz.qux", ".", "/") returns the index of ".bar" </pre> @param str The target string. (NotNull) @param delimiters The array of delimiters. (NotNull) @return The information of index. (NullAllowed: if delimiter not found) """ return doIndexOfFirst(false, str, delimiters); }
java
public static IndexOfInfo indexOfFirst(final String str, final String... delimiters) { return doIndexOfFirst(false, str, delimiters); }
[ "public", "static", "IndexOfInfo", "indexOfFirst", "(", "final", "String", "str", ",", "final", "String", "...", "delimiters", ")", "{", "return", "doIndexOfFirst", "(", "false", ",", "str", ",", "delimiters", ")", ";", "}" ]
Get the index of the first-found delimiter. <pre> indexOfFirst("foo.bar/baz.qux", ".", "/") returns the index of ".bar" </pre> @param str The target string. (NotNull) @param delimiters The array of delimiters. (NotNull) @return The information of index. (NullAllowed: if delimiter not found)
[ "Get", "the", "index", "of", "the", "first", "-", "found", "delimiter", ".", "<pre", ">", "indexOfFirst", "(", "foo", ".", "bar", "/", "baz", ".", "qux", ".", "/", ")", "returns", "the", "index", "of", ".", "bar", "<", "/", "pre", ">" ]
train
https://github.com/lastaflute/lasta-di/blob/c4e123610c53a04cc836c5e456660e32d613447b/src/main/java/org/lastaflute/di/util/LdiSrl.java#L379-L381
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.removeEntries
public static void removeEntries(File zip, String[] paths, OutputStream destOut) { """ Copies an existing ZIP file and removes entries with given paths. @param zip an existing ZIP file (only read) @param paths paths of the entries to remove @param destOut new ZIP destination output stream @since 1.14 """ if (log.isDebugEnabled()) { log.debug("Copying '" + zip + "' to an output stream and removing paths " + Arrays.asList(paths) + "."); } ZipOutputStream out = null; try { out = new ZipOutputStream(destOut); copyEntries(zip, out, new HashSet<String>(Arrays.asList(paths))); } finally { IOUtils.closeQuietly(out); } }
java
public static void removeEntries(File zip, String[] paths, OutputStream destOut) { if (log.isDebugEnabled()) { log.debug("Copying '" + zip + "' to an output stream and removing paths " + Arrays.asList(paths) + "."); } ZipOutputStream out = null; try { out = new ZipOutputStream(destOut); copyEntries(zip, out, new HashSet<String>(Arrays.asList(paths))); } finally { IOUtils.closeQuietly(out); } }
[ "public", "static", "void", "removeEntries", "(", "File", "zip", ",", "String", "[", "]", "paths", ",", "OutputStream", "destOut", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Copying '\"", "+", "zip", "+", "\"' to an output stream and removing paths \"", "+", "Arrays", ".", "asList", "(", "paths", ")", "+", "\".\"", ")", ";", "}", "ZipOutputStream", "out", "=", "null", ";", "try", "{", "out", "=", "new", "ZipOutputStream", "(", "destOut", ")", ";", "copyEntries", "(", "zip", ",", "out", ",", "new", "HashSet", "<", "String", ">", "(", "Arrays", ".", "asList", "(", "paths", ")", ")", ")", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "out", ")", ";", "}", "}" ]
Copies an existing ZIP file and removes entries with given paths. @param zip an existing ZIP file (only read) @param paths paths of the entries to remove @param destOut new ZIP destination output stream @since 1.14
[ "Copies", "an", "existing", "ZIP", "file", "and", "removes", "entries", "with", "given", "paths", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2332-L2345
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java
SqlGeneratorDefaultImpl.getPreparedDeleteStatement
public SqlStatement getPreparedDeleteStatement(ClassDescriptor cld) { """ generate a prepared DELETE-Statement for the Class described by cld. @param cld the ClassDescriptor """ SqlForClass sfc = getSqlForClass(cld); SqlStatement sql = sfc.getDeleteSql(); if(sql == null) { ProcedureDescriptor pd = cld.getDeleteProcedure(); if(pd == null) { sql = new SqlDeleteByPkStatement(cld, logger); } else { sql = new SqlProcedureStatement(pd, logger); } // set the sql string sfc.setDeleteSql(sql); if(logger.isDebugEnabled()) { logger.debug("SQL:" + sql.getStatement()); } } return sql; }
java
public SqlStatement getPreparedDeleteStatement(ClassDescriptor cld) { SqlForClass sfc = getSqlForClass(cld); SqlStatement sql = sfc.getDeleteSql(); if(sql == null) { ProcedureDescriptor pd = cld.getDeleteProcedure(); if(pd == null) { sql = new SqlDeleteByPkStatement(cld, logger); } else { sql = new SqlProcedureStatement(pd, logger); } // set the sql string sfc.setDeleteSql(sql); if(logger.isDebugEnabled()) { logger.debug("SQL:" + sql.getStatement()); } } return sql; }
[ "public", "SqlStatement", "getPreparedDeleteStatement", "(", "ClassDescriptor", "cld", ")", "{", "SqlForClass", "sfc", "=", "getSqlForClass", "(", "cld", ")", ";", "SqlStatement", "sql", "=", "sfc", ".", "getDeleteSql", "(", ")", ";", "if", "(", "sql", "==", "null", ")", "{", "ProcedureDescriptor", "pd", "=", "cld", ".", "getDeleteProcedure", "(", ")", ";", "if", "(", "pd", "==", "null", ")", "{", "sql", "=", "new", "SqlDeleteByPkStatement", "(", "cld", ",", "logger", ")", ";", "}", "else", "{", "sql", "=", "new", "SqlProcedureStatement", "(", "pd", ",", "logger", ")", ";", "}", "// set the sql string\r", "sfc", ".", "setDeleteSql", "(", "sql", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"SQL:\"", "+", "sql", ".", "getStatement", "(", ")", ")", ";", "}", "}", "return", "sql", ";", "}" ]
generate a prepared DELETE-Statement for the Class described by cld. @param cld the ClassDescriptor
[ "generate", "a", "prepared", "DELETE", "-", "Statement", "for", "the", "Class", "described", "by", "cld", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java#L75-L100
nightcode/yaranga
core/src/org/nightcode/common/net/http/AuthUtils.java
AuthUtils.percentEncode
public static String percentEncode(String source) throws AuthException { """ Returns an encoded string. @see <a href="http://tools.ietf.org/html/rfc5849#section-3.6">3.6. Percent Encoding</a> @param source source string for encoding @return encoded string @throws AuthException if the named encoding is not supported """ try { return URLEncoder.encode(source, "UTF-8") .replace("+", "%20") .replace("*", "%2A") .replace("%7E", "~"); } catch (UnsupportedEncodingException ex) { throw new AuthException("cannot encode value '" + source + "'", ex); } }
java
public static String percentEncode(String source) throws AuthException { try { return URLEncoder.encode(source, "UTF-8") .replace("+", "%20") .replace("*", "%2A") .replace("%7E", "~"); } catch (UnsupportedEncodingException ex) { throw new AuthException("cannot encode value '" + source + "'", ex); } }
[ "public", "static", "String", "percentEncode", "(", "String", "source", ")", "throws", "AuthException", "{", "try", "{", "return", "URLEncoder", ".", "encode", "(", "source", ",", "\"UTF-8\"", ")", ".", "replace", "(", "\"+\"", ",", "\"%20\"", ")", ".", "replace", "(", "\"*\"", ",", "\"%2A\"", ")", ".", "replace", "(", "\"%7E\"", ",", "\"~\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "ex", ")", "{", "throw", "new", "AuthException", "(", "\"cannot encode value '\"", "+", "source", "+", "\"'\"", ",", "ex", ")", ";", "}", "}" ]
Returns an encoded string. @see <a href="http://tools.ietf.org/html/rfc5849#section-3.6">3.6. Percent Encoding</a> @param source source string for encoding @return encoded string @throws AuthException if the named encoding is not supported
[ "Returns", "an", "encoded", "string", "." ]
train
https://github.com/nightcode/yaranga/blob/f02cf8d8bcd365b6b1d55638938631a00e9ee808/core/src/org/nightcode/common/net/http/AuthUtils.java#L35-L44
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/NonplanarBonds.java
NonplanarBonds.sortClockwise
private int sortClockwise(int[] indices, IAtom focus, IAtom[] atoms, int n) { """ Sort the {@code indices}, which correspond to an index in the {@code atoms} array in clockwise order. @param indices indices, 0 to n @param focus the central atom @param atoms the neighbors of the focus @param n the number of neighbors @return the permutation parity of the sort """ int x = 0; for (int j = 1; j < n; j++) { int v = indices[j]; int i = j - 1; while ((i >= 0) && less(v, indices[i], atoms, focus.getPoint2d())) { indices[i + 1] = indices[i--]; x++; } indices[i + 1] = v; } return indexParity(x); }
java
private int sortClockwise(int[] indices, IAtom focus, IAtom[] atoms, int n) { int x = 0; for (int j = 1; j < n; j++) { int v = indices[j]; int i = j - 1; while ((i >= 0) && less(v, indices[i], atoms, focus.getPoint2d())) { indices[i + 1] = indices[i--]; x++; } indices[i + 1] = v; } return indexParity(x); }
[ "private", "int", "sortClockwise", "(", "int", "[", "]", "indices", ",", "IAtom", "focus", ",", "IAtom", "[", "]", "atoms", ",", "int", "n", ")", "{", "int", "x", "=", "0", ";", "for", "(", "int", "j", "=", "1", ";", "j", "<", "n", ";", "j", "++", ")", "{", "int", "v", "=", "indices", "[", "j", "]", ";", "int", "i", "=", "j", "-", "1", ";", "while", "(", "(", "i", ">=", "0", ")", "&&", "less", "(", "v", ",", "indices", "[", "i", "]", ",", "atoms", ",", "focus", ".", "getPoint2d", "(", ")", ")", ")", "{", "indices", "[", "i", "+", "1", "]", "=", "indices", "[", "i", "--", "]", ";", "x", "++", ";", "}", "indices", "[", "i", "+", "1", "]", "=", "v", ";", "}", "return", "indexParity", "(", "x", ")", ";", "}" ]
Sort the {@code indices}, which correspond to an index in the {@code atoms} array in clockwise order. @param indices indices, 0 to n @param focus the central atom @param atoms the neighbors of the focus @param n the number of neighbors @return the permutation parity of the sort
[ "Sort", "the", "{", "@code", "indices", "}", "which", "correspond", "to", "an", "index", "in", "the", "{", "@code", "atoms", "}", "array", "in", "clockwise", "order", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/NonplanarBonds.java#L881-L893
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CProductPersistenceImpl.java
CProductPersistenceImpl.findByUUID_G
@Override public CProduct findByUUID_G(String uuid, long groupId) throws NoSuchCProductException { """ Returns the c product where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCProductException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching c product @throws NoSuchCProductException if a matching c product could not be found """ CProduct cProduct = fetchByUUID_G(uuid, groupId); if (cProduct == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCProductException(msg.toString()); } return cProduct; }
java
@Override public CProduct findByUUID_G(String uuid, long groupId) throws NoSuchCProductException { CProduct cProduct = fetchByUUID_G(uuid, groupId); if (cProduct == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCProductException(msg.toString()); } return cProduct; }
[ "@", "Override", "public", "CProduct", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCProductException", "{", "CProduct", "cProduct", "=", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "if", "(", "cProduct", "==", "null", ")", "{", "StringBundler", "msg", "=", "new", "StringBundler", "(", "6", ")", ";", "msg", ".", "append", "(", "_NO_SUCH_ENTITY_WITH_KEY", ")", ";", "msg", ".", "append", "(", "\"uuid=\"", ")", ";", "msg", ".", "append", "(", "uuid", ")", ";", "msg", ".", "append", "(", "\", groupId=\"", ")", ";", "msg", ".", "append", "(", "groupId", ")", ";", "msg", ".", "append", "(", "\"}\"", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "throw", "new", "NoSuchCProductException", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "return", "cProduct", ";", "}" ]
Returns the c product where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCProductException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching c product @throws NoSuchCProductException if a matching c product could not be found
[ "Returns", "the", "c", "product", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCProductException", "}", "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/CProductPersistenceImpl.java#L658-L684
apiman/apiman
common/servlet/src/main/java/io/apiman/common/servlet/AuthenticationFilter.java
AuthenticationFilter.parseAuthorizationBasic
private Creds parseAuthorizationBasic(String authHeader) { """ Parses the Authorization request header into a username and password. @param authHeader the auth header """ String userpassEncoded = authHeader.substring(6); String data = StringUtils.newStringUtf8(Base64.decodeBase64(userpassEncoded)); int sepIdx = data.indexOf(':'); if (sepIdx > 0) { String username = data.substring(0, sepIdx); String password = data.substring(sepIdx + 1); return new Creds(username, password); } else { return new Creds(data, null); } }
java
private Creds parseAuthorizationBasic(String authHeader) { String userpassEncoded = authHeader.substring(6); String data = StringUtils.newStringUtf8(Base64.decodeBase64(userpassEncoded)); int sepIdx = data.indexOf(':'); if (sepIdx > 0) { String username = data.substring(0, sepIdx); String password = data.substring(sepIdx + 1); return new Creds(username, password); } else { return new Creds(data, null); } }
[ "private", "Creds", "parseAuthorizationBasic", "(", "String", "authHeader", ")", "{", "String", "userpassEncoded", "=", "authHeader", ".", "substring", "(", "6", ")", ";", "String", "data", "=", "StringUtils", ".", "newStringUtf8", "(", "Base64", ".", "decodeBase64", "(", "userpassEncoded", ")", ")", ";", "int", "sepIdx", "=", "data", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "sepIdx", ">", "0", ")", "{", "String", "username", "=", "data", ".", "substring", "(", "0", ",", "sepIdx", ")", ";", "String", "password", "=", "data", ".", "substring", "(", "sepIdx", "+", "1", ")", ";", "return", "new", "Creds", "(", "username", ",", "password", ")", ";", "}", "else", "{", "return", "new", "Creds", "(", "data", ",", "null", ")", ";", "}", "}" ]
Parses the Authorization request header into a username and password. @param authHeader the auth header
[ "Parses", "the", "Authorization", "request", "header", "into", "a", "username", "and", "password", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/servlet/src/main/java/io/apiman/common/servlet/AuthenticationFilter.java#L309-L320
SonarSource/sonarqube
sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java
MoreCollectors.unorderedIndex
public static <K, E> Collector<E, ImmutableSetMultimap.Builder<K, E>, ImmutableSetMultimap<K, E>> unorderedIndex(Function<? super E, K> keyFunction) { """ Creates an {@link com.google.common.collect.ImmutableSetMultimap} from the stream where the values are the values in the stream and the keys are the result of the provided {@link Function keyFunction} applied to each value in the stream. <p> Neither {@link Function keyFunction} nor {@link Function valueFunction} can return {@code null}, otherwise a {@link NullPointerException} will be thrown. </p> @throws NullPointerException if {@code keyFunction} or {@code valueFunction} is {@code null}. @throws NullPointerException if result of {@code keyFunction} or {@code valueFunction} is {@code null}. """ return unorderedIndex(keyFunction, Function.identity()); }
java
public static <K, E> Collector<E, ImmutableSetMultimap.Builder<K, E>, ImmutableSetMultimap<K, E>> unorderedIndex(Function<? super E, K> keyFunction) { return unorderedIndex(keyFunction, Function.identity()); }
[ "public", "static", "<", "K", ",", "E", ">", "Collector", "<", "E", ",", "ImmutableSetMultimap", ".", "Builder", "<", "K", ",", "E", ">", ",", "ImmutableSetMultimap", "<", "K", ",", "E", ">", ">", "unorderedIndex", "(", "Function", "<", "?", "super", "E", ",", "K", ">", "keyFunction", ")", "{", "return", "unorderedIndex", "(", "keyFunction", ",", "Function", ".", "identity", "(", ")", ")", ";", "}" ]
Creates an {@link com.google.common.collect.ImmutableSetMultimap} from the stream where the values are the values in the stream and the keys are the result of the provided {@link Function keyFunction} applied to each value in the stream. <p> Neither {@link Function keyFunction} nor {@link Function valueFunction} can return {@code null}, otherwise a {@link NullPointerException} will be thrown. </p> @throws NullPointerException if {@code keyFunction} or {@code valueFunction} is {@code null}. @throws NullPointerException if result of {@code keyFunction} or {@code valueFunction} is {@code null}.
[ "Creates", "an", "{", "@link", "com", ".", "google", ".", "common", ".", "collect", ".", "ImmutableSetMultimap", "}", "from", "the", "stream", "where", "the", "values", "are", "the", "values", "in", "the", "stream", "and", "the", "keys", "are", "the", "result", "of", "the", "provided", "{", "@link", "Function", "keyFunction", "}", "applied", "to", "each", "value", "in", "the", "stream", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java#L369-L371
rzwitserloot/lombok
src/core/lombok/javac/handlers/JavacHandlerUtil.java
JavacHandlerUtil.chainDots
public static JCExpression chainDots(JavacNode node, String elem1, String elem2, String... elems) { """ In javac, dotted access of any kind, from {@code java.lang.String} to {@code var.methodName} is represented by a fold-left of {@code Select} nodes with the leftmost string represented by a {@code Ident} node. This method generates such an expression. <p> The position of the generated node(s) will be unpositioned (-1). For example, maker.Select(maker.Select(maker.Ident(NAME[java]), NAME[lang]), NAME[String]). @see com.sun.tools.javac.tree.JCTree.JCIdent @see com.sun.tools.javac.tree.JCTree.JCFieldAccess """ return chainDots(node, -1, elem1, elem2, elems); }
java
public static JCExpression chainDots(JavacNode node, String elem1, String elem2, String... elems) { return chainDots(node, -1, elem1, elem2, elems); }
[ "public", "static", "JCExpression", "chainDots", "(", "JavacNode", "node", ",", "String", "elem1", ",", "String", "elem2", ",", "String", "...", "elems", ")", "{", "return", "chainDots", "(", "node", ",", "-", "1", ",", "elem1", ",", "elem2", ",", "elems", ")", ";", "}" ]
In javac, dotted access of any kind, from {@code java.lang.String} to {@code var.methodName} is represented by a fold-left of {@code Select} nodes with the leftmost string represented by a {@code Ident} node. This method generates such an expression. <p> The position of the generated node(s) will be unpositioned (-1). For example, maker.Select(maker.Select(maker.Ident(NAME[java]), NAME[lang]), NAME[String]). @see com.sun.tools.javac.tree.JCTree.JCIdent @see com.sun.tools.javac.tree.JCTree.JCFieldAccess
[ "In", "javac", "dotted", "access", "of", "any", "kind", "from", "{", "@code", "java", ".", "lang", ".", "String", "}", "to", "{", "@code", "var", ".", "methodName", "}", "is", "represented", "by", "a", "fold", "-", "left", "of", "{", "@code", "Select", "}", "nodes", "with", "the", "leftmost", "string", "represented", "by", "a", "{", "@code", "Ident", "}", "node", ".", "This", "method", "generates", "such", "an", "expression", ".", "<p", ">", "The", "position", "of", "the", "generated", "node", "(", "s", ")", "will", "be", "unpositioned", "(", "-", "1", ")", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1327-L1329
jglobus/JGlobus
gram/src/main/java/org/globus/rsl/Binding.java
Binding.toRSL
public void toRSL(StringBuffer buf, boolean explicitConcat) { """ Produces a RSL representation of this variable definition. @param buf buffer to add the RSL representation to. @param explicitConcat if true explicit concatination will be used in RSL strings. """ buf.append("("); buf.append( getName() ); buf.append(" "); getValue().toRSL(buf, explicitConcat); buf.append(")"); }
java
public void toRSL(StringBuffer buf, boolean explicitConcat) { buf.append("("); buf.append( getName() ); buf.append(" "); getValue().toRSL(buf, explicitConcat); buf.append(")"); }
[ "public", "void", "toRSL", "(", "StringBuffer", "buf", ",", "boolean", "explicitConcat", ")", "{", "buf", ".", "append", "(", "\"(\"", ")", ";", "buf", ".", "append", "(", "getName", "(", ")", ")", ";", "buf", ".", "append", "(", "\" \"", ")", ";", "getValue", "(", ")", ".", "toRSL", "(", "buf", ",", "explicitConcat", ")", ";", "buf", ".", "append", "(", "\")\"", ")", ";", "}" ]
Produces a RSL representation of this variable definition. @param buf buffer to add the RSL representation to. @param explicitConcat if true explicit concatination will be used in RSL strings.
[ "Produces", "a", "RSL", "representation", "of", "this", "variable", "definition", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gram/src/main/java/org/globus/rsl/Binding.java#L93-L99
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static DefaultTableModel leftShift(DefaultTableModel self, Object row) { """ Overloads the left shift operator to provide an easy way to add rows to a DefaultTableModel. <p> if row.size &lt; model.size -&gt; row will be padded with nulls<br> if row.size &gt; model.size -&gt; additional columns will be discarded<br> @param self a DefaultTableModel @param row a row to be added to the model. @return same model, after the value was added to it. @since 1.6.4 """ if (row == null) { // adds an empty row self.addRow((Object[]) null); return self; } self.addRow(buildRowData(self, row)); return self; }
java
public static DefaultTableModel leftShift(DefaultTableModel self, Object row) { if (row == null) { // adds an empty row self.addRow((Object[]) null); return self; } self.addRow(buildRowData(self, row)); return self; }
[ "public", "static", "DefaultTableModel", "leftShift", "(", "DefaultTableModel", "self", ",", "Object", "row", ")", "{", "if", "(", "row", "==", "null", ")", "{", "// adds an empty row", "self", ".", "addRow", "(", "(", "Object", "[", "]", ")", "null", ")", ";", "return", "self", ";", "}", "self", ".", "addRow", "(", "buildRowData", "(", "self", ",", "row", ")", ")", ";", "return", "self", ";", "}" ]
Overloads the left shift operator to provide an easy way to add rows to a DefaultTableModel. <p> if row.size &lt; model.size -&gt; row will be padded with nulls<br> if row.size &gt; model.size -&gt; additional columns will be discarded<br> @param self a DefaultTableModel @param row a row to be added to the model. @return same model, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "rows", "to", "a", "DefaultTableModel", ".", "<p", ">", "if", "row", ".", "size", "&lt", ";", "model", ".", "size", "-", "&gt", ";", "row", "will", "be", "padded", "with", "nulls<br", ">", "if", "row", ".", "size", "&gt", ";", "model", ".", "size", "-", "&gt", ";", "additional", "columns", "will", "be", "discarded<br", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L462-L470
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
TimestampUtils.toLocalTimeBin
public LocalTime toLocalTimeBin(byte[] bytes) throws PSQLException { """ Returns the SQL Time object matching the given bytes with {@link Oid#TIME}. @param bytes The binary encoded time value. @return The parsed time object. @throws PSQLException If binary format could not be parsed. """ if (bytes.length != 8) { throw new PSQLException(GT.tr("Unsupported binary encoding of {0}.", "time"), PSQLState.BAD_DATETIME_FORMAT); } long micros; if (usesDouble) { double seconds = ByteConverter.float8(bytes, 0); micros = (long) (seconds * 1000000d); } else { micros = ByteConverter.int8(bytes, 0); } return LocalTime.ofNanoOfDay(micros * 1000); }
java
public LocalTime toLocalTimeBin(byte[] bytes) throws PSQLException { if (bytes.length != 8) { throw new PSQLException(GT.tr("Unsupported binary encoding of {0}.", "time"), PSQLState.BAD_DATETIME_FORMAT); } long micros; if (usesDouble) { double seconds = ByteConverter.float8(bytes, 0); micros = (long) (seconds * 1000000d); } else { micros = ByteConverter.int8(bytes, 0); } return LocalTime.ofNanoOfDay(micros * 1000); }
[ "public", "LocalTime", "toLocalTimeBin", "(", "byte", "[", "]", "bytes", ")", "throws", "PSQLException", "{", "if", "(", "bytes", ".", "length", "!=", "8", ")", "{", "throw", "new", "PSQLException", "(", "GT", ".", "tr", "(", "\"Unsupported binary encoding of {0}.\"", ",", "\"time\"", ")", ",", "PSQLState", ".", "BAD_DATETIME_FORMAT", ")", ";", "}", "long", "micros", ";", "if", "(", "usesDouble", ")", "{", "double", "seconds", "=", "ByteConverter", ".", "float8", "(", "bytes", ",", "0", ")", ";", "micros", "=", "(", "long", ")", "(", "seconds", "*", "1000000d", ")", ";", "}", "else", "{", "micros", "=", "ByteConverter", ".", "int8", "(", "bytes", ",", "0", ")", ";", "}", "return", "LocalTime", ".", "ofNanoOfDay", "(", "micros", "*", "1000", ")", ";", "}" ]
Returns the SQL Time object matching the given bytes with {@link Oid#TIME}. @param bytes The binary encoded time value. @return The parsed time object. @throws PSQLException If binary format could not be parsed.
[ "Returns", "the", "SQL", "Time", "object", "matching", "the", "given", "bytes", "with", "{", "@link", "Oid#TIME", "}", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L1012-L1030
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.addHierarchicalEntityChildAsync
public Observable<UUID> addHierarchicalEntityChildAsync(UUID appId, String versionId, UUID hEntityId, AddHierarchicalEntityChildOptionalParameter addHierarchicalEntityChildOptionalParameter) { """ Creates a single child in an existing hierarchical entity model. @param appId The application ID. @param versionId The version ID. @param hEntityId The hierarchical entity extractor ID. @param addHierarchicalEntityChildOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UUID object """ return addHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, addHierarchicalEntityChildOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() { @Override public UUID call(ServiceResponse<UUID> response) { return response.body(); } }); }
java
public Observable<UUID> addHierarchicalEntityChildAsync(UUID appId, String versionId, UUID hEntityId, AddHierarchicalEntityChildOptionalParameter addHierarchicalEntityChildOptionalParameter) { return addHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, addHierarchicalEntityChildOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() { @Override public UUID call(ServiceResponse<UUID> response) { return response.body(); } }); }
[ "public", "Observable", "<", "UUID", ">", "addHierarchicalEntityChildAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "hEntityId", ",", "AddHierarchicalEntityChildOptionalParameter", "addHierarchicalEntityChildOptionalParameter", ")", "{", "return", "addHierarchicalEntityChildWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "hEntityId", ",", "addHierarchicalEntityChildOptionalParameter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "UUID", ">", ",", "UUID", ">", "(", ")", "{", "@", "Override", "public", "UUID", "call", "(", "ServiceResponse", "<", "UUID", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates a single child in an existing hierarchical entity model. @param appId The application ID. @param versionId The version ID. @param hEntityId The hierarchical entity extractor ID. @param addHierarchicalEntityChildOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UUID object
[ "Creates", "a", "single", "child", "in", "an", "existing", "hierarchical", "entity", "model", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6674-L6681
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/labelling/AbstractReactionLabeller.java
AbstractReactionLabeller.cloneAndSortMappings
private void cloneAndSortMappings(IReaction reaction, IReaction copyOfReaction, Map<IAtomContainer, int[]> permutationMap) { """ Clone and Sort the mappings based on the order of the first object in the mapping (which is assumed to be the reactant). @param reaction """ // make a lookup for the indices of the atoms in the copy final Map<IChemObject, Integer> indexMap = new HashMap<IChemObject, Integer>(); List<IAtomContainer> all = ReactionManipulator.getAllAtomContainers(copyOfReaction); int globalIndex = 0; for (IAtomContainer ac : all) { for (IAtom atom : ac.atoms()) { indexMap.put(atom, globalIndex); globalIndex++; } } Map<IAtom, IAtom> atomAtomMap = atomAtomMap(reaction, copyOfReaction, permutationMap); List<IMapping> map = cloneMappings(reaction, atomAtomMap); Comparator<IMapping> mappingSorter = new Comparator<IMapping>() { /** * {@inheritDoc} */ @Override public int compare(IMapping o1, IMapping o2) { IChemObject o10 = o1.getChemObject(0); IChemObject o20 = o2.getChemObject(0); return indexMap.get(o10).compareTo(indexMap.get(o20)); } }; Collections.sort(map, mappingSorter); int mappingIndex = 0; for (IMapping mapping : map) { mapping.getChemObject(0).setProperty(CDKConstants.ATOM_ATOM_MAPPING, mappingIndex); mapping.getChemObject(1).setProperty(CDKConstants.ATOM_ATOM_MAPPING, mappingIndex); copyOfReaction.addMapping(mapping); mappingIndex++; } }
java
private void cloneAndSortMappings(IReaction reaction, IReaction copyOfReaction, Map<IAtomContainer, int[]> permutationMap) { // make a lookup for the indices of the atoms in the copy final Map<IChemObject, Integer> indexMap = new HashMap<IChemObject, Integer>(); List<IAtomContainer> all = ReactionManipulator.getAllAtomContainers(copyOfReaction); int globalIndex = 0; for (IAtomContainer ac : all) { for (IAtom atom : ac.atoms()) { indexMap.put(atom, globalIndex); globalIndex++; } } Map<IAtom, IAtom> atomAtomMap = atomAtomMap(reaction, copyOfReaction, permutationMap); List<IMapping> map = cloneMappings(reaction, atomAtomMap); Comparator<IMapping> mappingSorter = new Comparator<IMapping>() { /** * {@inheritDoc} */ @Override public int compare(IMapping o1, IMapping o2) { IChemObject o10 = o1.getChemObject(0); IChemObject o20 = o2.getChemObject(0); return indexMap.get(o10).compareTo(indexMap.get(o20)); } }; Collections.sort(map, mappingSorter); int mappingIndex = 0; for (IMapping mapping : map) { mapping.getChemObject(0).setProperty(CDKConstants.ATOM_ATOM_MAPPING, mappingIndex); mapping.getChemObject(1).setProperty(CDKConstants.ATOM_ATOM_MAPPING, mappingIndex); copyOfReaction.addMapping(mapping); mappingIndex++; } }
[ "private", "void", "cloneAndSortMappings", "(", "IReaction", "reaction", ",", "IReaction", "copyOfReaction", ",", "Map", "<", "IAtomContainer", ",", "int", "[", "]", ">", "permutationMap", ")", "{", "// make a lookup for the indices of the atoms in the copy", "final", "Map", "<", "IChemObject", ",", "Integer", ">", "indexMap", "=", "new", "HashMap", "<", "IChemObject", ",", "Integer", ">", "(", ")", ";", "List", "<", "IAtomContainer", ">", "all", "=", "ReactionManipulator", ".", "getAllAtomContainers", "(", "copyOfReaction", ")", ";", "int", "globalIndex", "=", "0", ";", "for", "(", "IAtomContainer", "ac", ":", "all", ")", "{", "for", "(", "IAtom", "atom", ":", "ac", ".", "atoms", "(", ")", ")", "{", "indexMap", ".", "put", "(", "atom", ",", "globalIndex", ")", ";", "globalIndex", "++", ";", "}", "}", "Map", "<", "IAtom", ",", "IAtom", ">", "atomAtomMap", "=", "atomAtomMap", "(", "reaction", ",", "copyOfReaction", ",", "permutationMap", ")", ";", "List", "<", "IMapping", ">", "map", "=", "cloneMappings", "(", "reaction", ",", "atomAtomMap", ")", ";", "Comparator", "<", "IMapping", ">", "mappingSorter", "=", "new", "Comparator", "<", "IMapping", ">", "(", ")", "{", "/**\n * {@inheritDoc}\n */", "@", "Override", "public", "int", "compare", "(", "IMapping", "o1", ",", "IMapping", "o2", ")", "{", "IChemObject", "o10", "=", "o1", ".", "getChemObject", "(", "0", ")", ";", "IChemObject", "o20", "=", "o2", ".", "getChemObject", "(", "0", ")", ";", "return", "indexMap", ".", "get", "(", "o10", ")", ".", "compareTo", "(", "indexMap", ".", "get", "(", "o20", ")", ")", ";", "}", "}", ";", "Collections", ".", "sort", "(", "map", ",", "mappingSorter", ")", ";", "int", "mappingIndex", "=", "0", ";", "for", "(", "IMapping", "mapping", ":", "map", ")", "{", "mapping", ".", "getChemObject", "(", "0", ")", ".", "setProperty", "(", "CDKConstants", ".", "ATOM_ATOM_MAPPING", ",", "mappingIndex", ")", ";", "mapping", ".", "getChemObject", "(", "1", ")", ".", "setProperty", "(", "CDKConstants", ".", "ATOM_ATOM_MAPPING", ",", "mappingIndex", ")", ";", "copyOfReaction", ".", "addMapping", "(", "mapping", ")", ";", "mappingIndex", "++", ";", "}", "}" ]
Clone and Sort the mappings based on the order of the first object in the mapping (which is assumed to be the reactant). @param reaction
[ "Clone", "and", "Sort", "the", "mappings", "based", "on", "the", "order", "of", "the", "first", "object", "in", "the", "mapping", "(", "which", "is", "assumed", "to", "be", "the", "reactant", ")", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/labelling/AbstractReactionLabeller.java#L105-L144
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/ftp/FTPFileSystem.java
FTPFileSystem.getFileStatus
private FileStatus getFileStatus(FTPFile ftpFile, Path parentPath) { """ Convert the file information in FTPFile to a {@link FileStatus} object. * @param ftpFile @param parentPath @return FileStatus """ long length = ftpFile.getSize(); boolean isDir = ftpFile.isDirectory(); int blockReplication = 1; // Using default block size since there is no way in FTP client to know of // block sizes on server. The assumption could be less than ideal. long blockSize = DEFAULT_BLOCK_SIZE; long modTime = ftpFile.getTimestamp().getTimeInMillis(); long accessTime = 0; FsPermission permission = getPermissions(ftpFile); String user = ftpFile.getUser(); String group = ftpFile.getGroup(); Path filePath = new Path(parentPath, ftpFile.getName()); return new FileStatus(length, isDir, blockReplication, blockSize, modTime, accessTime, permission, user, group, filePath.makeQualified(this)); }
java
private FileStatus getFileStatus(FTPFile ftpFile, Path parentPath) { long length = ftpFile.getSize(); boolean isDir = ftpFile.isDirectory(); int blockReplication = 1; // Using default block size since there is no way in FTP client to know of // block sizes on server. The assumption could be less than ideal. long blockSize = DEFAULT_BLOCK_SIZE; long modTime = ftpFile.getTimestamp().getTimeInMillis(); long accessTime = 0; FsPermission permission = getPermissions(ftpFile); String user = ftpFile.getUser(); String group = ftpFile.getGroup(); Path filePath = new Path(parentPath, ftpFile.getName()); return new FileStatus(length, isDir, blockReplication, blockSize, modTime, accessTime, permission, user, group, filePath.makeQualified(this)); }
[ "private", "FileStatus", "getFileStatus", "(", "FTPFile", "ftpFile", ",", "Path", "parentPath", ")", "{", "long", "length", "=", "ftpFile", ".", "getSize", "(", ")", ";", "boolean", "isDir", "=", "ftpFile", ".", "isDirectory", "(", ")", ";", "int", "blockReplication", "=", "1", ";", "// Using default block size since there is no way in FTP client to know of", "// block sizes on server. The assumption could be less than ideal.", "long", "blockSize", "=", "DEFAULT_BLOCK_SIZE", ";", "long", "modTime", "=", "ftpFile", ".", "getTimestamp", "(", ")", ".", "getTimeInMillis", "(", ")", ";", "long", "accessTime", "=", "0", ";", "FsPermission", "permission", "=", "getPermissions", "(", "ftpFile", ")", ";", "String", "user", "=", "ftpFile", ".", "getUser", "(", ")", ";", "String", "group", "=", "ftpFile", ".", "getGroup", "(", ")", ";", "Path", "filePath", "=", "new", "Path", "(", "parentPath", ",", "ftpFile", ".", "getName", "(", ")", ")", ";", "return", "new", "FileStatus", "(", "length", ",", "isDir", ",", "blockReplication", ",", "blockSize", ",", "modTime", ",", "accessTime", ",", "permission", ",", "user", ",", "group", ",", "filePath", ".", "makeQualified", "(", "this", ")", ")", ";", "}" ]
Convert the file information in FTPFile to a {@link FileStatus} object. * @param ftpFile @param parentPath @return FileStatus
[ "Convert", "the", "file", "information", "in", "FTPFile", "to", "a", "{", "@link", "FileStatus", "}", "object", ".", "*" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/ftp/FTPFileSystem.java#L434-L449
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.getByte
public static byte getByte(MemorySegment[] segments, int offset) { """ get byte from segments. @param segments target segments. @param offset value offset. """ if (inFirstSegment(segments, offset, 1)) { return segments[0].get(offset); } else { return getByteMultiSegments(segments, offset); } }
java
public static byte getByte(MemorySegment[] segments, int offset) { if (inFirstSegment(segments, offset, 1)) { return segments[0].get(offset); } else { return getByteMultiSegments(segments, offset); } }
[ "public", "static", "byte", "getByte", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ")", "{", "if", "(", "inFirstSegment", "(", "segments", ",", "offset", ",", "1", ")", ")", "{", "return", "segments", "[", "0", "]", ".", "get", "(", "offset", ")", ";", "}", "else", "{", "return", "getByteMultiSegments", "(", "segments", ",", "offset", ")", ";", "}", "}" ]
get byte from segments. @param segments target segments. @param offset value offset.
[ "get", "byte", "from", "segments", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L576-L582
HeidelTime/heideltime
src/de/unihd/dbs/uima/annotator/stanfordtagger/StanfordPOSTaggerWrapper.java
StanfordPOSTaggerWrapper.initialize
public void initialize(UimaContext aContext) { """ initialization method where we fill configuration values and check some prerequisites """ // get configuration from the descriptor annotate_tokens = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_TOKENS); annotate_sentences = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_SENTENCES); annotate_partofspeech = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_PARTOFSPEECH); model_path = (String) aContext.getConfigParameterValue(PARAM_MODEL_PATH); config_path = (String) aContext.getConfigParameterValue(PARAM_CONFIG_PATH); // check if the model file exists if(model_path == null) { Logger.printError(component, "The model file for the Stanford Tagger was not correctly specified."); System.exit(-1); } // try instantiating the MaxEnt Tagger try { if(config_path != null) { // configuration exists FileInputStream isr = new FileInputStream(config_path); Properties props = new Properties(); props.load(isr); mt = new MaxentTagger(model_path, new TaggerConfig(props), false); } else { // instantiate without configuration file mt = new MaxentTagger(model_path, new TaggerConfig("-model", model_path), false); } } catch(Exception e) { e.printStackTrace(); Logger.printError(component, "MaxentTagger could not be instantiated with the supplied model("+model_path+") and config("+config_path+") file."); System.exit(-1); } }
java
public void initialize(UimaContext aContext) { // get configuration from the descriptor annotate_tokens = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_TOKENS); annotate_sentences = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_SENTENCES); annotate_partofspeech = (Boolean) aContext.getConfigParameterValue(PARAM_ANNOTATE_PARTOFSPEECH); model_path = (String) aContext.getConfigParameterValue(PARAM_MODEL_PATH); config_path = (String) aContext.getConfigParameterValue(PARAM_CONFIG_PATH); // check if the model file exists if(model_path == null) { Logger.printError(component, "The model file for the Stanford Tagger was not correctly specified."); System.exit(-1); } // try instantiating the MaxEnt Tagger try { if(config_path != null) { // configuration exists FileInputStream isr = new FileInputStream(config_path); Properties props = new Properties(); props.load(isr); mt = new MaxentTagger(model_path, new TaggerConfig(props), false); } else { // instantiate without configuration file mt = new MaxentTagger(model_path, new TaggerConfig("-model", model_path), false); } } catch(Exception e) { e.printStackTrace(); Logger.printError(component, "MaxentTagger could not be instantiated with the supplied model("+model_path+") and config("+config_path+") file."); System.exit(-1); } }
[ "public", "void", "initialize", "(", "UimaContext", "aContext", ")", "{", "// get configuration from the descriptor", "annotate_tokens", "=", "(", "Boolean", ")", "aContext", ".", "getConfigParameterValue", "(", "PARAM_ANNOTATE_TOKENS", ")", ";", "annotate_sentences", "=", "(", "Boolean", ")", "aContext", ".", "getConfigParameterValue", "(", "PARAM_ANNOTATE_SENTENCES", ")", ";", "annotate_partofspeech", "=", "(", "Boolean", ")", "aContext", ".", "getConfigParameterValue", "(", "PARAM_ANNOTATE_PARTOFSPEECH", ")", ";", "model_path", "=", "(", "String", ")", "aContext", ".", "getConfigParameterValue", "(", "PARAM_MODEL_PATH", ")", ";", "config_path", "=", "(", "String", ")", "aContext", ".", "getConfigParameterValue", "(", "PARAM_CONFIG_PATH", ")", ";", "// check if the model file exists", "if", "(", "model_path", "==", "null", ")", "{", "Logger", ".", "printError", "(", "component", ",", "\"The model file for the Stanford Tagger was not correctly specified.\"", ")", ";", "System", ".", "exit", "(", "-", "1", ")", ";", "}", "// try instantiating the MaxEnt Tagger", "try", "{", "if", "(", "config_path", "!=", "null", ")", "{", "// configuration exists", "FileInputStream", "isr", "=", "new", "FileInputStream", "(", "config_path", ")", ";", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "props", ".", "load", "(", "isr", ")", ";", "mt", "=", "new", "MaxentTagger", "(", "model_path", ",", "new", "TaggerConfig", "(", "props", ")", ",", "false", ")", ";", "}", "else", "{", "// instantiate without configuration file", "mt", "=", "new", "MaxentTagger", "(", "model_path", ",", "new", "TaggerConfig", "(", "\"-model\"", ",", "model_path", ")", ",", "false", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "Logger", ".", "printError", "(", "component", ",", "\"MaxentTagger could not be instantiated with the supplied model(\"", "+", "model_path", "+", "\") and config(\"", "+", "config_path", "+", "\") file.\"", ")", ";", "System", ".", "exit", "(", "-", "1", ")", ";", "}", "}" ]
initialization method where we fill configuration values and check some prerequisites
[ "initialization", "method", "where", "we", "fill", "configuration", "values", "and", "check", "some", "prerequisites" ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/annotator/stanfordtagger/StanfordPOSTaggerWrapper.java#L59-L88
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.createOrUpdateAsync
public Observable<AppServiceEnvironmentResourceInner> createOrUpdateAsync(String resourceGroupName, String name, AppServiceEnvironmentResourceInner hostingEnvironmentEnvelope) { """ Create or update an App Service Environment. Create or update an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param hostingEnvironmentEnvelope Configuration details of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).map(new Func1<ServiceResponse<AppServiceEnvironmentResourceInner>, AppServiceEnvironmentResourceInner>() { @Override public AppServiceEnvironmentResourceInner call(ServiceResponse<AppServiceEnvironmentResourceInner> response) { return response.body(); } }); }
java
public Observable<AppServiceEnvironmentResourceInner> createOrUpdateAsync(String resourceGroupName, String name, AppServiceEnvironmentResourceInner hostingEnvironmentEnvelope) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).map(new Func1<ServiceResponse<AppServiceEnvironmentResourceInner>, AppServiceEnvironmentResourceInner>() { @Override public AppServiceEnvironmentResourceInner call(ServiceResponse<AppServiceEnvironmentResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AppServiceEnvironmentResourceInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "AppServiceEnvironmentResourceInner", "hostingEnvironmentEnvelope", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "hostingEnvironmentEnvelope", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "AppServiceEnvironmentResourceInner", ">", ",", "AppServiceEnvironmentResourceInner", ">", "(", ")", "{", "@", "Override", "public", "AppServiceEnvironmentResourceInner", "call", "(", "ServiceResponse", "<", "AppServiceEnvironmentResourceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or update an App Service Environment. Create or update an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param hostingEnvironmentEnvelope Configuration details of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "or", "update", "an", "App", "Service", "Environment", ".", "Create", "or", "update", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L715-L722
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpProxyRedirect.java
HttpProxyRedirect.getRedirectPort
public static Integer getRedirectPort(String host, int httpPort) { """ <p> This method returns the secure port number to redirect to given the specified host and incoming (non-secure) port number. If a proxy redirect has been configured with the specified host and httpPort, the associated httpsPort will be returned. </p><p> If the specified httpPort has been configured but not with the specified host, then this method will return the httpsPort associated with a proxy redirect that has been configured with a wildcard if one exists (i.e. &lt;httpProxyRedirect host="*" .../&gt;). </p><p> If no proxy redirect has been configured for the specified httpPort, then this method will return null. </p> @return the httpsPort associated with the proxy redirect for the specified host/httpPort. """ Integer httpsPort = null; synchronized (map) { if (httpPort == DEFAULT_HTTP_PORT && map.get(httpPort) == null) { // use default redirect of 80 to 443 httpsPort = DEFAULT_HTTPS_PORT; } else { Map<String, HttpProxyRedirect> redirectsForThisPort = map.get(httpPort); if (redirectsForThisPort != null) { HttpProxyRedirect hdr = redirectsForThisPort.get(host); if (hdr == null) { hdr = redirectsForThisPort.get(STAR); } if (hdr != null && hdr.enabled) { httpsPort = hdr.httpsPort; } } } } return httpsPort; }
java
public static Integer getRedirectPort(String host, int httpPort) { Integer httpsPort = null; synchronized (map) { if (httpPort == DEFAULT_HTTP_PORT && map.get(httpPort) == null) { // use default redirect of 80 to 443 httpsPort = DEFAULT_HTTPS_PORT; } else { Map<String, HttpProxyRedirect> redirectsForThisPort = map.get(httpPort); if (redirectsForThisPort != null) { HttpProxyRedirect hdr = redirectsForThisPort.get(host); if (hdr == null) { hdr = redirectsForThisPort.get(STAR); } if (hdr != null && hdr.enabled) { httpsPort = hdr.httpsPort; } } } } return httpsPort; }
[ "public", "static", "Integer", "getRedirectPort", "(", "String", "host", ",", "int", "httpPort", ")", "{", "Integer", "httpsPort", "=", "null", ";", "synchronized", "(", "map", ")", "{", "if", "(", "httpPort", "==", "DEFAULT_HTTP_PORT", "&&", "map", ".", "get", "(", "httpPort", ")", "==", "null", ")", "{", "// use default redirect of 80 to 443", "httpsPort", "=", "DEFAULT_HTTPS_PORT", ";", "}", "else", "{", "Map", "<", "String", ",", "HttpProxyRedirect", ">", "redirectsForThisPort", "=", "map", ".", "get", "(", "httpPort", ")", ";", "if", "(", "redirectsForThisPort", "!=", "null", ")", "{", "HttpProxyRedirect", "hdr", "=", "redirectsForThisPort", ".", "get", "(", "host", ")", ";", "if", "(", "hdr", "==", "null", ")", "{", "hdr", "=", "redirectsForThisPort", ".", "get", "(", "STAR", ")", ";", "}", "if", "(", "hdr", "!=", "null", "&&", "hdr", ".", "enabled", ")", "{", "httpsPort", "=", "hdr", ".", "httpsPort", ";", "}", "}", "}", "}", "return", "httpsPort", ";", "}" ]
<p> This method returns the secure port number to redirect to given the specified host and incoming (non-secure) port number. If a proxy redirect has been configured with the specified host and httpPort, the associated httpsPort will be returned. </p><p> If the specified httpPort has been configured but not with the specified host, then this method will return the httpsPort associated with a proxy redirect that has been configured with a wildcard if one exists (i.e. &lt;httpProxyRedirect host="*" .../&gt;). </p><p> If no proxy redirect has been configured for the specified httpPort, then this method will return null. </p> @return the httpsPort associated with the proxy redirect for the specified host/httpPort.
[ "<p", ">", "This", "method", "returns", "the", "secure", "port", "number", "to", "redirect", "to", "given", "the", "specified", "host", "and", "incoming", "(", "non", "-", "secure", ")", "port", "number", ".", "If", "a", "proxy", "redirect", "has", "been", "configured", "with", "the", "specified", "host", "and", "httpPort", "the", "associated", "httpsPort", "will", "be", "returned", ".", "<", "/", "p", ">", "<p", ">", "If", "the", "specified", "httpPort", "has", "been", "configured", "but", "not", "with", "the", "specified", "host", "then", "this", "method", "will", "return", "the", "httpsPort", "associated", "with", "a", "proxy", "redirect", "that", "has", "been", "configured", "with", "a", "wildcard", "if", "one", "exists", "(", "i", ".", "e", ".", "&lt", ";", "httpProxyRedirect", "host", "=", "*", "...", "/", "&gt", ";", ")", ".", "<", "/", "p", ">", "<p", ">", "If", "no", "proxy", "redirect", "has", "been", "configured", "for", "the", "specified", "httpPort", "then", "this", "method", "will", "return", "null", ".", "<", "/", "p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpProxyRedirect.java#L91-L111
graphhopper/graphhopper
core/src/main/java/com/graphhopper/reader/ReaderElement.java
ReaderElement.hasTag
public boolean hasTag(String key, String... values) { """ Check that a given tag has one of the specified values. If no values are given, just checks for presence of the tag """ Object value = properties.get(key); if (value == null) return false; // tag present, no values given: success if (values.length == 0) return true; for (String val : values) { if (val.equals(value)) return true; } return false; }
java
public boolean hasTag(String key, String... values) { Object value = properties.get(key); if (value == null) return false; // tag present, no values given: success if (values.length == 0) return true; for (String val : values) { if (val.equals(value)) return true; } return false; }
[ "public", "boolean", "hasTag", "(", "String", "key", ",", "String", "...", "values", ")", "{", "Object", "value", "=", "properties", ".", "get", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "return", "false", ";", "// tag present, no values given: success", "if", "(", "values", ".", "length", "==", "0", ")", "return", "true", ";", "for", "(", "String", "val", ":", "values", ")", "{", "if", "(", "val", ".", "equals", "(", "value", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
Check that a given tag has one of the specified values. If no values are given, just checks for presence of the tag
[ "Check", "that", "a", "given", "tag", "has", "one", "of", "the", "specified", "values", ".", "If", "no", "values", "are", "given", "just", "checks", "for", "presence", "of", "the", "tag" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/reader/ReaderElement.java#L113-L127
wisdom-framework/wisdom
core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java
AbstractRouter.getReverseRouteFor
@Override public String getReverseRouteFor(String className, String method) { """ Gets the url of the route handled by the specified action method. The action does not takes parameters. This implementation delegates to {@link #getReverseRouteFor(String, String, java.util.Map)}. @param className the controller class @param method the controller method @return the url, {@literal null} if the action method is not found """ return getReverseRouteFor(className, method, null); }
java
@Override public String getReverseRouteFor(String className, String method) { return getReverseRouteFor(className, method, null); }
[ "@", "Override", "public", "String", "getReverseRouteFor", "(", "String", "className", ",", "String", "method", ")", "{", "return", "getReverseRouteFor", "(", "className", ",", "method", ",", "null", ")", ";", "}" ]
Gets the url of the route handled by the specified action method. The action does not takes parameters. This implementation delegates to {@link #getReverseRouteFor(String, String, java.util.Map)}. @param className the controller class @param method the controller method @return the url, {@literal null} if the action method is not found
[ "Gets", "the", "url", "of", "the", "route", "handled", "by", "the", "specified", "action", "method", ".", "The", "action", "does", "not", "takes", "parameters", ".", "This", "implementation", "delegates", "to", "{", "@link", "#getReverseRouteFor", "(", "String", "String", "java", ".", "util", ".", "Map", ")", "}", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java#L101-L104
thorinii/lct
src/main/java/me/lachlanap/lct/data/ConstantFieldFactory.java
ConstantFieldFactory.createConstantField
public ConstantField createConstantField(Class<?> container, String field, Constant annot) throws ConstantException { """ Tries to create a ConstantField from a raw field. Cycles through all the providers until one is found that can satisfy. <p/> @param container the class enclosing the field @param field the name of the field @param annot the Constant annotation to extract constraints from @return the constructed ConstantField @throws ConstantException when the field cannot be found, or no provider is found """ Class<?> type; try { type = container.getField(field).getType(); } catch (NoSuchFieldException e) { throw new ConstantException("Cannot find constant " + annot.name() + " (" + container.getSimpleName() + "." + field + ")", e); } for (ConstantFieldProvider provider : providers) { if (provider.canProvide(type)) return provider.getField(type, container, field, annot); } throw new ConstantException("No provider found for " + annot.name() + " of type " + type.getSimpleName()); }
java
public ConstantField createConstantField(Class<?> container, String field, Constant annot) throws ConstantException { Class<?> type; try { type = container.getField(field).getType(); } catch (NoSuchFieldException e) { throw new ConstantException("Cannot find constant " + annot.name() + " (" + container.getSimpleName() + "." + field + ")", e); } for (ConstantFieldProvider provider : providers) { if (provider.canProvide(type)) return provider.getField(type, container, field, annot); } throw new ConstantException("No provider found for " + annot.name() + " of type " + type.getSimpleName()); }
[ "public", "ConstantField", "createConstantField", "(", "Class", "<", "?", ">", "container", ",", "String", "field", ",", "Constant", "annot", ")", "throws", "ConstantException", "{", "Class", "<", "?", ">", "type", ";", "try", "{", "type", "=", "container", ".", "getField", "(", "field", ")", ".", "getType", "(", ")", ";", "}", "catch", "(", "NoSuchFieldException", "e", ")", "{", "throw", "new", "ConstantException", "(", "\"Cannot find constant \"", "+", "annot", ".", "name", "(", ")", "+", "\" (\"", "+", "container", ".", "getSimpleName", "(", ")", "+", "\".\"", "+", "field", "+", "\")\"", ",", "e", ")", ";", "}", "for", "(", "ConstantFieldProvider", "provider", ":", "providers", ")", "{", "if", "(", "provider", ".", "canProvide", "(", "type", ")", ")", "return", "provider", ".", "getField", "(", "type", ",", "container", ",", "field", ",", "annot", ")", ";", "}", "throw", "new", "ConstantException", "(", "\"No provider found for \"", "+", "annot", ".", "name", "(", ")", "+", "\" of type \"", "+", "type", ".", "getSimpleName", "(", ")", ")", ";", "}" ]
Tries to create a ConstantField from a raw field. Cycles through all the providers until one is found that can satisfy. <p/> @param container the class enclosing the field @param field the name of the field @param annot the Constant annotation to extract constraints from @return the constructed ConstantField @throws ConstantException when the field cannot be found, or no provider is found
[ "Tries", "to", "create", "a", "ConstantField", "from", "a", "raw", "field", ".", "Cycles", "through", "all", "the", "providers", "until", "one", "is", "found", "that", "can", "satisfy", ".", "<p", "/", ">" ]
train
https://github.com/thorinii/lct/blob/83d9dd94aac1efec4815b5658faa395a081592dc/src/main/java/me/lachlanap/lct/data/ConstantFieldFactory.java#L42-L60
apache/incubator-gobblin
gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStore.java
SimpleHadoopFilesystemConfigStore.getDatasetDirForKey
private Path getDatasetDirForKey(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException { """ Retrieves the dataset dir on HDFS associated with the given {@link ConfigKeyPath} and the given version. This directory contains the {@link #MAIN_CONF_FILE_NAME} and {@link #INCLUDES_CONF_FILE_NAME} file, as well as any child datasets. """ String datasetFromConfigKey = getDatasetFromConfigKey(configKey); if (StringUtils.isBlank(datasetFromConfigKey)) { return getVersionRoot(version); } return new Path(getVersionRoot(version), datasetFromConfigKey); }
java
private Path getDatasetDirForKey(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException { String datasetFromConfigKey = getDatasetFromConfigKey(configKey); if (StringUtils.isBlank(datasetFromConfigKey)) { return getVersionRoot(version); } return new Path(getVersionRoot(version), datasetFromConfigKey); }
[ "private", "Path", "getDatasetDirForKey", "(", "ConfigKeyPath", "configKey", ",", "String", "version", ")", "throws", "VersionDoesNotExistException", "{", "String", "datasetFromConfigKey", "=", "getDatasetFromConfigKey", "(", "configKey", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "datasetFromConfigKey", ")", ")", "{", "return", "getVersionRoot", "(", "version", ")", ";", "}", "return", "new", "Path", "(", "getVersionRoot", "(", "version", ")", ",", "datasetFromConfigKey", ")", ";", "}" ]
Retrieves the dataset dir on HDFS associated with the given {@link ConfigKeyPath} and the given version. This directory contains the {@link #MAIN_CONF_FILE_NAME} and {@link #INCLUDES_CONF_FILE_NAME} file, as well as any child datasets.
[ "Retrieves", "the", "dataset", "dir", "on", "HDFS", "associated", "with", "the", "given", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStore.java#L375-L383
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/TieredBlockStore.java
TieredBlockStore.moveBlockInternal
private MoveBlockResult moveBlockInternal(long sessionId, long blockId, BlockStoreLocation oldLocation, BlockStoreLocation newLocation) throws BlockDoesNotExistException, BlockAlreadyExistsException, InvalidWorkerStateException, IOException { """ Moves a block to new location only if allocator finds available space in newLocation. This method will not trigger any eviction. Returns {@link MoveBlockResult}. @param sessionId session id @param blockId block id @param oldLocation the source location of the block @param newLocation new location to move this block @return the resulting information about the move operation @throws BlockDoesNotExistException if block is not found @throws BlockAlreadyExistsException if a block with same id already exists in new location @throws InvalidWorkerStateException if the block to move is a temp block """ long lockId = mLockManager.lockBlock(sessionId, blockId, BlockLockType.WRITE); try { long blockSize; String srcFilePath; String dstFilePath; BlockMeta srcBlockMeta; BlockStoreLocation srcLocation; BlockStoreLocation dstLocation; try (LockResource r = new LockResource(mMetadataReadLock)) { if (mMetaManager.hasTempBlockMeta(blockId)) { throw new InvalidWorkerStateException(ExceptionMessage.MOVE_UNCOMMITTED_BLOCK, blockId); } srcBlockMeta = mMetaManager.getBlockMeta(blockId); srcLocation = srcBlockMeta.getBlockLocation(); srcFilePath = srcBlockMeta.getPath(); blockSize = srcBlockMeta.getBlockSize(); } if (!srcLocation.belongsTo(oldLocation)) { throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_NOT_FOUND_AT_LOCATION, blockId, oldLocation); } TempBlockMeta dstTempBlock = createBlockMetaInternal(sessionId, blockId, newLocation, blockSize, false); if (dstTempBlock == null) { return new MoveBlockResult(false, blockSize, null, null); } // When `newLocation` is some specific location, the `newLocation` and the `dstLocation` are // just the same; while for `newLocation` with a wildcard significance, the `dstLocation` // is a specific one with specific tier and dir which belongs to newLocation. dstLocation = dstTempBlock.getBlockLocation(); // When the dstLocation belongs to srcLocation, simply abort the tempBlockMeta just created // internally from the newLocation and return success with specific block location. if (dstLocation.belongsTo(srcLocation)) { mMetaManager.abortTempBlockMeta(dstTempBlock); return new MoveBlockResult(true, blockSize, srcLocation, dstLocation); } dstFilePath = dstTempBlock.getCommitPath(); // Heavy IO is guarded by block lock but not metadata lock. This may throw IOException. FileUtils.move(srcFilePath, dstFilePath); try (LockResource r = new LockResource(mMetadataWriteLock)) { // If this metadata update fails, we panic for now. // TODO(bin): Implement rollback scheme to recover from IO failures. mMetaManager.moveBlockMeta(srcBlockMeta, dstTempBlock); } catch (BlockAlreadyExistsException | BlockDoesNotExistException | WorkerOutOfSpaceException e) { // WorkerOutOfSpaceException is only possible if session id gets cleaned between // createBlockMetaInternal and moveBlockMeta. throw Throwables.propagate(e); // we shall never reach here } return new MoveBlockResult(true, blockSize, srcLocation, dstLocation); } finally { mLockManager.unlockBlock(lockId); } }
java
private MoveBlockResult moveBlockInternal(long sessionId, long blockId, BlockStoreLocation oldLocation, BlockStoreLocation newLocation) throws BlockDoesNotExistException, BlockAlreadyExistsException, InvalidWorkerStateException, IOException { long lockId = mLockManager.lockBlock(sessionId, blockId, BlockLockType.WRITE); try { long blockSize; String srcFilePath; String dstFilePath; BlockMeta srcBlockMeta; BlockStoreLocation srcLocation; BlockStoreLocation dstLocation; try (LockResource r = new LockResource(mMetadataReadLock)) { if (mMetaManager.hasTempBlockMeta(blockId)) { throw new InvalidWorkerStateException(ExceptionMessage.MOVE_UNCOMMITTED_BLOCK, blockId); } srcBlockMeta = mMetaManager.getBlockMeta(blockId); srcLocation = srcBlockMeta.getBlockLocation(); srcFilePath = srcBlockMeta.getPath(); blockSize = srcBlockMeta.getBlockSize(); } if (!srcLocation.belongsTo(oldLocation)) { throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_NOT_FOUND_AT_LOCATION, blockId, oldLocation); } TempBlockMeta dstTempBlock = createBlockMetaInternal(sessionId, blockId, newLocation, blockSize, false); if (dstTempBlock == null) { return new MoveBlockResult(false, blockSize, null, null); } // When `newLocation` is some specific location, the `newLocation` and the `dstLocation` are // just the same; while for `newLocation` with a wildcard significance, the `dstLocation` // is a specific one with specific tier and dir which belongs to newLocation. dstLocation = dstTempBlock.getBlockLocation(); // When the dstLocation belongs to srcLocation, simply abort the tempBlockMeta just created // internally from the newLocation and return success with specific block location. if (dstLocation.belongsTo(srcLocation)) { mMetaManager.abortTempBlockMeta(dstTempBlock); return new MoveBlockResult(true, blockSize, srcLocation, dstLocation); } dstFilePath = dstTempBlock.getCommitPath(); // Heavy IO is guarded by block lock but not metadata lock. This may throw IOException. FileUtils.move(srcFilePath, dstFilePath); try (LockResource r = new LockResource(mMetadataWriteLock)) { // If this metadata update fails, we panic for now. // TODO(bin): Implement rollback scheme to recover from IO failures. mMetaManager.moveBlockMeta(srcBlockMeta, dstTempBlock); } catch (BlockAlreadyExistsException | BlockDoesNotExistException | WorkerOutOfSpaceException e) { // WorkerOutOfSpaceException is only possible if session id gets cleaned between // createBlockMetaInternal and moveBlockMeta. throw Throwables.propagate(e); // we shall never reach here } return new MoveBlockResult(true, blockSize, srcLocation, dstLocation); } finally { mLockManager.unlockBlock(lockId); } }
[ "private", "MoveBlockResult", "moveBlockInternal", "(", "long", "sessionId", ",", "long", "blockId", ",", "BlockStoreLocation", "oldLocation", ",", "BlockStoreLocation", "newLocation", ")", "throws", "BlockDoesNotExistException", ",", "BlockAlreadyExistsException", ",", "InvalidWorkerStateException", ",", "IOException", "{", "long", "lockId", "=", "mLockManager", ".", "lockBlock", "(", "sessionId", ",", "blockId", ",", "BlockLockType", ".", "WRITE", ")", ";", "try", "{", "long", "blockSize", ";", "String", "srcFilePath", ";", "String", "dstFilePath", ";", "BlockMeta", "srcBlockMeta", ";", "BlockStoreLocation", "srcLocation", ";", "BlockStoreLocation", "dstLocation", ";", "try", "(", "LockResource", "r", "=", "new", "LockResource", "(", "mMetadataReadLock", ")", ")", "{", "if", "(", "mMetaManager", ".", "hasTempBlockMeta", "(", "blockId", ")", ")", "{", "throw", "new", "InvalidWorkerStateException", "(", "ExceptionMessage", ".", "MOVE_UNCOMMITTED_BLOCK", ",", "blockId", ")", ";", "}", "srcBlockMeta", "=", "mMetaManager", ".", "getBlockMeta", "(", "blockId", ")", ";", "srcLocation", "=", "srcBlockMeta", ".", "getBlockLocation", "(", ")", ";", "srcFilePath", "=", "srcBlockMeta", ".", "getPath", "(", ")", ";", "blockSize", "=", "srcBlockMeta", ".", "getBlockSize", "(", ")", ";", "}", "if", "(", "!", "srcLocation", ".", "belongsTo", "(", "oldLocation", ")", ")", "{", "throw", "new", "BlockDoesNotExistException", "(", "ExceptionMessage", ".", "BLOCK_NOT_FOUND_AT_LOCATION", ",", "blockId", ",", "oldLocation", ")", ";", "}", "TempBlockMeta", "dstTempBlock", "=", "createBlockMetaInternal", "(", "sessionId", ",", "blockId", ",", "newLocation", ",", "blockSize", ",", "false", ")", ";", "if", "(", "dstTempBlock", "==", "null", ")", "{", "return", "new", "MoveBlockResult", "(", "false", ",", "blockSize", ",", "null", ",", "null", ")", ";", "}", "// When `newLocation` is some specific location, the `newLocation` and the `dstLocation` are", "// just the same; while for `newLocation` with a wildcard significance, the `dstLocation`", "// is a specific one with specific tier and dir which belongs to newLocation.", "dstLocation", "=", "dstTempBlock", ".", "getBlockLocation", "(", ")", ";", "// When the dstLocation belongs to srcLocation, simply abort the tempBlockMeta just created", "// internally from the newLocation and return success with specific block location.", "if", "(", "dstLocation", ".", "belongsTo", "(", "srcLocation", ")", ")", "{", "mMetaManager", ".", "abortTempBlockMeta", "(", "dstTempBlock", ")", ";", "return", "new", "MoveBlockResult", "(", "true", ",", "blockSize", ",", "srcLocation", ",", "dstLocation", ")", ";", "}", "dstFilePath", "=", "dstTempBlock", ".", "getCommitPath", "(", ")", ";", "// Heavy IO is guarded by block lock but not metadata lock. This may throw IOException.", "FileUtils", ".", "move", "(", "srcFilePath", ",", "dstFilePath", ")", ";", "try", "(", "LockResource", "r", "=", "new", "LockResource", "(", "mMetadataWriteLock", ")", ")", "{", "// If this metadata update fails, we panic for now.", "// TODO(bin): Implement rollback scheme to recover from IO failures.", "mMetaManager", ".", "moveBlockMeta", "(", "srcBlockMeta", ",", "dstTempBlock", ")", ";", "}", "catch", "(", "BlockAlreadyExistsException", "|", "BlockDoesNotExistException", "|", "WorkerOutOfSpaceException", "e", ")", "{", "// WorkerOutOfSpaceException is only possible if session id gets cleaned between", "// createBlockMetaInternal and moveBlockMeta.", "throw", "Throwables", ".", "propagate", "(", "e", ")", ";", "// we shall never reach here", "}", "return", "new", "MoveBlockResult", "(", "true", ",", "blockSize", ",", "srcLocation", ",", "dstLocation", ")", ";", "}", "finally", "{", "mLockManager", ".", "unlockBlock", "(", "lockId", ")", ";", "}", "}" ]
Moves a block to new location only if allocator finds available space in newLocation. This method will not trigger any eviction. Returns {@link MoveBlockResult}. @param sessionId session id @param blockId block id @param oldLocation the source location of the block @param newLocation new location to move this block @return the resulting information about the move operation @throws BlockDoesNotExistException if block is not found @throws BlockAlreadyExistsException if a block with same id already exists in new location @throws InvalidWorkerStateException if the block to move is a temp block
[ "Moves", "a", "block", "to", "new", "location", "only", "if", "allocator", "finds", "available", "space", "in", "newLocation", ".", "This", "method", "will", "not", "trigger", "any", "eviction", ".", "Returns", "{", "@link", "MoveBlockResult", "}", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/TieredBlockStore.java#L813-L877
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/ColumnText.java
ColumnText.setSimpleColumn
public void setSimpleColumn(float llx, float lly, float urx, float ury, float leading, int alignment) { """ Simplified method for rectangular columns. @param llx the lower left x corner @param lly the lower left y corner @param urx the upper right x corner @param ury the upper right y corner @param leading the leading @param alignment the column alignment """ setLeading(leading); this.alignment = alignment; setSimpleColumn(llx, lly, urx, ury); }
java
public void setSimpleColumn(float llx, float lly, float urx, float ury, float leading, int alignment) { setLeading(leading); this.alignment = alignment; setSimpleColumn(llx, lly, urx, ury); }
[ "public", "void", "setSimpleColumn", "(", "float", "llx", ",", "float", "lly", ",", "float", "urx", ",", "float", "ury", ",", "float", "leading", ",", "int", "alignment", ")", "{", "setLeading", "(", "leading", ")", ";", "this", ".", "alignment", "=", "alignment", ";", "setSimpleColumn", "(", "llx", ",", "lly", ",", "urx", ",", "ury", ")", ";", "}" ]
Simplified method for rectangular columns. @param llx the lower left x corner @param lly the lower left y corner @param urx the upper right x corner @param ury the upper right y corner @param leading the leading @param alignment the column alignment
[ "Simplified", "method", "for", "rectangular", "columns", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/ColumnText.java#L624-L628
EvidentSolutions/dalesbred
dalesbred/src/main/java/org/dalesbred/Database.java
Database.findTable
public @NotNull ResultTable findTable(@NotNull @SQL String sql, Object... args) { """ Executes a query and creates a {@link ResultTable} from the results. """ return findTable(SqlQuery.query(sql, args)); }
java
public @NotNull ResultTable findTable(@NotNull @SQL String sql, Object... args) { return findTable(SqlQuery.query(sql, args)); }
[ "public", "@", "NotNull", "ResultTable", "findTable", "(", "@", "NotNull", "@", "SQL", "String", "sql", ",", "Object", "...", "args", ")", "{", "return", "findTable", "(", "SqlQuery", ".", "query", "(", "sql", ",", "args", ")", ")", ";", "}" ]
Executes a query and creates a {@link ResultTable} from the results.
[ "Executes", "a", "query", "and", "creates", "a", "{" ]
train
https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L592-L594
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Assert.java
Assert.notEmpty
public static <T> Collection<T> notEmpty(Collection<T> collection, String errorMsgTemplate, Object... params) throws IllegalArgumentException { """ 断言给定集合非空 <pre class="code"> Assert.notEmpty(collection, "Collection must have elements"); </pre> @param <T> 集合元素类型 @param collection 被检查的集合 @param errorMsgTemplate 异常时的消息模板 @param params 参数列表 @return 非空集合 @throws IllegalArgumentException if the collection is {@code null} or has no elements """ if (CollectionUtil.isEmpty(collection)) { throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params)); } return collection; }
java
public static <T> Collection<T> notEmpty(Collection<T> collection, String errorMsgTemplate, Object... params) throws IllegalArgumentException { if (CollectionUtil.isEmpty(collection)) { throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params)); } return collection; }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "notEmpty", "(", "Collection", "<", "T", ">", "collection", ",", "String", "errorMsgTemplate", ",", "Object", "...", "params", ")", "throws", "IllegalArgumentException", "{", "if", "(", "CollectionUtil", ".", "isEmpty", "(", "collection", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "StrUtil", ".", "format", "(", "errorMsgTemplate", ",", "params", ")", ")", ";", "}", "return", "collection", ";", "}" ]
断言给定集合非空 <pre class="code"> Assert.notEmpty(collection, "Collection must have elements"); </pre> @param <T> 集合元素类型 @param collection 被检查的集合 @param errorMsgTemplate 异常时的消息模板 @param params 参数列表 @return 非空集合 @throws IllegalArgumentException if the collection is {@code null} or has no elements
[ "断言给定集合非空" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L351-L356
michel-kraemer/citeproc-java
citeproc-java/src/main/java/de/undercouch/citeproc/CSL.java
CSL.setConvertLinks
public void setConvertLinks(boolean convert) { """ Specifies if the processor should convert URLs and DOIs in the output to links. How links are created depends on the output format that has been set with {@link #setOutputFormat(String)} @param convert true if URLs and DOIs should be converted to links """ try { runner.callMethod("setConvertLinks", engine, convert); } catch (ScriptRunnerException e) { throw new IllegalArgumentException("Could not set option", e); } }
java
public void setConvertLinks(boolean convert) { try { runner.callMethod("setConvertLinks", engine, convert); } catch (ScriptRunnerException e) { throw new IllegalArgumentException("Could not set option", e); } }
[ "public", "void", "setConvertLinks", "(", "boolean", "convert", ")", "{", "try", "{", "runner", ".", "callMethod", "(", "\"setConvertLinks\"", ",", "engine", ",", "convert", ")", ";", "}", "catch", "(", "ScriptRunnerException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not set option\"", ",", "e", ")", ";", "}", "}" ]
Specifies if the processor should convert URLs and DOIs in the output to links. How links are created depends on the output format that has been set with {@link #setOutputFormat(String)} @param convert true if URLs and DOIs should be converted to links
[ "Specifies", "if", "the", "processor", "should", "convert", "URLs", "and", "DOIs", "in", "the", "output", "to", "links", ".", "How", "links", "are", "created", "depends", "on", "the", "output", "format", "that", "has", "been", "set", "with", "{" ]
train
https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/CSL.java#L579-L585
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/expressions/Expressions.java
Expressions.isEqual
public static BooleanIsEqual isEqual(BooleanExpression left, Object constant) { """ Creates an IsEqual expression from the given expression and constant. @param left The left expression. @param constant The constant to compare to (must be a Boolean). @throws IllegalArgumentException If constant is not a Boolean. @return A new IsEqual binary expression. """ if (!(constant instanceof Boolean)) throw new IllegalArgumentException("constant is not a Boolean"); return new BooleanIsEqual(left, constant((Boolean)constant)); }
java
public static BooleanIsEqual isEqual(BooleanExpression left, Object constant) { if (!(constant instanceof Boolean)) throw new IllegalArgumentException("constant is not a Boolean"); return new BooleanIsEqual(left, constant((Boolean)constant)); }
[ "public", "static", "BooleanIsEqual", "isEqual", "(", "BooleanExpression", "left", ",", "Object", "constant", ")", "{", "if", "(", "!", "(", "constant", "instanceof", "Boolean", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"constant is not a Boolean\"", ")", ";", "return", "new", "BooleanIsEqual", "(", "left", ",", "constant", "(", "(", "Boolean", ")", "constant", ")", ")", ";", "}" ]
Creates an IsEqual expression from the given expression and constant. @param left The left expression. @param constant The constant to compare to (must be a Boolean). @throws IllegalArgumentException If constant is not a Boolean. @return A new IsEqual binary expression.
[ "Creates", "an", "IsEqual", "expression", "from", "the", "given", "expression", "and", "constant", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L198-L204
Stratio/stratio-cassandra
src/java/org/apache/cassandra/cli/CliClient.java
CliClient.showColumnMeta
private void showColumnMeta(PrintStream output, CfDef cfDef, ColumnDef colDef) { """ Writes the supplied ColumnDef to the StringBuilder as a cli script. @param output The File to write to. @param cfDef The CfDef as a source for comparator/validator @param colDef The Column Definition to export """ output.append(NEWLINE + TAB + TAB + "{"); final AbstractType<?> comparator = getFormatType(cfDef.column_type.equals("Super") ? cfDef.subcomparator_type : cfDef.comparator_type); output.append("column_name : '" + CliUtils.escapeSQLString(comparator.getString(colDef.name)) + "'," + NEWLINE); String validationClass = normaliseType(colDef.validation_class, "org.apache.cassandra.db.marshal"); output.append(TAB + TAB + "validation_class : " + CliUtils.escapeSQLString(validationClass)); if (colDef.isSetIndex_name()) { output.append(",").append(NEWLINE) .append(TAB + TAB + "index_name : '" + CliUtils.escapeSQLString(colDef.index_name) + "'," + NEWLINE) .append(TAB + TAB + "index_type : " + CliUtils.escapeSQLString(Integer.toString(colDef.index_type.getValue()))); if (colDef.index_options != null && !colDef.index_options.isEmpty()) { output.append(",").append(NEWLINE); output.append(TAB + TAB + "index_options : {" + NEWLINE); int numOpts = colDef.index_options.size(); for (Map.Entry<String, String> entry : colDef.index_options.entrySet()) { String option = CliUtils.escapeSQLString(entry.getKey()); String optionValue = CliUtils.escapeSQLString(entry.getValue()); output.append(TAB + TAB + TAB) .append("'" + option + "' : '") .append(optionValue) .append("'"); if (--numOpts > 0) output.append(",").append(NEWLINE); } output.append("}"); } } output.append("}"); }
java
private void showColumnMeta(PrintStream output, CfDef cfDef, ColumnDef colDef) { output.append(NEWLINE + TAB + TAB + "{"); final AbstractType<?> comparator = getFormatType(cfDef.column_type.equals("Super") ? cfDef.subcomparator_type : cfDef.comparator_type); output.append("column_name : '" + CliUtils.escapeSQLString(comparator.getString(colDef.name)) + "'," + NEWLINE); String validationClass = normaliseType(colDef.validation_class, "org.apache.cassandra.db.marshal"); output.append(TAB + TAB + "validation_class : " + CliUtils.escapeSQLString(validationClass)); if (colDef.isSetIndex_name()) { output.append(",").append(NEWLINE) .append(TAB + TAB + "index_name : '" + CliUtils.escapeSQLString(colDef.index_name) + "'," + NEWLINE) .append(TAB + TAB + "index_type : " + CliUtils.escapeSQLString(Integer.toString(colDef.index_type.getValue()))); if (colDef.index_options != null && !colDef.index_options.isEmpty()) { output.append(",").append(NEWLINE); output.append(TAB + TAB + "index_options : {" + NEWLINE); int numOpts = colDef.index_options.size(); for (Map.Entry<String, String> entry : colDef.index_options.entrySet()) { String option = CliUtils.escapeSQLString(entry.getKey()); String optionValue = CliUtils.escapeSQLString(entry.getValue()); output.append(TAB + TAB + TAB) .append("'" + option + "' : '") .append(optionValue) .append("'"); if (--numOpts > 0) output.append(",").append(NEWLINE); } output.append("}"); } } output.append("}"); }
[ "private", "void", "showColumnMeta", "(", "PrintStream", "output", ",", "CfDef", "cfDef", ",", "ColumnDef", "colDef", ")", "{", "output", ".", "append", "(", "NEWLINE", "+", "TAB", "+", "TAB", "+", "\"{\"", ")", ";", "final", "AbstractType", "<", "?", ">", "comparator", "=", "getFormatType", "(", "cfDef", ".", "column_type", ".", "equals", "(", "\"Super\"", ")", "?", "cfDef", ".", "subcomparator_type", ":", "cfDef", ".", "comparator_type", ")", ";", "output", ".", "append", "(", "\"column_name : '\"", "+", "CliUtils", ".", "escapeSQLString", "(", "comparator", ".", "getString", "(", "colDef", ".", "name", ")", ")", "+", "\"',\"", "+", "NEWLINE", ")", ";", "String", "validationClass", "=", "normaliseType", "(", "colDef", ".", "validation_class", ",", "\"org.apache.cassandra.db.marshal\"", ")", ";", "output", ".", "append", "(", "TAB", "+", "TAB", "+", "\"validation_class : \"", "+", "CliUtils", ".", "escapeSQLString", "(", "validationClass", ")", ")", ";", "if", "(", "colDef", ".", "isSetIndex_name", "(", ")", ")", "{", "output", ".", "append", "(", "\",\"", ")", ".", "append", "(", "NEWLINE", ")", ".", "append", "(", "TAB", "+", "TAB", "+", "\"index_name : '\"", "+", "CliUtils", ".", "escapeSQLString", "(", "colDef", ".", "index_name", ")", "+", "\"',\"", "+", "NEWLINE", ")", ".", "append", "(", "TAB", "+", "TAB", "+", "\"index_type : \"", "+", "CliUtils", ".", "escapeSQLString", "(", "Integer", ".", "toString", "(", "colDef", ".", "index_type", ".", "getValue", "(", ")", ")", ")", ")", ";", "if", "(", "colDef", ".", "index_options", "!=", "null", "&&", "!", "colDef", ".", "index_options", ".", "isEmpty", "(", ")", ")", "{", "output", ".", "append", "(", "\",\"", ")", ".", "append", "(", "NEWLINE", ")", ";", "output", ".", "append", "(", "TAB", "+", "TAB", "+", "\"index_options : {\"", "+", "NEWLINE", ")", ";", "int", "numOpts", "=", "colDef", ".", "index_options", ".", "size", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "colDef", ".", "index_options", ".", "entrySet", "(", ")", ")", "{", "String", "option", "=", "CliUtils", ".", "escapeSQLString", "(", "entry", ".", "getKey", "(", ")", ")", ";", "String", "optionValue", "=", "CliUtils", ".", "escapeSQLString", "(", "entry", ".", "getValue", "(", ")", ")", ";", "output", ".", "append", "(", "TAB", "+", "TAB", "+", "TAB", ")", ".", "append", "(", "\"'\"", "+", "option", "+", "\"' : '\"", ")", ".", "append", "(", "optionValue", ")", ".", "append", "(", "\"'\"", ")", ";", "if", "(", "--", "numOpts", ">", "0", ")", "output", ".", "append", "(", "\",\"", ")", ".", "append", "(", "NEWLINE", ")", ";", "}", "output", ".", "append", "(", "\"}\"", ")", ";", "}", "}", "output", ".", "append", "(", "\"}\"", ")", ";", "}" ]
Writes the supplied ColumnDef to the StringBuilder as a cli script. @param output The File to write to. @param cfDef The CfDef as a source for comparator/validator @param colDef The Column Definition to export
[ "Writes", "the", "supplied", "ColumnDef", "to", "the", "StringBuilder", "as", "a", "cli", "script", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L1917-L1955
bazaarvoice/emodb
sor-client-common/src/main/java/com/bazaarvoice/emodb/sor/client/DataStoreStreaming.java
DataStoreStreaming.updateAll
public static void updateAll(DataStore dataStore, Iterable<Update> updates) { """ Creates, updates or deletes zero or more pieces of content in the data store. """ updateAll(dataStore, updates.iterator(), ImmutableSet.<String>of()); }
java
public static void updateAll(DataStore dataStore, Iterable<Update> updates) { updateAll(dataStore, updates.iterator(), ImmutableSet.<String>of()); }
[ "public", "static", "void", "updateAll", "(", "DataStore", "dataStore", ",", "Iterable", "<", "Update", ">", "updates", ")", "{", "updateAll", "(", "dataStore", ",", "updates", ".", "iterator", "(", ")", ",", "ImmutableSet", ".", "<", "String", ">", "of", "(", ")", ")", ";", "}" ]
Creates, updates or deletes zero or more pieces of content in the data store.
[ "Creates", "updates", "or", "deletes", "zero", "or", "more", "pieces", "of", "content", "in", "the", "data", "store", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor-client-common/src/main/java/com/bazaarvoice/emodb/sor/client/DataStoreStreaming.java#L135-L137
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/AccountsApi.java
AccountsApi.getPermissionProfile
public PermissionProfile getPermissionProfile(String accountId, String permissionProfileId) throws ApiException { """ Returns a permissions profile in the specified account. @param accountId The external account number (int) or account ID Guid. (required) @param permissionProfileId (required) @return PermissionProfile """ return getPermissionProfile(accountId, permissionProfileId, null); }
java
public PermissionProfile getPermissionProfile(String accountId, String permissionProfileId) throws ApiException { return getPermissionProfile(accountId, permissionProfileId, null); }
[ "public", "PermissionProfile", "getPermissionProfile", "(", "String", "accountId", ",", "String", "permissionProfileId", ")", "throws", "ApiException", "{", "return", "getPermissionProfile", "(", "accountId", ",", "permissionProfileId", ",", "null", ")", ";", "}" ]
Returns a permissions profile in the specified account. @param accountId The external account number (int) or account ID Guid. (required) @param permissionProfileId (required) @return PermissionProfile
[ "Returns", "a", "permissions", "profile", "in", "the", "specified", "account", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L1631-L1633
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/js/CollectingJSCodeProvider.java
CollectingJSCodeProvider.addFlattenedAt
@Nonnull public CollectingJSCodeProvider addFlattenedAt (@Nonnegative final int nIndex, @Nullable final IHasJSCode aProvider) { """ Add JS code at the specified index but unwrapping any {@link CollectingJSCodeProvider} instances. @param nIndex The index where the element should be added. Should be &ge; 0. @param aProvider The JS code provider to be added. May be <code>null</code>. @return this for chaining """ if (aProvider != null) if (aProvider instanceof CollectingJSCodeProvider) m_aList.addAll (nIndex, ((CollectingJSCodeProvider) aProvider).m_aList); else m_aList.add (nIndex, aProvider); return this; }
java
@Nonnull public CollectingJSCodeProvider addFlattenedAt (@Nonnegative final int nIndex, @Nullable final IHasJSCode aProvider) { if (aProvider != null) if (aProvider instanceof CollectingJSCodeProvider) m_aList.addAll (nIndex, ((CollectingJSCodeProvider) aProvider).m_aList); else m_aList.add (nIndex, aProvider); return this; }
[ "@", "Nonnull", "public", "CollectingJSCodeProvider", "addFlattenedAt", "(", "@", "Nonnegative", "final", "int", "nIndex", ",", "@", "Nullable", "final", "IHasJSCode", "aProvider", ")", "{", "if", "(", "aProvider", "!=", "null", ")", "if", "(", "aProvider", "instanceof", "CollectingJSCodeProvider", ")", "m_aList", ".", "addAll", "(", "nIndex", ",", "(", "(", "CollectingJSCodeProvider", ")", "aProvider", ")", ".", "m_aList", ")", ";", "else", "m_aList", ".", "add", "(", "nIndex", ",", "aProvider", ")", ";", "return", "this", ";", "}" ]
Add JS code at the specified index but unwrapping any {@link CollectingJSCodeProvider} instances. @param nIndex The index where the element should be added. Should be &ge; 0. @param aProvider The JS code provider to be added. May be <code>null</code>. @return this for chaining
[ "Add", "JS", "code", "at", "the", "specified", "index", "but", "unwrapping", "any", "{", "@link", "CollectingJSCodeProvider", "}", "instances", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/CollectingJSCodeProvider.java#L113-L122
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ChainerServlet.java
ChainerServlet.service
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { """ Handle a servlet request by chaining the configured list of servlets. Only the final response in the chain will be sent back to the client. This servlet does not actual generate any content. This servlet only constructs and processes the servlet chain. @param req HttpServletRequest @param resp HttpServletResponse @exception javax.servlet.ServletException @exception java.io.IOException """ // Method re-written for PQ47469 ServletChain chain = new ServletChain(); try { String path = null; for (int index = 0; index < this.chainPath.length; ++index) { path = this.chainPath[index]; RequestDispatcher rDispatcher = getServletContext().getRequestDispatcher(path); chain.addRequestDispatcher(rDispatcher); } chain.forward(new HttpServletRequestWrapper(request), new HttpServletResponseWrapper(response)); } finally { if (chain != null) { chain.clear(); } } }
java
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Method re-written for PQ47469 ServletChain chain = new ServletChain(); try { String path = null; for (int index = 0; index < this.chainPath.length; ++index) { path = this.chainPath[index]; RequestDispatcher rDispatcher = getServletContext().getRequestDispatcher(path); chain.addRequestDispatcher(rDispatcher); } chain.forward(new HttpServletRequestWrapper(request), new HttpServletResponseWrapper(response)); } finally { if (chain != null) { chain.clear(); } } }
[ "public", "void", "service", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "// Method re-written for PQ47469", "ServletChain", "chain", "=", "new", "ServletChain", "(", ")", ";", "try", "{", "String", "path", "=", "null", ";", "for", "(", "int", "index", "=", "0", ";", "index", "<", "this", ".", "chainPath", ".", "length", ";", "++", "index", ")", "{", "path", "=", "this", ".", "chainPath", "[", "index", "]", ";", "RequestDispatcher", "rDispatcher", "=", "getServletContext", "(", ")", ".", "getRequestDispatcher", "(", "path", ")", ";", "chain", ".", "addRequestDispatcher", "(", "rDispatcher", ")", ";", "}", "chain", ".", "forward", "(", "new", "HttpServletRequestWrapper", "(", "request", ")", ",", "new", "HttpServletResponseWrapper", "(", "response", ")", ")", ";", "}", "finally", "{", "if", "(", "chain", "!=", "null", ")", "{", "chain", ".", "clear", "(", ")", ";", "}", "}", "}" ]
Handle a servlet request by chaining the configured list of servlets. Only the final response in the chain will be sent back to the client. This servlet does not actual generate any content. This servlet only constructs and processes the servlet chain. @param req HttpServletRequest @param resp HttpServletResponse @exception javax.servlet.ServletException @exception java.io.IOException
[ "Handle", "a", "servlet", "request", "by", "chaining", "the", "configured", "list", "of", "servlets", ".", "Only", "the", "final", "response", "in", "the", "chain", "will", "be", "sent", "back", "to", "the", "client", ".", "This", "servlet", "does", "not", "actual", "generate", "any", "content", ".", "This", "servlet", "only", "constructs", "and", "processes", "the", "servlet", "chain", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ChainerServlet.java#L127-L146
ehcache/ehcache3
impl/src/main/java/org/ehcache/config/builders/CacheManagerBuilder.java
CacheManagerBuilder.withDefaultSizeOfMaxObjectGraph
public CacheManagerBuilder<T> withDefaultSizeOfMaxObjectGraph(long size) { """ Adds a default {@link SizeOfEngine} configuration, that limits the max object graph to size, to the returned builder. @param size the max object graph size @return a new builder with the added configuration """ DefaultSizeOfEngineProviderConfiguration configuration = configBuilder.findServiceByClass(DefaultSizeOfEngineProviderConfiguration.class); if (configuration == null) { return new CacheManagerBuilder<>(this, configBuilder.addService(new DefaultSizeOfEngineProviderConfiguration(DEFAULT_MAX_OBJECT_SIZE, DEFAULT_UNIT, size))); } else { ConfigurationBuilder builder = configBuilder.removeService(configuration); return new CacheManagerBuilder<>(this, builder.addService(new DefaultSizeOfEngineProviderConfiguration(configuration .getMaxObjectSize(), configuration.getUnit(), size))); } }
java
public CacheManagerBuilder<T> withDefaultSizeOfMaxObjectGraph(long size) { DefaultSizeOfEngineProviderConfiguration configuration = configBuilder.findServiceByClass(DefaultSizeOfEngineProviderConfiguration.class); if (configuration == null) { return new CacheManagerBuilder<>(this, configBuilder.addService(new DefaultSizeOfEngineProviderConfiguration(DEFAULT_MAX_OBJECT_SIZE, DEFAULT_UNIT, size))); } else { ConfigurationBuilder builder = configBuilder.removeService(configuration); return new CacheManagerBuilder<>(this, builder.addService(new DefaultSizeOfEngineProviderConfiguration(configuration .getMaxObjectSize(), configuration.getUnit(), size))); } }
[ "public", "CacheManagerBuilder", "<", "T", ">", "withDefaultSizeOfMaxObjectGraph", "(", "long", "size", ")", "{", "DefaultSizeOfEngineProviderConfiguration", "configuration", "=", "configBuilder", ".", "findServiceByClass", "(", "DefaultSizeOfEngineProviderConfiguration", ".", "class", ")", ";", "if", "(", "configuration", "==", "null", ")", "{", "return", "new", "CacheManagerBuilder", "<>", "(", "this", ",", "configBuilder", ".", "addService", "(", "new", "DefaultSizeOfEngineProviderConfiguration", "(", "DEFAULT_MAX_OBJECT_SIZE", ",", "DEFAULT_UNIT", ",", "size", ")", ")", ")", ";", "}", "else", "{", "ConfigurationBuilder", "builder", "=", "configBuilder", ".", "removeService", "(", "configuration", ")", ";", "return", "new", "CacheManagerBuilder", "<>", "(", "this", ",", "builder", ".", "addService", "(", "new", "DefaultSizeOfEngineProviderConfiguration", "(", "configuration", ".", "getMaxObjectSize", "(", ")", ",", "configuration", ".", "getUnit", "(", ")", ",", "size", ")", ")", ")", ";", "}", "}" ]
Adds a default {@link SizeOfEngine} configuration, that limits the max object graph to size, to the returned builder. @param size the max object graph size @return a new builder with the added configuration
[ "Adds", "a", "default", "{", "@link", "SizeOfEngine", "}", "configuration", "that", "limits", "the", "max", "object", "graph", "to", "size", "to", "the", "returned", "builder", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheManagerBuilder.java#L246-L255
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java
ModelSerializer.writeModel
public static void writeModel(@NonNull Model model, @NonNull File file, boolean saveUpdater) throws IOException { """ Write a model to a file @param model the model to write @param file the file to write to @param saveUpdater whether to save the updater or not @throws IOException """ writeModel(model,file,saveUpdater,null); }
java
public static void writeModel(@NonNull Model model, @NonNull File file, boolean saveUpdater) throws IOException { writeModel(model,file,saveUpdater,null); }
[ "public", "static", "void", "writeModel", "(", "@", "NonNull", "Model", "model", ",", "@", "NonNull", "File", "file", ",", "boolean", "saveUpdater", ")", "throws", "IOException", "{", "writeModel", "(", "model", ",", "file", ",", "saveUpdater", ",", "null", ")", ";", "}" ]
Write a model to a file @param model the model to write @param file the file to write to @param saveUpdater whether to save the updater or not @throws IOException
[ "Write", "a", "model", "to", "a", "file" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L75-L77
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/BlankSpan.java
BlankSpan.putAttribute
@Override public void putAttribute(String key, AttributeValue value) { """ No-op implementation of the {@link Span#putAttribute(String, AttributeValue)} method. """ Utils.checkNotNull(key, "key"); Utils.checkNotNull(value, "value"); }
java
@Override public void putAttribute(String key, AttributeValue value) { Utils.checkNotNull(key, "key"); Utils.checkNotNull(value, "value"); }
[ "@", "Override", "public", "void", "putAttribute", "(", "String", "key", ",", "AttributeValue", "value", ")", "{", "Utils", ".", "checkNotNull", "(", "key", ",", "\"key\"", ")", ";", "Utils", ".", "checkNotNull", "(", "value", ",", "\"value\"", ")", ";", "}" ]
No-op implementation of the {@link Span#putAttribute(String, AttributeValue)} method.
[ "No", "-", "op", "implementation", "of", "the", "{" ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/BlankSpan.java#L45-L49
kkopacz/agiso-tempel
bundles/tempel-core/src/main/java/org/agiso/tempel/core/DefaultTemplateExecutor.java
DefaultTemplateExecutor.processParam
private Object processParam(TemplateParam<?, ?, ?> param, Map<String, Object> params, Template<?> template) { """ Przetwarzanie warości parametru (pobieranie, konwersja i walidacja) @param param @param params @param template @return """ Object value = fetchParamValue(param, params, param.getFetcher()); value = convertParamValue(value, param.getType(), param.getConverter()); validateParamValue(value, param.getValidator()); return value; }
java
private Object processParam(TemplateParam<?, ?, ?> param, Map<String, Object> params, Template<?> template) { Object value = fetchParamValue(param, params, param.getFetcher()); value = convertParamValue(value, param.getType(), param.getConverter()); validateParamValue(value, param.getValidator()); return value; }
[ "private", "Object", "processParam", "(", "TemplateParam", "<", "?", ",", "?", ",", "?", ">", "param", ",", "Map", "<", "String", ",", "Object", ">", "params", ",", "Template", "<", "?", ">", "template", ")", "{", "Object", "value", "=", "fetchParamValue", "(", "param", ",", "params", ",", "param", ".", "getFetcher", "(", ")", ")", ";", "value", "=", "convertParamValue", "(", "value", ",", "param", ".", "getType", "(", ")", ",", "param", ".", "getConverter", "(", ")", ")", ";", "validateParamValue", "(", "value", ",", "param", ".", "getValidator", "(", ")", ")", ";", "return", "value", ";", "}" ]
Przetwarzanie warości parametru (pobieranie, konwersja i walidacja) @param param @param params @param template @return
[ "Przetwarzanie", "warości", "parametru", "(", "pobieranie", "konwersja", "i", "walidacja", ")" ]
train
https://github.com/kkopacz/agiso-tempel/blob/ff7a96153153b6bc07212d776816b87d9538f6fa/bundles/tempel-core/src/main/java/org/agiso/tempel/core/DefaultTemplateExecutor.java#L384-L389
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.stripIndent
public static String stripIndent(CharSequence self, int numChars) { """ Strip <tt>numChar</tt> leading characters from every line in a CharSequence. <pre class="groovyTestCase"> assert 'DEF\n456' == '''ABCDEF\n123456'''.stripIndent(3) </pre> @param self The CharSequence to strip the characters from @param numChars The number of characters to strip @return the stripped String @since 1.8.2 """ String s = self.toString(); if (s.length() == 0 || numChars <= 0) return s; try { StringBuilder builder = new StringBuilder(); for (String line : readLines((CharSequence) s)) { // normalize an empty or whitespace line to \n // or strip the indent for lines containing non-space characters if (!isAllWhitespace((CharSequence) line)) { builder.append(stripIndentFromLine(line, numChars)); } builder.append("\n"); } // remove the normalized ending line ending if it was not present if (!s.endsWith("\n")) { builder.deleteCharAt(builder.length() - 1); } return builder.toString(); } catch (IOException e) { /* ignore */ } return s; }
java
public static String stripIndent(CharSequence self, int numChars) { String s = self.toString(); if (s.length() == 0 || numChars <= 0) return s; try { StringBuilder builder = new StringBuilder(); for (String line : readLines((CharSequence) s)) { // normalize an empty or whitespace line to \n // or strip the indent for lines containing non-space characters if (!isAllWhitespace((CharSequence) line)) { builder.append(stripIndentFromLine(line, numChars)); } builder.append("\n"); } // remove the normalized ending line ending if it was not present if (!s.endsWith("\n")) { builder.deleteCharAt(builder.length() - 1); } return builder.toString(); } catch (IOException e) { /* ignore */ } return s; }
[ "public", "static", "String", "stripIndent", "(", "CharSequence", "self", ",", "int", "numChars", ")", "{", "String", "s", "=", "self", ".", "toString", "(", ")", ";", "if", "(", "s", ".", "length", "(", ")", "==", "0", "||", "numChars", "<=", "0", ")", "return", "s", ";", "try", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "line", ":", "readLines", "(", "(", "CharSequence", ")", "s", ")", ")", "{", "// normalize an empty or whitespace line to \\n", "// or strip the indent for lines containing non-space characters", "if", "(", "!", "isAllWhitespace", "(", "(", "CharSequence", ")", "line", ")", ")", "{", "builder", ".", "append", "(", "stripIndentFromLine", "(", "line", ",", "numChars", ")", ")", ";", "}", "builder", ".", "append", "(", "\"\\n\"", ")", ";", "}", "// remove the normalized ending line ending if it was not present", "if", "(", "!", "s", ".", "endsWith", "(", "\"\\n\"", ")", ")", "{", "builder", ".", "deleteCharAt", "(", "builder", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "builder", ".", "toString", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "/* ignore */", "}", "return", "s", ";", "}" ]
Strip <tt>numChar</tt> leading characters from every line in a CharSequence. <pre class="groovyTestCase"> assert 'DEF\n456' == '''ABCDEF\n123456'''.stripIndent(3) </pre> @param self The CharSequence to strip the characters from @param numChars The number of characters to strip @return the stripped String @since 1.8.2
[ "Strip", "<tt", ">", "numChar<", "/", "tt", ">", "leading", "characters", "from", "every", "line", "in", "a", "CharSequence", ".", "<pre", "class", "=", "groovyTestCase", ">", "assert", "DEF", "\\", "n456", "==", "ABCDEF", "\\", "n123456", ".", "stripIndent", "(", "3", ")", "<", "/", "pre", ">" ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2973-L2995
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/jackson/MultiPointSerializer.java
MultiPointSerializer.writeShapeSpecificSerialization
@Override public void writeShapeSpecificSerialization(MultiPoint value, JsonGenerator jgen, SerializerProvider provider) throws IOException { """ Method that can be called to ask implementation to serialize values of type this serializer handles. @param value Value to serialize; can not be null. @param jgen Generator used to output resulting Json content @param provider Provider that can be used to get serializers for serializing Objects value contains, if any. @throws java.io.IOException If serialization failed. """ jgen.writeFieldName( "type"); jgen.writeString( "MultiPoint"); jgen.writeArrayFieldStart( "coordinates"); // set beanproperty to null since we are not serializing a real property JsonSerializer<Object> ser = provider.findValueSerializer(Float.class, null); for (int i = 0; i < value.getNumGeometries(); i++) { Point pnt = value.getGeometryN(i); jgen.writeStartArray(); ser.serialize( (float) pnt.getX(), jgen, provider); ser.serialize( (float) pnt.getY(), jgen, provider); jgen.writeEndArray(); } jgen.writeEndArray(); }
java
@Override public void writeShapeSpecificSerialization(MultiPoint value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeFieldName( "type"); jgen.writeString( "MultiPoint"); jgen.writeArrayFieldStart( "coordinates"); // set beanproperty to null since we are not serializing a real property JsonSerializer<Object> ser = provider.findValueSerializer(Float.class, null); for (int i = 0; i < value.getNumGeometries(); i++) { Point pnt = value.getGeometryN(i); jgen.writeStartArray(); ser.serialize( (float) pnt.getX(), jgen, provider); ser.serialize( (float) pnt.getY(), jgen, provider); jgen.writeEndArray(); } jgen.writeEndArray(); }
[ "@", "Override", "public", "void", "writeShapeSpecificSerialization", "(", "MultiPoint", "value", ",", "JsonGenerator", "jgen", ",", "SerializerProvider", "provider", ")", "throws", "IOException", "{", "jgen", ".", "writeFieldName", "(", "\"type\"", ")", ";", "jgen", ".", "writeString", "(", "\"MultiPoint\"", ")", ";", "jgen", ".", "writeArrayFieldStart", "(", "\"coordinates\"", ")", ";", "// set beanproperty to null since we are not serializing a real property", "JsonSerializer", "<", "Object", ">", "ser", "=", "provider", ".", "findValueSerializer", "(", "Float", ".", "class", ",", "null", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "value", ".", "getNumGeometries", "(", ")", ";", "i", "++", ")", "{", "Point", "pnt", "=", "value", ".", "getGeometryN", "(", "i", ")", ";", "jgen", ".", "writeStartArray", "(", ")", ";", "ser", ".", "serialize", "(", "(", "float", ")", "pnt", ".", "getX", "(", ")", ",", "jgen", ",", "provider", ")", ";", "ser", ".", "serialize", "(", "(", "float", ")", "pnt", ".", "getY", "(", ")", ",", "jgen", ",", "provider", ")", ";", "jgen", ".", "writeEndArray", "(", ")", ";", "}", "jgen", ".", "writeEndArray", "(", ")", ";", "}" ]
Method that can be called to ask implementation to serialize values of type this serializer handles. @param value Value to serialize; can not be null. @param jgen Generator used to output resulting Json content @param provider Provider that can be used to get serializers for serializing Objects value contains, if any. @throws java.io.IOException If serialization failed.
[ "Method", "that", "can", "be", "called", "to", "ask", "implementation", "to", "serialize", "values", "of", "type", "this", "serializer", "handles", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/MultiPointSerializer.java#L59-L75
Impetus/Kundera
src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClientFactory.java
DSClientFactory.getPolicy
private com.datastax.driver.core.policies.RetryPolicy getPolicy(RetryPolicy policy, Properties props) { """ Gets the policy. @param policy the policy @param props the props @return the policy @throws Exception the exception """ com.datastax.driver.core.policies.RetryPolicy retryPolicy = null; String isLoggingRetry = (String) props.get("isLoggingRetry"); switch (policy) { case DowngradingConsistencyRetryPolicy: retryPolicy = DowngradingConsistencyRetryPolicy.INSTANCE; break; case FallthroughRetryPolicy: retryPolicy = FallthroughRetryPolicy.INSTANCE; break; case Custom: retryPolicy = getCustomRetryPolicy(props); break; default: break; } if (retryPolicy != null && Boolean.valueOf(isLoggingRetry)) { retryPolicy = new LoggingRetryPolicy(retryPolicy); } return retryPolicy; }
java
private com.datastax.driver.core.policies.RetryPolicy getPolicy(RetryPolicy policy, Properties props) { com.datastax.driver.core.policies.RetryPolicy retryPolicy = null; String isLoggingRetry = (String) props.get("isLoggingRetry"); switch (policy) { case DowngradingConsistencyRetryPolicy: retryPolicy = DowngradingConsistencyRetryPolicy.INSTANCE; break; case FallthroughRetryPolicy: retryPolicy = FallthroughRetryPolicy.INSTANCE; break; case Custom: retryPolicy = getCustomRetryPolicy(props); break; default: break; } if (retryPolicy != null && Boolean.valueOf(isLoggingRetry)) { retryPolicy = new LoggingRetryPolicy(retryPolicy); } return retryPolicy; }
[ "private", "com", ".", "datastax", ".", "driver", ".", "core", ".", "policies", ".", "RetryPolicy", "getPolicy", "(", "RetryPolicy", "policy", ",", "Properties", "props", ")", "{", "com", ".", "datastax", ".", "driver", ".", "core", ".", "policies", ".", "RetryPolicy", "retryPolicy", "=", "null", ";", "String", "isLoggingRetry", "=", "(", "String", ")", "props", ".", "get", "(", "\"isLoggingRetry\"", ")", ";", "switch", "(", "policy", ")", "{", "case", "DowngradingConsistencyRetryPolicy", ":", "retryPolicy", "=", "DowngradingConsistencyRetryPolicy", ".", "INSTANCE", ";", "break", ";", "case", "FallthroughRetryPolicy", ":", "retryPolicy", "=", "FallthroughRetryPolicy", ".", "INSTANCE", ";", "break", ";", "case", "Custom", ":", "retryPolicy", "=", "getCustomRetryPolicy", "(", "props", ")", ";", "break", ";", "default", ":", "break", ";", "}", "if", "(", "retryPolicy", "!=", "null", "&&", "Boolean", ".", "valueOf", "(", "isLoggingRetry", ")", ")", "{", "retryPolicy", "=", "new", "LoggingRetryPolicy", "(", "retryPolicy", ")", ";", "}", "return", "retryPolicy", ";", "}" ]
Gets the policy. @param policy the policy @param props the props @return the policy @throws Exception the exception
[ "Gets", "the", "policy", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClientFactory.java#L709-L740
wisdom-framework/wisdom
core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java
CryptoServiceSingleton.encryptAESWithCBC
@Override public String encryptAESWithCBC(String value, String privateKey, String salt, String iv) { """ Encrypt a String with the AES encryption advanced using 'AES/CBC/PKCS5Padding'. Unlike the regular encode/decode AES method using ECB (Electronic Codebook), it uses Cipher-block chaining (CBC). The private key must have a length of 16 bytes, the salt and initialization vector must be valid hex Strings. @param value The message to encrypt @param privateKey The private key @param salt The salt (hexadecimal String) @param iv The initialization vector (hexadecimal String) @return encrypted String encoded using Base64 """ SecretKey genKey = generateAESKey(privateKey, salt); byte[] encrypted = doFinal(Cipher.ENCRYPT_MODE, genKey, iv, value.getBytes(UTF_8)); return encodeBase64(encrypted); }
java
@Override public String encryptAESWithCBC(String value, String privateKey, String salt, String iv) { SecretKey genKey = generateAESKey(privateKey, salt); byte[] encrypted = doFinal(Cipher.ENCRYPT_MODE, genKey, iv, value.getBytes(UTF_8)); return encodeBase64(encrypted); }
[ "@", "Override", "public", "String", "encryptAESWithCBC", "(", "String", "value", ",", "String", "privateKey", ",", "String", "salt", ",", "String", "iv", ")", "{", "SecretKey", "genKey", "=", "generateAESKey", "(", "privateKey", ",", "salt", ")", ";", "byte", "[", "]", "encrypted", "=", "doFinal", "(", "Cipher", ".", "ENCRYPT_MODE", ",", "genKey", ",", "iv", ",", "value", ".", "getBytes", "(", "UTF_8", ")", ")", ";", "return", "encodeBase64", "(", "encrypted", ")", ";", "}" ]
Encrypt a String with the AES encryption advanced using 'AES/CBC/PKCS5Padding'. Unlike the regular encode/decode AES method using ECB (Electronic Codebook), it uses Cipher-block chaining (CBC). The private key must have a length of 16 bytes, the salt and initialization vector must be valid hex Strings. @param value The message to encrypt @param privateKey The private key @param salt The salt (hexadecimal String) @param iv The initialization vector (hexadecimal String) @return encrypted String encoded using Base64
[ "Encrypt", "a", "String", "with", "the", "AES", "encryption", "advanced", "using", "AES", "/", "CBC", "/", "PKCS5Padding", ".", "Unlike", "the", "regular", "encode", "/", "decode", "AES", "method", "using", "ECB", "(", "Electronic", "Codebook", ")", "it", "uses", "Cipher", "-", "block", "chaining", "(", "CBC", ")", ".", "The", "private", "key", "must", "have", "a", "length", "of", "16", "bytes", "the", "salt", "and", "initialization", "vector", "must", "be", "valid", "hex", "Strings", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L136-L141
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java
Sample.getLinearInterpolated
private int getLinearInterpolated(final int currentSamplePos, final int currentTuningPos) { """ Does the linear interpolation with the next sample @since 06.06.2006 @param currentTuningPos @return """ final long s1 = ((long)sample[currentSamplePos ])<<Helpers.SAMPLE_SHIFT; final long s2 = ((long)sample[currentSamplePos+1])<<Helpers.SAMPLE_SHIFT; return (int)((s1 + (((s2-s1)*((long)currentTuningPos))>>Helpers.SHIFT))>>Helpers.SAMPLE_SHIFT); }
java
private int getLinearInterpolated(final int currentSamplePos, final int currentTuningPos) { final long s1 = ((long)sample[currentSamplePos ])<<Helpers.SAMPLE_SHIFT; final long s2 = ((long)sample[currentSamplePos+1])<<Helpers.SAMPLE_SHIFT; return (int)((s1 + (((s2-s1)*((long)currentTuningPos))>>Helpers.SHIFT))>>Helpers.SAMPLE_SHIFT); }
[ "private", "int", "getLinearInterpolated", "(", "final", "int", "currentSamplePos", ",", "final", "int", "currentTuningPos", ")", "{", "final", "long", "s1", "=", "(", "(", "long", ")", "sample", "[", "currentSamplePos", "]", ")", "<<", "Helpers", ".", "SAMPLE_SHIFT", ";", "final", "long", "s2", "=", "(", "(", "long", ")", "sample", "[", "currentSamplePos", "+", "1", "]", ")", "<<", "Helpers", ".", "SAMPLE_SHIFT", ";", "return", "(", "int", ")", "(", "(", "s1", "+", "(", "(", "(", "s2", "-", "s1", ")", "*", "(", "(", "long", ")", "currentTuningPos", ")", ")", ">>", "Helpers", ".", "SHIFT", ")", ")", ">>", "Helpers", ".", "SAMPLE_SHIFT", ")", ";", "}" ]
Does the linear interpolation with the next sample @since 06.06.2006 @param currentTuningPos @return
[ "Does", "the", "linear", "interpolation", "with", "the", "next", "sample" ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java#L138-L143
apache/fluo
modules/core/src/main/java/org/apache/fluo/core/impl/FluoConfigurationImpl.java
FluoConfigurationImpl.getVisibilityCacheTimeout
public static long getVisibilityCacheTimeout(FluoConfiguration conf, TimeUnit tu) { """ Gets the time before stale entries in the cache are evicted based on age. This method returns a long representing the time converted from the TimeUnit passed in. @param conf The FluoConfiguration @param tu The TimeUnit desired to represent the cache timeout """ long millis = conf.getLong(VISIBILITY_CACHE_TIMEOUT, VISIBILITY_CACHE_TIMEOUT_DEFAULT); if (millis <= 0) { throw new IllegalArgumentException("Timeout must positive for " + VISIBILITY_CACHE_TIMEOUT); } return tu.convert(millis, TimeUnit.MILLISECONDS); }
java
public static long getVisibilityCacheTimeout(FluoConfiguration conf, TimeUnit tu) { long millis = conf.getLong(VISIBILITY_CACHE_TIMEOUT, VISIBILITY_CACHE_TIMEOUT_DEFAULT); if (millis <= 0) { throw new IllegalArgumentException("Timeout must positive for " + VISIBILITY_CACHE_TIMEOUT); } return tu.convert(millis, TimeUnit.MILLISECONDS); }
[ "public", "static", "long", "getVisibilityCacheTimeout", "(", "FluoConfiguration", "conf", ",", "TimeUnit", "tu", ")", "{", "long", "millis", "=", "conf", ".", "getLong", "(", "VISIBILITY_CACHE_TIMEOUT", ",", "VISIBILITY_CACHE_TIMEOUT_DEFAULT", ")", ";", "if", "(", "millis", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Timeout must positive for \"", "+", "VISIBILITY_CACHE_TIMEOUT", ")", ";", "}", "return", "tu", ".", "convert", "(", "millis", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}" ]
Gets the time before stale entries in the cache are evicted based on age. This method returns a long representing the time converted from the TimeUnit passed in. @param conf The FluoConfiguration @param tu The TimeUnit desired to represent the cache timeout
[ "Gets", "the", "time", "before", "stale", "entries", "in", "the", "cache", "are", "evicted", "based", "on", "age", ".", "This", "method", "returns", "a", "long", "representing", "the", "time", "converted", "from", "the", "TimeUnit", "passed", "in", "." ]
train
https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/core/src/main/java/org/apache/fluo/core/impl/FluoConfigurationImpl.java#L180-L186
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/interactions/Actions.java
Actions.keyDown
public Actions keyDown(CharSequence key) { """ Performs a modifier key press. Does not release the modifier key - subsequent interactions may assume it's kept pressed. Note that the modifier key is <b>never</b> released implicitly - either <i>keyUp(theKey)</i> or <i>sendKeys(Keys.NULL)</i> must be called to release the modifier. @param key Either {@link Keys#SHIFT}, {@link Keys#ALT} or {@link Keys#CONTROL}. If the provided key is none of those, {@link IllegalArgumentException} is thrown. @return A self reference. """ if (isBuildingActions()) { action.addAction(new KeyDownAction(jsonKeyboard, jsonMouse, asKeys(key))); } return addKeyAction(key, codePoint -> tick(defaultKeyboard.createKeyDown(codePoint))); }
java
public Actions keyDown(CharSequence key) { if (isBuildingActions()) { action.addAction(new KeyDownAction(jsonKeyboard, jsonMouse, asKeys(key))); } return addKeyAction(key, codePoint -> tick(defaultKeyboard.createKeyDown(codePoint))); }
[ "public", "Actions", "keyDown", "(", "CharSequence", "key", ")", "{", "if", "(", "isBuildingActions", "(", ")", ")", "{", "action", ".", "addAction", "(", "new", "KeyDownAction", "(", "jsonKeyboard", ",", "jsonMouse", ",", "asKeys", "(", "key", ")", ")", ")", ";", "}", "return", "addKeyAction", "(", "key", ",", "codePoint", "->", "tick", "(", "defaultKeyboard", ".", "createKeyDown", "(", "codePoint", ")", ")", ")", ";", "}" ]
Performs a modifier key press. Does not release the modifier key - subsequent interactions may assume it's kept pressed. Note that the modifier key is <b>never</b> released implicitly - either <i>keyUp(theKey)</i> or <i>sendKeys(Keys.NULL)</i> must be called to release the modifier. @param key Either {@link Keys#SHIFT}, {@link Keys#ALT} or {@link Keys#CONTROL}. If the provided key is none of those, {@link IllegalArgumentException} is thrown. @return A self reference.
[ "Performs", "a", "modifier", "key", "press", ".", "Does", "not", "release", "the", "modifier", "key", "-", "subsequent", "interactions", "may", "assume", "it", "s", "kept", "pressed", ".", "Note", "that", "the", "modifier", "key", "is", "<b", ">", "never<", "/", "b", ">", "released", "implicitly", "-", "either", "<i", ">", "keyUp", "(", "theKey", ")", "<", "/", "i", ">", "or", "<i", ">", "sendKeys", "(", "Keys", ".", "NULL", ")", "<", "/", "i", ">", "must", "be", "called", "to", "release", "the", "modifier", "." ]
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L87-L92
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java
ExpressRouteConnectionsInner.createOrUpdate
public ExpressRouteConnectionInner createOrUpdate(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) { """ Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. @param resourceGroupName The name of the resource group. @param expressRouteGatewayName The name of the ExpressRoute gateway. @param connectionName The name of the connection subresource. @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteConnectionInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).toBlocking().last().body(); }
java
public ExpressRouteConnectionInner createOrUpdate(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).toBlocking().last().body(); }
[ "public", "ExpressRouteConnectionInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "expressRouteGatewayName", ",", "String", "connectionName", ",", "ExpressRouteConnectionInner", "putExpressRouteConnectionParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "expressRouteGatewayName", ",", "connectionName", ",", "putExpressRouteConnectionParameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. @param resourceGroupName The name of the resource group. @param expressRouteGatewayName The name of the ExpressRoute gateway. @param connectionName The name of the connection subresource. @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteConnectionInner object if successful.
[ "Creates", "a", "connection", "between", "an", "ExpressRoute", "gateway", "and", "an", "ExpressRoute", "circuit", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java#L96-L98
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java
ExcelWriter.merge
public ExcelWriter merge(int firstRow, int lastRow, int firstColumn, int lastColumn, Object content, boolean isSetHeaderStyle) { """ 合并某行的单元格,并写入对象到单元格<br> 如果写到单元格中的内容非null,行号自动+1,否则当前行号不变<br> 样式为默认标题样式,可使用{@link #getHeadCellStyle()}方法调用后自定义默认样式 @param lastColumn 合并到的最后一个列号 @param content 合并单元格后的内容 @param isSetHeaderStyle 是否为合并后的单元格设置默认标题样式 @return this @since 4.0.10 """ Assert.isFalse(this.isClosed, "ExcelWriter has been closed!"); final CellStyle style = (isSetHeaderStyle && null != this.styleSet && null != this.styleSet.headCellStyle) ? this.styleSet.headCellStyle : this.styleSet.cellStyle; CellUtil.mergingCells(this.sheet, firstRow, lastRow, firstColumn, lastColumn, style); // 设置内容 if (null != content) { final Cell cell = getOrCreateCell(firstColumn, firstRow); CellUtil.setCellValue(cell, content, this.styleSet, isSetHeaderStyle); } return this; }
java
public ExcelWriter merge(int firstRow, int lastRow, int firstColumn, int lastColumn, Object content, boolean isSetHeaderStyle) { Assert.isFalse(this.isClosed, "ExcelWriter has been closed!"); final CellStyle style = (isSetHeaderStyle && null != this.styleSet && null != this.styleSet.headCellStyle) ? this.styleSet.headCellStyle : this.styleSet.cellStyle; CellUtil.mergingCells(this.sheet, firstRow, lastRow, firstColumn, lastColumn, style); // 设置内容 if (null != content) { final Cell cell = getOrCreateCell(firstColumn, firstRow); CellUtil.setCellValue(cell, content, this.styleSet, isSetHeaderStyle); } return this; }
[ "public", "ExcelWriter", "merge", "(", "int", "firstRow", ",", "int", "lastRow", ",", "int", "firstColumn", ",", "int", "lastColumn", ",", "Object", "content", ",", "boolean", "isSetHeaderStyle", ")", "{", "Assert", ".", "isFalse", "(", "this", ".", "isClosed", ",", "\"ExcelWriter has been closed!\"", ")", ";", "final", "CellStyle", "style", "=", "(", "isSetHeaderStyle", "&&", "null", "!=", "this", ".", "styleSet", "&&", "null", "!=", "this", ".", "styleSet", ".", "headCellStyle", ")", "?", "this", ".", "styleSet", ".", "headCellStyle", ":", "this", ".", "styleSet", ".", "cellStyle", ";", "CellUtil", ".", "mergingCells", "(", "this", ".", "sheet", ",", "firstRow", ",", "lastRow", ",", "firstColumn", ",", "lastColumn", ",", "style", ")", ";", "// 设置内容\r", "if", "(", "null", "!=", "content", ")", "{", "final", "Cell", "cell", "=", "getOrCreateCell", "(", "firstColumn", ",", "firstRow", ")", ";", "CellUtil", ".", "setCellValue", "(", "cell", ",", "content", ",", "this", ".", "styleSet", ",", "isSetHeaderStyle", ")", ";", "}", "return", "this", ";", "}" ]
合并某行的单元格,并写入对象到单元格<br> 如果写到单元格中的内容非null,行号自动+1,否则当前行号不变<br> 样式为默认标题样式,可使用{@link #getHeadCellStyle()}方法调用后自定义默认样式 @param lastColumn 合并到的最后一个列号 @param content 合并单元格后的内容 @param isSetHeaderStyle 是否为合并后的单元格设置默认标题样式 @return this @since 4.0.10
[ "合并某行的单元格,并写入对象到单元格<br", ">", "如果写到单元格中的内容非null,行号自动", "+", "1,否则当前行号不变<br", ">", "样式为默认标题样式,可使用", "{", "@link", "#getHeadCellStyle", "()", "}", "方法调用后自定义默认样式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L542-L554
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/buffer/MappeableRunContainer.java
MappeableRunContainer.canPrependValueLength
private boolean canPrependValueLength(int value, int index) { """ To check if a value length can be prepended with a given value """ if (index < this.nbrruns) { int nextValue = toIntUnsigned(getValue(index)); if (nextValue == value + 1) { return true; } } return false; }
java
private boolean canPrependValueLength(int value, int index) { if (index < this.nbrruns) { int nextValue = toIntUnsigned(getValue(index)); if (nextValue == value + 1) { return true; } } return false; }
[ "private", "boolean", "canPrependValueLength", "(", "int", "value", ",", "int", "index", ")", "{", "if", "(", "index", "<", "this", ".", "nbrruns", ")", "{", "int", "nextValue", "=", "toIntUnsigned", "(", "getValue", "(", "index", ")", ")", ";", "if", "(", "nextValue", "==", "value", "+", "1", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
To check if a value length can be prepended with a given value
[ "To", "check", "if", "a", "value", "length", "can", "be", "prepended", "with", "a", "given", "value" ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/MappeableRunContainer.java#L676-L684
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java
SparseCpuLevel1.sdoti
@Override protected double sdoti(long N, INDArray X, DataBuffer indx, INDArray Y) { """ Computes the dot product of a compressed sparse float vector by a full-storage real vector. @param N The number of elements in x and indx @param X an sparse INDArray. Size at least N @param indx an Databuffer that specifies the indices for the elements of x. Size at least N @param Y a dense INDArray. Size at least max(indx[i]) """ return cblas_sdoti((int) N, (FloatPointer) X.data().addressPointer(),(IntPointer) indx.addressPointer(), (FloatPointer) Y.data().addressPointer()); }
java
@Override protected double sdoti(long N, INDArray X, DataBuffer indx, INDArray Y) { return cblas_sdoti((int) N, (FloatPointer) X.data().addressPointer(),(IntPointer) indx.addressPointer(), (FloatPointer) Y.data().addressPointer()); }
[ "@", "Override", "protected", "double", "sdoti", "(", "long", "N", ",", "INDArray", "X", ",", "DataBuffer", "indx", ",", "INDArray", "Y", ")", "{", "return", "cblas_sdoti", "(", "(", "int", ")", "N", ",", "(", "FloatPointer", ")", "X", ".", "data", "(", ")", ".", "addressPointer", "(", ")", ",", "(", "IntPointer", ")", "indx", ".", "addressPointer", "(", ")", ",", "(", "FloatPointer", ")", "Y", ".", "data", "(", ")", ".", "addressPointer", "(", ")", ")", ";", "}" ]
Computes the dot product of a compressed sparse float vector by a full-storage real vector. @param N The number of elements in x and indx @param X an sparse INDArray. Size at least N @param indx an Databuffer that specifies the indices for the elements of x. Size at least N @param Y a dense INDArray. Size at least max(indx[i])
[ "Computes", "the", "dot", "product", "of", "a", "compressed", "sparse", "float", "vector", "by", "a", "full", "-", "storage", "real", "vector", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java#L57-L61
google/closure-compiler
src/com/google/javascript/jscomp/TypeInference.java
TypeInference.backwardsInferenceFromCallSite
private void backwardsInferenceFromCallSite(Node n, FunctionType fnType, FlowScope scope) { """ We only do forward type inference. We do not do full backwards type inference. In other words, if we have, <code> var x = f(); g(x); </code> a forward type-inference engine would try to figure out the type of "x" from the return type of "f". A backwards type-inference engine would try to figure out the type of "x" from the parameter type of "g". <p>However, there are a few special syntactic forms where we do some some half-assed backwards type-inference, because programmers expect it in this day and age. To take an example from Java, <code> List<String> x = Lists.newArrayList(); </code> The Java compiler will be able to infer the generic type of the List returned by newArrayList(). <p>In much the same way, we do some special-case backwards inference for JS. Those cases are enumerated here. """ boolean updatedFnType = inferTemplatedTypesForCall(n, fnType, scope); if (updatedFnType) { fnType = n.getFirstChild().getJSType().toMaybeFunctionType(); } updateTypeOfArguments(n, fnType); updateBind(n); }
java
private void backwardsInferenceFromCallSite(Node n, FunctionType fnType, FlowScope scope) { boolean updatedFnType = inferTemplatedTypesForCall(n, fnType, scope); if (updatedFnType) { fnType = n.getFirstChild().getJSType().toMaybeFunctionType(); } updateTypeOfArguments(n, fnType); updateBind(n); }
[ "private", "void", "backwardsInferenceFromCallSite", "(", "Node", "n", ",", "FunctionType", "fnType", ",", "FlowScope", "scope", ")", "{", "boolean", "updatedFnType", "=", "inferTemplatedTypesForCall", "(", "n", ",", "fnType", ",", "scope", ")", ";", "if", "(", "updatedFnType", ")", "{", "fnType", "=", "n", ".", "getFirstChild", "(", ")", ".", "getJSType", "(", ")", ".", "toMaybeFunctionType", "(", ")", ";", "}", "updateTypeOfArguments", "(", "n", ",", "fnType", ")", ";", "updateBind", "(", "n", ")", ";", "}" ]
We only do forward type inference. We do not do full backwards type inference. In other words, if we have, <code> var x = f(); g(x); </code> a forward type-inference engine would try to figure out the type of "x" from the return type of "f". A backwards type-inference engine would try to figure out the type of "x" from the parameter type of "g". <p>However, there are a few special syntactic forms where we do some some half-assed backwards type-inference, because programmers expect it in this day and age. To take an example from Java, <code> List<String> x = Lists.newArrayList(); </code> The Java compiler will be able to infer the generic type of the List returned by newArrayList(). <p>In much the same way, we do some special-case backwards inference for JS. Those cases are enumerated here.
[ "We", "only", "do", "forward", "type", "inference", ".", "We", "do", "not", "do", "full", "backwards", "type", "inference", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L1617-L1624
romannurik/muzei
muzei-api/src/main/java/com/google/android/apps/muzei/api/MuzeiArtSource.java
MuzeiArtSource.onStartCommand
@Override public int onStartCommand(Intent intent, int flags, int startId) { """ You should not override this method for your MuzeiArtSource. Instead, override {@link #onUpdate}, which Muzei calls when the MuzeiArtSource receives an update request. @see android.app.IntentService#onStartCommand """ super.onStartCommand(intent, flags, startId); Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent; mServiceHandler.sendMessage(msg); return mRedelivery ? START_REDELIVER_INTENT : START_NOT_STICKY; }
java
@Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent; mServiceHandler.sendMessage(msg); return mRedelivery ? START_REDELIVER_INTENT : START_NOT_STICKY; }
[ "@", "Override", "public", "int", "onStartCommand", "(", "Intent", "intent", ",", "int", "flags", ",", "int", "startId", ")", "{", "super", ".", "onStartCommand", "(", "intent", ",", "flags", ",", "startId", ")", ";", "Message", "msg", "=", "mServiceHandler", ".", "obtainMessage", "(", ")", ";", "msg", ".", "arg1", "=", "startId", ";", "msg", ".", "obj", "=", "intent", ";", "mServiceHandler", ".", "sendMessage", "(", "msg", ")", ";", "return", "mRedelivery", "?", "START_REDELIVER_INTENT", ":", "START_NOT_STICKY", ";", "}" ]
You should not override this method for your MuzeiArtSource. Instead, override {@link #onUpdate}, which Muzei calls when the MuzeiArtSource receives an update request. @see android.app.IntentService#onStartCommand
[ "You", "should", "not", "override", "this", "method", "for", "your", "MuzeiArtSource", ".", "Instead", "override", "{", "@link", "#onUpdate", "}", "which", "Muzei", "calls", "when", "the", "MuzeiArtSource", "receives", "an", "update", "request", "." ]
train
https://github.com/romannurik/muzei/blob/d00777a5fc59f34471be338c814ea85ddcbde304/muzei-api/src/main/java/com/google/android/apps/muzei/api/MuzeiArtSource.java#L356-L364
icode/ameba
src/main/java/ameba/lib/Fibers.java
Fibers.runInFiberChecked
public static <X extends Exception> void runInFiberChecked(SuspendableRunnable target, Class<X> exceptionType) throws X, InterruptedException { """ Runs an action in a new fiber and awaits the fiber's termination. Unlike {@link #runInFiber(SuspendableRunnable) runInFiber} this method does not throw {@link ExecutionException}, but wraps any checked exception thrown by the operation in a {@link RuntimeException}, unless it is of the given {@code exception type}, in which case the checked exception is thrown as-is. The new fiber is scheduled by the {@link DefaultFiberScheduler default scheduler}. @param target the operation @param exceptionType a checked exception type that will not be wrapped if thrown by the operation, but thrown as-is. @throws InterruptedException """ FiberUtil.runInFiberChecked(target, exceptionType); }
java
public static <X extends Exception> void runInFiberChecked(SuspendableRunnable target, Class<X> exceptionType) throws X, InterruptedException { FiberUtil.runInFiberChecked(target, exceptionType); }
[ "public", "static", "<", "X", "extends", "Exception", ">", "void", "runInFiberChecked", "(", "SuspendableRunnable", "target", ",", "Class", "<", "X", ">", "exceptionType", ")", "throws", "X", ",", "InterruptedException", "{", "FiberUtil", ".", "runInFiberChecked", "(", "target", ",", "exceptionType", ")", ";", "}" ]
Runs an action in a new fiber and awaits the fiber's termination. Unlike {@link #runInFiber(SuspendableRunnable) runInFiber} this method does not throw {@link ExecutionException}, but wraps any checked exception thrown by the operation in a {@link RuntimeException}, unless it is of the given {@code exception type}, in which case the checked exception is thrown as-is. The new fiber is scheduled by the {@link DefaultFiberScheduler default scheduler}. @param target the operation @param exceptionType a checked exception type that will not be wrapped if thrown by the operation, but thrown as-is. @throws InterruptedException
[ "Runs", "an", "action", "in", "a", "new", "fiber", "and", "awaits", "the", "fiber", "s", "termination", ".", "Unlike", "{", "@link", "#runInFiber", "(", "SuspendableRunnable", ")", "runInFiber", "}", "this", "method", "does", "not", "throw", "{", "@link", "ExecutionException", "}", "but", "wraps", "any", "checked", "exception", "thrown", "by", "the", "operation", "in", "a", "{", "@link", "RuntimeException", "}", "unless", "it", "is", "of", "the", "given", "{", "@code", "exception", "type", "}", "in", "which", "case", "the", "checked", "exception", "is", "thrown", "as", "-", "is", ".", "The", "new", "fiber", "is", "scheduled", "by", "the", "{", "@link", "DefaultFiberScheduler", "default", "scheduler", "}", "." ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/lib/Fibers.java#L390-L392
grpc/grpc-java
services/src/main/java/io/grpc/services/HealthStatusManager.java
HealthStatusManager.setStatus
public void setStatus(String service, ServingStatus status) { """ Updates the status of the server. @param service the name of some aspect of the server that is associated with a health status. This name can have no relation with the gRPC services that the server is running with. It can also be an empty String {@code ""} per the gRPC specification. @param status is one of the values {@link ServingStatus#SERVING}, {@link ServingStatus#NOT_SERVING} and {@link ServingStatus#UNKNOWN}. """ checkNotNull(status, "status"); healthService.setStatus(service, status); }
java
public void setStatus(String service, ServingStatus status) { checkNotNull(status, "status"); healthService.setStatus(service, status); }
[ "public", "void", "setStatus", "(", "String", "service", ",", "ServingStatus", "status", ")", "{", "checkNotNull", "(", "status", ",", "\"status\"", ")", ";", "healthService", ".", "setStatus", "(", "service", ",", "status", ")", ";", "}" ]
Updates the status of the server. @param service the name of some aspect of the server that is associated with a health status. This name can have no relation with the gRPC services that the server is running with. It can also be an empty String {@code ""} per the gRPC specification. @param status is one of the values {@link ServingStatus#SERVING}, {@link ServingStatus#NOT_SERVING} and {@link ServingStatus#UNKNOWN}.
[ "Updates", "the", "status", "of", "the", "server", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/services/src/main/java/io/grpc/services/HealthStatusManager.java#L65-L68
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_Interpolate3DLine.java
ST_Interpolate3DLine.linearZInterpolation
private static MultiLineString linearZInterpolation(MultiLineString multiLineString) { """ Interpolate each linestring of the multilinestring. @param multiLineString @return """ int nbGeom = multiLineString.getNumGeometries(); LineString[] lines = new LineString[nbGeom]; for (int i = 0; i < nbGeom; i++) { LineString subGeom = (LineString) multiLineString.getGeometryN(i); double startz = subGeom.getStartPoint().getCoordinates()[0].z; double endz = subGeom.getEndPoint().getCoordinates()[0].z; double length = subGeom.getLength(); subGeom.apply(new LinearZInterpolationFilter(startz, endz, length)); lines[i] = subGeom; } return FACTORY.createMultiLineString(lines); }
java
private static MultiLineString linearZInterpolation(MultiLineString multiLineString) { int nbGeom = multiLineString.getNumGeometries(); LineString[] lines = new LineString[nbGeom]; for (int i = 0; i < nbGeom; i++) { LineString subGeom = (LineString) multiLineString.getGeometryN(i); double startz = subGeom.getStartPoint().getCoordinates()[0].z; double endz = subGeom.getEndPoint().getCoordinates()[0].z; double length = subGeom.getLength(); subGeom.apply(new LinearZInterpolationFilter(startz, endz, length)); lines[i] = subGeom; } return FACTORY.createMultiLineString(lines); }
[ "private", "static", "MultiLineString", "linearZInterpolation", "(", "MultiLineString", "multiLineString", ")", "{", "int", "nbGeom", "=", "multiLineString", ".", "getNumGeometries", "(", ")", ";", "LineString", "[", "]", "lines", "=", "new", "LineString", "[", "nbGeom", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nbGeom", ";", "i", "++", ")", "{", "LineString", "subGeom", "=", "(", "LineString", ")", "multiLineString", ".", "getGeometryN", "(", "i", ")", ";", "double", "startz", "=", "subGeom", ".", "getStartPoint", "(", ")", ".", "getCoordinates", "(", ")", "[", "0", "]", ".", "z", ";", "double", "endz", "=", "subGeom", ".", "getEndPoint", "(", ")", ".", "getCoordinates", "(", ")", "[", "0", "]", ".", "z", ";", "double", "length", "=", "subGeom", ".", "getLength", "(", ")", ";", "subGeom", ".", "apply", "(", "new", "LinearZInterpolationFilter", "(", "startz", ",", "endz", ",", "length", ")", ")", ";", "lines", "[", "i", "]", "=", "subGeom", ";", "}", "return", "FACTORY", ".", "createMultiLineString", "(", "lines", ")", ";", "}" ]
Interpolate each linestring of the multilinestring. @param multiLineString @return
[ "Interpolate", "each", "linestring", "of", "the", "multilinestring", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_Interpolate3DLine.java#L88-L101
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilders.java
SearchBuilders.geoDistance
public static GeoDistanceSortFieldBuilder geoDistance(String mapper, double latitude, double longitude) { """ Returns a new {@link SimpleSortFieldBuilder} for the specified field. @param mapper the name of mapper to use to calculate distance @param latitude the latitude of the reference point @param longitude the longitude of the reference point @return a new geo distance sort field builder """ return new GeoDistanceSortFieldBuilder(mapper, latitude, longitude); }
java
public static GeoDistanceSortFieldBuilder geoDistance(String mapper, double latitude, double longitude) { return new GeoDistanceSortFieldBuilder(mapper, latitude, longitude); }
[ "public", "static", "GeoDistanceSortFieldBuilder", "geoDistance", "(", "String", "mapper", ",", "double", "latitude", ",", "double", "longitude", ")", "{", "return", "new", "GeoDistanceSortFieldBuilder", "(", "mapper", ",", "latitude", ",", "longitude", ")", ";", "}" ]
Returns a new {@link SimpleSortFieldBuilder} for the specified field. @param mapper the name of mapper to use to calculate distance @param latitude the latitude of the reference point @param longitude the longitude of the reference point @return a new geo distance sort field builder
[ "Returns", "a", "new", "{", "@link", "SimpleSortFieldBuilder", "}", "for", "the", "specified", "field", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilders.java#L297-L299
javajazz/jazz
src/main/lombok/de/scravy/jazz/Jazz.java
Jazz.animate
public static <M> Window animate(final String title, final int width, final int height, final M model, final Renderer<M> renderer, final UpdateHandler<M> updateHandler) { """ Displays an animation in a single window. You can open multiple windows using this method. @see Renderer @since 1.0.0 @param title The title of the displayed window. @param width The width of the displayed window. @param height The height of the displayed window. @param model The model (a data object that describes your world). @param renderer The renderer that derives a picture from the model. @param updateHandler The update handler that updates the model. @return A reference to the newly created window. """ return animate(title, width, height, new Animation() { @Override public void update(final double time, final double delta) { updateHandler.update(model, time, delta); } @Override public Picture getPicture() { return renderer.render(model); } }); }
java
public static <M> Window animate(final String title, final int width, final int height, final M model, final Renderer<M> renderer, final UpdateHandler<M> updateHandler) { return animate(title, width, height, new Animation() { @Override public void update(final double time, final double delta) { updateHandler.update(model, time, delta); } @Override public Picture getPicture() { return renderer.render(model); } }); }
[ "public", "static", "<", "M", ">", "Window", "animate", "(", "final", "String", "title", ",", "final", "int", "width", ",", "final", "int", "height", ",", "final", "M", "model", ",", "final", "Renderer", "<", "M", ">", "renderer", ",", "final", "UpdateHandler", "<", "M", ">", "updateHandler", ")", "{", "return", "animate", "(", "title", ",", "width", ",", "height", ",", "new", "Animation", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "final", "double", "time", ",", "final", "double", "delta", ")", "{", "updateHandler", ".", "update", "(", "model", ",", "time", ",", "delta", ")", ";", "}", "@", "Override", "public", "Picture", "getPicture", "(", ")", "{", "return", "renderer", ".", "render", "(", "model", ")", ";", "}", "}", ")", ";", "}" ]
Displays an animation in a single window. You can open multiple windows using this method. @see Renderer @since 1.0.0 @param title The title of the displayed window. @param width The width of the displayed window. @param height The height of the displayed window. @param model The model (a data object that describes your world). @param renderer The renderer that derives a picture from the model. @param updateHandler The update handler that updates the model. @return A reference to the newly created window.
[ "Displays", "an", "animation", "in", "a", "single", "window", "." ]
train
https://github.com/javajazz/jazz/blob/f4a1a601700442b8ec6a947f5772a96dbf5dc44b/src/main/lombok/de/scravy/jazz/Jazz.java#L280-L296
jglobus/JGlobus
ssl-proxies/src/main/java/org/globus/common/CoGProperties.java
CoGProperties.getUdpSourcePortRange
public String getUdpSourcePortRange() { """ Returns the udp source port range. It first checks the 'GLOBUS_UDP_SOURCE_PORT_RANGE' system property. If that system property is not set then 'org.globus.source.udp.port.range' system property is checked. If that system property is not set then it returns the value specified in the configuration file. Returns null if the port range is not defined.<BR> The port range is in the following form: &lt;minport&gt;, &lt;maxport&gt; @return <code>String</code> the port range. """ String value = null; value = System.getProperty("GLOBUS_UDP_SOURCE_PORT_RANGE"); if (value != null) { return value; } value = System.getProperty("org.globus.udp.source.port.range"); if (value != null) { return value; } return getProperty("udp.source.port.range", null); }
java
public String getUdpSourcePortRange() { String value = null; value = System.getProperty("GLOBUS_UDP_SOURCE_PORT_RANGE"); if (value != null) { return value; } value = System.getProperty("org.globus.udp.source.port.range"); if (value != null) { return value; } return getProperty("udp.source.port.range", null); }
[ "public", "String", "getUdpSourcePortRange", "(", ")", "{", "String", "value", "=", "null", ";", "value", "=", "System", ".", "getProperty", "(", "\"GLOBUS_UDP_SOURCE_PORT_RANGE\"", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return", "value", ";", "}", "value", "=", "System", ".", "getProperty", "(", "\"org.globus.udp.source.port.range\"", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return", "value", ";", "}", "return", "getProperty", "(", "\"udp.source.port.range\"", ",", "null", ")", ";", "}" ]
Returns the udp source port range. It first checks the 'GLOBUS_UDP_SOURCE_PORT_RANGE' system property. If that system property is not set then 'org.globus.source.udp.port.range' system property is checked. If that system property is not set then it returns the value specified in the configuration file. Returns null if the port range is not defined.<BR> The port range is in the following form: &lt;minport&gt;, &lt;maxport&gt; @return <code>String</code> the port range.
[ "Returns", "the", "udp", "source", "port", "range", ".", "It", "first", "checks", "the", "GLOBUS_UDP_SOURCE_PORT_RANGE", "system", "property", ".", "If", "that", "system", "property", "is", "not", "set", "then", "org", ".", "globus", ".", "source", ".", "udp", ".", "port", ".", "range", "system", "property", "is", "checked", ".", "If", "that", "system", "property", "is", "not", "set", "then", "it", "returns", "the", "value", "specified", "in", "the", "configuration", "file", ".", "Returns", "null", "if", "the", "port", "range", "is", "not", "defined", ".", "<BR", ">", "The", "port", "range", "is", "in", "the", "following", "form", ":", "&lt", ";", "minport&gt", ";", "&lt", ";", "maxport&gt", ";" ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/common/CoGProperties.java#L458-L469
dnsjava/dnsjava
org/xbill/DNS/Record.java
Record.newRecord
public static Record newRecord(Name name, int type, int dclass, long ttl, int length, byte [] data) { """ Creates a new record, with the given parameters. @param name The owner name of the record. @param type The record's type. @param dclass The record's class. @param ttl The record's time to live. @param length The length of the record's data. @param data The rdata of the record, in uncompressed DNS wire format. Only the first length bytes are used. """ if (!name.isAbsolute()) throw new RelativeNameException(name); Type.check(type); DClass.check(dclass); TTL.check(ttl); DNSInput in; if (data != null) in = new DNSInput(data); else in = null; try { return newRecord(name, type, dclass, ttl, length, in); } catch (IOException e) { return null; } }
java
public static Record newRecord(Name name, int type, int dclass, long ttl, int length, byte [] data) { if (!name.isAbsolute()) throw new RelativeNameException(name); Type.check(type); DClass.check(dclass); TTL.check(ttl); DNSInput in; if (data != null) in = new DNSInput(data); else in = null; try { return newRecord(name, type, dclass, ttl, length, in); } catch (IOException e) { return null; } }
[ "public", "static", "Record", "newRecord", "(", "Name", "name", ",", "int", "type", ",", "int", "dclass", ",", "long", "ttl", ",", "int", "length", ",", "byte", "[", "]", "data", ")", "{", "if", "(", "!", "name", ".", "isAbsolute", "(", ")", ")", "throw", "new", "RelativeNameException", "(", "name", ")", ";", "Type", ".", "check", "(", "type", ")", ";", "DClass", ".", "check", "(", "dclass", ")", ";", "TTL", ".", "check", "(", "ttl", ")", ";", "DNSInput", "in", ";", "if", "(", "data", "!=", "null", ")", "in", "=", "new", "DNSInput", "(", "data", ")", ";", "else", "in", "=", "null", ";", "try", "{", "return", "newRecord", "(", "name", ",", "type", ",", "dclass", ",", "ttl", ",", "length", ",", "in", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "null", ";", "}", "}" ]
Creates a new record, with the given parameters. @param name The owner name of the record. @param type The record's type. @param dclass The record's class. @param ttl The record's time to live. @param length The length of the record's data. @param data The rdata of the record, in uncompressed DNS wire format. Only the first length bytes are used.
[ "Creates", "a", "new", "record", "with", "the", "given", "parameters", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Record.java#L107-L126
walkmod/walkmod-core
src/main/java/org/walkmod/WalkModFacade.java
WalkModFacade.addTransformationConfig
public void addTransformationConfig(String chain, String path, boolean recursive, TransformationConfig transformationCfg, Integer order, String before) throws Exception { """ Adds a new transformation configuration into the configuration file @param chain chain identifier where the transformation will be appended. It can be null. @param path the path where the transformation config will be applied if the chain does not exists or is null. @param recursive if the transformation config is added recursively to all the submodules. @param transformationCfg transformation configuration to add @param order priority order @param before defines which is the next chain to execute @throws Exception in case that the walkmod configuration file can't be read. """ long startTime = System.currentTimeMillis(); Exception exception = null; if (!cfg.exists()) { init(); } userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider(); cfgProvider.addTransformationConfig(chain, path, transformationCfg, recursive, order, before); } catch (Exception e) { exception = e; } finally { System.setProperty("user.dir", userDir); updateMsg(startTime, exception); } }
java
public void addTransformationConfig(String chain, String path, boolean recursive, TransformationConfig transformationCfg, Integer order, String before) throws Exception { long startTime = System.currentTimeMillis(); Exception exception = null; if (!cfg.exists()) { init(); } userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider(); cfgProvider.addTransformationConfig(chain, path, transformationCfg, recursive, order, before); } catch (Exception e) { exception = e; } finally { System.setProperty("user.dir", userDir); updateMsg(startTime, exception); } }
[ "public", "void", "addTransformationConfig", "(", "String", "chain", ",", "String", "path", ",", "boolean", "recursive", ",", "TransformationConfig", "transformationCfg", ",", "Integer", "order", ",", "String", "before", ")", "throws", "Exception", "{", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "Exception", "exception", "=", "null", ";", "if", "(", "!", "cfg", ".", "exists", "(", ")", ")", "{", "init", "(", ")", ";", "}", "userDir", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"user.dir\"", ")", ")", ".", "getAbsolutePath", "(", ")", ";", "System", ".", "setProperty", "(", "\"user.dir\"", ",", "options", ".", "getExecutionDirectory", "(", ")", ".", "getAbsolutePath", "(", ")", ")", ";", "try", "{", "ConfigurationManager", "manager", "=", "new", "ConfigurationManager", "(", "cfg", ",", "false", ")", ";", "ProjectConfigurationProvider", "cfgProvider", "=", "manager", ".", "getProjectConfigurationProvider", "(", ")", ";", "cfgProvider", ".", "addTransformationConfig", "(", "chain", ",", "path", ",", "transformationCfg", ",", "recursive", ",", "order", ",", "before", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "exception", "=", "e", ";", "}", "finally", "{", "System", ".", "setProperty", "(", "\"user.dir\"", ",", "userDir", ")", ";", "updateMsg", "(", "startTime", ",", "exception", ")", ";", "}", "}" ]
Adds a new transformation configuration into the configuration file @param chain chain identifier where the transformation will be appended. It can be null. @param path the path where the transformation config will be applied if the chain does not exists or is null. @param recursive if the transformation config is added recursively to all the submodules. @param transformationCfg transformation configuration to add @param order priority order @param before defines which is the next chain to execute @throws Exception in case that the walkmod configuration file can't be read.
[ "Adds", "a", "new", "transformation", "configuration", "into", "the", "configuration", "file" ]
train
https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L430-L451
SvenEwald/xmlbeam
src/main/java/org/xmlbeam/util/intern/ReflectionHelper.java
ReflectionHelper.getCallableFactoryForParams
public static Method getCallableFactoryForParams(final Class<?> type, final Class<?>... params) { """ Search for a static factory method returning the target type. @param type @param params @return factory method or null if it is not found. """ for (Method m : type.getMethods()) { if ((m.getModifiers() & PUBLIC_STATIC_MODIFIER) != PUBLIC_STATIC_MODIFIER) { continue; } if (!type.isAssignableFrom(m.getReturnType())) { continue; } if (!Arrays.equals(m.getParameterTypes(), params)) { continue; } if (!VALID_FACTORY_METHOD_NAMES.matcher(m.getName()).matches()) { continue; } return m; } return null; }
java
public static Method getCallableFactoryForParams(final Class<?> type, final Class<?>... params) { for (Method m : type.getMethods()) { if ((m.getModifiers() & PUBLIC_STATIC_MODIFIER) != PUBLIC_STATIC_MODIFIER) { continue; } if (!type.isAssignableFrom(m.getReturnType())) { continue; } if (!Arrays.equals(m.getParameterTypes(), params)) { continue; } if (!VALID_FACTORY_METHOD_NAMES.matcher(m.getName()).matches()) { continue; } return m; } return null; }
[ "public", "static", "Method", "getCallableFactoryForParams", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "Class", "<", "?", ">", "...", "params", ")", "{", "for", "(", "Method", "m", ":", "type", ".", "getMethods", "(", ")", ")", "{", "if", "(", "(", "m", ".", "getModifiers", "(", ")", "&", "PUBLIC_STATIC_MODIFIER", ")", "!=", "PUBLIC_STATIC_MODIFIER", ")", "{", "continue", ";", "}", "if", "(", "!", "type", ".", "isAssignableFrom", "(", "m", ".", "getReturnType", "(", ")", ")", ")", "{", "continue", ";", "}", "if", "(", "!", "Arrays", ".", "equals", "(", "m", ".", "getParameterTypes", "(", ")", ",", "params", ")", ")", "{", "continue", ";", "}", "if", "(", "!", "VALID_FACTORY_METHOD_NAMES", ".", "matcher", "(", "m", ".", "getName", "(", ")", ")", ".", "matches", "(", ")", ")", "{", "continue", ";", "}", "return", "m", ";", "}", "return", "null", ";", "}" ]
Search for a static factory method returning the target type. @param type @param params @return factory method or null if it is not found.
[ "Search", "for", "a", "static", "factory", "method", "returning", "the", "target", "type", "." ]
train
https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/util/intern/ReflectionHelper.java#L330-L347
bmwcarit/joynr
java/core/clustercontroller/src/main/java/io/joynr/accesscontrol/AccessControlAlgorithm.java
AccessControlAlgorithm.getProviderPermission
public Permission getProviderPermission(@Nullable MasterAccessControlEntry master, @Nullable MasterAccessControlEntry mediator, @Nullable OwnerAccessControlEntry owner, TrustLevel trustLevel) { """ Get the provider permission for given combination of control entries and with the given trust level. @param master The master access control entry @param mediator The mediator access control entry @param owner The owner access control entry @param trustLevel The trust level of the user sending the message @return provider permission """ assert (false) : "Provider permission algorithm is not yet implemented!"; return getPermission(PermissionType.PROVIDER, master, mediator, owner, trustLevel); }
java
public Permission getProviderPermission(@Nullable MasterAccessControlEntry master, @Nullable MasterAccessControlEntry mediator, @Nullable OwnerAccessControlEntry owner, TrustLevel trustLevel) { assert (false) : "Provider permission algorithm is not yet implemented!"; return getPermission(PermissionType.PROVIDER, master, mediator, owner, trustLevel); }
[ "public", "Permission", "getProviderPermission", "(", "@", "Nullable", "MasterAccessControlEntry", "master", ",", "@", "Nullable", "MasterAccessControlEntry", "mediator", ",", "@", "Nullable", "OwnerAccessControlEntry", "owner", ",", "TrustLevel", "trustLevel", ")", "{", "assert", "(", "false", ")", ":", "\"Provider permission algorithm is not yet implemented!\"", ";", "return", "getPermission", "(", "PermissionType", ".", "PROVIDER", ",", "master", ",", "mediator", ",", "owner", ",", "trustLevel", ")", ";", "}" ]
Get the provider permission for given combination of control entries and with the given trust level. @param master The master access control entry @param mediator The mediator access control entry @param owner The owner access control entry @param trustLevel The trust level of the user sending the message @return provider permission
[ "Get", "the", "provider", "permission", "for", "given", "combination", "of", "control", "entries", "and", "with", "the", "given", "trust", "level", "." ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/clustercontroller/src/main/java/io/joynr/accesscontrol/AccessControlAlgorithm.java#L59-L65
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/processor/map/CreateMapProcessor.java
CreateMapProcessor.createSvgGraphics
public static SVGGraphics2D createSvgGraphics(final Dimension size) throws ParserConfigurationException { """ Create a SVG graphic with the give dimensions. @param size The size of the SVG graphic. """ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document document = db.getDOMImplementation().createDocument(null, "svg", null); SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document); ctx.setStyleHandler(new OpacityAdjustingStyleHandler()); ctx.setComment("Generated by GeoTools2 with Batik SVG Generator"); SVGGraphics2D g2d = new SVGGraphics2D(ctx, true); g2d.setSVGCanvasSize(size); return g2d; }
java
public static SVGGraphics2D createSvgGraphics(final Dimension size) throws ParserConfigurationException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document document = db.getDOMImplementation().createDocument(null, "svg", null); SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document); ctx.setStyleHandler(new OpacityAdjustingStyleHandler()); ctx.setComment("Generated by GeoTools2 with Batik SVG Generator"); SVGGraphics2D g2d = new SVGGraphics2D(ctx, true); g2d.setSVGCanvasSize(size); return g2d; }
[ "public", "static", "SVGGraphics2D", "createSvgGraphics", "(", "final", "Dimension", "size", ")", "throws", "ParserConfigurationException", "{", "DocumentBuilderFactory", "dbf", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "DocumentBuilder", "db", "=", "dbf", ".", "newDocumentBuilder", "(", ")", ";", "Document", "document", "=", "db", ".", "getDOMImplementation", "(", ")", ".", "createDocument", "(", "null", ",", "\"svg\"", ",", "null", ")", ";", "SVGGeneratorContext", "ctx", "=", "SVGGeneratorContext", ".", "createDefault", "(", "document", ")", ";", "ctx", ".", "setStyleHandler", "(", "new", "OpacityAdjustingStyleHandler", "(", ")", ")", ";", "ctx", ".", "setComment", "(", "\"Generated by GeoTools2 with Batik SVG Generator\"", ")", ";", "SVGGraphics2D", "g2d", "=", "new", "SVGGraphics2D", "(", "ctx", ",", "true", ")", ";", "g2d", ".", "setSVGCanvasSize", "(", "size", ")", ";", "return", "g2d", ";", "}" ]
Create a SVG graphic with the give dimensions. @param size The size of the SVG graphic.
[ "Create", "a", "SVG", "graphic", "with", "the", "give", "dimensions", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/map/CreateMapProcessor.java#L189-L203
Waikato/moa
moa/src/main/java/com/yahoo/labs/samoa/instances/SamoaToWekaInstanceConverter.java
SamoaToWekaInstanceConverter.wekaAttribute
protected weka.core.Attribute wekaAttribute(int index, Attribute attribute) { """ Weka attribute. @param index the index @param attribute the attribute @return the weka.core. attribute """ weka.core.Attribute wekaAttribute; if (attribute.isNominal()) { wekaAttribute = new weka.core.Attribute(attribute.name(), attribute.getAttributeValues(), index); } else { wekaAttribute = new weka.core.Attribute(attribute.name(), index); } //System.out.println(wekaAttribute.name()); //System.out.println(wekaAttribute.isNominal()); return wekaAttribute; }
java
protected weka.core.Attribute wekaAttribute(int index, Attribute attribute) { weka.core.Attribute wekaAttribute; if (attribute.isNominal()) { wekaAttribute = new weka.core.Attribute(attribute.name(), attribute.getAttributeValues(), index); } else { wekaAttribute = new weka.core.Attribute(attribute.name(), index); } //System.out.println(wekaAttribute.name()); //System.out.println(wekaAttribute.isNominal()); return wekaAttribute; }
[ "protected", "weka", ".", "core", ".", "Attribute", "wekaAttribute", "(", "int", "index", ",", "Attribute", "attribute", ")", "{", "weka", ".", "core", ".", "Attribute", "wekaAttribute", ";", "if", "(", "attribute", ".", "isNominal", "(", ")", ")", "{", "wekaAttribute", "=", "new", "weka", ".", "core", ".", "Attribute", "(", "attribute", ".", "name", "(", ")", ",", "attribute", ".", "getAttributeValues", "(", ")", ",", "index", ")", ";", "}", "else", "{", "wekaAttribute", "=", "new", "weka", ".", "core", ".", "Attribute", "(", "attribute", ".", "name", "(", ")", ",", "index", ")", ";", "}", "//System.out.println(wekaAttribute.name());", "//System.out.println(wekaAttribute.isNominal());", "return", "wekaAttribute", ";", "}" ]
Weka attribute. @param index the index @param attribute the attribute @return the weka.core. attribute
[ "Weka", "attribute", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/SamoaToWekaInstanceConverter.java#L124-L135
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/LinkedWorkspacesInner.java
LinkedWorkspacesInner.get
public LinkedWorkspaceInner get(String resourceGroupName, String automationAccountName) { """ Retrieve the linked workspace for the account id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the LinkedWorkspaceInner object if successful. """ return getWithServiceResponseAsync(resourceGroupName, automationAccountName).toBlocking().single().body(); }
java
public LinkedWorkspaceInner get(String resourceGroupName, String automationAccountName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName).toBlocking().single().body(); }
[ "public", "LinkedWorkspaceInner", "get", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Retrieve the linked workspace for the account id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the LinkedWorkspaceInner object if successful.
[ "Retrieve", "the", "linked", "workspace", "for", "the", "account", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/LinkedWorkspacesInner.java#L70-L72
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
DatabaseUtils.queryNumEntries
public static long queryNumEntries(SQLiteDatabase db, String table) { """ Query the table for the number of rows in the table. @param db the database the table is in @param table the name of the table to query @return the number of rows in the table """ return queryNumEntries(db, table, null, null); }
java
public static long queryNumEntries(SQLiteDatabase db, String table) { return queryNumEntries(db, table, null, null); }
[ "public", "static", "long", "queryNumEntries", "(", "SQLiteDatabase", "db", ",", "String", "table", ")", "{", "return", "queryNumEntries", "(", "db", ",", "table", ",", "null", ",", "null", ")", ";", "}" ]
Query the table for the number of rows in the table. @param db the database the table is in @param table the name of the table to query @return the number of rows in the table
[ "Query", "the", "table", "for", "the", "number", "of", "rows", "in", "the", "table", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L779-L781
davidmoten/rxjava-extras
src/main/java/com/github/davidmoten/rx/internal/operators/FileBasedSPSCQueueMemoryMappedReaderWriter.java
FileBasedSPSCQueueMemoryMappedReaderWriter.offer
public boolean offer(T t) { """ Returns true if value written to file or false if not enough space (writes and end-of-file marker in the fixed-length memory mapped file). @param t value to write to the serialized queue @return true if written, false if not enough space """ // the current position will be just past the length bytes for this // item (length bytes will be 0 at the moment) int serializedLength = serializer.size(); if (serializedLength == UNKNOWN_LENGTH) { return offerUnknownLength(t); } else { return offerKnownLength(t, serializedLength); } }
java
public boolean offer(T t) { // the current position will be just past the length bytes for this // item (length bytes will be 0 at the moment) int serializedLength = serializer.size(); if (serializedLength == UNKNOWN_LENGTH) { return offerUnknownLength(t); } else { return offerKnownLength(t, serializedLength); } }
[ "public", "boolean", "offer", "(", "T", "t", ")", "{", "// the current position will be just past the length bytes for this", "// item (length bytes will be 0 at the moment)", "int", "serializedLength", "=", "serializer", ".", "size", "(", ")", ";", "if", "(", "serializedLength", "==", "UNKNOWN_LENGTH", ")", "{", "return", "offerUnknownLength", "(", "t", ")", ";", "}", "else", "{", "return", "offerKnownLength", "(", "t", ",", "serializedLength", ")", ";", "}", "}" ]
Returns true if value written to file or false if not enough space (writes and end-of-file marker in the fixed-length memory mapped file). @param t value to write to the serialized queue @return true if written, false if not enough space
[ "Returns", "true", "if", "value", "written", "to", "file", "or", "false", "if", "not", "enough", "space", "(", "writes", "and", "end", "-", "of", "-", "file", "marker", "in", "the", "fixed", "-", "length", "memory", "mapped", "file", ")", "." ]
train
https://github.com/davidmoten/rxjava-extras/blob/a91d2ba7d454843250e0b0fce36084f9fb02a551/src/main/java/com/github/davidmoten/rx/internal/operators/FileBasedSPSCQueueMemoryMappedReaderWriter.java#L259-L268
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java
DrizzlePreparedStatement.setBlob
public void setBlob(final int parameterIndex, final Blob x) throws SQLException { """ Sets the designated parameter to the given <code>java.sql.Blob</code> object. The driver converts this to an SQL <code>BLOB</code> value when it sends it to the database. @param parameterIndex the first parameter is 1, the second is 2, ... @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code> @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support this method @since 1.2 """ if(x == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new StreamParameter(x.getBinaryStream(), x.length())); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read stream", e); } }
java
public void setBlob(final int parameterIndex, final Blob x) throws SQLException { if(x == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new StreamParameter(x.getBinaryStream(), x.length())); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read stream", e); } }
[ "public", "void", "setBlob", "(", "final", "int", "parameterIndex", ",", "final", "Blob", "x", ")", "throws", "SQLException", "{", "if", "(", "x", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ",", "Types", ".", "BLOB", ")", ";", "return", ";", "}", "try", "{", "setParameter", "(", "parameterIndex", ",", "new", "StreamParameter", "(", "x", ".", "getBinaryStream", "(", ")", ",", "x", ".", "length", "(", ")", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "SQLExceptionMapper", ".", "getSQLException", "(", "\"Could not read stream\"", ",", "e", ")", ";", "}", "}" ]
Sets the designated parameter to the given <code>java.sql.Blob</code> object. The driver converts this to an SQL <code>BLOB</code> value when it sends it to the database. @param parameterIndex the first parameter is 1, the second is 2, ... @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code> @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support this method @since 1.2
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "<code", ">", "java", ".", "sql", ".", "Blob<", "/", "code", ">", "object", ".", "The", "driver", "converts", "this", "to", "an", "SQL", "<code", ">", "BLOB<", "/", "code", ">", "value", "when", "it", "sends", "it", "to", "the", "database", "." ]
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L263-L273
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java
Http2ConnectionHandler.onHttpServerUpgrade
public void onHttpServerUpgrade(Http2Settings settings) throws Http2Exception { """ Handles the server-side (cleartext) upgrade from HTTP to HTTP/2. @param settings the settings for the remote endpoint. """ if (!connection().isServer()) { throw connectionError(PROTOCOL_ERROR, "Server-side HTTP upgrade requested for a client"); } if (!prefaceSent()) { // If the preface was not sent yet it most likely means the handler was not added to the pipeline before // calling this method. throw connectionError(INTERNAL_ERROR, "HTTP upgrade must occur after preface was sent"); } if (decoder.prefaceReceived()) { throw connectionError(PROTOCOL_ERROR, "HTTP upgrade must occur before HTTP/2 preface is received"); } // Apply the settings but no ACK is necessary. encoder.remoteSettings(settings); // Create a stream in the half-closed state. connection().remote().createStream(HTTP_UPGRADE_STREAM_ID, true); }
java
public void onHttpServerUpgrade(Http2Settings settings) throws Http2Exception { if (!connection().isServer()) { throw connectionError(PROTOCOL_ERROR, "Server-side HTTP upgrade requested for a client"); } if (!prefaceSent()) { // If the preface was not sent yet it most likely means the handler was not added to the pipeline before // calling this method. throw connectionError(INTERNAL_ERROR, "HTTP upgrade must occur after preface was sent"); } if (decoder.prefaceReceived()) { throw connectionError(PROTOCOL_ERROR, "HTTP upgrade must occur before HTTP/2 preface is received"); } // Apply the settings but no ACK is necessary. encoder.remoteSettings(settings); // Create a stream in the half-closed state. connection().remote().createStream(HTTP_UPGRADE_STREAM_ID, true); }
[ "public", "void", "onHttpServerUpgrade", "(", "Http2Settings", "settings", ")", "throws", "Http2Exception", "{", "if", "(", "!", "connection", "(", ")", ".", "isServer", "(", ")", ")", "{", "throw", "connectionError", "(", "PROTOCOL_ERROR", ",", "\"Server-side HTTP upgrade requested for a client\"", ")", ";", "}", "if", "(", "!", "prefaceSent", "(", ")", ")", "{", "// If the preface was not sent yet it most likely means the handler was not added to the pipeline before", "// calling this method.", "throw", "connectionError", "(", "INTERNAL_ERROR", ",", "\"HTTP upgrade must occur after preface was sent\"", ")", ";", "}", "if", "(", "decoder", ".", "prefaceReceived", "(", ")", ")", "{", "throw", "connectionError", "(", "PROTOCOL_ERROR", ",", "\"HTTP upgrade must occur before HTTP/2 preface is received\"", ")", ";", "}", "// Apply the settings but no ACK is necessary.", "encoder", ".", "remoteSettings", "(", "settings", ")", ";", "// Create a stream in the half-closed state.", "connection", "(", ")", ".", "remote", "(", ")", ".", "createStream", "(", "HTTP_UPGRADE_STREAM_ID", ",", "true", ")", ";", "}" ]
Handles the server-side (cleartext) upgrade from HTTP to HTTP/2. @param settings the settings for the remote endpoint.
[ "Handles", "the", "server", "-", "side", "(", "cleartext", ")", "upgrade", "from", "HTTP", "to", "HTTP", "/", "2", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L164-L182
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/api/Database.java
Database.getAttachment
public InputStream getAttachment(String docId, String attachmentName, String revId) { """ Reads an attachment from the database. The stream must be closed after usage, otherwise http connection leaks will occur. @param docId the document id @param attachmentName the attachment name @param revId the document revision id or {@code null} @return the attachment in the form of an {@code InputStream}. """ return db.getAttachment(docId, attachmentName, revId); }
java
public InputStream getAttachment(String docId, String attachmentName, String revId) { return db.getAttachment(docId, attachmentName, revId); }
[ "public", "InputStream", "getAttachment", "(", "String", "docId", ",", "String", "attachmentName", ",", "String", "revId", ")", "{", "return", "db", ".", "getAttachment", "(", "docId", ",", "attachmentName", ",", "revId", ")", ";", "}" ]
Reads an attachment from the database. The stream must be closed after usage, otherwise http connection leaks will occur. @param docId the document id @param attachmentName the attachment name @param revId the document revision id or {@code null} @return the attachment in the form of an {@code InputStream}.
[ "Reads", "an", "attachment", "from", "the", "database", "." ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L1218-L1220
drewwills/cernunnos
cernunnos-core/src/main/java/org/danann/cernunnos/sql/UpsertTask.java
UpsertTask.doUpdate
protected int doUpdate(JdbcTemplate jdbcTemplate, TaskRequest req, TaskResponse res) { """ Executes the update and returns the affected row count Moved to its own method to reduce possibility for variable name confusion """ //Setup the update parameters and setter final List<Phrase> parametersInUse = update_parameters != null ? update_parameters : parameters; final PreparedStatementSetter preparedStatementSetter = new PhraseParameterPreparedStatementSetter(parametersInUse, req, res); //Get the update sql and execute the update. final String fUpdateSql = (String) update_sql.evaluate(req, res); return jdbcTemplate.update(fUpdateSql, preparedStatementSetter); }
java
protected int doUpdate(JdbcTemplate jdbcTemplate, TaskRequest req, TaskResponse res) { //Setup the update parameters and setter final List<Phrase> parametersInUse = update_parameters != null ? update_parameters : parameters; final PreparedStatementSetter preparedStatementSetter = new PhraseParameterPreparedStatementSetter(parametersInUse, req, res); //Get the update sql and execute the update. final String fUpdateSql = (String) update_sql.evaluate(req, res); return jdbcTemplate.update(fUpdateSql, preparedStatementSetter); }
[ "protected", "int", "doUpdate", "(", "JdbcTemplate", "jdbcTemplate", ",", "TaskRequest", "req", ",", "TaskResponse", "res", ")", "{", "//Setup the update parameters and setter", "final", "List", "<", "Phrase", ">", "parametersInUse", "=", "update_parameters", "!=", "null", "?", "update_parameters", ":", "parameters", ";", "final", "PreparedStatementSetter", "preparedStatementSetter", "=", "new", "PhraseParameterPreparedStatementSetter", "(", "parametersInUse", ",", "req", ",", "res", ")", ";", "//Get the update sql and execute the update.", "final", "String", "fUpdateSql", "=", "(", "String", ")", "update_sql", ".", "evaluate", "(", "req", ",", "res", ")", ";", "return", "jdbcTemplate", ".", "update", "(", "fUpdateSql", ",", "preparedStatementSetter", ")", ";", "}" ]
Executes the update and returns the affected row count Moved to its own method to reduce possibility for variable name confusion
[ "Executes", "the", "update", "and", "returns", "the", "affected", "row", "count" ]
train
https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/sql/UpsertTask.java#L158-L166
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java
ScenarioPortrayal.addScatterPlot
public void addScatterPlot(String scatterID, String xAxisLabel, String yAxisLabel) throws ShanksException { """ Add a ScatterPlot to the simulation @param scatterID - An ID for the ScatterPlot @param xAxisLabel - The name of the x axis @param yAxisLabel - The name of the y axis @throws ShanksException """ if (!this.timeCharts.containsKey(scatterID)) { ScatterPlotGenerator scatter = new ScatterPlotGenerator(); scatter.setTitle(scatterID); scatter.setXAxisLabel(xAxisLabel); scatter.setYAxisLabel(yAxisLabel); this.scatterPlots.put(scatterID, scatter); } else { throw new DuplicatedChartIDException(scatterID); } }
java
public void addScatterPlot(String scatterID, String xAxisLabel, String yAxisLabel) throws ShanksException { if (!this.timeCharts.containsKey(scatterID)) { ScatterPlotGenerator scatter = new ScatterPlotGenerator(); scatter.setTitle(scatterID); scatter.setXAxisLabel(xAxisLabel); scatter.setYAxisLabel(yAxisLabel); this.scatterPlots.put(scatterID, scatter); } else { throw new DuplicatedChartIDException(scatterID); } }
[ "public", "void", "addScatterPlot", "(", "String", "scatterID", ",", "String", "xAxisLabel", ",", "String", "yAxisLabel", ")", "throws", "ShanksException", "{", "if", "(", "!", "this", ".", "timeCharts", ".", "containsKey", "(", "scatterID", ")", ")", "{", "ScatterPlotGenerator", "scatter", "=", "new", "ScatterPlotGenerator", "(", ")", ";", "scatter", ".", "setTitle", "(", "scatterID", ")", ";", "scatter", ".", "setXAxisLabel", "(", "xAxisLabel", ")", ";", "scatter", ".", "setYAxisLabel", "(", "yAxisLabel", ")", ";", "this", ".", "scatterPlots", ".", "put", "(", "scatterID", ",", "scatter", ")", ";", "}", "else", "{", "throw", "new", "DuplicatedChartIDException", "(", "scatterID", ")", ";", "}", "}" ]
Add a ScatterPlot to the simulation @param scatterID - An ID for the ScatterPlot @param xAxisLabel - The name of the x axis @param yAxisLabel - The name of the y axis @throws ShanksException
[ "Add", "a", "ScatterPlot", "to", "the", "simulation" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java#L261-L271
camunda/camunda-bpm-mockito
src/main/java/org/camunda/bpm/extension/mockito/process/CallActivityMock.java
CallActivityMock.onExecutionAddVariable
public CallActivityMock onExecutionAddVariable(final String key, final Object val) { """ On execution, the MockProcess will add the given process variable @param key ... key of the process variable @param val ... value of the process variable @return self """ return this.onExecutionAddVariables(createVariables().putValue(key, val)); }
java
public CallActivityMock onExecutionAddVariable(final String key, final Object val){ return this.onExecutionAddVariables(createVariables().putValue(key, val)); }
[ "public", "CallActivityMock", "onExecutionAddVariable", "(", "final", "String", "key", ",", "final", "Object", "val", ")", "{", "return", "this", ".", "onExecutionAddVariables", "(", "createVariables", "(", ")", ".", "putValue", "(", "key", ",", "val", ")", ")", ";", "}" ]
On execution, the MockProcess will add the given process variable @param key ... key of the process variable @param val ... value of the process variable @return self
[ "On", "execution", "the", "MockProcess", "will", "add", "the", "given", "process", "variable" ]
train
https://github.com/camunda/camunda-bpm-mockito/blob/77b86c9710813f0bfa59b92985e126a9dad66eef/src/main/java/org/camunda/bpm/extension/mockito/process/CallActivityMock.java#L66-L68
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.searchDescending
public static int searchDescending(char[] charArray, char value) { """ Search for the value in the reverse sorted char array and return the index. @param charArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1. """ int start = 0; int end = charArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == charArray[middle]) { return middle; } if(value > charArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int searchDescending(char[] charArray, char value) { int start = 0; int end = charArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == charArray[middle]) { return middle; } if(value > charArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "searchDescending", "(", "char", "[", "]", "charArray", ",", "char", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "charArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", "(", "start", "<=", "end", ")", "{", "middle", "=", "(", "start", "+", "end", ")", ">>", "1", ";", "if", "(", "value", "==", "charArray", "[", "middle", "]", ")", "{", "return", "middle", ";", "}", "if", "(", "value", ">", "charArray", "[", "middle", "]", ")", "{", "end", "=", "middle", "-", "1", ";", "}", "else", "{", "start", "=", "middle", "+", "1", ";", "}", "}", "return", "-", "1", ";", "}" ]
Search for the value in the reverse sorted char array and return the index. @param charArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "reverse", "sorted", "char", "array", "and", "return", "the", "index", "." ]
train
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L441-L463
haraldk/TwelveMonkeys
imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/stream/URLImageInputStreamSpi.java
URLImageInputStreamSpi.createInputStreamInstance
public ImageInputStream createInputStreamInstance(final Object pInput, final boolean pUseCache, final File pCacheDir) throws IOException { """ The bad thing is that most people don't expect there to be an UR[I|L]ImageInputStreamSpi.. """ if (pInput instanceof URL) { URL url = (URL) pInput; // Special case for file protocol, a lot faster than FileCacheImageInputStream if ("file".equals(url.getProtocol())) { try { return new BufferedImageInputStream(new FileImageInputStream(new File(url.toURI()))); } catch (URISyntaxException ignore) { // This should never happen, but if it does, we'll fall back to using the stream ignore.printStackTrace(); } } // Otherwise revert to cached final InputStream stream = url.openStream(); if (pUseCache) { return new BufferedImageInputStream(new FileCacheImageInputStream(stream, pCacheDir) { @Override public void close() throws IOException { try { super.close(); } finally { stream.close(); // NOTE: If this line throws IOE, it will shadow the original.. } } }); } else { return new MemoryCacheImageInputStream(stream) { @Override public void close() throws IOException { try { super.close(); } finally { stream.close(); // NOTE: If this line throws IOE, it will shadow the original.. } } }; } } else { throw new IllegalArgumentException("Expected input of type URL: " + pInput); } }
java
public ImageInputStream createInputStreamInstance(final Object pInput, final boolean pUseCache, final File pCacheDir) throws IOException { if (pInput instanceof URL) { URL url = (URL) pInput; // Special case for file protocol, a lot faster than FileCacheImageInputStream if ("file".equals(url.getProtocol())) { try { return new BufferedImageInputStream(new FileImageInputStream(new File(url.toURI()))); } catch (URISyntaxException ignore) { // This should never happen, but if it does, we'll fall back to using the stream ignore.printStackTrace(); } } // Otherwise revert to cached final InputStream stream = url.openStream(); if (pUseCache) { return new BufferedImageInputStream(new FileCacheImageInputStream(stream, pCacheDir) { @Override public void close() throws IOException { try { super.close(); } finally { stream.close(); // NOTE: If this line throws IOE, it will shadow the original.. } } }); } else { return new MemoryCacheImageInputStream(stream) { @Override public void close() throws IOException { try { super.close(); } finally { stream.close(); // NOTE: If this line throws IOE, it will shadow the original.. } } }; } } else { throw new IllegalArgumentException("Expected input of type URL: " + pInput); } }
[ "public", "ImageInputStream", "createInputStreamInstance", "(", "final", "Object", "pInput", ",", "final", "boolean", "pUseCache", ",", "final", "File", "pCacheDir", ")", "throws", "IOException", "{", "if", "(", "pInput", "instanceof", "URL", ")", "{", "URL", "url", "=", "(", "URL", ")", "pInput", ";", "// Special case for file protocol, a lot faster than FileCacheImageInputStream", "if", "(", "\"file\"", ".", "equals", "(", "url", ".", "getProtocol", "(", ")", ")", ")", "{", "try", "{", "return", "new", "BufferedImageInputStream", "(", "new", "FileImageInputStream", "(", "new", "File", "(", "url", ".", "toURI", "(", ")", ")", ")", ")", ";", "}", "catch", "(", "URISyntaxException", "ignore", ")", "{", "// This should never happen, but if it does, we'll fall back to using the stream ", "ignore", ".", "printStackTrace", "(", ")", ";", "}", "}", "// Otherwise revert to cached", "final", "InputStream", "stream", "=", "url", ".", "openStream", "(", ")", ";", "if", "(", "pUseCache", ")", "{", "return", "new", "BufferedImageInputStream", "(", "new", "FileCacheImageInputStream", "(", "stream", ",", "pCacheDir", ")", "{", "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "try", "{", "super", ".", "close", "(", ")", ";", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "// NOTE: If this line throws IOE, it will shadow the original..", "}", "}", "}", ")", ";", "}", "else", "{", "return", "new", "MemoryCacheImageInputStream", "(", "stream", ")", "{", "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "try", "{", "super", ".", "close", "(", ")", ";", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "// NOTE: If this line throws IOE, it will shadow the original..", "}", "}", "}", ";", "}", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Expected input of type URL: \"", "+", "pInput", ")", ";", "}", "}" ]
The bad thing is that most people don't expect there to be an UR[I|L]ImageInputStreamSpi..
[ "The", "bad", "thing", "is", "that", "most", "people", "don", "t", "expect", "there", "to", "be", "an", "UR", "[", "I|L", "]", "ImageInputStreamSpi", ".." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/stream/URLImageInputStreamSpi.java#L62-L109
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java
MathBindings.floorDiv
public static IntegerBinding floorDiv(final ObservableIntegerValue x, final ObservableIntegerValue y) { """ Binding for {@link java.lang.Math#floorDiv(int, int)} @param x the dividend @param y the divisor @return the largest (closest to positive infinity) {@code int} value that is less than or equal to the algebraic quotient. @throws ArithmeticException if the divisor {@code y} is zero """ return createIntegerBinding(() -> Math.floorDiv(x.get(), y.get()), x, y); }
java
public static IntegerBinding floorDiv(final ObservableIntegerValue x, final ObservableIntegerValue y) { return createIntegerBinding(() -> Math.floorDiv(x.get(), y.get()), x, y); }
[ "public", "static", "IntegerBinding", "floorDiv", "(", "final", "ObservableIntegerValue", "x", ",", "final", "ObservableIntegerValue", "y", ")", "{", "return", "createIntegerBinding", "(", "(", ")", "->", "Math", ".", "floorDiv", "(", "x", ".", "get", "(", ")", ",", "y", ".", "get", "(", ")", ")", ",", "x", ",", "y", ")", ";", "}" ]
Binding for {@link java.lang.Math#floorDiv(int, int)} @param x the dividend @param y the divisor @return the largest (closest to positive infinity) {@code int} value that is less than or equal to the algebraic quotient. @throws ArithmeticException if the divisor {@code y} is zero
[ "Binding", "for", "{", "@link", "java", ".", "lang", ".", "Math#floorDiv", "(", "int", "int", ")", "}" ]
train
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L414-L416
dkpro/dkpro-argumentation
dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java
JCasUtil2.hasAny
public static <T extends TOP> boolean hasAny(final Class<T> type, final JCas aJCas) { """ Returns whether there is any feature structure of the given type @param type the type @param aJCas the JCas @return whether there is any feature structure of the given type """ return count(type, aJCas) != 0; }
java
public static <T extends TOP> boolean hasAny(final Class<T> type, final JCas aJCas) { return count(type, aJCas) != 0; }
[ "public", "static", "<", "T", "extends", "TOP", ">", "boolean", "hasAny", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "JCas", "aJCas", ")", "{", "return", "count", "(", "type", ",", "aJCas", ")", "!=", "0", ";", "}" ]
Returns whether there is any feature structure of the given type @param type the type @param aJCas the JCas @return whether there is any feature structure of the given type
[ "Returns", "whether", "there", "is", "any", "feature", "structure", "of", "the", "given", "type" ]
train
https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java#L66-L69
real-logic/agrona
agrona/src/main/java/org/agrona/concurrent/status/CountersReader.java
CountersReader.forEach
public void forEach(final MetaData metaData) { """ Iterate over all the metadata in the buffer. @param metaData function to be called for each metadata record. """ int counterId = 0; final AtomicBuffer metaDataBuffer = this.metaDataBuffer; for (int i = 0, capacity = metaDataBuffer.capacity(); i < capacity; i += METADATA_LENGTH) { final int recordStatus = metaDataBuffer.getIntVolatile(i); if (RECORD_ALLOCATED == recordStatus) { final int typeId = metaDataBuffer.getInt(i + TYPE_ID_OFFSET); final String label = labelValue(metaDataBuffer, i); final DirectBuffer keyBuffer = new UnsafeBuffer(metaDataBuffer, i + KEY_OFFSET, MAX_KEY_LENGTH); metaData.accept(counterId, typeId, keyBuffer, label); } else if (RECORD_UNUSED == recordStatus) { break; } counterId++; } }
java
public void forEach(final MetaData metaData) { int counterId = 0; final AtomicBuffer metaDataBuffer = this.metaDataBuffer; for (int i = 0, capacity = metaDataBuffer.capacity(); i < capacity; i += METADATA_LENGTH) { final int recordStatus = metaDataBuffer.getIntVolatile(i); if (RECORD_ALLOCATED == recordStatus) { final int typeId = metaDataBuffer.getInt(i + TYPE_ID_OFFSET); final String label = labelValue(metaDataBuffer, i); final DirectBuffer keyBuffer = new UnsafeBuffer(metaDataBuffer, i + KEY_OFFSET, MAX_KEY_LENGTH); metaData.accept(counterId, typeId, keyBuffer, label); } else if (RECORD_UNUSED == recordStatus) { break; } counterId++; } }
[ "public", "void", "forEach", "(", "final", "MetaData", "metaData", ")", "{", "int", "counterId", "=", "0", ";", "final", "AtomicBuffer", "metaDataBuffer", "=", "this", ".", "metaDataBuffer", ";", "for", "(", "int", "i", "=", "0", ",", "capacity", "=", "metaDataBuffer", ".", "capacity", "(", ")", ";", "i", "<", "capacity", ";", "i", "+=", "METADATA_LENGTH", ")", "{", "final", "int", "recordStatus", "=", "metaDataBuffer", ".", "getIntVolatile", "(", "i", ")", ";", "if", "(", "RECORD_ALLOCATED", "==", "recordStatus", ")", "{", "final", "int", "typeId", "=", "metaDataBuffer", ".", "getInt", "(", "i", "+", "TYPE_ID_OFFSET", ")", ";", "final", "String", "label", "=", "labelValue", "(", "metaDataBuffer", ",", "i", ")", ";", "final", "DirectBuffer", "keyBuffer", "=", "new", "UnsafeBuffer", "(", "metaDataBuffer", ",", "i", "+", "KEY_OFFSET", ",", "MAX_KEY_LENGTH", ")", ";", "metaData", ".", "accept", "(", "counterId", ",", "typeId", ",", "keyBuffer", ",", "label", ")", ";", "}", "else", "if", "(", "RECORD_UNUSED", "==", "recordStatus", ")", "{", "break", ";", "}", "counterId", "++", ";", "}", "}" ]
Iterate over all the metadata in the buffer. @param metaData function to be called for each metadata record.
[ "Iterate", "over", "all", "the", "metadata", "in", "the", "buffer", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/concurrent/status/CountersReader.java#L342-L366
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/Money.java
Money.ofMinor
public static Money ofMinor(CurrencyUnit currency, long amountMinor, int factionDigits) { """ Obtains an instance of {@code Money} from an amount in minor units. For example, {@code ofMinor(USD, 1234, 2)} creates the instance {@code USD 12.34}. @param currency the currency, not null @param amountMinor the amount of money in the minor division of the currency @param factionDigits number of digits @return the monetary amount from minor units @see CurrencyUnit#getDefaultFractionDigits() @see Money#ofMinor(CurrencyUnit, long, int) @throws NullPointerException when the currency is null @throws IllegalArgumentException when the factionDigits is negative @since 1.0.1 """ if(factionDigits < 0) { throw new IllegalArgumentException("The factionDigits cannot be negative"); } return of(BigDecimal.valueOf(amountMinor, factionDigits), currency); }
java
public static Money ofMinor(CurrencyUnit currency, long amountMinor, int factionDigits) { if(factionDigits < 0) { throw new IllegalArgumentException("The factionDigits cannot be negative"); } return of(BigDecimal.valueOf(amountMinor, factionDigits), currency); }
[ "public", "static", "Money", "ofMinor", "(", "CurrencyUnit", "currency", ",", "long", "amountMinor", ",", "int", "factionDigits", ")", "{", "if", "(", "factionDigits", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The factionDigits cannot be negative\"", ")", ";", "}", "return", "of", "(", "BigDecimal", ".", "valueOf", "(", "amountMinor", ",", "factionDigits", ")", ",", "currency", ")", ";", "}" ]
Obtains an instance of {@code Money} from an amount in minor units. For example, {@code ofMinor(USD, 1234, 2)} creates the instance {@code USD 12.34}. @param currency the currency, not null @param amountMinor the amount of money in the minor division of the currency @param factionDigits number of digits @return the monetary amount from minor units @see CurrencyUnit#getDefaultFractionDigits() @see Money#ofMinor(CurrencyUnit, long, int) @throws NullPointerException when the currency is null @throws IllegalArgumentException when the factionDigits is negative @since 1.0.1
[ "Obtains", "an", "instance", "of", "{" ]
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/Money.java#L829-L834
TNG/JGiven
jgiven-core/src/main/java/com/tngtech/jgiven/report/ReportGenerator.java
ReportGenerator.generateHtml5Report
public static AbstractReportGenerator generateHtml5Report() { """ Searches the Html5ReportGenerator in Java path and instantiates the report """ AbstractReportGenerator report; try { Class<?> aClass = new ReportGenerator().getClass().getClassLoader() .loadClass( "com.tngtech.jgiven.report.html5.Html5ReportGenerator" ); report = (AbstractReportGenerator) aClass.newInstance(); } catch( ClassNotFoundException e ) { throw new JGivenInstallationException( "The JGiven HTML5 Report Generator seems not to be on the classpath.\n" + "Ensure that you have a dependency to jgiven-html5-report." ); } catch( Exception e ) { throw new JGivenInternalDefectException( "The HTML5 Report Generator could not be instantiated.", e ); } return report; }
java
public static AbstractReportGenerator generateHtml5Report() { AbstractReportGenerator report; try { Class<?> aClass = new ReportGenerator().getClass().getClassLoader() .loadClass( "com.tngtech.jgiven.report.html5.Html5ReportGenerator" ); report = (AbstractReportGenerator) aClass.newInstance(); } catch( ClassNotFoundException e ) { throw new JGivenInstallationException( "The JGiven HTML5 Report Generator seems not to be on the classpath.\n" + "Ensure that you have a dependency to jgiven-html5-report." ); } catch( Exception e ) { throw new JGivenInternalDefectException( "The HTML5 Report Generator could not be instantiated.", e ); } return report; }
[ "public", "static", "AbstractReportGenerator", "generateHtml5Report", "(", ")", "{", "AbstractReportGenerator", "report", ";", "try", "{", "Class", "<", "?", ">", "aClass", "=", "new", "ReportGenerator", "(", ")", ".", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ".", "loadClass", "(", "\"com.tngtech.jgiven.report.html5.Html5ReportGenerator\"", ")", ";", "report", "=", "(", "AbstractReportGenerator", ")", "aClass", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "JGivenInstallationException", "(", "\"The JGiven HTML5 Report Generator seems not to be on the classpath.\\n\"", "+", "\"Ensure that you have a dependency to jgiven-html5-report.\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "JGivenInternalDefectException", "(", "\"The HTML5 Report Generator could not be instantiated.\"", ",", "e", ")", ";", "}", "return", "report", ";", "}" ]
Searches the Html5ReportGenerator in Java path and instantiates the report
[ "Searches", "the", "Html5ReportGenerator", "in", "Java", "path", "and", "instantiates", "the", "report" ]
train
https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/report/ReportGenerator.java#L67-L80
timewalker74/ffmq
core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java
BlockBasedDataStoreTools.findJournalFiles
public static File[] findJournalFiles( String baseName , File dataFolder ) { """ Find existing journal files for a given base name @param baseName @param dataFolder @return an array of journal files """ final String journalBase = baseName+JournalFile.SUFFIX; File[] journalFiles = dataFolder.listFiles(new FileFilter() { /* * (non-Javadoc) * @see java.io.FileFilter#accept(java.io.File) */ @Override public boolean accept(File pathname) { if (!pathname.isFile()) return false; return pathname.getName().startsWith(journalBase) && !pathname.getName().endsWith(JournalFile.RECYCLED_SUFFIX); } }); // Sort them in ascending order Arrays.sort(journalFiles, new Comparator<File>() { @Override public int compare(File f1, File f2) { return f1.getName().compareTo(f2.getName()); } }); return journalFiles; }
java
public static File[] findJournalFiles( String baseName , File dataFolder ) { final String journalBase = baseName+JournalFile.SUFFIX; File[] journalFiles = dataFolder.listFiles(new FileFilter() { /* * (non-Javadoc) * @see java.io.FileFilter#accept(java.io.File) */ @Override public boolean accept(File pathname) { if (!pathname.isFile()) return false; return pathname.getName().startsWith(journalBase) && !pathname.getName().endsWith(JournalFile.RECYCLED_SUFFIX); } }); // Sort them in ascending order Arrays.sort(journalFiles, new Comparator<File>() { @Override public int compare(File f1, File f2) { return f1.getName().compareTo(f2.getName()); } }); return journalFiles; }
[ "public", "static", "File", "[", "]", "findJournalFiles", "(", "String", "baseName", ",", "File", "dataFolder", ")", "{", "final", "String", "journalBase", "=", "baseName", "+", "JournalFile", ".", "SUFFIX", ";", "File", "[", "]", "journalFiles", "=", "dataFolder", ".", "listFiles", "(", "new", "FileFilter", "(", ")", "{", "/*\n\t\t\t * (non-Javadoc)\n\t\t\t * @see java.io.FileFilter#accept(java.io.File)\n\t\t\t */", "@", "Override", "public", "boolean", "accept", "(", "File", "pathname", ")", "{", "if", "(", "!", "pathname", ".", "isFile", "(", ")", ")", "return", "false", ";", "return", "pathname", ".", "getName", "(", ")", ".", "startsWith", "(", "journalBase", ")", "&&", "!", "pathname", ".", "getName", "(", ")", ".", "endsWith", "(", "JournalFile", ".", "RECYCLED_SUFFIX", ")", ";", "}", "}", ")", ";", "// Sort them in ascending order", "Arrays", ".", "sort", "(", "journalFiles", ",", "new", "Comparator", "<", "File", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "File", "f1", ",", "File", "f2", ")", "{", "return", "f1", ".", "getName", "(", ")", ".", "compareTo", "(", "f2", ".", "getName", "(", ")", ")", ";", "}", "}", ")", ";", "return", "journalFiles", ";", "}" ]
Find existing journal files for a given base name @param baseName @param dataFolder @return an array of journal files
[ "Find", "existing", "journal", "files", "for", "a", "given", "base", "name" ]
train
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/storage/data/impl/BlockBasedDataStoreTools.java#L163-L192
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/parameterization/ListParameterization.java
ListParameterization.addParameter
public ListParameterization addParameter(String optionid, Object value) { """ Add a parameter to the parameter list @param optionid Option ID @param value Value @return this, for chaining """ optionid = optionid.startsWith(SerializedParameterization.OPTION_PREFIX) ? optionid.substring(SerializedParameterization.OPTION_PREFIX.length()) : optionid; parameters.add(new ParameterPair(optionid, value)); return this; }
java
public ListParameterization addParameter(String optionid, Object value) { optionid = optionid.startsWith(SerializedParameterization.OPTION_PREFIX) ? optionid.substring(SerializedParameterization.OPTION_PREFIX.length()) : optionid; parameters.add(new ParameterPair(optionid, value)); return this; }
[ "public", "ListParameterization", "addParameter", "(", "String", "optionid", ",", "Object", "value", ")", "{", "optionid", "=", "optionid", ".", "startsWith", "(", "SerializedParameterization", ".", "OPTION_PREFIX", ")", "?", "optionid", ".", "substring", "(", "SerializedParameterization", ".", "OPTION_PREFIX", ".", "length", "(", ")", ")", ":", "optionid", ";", "parameters", ".", "add", "(", "new", "ParameterPair", "(", "optionid", ",", "value", ")", ")", ";", "return", "this", ";", "}" ]
Add a parameter to the parameter list @param optionid Option ID @param value Value @return this, for chaining
[ "Add", "a", "parameter", "to", "the", "parameter", "list" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/parameterization/ListParameterization.java#L123-L127
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java
JdbcCpoAdapter.processSelectGroup
protected <T> T processSelectGroup(T obj, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException { """ Retrieves the Object from the datasource. @param obj This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. The input object is used to specify the search criteria. @param groupName The name which identifies which RETRIEVE Function Group to execute to retrieve the object. @param wheres A collection of CpoWhere objects to be used by the function @param orderBy A collection of CpoOrderBy objects to be used by the function @param nativeExpressions A collection of CpoNativeFunction objects to be used by the function @return A populated object of the same type as the Object passed in as a argument. If no objects match the criteria a NULL will be returned. @throws CpoException the retrieve function defined for this objects returns more than one row, an exception will be thrown. """ Connection c = null; T result = null; try { c = getReadConnection(); result = processSelectGroup(obj, groupName, wheres, orderBy, nativeExpressions, c); // The select may have a for update clause on it // Since the connection is cached we need to get rid of this commitLocalConnection(c); } catch (Exception e) { // Any exception has to try to rollback the work; rollbackLocalConnection(c); ExceptionHelper.reThrowCpoException(e, "processSelectGroup(Object obj, String groupName) failed"); } finally { closeLocalConnection(c); } return result; }
java
protected <T> T processSelectGroup(T obj, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException { Connection c = null; T result = null; try { c = getReadConnection(); result = processSelectGroup(obj, groupName, wheres, orderBy, nativeExpressions, c); // The select may have a for update clause on it // Since the connection is cached we need to get rid of this commitLocalConnection(c); } catch (Exception e) { // Any exception has to try to rollback the work; rollbackLocalConnection(c); ExceptionHelper.reThrowCpoException(e, "processSelectGroup(Object obj, String groupName) failed"); } finally { closeLocalConnection(c); } return result; }
[ "protected", "<", "T", ">", "T", "processSelectGroup", "(", "T", "obj", ",", "String", "groupName", ",", "Collection", "<", "CpoWhere", ">", "wheres", ",", "Collection", "<", "CpoOrderBy", ">", "orderBy", ",", "Collection", "<", "CpoNativeFunction", ">", "nativeExpressions", ")", "throws", "CpoException", "{", "Connection", "c", "=", "null", ";", "T", "result", "=", "null", ";", "try", "{", "c", "=", "getReadConnection", "(", ")", ";", "result", "=", "processSelectGroup", "(", "obj", ",", "groupName", ",", "wheres", ",", "orderBy", ",", "nativeExpressions", ",", "c", ")", ";", "// The select may have a for update clause on it", "// Since the connection is cached we need to get rid of this", "commitLocalConnection", "(", "c", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// Any exception has to try to rollback the work;", "rollbackLocalConnection", "(", "c", ")", ";", "ExceptionHelper", ".", "reThrowCpoException", "(", "e", ",", "\"processSelectGroup(Object obj, String groupName) failed\"", ")", ";", "}", "finally", "{", "closeLocalConnection", "(", "c", ")", ";", "}", "return", "result", ";", "}" ]
Retrieves the Object from the datasource. @param obj This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. The input object is used to specify the search criteria. @param groupName The name which identifies which RETRIEVE Function Group to execute to retrieve the object. @param wheres A collection of CpoWhere objects to be used by the function @param orderBy A collection of CpoOrderBy objects to be used by the function @param nativeExpressions A collection of CpoNativeFunction objects to be used by the function @return A populated object of the same type as the Object passed in as a argument. If no objects match the criteria a NULL will be returned. @throws CpoException the retrieve function defined for this objects returns more than one row, an exception will be thrown.
[ "Retrieves", "the", "Object", "from", "the", "datasource", "." ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L2273-L2293
aws/aws-sdk-java
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/utils/ModelLoaderUtils.java
ModelLoaderUtils.loadConfigurationModel
public static <T> T loadConfigurationModel(Class<T> clzz, String configurationFileLocation) { """ Deserialize the contents of a given configuration file. @param clzz Class to deserialize into @param configurationFileLocation Location of config file to load @return Marshalled configuration class """ System.out.println("Loading config file " + configurationFileLocation); InputStream fileContents = null; try { fileContents = getRequiredResourceAsStream(configurationFileLocation); return Jackson.load(clzz, fileContents); } catch (IOException e) { System.err.println("Failed to read the configuration file " + configurationFileLocation); throw new RuntimeException(e); } finally { if (fileContents != null) { Utils.closeQuietly(fileContents); } } }
java
public static <T> T loadConfigurationModel(Class<T> clzz, String configurationFileLocation) { System.out.println("Loading config file " + configurationFileLocation); InputStream fileContents = null; try { fileContents = getRequiredResourceAsStream(configurationFileLocation); return Jackson.load(clzz, fileContents); } catch (IOException e) { System.err.println("Failed to read the configuration file " + configurationFileLocation); throw new RuntimeException(e); } finally { if (fileContents != null) { Utils.closeQuietly(fileContents); } } }
[ "public", "static", "<", "T", ">", "T", "loadConfigurationModel", "(", "Class", "<", "T", ">", "clzz", ",", "String", "configurationFileLocation", ")", "{", "System", ".", "out", ".", "println", "(", "\"Loading config file \"", "+", "configurationFileLocation", ")", ";", "InputStream", "fileContents", "=", "null", ";", "try", "{", "fileContents", "=", "getRequiredResourceAsStream", "(", "configurationFileLocation", ")", ";", "return", "Jackson", ".", "load", "(", "clzz", ",", "fileContents", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Failed to read the configuration file \"", "+", "configurationFileLocation", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "fileContents", "!=", "null", ")", "{", "Utils", ".", "closeQuietly", "(", "fileContents", ")", ";", "}", "}", "}" ]
Deserialize the contents of a given configuration file. @param clzz Class to deserialize into @param configurationFileLocation Location of config file to load @return Marshalled configuration class
[ "Deserialize", "the", "contents", "of", "a", "given", "configuration", "file", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/utils/ModelLoaderUtils.java#L39-L53
bmwcarit/joynr
java/core/libjoynr/src/main/java/io/joynr/arbitration/VersionCompatibilityChecker.java
VersionCompatibilityChecker.check
public boolean check(Version caller, Version provider) { """ Compatibility of two versions is defined as the caller and provider versions having the same major version, and the provider having the same or a higher minor version as the caller. @param caller the version of the participant performing the call. Must not be <code>null</code>. If either major or minor is <code>null</code>, this will be interpreted as <code>0</code>. @param provider the version of the provider who is being called. Must not be <code>null</code>. If either major or minor is <code>null</code>, this will be interpreted as <code>0</code>. @return <code>true</code> if the versions are compatible as described above, or <code>false</code> if not. @throws IllegalArgumentException if either caller or provider are <code>null</code>. """ if (caller == null || provider == null) { throw new IllegalArgumentException(format("Both caller (%s) and provider (%s) must be non-null.", caller, provider)); } if (caller.getMajorVersion() == null || caller.getMinorVersion() == null || provider.getMajorVersion() == null || provider.getMinorVersion() == null) { throw new IllegalArgumentException(format("Neither major nor minor version values can be null in either caller %s or provider %s.", caller, provider)); } int callerMajor = caller.getMajorVersion(); int callerMinor = caller.getMinorVersion(); int providerMajor = provider.getMajorVersion(); int providerMinor = provider.getMinorVersion(); return callerMajor == providerMajor && callerMinor <= providerMinor; }
java
public boolean check(Version caller, Version provider) { if (caller == null || provider == null) { throw new IllegalArgumentException(format("Both caller (%s) and provider (%s) must be non-null.", caller, provider)); } if (caller.getMajorVersion() == null || caller.getMinorVersion() == null || provider.getMajorVersion() == null || provider.getMinorVersion() == null) { throw new IllegalArgumentException(format("Neither major nor minor version values can be null in either caller %s or provider %s.", caller, provider)); } int callerMajor = caller.getMajorVersion(); int callerMinor = caller.getMinorVersion(); int providerMajor = provider.getMajorVersion(); int providerMinor = provider.getMinorVersion(); return callerMajor == providerMajor && callerMinor <= providerMinor; }
[ "public", "boolean", "check", "(", "Version", "caller", ",", "Version", "provider", ")", "{", "if", "(", "caller", "==", "null", "||", "provider", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "\"Both caller (%s) and provider (%s) must be non-null.\"", ",", "caller", ",", "provider", ")", ")", ";", "}", "if", "(", "caller", ".", "getMajorVersion", "(", ")", "==", "null", "||", "caller", ".", "getMinorVersion", "(", ")", "==", "null", "||", "provider", ".", "getMajorVersion", "(", ")", "==", "null", "||", "provider", ".", "getMinorVersion", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "\"Neither major nor minor version values can be null in either caller %s or provider %s.\"", ",", "caller", ",", "provider", ")", ")", ";", "}", "int", "callerMajor", "=", "caller", ".", "getMajorVersion", "(", ")", ";", "int", "callerMinor", "=", "caller", ".", "getMinorVersion", "(", ")", ";", "int", "providerMajor", "=", "provider", ".", "getMajorVersion", "(", ")", ";", "int", "providerMinor", "=", "provider", ".", "getMinorVersion", "(", ")", ";", "return", "callerMajor", "==", "providerMajor", "&&", "callerMinor", "<=", "providerMinor", ";", "}" ]
Compatibility of two versions is defined as the caller and provider versions having the same major version, and the provider having the same or a higher minor version as the caller. @param caller the version of the participant performing the call. Must not be <code>null</code>. If either major or minor is <code>null</code>, this will be interpreted as <code>0</code>. @param provider the version of the provider who is being called. Must not be <code>null</code>. If either major or minor is <code>null</code>, this will be interpreted as <code>0</code>. @return <code>true</code> if the versions are compatible as described above, or <code>false</code> if not. @throws IllegalArgumentException if either caller or provider are <code>null</code>.
[ "Compatibility", "of", "two", "versions", "is", "defined", "as", "the", "caller", "and", "provider", "versions", "having", "the", "same", "major", "version", "and", "the", "provider", "having", "the", "same", "or", "a", "higher", "minor", "version", "as", "the", "caller", "." ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/arbitration/VersionCompatibilityChecker.java#L48-L67
rythmengine/rythmengine
src/main/java/org/rythmengine/utils/S.java
S.isNotEqual
public static boolean isNotEqual(String s1, String s2, int modifier) { """ The counter function of {@link #isEqual(String, String, int)} @param s1 @param s2 @param modifier @return true if s1 not equals s2 """ return !isEqual(s1, s2, modifier); }
java
public static boolean isNotEqual(String s1, String s2, int modifier) { return !isEqual(s1, s2, modifier); }
[ "public", "static", "boolean", "isNotEqual", "(", "String", "s1", ",", "String", "s2", ",", "int", "modifier", ")", "{", "return", "!", "isEqual", "(", "s1", ",", "s2", ",", "modifier", ")", ";", "}" ]
The counter function of {@link #isEqual(String, String, int)} @param s1 @param s2 @param modifier @return true if s1 not equals s2
[ "The", "counter", "function", "of", "{", "@link", "#isEqual", "(", "String", "String", "int", ")", "}" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/utils/S.java#L313-L315
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java
CouchDatabaseBase.getAttachment
private InputStream getAttachment(URI uri) { """ Reads an attachment from the database. The stream must be closed after usage, otherwise http connection leaks will occur. @param uri the attachment URI @return the attachment in the form of an {@code InputStream}. """ HttpConnection connection = Http.GET(uri); couchDbClient.execute(connection); try { return connection.responseAsInputStream(); } catch (IOException e) { throw new CouchDbException("Error retrieving response input stream.", e); } }
java
private InputStream getAttachment(URI uri) { HttpConnection connection = Http.GET(uri); couchDbClient.execute(connection); try { return connection.responseAsInputStream(); } catch (IOException e) { throw new CouchDbException("Error retrieving response input stream.", e); } }
[ "private", "InputStream", "getAttachment", "(", "URI", "uri", ")", "{", "HttpConnection", "connection", "=", "Http", ".", "GET", "(", "uri", ")", ";", "couchDbClient", ".", "execute", "(", "connection", ")", ";", "try", "{", "return", "connection", ".", "responseAsInputStream", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CouchDbException", "(", "\"Error retrieving response input stream.\"", ",", "e", ")", ";", "}", "}" ]
Reads an attachment from the database. The stream must be closed after usage, otherwise http connection leaks will occur. @param uri the attachment URI @return the attachment in the form of an {@code InputStream}.
[ "Reads", "an", "attachment", "from", "the", "database", "." ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java#L323-L331
jenkinsci/jenkins
core/src/main/java/hudson/util/BootFailure.java
BootFailure.publish
public void publish(ServletContext context, @CheckForNull File home) { """ Exposes this failure to UI and invoke the hook. @param home JENKINS_HOME if it's already known. """ LOGGER.log(Level.SEVERE, "Failed to initialize Jenkins",this); WebApp.get(context).setApp(this); if (home == null) { return; } new GroovyHookScript("boot-failure", context, home, BootFailure.class.getClassLoader()) .bind("exception",this) .bind("home",home) .bind("servletContext", context) .bind("attempts",loadAttempts(home)) .run(); }
java
public void publish(ServletContext context, @CheckForNull File home) { LOGGER.log(Level.SEVERE, "Failed to initialize Jenkins",this); WebApp.get(context).setApp(this); if (home == null) { return; } new GroovyHookScript("boot-failure", context, home, BootFailure.class.getClassLoader()) .bind("exception",this) .bind("home",home) .bind("servletContext", context) .bind("attempts",loadAttempts(home)) .run(); }
[ "public", "void", "publish", "(", "ServletContext", "context", ",", "@", "CheckForNull", "File", "home", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Failed to initialize Jenkins\"", ",", "this", ")", ";", "WebApp", ".", "get", "(", "context", ")", ".", "setApp", "(", "this", ")", ";", "if", "(", "home", "==", "null", ")", "{", "return", ";", "}", "new", "GroovyHookScript", "(", "\"boot-failure\"", ",", "context", ",", "home", ",", "BootFailure", ".", "class", ".", "getClassLoader", "(", ")", ")", ".", "bind", "(", "\"exception\"", ",", "this", ")", ".", "bind", "(", "\"home\"", ",", "home", ")", ".", "bind", "(", "\"servletContext\"", ",", "context", ")", ".", "bind", "(", "\"attempts\"", ",", "loadAttempts", "(", "home", ")", ")", ".", "run", "(", ")", ";", "}" ]
Exposes this failure to UI and invoke the hook. @param home JENKINS_HOME if it's already known.
[ "Exposes", "this", "failure", "to", "UI", "and", "invoke", "the", "hook", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/BootFailure.java#L39-L52
VoltDB/voltdb
src/frontend/org/voltdb/client/ClientImpl.java
ClientImpl.callProcedureWithClientTimeout
public ClientResponse callProcedureWithClientTimeout( int batchTimeout, boolean allPartition, String procName, long clientTimeout, TimeUnit unit, Object... parameters) throws IOException, NoConnectionsException, ProcCallException { """ Synchronously invoke a procedure call blocking until a result is available. @param batchTimeout procedure invocation batch timeout. @param allPartition whether this is an all-partition invocation @param procName class name (not qualified by package) of the procedure to execute. @param clientTimeout timeout for the procedure @param unit TimeUnit of procedure timeout @param parameters vararg list of procedure's parameter values. @return ClientResponse for execution. @throws org.voltdb.client.ProcCallException @throws NoConnectionsException """ long handle = m_handle.getAndIncrement(); ProcedureInvocation invocation = new ProcedureInvocation(handle, batchTimeout, allPartition, procName, parameters); long nanos = unit.toNanos(clientTimeout); return internalSyncCallProcedure(nanos, invocation); }
java
public ClientResponse callProcedureWithClientTimeout( int batchTimeout, boolean allPartition, String procName, long clientTimeout, TimeUnit unit, Object... parameters) throws IOException, NoConnectionsException, ProcCallException { long handle = m_handle.getAndIncrement(); ProcedureInvocation invocation = new ProcedureInvocation(handle, batchTimeout, allPartition, procName, parameters); long nanos = unit.toNanos(clientTimeout); return internalSyncCallProcedure(nanos, invocation); }
[ "public", "ClientResponse", "callProcedureWithClientTimeout", "(", "int", "batchTimeout", ",", "boolean", "allPartition", ",", "String", "procName", ",", "long", "clientTimeout", ",", "TimeUnit", "unit", ",", "Object", "...", "parameters", ")", "throws", "IOException", ",", "NoConnectionsException", ",", "ProcCallException", "{", "long", "handle", "=", "m_handle", ".", "getAndIncrement", "(", ")", ";", "ProcedureInvocation", "invocation", "=", "new", "ProcedureInvocation", "(", "handle", ",", "batchTimeout", ",", "allPartition", ",", "procName", ",", "parameters", ")", ";", "long", "nanos", "=", "unit", ".", "toNanos", "(", "clientTimeout", ")", ";", "return", "internalSyncCallProcedure", "(", "nanos", ",", "invocation", ")", ";", "}" ]
Synchronously invoke a procedure call blocking until a result is available. @param batchTimeout procedure invocation batch timeout. @param allPartition whether this is an all-partition invocation @param procName class name (not qualified by package) of the procedure to execute. @param clientTimeout timeout for the procedure @param unit TimeUnit of procedure timeout @param parameters vararg list of procedure's parameter values. @return ClientResponse for execution. @throws org.voltdb.client.ProcCallException @throws NoConnectionsException
[ "Synchronously", "invoke", "a", "procedure", "call", "blocking", "until", "a", "result", "is", "available", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/ClientImpl.java#L311-L325
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
Annotate.queueScanTreeAndTypeAnnotate
public void queueScanTreeAndTypeAnnotate(JCTree tree, Env<AttrContext> env, Symbol sym, DiagnosticPosition deferPos) { """ Enqueue tree for scanning of type annotations, attaching to the Symbol sym. """ Assert.checkNonNull(sym); normal(() -> tree.accept(new TypeAnnotate(env, sym, deferPos))); }
java
public void queueScanTreeAndTypeAnnotate(JCTree tree, Env<AttrContext> env, Symbol sym, DiagnosticPosition deferPos) { Assert.checkNonNull(sym); normal(() -> tree.accept(new TypeAnnotate(env, sym, deferPos))); }
[ "public", "void", "queueScanTreeAndTypeAnnotate", "(", "JCTree", "tree", ",", "Env", "<", "AttrContext", ">", "env", ",", "Symbol", "sym", ",", "DiagnosticPosition", "deferPos", ")", "{", "Assert", ".", "checkNonNull", "(", "sym", ")", ";", "normal", "(", "(", ")", "->", "tree", ".", "accept", "(", "new", "TypeAnnotate", "(", "env", ",", "sym", ",", "deferPos", ")", ")", ")", ";", "}" ]
Enqueue tree for scanning of type annotations, attaching to the Symbol sym.
[ "Enqueue", "tree", "for", "scanning", "of", "type", "annotations", "attaching", "to", "the", "Symbol", "sym", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L981-L986
headius/invokebinder
src/main/java/com/headius/invokebinder/SmartBinder.java
SmartBinder.foldStatic
public SmartBinder foldStatic(String newName, Lookup lookup, Class<?> target, String method) { """ Acquire a static folding function from the given target class, using the given name and Lookup. Pass all arguments to that function and insert the resulting value as newName into the argument list. @param newName the name of the new first argument where the fold function's result will be passed @param lookup the Lookup to use for acquiring a folding function @param target the class on which to find the folding function @param method the name of the method to become a folding function @return a new SmartBinder with the fold applied """ Binder newBinder = binder.foldStatic(lookup, target, method); return new SmartBinder(this, signature().prependArg(newName, newBinder.type().parameterType(0)), binder); }
java
public SmartBinder foldStatic(String newName, Lookup lookup, Class<?> target, String method) { Binder newBinder = binder.foldStatic(lookup, target, method); return new SmartBinder(this, signature().prependArg(newName, newBinder.type().parameterType(0)), binder); }
[ "public", "SmartBinder", "foldStatic", "(", "String", "newName", ",", "Lookup", "lookup", ",", "Class", "<", "?", ">", "target", ",", "String", "method", ")", "{", "Binder", "newBinder", "=", "binder", ".", "foldStatic", "(", "lookup", ",", "target", ",", "method", ")", ";", "return", "new", "SmartBinder", "(", "this", ",", "signature", "(", ")", ".", "prependArg", "(", "newName", ",", "newBinder", ".", "type", "(", ")", ".", "parameterType", "(", "0", ")", ")", ",", "binder", ")", ";", "}" ]
Acquire a static folding function from the given target class, using the given name and Lookup. Pass all arguments to that function and insert the resulting value as newName into the argument list. @param newName the name of the new first argument where the fold function's result will be passed @param lookup the Lookup to use for acquiring a folding function @param target the class on which to find the folding function @param method the name of the method to become a folding function @return a new SmartBinder with the fold applied
[ "Acquire", "a", "static", "folding", "function", "from", "the", "given", "target", "class", "using", "the", "given", "name", "and", "Lookup", ".", "Pass", "all", "arguments", "to", "that", "function", "and", "insert", "the", "resulting", "value", "as", "newName", "into", "the", "argument", "list", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartBinder.java#L230-L233
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java
AbstractJobLauncher.getJobLock
protected JobLock getJobLock(Properties properties, JobLockEventListener jobLockEventListener) throws JobLockException { """ Get a {@link JobLock} to be used for the job. @param properties the job properties @param jobLockEventListener the listener for lock events. @return {@link JobLock} to be used for the job @throws JobLockException throw when the {@link JobLock} fails to initialize """ return LegacyJobLockFactoryManager.getJobLock(properties, jobLockEventListener); }
java
protected JobLock getJobLock(Properties properties, JobLockEventListener jobLockEventListener) throws JobLockException { return LegacyJobLockFactoryManager.getJobLock(properties, jobLockEventListener); }
[ "protected", "JobLock", "getJobLock", "(", "Properties", "properties", ",", "JobLockEventListener", "jobLockEventListener", ")", "throws", "JobLockException", "{", "return", "LegacyJobLockFactoryManager", ".", "getJobLock", "(", "properties", ",", "jobLockEventListener", ")", ";", "}" ]
Get a {@link JobLock} to be used for the job. @param properties the job properties @param jobLockEventListener the listener for lock events. @return {@link JobLock} to be used for the job @throws JobLockException throw when the {@link JobLock} fails to initialize
[ "Get", "a", "{", "@link", "JobLock", "}", "to", "be", "used", "for", "the", "job", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java#L645-L648
banq/jdonframework
src/main/java/com/jdon/util/jdom/XMLProperties.java
XMLProperties.parsePropertyName
private String[] parsePropertyName(String name) { """ Returns an array representation of the given Jive property. Jive properties are always in the format "prop.name.is.this" which would be represented as an array of four Strings. @param name the name of the Jive property. @return an array representation of the given Jive property. """ // Figure out the number of parts of the name (this becomes the size // of the resulting array). int size = 1; for (int i = 0; i < name.length(); i++) { if (name.charAt(i) == '.') { size++; } } String[] propName = new String[size]; // Use a StringTokenizer to tokenize the property name. StringTokenizer tokenizer = new StringTokenizer(name, "."); int i = 0; while (tokenizer.hasMoreTokens()) { propName[i] = tokenizer.nextToken(); i++; } return propName; }
java
private String[] parsePropertyName(String name) { // Figure out the number of parts of the name (this becomes the size // of the resulting array). int size = 1; for (int i = 0; i < name.length(); i++) { if (name.charAt(i) == '.') { size++; } } String[] propName = new String[size]; // Use a StringTokenizer to tokenize the property name. StringTokenizer tokenizer = new StringTokenizer(name, "."); int i = 0; while (tokenizer.hasMoreTokens()) { propName[i] = tokenizer.nextToken(); i++; } return propName; }
[ "private", "String", "[", "]", "parsePropertyName", "(", "String", "name", ")", "{", "// Figure out the number of parts of the name (this becomes the size\r", "// of the resulting array).\r", "int", "size", "=", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "name", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "name", ".", "charAt", "(", "i", ")", "==", "'", "'", ")", "{", "size", "++", ";", "}", "}", "String", "[", "]", "propName", "=", "new", "String", "[", "size", "]", ";", "// Use a StringTokenizer to tokenize the property name.\r", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "name", ",", "\".\"", ")", ";", "int", "i", "=", "0", ";", "while", "(", "tokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "propName", "[", "i", "]", "=", "tokenizer", ".", "nextToken", "(", ")", ";", "i", "++", ";", "}", "return", "propName", ";", "}" ]
Returns an array representation of the given Jive property. Jive properties are always in the format "prop.name.is.this" which would be represented as an array of four Strings. @param name the name of the Jive property. @return an array representation of the given Jive property.
[ "Returns", "an", "array", "representation", "of", "the", "given", "Jive", "property", ".", "Jive", "properties", "are", "always", "in", "the", "format", "prop", ".", "name", ".", "is", ".", "this", "which", "would", "be", "represented", "as", "an", "array", "of", "four", "Strings", "." ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/XMLProperties.java#L239-L257
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/websphere/channelfw/ChannelUtils.java
ChannelUtils.loadConfig
public static synchronized Map<String, List<String>> loadConfig(Map<String, Object> config) { """ Using the provided configuration, create or update channels, chains, and groups within the channel framework. This will return a map containing lists of created objects. The keys include "factory", "chain", "group", and "channel". The lists will contains the name of the objects such as channel names, chain names, etc. Each list is guarenteed to be non-null; however, might easily be empty. @param config @return Map<String,List<String>> """ final boolean bTrace = TraceComponent.isAnyTracingEnabled(); boolean usingDelayed = false; if (null == config) { if (delayedConfig.isEmpty()) { return null; } // process the delayed configuration values if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "loadConfig using delayed config information"); } config = delayedConfig; delayedConfig = new HashMap<String, Object>(); usingDelayed = true; } Map<String, List<String>> rc = load(config, false, true); if (usingDelayed && !delayedStarts.isEmpty()) { // see if we can start any of the chains now start(rc, false, false); } return rc; }
java
public static synchronized Map<String, List<String>> loadConfig(Map<String, Object> config) { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); boolean usingDelayed = false; if (null == config) { if (delayedConfig.isEmpty()) { return null; } // process the delayed configuration values if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "loadConfig using delayed config information"); } config = delayedConfig; delayedConfig = new HashMap<String, Object>(); usingDelayed = true; } Map<String, List<String>> rc = load(config, false, true); if (usingDelayed && !delayedStarts.isEmpty()) { // see if we can start any of the chains now start(rc, false, false); } return rc; }
[ "public", "static", "synchronized", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "loadConfig", "(", "Map", "<", "String", ",", "Object", ">", "config", ")", "{", "final", "boolean", "bTrace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "boolean", "usingDelayed", "=", "false", ";", "if", "(", "null", "==", "config", ")", "{", "if", "(", "delayedConfig", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "// process the delayed configuration values", "if", "(", "bTrace", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"loadConfig using delayed config information\"", ")", ";", "}", "config", "=", "delayedConfig", ";", "delayedConfig", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "usingDelayed", "=", "true", ";", "}", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "rc", "=", "load", "(", "config", ",", "false", ",", "true", ")", ";", "if", "(", "usingDelayed", "&&", "!", "delayedStarts", ".", "isEmpty", "(", ")", ")", "{", "// see if we can start any of the chains now", "start", "(", "rc", ",", "false", ",", "false", ")", ";", "}", "return", "rc", ";", "}" ]
Using the provided configuration, create or update channels, chains, and groups within the channel framework. This will return a map containing lists of created objects. The keys include "factory", "chain", "group", and "channel". The lists will contains the name of the objects such as channel names, chain names, etc. Each list is guarenteed to be non-null; however, might easily be empty. @param config @return Map<String,List<String>>
[ "Using", "the", "provided", "configuration", "create", "or", "update", "channels", "chains", "and", "groups", "within", "the", "channel", "framework", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/websphere/channelfw/ChannelUtils.java#L385-L407
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java
BlobContainersInner.setLegalHold
public LegalHoldInner setLegalHold(String resourceGroupName, String accountName, String containerName, List<String> tags) { """ Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. @param tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the LegalHoldInner object if successful. """ return setLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).toBlocking().single().body(); }
java
public LegalHoldInner setLegalHold(String resourceGroupName, String accountName, String containerName, List<String> tags) { return setLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).toBlocking().single().body(); }
[ "public", "LegalHoldInner", "setLegalHold", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "containerName", ",", "List", "<", "String", ">", "tags", ")", "{", "return", "setLegalHoldWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "containerName", ",", "tags", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. @param tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the LegalHoldInner object if successful.
[ "Sets", "legal", "hold", "tags", ".", "Setting", "the", "same", "tag", "results", "in", "an", "idempotent", "operation", ".", "SetLegalHold", "follows", "an", "append", "pattern", "and", "does", "not", "clear", "out", "the", "existing", "tags", "that", "are", "not", "specified", "in", "the", "request", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L795-L797
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonReaderDriver.java
GeoJsonReaderDriver.parseMultiLinestringMetadata
private void parseMultiLinestringMetadata(JsonParser jp) throws IOException, SQLException { """ Parses MultiLineString defined as: { "type": "MultiLineString", "coordinates": [ [ [100.0, 0.0], [101.0, 1.0] ], [ [102.0, 2.0], [103.0, 3.0] ] ] } @param jp """ jp.nextToken(); // FIELD_NAME coordinates String coordinatesField = jp.getText(); if (coordinatesField.equalsIgnoreCase(GeoJsonField.COORDINATES)) { jp.nextToken();//START_ARRAY [ coordinates jp.nextToken(); // START_ARRAY [ coordinates line while (jp.getCurrentToken() != JsonToken.END_ARRAY) { parseCoordinatesMetadata(jp); jp.nextToken(); } jp.nextToken();//END_OBJECT } geometry } else { throw new SQLException("Malformed GeoJSON file. Expected 'coordinates', found '" + coordinatesField + "'"); } }
java
private void parseMultiLinestringMetadata(JsonParser jp) throws IOException, SQLException { jp.nextToken(); // FIELD_NAME coordinates String coordinatesField = jp.getText(); if (coordinatesField.equalsIgnoreCase(GeoJsonField.COORDINATES)) { jp.nextToken();//START_ARRAY [ coordinates jp.nextToken(); // START_ARRAY [ coordinates line while (jp.getCurrentToken() != JsonToken.END_ARRAY) { parseCoordinatesMetadata(jp); jp.nextToken(); } jp.nextToken();//END_OBJECT } geometry } else { throw new SQLException("Malformed GeoJSON file. Expected 'coordinates', found '" + coordinatesField + "'"); } }
[ "private", "void", "parseMultiLinestringMetadata", "(", "JsonParser", "jp", ")", "throws", "IOException", ",", "SQLException", "{", "jp", ".", "nextToken", "(", ")", ";", "// FIELD_NAME coordinates ", "String", "coordinatesField", "=", "jp", ".", "getText", "(", ")", ";", "if", "(", "coordinatesField", ".", "equalsIgnoreCase", "(", "GeoJsonField", ".", "COORDINATES", ")", ")", "{", "jp", ".", "nextToken", "(", ")", ";", "//START_ARRAY [ coordinates", "jp", ".", "nextToken", "(", ")", ";", "// START_ARRAY [ coordinates line", "while", "(", "jp", ".", "getCurrentToken", "(", ")", "!=", "JsonToken", ".", "END_ARRAY", ")", "{", "parseCoordinatesMetadata", "(", "jp", ")", ";", "jp", ".", "nextToken", "(", ")", ";", "}", "jp", ".", "nextToken", "(", ")", ";", "//END_OBJECT } geometry ", "}", "else", "{", "throw", "new", "SQLException", "(", "\"Malformed GeoJSON file. Expected 'coordinates', found '\"", "+", "coordinatesField", "+", "\"'\"", ")", ";", "}", "}" ]
Parses MultiLineString defined as: { "type": "MultiLineString", "coordinates": [ [ [100.0, 0.0], [101.0, 1.0] ], [ [102.0, 2.0], [103.0, 3.0] ] ] } @param jp
[ "Parses", "MultiLineString", "defined", "as", ":" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonReaderDriver.java#L494-L509