repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
Coveros/selenified
src/main/java/com/coveros/selenified/element/Element.java
Element.isScrolledTo
private void isScrolledTo(String action, String expected) { WebElement webElement = getWebElement(); long elementPosition = webElement.getLocation().getY(); JavascriptExecutor js = (JavascriptExecutor) driver; int scrollHeight = ((Number) js.executeScript("return document.documentElement.scrollTop || document.body.scrollTop;")).intValue(); int viewportHeight = ((Number) js.executeScript("return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);")).intValue(); if (elementPosition < scrollHeight || elementPosition > viewportHeight + scrollHeight) { reporter.fail(action, expected, prettyOutputStart() + " was scrolled to, but is not within the current viewport"); } else { reporter.pass(action, expected, prettyOutputStart() + " is properly scrolled to and within the current viewport"); } }
java
private void isScrolledTo(String action, String expected) { WebElement webElement = getWebElement(); long elementPosition = webElement.getLocation().getY(); JavascriptExecutor js = (JavascriptExecutor) driver; int scrollHeight = ((Number) js.executeScript("return document.documentElement.scrollTop || document.body.scrollTop;")).intValue(); int viewportHeight = ((Number) js.executeScript("return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);")).intValue(); if (elementPosition < scrollHeight || elementPosition > viewportHeight + scrollHeight) { reporter.fail(action, expected, prettyOutputStart() + " was scrolled to, but is not within the current viewport"); } else { reporter.pass(action, expected, prettyOutputStart() + " is properly scrolled to and within the current viewport"); } }
[ "private", "void", "isScrolledTo", "(", "String", "action", ",", "String", "expected", ")", "{", "WebElement", "webElement", "=", "getWebElement", "(", ")", ";", "long", "elementPosition", "=", "webElement", ".", "getLocation", "(", ")", ".", "getY", "(", ")", ";", "JavascriptExecutor", "js", "=", "(", "JavascriptExecutor", ")", "driver", ";", "int", "scrollHeight", "=", "(", "(", "Number", ")", "js", ".", "executeScript", "(", "\"return document.documentElement.scrollTop || document.body.scrollTop;\"", ")", ")", ".", "intValue", "(", ")", ";", "int", "viewportHeight", "=", "(", "(", "Number", ")", "js", ".", "executeScript", "(", "\"return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\"", ")", ")", ".", "intValue", "(", ")", ";", "if", "(", "elementPosition", "<", "scrollHeight", "||", "elementPosition", ">", "viewportHeight", "+", "scrollHeight", ")", "{", "reporter", ".", "fail", "(", "action", ",", "expected", ",", "prettyOutputStart", "(", ")", "+", "\" was scrolled to, but is not within the current viewport\"", ")", ";", "}", "else", "{", "reporter", ".", "pass", "(", "action", ",", "expected", ",", "prettyOutputStart", "(", ")", "+", "\" is properly scrolled to and within the current viewport\"", ")", ";", "}", "}" ]
Determines if the element scrolled towards is now currently displayed on the screen @param action - what is the action occurring @param expected - what is the expected outcome of said action
[ "Determines", "if", "the", "element", "scrolled", "towards", "is", "now", "currently", "displayed", "on", "the", "screen" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/Element.java#L1112-L1124
Waikato/moa
moa/src/main/java/weka/core/MOAUtils.java
MOAUtils.fromCommandLine
public static MOAObject fromCommandLine(Class requiredType, String commandline) { MOAObject result; String[] tmpOptions; String classname; try { tmpOptions = Utils.splitOptions(commandline); classname = tmpOptions[0]; tmpOptions[0] = ""; try { result = (MOAObject) Class.forName(classname).newInstance(); } catch (Exception e) { // try to prepend package name result = (MOAObject) Class.forName(requiredType.getPackage().getName() + "." + classname).newInstance(); } if (result instanceof AbstractOptionHandler) { ((AbstractOptionHandler) result).getOptions().setViaCLIString(Utils.joinOptions(tmpOptions)); ((AbstractOptionHandler) result).prepareForUse(); } } catch (Exception e) { e.printStackTrace(); result = null; } return result; }
java
public static MOAObject fromCommandLine(Class requiredType, String commandline) { MOAObject result; String[] tmpOptions; String classname; try { tmpOptions = Utils.splitOptions(commandline); classname = tmpOptions[0]; tmpOptions[0] = ""; try { result = (MOAObject) Class.forName(classname).newInstance(); } catch (Exception e) { // try to prepend package name result = (MOAObject) Class.forName(requiredType.getPackage().getName() + "." + classname).newInstance(); } if (result instanceof AbstractOptionHandler) { ((AbstractOptionHandler) result).getOptions().setViaCLIString(Utils.joinOptions(tmpOptions)); ((AbstractOptionHandler) result).prepareForUse(); } } catch (Exception e) { e.printStackTrace(); result = null; } return result; }
[ "public", "static", "MOAObject", "fromCommandLine", "(", "Class", "requiredType", ",", "String", "commandline", ")", "{", "MOAObject", "result", ";", "String", "[", "]", "tmpOptions", ";", "String", "classname", ";", "try", "{", "tmpOptions", "=", "Utils", ".", "splitOptions", "(", "commandline", ")", ";", "classname", "=", "tmpOptions", "[", "0", "]", ";", "tmpOptions", "[", "0", "]", "=", "\"\"", ";", "try", "{", "result", "=", "(", "MOAObject", ")", "Class", ".", "forName", "(", "classname", ")", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// try to prepend package name", "result", "=", "(", "MOAObject", ")", "Class", ".", "forName", "(", "requiredType", ".", "getPackage", "(", ")", ".", "getName", "(", ")", "+", "\".\"", "+", "classname", ")", ".", "newInstance", "(", ")", ";", "}", "if", "(", "result", "instanceof", "AbstractOptionHandler", ")", "{", "(", "(", "AbstractOptionHandler", ")", "result", ")", ".", "getOptions", "(", ")", ".", "setViaCLIString", "(", "Utils", ".", "joinOptions", "(", "tmpOptions", ")", ")", ";", "(", "(", "AbstractOptionHandler", ")", "result", ")", ".", "prepareForUse", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "result", "=", "null", ";", "}", "return", "result", ";", "}" ]
Turns a commandline into an object (classname + optional options). @param requiredType the required class @param commandline the commandline to turn into an object @return the generated oblect
[ "Turns", "a", "commandline", "into", "an", "object", "(", "classname", "+", "optional", "options", ")", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/weka/core/MOAUtils.java#L54-L81
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/block/meta/MasterWorkerInfo.java
MasterWorkerInfo.updateCapacityBytes
public void updateCapacityBytes(Map<String, Long> capacityBytesOnTiers) { mCapacityBytes = 0; mTotalBytesOnTiers = capacityBytesOnTiers; for (long t : mTotalBytesOnTiers.values()) { mCapacityBytes += t; } }
java
public void updateCapacityBytes(Map<String, Long> capacityBytesOnTiers) { mCapacityBytes = 0; mTotalBytesOnTiers = capacityBytesOnTiers; for (long t : mTotalBytesOnTiers.values()) { mCapacityBytes += t; } }
[ "public", "void", "updateCapacityBytes", "(", "Map", "<", "String", ",", "Long", ">", "capacityBytesOnTiers", ")", "{", "mCapacityBytes", "=", "0", ";", "mTotalBytesOnTiers", "=", "capacityBytesOnTiers", ";", "for", "(", "long", "t", ":", "mTotalBytesOnTiers", ".", "values", "(", ")", ")", "{", "mCapacityBytes", "+=", "t", ";", "}", "}" ]
Sets the capacity of the worker in bytes. @param capacityBytesOnTiers used bytes on each storage tier
[ "Sets", "the", "capacity", "of", "the", "worker", "in", "bytes", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/block/meta/MasterWorkerInfo.java#L412-L418
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/factory/DecompositionFactory_DDRM.java
DecompositionFactory_DDRM.decomposeSafe
public static <T extends DMatrix> boolean decomposeSafe(DecompositionInterface<T> decomp, T M ) { if( decomp.inputModified() ) { return decomp.decompose(M.<T>copy()); } else { return decomp.decompose(M); } }
java
public static <T extends DMatrix> boolean decomposeSafe(DecompositionInterface<T> decomp, T M ) { if( decomp.inputModified() ) { return decomp.decompose(M.<T>copy()); } else { return decomp.decompose(M); } }
[ "public", "static", "<", "T", "extends", "DMatrix", ">", "boolean", "decomposeSafe", "(", "DecompositionInterface", "<", "T", ">", "decomp", ",", "T", "M", ")", "{", "if", "(", "decomp", ".", "inputModified", "(", ")", ")", "{", "return", "decomp", ".", "decompose", "(", "M", ".", "<", "T", ">", "copy", "(", ")", ")", ";", "}", "else", "{", "return", "decomp", ".", "decompose", "(", "M", ")", ";", "}", "}" ]
A simple convinience function that decomposes the matrix but automatically checks the input ti make sure is not being modified. @param decomp Decomposition which is being wrapped @param M THe matrix being decomposed. @param <T> Matrix type. @return If the decomposition was successful or not.
[ "A", "simple", "convinience", "function", "that", "decomposes", "the", "matrix", "but", "automatically", "checks", "the", "input", "ti", "make", "sure", "is", "not", "being", "modified", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/factory/DecompositionFactory_DDRM.java#L331-L337
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/authorization/providers/PoliciesCache.java
PoliciesCache.fromDir
public static PoliciesCache fromDir(File rootDir, final Set<Attribute> forcedContext) { return fromSourceProvider(YamlProvider.getDirProvider(rootDir),forcedContext); }
java
public static PoliciesCache fromDir(File rootDir, final Set<Attribute> forcedContext) { return fromSourceProvider(YamlProvider.getDirProvider(rootDir),forcedContext); }
[ "public", "static", "PoliciesCache", "fromDir", "(", "File", "rootDir", ",", "final", "Set", "<", "Attribute", ">", "forcedContext", ")", "{", "return", "fromSourceProvider", "(", "YamlProvider", ".", "getDirProvider", "(", "rootDir", ")", ",", "forcedContext", ")", ";", "}" ]
Create a cache from a directory source @param rootDir base director @return cache
[ "Create", "a", "cache", "from", "a", "directory", "source" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/authorization/providers/PoliciesCache.java#L197-L199
outbrain/ob1k
ob1k-concurrent/src/main/java/com/outbrain/ob1k/concurrent/ComposableFutures.java
ComposableFutures.submit
public static <T> ComposableFuture<T> submit(final Callable<T> task) { return submit(false, task); }
java
public static <T> ComposableFuture<T> submit(final Callable<T> task) { return submit(false, task); }
[ "public", "static", "<", "T", ">", "ComposableFuture", "<", "T", ">", "submit", "(", "final", "Callable", "<", "T", ">", "task", ")", "{", "return", "submit", "(", "false", ",", "task", ")", ";", "}" ]
sends a callable task to the default thread pool and returns a ComposableFuture that represent the result. @param task the task to run. @param <T> the future type @return a future representing the result.
[ "sends", "a", "callable", "task", "to", "the", "default", "thread", "pool", "and", "returns", "a", "ComposableFuture", "that", "represent", "the", "result", "." ]
train
https://github.com/outbrain/ob1k/blob/9e43ab39230c5787065053da0f766d822d0fe4e7/ob1k-concurrent/src/main/java/com/outbrain/ob1k/concurrent/ComposableFutures.java#L415-L417
geomajas/geomajas-project-server
impl/src/main/java/org/geomajas/internal/layer/vector/GetFeaturesEachStep.java
GetFeaturesEachStep.findStyleFilter
private StyleFilter findStyleFilter(Object feature, List<StyleFilter> styles) { for (StyleFilter styleFilter : styles) { if (styleFilter.getFilter().evaluate(feature)) { return styleFilter; } } return new StyleFilterImpl(); }
java
private StyleFilter findStyleFilter(Object feature, List<StyleFilter> styles) { for (StyleFilter styleFilter : styles) { if (styleFilter.getFilter().evaluate(feature)) { return styleFilter; } } return new StyleFilterImpl(); }
[ "private", "StyleFilter", "findStyleFilter", "(", "Object", "feature", ",", "List", "<", "StyleFilter", ">", "styles", ")", "{", "for", "(", "StyleFilter", "styleFilter", ":", "styles", ")", "{", "if", "(", "styleFilter", ".", "getFilter", "(", ")", ".", "evaluate", "(", "feature", ")", ")", "{", "return", "styleFilter", ";", "}", "}", "return", "new", "StyleFilterImpl", "(", ")", ";", "}" ]
Find the style filter that must be applied to this feature. @param feature feature to find the style for @param styles style filters to select from @return a style filter
[ "Find", "the", "style", "filter", "that", "must", "be", "applied", "to", "this", "feature", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/layer/vector/GetFeaturesEachStep.java#L228-L235
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/container/ContainerBase.java
ContainerBase.addNestedJarFileResource
private T addNestedJarFileResource(final File resource, final ArchivePath target, final ArchivePath base) throws IllegalArgumentException { final Iterable<ClassLoader> classLoaders = ((Configurable) this.getArchive()).getConfiguration() .getClassLoaders(); for (final ClassLoader classLoader : classLoaders) { final InputStream in = classLoader.getResourceAsStream(resourceAdjustedPath(resource)); if (in != null) { final Asset asset = new ByteArrayAsset(in); return add(asset, base, target.get()); } } throw new IllegalArgumentException(resource.getPath() + " was not found in any available ClassLoaders"); }
java
private T addNestedJarFileResource(final File resource, final ArchivePath target, final ArchivePath base) throws IllegalArgumentException { final Iterable<ClassLoader> classLoaders = ((Configurable) this.getArchive()).getConfiguration() .getClassLoaders(); for (final ClassLoader classLoader : classLoaders) { final InputStream in = classLoader.getResourceAsStream(resourceAdjustedPath(resource)); if (in != null) { final Asset asset = new ByteArrayAsset(in); return add(asset, base, target.get()); } } throw new IllegalArgumentException(resource.getPath() + " was not found in any available ClassLoaders"); }
[ "private", "T", "addNestedJarFileResource", "(", "final", "File", "resource", ",", "final", "ArchivePath", "target", ",", "final", "ArchivePath", "base", ")", "throws", "IllegalArgumentException", "{", "final", "Iterable", "<", "ClassLoader", ">", "classLoaders", "=", "(", "(", "Configurable", ")", "this", ".", "getArchive", "(", ")", ")", ".", "getConfiguration", "(", ")", ".", "getClassLoaders", "(", ")", ";", "for", "(", "final", "ClassLoader", "classLoader", ":", "classLoaders", ")", "{", "final", "InputStream", "in", "=", "classLoader", ".", "getResourceAsStream", "(", "resourceAdjustedPath", "(", "resource", ")", ")", ";", "if", "(", "in", "!=", "null", ")", "{", "final", "Asset", "asset", "=", "new", "ByteArrayAsset", "(", "in", ")", ";", "return", "add", "(", "asset", ",", "base", ",", "target", ".", "get", "(", ")", ")", ";", "}", "}", "throw", "new", "IllegalArgumentException", "(", "resource", ".", "getPath", "(", ")", "+", "\" was not found in any available ClassLoaders\"", ")", ";", "}" ]
Adds the specified {@link File} resource (a nested JAR File form) to the current archive, returning the archive itself @param resource @param target @return @throws IllegalArgumentException
[ "Adds", "the", "specified", "{", "@link", "File", "}", "resource", "(", "a", "nested", "JAR", "File", "form", ")", "to", "the", "current", "archive", "returning", "the", "archive", "itself" ]
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/container/ContainerBase.java#L799-L812
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/tools/Model.java
Model.setMinValue
public void setMinValue(final double MIN_VALUE) { // check min-max values if (Double.compare(MIN_VALUE, maxValue) == 0) { throw new IllegalArgumentException("Min value cannot be equal to max value"); } if (Double.compare(MIN_VALUE, maxValue) > 0) { minValue = maxValue; maxValue = MIN_VALUE; } else { minValue = MIN_VALUE; } calculate(); validate(); calcAngleStep(); fireStateChanged(); }
java
public void setMinValue(final double MIN_VALUE) { // check min-max values if (Double.compare(MIN_VALUE, maxValue) == 0) { throw new IllegalArgumentException("Min value cannot be equal to max value"); } if (Double.compare(MIN_VALUE, maxValue) > 0) { minValue = maxValue; maxValue = MIN_VALUE; } else { minValue = MIN_VALUE; } calculate(); validate(); calcAngleStep(); fireStateChanged(); }
[ "public", "void", "setMinValue", "(", "final", "double", "MIN_VALUE", ")", "{", "// check min-max values", "if", "(", "Double", ".", "compare", "(", "MIN_VALUE", ",", "maxValue", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Min value cannot be equal to max value\"", ")", ";", "}", "if", "(", "Double", ".", "compare", "(", "MIN_VALUE", ",", "maxValue", ")", ">", "0", ")", "{", "minValue", "=", "maxValue", ";", "maxValue", "=", "MIN_VALUE", ";", "}", "else", "{", "minValue", "=", "MIN_VALUE", ";", "}", "calculate", "(", ")", ";", "validate", "(", ")", ";", "calcAngleStep", "(", ")", ";", "fireStateChanged", "(", ")", ";", "}" ]
Sets the minium value that will be used for the calculation of the nice minimum value for the scale. @param MIN_VALUE
[ "Sets", "the", "minium", "value", "that", "will", "be", "used", "for", "the", "calculation", "of", "the", "nice", "minimum", "value", "for", "the", "scale", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/tools/Model.java#L355-L371
knowm/XChange
xchange-bitso/src/main/java/org/knowm/xchange/bitso/BitsoAdapters.java
BitsoAdapters.adaptTrades
public static Trades adaptTrades(BitsoTransaction[] transactions, CurrencyPair currencyPair) { List<Trade> trades = new ArrayList<>(); long lastTradeId = 0; for (BitsoTransaction tx : transactions) { Order.OrderType type; switch (tx.getSide()) { case "buy": type = Order.OrderType.ASK; break; case "sell": type = Order.OrderType.BID; break; default: type = null; } final long tradeId = tx.getTid(); if (tradeId > lastTradeId) { lastTradeId = tradeId; } trades.add( new Trade( type, tx.getAmount(), currencyPair, tx.getPrice(), DateUtils.fromMillisUtc(tx.getDate() * 1000L), String.valueOf(tradeId))); } return new Trades(trades, lastTradeId, TradeSortType.SortByID); }
java
public static Trades adaptTrades(BitsoTransaction[] transactions, CurrencyPair currencyPair) { List<Trade> trades = new ArrayList<>(); long lastTradeId = 0; for (BitsoTransaction tx : transactions) { Order.OrderType type; switch (tx.getSide()) { case "buy": type = Order.OrderType.ASK; break; case "sell": type = Order.OrderType.BID; break; default: type = null; } final long tradeId = tx.getTid(); if (tradeId > lastTradeId) { lastTradeId = tradeId; } trades.add( new Trade( type, tx.getAmount(), currencyPair, tx.getPrice(), DateUtils.fromMillisUtc(tx.getDate() * 1000L), String.valueOf(tradeId))); } return new Trades(trades, lastTradeId, TradeSortType.SortByID); }
[ "public", "static", "Trades", "adaptTrades", "(", "BitsoTransaction", "[", "]", "transactions", ",", "CurrencyPair", "currencyPair", ")", "{", "List", "<", "Trade", ">", "trades", "=", "new", "ArrayList", "<>", "(", ")", ";", "long", "lastTradeId", "=", "0", ";", "for", "(", "BitsoTransaction", "tx", ":", "transactions", ")", "{", "Order", ".", "OrderType", "type", ";", "switch", "(", "tx", ".", "getSide", "(", ")", ")", "{", "case", "\"buy\"", ":", "type", "=", "Order", ".", "OrderType", ".", "ASK", ";", "break", ";", "case", "\"sell\"", ":", "type", "=", "Order", ".", "OrderType", ".", "BID", ";", "break", ";", "default", ":", "type", "=", "null", ";", "}", "final", "long", "tradeId", "=", "tx", ".", "getTid", "(", ")", ";", "if", "(", "tradeId", ">", "lastTradeId", ")", "{", "lastTradeId", "=", "tradeId", ";", "}", "trades", ".", "add", "(", "new", "Trade", "(", "type", ",", "tx", ".", "getAmount", "(", ")", ",", "currencyPair", ",", "tx", ".", "getPrice", "(", ")", ",", "DateUtils", ".", "fromMillisUtc", "(", "tx", ".", "getDate", "(", ")", "*", "1000L", ")", ",", "String", ".", "valueOf", "(", "tradeId", ")", ")", ")", ";", "}", "return", "new", "Trades", "(", "trades", ",", "lastTradeId", ",", "TradeSortType", ".", "SortByID", ")", ";", "}" ]
Adapts a Transaction[] to a Trades Object @param transactions The Bitso transactions @param currencyPair (e.g. BTC/MXN) @return The XChange Trades
[ "Adapts", "a", "Transaction", "[]", "to", "a", "Trades", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitso/src/main/java/org/knowm/xchange/bitso/BitsoAdapters.java#L105-L136
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.customMethod
public static void customMethod(String methodType,String methodName, Class<?> clazz){ String completeName = clazz.getCanonicalName(); String packageName = clazz.getPackage().getName(); String className = completeName.substring(packageName.length()+1); throw new MalformedBeanException(MSG.INSTANCE.message(customMethodException, methodType, methodName,className)); }
java
public static void customMethod(String methodType,String methodName, Class<?> clazz){ String completeName = clazz.getCanonicalName(); String packageName = clazz.getPackage().getName(); String className = completeName.substring(packageName.length()+1); throw new MalformedBeanException(MSG.INSTANCE.message(customMethodException, methodType, methodName,className)); }
[ "public", "static", "void", "customMethod", "(", "String", "methodType", ",", "String", "methodName", ",", "Class", "<", "?", ">", "clazz", ")", "{", "String", "completeName", "=", "clazz", ".", "getCanonicalName", "(", ")", ";", "String", "packageName", "=", "clazz", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ";", "String", "className", "=", "completeName", ".", "substring", "(", "packageName", ".", "length", "(", ")", "+", "1", ")", ";", "throw", "new", "MalformedBeanException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "customMethodException", ",", "methodType", ",", "methodName", ",", "className", ")", ")", ";", "}" ]
Thrown when the bean doesn't respect the javabean conventions. @param methodType method type @param methodName name of the method doesn't exist @param clazz class when this method isn't present
[ "Thrown", "when", "the", "bean", "doesn", "t", "respect", "the", "javabean", "conventions", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L423-L428
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/TimecodeBuilder.java
TimecodeBuilder.compensateForDropFrame
static long compensateForDropFrame(final long framenumber, final double framerate) { //Code by David Heidelberger, adapted from Andrew Duncan //Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate final long dropFrames = Math.round(framerate * .066666); final long framesPer10Minutes = Math.round(framerate * 60 * 10); final long framesPerMinute = (Math.round(framerate) * 60) - dropFrames; final long d = framenumber / framesPer10Minutes; final long m = framenumber % framesPer10Minutes; //In the original post, the next line read m>1, which only worked for 29.97. Jean-Baptiste Mardelle correctly pointed out that m should be compared to dropFrames. if (m > dropFrames) return framenumber + (dropFrames * 9 * d) + dropFrames * ((m - dropFrames) / framesPerMinute); else return framenumber + dropFrames * 9 * d; }
java
static long compensateForDropFrame(final long framenumber, final double framerate) { //Code by David Heidelberger, adapted from Andrew Duncan //Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate final long dropFrames = Math.round(framerate * .066666); final long framesPer10Minutes = Math.round(framerate * 60 * 10); final long framesPerMinute = (Math.round(framerate) * 60) - dropFrames; final long d = framenumber / framesPer10Minutes; final long m = framenumber % framesPer10Minutes; //In the original post, the next line read m>1, which only worked for 29.97. Jean-Baptiste Mardelle correctly pointed out that m should be compared to dropFrames. if (m > dropFrames) return framenumber + (dropFrames * 9 * d) + dropFrames * ((m - dropFrames) / framesPerMinute); else return framenumber + dropFrames * 9 * d; }
[ "static", "long", "compensateForDropFrame", "(", "final", "long", "framenumber", ",", "final", "double", "framerate", ")", "{", "//Code by David Heidelberger, adapted from Andrew Duncan", "//Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate", "final", "long", "dropFrames", "=", "Math", ".", "round", "(", "framerate", "*", ".066666", ")", ";", "final", "long", "framesPer10Minutes", "=", "Math", ".", "round", "(", "framerate", "*", "60", "*", "10", ")", ";", "final", "long", "framesPerMinute", "=", "(", "Math", ".", "round", "(", "framerate", ")", "*", "60", ")", "-", "dropFrames", ";", "final", "long", "d", "=", "framenumber", "/", "framesPer10Minutes", ";", "final", "long", "m", "=", "framenumber", "%", "framesPer10Minutes", ";", "//In the original post, the next line read m>1, which only worked for 29.97. Jean-Baptiste Mardelle correctly pointed out that m should be compared to dropFrames.", "if", "(", "m", ">", "dropFrames", ")", "return", "framenumber", "+", "(", "dropFrames", "*", "9", "*", "d", ")", "+", "dropFrames", "*", "(", "(", "m", "-", "dropFrames", ")", "/", "framesPerMinute", ")", ";", "else", "return", "framenumber", "+", "dropFrames", "*", "9", "*", "d", ";", "}" ]
@param framenumber @param framerate should be 29.97, 59.94, or 23.976, otherwise the calculations will be off. @return a frame number that lets us use non-dropframe computations to extract time components
[ "@param", "framenumber", "@param", "framerate", "should", "be", "29", ".", "97", "59", ".", "94", "or", "23", ".", "976", "otherwise", "the", "calculations", "will", "be", "off", "." ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/TimecodeBuilder.java#L375-L393
UrielCh/ovh-java-sdk
ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java
ApiOvhEmailpro.service_externalContact_externalEmailAddress_GET
public OvhExternalContact service_externalContact_externalEmailAddress_GET(String service, String externalEmailAddress) throws IOException { String qPath = "/email/pro/{service}/externalContact/{externalEmailAddress}"; StringBuilder sb = path(qPath, service, externalEmailAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExternalContact.class); }
java
public OvhExternalContact service_externalContact_externalEmailAddress_GET(String service, String externalEmailAddress) throws IOException { String qPath = "/email/pro/{service}/externalContact/{externalEmailAddress}"; StringBuilder sb = path(qPath, service, externalEmailAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExternalContact.class); }
[ "public", "OvhExternalContact", "service_externalContact_externalEmailAddress_GET", "(", "String", "service", ",", "String", "externalEmailAddress", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/pro/{service}/externalContact/{externalEmailAddress}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "service", ",", "externalEmailAddress", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhExternalContact", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /email/pro/{service}/externalContact/{externalEmailAddress} @param service [required] The internal name of your pro organization @param externalEmailAddress [required] Contact email API beta
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L76-L81
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
TimestampUtils.toLocalDateTimeBin
public LocalDateTime toLocalDateTimeBin(TimeZone tz, byte[] bytes) throws PSQLException { ParsedBinaryTimestamp parsedTimestamp = this.toParsedTimestampBin(tz, bytes, true); if (parsedTimestamp.infinity == Infinity.POSITIVE) { return LocalDateTime.MAX; } else if (parsedTimestamp.infinity == Infinity.NEGATIVE) { return LocalDateTime.MIN; } return LocalDateTime.ofEpochSecond(parsedTimestamp.millis / 1000L, parsedTimestamp.nanos, ZoneOffset.UTC); }
java
public LocalDateTime toLocalDateTimeBin(TimeZone tz, byte[] bytes) throws PSQLException { ParsedBinaryTimestamp parsedTimestamp = this.toParsedTimestampBin(tz, bytes, true); if (parsedTimestamp.infinity == Infinity.POSITIVE) { return LocalDateTime.MAX; } else if (parsedTimestamp.infinity == Infinity.NEGATIVE) { return LocalDateTime.MIN; } return LocalDateTime.ofEpochSecond(parsedTimestamp.millis / 1000L, parsedTimestamp.nanos, ZoneOffset.UTC); }
[ "public", "LocalDateTime", "toLocalDateTimeBin", "(", "TimeZone", "tz", ",", "byte", "[", "]", "bytes", ")", "throws", "PSQLException", "{", "ParsedBinaryTimestamp", "parsedTimestamp", "=", "this", ".", "toParsedTimestampBin", "(", "tz", ",", "bytes", ",", "true", ")", ";", "if", "(", "parsedTimestamp", ".", "infinity", "==", "Infinity", ".", "POSITIVE", ")", "{", "return", "LocalDateTime", ".", "MAX", ";", "}", "else", "if", "(", "parsedTimestamp", ".", "infinity", "==", "Infinity", ".", "NEGATIVE", ")", "{", "return", "LocalDateTime", ".", "MIN", ";", "}", "return", "LocalDateTime", ".", "ofEpochSecond", "(", "parsedTimestamp", ".", "millis", "/", "1000L", ",", "parsedTimestamp", ".", "nanos", ",", "ZoneOffset", ".", "UTC", ")", ";", "}" ]
Returns the local date time object matching the given bytes with {@link Oid#TIMESTAMP} or {@link Oid#TIMESTAMPTZ}. @param tz time zone to use @param bytes The binary encoded local date time value. @return The parsed local date time object. @throws PSQLException If binary format could not be parsed.
[ "Returns", "the", "local", "date", "time", "object", "matching", "the", "given", "bytes", "with", "{", "@link", "Oid#TIMESTAMP", "}", "or", "{", "@link", "Oid#TIMESTAMPTZ", "}", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L1133-L1143
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/RemoveLeadingOperation.java
RemoveLeadingOperation.performRemoveLeading
private String performRemoveLeading(String source, Integer length, Matcher matcher) { if (length != null && length != 0) { matcher.region(0, length); } if (matcher.find()) { String matched = matcher.group(); return source.substring(matched.length()); } return source; }
java
private String performRemoveLeading(String source, Integer length, Matcher matcher) { if (length != null && length != 0) { matcher.region(0, length); } if (matcher.find()) { String matched = matcher.group(); return source.substring(matched.length()); } return source; }
[ "private", "String", "performRemoveLeading", "(", "String", "source", ",", "Integer", "length", ",", "Matcher", "matcher", ")", "{", "if", "(", "length", "!=", "null", "&&", "length", "!=", "0", ")", "{", "matcher", ".", "region", "(", "0", ",", "length", ")", ";", "}", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "String", "matched", "=", "matcher", ".", "group", "(", ")", ";", "return", "source", ".", "substring", "(", "matched", ".", "length", "(", ")", ")", ";", "}", "return", "source", ";", "}" ]
Perform the remove leading operation. Returns the original string if the matcher does not match with the string
[ "Perform", "the", "remove", "leading", "operation", ".", "Returns", "the", "original", "string", "if", "the", "matcher", "does", "not", "match", "with", "the", "string" ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/RemoveLeadingOperation.java#L75-L84
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java
AdHocCommandManager.respondError
private static IQ respondError(AdHocCommandData response, StanzaError.Builder error) { response.setType(IQ.Type.error); response.setError(error); return response; }
java
private static IQ respondError(AdHocCommandData response, StanzaError.Builder error) { response.setType(IQ.Type.error); response.setError(error); return response; }
[ "private", "static", "IQ", "respondError", "(", "AdHocCommandData", "response", ",", "StanzaError", ".", "Builder", "error", ")", "{", "response", ".", "setType", "(", "IQ", ".", "Type", ".", "error", ")", ";", "response", ".", "setError", "(", "error", ")", ";", "return", "response", ";", "}" ]
Responds an error with an specific error. @param response the response to send. @param error the error to send. @throws NotConnectedException
[ "Responds", "an", "error", "with", "an", "specific", "error", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java#L594-L598
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java
AttributesImpl.setLocalName
public void setLocalName (int index, String localName) { if (index >= 0 && index < length) { data[index*5+1] = localName; } else { badIndex(index); } }
java
public void setLocalName (int index, String localName) { if (index >= 0 && index < length) { data[index*5+1] = localName; } else { badIndex(index); } }
[ "public", "void", "setLocalName", "(", "int", "index", ",", "String", "localName", ")", "{", "if", "(", "index", ">=", "0", "&&", "index", "<", "length", ")", "{", "data", "[", "index", "*", "5", "+", "1", "]", "=", "localName", ";", "}", "else", "{", "badIndex", "(", "index", ")", ";", "}", "}" ]
Set the local name of a specific attribute. @param index The index of the attribute (zero-based). @param localName The attribute's local name, or the empty string for none. @exception java.lang.ArrayIndexOutOfBoundsException When the supplied index does not point to an attribute in the list.
[ "Set", "the", "local", "name", "of", "a", "specific", "attribute", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L486-L493
sitoolkit/sit-wt-all
sit-wt-runtime/src/main/java/io/sitoolkit/wt/domain/evidence/LogRecord.java
LogRecord.create
public static LogRecord create(SitLogger logger, ElementPosition position, TestStep testStep, MessagePattern pattern, Object... params) { Object[] newParams = new Object[] { testStep.getItemName(), testStep.getLocator() }; newParams = ArrayUtils.addAll(newParams, params); return create(logger, position, testStep, pattern.getPattern(), newParams); }
java
public static LogRecord create(SitLogger logger, ElementPosition position, TestStep testStep, MessagePattern pattern, Object... params) { Object[] newParams = new Object[] { testStep.getItemName(), testStep.getLocator() }; newParams = ArrayUtils.addAll(newParams, params); return create(logger, position, testStep, pattern.getPattern(), newParams); }
[ "public", "static", "LogRecord", "create", "(", "SitLogger", "logger", ",", "ElementPosition", "position", ",", "TestStep", "testStep", ",", "MessagePattern", "pattern", ",", "Object", "...", "params", ")", "{", "Object", "[", "]", "newParams", "=", "new", "Object", "[", "]", "{", "testStep", ".", "getItemName", "(", ")", ",", "testStep", ".", "getLocator", "(", ")", "}", ";", "newParams", "=", "ArrayUtils", ".", "addAll", "(", "newParams", ",", "params", ")", ";", "return", "create", "(", "logger", ",", "position", ",", "testStep", ",", "pattern", ".", "getPattern", "(", ")", ",", "newParams", ")", ";", "}" ]
次のメッセージを持つ操作ログオブジェクトを作成します。 @param logger ロガー @param position 要素位置 @param testStep テストステップ @param pattern メッセージパターン @param params メッセージパラメーター @return 操作ログ
[ "次のメッセージを持つ操作ログオブジェクトを作成します。" ]
train
https://github.com/sitoolkit/sit-wt-all/blob/efabde27aa731a5602d2041e137721a22f4fd27a/sit-wt-runtime/src/main/java/io/sitoolkit/wt/domain/evidence/LogRecord.java#L102-L109
dyu/protostuff-1.0.x
protostuff-model-json/src/main/java/com/dyuproject/protostuff/json/ReflectionJSON.java
ReflectionJSON.getField
protected Field getField(String name, Model<Field> model) throws IOException { return model.getProperty(name); }
java
protected Field getField(String name, Model<Field> model) throws IOException { return model.getProperty(name); }
[ "protected", "Field", "getField", "(", "String", "name", ",", "Model", "<", "Field", ">", "model", ")", "throws", "IOException", "{", "return", "model", ".", "getProperty", "(", "name", ")", ";", "}" ]
/* public <T extends MessageLite, B extends Builder> LiteConvertor getConvertor(Class<?> messageType) { return _convertors.get(messageType.getName()); }
[ "/", "*", "public", "<T", "extends", "MessageLite", "B", "extends", "Builder", ">", "LiteConvertor", "getConvertor", "(", "Class<?", ">", "messageType", ")", "{", "return", "_convertors", ".", "get", "(", "messageType", ".", "getName", "()", ")", ";", "}" ]
train
https://github.com/dyu/protostuff-1.0.x/blob/d7c964ec20da3fe44699d86ee95c2677ddffde96/protostuff-model-json/src/main/java/com/dyuproject/protostuff/json/ReflectionJSON.java#L141-L144
radkovo/CSSBox
src/main/java/org/fit/cssbox/layout/TableCellBox.java
TableCellBox.applyVerticalAlign
public void applyVerticalAlign(int origHeight, int newHeight, int baseline) { int yofs = 0; CSSProperty.VerticalAlign valign = style.getProperty("vertical-align"); if (valign == null) valign = CSSProperty.VerticalAlign.MIDDLE; switch (valign) { case TOP: yofs = 0; break; case BOTTOM: yofs = newHeight - origHeight; break; case MIDDLE: yofs = (newHeight - origHeight) / 2; break; default: yofs = baseline - getFirstInlineBoxBaseline(); //all other values should behave as BASELINE break; } if (yofs > 0) coffset = yofs; }
java
public void applyVerticalAlign(int origHeight, int newHeight, int baseline) { int yofs = 0; CSSProperty.VerticalAlign valign = style.getProperty("vertical-align"); if (valign == null) valign = CSSProperty.VerticalAlign.MIDDLE; switch (valign) { case TOP: yofs = 0; break; case BOTTOM: yofs = newHeight - origHeight; break; case MIDDLE: yofs = (newHeight - origHeight) / 2; break; default: yofs = baseline - getFirstInlineBoxBaseline(); //all other values should behave as BASELINE break; } if (yofs > 0) coffset = yofs; }
[ "public", "void", "applyVerticalAlign", "(", "int", "origHeight", ",", "int", "newHeight", ",", "int", "baseline", ")", "{", "int", "yofs", "=", "0", ";", "CSSProperty", ".", "VerticalAlign", "valign", "=", "style", ".", "getProperty", "(", "\"vertical-align\"", ")", ";", "if", "(", "valign", "==", "null", ")", "valign", "=", "CSSProperty", ".", "VerticalAlign", ".", "MIDDLE", ";", "switch", "(", "valign", ")", "{", "case", "TOP", ":", "yofs", "=", "0", ";", "break", ";", "case", "BOTTOM", ":", "yofs", "=", "newHeight", "-", "origHeight", ";", "break", ";", "case", "MIDDLE", ":", "yofs", "=", "(", "newHeight", "-", "origHeight", ")", "/", "2", ";", "break", ";", "default", ":", "yofs", "=", "baseline", "-", "getFirstInlineBoxBaseline", "(", ")", ";", "//all other values should behave as BASELINE", "break", ";", "}", "if", "(", "yofs", ">", "0", ")", "coffset", "=", "yofs", ";", "}" ]
Applies the vertical alignment after the row height is computed. Moves all child boxes according to the vertical-align value of the cell and the difference between the original height (after the cell layout) and the new (required by the row) height. @param origHeight the original cell height obtained from the content layout @param newHeight the cell height required by the row. It should be greater or equal to origHeight. @param baseline the row's baseline offset
[ "Applies", "the", "vertical", "alignment", "after", "the", "row", "height", "is", "computed", ".", "Moves", "all", "child", "boxes", "according", "to", "the", "vertical", "-", "align", "value", "of", "the", "cell", "and", "the", "difference", "between", "the", "original", "height", "(", "after", "the", "cell", "layout", ")", "and", "the", "new", "(", "required", "by", "the", "row", ")", "height", "." ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/TableCellBox.java#L220-L239
erlang/otp
lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java
OtpOutputStream.write_port
public void write_port(final String node, final int id, final int creation) { write1(OtpExternal.portTag); write_atom(node); write4BE(id & 0xfffffff); // 28 bits write1(creation & 0x3); // 2 bits }
java
public void write_port(final String node, final int id, final int creation) { write1(OtpExternal.portTag); write_atom(node); write4BE(id & 0xfffffff); // 28 bits write1(creation & 0x3); // 2 bits }
[ "public", "void", "write_port", "(", "final", "String", "node", ",", "final", "int", "id", ",", "final", "int", "creation", ")", "{", "write1", "(", "OtpExternal", ".", "portTag", ")", ";", "write_atom", "(", "node", ")", ";", "write4BE", "(", "id", "&", "0xfffffff", ")", ";", "// 28 bits", "write1", "(", "creation", "&", "0x3", ")", ";", "// 2 bits", "}" ]
Write an Erlang port to the stream. @param node the nodename. @param id an arbitrary number. Only the low order 28 bits will be used. @param creation another arbitrary number. Only the low order 2 bits will be used.
[ "Write", "an", "Erlang", "port", "to", "the", "stream", "." ]
train
https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java#L760-L765
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java
JsonObject.getLong
public long getLong(String name, long defaultValue) { JsonValue value = get(name); return value != null ? value.asLong() : defaultValue; }
java
public long getLong(String name, long defaultValue) { JsonValue value = get(name); return value != null ? value.asLong() : defaultValue; }
[ "public", "long", "getLong", "(", "String", "name", ",", "long", "defaultValue", ")", "{", "JsonValue", "value", "=", "get", "(", "name", ")", ";", "return", "value", "!=", "null", "?", "value", ".", "asLong", "(", ")", ":", "defaultValue", ";", "}" ]
Returns the <code>long</code> value of the member with the specified name in this object. If this object does not contain a member with this name, the given default value is returned. If this object contains multiple members with the given name, the last one will be picked. If this member's value does not represent a JSON number or if it cannot be interpreted as Java <code>long</code>, an exception is thrown. @param name the name of the member whose value is to be returned @param defaultValue the value to be returned if the requested member is missing @return the value of the last member with the specified name, or the given default value if this object does not contain a member with that name
[ "Returns", "the", "<code", ">", "long<", "/", "code", ">", "value", "of", "the", "member", "with", "the", "specified", "name", "in", "this", "object", ".", "If", "this", "object", "does", "not", "contain", "a", "member", "with", "this", "name", "the", "given", "default", "value", "is", "returned", ".", "If", "this", "object", "contains", "multiple", "members", "with", "the", "given", "name", "the", "last", "one", "will", "be", "picked", ".", "If", "this", "member", "s", "value", "does", "not", "represent", "a", "JSON", "number", "or", "if", "it", "cannot", "be", "interpreted", "as", "Java", "<code", ">", "long<", "/", "code", ">", "an", "exception", "is", "thrown", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java#L600-L603
JodaOrg/joda-time
src/main/java/org/joda/time/field/BaseDateTimeField.java
BaseDateTimeField.convertText
protected int convertText(String text, Locale locale) { try { return Integer.parseInt(text); } catch (NumberFormatException ex) { throw new IllegalFieldValueException(getType(), text); } }
java
protected int convertText(String text, Locale locale) { try { return Integer.parseInt(text); } catch (NumberFormatException ex) { throw new IllegalFieldValueException(getType(), text); } }
[ "protected", "int", "convertText", "(", "String", "text", ",", "Locale", "locale", ")", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "text", ")", ";", "}", "catch", "(", "NumberFormatException", "ex", ")", "{", "throw", "new", "IllegalFieldValueException", "(", "getType", "(", ")", ",", "text", ")", ";", "}", "}" ]
Convert the specified text and locale into a value. @param text the text to convert @param locale the locale to convert using @return the value extracted from the text @throws IllegalArgumentException if the text is invalid
[ "Convert", "the", "specified", "text", "and", "locale", "into", "a", "value", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/BaseDateTimeField.java#L666-L672
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.getCustomEntityRoleAsync
public Observable<EntityRole> getCustomEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) { return getCustomEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() { @Override public EntityRole call(ServiceResponse<EntityRole> response) { return response.body(); } }); }
java
public Observable<EntityRole> getCustomEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) { return getCustomEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() { @Override public EntityRole call(ServiceResponse<EntityRole> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EntityRole", ">", "getCustomEntityRoleAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ")", "{", "return", "getCustomEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ",", "roleId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "EntityRole", ">", ",", "EntityRole", ">", "(", ")", "{", "@", "Override", "public", "EntityRole", "call", "(", "ServiceResponse", "<", "EntityRole", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get one entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity ID. @param roleId entity role ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EntityRole object
[ "Get", "one", "entity", "role", "for", "a", "given", "entity", "." ]
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#L13592-L13599
magro/memcached-session-manager
core/src/main/java/de/javakaffee/web/msm/JavaSerializationTranscoder.java
JavaSerializationTranscoder.deserializeAttributes
@Override public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in ) { ByteArrayInputStream bis = null; ObjectInputStream ois = null; try { bis = new ByteArrayInputStream( in ); ois = createObjectInputStream( bis ); final ConcurrentMap<String, Object> attributes = new ConcurrentHashMap<String, Object>(); final int n = ( (Integer) ois.readObject() ).intValue(); for ( int i = 0; i < n; i++ ) { final String name = (String) ois.readObject(); final Object value = ois.readObject(); if ( ( value instanceof String ) && ( value.equals( NOT_SERIALIZED ) ) ) { continue; } if ( LOG.isDebugEnabled() ) { LOG.debug( " loading attribute '" + name + "' with value '" + value + "'" ); } attributes.put( name, value ); } return attributes; } catch ( final ClassNotFoundException e ) { LOG.warn( "Caught CNFE decoding "+ in.length +" bytes of data", e ); throw new TranscoderDeserializationException( "Caught CNFE decoding data", e ); } catch ( final IOException e ) { LOG.warn( "Caught IOException decoding "+ in.length +" bytes of data", e ); throw new TranscoderDeserializationException( "Caught IOException decoding data", e ); } finally { closeSilently( bis ); closeSilently( ois ); } }
java
@Override public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in ) { ByteArrayInputStream bis = null; ObjectInputStream ois = null; try { bis = new ByteArrayInputStream( in ); ois = createObjectInputStream( bis ); final ConcurrentMap<String, Object> attributes = new ConcurrentHashMap<String, Object>(); final int n = ( (Integer) ois.readObject() ).intValue(); for ( int i = 0; i < n; i++ ) { final String name = (String) ois.readObject(); final Object value = ois.readObject(); if ( ( value instanceof String ) && ( value.equals( NOT_SERIALIZED ) ) ) { continue; } if ( LOG.isDebugEnabled() ) { LOG.debug( " loading attribute '" + name + "' with value '" + value + "'" ); } attributes.put( name, value ); } return attributes; } catch ( final ClassNotFoundException e ) { LOG.warn( "Caught CNFE decoding "+ in.length +" bytes of data", e ); throw new TranscoderDeserializationException( "Caught CNFE decoding data", e ); } catch ( final IOException e ) { LOG.warn( "Caught IOException decoding "+ in.length +" bytes of data", e ); throw new TranscoderDeserializationException( "Caught IOException decoding data", e ); } finally { closeSilently( bis ); closeSilently( ois ); } }
[ "@", "Override", "public", "ConcurrentMap", "<", "String", ",", "Object", ">", "deserializeAttributes", "(", "final", "byte", "[", "]", "in", ")", "{", "ByteArrayInputStream", "bis", "=", "null", ";", "ObjectInputStream", "ois", "=", "null", ";", "try", "{", "bis", "=", "new", "ByteArrayInputStream", "(", "in", ")", ";", "ois", "=", "createObjectInputStream", "(", "bis", ")", ";", "final", "ConcurrentMap", "<", "String", ",", "Object", ">", "attributes", "=", "new", "ConcurrentHashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "final", "int", "n", "=", "(", "(", "Integer", ")", "ois", ".", "readObject", "(", ")", ")", ".", "intValue", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "final", "String", "name", "=", "(", "String", ")", "ois", ".", "readObject", "(", ")", ";", "final", "Object", "value", "=", "ois", ".", "readObject", "(", ")", ";", "if", "(", "(", "value", "instanceof", "String", ")", "&&", "(", "value", ".", "equals", "(", "NOT_SERIALIZED", ")", ")", ")", "{", "continue", ";", "}", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\" loading attribute '\"", "+", "name", "+", "\"' with value '\"", "+", "value", "+", "\"'\"", ")", ";", "}", "attributes", ".", "put", "(", "name", ",", "value", ")", ";", "}", "return", "attributes", ";", "}", "catch", "(", "final", "ClassNotFoundException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Caught CNFE decoding \"", "+", "in", ".", "length", "+", "\" bytes of data\"", ",", "e", ")", ";", "throw", "new", "TranscoderDeserializationException", "(", "\"Caught CNFE decoding data\"", ",", "e", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Caught IOException decoding \"", "+", "in", ".", "length", "+", "\" bytes of data\"", ",", "e", ")", ";", "throw", "new", "TranscoderDeserializationException", "(", "\"Caught IOException decoding data\"", ",", "e", ")", ";", "}", "finally", "{", "closeSilently", "(", "bis", ")", ";", "closeSilently", "(", "ois", ")", ";", "}", "}" ]
Get the object represented by the given serialized bytes. @param in the bytes to deserialize @return the resulting object
[ "Get", "the", "object", "represented", "by", "the", "given", "serialized", "bytes", "." ]
train
https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/JavaSerializationTranscoder.java#L161-L194
stratosphere/stratosphere
stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/VertexCentricIteration.java
VertexCentricIteration.registerAggregator
public void registerAggregator(String name, Class<? extends Aggregator<?>> aggregator) { this.aggregators.put(name, aggregator); }
java
public void registerAggregator(String name, Class<? extends Aggregator<?>> aggregator) { this.aggregators.put(name, aggregator); }
[ "public", "void", "registerAggregator", "(", "String", "name", ",", "Class", "<", "?", "extends", "Aggregator", "<", "?", ">", ">", "aggregator", ")", "{", "this", ".", "aggregators", ".", "put", "(", "name", ",", "aggregator", ")", ";", "}" ]
Registers a new aggregator. Aggregators registered here are available during the execution of the vertex updates via {@link VertexUpdateFunction#getIterationAggregator(String)} and {@link VertexUpdateFunction#getPreviousIterationAggregate(String)}. @param name The name of the aggregator, used to retrieve it and its aggregates during execution. @param aggregator The aggregator.
[ "Registers", "a", "new", "aggregator", ".", "Aggregators", "registered", "here", "are", "available", "during", "the", "execution", "of", "the", "vertex", "updates", "via", "{", "@link", "VertexUpdateFunction#getIterationAggregator", "(", "String", ")", "}", "and", "{", "@link", "VertexUpdateFunction#getPreviousIterationAggregate", "(", "String", ")", "}", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/VertexCentricIteration.java#L170-L172
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONCompare.java
JSONCompare.compareJSON
public static JSONCompareResult compareJSON(String expectedStr, String actualStr, JSONComparator comparator) throws JSONException { Object expected = JSONParser.parseJSON(expectedStr); Object actual = JSONParser.parseJSON(actualStr); if ((expected instanceof JSONObject) && (actual instanceof JSONObject)) { return compareJSON((JSONObject) expected, (JSONObject) actual, comparator); } else if ((expected instanceof JSONArray) && (actual instanceof JSONArray)) { return compareJSON((JSONArray)expected, (JSONArray)actual, comparator); } else if (expected instanceof JSONString && actual instanceof JSONString) { return compareJson((JSONString) expected, (JSONString) actual); } else if (expected instanceof JSONObject) { return new JSONCompareResult().fail("", expected, actual); } else { return new JSONCompareResult().fail("", expected, actual); } }
java
public static JSONCompareResult compareJSON(String expectedStr, String actualStr, JSONComparator comparator) throws JSONException { Object expected = JSONParser.parseJSON(expectedStr); Object actual = JSONParser.parseJSON(actualStr); if ((expected instanceof JSONObject) && (actual instanceof JSONObject)) { return compareJSON((JSONObject) expected, (JSONObject) actual, comparator); } else if ((expected instanceof JSONArray) && (actual instanceof JSONArray)) { return compareJSON((JSONArray)expected, (JSONArray)actual, comparator); } else if (expected instanceof JSONString && actual instanceof JSONString) { return compareJson((JSONString) expected, (JSONString) actual); } else if (expected instanceof JSONObject) { return new JSONCompareResult().fail("", expected, actual); } else { return new JSONCompareResult().fail("", expected, actual); } }
[ "public", "static", "JSONCompareResult", "compareJSON", "(", "String", "expectedStr", ",", "String", "actualStr", ",", "JSONComparator", "comparator", ")", "throws", "JSONException", "{", "Object", "expected", "=", "JSONParser", ".", "parseJSON", "(", "expectedStr", ")", ";", "Object", "actual", "=", "JSONParser", ".", "parseJSON", "(", "actualStr", ")", ";", "if", "(", "(", "expected", "instanceof", "JSONObject", ")", "&&", "(", "actual", "instanceof", "JSONObject", ")", ")", "{", "return", "compareJSON", "(", "(", "JSONObject", ")", "expected", ",", "(", "JSONObject", ")", "actual", ",", "comparator", ")", ";", "}", "else", "if", "(", "(", "expected", "instanceof", "JSONArray", ")", "&&", "(", "actual", "instanceof", "JSONArray", ")", ")", "{", "return", "compareJSON", "(", "(", "JSONArray", ")", "expected", ",", "(", "JSONArray", ")", "actual", ",", "comparator", ")", ";", "}", "else", "if", "(", "expected", "instanceof", "JSONString", "&&", "actual", "instanceof", "JSONString", ")", "{", "return", "compareJson", "(", "(", "JSONString", ")", "expected", ",", "(", "JSONString", ")", "actual", ")", ";", "}", "else", "if", "(", "expected", "instanceof", "JSONObject", ")", "{", "return", "new", "JSONCompareResult", "(", ")", ".", "fail", "(", "\"\"", ",", "expected", ",", "actual", ")", ";", "}", "else", "{", "return", "new", "JSONCompareResult", "(", ")", ".", "fail", "(", "\"\"", ",", "expected", ",", "actual", ")", ";", "}", "}" ]
Compares JSON string provided to the expected JSON string using provided comparator, and returns the results of the comparison. @param expectedStr Expected JSON string @param actualStr JSON string to compare @param comparator Comparator to use @return result of the comparison @throws JSONException JSON parsing error @throws IllegalArgumentException when type of expectedStr doesn't match the type of actualStr
[ "Compares", "JSON", "string", "provided", "to", "the", "expected", "JSON", "string", "using", "provided", "comparator", "and", "returns", "the", "results", "of", "the", "comparison", "." ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONCompare.java#L47-L66
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bcc/BccClient.java
BccClient.createSnapshot
public CreateSnapshotResponse createSnapshot(String volumeId, String snapshotName, String desc) { return this.createSnapshot(new CreateSnapshotRequest() .withVolumeId(volumeId).withSnapshotName(snapshotName).withDesc(desc)); }
java
public CreateSnapshotResponse createSnapshot(String volumeId, String snapshotName, String desc) { return this.createSnapshot(new CreateSnapshotRequest() .withVolumeId(volumeId).withSnapshotName(snapshotName).withDesc(desc)); }
[ "public", "CreateSnapshotResponse", "createSnapshot", "(", "String", "volumeId", ",", "String", "snapshotName", ",", "String", "desc", ")", "{", "return", "this", ".", "createSnapshot", "(", "new", "CreateSnapshotRequest", "(", ")", ".", "withVolumeId", "(", "volumeId", ")", ".", "withSnapshotName", "(", "snapshotName", ")", ".", "withDesc", "(", "desc", ")", ")", ";", "}" ]
Creating snapshot from specified volume. You can create snapshot from system volume and CDS volume. While creating snapshot from system volume,the instance must be Running or Stopped, otherwise,it's will get <code>409</code> errorCode. While creating snapshot from CDS volume,,the volume must be InUs or Available, otherwise,it's will get <code>409</code> errorCode. This is an asynchronous interface, you can get the latest status by invoke {@link #getSnapshot(GetSnapshotRequest)} @param volumeId The id of volume which will be used to create snapshot. @param snapshotName The name of snapshot will be created. @param desc The optional parameter to describe the newly created snapshot. @return The response with the id of snapshot created.
[ "Creating", "snapshot", "from", "specified", "volume", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1386-L1389
Azure/azure-sdk-for-java
datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java
ServicesInner.checkNameAvailability
public NameAvailabilityResponseInner checkNameAvailability(String location, NameAvailabilityRequest parameters) { return checkNameAvailabilityWithServiceResponseAsync(location, parameters).toBlocking().single().body(); }
java
public NameAvailabilityResponseInner checkNameAvailability(String location, NameAvailabilityRequest parameters) { return checkNameAvailabilityWithServiceResponseAsync(location, parameters).toBlocking().single().body(); }
[ "public", "NameAvailabilityResponseInner", "checkNameAvailability", "(", "String", "location", ",", "NameAvailabilityRequest", "parameters", ")", "{", "return", "checkNameAvailabilityWithServiceResponseAsync", "(", "location", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Check name validity and availability. This method checks whether a proposed top-level resource name is valid and available. @param location The Azure region of the operation @param parameters Requested name to validate @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the NameAvailabilityResponseInner object if successful.
[ "Check", "name", "validity", "and", "availability", ".", "This", "method", "checks", "whether", "a", "proposed", "top", "-", "level", "resource", "name", "is", "valid", "and", "available", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L1812-L1814
amlinv/amq-monitor
amq-monitor-web-impl/src/main/java/com/amlinv/activemq/stats/QueueStatisticsCollection.java
QueueStatisticsCollection.updateRates
protected void updateRates (QueueStatMeasurements rateMeasurements, long dequeueCountDelta, long enqueueCountDelta) { double oldDequeueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageDequeueRate(); double oldDequeueRateOneHour = rateMeasurements.messageRates.getOneHourAverageDequeueRate(); double oldDequeueRateOneDay = rateMeasurements.messageRates.getOneDayAverageDequeueRate(); double oldEnqueueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate(); double oldEnqueueRateOneHour = rateMeasurements.messageRates.getOneHourAverageEnqueueRate(); double oldEnqueueRateOneDay = rateMeasurements.messageRates.getOneDayAverageEnqueueRate(); // // Protect against negative changes in Enqueue and Dequeue counts - these metrics are designed to only ever // increase, but can reset in cases such as restarting a broker and manually resetting the statistics through // JMX controls. // if ( dequeueCountDelta < 0 ) { this.log.debug("detected negative change in dequeue count; ignoring: queue={}; delta={}", this.queueName, dequeueCountDelta); dequeueCountDelta = 0; } if ( enqueueCountDelta < 0 ) { this.log.debug("detected negative change in enqueue count; ignoring: queue={}; delta={}", this.queueName, enqueueCountDelta); enqueueCountDelta = 0; } // // Update the rates and add in the changes. // rateMeasurements.messageRates.onTimestampSample(statsClock.getStatsStopWatchTime(), dequeueCountDelta, enqueueCountDelta); aggregateDequeueRateOneMinute -= oldDequeueRateOneMinute; aggregateDequeueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageDequeueRate(); aggregateDequeueRateOneHour -= oldDequeueRateOneHour; aggregateDequeueRateOneHour += rateMeasurements.messageRates.getOneHourAverageDequeueRate(); aggregateDequeueRateOneDay -= oldDequeueRateOneDay; aggregateDequeueRateOneDay += rateMeasurements.messageRates.getOneDayAverageDequeueRate(); aggregateEnqueueRateOneMinute -= oldEnqueueRateOneMinute; aggregateEnqueueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate(); aggregateEnqueueRateOneHour -= oldEnqueueRateOneHour; aggregateEnqueueRateOneHour += rateMeasurements.messageRates.getOneHourAverageEnqueueRate(); aggregateEnqueueRateOneDay -= oldEnqueueRateOneDay; aggregateEnqueueRateOneDay += rateMeasurements.messageRates.getOneDayAverageEnqueueRate(); }
java
protected void updateRates (QueueStatMeasurements rateMeasurements, long dequeueCountDelta, long enqueueCountDelta) { double oldDequeueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageDequeueRate(); double oldDequeueRateOneHour = rateMeasurements.messageRates.getOneHourAverageDequeueRate(); double oldDequeueRateOneDay = rateMeasurements.messageRates.getOneDayAverageDequeueRate(); double oldEnqueueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate(); double oldEnqueueRateOneHour = rateMeasurements.messageRates.getOneHourAverageEnqueueRate(); double oldEnqueueRateOneDay = rateMeasurements.messageRates.getOneDayAverageEnqueueRate(); // // Protect against negative changes in Enqueue and Dequeue counts - these metrics are designed to only ever // increase, but can reset in cases such as restarting a broker and manually resetting the statistics through // JMX controls. // if ( dequeueCountDelta < 0 ) { this.log.debug("detected negative change in dequeue count; ignoring: queue={}; delta={}", this.queueName, dequeueCountDelta); dequeueCountDelta = 0; } if ( enqueueCountDelta < 0 ) { this.log.debug("detected negative change in enqueue count; ignoring: queue={}; delta={}", this.queueName, enqueueCountDelta); enqueueCountDelta = 0; } // // Update the rates and add in the changes. // rateMeasurements.messageRates.onTimestampSample(statsClock.getStatsStopWatchTime(), dequeueCountDelta, enqueueCountDelta); aggregateDequeueRateOneMinute -= oldDequeueRateOneMinute; aggregateDequeueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageDequeueRate(); aggregateDequeueRateOneHour -= oldDequeueRateOneHour; aggregateDequeueRateOneHour += rateMeasurements.messageRates.getOneHourAverageDequeueRate(); aggregateDequeueRateOneDay -= oldDequeueRateOneDay; aggregateDequeueRateOneDay += rateMeasurements.messageRates.getOneDayAverageDequeueRate(); aggregateEnqueueRateOneMinute -= oldEnqueueRateOneMinute; aggregateEnqueueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate(); aggregateEnqueueRateOneHour -= oldEnqueueRateOneHour; aggregateEnqueueRateOneHour += rateMeasurements.messageRates.getOneHourAverageEnqueueRate(); aggregateEnqueueRateOneDay -= oldEnqueueRateOneDay; aggregateEnqueueRateOneDay += rateMeasurements.messageRates.getOneDayAverageEnqueueRate(); }
[ "protected", "void", "updateRates", "(", "QueueStatMeasurements", "rateMeasurements", ",", "long", "dequeueCountDelta", ",", "long", "enqueueCountDelta", ")", "{", "double", "oldDequeueRateOneMinute", "=", "rateMeasurements", ".", "messageRates", ".", "getOneMinuteAverageDequeueRate", "(", ")", ";", "double", "oldDequeueRateOneHour", "=", "rateMeasurements", ".", "messageRates", ".", "getOneHourAverageDequeueRate", "(", ")", ";", "double", "oldDequeueRateOneDay", "=", "rateMeasurements", ".", "messageRates", ".", "getOneDayAverageDequeueRate", "(", ")", ";", "double", "oldEnqueueRateOneMinute", "=", "rateMeasurements", ".", "messageRates", ".", "getOneMinuteAverageEnqueueRate", "(", ")", ";", "double", "oldEnqueueRateOneHour", "=", "rateMeasurements", ".", "messageRates", ".", "getOneHourAverageEnqueueRate", "(", ")", ";", "double", "oldEnqueueRateOneDay", "=", "rateMeasurements", ".", "messageRates", ".", "getOneDayAverageEnqueueRate", "(", ")", ";", "//", "// Protect against negative changes in Enqueue and Dequeue counts - these metrics are designed to only ever", "// increase, but can reset in cases such as restarting a broker and manually resetting the statistics through", "// JMX controls.", "//", "if", "(", "dequeueCountDelta", "<", "0", ")", "{", "this", ".", "log", ".", "debug", "(", "\"detected negative change in dequeue count; ignoring: queue={}; delta={}\"", ",", "this", ".", "queueName", ",", "dequeueCountDelta", ")", ";", "dequeueCountDelta", "=", "0", ";", "}", "if", "(", "enqueueCountDelta", "<", "0", ")", "{", "this", ".", "log", ".", "debug", "(", "\"detected negative change in enqueue count; ignoring: queue={}; delta={}\"", ",", "this", ".", "queueName", ",", "enqueueCountDelta", ")", ";", "enqueueCountDelta", "=", "0", ";", "}", "//", "// Update the rates and add in the changes.", "//", "rateMeasurements", ".", "messageRates", ".", "onTimestampSample", "(", "statsClock", ".", "getStatsStopWatchTime", "(", ")", ",", "dequeueCountDelta", ",", "enqueueCountDelta", ")", ";", "aggregateDequeueRateOneMinute", "-=", "oldDequeueRateOneMinute", ";", "aggregateDequeueRateOneMinute", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneMinuteAverageDequeueRate", "(", ")", ";", "aggregateDequeueRateOneHour", "-=", "oldDequeueRateOneHour", ";", "aggregateDequeueRateOneHour", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneHourAverageDequeueRate", "(", ")", ";", "aggregateDequeueRateOneDay", "-=", "oldDequeueRateOneDay", ";", "aggregateDequeueRateOneDay", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneDayAverageDequeueRate", "(", ")", ";", "aggregateEnqueueRateOneMinute", "-=", "oldEnqueueRateOneMinute", ";", "aggregateEnqueueRateOneMinute", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneMinuteAverageEnqueueRate", "(", ")", ";", "aggregateEnqueueRateOneHour", "-=", "oldEnqueueRateOneHour", ";", "aggregateEnqueueRateOneHour", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneHourAverageEnqueueRate", "(", ")", ";", "aggregateEnqueueRateOneDay", "-=", "oldEnqueueRateOneDay", ";", "aggregateEnqueueRateOneDay", "+=", "rateMeasurements", ".", "messageRates", ".", "getOneDayAverageEnqueueRate", "(", ")", ";", "}" ]
Update message rates given the change in dequeue and enqueue counts for one broker queue. @param rateMeasurements measurements for one broker queue. @param dequeueCountDelta change in the dequeue count since the last measurement for the same broker queue. @param enqueueCountDelta change in the enqueue count since the last measurement for the same broker queue.
[ "Update", "message", "rates", "given", "the", "change", "in", "dequeue", "and", "enqueue", "counts", "for", "one", "broker", "queue", "." ]
train
https://github.com/amlinv/amq-monitor/blob/0ae0156f56d7d3edf98bca9c30b153b770fe5bfa/amq-monitor-web-impl/src/main/java/com/amlinv/activemq/stats/QueueStatisticsCollection.java#L158-L208
qiniu/android-sdk
library/src/main/java/com/qiniu/android/storage/UploadManager.java
UploadManager.syncPut
public ResponseInfo syncPut(File file, String key, String token, UploadOptions options) { final UpToken decodedToken = UpToken.parse(token); ResponseInfo info = areInvalidArg(key, null, file, token, decodedToken); if (info != null) { return info; } return FormUploader.syncUpload(client, config, file, key, decodedToken, options); }
java
public ResponseInfo syncPut(File file, String key, String token, UploadOptions options) { final UpToken decodedToken = UpToken.parse(token); ResponseInfo info = areInvalidArg(key, null, file, token, decodedToken); if (info != null) { return info; } return FormUploader.syncUpload(client, config, file, key, decodedToken, options); }
[ "public", "ResponseInfo", "syncPut", "(", "File", "file", ",", "String", "key", ",", "String", "token", ",", "UploadOptions", "options", ")", "{", "final", "UpToken", "decodedToken", "=", "UpToken", ".", "parse", "(", "token", ")", ";", "ResponseInfo", "info", "=", "areInvalidArg", "(", "key", ",", "null", ",", "file", ",", "token", ",", "decodedToken", ")", ";", "if", "(", "info", "!=", "null", ")", "{", "return", "info", ";", "}", "return", "FormUploader", ".", "syncUpload", "(", "client", ",", "config", ",", "file", ",", "key", ",", "decodedToken", ",", "options", ")", ";", "}" ]
同步上传文件。使用 form 表单方式上传,建议只在文件较小情况下使用此方式,如 file.size() < 1024 * 1024。 @param file 上传的文件对象 @param key 上传数据保存的文件名 @param token 上传凭证 @param options 上传数据的可选参数 @return 响应信息 ResponseInfo#response 响应体,序列化后 json 格式
[ "同步上传文件。使用", "form", "表单方式上传,建议只在文件较小情况下使用此方式,如", "file", ".", "size", "()", "<", "1024", "*", "1024。" ]
train
https://github.com/qiniu/android-sdk/blob/dbd2a01fb3bff7a5e75e8934bbf81713124d8466/library/src/main/java/com/qiniu/android/storage/UploadManager.java#L219-L226
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPChannel.java
TCPChannel.setup
public ChannelTermination setup(ChannelData runtimeConfig, TCPChannelConfiguration tcpConfig, TCPChannelFactory factory) throws ChannelException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setup"); } this.channelFactory = factory; this.channelData = runtimeConfig; this.channelName = runtimeConfig.getName(); this.externalName = runtimeConfig.getExternalName(); this.config = tcpConfig; for (int i = 0; i < this.inUse.length; i++) { this.inUse[i] = new ConcurrentLinkedQueue<TCPConnLink>(); } this.vcFactory = ChannelFrameworkFactory.getChannelFramework().getInboundVCFactory(); this.alists = AccessLists.getInstance(this.config); if (this.config.isInbound() && acceptReqProcessor.get() == null) { acceptReqProcessor = StaticValue.mutateStaticValue(acceptReqProcessor, new Callable<NBAccept>() { @Override public NBAccept call() throws Exception { return new NBAccept(TCPChannel.this.config); } }); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setup"); } return null; }
java
public ChannelTermination setup(ChannelData runtimeConfig, TCPChannelConfiguration tcpConfig, TCPChannelFactory factory) throws ChannelException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setup"); } this.channelFactory = factory; this.channelData = runtimeConfig; this.channelName = runtimeConfig.getName(); this.externalName = runtimeConfig.getExternalName(); this.config = tcpConfig; for (int i = 0; i < this.inUse.length; i++) { this.inUse[i] = new ConcurrentLinkedQueue<TCPConnLink>(); } this.vcFactory = ChannelFrameworkFactory.getChannelFramework().getInboundVCFactory(); this.alists = AccessLists.getInstance(this.config); if (this.config.isInbound() && acceptReqProcessor.get() == null) { acceptReqProcessor = StaticValue.mutateStaticValue(acceptReqProcessor, new Callable<NBAccept>() { @Override public NBAccept call() throws Exception { return new NBAccept(TCPChannel.this.config); } }); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setup"); } return null; }
[ "public", "ChannelTermination", "setup", "(", "ChannelData", "runtimeConfig", ",", "TCPChannelConfiguration", "tcpConfig", ",", "TCPChannelFactory", "factory", ")", "throws", "ChannelException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"setup\"", ")", ";", "}", "this", ".", "channelFactory", "=", "factory", ";", "this", ".", "channelData", "=", "runtimeConfig", ";", "this", ".", "channelName", "=", "runtimeConfig", ".", "getName", "(", ")", ";", "this", ".", "externalName", "=", "runtimeConfig", ".", "getExternalName", "(", ")", ";", "this", ".", "config", "=", "tcpConfig", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "inUse", ".", "length", ";", "i", "++", ")", "{", "this", ".", "inUse", "[", "i", "]", "=", "new", "ConcurrentLinkedQueue", "<", "TCPConnLink", ">", "(", ")", ";", "}", "this", ".", "vcFactory", "=", "ChannelFrameworkFactory", ".", "getChannelFramework", "(", ")", ".", "getInboundVCFactory", "(", ")", ";", "this", ".", "alists", "=", "AccessLists", ".", "getInstance", "(", "this", ".", "config", ")", ";", "if", "(", "this", ".", "config", ".", "isInbound", "(", ")", "&&", "acceptReqProcessor", ".", "get", "(", ")", "==", "null", ")", "{", "acceptReqProcessor", "=", "StaticValue", ".", "mutateStaticValue", "(", "acceptReqProcessor", ",", "new", "Callable", "<", "NBAccept", ">", "(", ")", "{", "@", "Override", "public", "NBAccept", "call", "(", ")", "throws", "Exception", "{", "return", "new", "NBAccept", "(", "TCPChannel", ".", "this", ".", "config", ")", ";", "}", "}", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"setup\"", ")", ";", "}", "return", "null", ";", "}" ]
Initialize this channel. @param runtimeConfig @param tcpConfig @param factory @return ChannelTermination @throws ChannelException
[ "Initialize", "this", "channel", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/TCPChannel.java#L124-L156
kiegroup/drools
drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java
KnowledgeBaseImpl.populateGlobalsMap
private void populateGlobalsMap(Map<String, String> globs) throws ClassNotFoundException { this.globals = new HashMap<String, Class<?>>(); for (Map.Entry<String, String> entry : globs.entrySet()) { addGlobal( entry.getKey(), this.rootClassLoader.loadClass( entry.getValue() ) ); } }
java
private void populateGlobalsMap(Map<String, String> globs) throws ClassNotFoundException { this.globals = new HashMap<String, Class<?>>(); for (Map.Entry<String, String> entry : globs.entrySet()) { addGlobal( entry.getKey(), this.rootClassLoader.loadClass( entry.getValue() ) ); } }
[ "private", "void", "populateGlobalsMap", "(", "Map", "<", "String", ",", "String", ">", "globs", ")", "throws", "ClassNotFoundException", "{", "this", ".", "globals", "=", "new", "HashMap", "<", "String", ",", "Class", "<", "?", ">", ">", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "globs", ".", "entrySet", "(", ")", ")", "{", "addGlobal", "(", "entry", ".", "getKey", "(", ")", ",", "this", ".", "rootClassLoader", ".", "loadClass", "(", "entry", ".", "getValue", "(", ")", ")", ")", ";", "}", "}" ]
globals class types must be re-wired after serialization @throws ClassNotFoundException
[ "globals", "class", "types", "must", "be", "re", "-", "wired", "after", "serialization" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/impl/KnowledgeBaseImpl.java#L588-L594
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginSetFlowLogConfiguration
public FlowLogInformationInner beginSetFlowLogConfiguration(String resourceGroupName, String networkWatcherName, FlowLogInformationInner parameters) { return beginSetFlowLogConfigurationWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
java
public FlowLogInformationInner beginSetFlowLogConfiguration(String resourceGroupName, String networkWatcherName, FlowLogInformationInner parameters) { return beginSetFlowLogConfigurationWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
[ "public", "FlowLogInformationInner", "beginSetFlowLogConfiguration", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "FlowLogInformationInner", "parameters", ")", "{", "return", "beginSetFlowLogConfigurationWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkWatcherName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Configures flow log on a specified resource. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that define the configuration of flow log. @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 FlowLogInformationInner object if successful.
[ "Configures", "flow", "log", "on", "a", "specified", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1877-L1879
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/BeanContext.java
BeanContext.getBeanMap
public BeanMap getBeanMap(Object bean, boolean failOnNulls) throws BeanContextException { BeanPropertyAccessor accessor = BeanPropertyAccessor.forClass(bean.getClass()); return new BeanMap(bean, accessor, failOnNulls); }
java
public BeanMap getBeanMap(Object bean, boolean failOnNulls) throws BeanContextException { BeanPropertyAccessor accessor = BeanPropertyAccessor.forClass(bean.getClass()); return new BeanMap(bean, accessor, failOnNulls); }
[ "public", "BeanMap", "getBeanMap", "(", "Object", "bean", ",", "boolean", "failOnNulls", ")", "throws", "BeanContextException", "{", "BeanPropertyAccessor", "accessor", "=", "BeanPropertyAccessor", ".", "forClass", "(", "bean", ".", "getClass", "(", ")", ")", ";", "return", "new", "BeanMap", "(", "bean", ",", "accessor", ",", "failOnNulls", ")", ";", "}" ]
Get an object wrapping the given bean that allows dynamic property lookups. The <code>failOnNulls</code> parameter may be used to cause an exception to be thrown when portions of the composite graph are <code>null</code>. <code>bean = getBeanMap(bean); bean['name']</code> @param bean The bean to wrap and return @param failOnNulls The state of whether to throw exceptions on null graph @return The object allowing dynamic lookups on the bean @throws BeanContextException If any portion of the composite graph is <code>null</code> such as city being null in 'team.city.name'. This is only thrown if failOnNulls is <code>true</code>
[ "Get", "an", "object", "wrapping", "the", "given", "bean", "that", "allows", "dynamic", "property", "lookups", ".", "The", "<code", ">", "failOnNulls<", "/", "code", ">", "parameter", "may", "be", "used", "to", "cause", "an", "exception", "to", "be", "thrown", "when", "portions", "of", "the", "composite", "graph", "are", "<code", ">", "null<", "/", "code", ">", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/BeanContext.java#L88-L94
lucee/Lucee
core/src/main/java/lucee/commons/io/compress/CompressUtil.java
CompressUtil.compressTar
public static void compressTar(Resource[] sources, Resource target, int mode) throws IOException { compressTar(sources, IOUtil.toBufferedOutputStream(target.getOutputStream()), mode); }
java
public static void compressTar(Resource[] sources, Resource target, int mode) throws IOException { compressTar(sources, IOUtil.toBufferedOutputStream(target.getOutputStream()), mode); }
[ "public", "static", "void", "compressTar", "(", "Resource", "[", "]", "sources", ",", "Resource", "target", ",", "int", "mode", ")", "throws", "IOException", "{", "compressTar", "(", "sources", ",", "IOUtil", ".", "toBufferedOutputStream", "(", "target", ".", "getOutputStream", "(", ")", ")", ",", "mode", ")", ";", "}" ]
compress a source file/directory to a tar file @param sources @param target @param mode @throws IOException
[ "compress", "a", "source", "file", "/", "directory", "to", "a", "tar", "file" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/compress/CompressUtil.java#L543-L545
attoparser/attoparser
src/main/java/org/attoparser/dom/StructureTextsRepository.java
StructureTextsRepository.getStructureName
static String getStructureName(final char[] buffer, final int offset, final int len) { final int index = TextUtil.binarySearch(true, ALL_STANDARD_NAMES, buffer, offset, len); if (index < 0) { return new String(buffer, offset, len); } return ALL_STANDARD_NAMES[index]; }
java
static String getStructureName(final char[] buffer, final int offset, final int len) { final int index = TextUtil.binarySearch(true, ALL_STANDARD_NAMES, buffer, offset, len); if (index < 0) { return new String(buffer, offset, len); } return ALL_STANDARD_NAMES[index]; }
[ "static", "String", "getStructureName", "(", "final", "char", "[", "]", "buffer", ",", "final", "int", "offset", ",", "final", "int", "len", ")", "{", "final", "int", "index", "=", "TextUtil", ".", "binarySearch", "(", "true", ",", "ALL_STANDARD_NAMES", ",", "buffer", ",", "offset", ",", "len", ")", ";", "if", "(", "index", "<", "0", ")", "{", "return", "new", "String", "(", "buffer", ",", "offset", ",", "len", ")", ";", "}", "return", "ALL_STANDARD_NAMES", "[", "index", "]", ";", "}" ]
This method will try to avoid creating new strings for each structure name (element/attribute)
[ "This", "method", "will", "try", "to", "avoid", "creating", "new", "strings", "for", "each", "structure", "name", "(", "element", "/", "attribute", ")" ]
train
https://github.com/attoparser/attoparser/blob/d2e8c1d822e290b0ce0242aff6e56ebdb9ca74b0/src/main/java/org/attoparser/dom/StructureTextsRepository.java#L139-L148
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/AccountsApi.java
AccountsApi.createPermissionProfile
public PermissionProfile createPermissionProfile(String accountId, PermissionProfile permissionProfile) throws ApiException { return createPermissionProfile(accountId, permissionProfile, null); }
java
public PermissionProfile createPermissionProfile(String accountId, PermissionProfile permissionProfile) throws ApiException { return createPermissionProfile(accountId, permissionProfile, null); }
[ "public", "PermissionProfile", "createPermissionProfile", "(", "String", "accountId", ",", "PermissionProfile", "permissionProfile", ")", "throws", "ApiException", "{", "return", "createPermissionProfile", "(", "accountId", ",", "permissionProfile", ",", "null", ")", ";", "}" ]
Creates a new permission profile in the specified account. @param accountId The external account number (int) or account ID Guid. (required) @param permissionProfile (optional) @return PermissionProfile
[ "Creates", "a", "new", "permission", "profile", "in", "the", "specified", "account", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L274-L276
seam/faces
impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java
BeanManagerUtils.getContextualInstanceStrict
@SuppressWarnings("unchecked") public static <T> T getContextualInstanceStrict(final BeanManager manager, final Class<T> type) { T result = null; Bean<T> bean = resolveStrict(manager, type); if (bean != null) { CreationalContext<T> context = manager.createCreationalContext(bean); if (context != null) { result = (T) manager.getReference(bean, type, context); } } return result; }
java
@SuppressWarnings("unchecked") public static <T> T getContextualInstanceStrict(final BeanManager manager, final Class<T> type) { T result = null; Bean<T> bean = resolveStrict(manager, type); if (bean != null) { CreationalContext<T> context = manager.createCreationalContext(bean); if (context != null) { result = (T) manager.getReference(bean, type, context); } } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getContextualInstanceStrict", "(", "final", "BeanManager", "manager", ",", "final", "Class", "<", "T", ">", "type", ")", "{", "T", "result", "=", "null", ";", "Bean", "<", "T", ">", "bean", "=", "resolveStrict", "(", "manager", ",", "type", ")", ";", "if", "(", "bean", "!=", "null", ")", "{", "CreationalContext", "<", "T", ">", "context", "=", "manager", ".", "createCreationalContext", "(", "bean", ")", ";", "if", "(", "context", "!=", "null", ")", "{", "result", "=", "(", "T", ")", "manager", ".", "getReference", "(", "bean", ",", "type", ",", "context", ")", ";", "}", "}", "return", "result", ";", "}" ]
Get a CDI managed instance matching exactly the given type. That's why BeanManager#resolve isn't used. <p/> <b>NOTE:</b> Using this method should be avoided at all costs. <b>NOTE:</b> Using this method should be avoided at all costs. @param manager The bean manager with which to perform the lookup. @param type The class for which to return an instance. @return The managed instance, or null if none could be provided.
[ "Get", "a", "CDI", "managed", "instance", "matching", "exactly", "the", "given", "type", ".", "That", "s", "why", "BeanManager#resolve", "isn", "t", "used", ".", "<p", "/", ">", "<b", ">", "NOTE", ":", "<", "/", "b", ">", "Using", "this", "method", "should", "be", "avoided", "at", "all", "costs", ".", "<b", ">", "NOTE", ":", "<", "/", "b", ">", "Using", "this", "method", "should", "be", "avoided", "at", "all", "costs", "." ]
train
https://github.com/seam/faces/blob/2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java#L134-L145
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsEditorSelector.java
CmsEditorSelector.showErrorDialog
private static void showErrorDialog(CmsJspActionElement jsp, Throwable t) { CmsDialog wp = new CmsDialog(jsp); wp.setParamMessage(Messages.get().getBundle(wp.getLocale()).key(Messages.ERR_NO_EDITOR_FOUND_0)); wp.fillParamValues(jsp.getRequest()); try { wp.includeErrorpage(wp, t); } catch (JspException e) { LOG.debug( org.opencms.workplace.commons.Messages.get().getBundle().key( org.opencms.workplace.commons.Messages.LOG_ERROR_INCLUDE_FAILED_1, CmsWorkplace.FILE_DIALOG_SCREEN_ERRORPAGE), e); } }
java
private static void showErrorDialog(CmsJspActionElement jsp, Throwable t) { CmsDialog wp = new CmsDialog(jsp); wp.setParamMessage(Messages.get().getBundle(wp.getLocale()).key(Messages.ERR_NO_EDITOR_FOUND_0)); wp.fillParamValues(jsp.getRequest()); try { wp.includeErrorpage(wp, t); } catch (JspException e) { LOG.debug( org.opencms.workplace.commons.Messages.get().getBundle().key( org.opencms.workplace.commons.Messages.LOG_ERROR_INCLUDE_FAILED_1, CmsWorkplace.FILE_DIALOG_SCREEN_ERRORPAGE), e); } }
[ "private", "static", "void", "showErrorDialog", "(", "CmsJspActionElement", "jsp", ",", "Throwable", "t", ")", "{", "CmsDialog", "wp", "=", "new", "CmsDialog", "(", "jsp", ")", ";", "wp", ".", "setParamMessage", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", "wp", ".", "getLocale", "(", ")", ")", ".", "key", "(", "Messages", ".", "ERR_NO_EDITOR_FOUND_0", ")", ")", ";", "wp", ".", "fillParamValues", "(", "jsp", ".", "getRequest", "(", ")", ")", ";", "try", "{", "wp", ".", "includeErrorpage", "(", "wp", ",", "t", ")", ";", "}", "catch", "(", "JspException", "e", ")", "{", "LOG", ".", "debug", "(", "org", ".", "opencms", ".", "workplace", ".", "commons", ".", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "org", ".", "opencms", ".", "workplace", ".", "commons", ".", "Messages", ".", "LOG_ERROR_INCLUDE_FAILED_1", ",", "CmsWorkplace", ".", "FILE_DIALOG_SCREEN_ERRORPAGE", ")", ",", "e", ")", ";", "}", "}" ]
Shows the error dialog when no valid editor is found and returns null for the editor URI.<p> @param jsp the instantiated CmsJspActionElement @param t a throwable object, can be null
[ "Shows", "the", "error", "dialog", "when", "no", "valid", "editor", "is", "found", "and", "returns", "null", "for", "the", "editor", "URI", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsEditorSelector.java#L85-L99
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.writeString
public static void writeString(String s, DataOutput out) throws IOException { if(s != null) { out.write(1); out.writeUTF(s); } else out.write(0); }
java
public static void writeString(String s, DataOutput out) throws IOException { if(s != null) { out.write(1); out.writeUTF(s); } else out.write(0); }
[ "public", "static", "void", "writeString", "(", "String", "s", ",", "DataOutput", "out", ")", "throws", "IOException", "{", "if", "(", "s", "!=", "null", ")", "{", "out", ".", "write", "(", "1", ")", ";", "out", ".", "writeUTF", "(", "s", ")", ";", "}", "else", "out", ".", "write", "(", "0", ")", ";", "}" ]
Writes a string to buf. The length of the string is written first, followed by the chars (as single-byte values). Multi-byte values are truncated: only the lower byte of each multi-byte char is written, similar to {@link DataOutput#writeChars(String)}. @param s the string @param out the output stream
[ "Writes", "a", "string", "to", "buf", ".", "The", "length", "of", "the", "string", "is", "written", "first", "followed", "by", "the", "chars", "(", "as", "single", "-", "byte", "values", ")", ".", "Multi", "-", "byte", "values", "are", "truncated", ":", "only", "the", "lower", "byte", "of", "each", "multi", "-", "byte", "char", "is", "written", "similar", "to", "{" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L616-L623
nguillaumin/slick2d-maven
slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/FontFileReader.java
FontFileReader.readTTFString
public final String readTTFString() throws IOException { int i = current; while (file[i++] != 0) { if (i > fsize) { throw new java.io.EOFException("Reached EOF, file size=" + fsize); } } byte[] tmp = new byte[i - current]; System.arraycopy(file, current, tmp, 0, i - current); return new String(tmp, "ISO-8859-1"); }
java
public final String readTTFString() throws IOException { int i = current; while (file[i++] != 0) { if (i > fsize) { throw new java.io.EOFException("Reached EOF, file size=" + fsize); } } byte[] tmp = new byte[i - current]; System.arraycopy(file, current, tmp, 0, i - current); return new String(tmp, "ISO-8859-1"); }
[ "public", "final", "String", "readTTFString", "(", ")", "throws", "IOException", "{", "int", "i", "=", "current", ";", "while", "(", "file", "[", "i", "++", "]", "!=", "0", ")", "{", "if", "(", "i", ">", "fsize", ")", "{", "throw", "new", "java", ".", "io", ".", "EOFException", "(", "\"Reached EOF, file size=\"", "+", "fsize", ")", ";", "}", "}", "byte", "[", "]", "tmp", "=", "new", "byte", "[", "i", "-", "current", "]", ";", "System", ".", "arraycopy", "(", "file", ",", "current", ",", "tmp", ",", "0", ",", "i", "-", "current", ")", ";", "return", "new", "String", "(", "tmp", ",", "\"ISO-8859-1\"", ")", ";", "}" ]
Read a NUL terminated ISO-8859-1 string. @return A String @throws IOException If EOF is reached
[ "Read", "a", "NUL", "terminated", "ISO", "-", "8859", "-", "1", "string", "." ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/FontFileReader.java#L302-L314
facebookarchive/hadoop-20
src/core/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java
MetricsRecordImpl.setTag
public void setTag(String tagName, short tagValue) { tagTable.put(tagName, Short.valueOf(tagValue)); }
java
public void setTag(String tagName, short tagValue) { tagTable.put(tagName, Short.valueOf(tagValue)); }
[ "public", "void", "setTag", "(", "String", "tagName", ",", "short", "tagValue", ")", "{", "tagTable", ".", "put", "(", "tagName", ",", "Short", ".", "valueOf", "(", "tagValue", ")", ")", ";", "}" ]
Sets the named tag to the specified value. @param tagName name of the tag @param tagValue new value of the tag @throws MetricsException if the tagName conflicts with the configuration
[ "Sets", "the", "named", "tag", "to", "the", "specified", "value", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java#L101-L103
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/common/ProjectNodeSupport.java
ProjectNodeSupport.listPluginConfigurations
public List<ExtPluginConfiguration> listPluginConfigurations(final String keyprefix, final String serviceName) { return listPluginConfigurations(keyprefix, serviceName, true); }
java
public List<ExtPluginConfiguration> listPluginConfigurations(final String keyprefix, final String serviceName) { return listPluginConfigurations(keyprefix, serviceName, true); }
[ "public", "List", "<", "ExtPluginConfiguration", ">", "listPluginConfigurations", "(", "final", "String", "keyprefix", ",", "final", "String", "serviceName", ")", "{", "return", "listPluginConfigurations", "(", "keyprefix", ",", "serviceName", ",", "true", ")", ";", "}" ]
Return a list of resource model configuration @param serviceName @param keyprefix prefix for properties @return List of Maps, each map containing "type": String, "props":Properties
[ "Return", "a", "list", "of", "resource", "model", "configuration" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/ProjectNodeSupport.java#L683-L686
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.filemonitor/src/com/ibm/ws/kernel/filemonitor/internal/MonitorHolder.java
MonitorHolder.processFileRefresh
void processFileRefresh(boolean doFilterPaths, String listenerFilter) { externalScan(null, null, null, doFilterPaths, listenerFilter); }
java
void processFileRefresh(boolean doFilterPaths, String listenerFilter) { externalScan(null, null, null, doFilterPaths, listenerFilter); }
[ "void", "processFileRefresh", "(", "boolean", "doFilterPaths", ",", "String", "listenerFilter", ")", "{", "externalScan", "(", "null", ",", "null", ",", "null", ",", "doFilterPaths", ",", "listenerFilter", ")", ";", "}" ]
Processes file refresh operations for specific listeners. @param doFilterPaths The filter indicator. If true, input paths are filtered against pending file events. If false, all pending file events are processed. @param listenerFilter The filter string that allows only those listeners with a matching id to be called to process the event.
[ "Processes", "file", "refresh", "operations", "for", "specific", "listeners", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.filemonitor/src/com/ibm/ws/kernel/filemonitor/internal/MonitorHolder.java#L1142-L1144
apache/groovy
src/main/java/org/codehaus/groovy/runtime/EncodingGroovyMethods.java
EncodingGroovyMethods.encodeBase64
public static Writable encodeBase64(Byte[] data, final boolean chunked) { return encodeBase64(DefaultTypeTransformation.convertToByteArray(data), chunked); }
java
public static Writable encodeBase64(Byte[] data, final boolean chunked) { return encodeBase64(DefaultTypeTransformation.convertToByteArray(data), chunked); }
[ "public", "static", "Writable", "encodeBase64", "(", "Byte", "[", "]", "data", ",", "final", "boolean", "chunked", ")", "{", "return", "encodeBase64", "(", "DefaultTypeTransformation", ".", "convertToByteArray", "(", "data", ")", ",", "chunked", ")", ";", "}" ]
Produce a Writable object which writes the Base64 encoding of the byte array. Calling toString() on the result returns the encoding as a String. For more information on Base64 encoding and chunking see <code>RFC 4648</code>. @param data Byte array to be encoded @param chunked whether or not the Base64 encoded data should be MIME chunked @return object which will write the Base64 encoding of the byte array @since 1.5.1
[ "Produce", "a", "Writable", "object", "which", "writes", "the", "Base64", "encoding", "of", "the", "byte", "array", ".", "Calling", "toString", "()", "on", "the", "result", "returns", "the", "encoding", "as", "a", "String", ".", "For", "more", "information", "on", "Base64", "encoding", "and", "chunking", "see", "<code", ">", "RFC", "4648<", "/", "code", ">", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/EncodingGroovyMethods.java#L60-L62
MenoData/Time4J
base/src/main/java/net/time4j/range/DateInterval.java
DateInterval.until
public static DateInterval until(PlainDate end) { Boundary<PlainDate> past = Boundary.infinitePast(); return new DateInterval(past, Boundary.of(CLOSED, end)); }
java
public static DateInterval until(PlainDate end) { Boundary<PlainDate> past = Boundary.infinitePast(); return new DateInterval(past, Boundary.of(CLOSED, end)); }
[ "public", "static", "DateInterval", "until", "(", "PlainDate", "end", ")", "{", "Boundary", "<", "PlainDate", ">", "past", "=", "Boundary", ".", "infinitePast", "(", ")", ";", "return", "new", "DateInterval", "(", "past", ",", "Boundary", ".", "of", "(", "CLOSED", ",", "end", ")", ")", ";", "}" ]
/*[deutsch] <p>Erzeugt ein unbegrenztes Intervall bis zum angegebenen Endedatum. </p> @param end date of upper boundary (inclusive) @return new date interval @since 2.0
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Erzeugt", "ein", "unbegrenztes", "Intervall", "bis", "zum", "angegebenen", "Endedatum", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/DateInterval.java#L284-L289
samskivert/samskivert
src/main/java/com/samskivert/servlet/util/ParameterUtil.java
ParameterUtil.requireFloatParameter
public static float requireFloatParameter ( HttpServletRequest req, String name, String invalidDataMessage) throws DataValidationException { return parseFloatParameter(getParameter(req, name, false), invalidDataMessage); }
java
public static float requireFloatParameter ( HttpServletRequest req, String name, String invalidDataMessage) throws DataValidationException { return parseFloatParameter(getParameter(req, name, false), invalidDataMessage); }
[ "public", "static", "float", "requireFloatParameter", "(", "HttpServletRequest", "req", ",", "String", "name", ",", "String", "invalidDataMessage", ")", "throws", "DataValidationException", "{", "return", "parseFloatParameter", "(", "getParameter", "(", "req", ",", "name", ",", "false", ")", ",", "invalidDataMessage", ")", ";", "}" ]
Fetches the supplied parameter from the request and converts it to a float. If the parameter does not exist or is not a well-formed float, a data validation exception is thrown with the supplied message.
[ "Fetches", "the", "supplied", "parameter", "from", "the", "request", "and", "converts", "it", "to", "a", "float", ".", "If", "the", "parameter", "does", "not", "exist", "or", "is", "not", "a", "well", "-", "formed", "float", "a", "data", "validation", "exception", "is", "thrown", "with", "the", "supplied", "message", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/ParameterUtil.java#L74-L79
scaleset/scaleset-geo
src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java
GoogleMapsTileMath.metersToTilePixelsTransform
public AffineTransform metersToTilePixelsTransform(int tx, int ty, int zoomLevel) { AffineTransform result = new AffineTransform(); double scale = 1.0 / resolution(zoomLevel); int nTiles = 2 << (zoomLevel - 1); int px = tx * -256; int py = (nTiles - ty) * -256; // flip y for upper-left origin result.scale(1, -1); result.translate(px, py); result.scale(scale, scale); result.translate(originShift, originShift); return result; }
java
public AffineTransform metersToTilePixelsTransform(int tx, int ty, int zoomLevel) { AffineTransform result = new AffineTransform(); double scale = 1.0 / resolution(zoomLevel); int nTiles = 2 << (zoomLevel - 1); int px = tx * -256; int py = (nTiles - ty) * -256; // flip y for upper-left origin result.scale(1, -1); result.translate(px, py); result.scale(scale, scale); result.translate(originShift, originShift); return result; }
[ "public", "AffineTransform", "metersToTilePixelsTransform", "(", "int", "tx", ",", "int", "ty", ",", "int", "zoomLevel", ")", "{", "AffineTransform", "result", "=", "new", "AffineTransform", "(", ")", ";", "double", "scale", "=", "1.0", "/", "resolution", "(", "zoomLevel", ")", ";", "int", "nTiles", "=", "2", "<<", "(", "zoomLevel", "-", "1", ")", ";", "int", "px", "=", "tx", "*", "-", "256", ";", "int", "py", "=", "(", "nTiles", "-", "ty", ")", "*", "-", "256", ";", "// flip y for upper-left origin", "result", ".", "scale", "(", "1", ",", "-", "1", ")", ";", "result", ".", "translate", "(", "px", ",", "py", ")", ";", "result", ".", "scale", "(", "scale", ",", "scale", ")", ";", "result", ".", "translate", "(", "originShift", ",", "originShift", ")", ";", "return", "result", ";", "}" ]
Create a transform that converts meters to tile-relative pixels @param tx The x coordinate of the tile @param ty The y coordinate of the tile @param zoomLevel the zoom level @return AffineTransform with meters to pixels transformation
[ "Create", "a", "transform", "that", "converts", "meters", "to", "tile", "-", "relative", "pixels" ]
train
https://github.com/scaleset/scaleset-geo/blob/5cff2349668037dc287928a6c1a1f67c76d96b02/src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java#L216-L228
lviggiano/owner
owner-java8-extras/src/main/java/org/aeonbits/owner/converters/DurationConverter.java
DurationConverter.parseDuration
private static Duration parseDuration(String input) { String[] parts = ConverterUtil.splitNumericAndChar(input); String numberString = parts[0]; String originalUnitString = parts[1]; String unitString = originalUnitString; if (numberString.length() == 0) { throw new IllegalArgumentException(String.format("No number in duration value '%s'", input)); } if (unitString.length() > 2 && !unitString.endsWith("s")) { unitString = unitString + "s"; } ChronoUnit units; // note that this is deliberately case-sensitive switch (unitString) { case "ns": case "nanos": case "nanoseconds": units = ChronoUnit.NANOS; break; case "us": case "µs": case "micros": case "microseconds": units = ChronoUnit.MICROS; break; case "": case "ms": case "millis": case "milliseconds": units = ChronoUnit.MILLIS; break; case "s": case "seconds": units = ChronoUnit.SECONDS; break; case "m": case "minutes": units = ChronoUnit.MINUTES; break; case "h": case "hours": units = ChronoUnit.HOURS; break; case "d": case "days": units = ChronoUnit.DAYS; break; default: throw new IllegalArgumentException( String.format("Could not parse time unit '%s' (try ns, us, ms, s, m, h, d)", originalUnitString)); } return Duration.of(Long.parseLong(numberString), units); }
java
private static Duration parseDuration(String input) { String[] parts = ConverterUtil.splitNumericAndChar(input); String numberString = parts[0]; String originalUnitString = parts[1]; String unitString = originalUnitString; if (numberString.length() == 0) { throw new IllegalArgumentException(String.format("No number in duration value '%s'", input)); } if (unitString.length() > 2 && !unitString.endsWith("s")) { unitString = unitString + "s"; } ChronoUnit units; // note that this is deliberately case-sensitive switch (unitString) { case "ns": case "nanos": case "nanoseconds": units = ChronoUnit.NANOS; break; case "us": case "µs": case "micros": case "microseconds": units = ChronoUnit.MICROS; break; case "": case "ms": case "millis": case "milliseconds": units = ChronoUnit.MILLIS; break; case "s": case "seconds": units = ChronoUnit.SECONDS; break; case "m": case "minutes": units = ChronoUnit.MINUTES; break; case "h": case "hours": units = ChronoUnit.HOURS; break; case "d": case "days": units = ChronoUnit.DAYS; break; default: throw new IllegalArgumentException( String.format("Could not parse time unit '%s' (try ns, us, ms, s, m, h, d)", originalUnitString)); } return Duration.of(Long.parseLong(numberString), units); }
[ "private", "static", "Duration", "parseDuration", "(", "String", "input", ")", "{", "String", "[", "]", "parts", "=", "ConverterUtil", ".", "splitNumericAndChar", "(", "input", ")", ";", "String", "numberString", "=", "parts", "[", "0", "]", ";", "String", "originalUnitString", "=", "parts", "[", "1", "]", ";", "String", "unitString", "=", "originalUnitString", ";", "if", "(", "numberString", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"No number in duration value '%s'\"", ",", "input", ")", ")", ";", "}", "if", "(", "unitString", ".", "length", "(", ")", ">", "2", "&&", "!", "unitString", ".", "endsWith", "(", "\"s\"", ")", ")", "{", "unitString", "=", "unitString", "+", "\"s\"", ";", "}", "ChronoUnit", "units", ";", "// note that this is deliberately case-sensitive", "switch", "(", "unitString", ")", "{", "case", "\"ns\"", ":", "case", "\"nanos\"", ":", "case", "\"nanoseconds\"", ":", "units", "=", "ChronoUnit", ".", "NANOS", ";", "break", ";", "case", "\"us\"", ":", "case", "\"µs\":", "", "case", "\"micros\"", ":", "case", "\"microseconds\"", ":", "units", "=", "ChronoUnit", ".", "MICROS", ";", "break", ";", "case", "\"\"", ":", "case", "\"ms\"", ":", "case", "\"millis\"", ":", "case", "\"milliseconds\"", ":", "units", "=", "ChronoUnit", ".", "MILLIS", ";", "break", ";", "case", "\"s\"", ":", "case", "\"seconds\"", ":", "units", "=", "ChronoUnit", ".", "SECONDS", ";", "break", ";", "case", "\"m\"", ":", "case", "\"minutes\"", ":", "units", "=", "ChronoUnit", ".", "MINUTES", ";", "break", ";", "case", "\"h\"", ":", "case", "\"hours\"", ":", "units", "=", "ChronoUnit", ".", "HOURS", ";", "break", ";", "case", "\"d\"", ":", "case", "\"days\"", ":", "units", "=", "ChronoUnit", ".", "DAYS", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Could not parse time unit '%s' (try ns, us, ms, s, m, h, d)\"", ",", "originalUnitString", ")", ")", ";", "}", "return", "Duration", ".", "of", "(", "Long", ".", "parseLong", "(", "numberString", ")", ",", "units", ")", ";", "}" ]
Parses a duration string. If no units are specified in the string, it is assumed to be in milliseconds. This implementation was blatantly stolen/adapted from the typesafe-config project: https://github.com/typesafehub/config/blob/v1.3.0/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java#L551-L624 @param input the string to parse @return duration @throws IllegalArgumentException if input is invalid
[ "Parses", "a", "duration", "string", ".", "If", "no", "units", "are", "specified", "in", "the", "string", "it", "is", "assumed", "to", "be", "in", "milliseconds", "." ]
train
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner-java8-extras/src/main/java/org/aeonbits/owner/converters/DurationConverter.java#L74-L130
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/handlers/WindowsFilenameTabCompleter.java
WindowsFilenameTabCompleter.completeCandidates
@Override void completeCandidates(CommandContext ctx, String buffer, int cursor, List<String> candidates) { if (candidates.isEmpty()) { if (buffer.startsWith("\"") && buffer.length() >= 2) { // Quotes are added back by super class. buffer = buffer.substring(1); } if (buffer.length() == 2 && buffer.endsWith(":")) { candidates.add(buffer + File.separator); } } }
java
@Override void completeCandidates(CommandContext ctx, String buffer, int cursor, List<String> candidates) { if (candidates.isEmpty()) { if (buffer.startsWith("\"") && buffer.length() >= 2) { // Quotes are added back by super class. buffer = buffer.substring(1); } if (buffer.length() == 2 && buffer.endsWith(":")) { candidates.add(buffer + File.separator); } } }
[ "@", "Override", "void", "completeCandidates", "(", "CommandContext", "ctx", ",", "String", "buffer", ",", "int", "cursor", ",", "List", "<", "String", ">", "candidates", ")", "{", "if", "(", "candidates", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "buffer", ".", "startsWith", "(", "\"\\\"\"", ")", "&&", "buffer", ".", "length", "(", ")", ">=", "2", ")", "{", "// Quotes are added back by super class.", "buffer", "=", "buffer", ".", "substring", "(", "1", ")", ";", "}", "if", "(", "buffer", ".", "length", "(", ")", "==", "2", "&&", "buffer", ".", "endsWith", "(", "\":\"", ")", ")", "{", "candidates", ".", "add", "(", "buffer", "+", "File", ".", "separator", ")", ";", "}", "}", "}" ]
The only supported syntax at command execution is fully quoted, e.g.: "c:\Program Files\..." or not quoted at all. Completion supports only these 2 syntaxes.
[ "The", "only", "supported", "syntax", "at", "command", "execution", "is", "fully", "quoted", "e", ".", "g", ".", ":", "c", ":", "\\", "Program", "Files", "\\", "...", "or", "not", "quoted", "at", "all", ".", "Completion", "supports", "only", "these", "2", "syntaxes", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/WindowsFilenameTabCompleter.java#L44-L55
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/AntRunAction.java
AntRunAction.loadBuildPropertyFile
private void loadBuildPropertyFile(Project project, TestContext context) { if (StringUtils.hasText(propertyFilePath)) { String propertyFileResource = context.replaceDynamicContentInString(propertyFilePath); log.info("Reading build property file: " + propertyFileResource); Properties fileProperties; try { fileProperties = PropertiesLoaderUtils.loadProperties(new PathMatchingResourcePatternResolver().getResource(propertyFileResource)); for (Entry<Object, Object> entry : fileProperties.entrySet()) { String propertyValue = entry.getValue() != null ? context.replaceDynamicContentInString(entry.getValue().toString()) : ""; if (log.isDebugEnabled()) { log.debug("Set build property from file resource: " + entry.getKey() + "=" + propertyValue); } project.setProperty(entry.getKey().toString(), propertyValue); } } catch (IOException e) { throw new CitrusRuntimeException("Failed to read build property file", e); } } }
java
private void loadBuildPropertyFile(Project project, TestContext context) { if (StringUtils.hasText(propertyFilePath)) { String propertyFileResource = context.replaceDynamicContentInString(propertyFilePath); log.info("Reading build property file: " + propertyFileResource); Properties fileProperties; try { fileProperties = PropertiesLoaderUtils.loadProperties(new PathMatchingResourcePatternResolver().getResource(propertyFileResource)); for (Entry<Object, Object> entry : fileProperties.entrySet()) { String propertyValue = entry.getValue() != null ? context.replaceDynamicContentInString(entry.getValue().toString()) : ""; if (log.isDebugEnabled()) { log.debug("Set build property from file resource: " + entry.getKey() + "=" + propertyValue); } project.setProperty(entry.getKey().toString(), propertyValue); } } catch (IOException e) { throw new CitrusRuntimeException("Failed to read build property file", e); } } }
[ "private", "void", "loadBuildPropertyFile", "(", "Project", "project", ",", "TestContext", "context", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "propertyFilePath", ")", ")", "{", "String", "propertyFileResource", "=", "context", ".", "replaceDynamicContentInString", "(", "propertyFilePath", ")", ";", "log", ".", "info", "(", "\"Reading build property file: \"", "+", "propertyFileResource", ")", ";", "Properties", "fileProperties", ";", "try", "{", "fileProperties", "=", "PropertiesLoaderUtils", ".", "loadProperties", "(", "new", "PathMatchingResourcePatternResolver", "(", ")", ".", "getResource", "(", "propertyFileResource", ")", ")", ";", "for", "(", "Entry", "<", "Object", ",", "Object", ">", "entry", ":", "fileProperties", ".", "entrySet", "(", ")", ")", "{", "String", "propertyValue", "=", "entry", ".", "getValue", "(", ")", "!=", "null", "?", "context", ".", "replaceDynamicContentInString", "(", "entry", ".", "getValue", "(", ")", ".", "toString", "(", ")", ")", ":", "\"\"", ";", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Set build property from file resource: \"", "+", "entry", ".", "getKey", "(", ")", "+", "\"=\"", "+", "propertyValue", ")", ";", "}", "project", ".", "setProperty", "(", "entry", ".", "getKey", "(", ")", ".", "toString", "(", ")", ",", "propertyValue", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Failed to read build property file\"", ",", "e", ")", ";", "}", "}", "}" ]
Loads build properties from file resource and adds them to ANT project. @param project @param context
[ "Loads", "build", "properties", "from", "file", "resource", "and", "adds", "them", "to", "ANT", "project", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/AntRunAction.java#L149-L169
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/plan/AbstractServerGroupRolloutTask.java
AbstractServerGroupRolloutTask.recordPreparedOperation
protected void recordPreparedOperation(final ServerIdentity identity, final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> prepared) { final ModelNode preparedResult = prepared.getPreparedResult(); // Hmm do the server results need to get translated as well as the host one? // final ModelNode transformedResult = prepared.getOperation().transformResult(preparedResult); updatePolicy.recordServerResult(identity, preparedResult); executor.recordPreparedOperation(prepared); }
java
protected void recordPreparedOperation(final ServerIdentity identity, final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> prepared) { final ModelNode preparedResult = prepared.getPreparedResult(); // Hmm do the server results need to get translated as well as the host one? // final ModelNode transformedResult = prepared.getOperation().transformResult(preparedResult); updatePolicy.recordServerResult(identity, preparedResult); executor.recordPreparedOperation(prepared); }
[ "protected", "void", "recordPreparedOperation", "(", "final", "ServerIdentity", "identity", ",", "final", "TransactionalProtocolClient", ".", "PreparedOperation", "<", "ServerTaskExecutor", ".", "ServerOperation", ">", "prepared", ")", "{", "final", "ModelNode", "preparedResult", "=", "prepared", ".", "getPreparedResult", "(", ")", ";", "// Hmm do the server results need to get translated as well as the host one?", "// final ModelNode transformedResult = prepared.getOperation().transformResult(preparedResult);", "updatePolicy", ".", "recordServerResult", "(", "identity", ",", "preparedResult", ")", ";", "executor", ".", "recordPreparedOperation", "(", "prepared", ")", ";", "}" ]
Record a prepared operation. @param identity the server identity @param prepared the prepared operation
[ "Record", "a", "prepared", "operation", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/AbstractServerGroupRolloutTask.java#L97-L103
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/Timing.java
Timing.report
public long report(String str, PrintStream stream) { long elapsed = this.report(); stream.println(str + " Time elapsed: " + (elapsed) + " ms"); return elapsed; }
java
public long report(String str, PrintStream stream) { long elapsed = this.report(); stream.println(str + " Time elapsed: " + (elapsed) + " ms"); return elapsed; }
[ "public", "long", "report", "(", "String", "str", ",", "PrintStream", "stream", ")", "{", "long", "elapsed", "=", "this", ".", "report", "(", ")", ";", "stream", ".", "println", "(", "str", "+", "\" Time elapsed: \"", "+", "(", "elapsed", ")", "+", "\" ms\"", ")", ";", "return", "elapsed", ";", "}" ]
Print elapsed time (without stopping timer). @param str Additional prefix string to be printed @param stream PrintStream on which to write output @return Number of milliseconds elapsed
[ "Print", "elapsed", "time", "(", "without", "stopping", "timer", ")", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Timing.java#L66-L70
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/OverrideHelper.java
OverrideHelper.getResolvedFeatures
public ResolvedFeatures getResolvedFeatures(JvmTypeReference contextType) { ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, contextType.eResource().getResourceSet()); return getResolvedFeatures(owner.toLightweightTypeReference(contextType)); }
java
public ResolvedFeatures getResolvedFeatures(JvmTypeReference contextType) { ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, contextType.eResource().getResourceSet()); return getResolvedFeatures(owner.toLightweightTypeReference(contextType)); }
[ "public", "ResolvedFeatures", "getResolvedFeatures", "(", "JvmTypeReference", "contextType", ")", "{", "ITypeReferenceOwner", "owner", "=", "new", "StandardTypeReferenceOwner", "(", "services", ",", "contextType", ".", "eResource", "(", ")", ".", "getResourceSet", "(", ")", ")", ";", "return", "getResolvedFeatures", "(", "owner", ".", "toLightweightTypeReference", "(", "contextType", ")", ")", ";", "}" ]
Returns the resolved features that are defined in the given <code>context type</code> and its supertypes. Considers private methods of super types, too. @param contextType the context type. Has to be contained in a resource. @return the resolved features.
[ "Returns", "the", "resolved", "features", "that", "are", "defined", "in", "the", "given", "<code", ">", "context", "type<", "/", "code", ">", "and", "its", "supertypes", ".", "Considers", "private", "methods", "of", "super", "types", "too", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/OverrideHelper.java#L211-L214
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/servlet/RendererRequestUtils.java
RendererRequestUtils.setRequestDebuggable
public static void setRequestDebuggable(HttpServletRequest req, JawrConfig jawrConfig) { // make sure we have set an overrideKey // make sure the overrideKey exists in the request // lastly, make sure the keys match if (jawrConfig.getDebugOverrideKey().length() > 0 && null != req.getParameter(JawrConstant.OVERRIDE_KEY_PARAMETER_NAME) && jawrConfig .getDebugOverrideKey().equals(req.getParameter(JawrConstant.OVERRIDE_KEY_PARAMETER_NAME))) { ThreadLocalJawrContext.setDebugOverriden(true); } else { ThreadLocalJawrContext.setDebugOverriden(false); } // Inherit the debuggable property of the session if the session is a // debuggable one inheritSessionDebugProperty(req); }
java
public static void setRequestDebuggable(HttpServletRequest req, JawrConfig jawrConfig) { // make sure we have set an overrideKey // make sure the overrideKey exists in the request // lastly, make sure the keys match if (jawrConfig.getDebugOverrideKey().length() > 0 && null != req.getParameter(JawrConstant.OVERRIDE_KEY_PARAMETER_NAME) && jawrConfig .getDebugOverrideKey().equals(req.getParameter(JawrConstant.OVERRIDE_KEY_PARAMETER_NAME))) { ThreadLocalJawrContext.setDebugOverriden(true); } else { ThreadLocalJawrContext.setDebugOverriden(false); } // Inherit the debuggable property of the session if the session is a // debuggable one inheritSessionDebugProperty(req); }
[ "public", "static", "void", "setRequestDebuggable", "(", "HttpServletRequest", "req", ",", "JawrConfig", "jawrConfig", ")", "{", "// make sure we have set an overrideKey", "// make sure the overrideKey exists in the request", "// lastly, make sure the keys match", "if", "(", "jawrConfig", ".", "getDebugOverrideKey", "(", ")", ".", "length", "(", ")", ">", "0", "&&", "null", "!=", "req", ".", "getParameter", "(", "JawrConstant", ".", "OVERRIDE_KEY_PARAMETER_NAME", ")", "&&", "jawrConfig", ".", "getDebugOverrideKey", "(", ")", ".", "equals", "(", "req", ".", "getParameter", "(", "JawrConstant", ".", "OVERRIDE_KEY_PARAMETER_NAME", ")", ")", ")", "{", "ThreadLocalJawrContext", ".", "setDebugOverriden", "(", "true", ")", ";", "}", "else", "{", "ThreadLocalJawrContext", ".", "setDebugOverriden", "(", "false", ")", ";", "}", "// Inherit the debuggable property of the session if the session is a", "// debuggable one", "inheritSessionDebugProperty", "(", "req", ")", ";", "}" ]
Determines whether to override the debug settings. Sets the debugOverride status on ThreadLocalJawrContext @param req the request @param jawrConfig the jawr config
[ "Determines", "whether", "to", "override", "the", "debug", "settings", ".", "Sets", "the", "debugOverride", "status", "on", "ThreadLocalJawrContext" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/servlet/RendererRequestUtils.java#L257-L274
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/FinanceUtils.java
FinanceUtils.toGrowthRateFromAnnualReturn
public static double toGrowthRateFromAnnualReturn(double annualReturn, CalendarDateUnit growthRateUnit) { double tmpAnnualGrowthRate = PrimitiveMath.LOG1P.invoke(annualReturn); double tmpYearsPerGrowthRateUnit = CalendarDateUnit.YEAR.convert(growthRateUnit); return tmpAnnualGrowthRate * tmpYearsPerGrowthRateUnit; }
java
public static double toGrowthRateFromAnnualReturn(double annualReturn, CalendarDateUnit growthRateUnit) { double tmpAnnualGrowthRate = PrimitiveMath.LOG1P.invoke(annualReturn); double tmpYearsPerGrowthRateUnit = CalendarDateUnit.YEAR.convert(growthRateUnit); return tmpAnnualGrowthRate * tmpYearsPerGrowthRateUnit; }
[ "public", "static", "double", "toGrowthRateFromAnnualReturn", "(", "double", "annualReturn", ",", "CalendarDateUnit", "growthRateUnit", ")", "{", "double", "tmpAnnualGrowthRate", "=", "PrimitiveMath", ".", "LOG1P", ".", "invoke", "(", "annualReturn", ")", ";", "double", "tmpYearsPerGrowthRateUnit", "=", "CalendarDateUnit", ".", "YEAR", ".", "convert", "(", "growthRateUnit", ")", ";", "return", "tmpAnnualGrowthRate", "*", "tmpYearsPerGrowthRateUnit", ";", "}" ]
GrowthRate = ln(1.0 + InterestRate) / GrowthRateUnitsPerYear @param annualReturn Annualised return (percentage per year) @param growthRateUnit A growth rate unit @return A growth rate per unit (day, week, month, year...)
[ "GrowthRate", "=", "ln", "(", "1", ".", "0", "+", "InterestRate", ")", "/", "GrowthRateUnitsPerYear" ]
train
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/FinanceUtils.java#L457-L461
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/QuickSelect.java
QuickSelect.select
public static double select(final double[] arr, int lo, int hi, final int pivot) { while (hi > lo) { final int j = partition(arr, lo, hi); if (j == pivot) { return arr[pivot]; } if (j > pivot) { hi = j - 1; } else { lo = j + 1; } } return arr[pivot]; }
java
public static double select(final double[] arr, int lo, int hi, final int pivot) { while (hi > lo) { final int j = partition(arr, lo, hi); if (j == pivot) { return arr[pivot]; } if (j > pivot) { hi = j - 1; } else { lo = j + 1; } } return arr[pivot]; }
[ "public", "static", "double", "select", "(", "final", "double", "[", "]", "arr", ",", "int", "lo", ",", "int", "hi", ",", "final", "int", "pivot", ")", "{", "while", "(", "hi", ">", "lo", ")", "{", "final", "int", "j", "=", "partition", "(", "arr", ",", "lo", ",", "hi", ")", ";", "if", "(", "j", "==", "pivot", ")", "{", "return", "arr", "[", "pivot", "]", ";", "}", "if", "(", "j", ">", "pivot", ")", "{", "hi", "=", "j", "-", "1", ";", "}", "else", "{", "lo", "=", "j", "+", "1", ";", "}", "}", "return", "arr", "[", "pivot", "]", ";", "}" ]
Gets the 0-based kth order statistic from the array. Warning! This changes the ordering of elements in the given array! @param arr The array to be re-arranged. @param lo The lowest 0-based index to be considered. @param hi The highest 0-based index to be considered. @param pivot The 0-based smallest value to pivot on. @return The value of the smallest (n)th element where n is 0-based.
[ "Gets", "the", "0", "-", "based", "kth", "order", "statistic", "from", "the", "array", ".", "Warning!", "This", "changes", "the", "ordering", "of", "elements", "in", "the", "given", "array!" ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuickSelect.java#L136-L150
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/StructureDiagramGenerator.java
StructureDiagramGenerator.getOtherBondAtom
public IAtom getOtherBondAtom(IAtom atom, IBond bond) { if (!bond.contains(atom)) return null; if (bond.getBegin().equals(atom)) return bond.getEnd(); else return bond.getBegin(); }
java
public IAtom getOtherBondAtom(IAtom atom, IBond bond) { if (!bond.contains(atom)) return null; if (bond.getBegin().equals(atom)) return bond.getEnd(); else return bond.getBegin(); }
[ "public", "IAtom", "getOtherBondAtom", "(", "IAtom", "atom", ",", "IBond", "bond", ")", "{", "if", "(", "!", "bond", ".", "contains", "(", "atom", ")", ")", "return", "null", ";", "if", "(", "bond", ".", "getBegin", "(", ")", ".", "equals", "(", "atom", ")", ")", "return", "bond", ".", "getEnd", "(", ")", ";", "else", "return", "bond", ".", "getBegin", "(", ")", ";", "}" ]
Returns the other atom of the bond. Expects bond to have only two atoms. Returns null if the given atom is not part of the given bond. @param atom the atom we already have @param bond the bond @return the other atom of the bond
[ "Returns", "the", "other", "atom", "of", "the", "bond", ".", "Expects", "bond", "to", "have", "only", "two", "atoms", ".", "Returns", "null", "if", "the", "given", "atom", "is", "not", "part", "of", "the", "given", "bond", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/StructureDiagramGenerator.java#L2176-L2182
alkacon/opencms-core
src/org/opencms/db/oracle/CmsUserDriver.java
CmsUserDriver.getOutputStreamFromBlob
public static OutputStream getOutputStreamFromBlob(ResultSet res, String name) throws SQLException { Blob blob = res.getBlob(name); blob.truncate(0); return blob.setBinaryStream(0L); }
java
public static OutputStream getOutputStreamFromBlob(ResultSet res, String name) throws SQLException { Blob blob = res.getBlob(name); blob.truncate(0); return blob.setBinaryStream(0L); }
[ "public", "static", "OutputStream", "getOutputStreamFromBlob", "(", "ResultSet", "res", ",", "String", "name", ")", "throws", "SQLException", "{", "Blob", "blob", "=", "res", ".", "getBlob", "(", "name", ")", ";", "blob", ".", "truncate", "(", "0", ")", ";", "return", "blob", ".", "setBinaryStream", "(", "0L", ")", ";", "}" ]
Generates an Output stream that writes to a blob, also truncating the existing blob if required.<p> Apparently Oracle requires some non-standard handling here.<p> @param res the result set where the blob is located in @param name the name of the database column where the blob is located @return an Output stream from a blob @throws SQLException if something goes wring
[ "Generates", "an", "Output", "stream", "that", "writes", "to", "a", "blob", "also", "truncating", "the", "existing", "blob", "if", "required", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/oracle/CmsUserDriver.java#L71-L76
belaban/JGroups
src/org/jgroups/View.java
View.sameMembers
public static boolean sameMembers(View v1, View v2) { if(v1 == v2) return true; if(v1.size() != v2.size()) return false; Address[][] diff=diff(v1, v2); return diff[0].length == 0 && diff[1].length == 0; }
java
public static boolean sameMembers(View v1, View v2) { if(v1 == v2) return true; if(v1.size() != v2.size()) return false; Address[][] diff=diff(v1, v2); return diff[0].length == 0 && diff[1].length == 0; }
[ "public", "static", "boolean", "sameMembers", "(", "View", "v1", ",", "View", "v2", ")", "{", "if", "(", "v1", "==", "v2", ")", "return", "true", ";", "if", "(", "v1", ".", "size", "(", ")", "!=", "v2", ".", "size", "(", ")", ")", "return", "false", ";", "Address", "[", "]", "[", "]", "diff", "=", "diff", "(", "v1", ",", "v2", ")", ";", "return", "diff", "[", "0", "]", ".", "length", "==", "0", "&&", "diff", "[", "1", "]", ".", "length", "==", "0", ";", "}" ]
Checks if two views have the same members regardless of order. E.g. {A,B,C} and {B,A,C} returns true
[ "Checks", "if", "two", "views", "have", "the", "same", "members", "regardless", "of", "order", ".", "E", ".", "g", ".", "{", "A", "B", "C", "}", "and", "{", "B", "A", "C", "}", "returns", "true" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/View.java#L300-L307
JM-Lab/utils-java8
src/main/java/kr/jm/utils/JMProgressiveManager.java
JMProgressiveManager.registerPercentChangeListener
public JMProgressiveManager<T, R> registerPercentChangeListener( Consumer<Number> percentChangeListener) { return registerListener(progressivePercent, percentChangeListener); }
java
public JMProgressiveManager<T, R> registerPercentChangeListener( Consumer<Number> percentChangeListener) { return registerListener(progressivePercent, percentChangeListener); }
[ "public", "JMProgressiveManager", "<", "T", ",", "R", ">", "registerPercentChangeListener", "(", "Consumer", "<", "Number", ">", "percentChangeListener", ")", "{", "return", "registerListener", "(", "progressivePercent", ",", "percentChangeListener", ")", ";", "}" ]
Register percent change listener jm progressive manager. @param percentChangeListener the percent change listener @return the jm progressive manager
[ "Register", "percent", "change", "listener", "jm", "progressive", "manager", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/JMProgressiveManager.java#L276-L279
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipCall.java
SipCall.initiateOutgoingMessage
public boolean initiateOutgoingMessage(String toUri, String viaNonProxyRoute) { return initiateOutgoingMessage(null, toUri, viaNonProxyRoute, null, null, null); }
java
public boolean initiateOutgoingMessage(String toUri, String viaNonProxyRoute) { return initiateOutgoingMessage(null, toUri, viaNonProxyRoute, null, null, null); }
[ "public", "boolean", "initiateOutgoingMessage", "(", "String", "toUri", ",", "String", "viaNonProxyRoute", ")", "{", "return", "initiateOutgoingMessage", "(", "null", ",", "toUri", ",", "viaNonProxyRoute", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
This basic method is used to initiate an outgoing MESSAGE. <p> This method returns when the request message has been sent out. Your calling program must subsequently call the waitOutgoingMessageResponse() method (one or more times) to get the result(s). <p> If a DIALOG exists the method will use it to send the MESSAGE @param toUri The URI (sip:bob@nist.gov) to which the message should be directed @param viaNonProxyRoute Indicates whether to route the MESSAGE via Proxy or some other route. If null, route the call to the Proxy that was specified when the SipPhone object was created (SipStack.createSipPhone()). Else route it to the given node, which is specified as "hostaddress:port;parms/transport" i.e. 129.1.22.333:5060;lr/UDP. @return true if the message was successfully sent, false otherwise.
[ "This", "basic", "method", "is", "used", "to", "initiate", "an", "outgoing", "MESSAGE", "." ]
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipCall.java#L746-L748
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.handleNoopRequest
private static BinaryMemcacheRequest handleNoopRequest(final ChannelHandlerContext ctx, final NoopRequest msg) { BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(); request.setOpcode(OP_NOOP); return request; }
java
private static BinaryMemcacheRequest handleNoopRequest(final ChannelHandlerContext ctx, final NoopRequest msg) { BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(); request.setOpcode(OP_NOOP); return request; }
[ "private", "static", "BinaryMemcacheRequest", "handleNoopRequest", "(", "final", "ChannelHandlerContext", "ctx", ",", "final", "NoopRequest", "msg", ")", "{", "BinaryMemcacheRequest", "request", "=", "new", "DefaultBinaryMemcacheRequest", "(", ")", ";", "request", ".", "setOpcode", "(", "OP_NOOP", ")", ";", "return", "request", ";", "}" ]
Encodes a {@link NoopRequest} into its lower level representation. @param ctx the {@link ChannelHandlerContext} to use for allocation and others. @param msg the incoming message. @return a ready {@link BinaryMemcacheRequest}.
[ "Encodes", "a", "{", "@link", "NoopRequest", "}", "into", "its", "lower", "level", "representation", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L471-L475
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java
PoolsImpl.stopResizeAsync
public Observable<Void> stopResizeAsync(String poolId) { return stopResizeWithServiceResponseAsync(poolId).map(new Func1<ServiceResponseWithHeaders<Void, PoolStopResizeHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, PoolStopResizeHeaders> response) { return response.body(); } }); }
java
public Observable<Void> stopResizeAsync(String poolId) { return stopResizeWithServiceResponseAsync(poolId).map(new Func1<ServiceResponseWithHeaders<Void, PoolStopResizeHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, PoolStopResizeHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "stopResizeAsync", "(", "String", "poolId", ")", "{", "return", "stopResizeWithServiceResponseAsync", "(", "poolId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Void", ",", "PoolStopResizeHeaders", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponseWithHeaders", "<", "Void", ",", "PoolStopResizeHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Stops an ongoing resize operation on the pool. This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API can also be used to halt the initial sizing of the pool when it is created. @param poolId The ID of the pool whose resizing you want to stop. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Stops", "an", "ongoing", "resize", "operation", "on", "the", "pool", ".", "This", "does", "not", "restore", "the", "pool", "to", "its", "previous", "state", "before", "the", "resize", "operation", ":", "it", "only", "stops", "any", "further", "changes", "being", "made", "and", "the", "pool", "maintains", "its", "current", "state", ".", "After", "stopping", "the", "pool", "stabilizes", "at", "the", "number", "of", "nodes", "it", "was", "at", "when", "the", "stop", "operation", "was", "done", ".", "During", "the", "stop", "operation", "the", "pool", "allocation", "state", "changes", "first", "to", "stopping", "and", "then", "to", "steady", ".", "A", "resize", "operation", "need", "not", "be", "an", "explicit", "resize", "pool", "request", ";", "this", "API", "can", "also", "be", "used", "to", "halt", "the", "initial", "sizing", "of", "the", "pool", "when", "it", "is", "created", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L2990-L2997
icode/ameba
src/main/java/ameba/container/server/Connector.java
Connector.createDefault
public static Connector createDefault(Map<String, String> properties) { Connector.Builder builder = Connector.Builder.create() .rawProperties(properties) .secureEnabled(Boolean.parseBoolean(properties.get("ssl.enabled"))) .sslProtocol(properties.get("ssl.protocol")) .sslClientMode(Boolean.parseBoolean(properties.get("ssl.clientMode"))) .sslNeedClientAuth(Boolean.parseBoolean(properties.get("ssl.needClientAuth"))) .sslWantClientAuth(Boolean.parseBoolean(properties.get("ssl.wantClientAuth"))) .sslKeyManagerFactoryAlgorithm(properties.get("ssl.key.manager.factory.algorithm")) .sslKeyPassword(properties.get("ssl.key.password")) .sslKeyStoreProvider(properties.get("ssl.key.store.provider")) .sslKeyStoreType(properties.get("ssl.key.store.type")) .sslKeyStorePassword(properties.get("ssl.key.store.password")) .sslTrustManagerFactoryAlgorithm(properties.get("ssl.trust.manager.factory.algorithm")) .sslTrustPassword(properties.get("ssl.trust.password")) .sslTrustStoreProvider(properties.get("ssl.trust.store.provider")) .sslTrustStoreType(properties.get("ssl.trust.store.type")) .sslTrustStorePassword(properties.get("ssl.trust.store.password")) .ajpEnabled(Boolean.parseBoolean(properties.get("ajp.enabled"))) .host(StringUtils.defaultIfBlank(properties.get("host"), "0.0.0.0")) .port(Integer.valueOf(StringUtils.defaultIfBlank(properties.get("port"), "80"))) .name(properties.get("name")); String keyStoreFile = properties.get("ssl.key.store.file"); if (StringUtils.isNotBlank(keyStoreFile)) try { builder.sslKeyStoreFile(readByteArrayFromResource(keyStoreFile)); } catch (IOException e) { logger.error("读取sslKeyStoreFile出错", e); } String trustStoreFile = properties.get("ssl.trust.store.file"); if (StringUtils.isNotBlank(trustStoreFile)) try { builder.sslTrustStoreFile(readByteArrayFromResource(trustStoreFile)); } catch (IOException e) { logger.error("读取sslTrustStoreFile出错", e); } return builder.build(); }
java
public static Connector createDefault(Map<String, String> properties) { Connector.Builder builder = Connector.Builder.create() .rawProperties(properties) .secureEnabled(Boolean.parseBoolean(properties.get("ssl.enabled"))) .sslProtocol(properties.get("ssl.protocol")) .sslClientMode(Boolean.parseBoolean(properties.get("ssl.clientMode"))) .sslNeedClientAuth(Boolean.parseBoolean(properties.get("ssl.needClientAuth"))) .sslWantClientAuth(Boolean.parseBoolean(properties.get("ssl.wantClientAuth"))) .sslKeyManagerFactoryAlgorithm(properties.get("ssl.key.manager.factory.algorithm")) .sslKeyPassword(properties.get("ssl.key.password")) .sslKeyStoreProvider(properties.get("ssl.key.store.provider")) .sslKeyStoreType(properties.get("ssl.key.store.type")) .sslKeyStorePassword(properties.get("ssl.key.store.password")) .sslTrustManagerFactoryAlgorithm(properties.get("ssl.trust.manager.factory.algorithm")) .sslTrustPassword(properties.get("ssl.trust.password")) .sslTrustStoreProvider(properties.get("ssl.trust.store.provider")) .sslTrustStoreType(properties.get("ssl.trust.store.type")) .sslTrustStorePassword(properties.get("ssl.trust.store.password")) .ajpEnabled(Boolean.parseBoolean(properties.get("ajp.enabled"))) .host(StringUtils.defaultIfBlank(properties.get("host"), "0.0.0.0")) .port(Integer.valueOf(StringUtils.defaultIfBlank(properties.get("port"), "80"))) .name(properties.get("name")); String keyStoreFile = properties.get("ssl.key.store.file"); if (StringUtils.isNotBlank(keyStoreFile)) try { builder.sslKeyStoreFile(readByteArrayFromResource(keyStoreFile)); } catch (IOException e) { logger.error("读取sslKeyStoreFile出错", e); } String trustStoreFile = properties.get("ssl.trust.store.file"); if (StringUtils.isNotBlank(trustStoreFile)) try { builder.sslTrustStoreFile(readByteArrayFromResource(trustStoreFile)); } catch (IOException e) { logger.error("读取sslTrustStoreFile出错", e); } return builder.build(); }
[ "public", "static", "Connector", "createDefault", "(", "Map", "<", "String", ",", "String", ">", "properties", ")", "{", "Connector", ".", "Builder", "builder", "=", "Connector", ".", "Builder", ".", "create", "(", ")", ".", "rawProperties", "(", "properties", ")", ".", "secureEnabled", "(", "Boolean", ".", "parseBoolean", "(", "properties", ".", "get", "(", "\"ssl.enabled\"", ")", ")", ")", ".", "sslProtocol", "(", "properties", ".", "get", "(", "\"ssl.protocol\"", ")", ")", ".", "sslClientMode", "(", "Boolean", ".", "parseBoolean", "(", "properties", ".", "get", "(", "\"ssl.clientMode\"", ")", ")", ")", ".", "sslNeedClientAuth", "(", "Boolean", ".", "parseBoolean", "(", "properties", ".", "get", "(", "\"ssl.needClientAuth\"", ")", ")", ")", ".", "sslWantClientAuth", "(", "Boolean", ".", "parseBoolean", "(", "properties", ".", "get", "(", "\"ssl.wantClientAuth\"", ")", ")", ")", ".", "sslKeyManagerFactoryAlgorithm", "(", "properties", ".", "get", "(", "\"ssl.key.manager.factory.algorithm\"", ")", ")", ".", "sslKeyPassword", "(", "properties", ".", "get", "(", "\"ssl.key.password\"", ")", ")", ".", "sslKeyStoreProvider", "(", "properties", ".", "get", "(", "\"ssl.key.store.provider\"", ")", ")", ".", "sslKeyStoreType", "(", "properties", ".", "get", "(", "\"ssl.key.store.type\"", ")", ")", ".", "sslKeyStorePassword", "(", "properties", ".", "get", "(", "\"ssl.key.store.password\"", ")", ")", ".", "sslTrustManagerFactoryAlgorithm", "(", "properties", ".", "get", "(", "\"ssl.trust.manager.factory.algorithm\"", ")", ")", ".", "sslTrustPassword", "(", "properties", ".", "get", "(", "\"ssl.trust.password\"", ")", ")", ".", "sslTrustStoreProvider", "(", "properties", ".", "get", "(", "\"ssl.trust.store.provider\"", ")", ")", ".", "sslTrustStoreType", "(", "properties", ".", "get", "(", "\"ssl.trust.store.type\"", ")", ")", ".", "sslTrustStorePassword", "(", "properties", ".", "get", "(", "\"ssl.trust.store.password\"", ")", ")", ".", "ajpEnabled", "(", "Boolean", ".", "parseBoolean", "(", "properties", ".", "get", "(", "\"ajp.enabled\"", ")", ")", ")", ".", "host", "(", "StringUtils", ".", "defaultIfBlank", "(", "properties", ".", "get", "(", "\"host\"", ")", ",", "\"0.0.0.0\"", ")", ")", ".", "port", "(", "Integer", ".", "valueOf", "(", "StringUtils", ".", "defaultIfBlank", "(", "properties", ".", "get", "(", "\"port\"", ")", ",", "\"80\"", ")", ")", ")", ".", "name", "(", "properties", ".", "get", "(", "\"name\"", ")", ")", ";", "String", "keyStoreFile", "=", "properties", ".", "get", "(", "\"ssl.key.store.file\"", ")", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "keyStoreFile", ")", ")", "try", "{", "builder", ".", "sslKeyStoreFile", "(", "readByteArrayFromResource", "(", "keyStoreFile", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "error", "(", "\"读取sslKeyStoreFile出错\", e);", "", "", "", "", "}", "String", "trustStoreFile", "=", "properties", ".", "get", "(", "\"ssl.trust.store.file\"", ")", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "trustStoreFile", ")", ")", "try", "{", "builder", ".", "sslTrustStoreFile", "(", "readByteArrayFromResource", "(", "trustStoreFile", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "error", "(", "\"读取sslTrustStoreFile出错\", e);", "", "", "", "", "}", "return", "builder", ".", "build", "(", ")", ";", "}" ]
<p>createDefault.</p> @param properties a {@link java.util.Map} object. @return a {@link ameba.container.server.Connector} object.
[ "<p", ">", "createDefault", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/container/server/Connector.java#L73-L113
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataTiffImage.java
CoverageDataTiffImage.getPixel
public float getPixel(int x, int y) { float pixel = -1; if (rasters == null) { readPixels(); } if (rasters != null) { pixel = rasters.getFirstPixelSample(x, y).floatValue(); } else { throw new GeoPackageException("Could not retrieve pixel value"); } return pixel; }
java
public float getPixel(int x, int y) { float pixel = -1; if (rasters == null) { readPixels(); } if (rasters != null) { pixel = rasters.getFirstPixelSample(x, y).floatValue(); } else { throw new GeoPackageException("Could not retrieve pixel value"); } return pixel; }
[ "public", "float", "getPixel", "(", "int", "x", ",", "int", "y", ")", "{", "float", "pixel", "=", "-", "1", ";", "if", "(", "rasters", "==", "null", ")", "{", "readPixels", "(", ")", ";", "}", "if", "(", "rasters", "!=", "null", ")", "{", "pixel", "=", "rasters", ".", "getFirstPixelSample", "(", "x", ",", "y", ")", ".", "floatValue", "(", ")", ";", "}", "else", "{", "throw", "new", "GeoPackageException", "(", "\"Could not retrieve pixel value\"", ")", ";", "}", "return", "pixel", ";", "}" ]
Get the pixel at the coordinate @param x x coordinate @param y y coordinate @return pixel value
[ "Get", "the", "pixel", "at", "the", "coordinate" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataTiffImage.java#L147-L158
icode/ameba
src/main/java/ameba/mvc/template/internal/ResolvingViewableContext.java
ResolvingViewableContext.resolveAbsoluteViewable
@SuppressWarnings("unchecked") private ResolvedViewable resolveAbsoluteViewable(final Viewable viewable, Class<?> resourceClass, final MediaType mediaType, final TemplateProcessor templateProcessor) { final Object resolvedTemplateObject = templateProcessor.resolve(viewable.getTemplateName(), mediaType); if (resolvedTemplateObject != null) { return new ResolvedViewable(templateProcessor, resolvedTemplateObject, viewable, resourceClass, mediaType); } return null; }
java
@SuppressWarnings("unchecked") private ResolvedViewable resolveAbsoluteViewable(final Viewable viewable, Class<?> resourceClass, final MediaType mediaType, final TemplateProcessor templateProcessor) { final Object resolvedTemplateObject = templateProcessor.resolve(viewable.getTemplateName(), mediaType); if (resolvedTemplateObject != null) { return new ResolvedViewable(templateProcessor, resolvedTemplateObject, viewable, resourceClass, mediaType); } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "ResolvedViewable", "resolveAbsoluteViewable", "(", "final", "Viewable", "viewable", ",", "Class", "<", "?", ">", "resourceClass", ",", "final", "MediaType", "mediaType", ",", "final", "TemplateProcessor", "templateProcessor", ")", "{", "final", "Object", "resolvedTemplateObject", "=", "templateProcessor", ".", "resolve", "(", "viewable", ".", "getTemplateName", "(", ")", ",", "mediaType", ")", ";", "if", "(", "resolvedTemplateObject", "!=", "null", ")", "{", "return", "new", "ResolvedViewable", "(", "templateProcessor", ",", "resolvedTemplateObject", ",", "viewable", ",", "resourceClass", ",", "mediaType", ")", ";", "}", "return", "null", ";", "}" ]
Resolve given {@link Viewable viewable} with absolute template name using {@link MediaType media type} and {@link TemplateProcessor template processor}. @param viewable viewable to be resolved. @param mediaType media type of te output. @param resourceClass resource class. @param templateProcessor template processor to be used. @return resolved viewable or {@code null} if the viewable cannot be resolved.
[ "Resolve", "given", "{", "@link", "Viewable", "viewable", "}", "with", "absolute", "template", "name", "using", "{", "@link", "MediaType", "media", "type", "}", "and", "{", "@link", "TemplateProcessor", "template", "processor", "}", "." ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/mvc/template/internal/ResolvingViewableContext.java#L62-L73
mgormley/pacaya
src/main/java/edu/jhu/pacaya/autodiff/Toposort.java
Toposort.checkAreDescendentsOf
public static <T> void checkAreDescendentsOf(Set<T> inputSet, T root, Deps<T> deps) { // Check that all modules in the input set are descendents of the output module. HashSet<T> visited = new HashSet<T>(); dfs(root, visited, deps); if (!visited.containsAll(inputSet)) { throw new IllegalStateException("Input set contains modules which are not descendents of the output module: " + inputSet); } }
java
public static <T> void checkAreDescendentsOf(Set<T> inputSet, T root, Deps<T> deps) { // Check that all modules in the input set are descendents of the output module. HashSet<T> visited = new HashSet<T>(); dfs(root, visited, deps); if (!visited.containsAll(inputSet)) { throw new IllegalStateException("Input set contains modules which are not descendents of the output module: " + inputSet); } }
[ "public", "static", "<", "T", ">", "void", "checkAreDescendentsOf", "(", "Set", "<", "T", ">", "inputSet", ",", "T", "root", ",", "Deps", "<", "T", ">", "deps", ")", "{", "// Check that all modules in the input set are descendents of the output module.", "HashSet", "<", "T", ">", "visited", "=", "new", "HashSet", "<", "T", ">", "(", ")", ";", "dfs", "(", "root", ",", "visited", ",", "deps", ")", ";", "if", "(", "!", "visited", ".", "containsAll", "(", "inputSet", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Input set contains modules which are not descendents of the output module: \"", "+", "inputSet", ")", ";", "}", "}" ]
Checks that the given inputSet consists of only descendents of the root.
[ "Checks", "that", "the", "given", "inputSet", "consists", "of", "only", "descendents", "of", "the", "root", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/autodiff/Toposort.java#L115-L122
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/util/ByteConverter.java
ByteConverter.int8
public static void int8(byte[] target, int idx, long value) { target[idx + 0] = (byte) (value >>> 56); target[idx + 1] = (byte) (value >>> 48); target[idx + 2] = (byte) (value >>> 40); target[idx + 3] = (byte) (value >>> 32); target[idx + 4] = (byte) (value >>> 24); target[idx + 5] = (byte) (value >>> 16); target[idx + 6] = (byte) (value >>> 8); target[idx + 7] = (byte) value; }
java
public static void int8(byte[] target, int idx, long value) { target[idx + 0] = (byte) (value >>> 56); target[idx + 1] = (byte) (value >>> 48); target[idx + 2] = (byte) (value >>> 40); target[idx + 3] = (byte) (value >>> 32); target[idx + 4] = (byte) (value >>> 24); target[idx + 5] = (byte) (value >>> 16); target[idx + 6] = (byte) (value >>> 8); target[idx + 7] = (byte) value; }
[ "public", "static", "void", "int8", "(", "byte", "[", "]", "target", ",", "int", "idx", ",", "long", "value", ")", "{", "target", "[", "idx", "+", "0", "]", "=", "(", "byte", ")", "(", "value", ">>>", "56", ")", ";", "target", "[", "idx", "+", "1", "]", "=", "(", "byte", ")", "(", "value", ">>>", "48", ")", ";", "target", "[", "idx", "+", "2", "]", "=", "(", "byte", ")", "(", "value", ">>>", "40", ")", ";", "target", "[", "idx", "+", "3", "]", "=", "(", "byte", ")", "(", "value", ">>>", "32", ")", ";", "target", "[", "idx", "+", "4", "]", "=", "(", "byte", ")", "(", "value", ">>>", "24", ")", ";", "target", "[", "idx", "+", "5", "]", "=", "(", "byte", ")", "(", "value", ">>>", "16", ")", ";", "target", "[", "idx", "+", "6", "]", "=", "(", "byte", ")", "(", "value", ">>>", "8", ")", ";", "target", "[", "idx", "+", "7", "]", "=", "(", "byte", ")", "value", ";", "}" ]
Encodes a long value to the byte array. @param target The byte array to encode to. @param idx The starting index in the byte array. @param value The value to encode.
[ "Encodes", "a", "long", "value", "to", "the", "byte", "array", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/ByteConverter.java#L106-L115
networknt/light-4j
resource/src/main/java/com/networknt/resource/ResourceHelpers.java
ResourceHelpers.addProvidersToPathHandler
public static void addProvidersToPathHandler(PathResourceProvider[] pathResourceProviders, PathHandler pathHandler) { if (pathResourceProviders != null && pathResourceProviders.length > 0) { for (PathResourceProvider pathResourceProvider : pathResourceProviders) { if (pathResourceProvider.isPrefixPath()) { pathHandler.addPrefixPath(pathResourceProvider.getPath(), new ResourceHandler(pathResourceProvider.getResourceManager())); } else { pathHandler.addExactPath(pathResourceProvider.getPath(), new ResourceHandler(pathResourceProvider.getResourceManager())); } } } }
java
public static void addProvidersToPathHandler(PathResourceProvider[] pathResourceProviders, PathHandler pathHandler) { if (pathResourceProviders != null && pathResourceProviders.length > 0) { for (PathResourceProvider pathResourceProvider : pathResourceProviders) { if (pathResourceProvider.isPrefixPath()) { pathHandler.addPrefixPath(pathResourceProvider.getPath(), new ResourceHandler(pathResourceProvider.getResourceManager())); } else { pathHandler.addExactPath(pathResourceProvider.getPath(), new ResourceHandler(pathResourceProvider.getResourceManager())); } } } }
[ "public", "static", "void", "addProvidersToPathHandler", "(", "PathResourceProvider", "[", "]", "pathResourceProviders", ",", "PathHandler", "pathHandler", ")", "{", "if", "(", "pathResourceProviders", "!=", "null", "&&", "pathResourceProviders", ".", "length", ">", "0", ")", "{", "for", "(", "PathResourceProvider", "pathResourceProvider", ":", "pathResourceProviders", ")", "{", "if", "(", "pathResourceProvider", ".", "isPrefixPath", "(", ")", ")", "{", "pathHandler", ".", "addPrefixPath", "(", "pathResourceProvider", ".", "getPath", "(", ")", ",", "new", "ResourceHandler", "(", "pathResourceProvider", ".", "getResourceManager", "(", ")", ")", ")", ";", "}", "else", "{", "pathHandler", ".", "addExactPath", "(", "pathResourceProvider", ".", "getPath", "(", ")", ",", "new", "ResourceHandler", "(", "pathResourceProvider", ".", "getResourceManager", "(", ")", ")", ")", ";", "}", "}", "}", "}" ]
Helper to add given PathResourceProviders to a PathHandler. @param pathResourceProviders List of instances of classes implementing PathResourceProvider. @param pathHandler The handler that will have these handlers added to it.
[ "Helper", "to", "add", "given", "PathResourceProviders", "to", "a", "PathHandler", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/resource/src/main/java/com/networknt/resource/ResourceHelpers.java#L38-L48
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/MultiVertexGeometryImpl.java
MultiVertexGeometryImpl.setAttributeStreamRef
public void setAttributeStreamRef(int semantics, AttributeStreamBase stream) { // int test1 = VertexDescription.getPersistence(semantics); // int test2 = stream.getPersistence(); if ((stream != null) && VertexDescription.getPersistence(semantics) != stream .getPersistence())// input stream has wrong persistence throw new IllegalArgumentException(); // Do not check for the stream size here to allow several streams to be // attached before the point count is changed. addAttribute(semantics); int attributeIndex = m_description.getAttributeIndex(semantics); if (m_vertexAttributes == null) m_vertexAttributes = new AttributeStreamBase[m_description .getAttributeCount()]; m_vertexAttributes[attributeIndex] = stream; notifyModified(DirtyFlags.DirtyAll); }
java
public void setAttributeStreamRef(int semantics, AttributeStreamBase stream) { // int test1 = VertexDescription.getPersistence(semantics); // int test2 = stream.getPersistence(); if ((stream != null) && VertexDescription.getPersistence(semantics) != stream .getPersistence())// input stream has wrong persistence throw new IllegalArgumentException(); // Do not check for the stream size here to allow several streams to be // attached before the point count is changed. addAttribute(semantics); int attributeIndex = m_description.getAttributeIndex(semantics); if (m_vertexAttributes == null) m_vertexAttributes = new AttributeStreamBase[m_description .getAttributeCount()]; m_vertexAttributes[attributeIndex] = stream; notifyModified(DirtyFlags.DirtyAll); }
[ "public", "void", "setAttributeStreamRef", "(", "int", "semantics", ",", "AttributeStreamBase", "stream", ")", "{", "// int test1 = VertexDescription.getPersistence(semantics);", "// int test2 = stream.getPersistence();", "if", "(", "(", "stream", "!=", "null", ")", "&&", "VertexDescription", ".", "getPersistence", "(", "semantics", ")", "!=", "stream", ".", "getPersistence", "(", ")", ")", "// input stream has wrong persistence", "throw", "new", "IllegalArgumentException", "(", ")", ";", "// Do not check for the stream size here to allow several streams to be", "// attached before the point count is changed.", "addAttribute", "(", "semantics", ")", ";", "int", "attributeIndex", "=", "m_description", ".", "getAttributeIndex", "(", "semantics", ")", ";", "if", "(", "m_vertexAttributes", "==", "null", ")", "m_vertexAttributes", "=", "new", "AttributeStreamBase", "[", "m_description", ".", "getAttributeCount", "(", ")", "]", ";", "m_vertexAttributes", "[", "attributeIndex", "]", "=", "stream", ";", "notifyModified", "(", "DirtyFlags", ".", "DirtyAll", ")", ";", "}" ]
Sets a reference to the given AttributeStream of the Geometry. Once the buffer has been obtained, the vertices of the Geometry can be manipulated directly. The AttributeStream parameters are not checked for the size. <br> If the attribute is missing, it will be added. <br> Note, that this method does not change the vertex count in the Geometry. <br> The stream can have more elements, than the Geometry point count, but only necessary part will be saved when exporting to a ESRI shape or other format. @param semantics Semantics of the attribute to assign the stream to. @param stream The input AttributeStream that will be assigned by reference. If one changes the stream later through the reference, one has to call NotifyStreamChanged. \exception Throws invalid_argument exception if the input stream type does not match that of the semantics persistence.
[ "Sets", "a", "reference", "to", "the", "given", "AttributeStream", "of", "the", "Geometry", ".", "Once", "the", "buffer", "has", "been", "obtained", "the", "vertices", "of", "the", "Geometry", "can", "be", "manipulated", "directly", ".", "The", "AttributeStream", "parameters", "are", "not", "checked", "for", "the", "size", ".", "<br", ">", "If", "the", "attribute", "is", "missing", "it", "will", "be", "added", ".", "<br", ">", "Note", "that", "this", "method", "does", "not", "change", "the", "vertex", "count", "in", "the", "Geometry", ".", "<br", ">", "The", "stream", "can", "have", "more", "elements", "than", "the", "Geometry", "point", "count", "but", "only", "necessary", "part", "will", "be", "saved", "when", "exporting", "to", "a", "ESRI", "shape", "or", "other", "format", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/MultiVertexGeometryImpl.java#L404-L423
CenturyLinkCloud/mdw
mdw-hub/src/com/centurylink/mdw/hub/servlet/SoapServlet.java
SoapServlet.createSoapFaultResponse
protected String createSoapFaultResponse(String code, String message) throws SOAPException, TransformerException { return createSoapFaultResponse(SOAPConstants.SOAP_1_1_PROTOCOL, code, message); }
java
protected String createSoapFaultResponse(String code, String message) throws SOAPException, TransformerException { return createSoapFaultResponse(SOAPConstants.SOAP_1_1_PROTOCOL, code, message); }
[ "protected", "String", "createSoapFaultResponse", "(", "String", "code", ",", "String", "message", ")", "throws", "SOAPException", ",", "TransformerException", "{", "return", "createSoapFaultResponse", "(", "SOAPConstants", ".", "SOAP_1_1_PROTOCOL", ",", "code", ",", "message", ")", ";", "}" ]
Original API (Defaults to using MessageFactory.newInstance(), i.e. SOAP 1.1) @param code @param message @return Soap fault as string @throws SOAPException @throws TransformerException
[ "Original", "API", "(", "Defaults", "to", "using", "MessageFactory", ".", "newInstance", "()", "i", ".", "e", ".", "SOAP", "1", ".", "1", ")" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-hub/src/com/centurylink/mdw/hub/servlet/SoapServlet.java#L391-L394
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java
MarkdownParser.setOutlineDepthRange
public void setOutlineDepthRange(IntegerRange level) { if (level == null) { this.outlineDepthRange = new IntegerRange(DEFAULT_OUTLINE_TOP_LEVEL, DEFAULT_OUTLINE_TOP_LEVEL); } else { this.outlineDepthRange = level; } }
java
public void setOutlineDepthRange(IntegerRange level) { if (level == null) { this.outlineDepthRange = new IntegerRange(DEFAULT_OUTLINE_TOP_LEVEL, DEFAULT_OUTLINE_TOP_LEVEL); } else { this.outlineDepthRange = level; } }
[ "public", "void", "setOutlineDepthRange", "(", "IntegerRange", "level", ")", "{", "if", "(", "level", "==", "null", ")", "{", "this", ".", "outlineDepthRange", "=", "new", "IntegerRange", "(", "DEFAULT_OUTLINE_TOP_LEVEL", ",", "DEFAULT_OUTLINE_TOP_LEVEL", ")", ";", "}", "else", "{", "this", ".", "outlineDepthRange", "=", "level", ";", "}", "}" ]
Change the level at which the titles may appear in the outline. @param level the level, at least 1.
[ "Change", "the", "level", "at", "which", "the", "titles", "may", "appear", "in", "the", "outline", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L420-L426
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java
ConfigurationAbstractImpl.getClass
public Class getClass(String key, Class defaultValue, Class assignable) { return getClass(key, defaultValue, new Class[]{assignable}); }
java
public Class getClass(String key, Class defaultValue, Class assignable) { return getClass(key, defaultValue, new Class[]{assignable}); }
[ "public", "Class", "getClass", "(", "String", "key", ",", "Class", "defaultValue", ",", "Class", "assignable", ")", "{", "return", "getClass", "(", "key", ",", "defaultValue", ",", "new", "Class", "[", "]", "{", "assignable", "}", ")", ";", "}" ]
Returns the class specified by the value for the specified key. If no value for this key is found in the configuration, no class of this name can be found or the specified class is not assignable <code>assignable defaultValue</code> is returned. @param key the key @param defaultValue the default Value @param assignable a classe and/or interface the specified class must extend/implement. @return the value for the key, or <code>defaultValue</code>
[ "Returns", "the", "class", "specified", "by", "the", "value", "for", "the", "specified", "key", ".", "If", "no", "value", "for", "this", "key", "is", "found", "in", "the", "configuration", "no", "class", "of", "this", "name", "can", "be", "found", "or", "the", "specified", "class", "is", "not", "assignable", "<code", ">", "assignable", "defaultValue<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java#L386-L389
jblas-project/jblas
src/main/java/org/jblas/util/SanityChecks.java
SanityChecks.checkVectorAddition
public static void checkVectorAddition() { DoubleMatrix x = new DoubleMatrix(3, 1, 1.0, 2.0, 3.0); DoubleMatrix y = new DoubleMatrix(3, 1, 4.0, 5.0, 6.0); DoubleMatrix z = new DoubleMatrix(3, 1, 5.0, 7.0, 9.0); check("checking vector addition", x.add(y).equals(z)); }
java
public static void checkVectorAddition() { DoubleMatrix x = new DoubleMatrix(3, 1, 1.0, 2.0, 3.0); DoubleMatrix y = new DoubleMatrix(3, 1, 4.0, 5.0, 6.0); DoubleMatrix z = new DoubleMatrix(3, 1, 5.0, 7.0, 9.0); check("checking vector addition", x.add(y).equals(z)); }
[ "public", "static", "void", "checkVectorAddition", "(", ")", "{", "DoubleMatrix", "x", "=", "new", "DoubleMatrix", "(", "3", ",", "1", ",", "1.0", ",", "2.0", ",", "3.0", ")", ";", "DoubleMatrix", "y", "=", "new", "DoubleMatrix", "(", "3", ",", "1", ",", "4.0", ",", "5.0", ",", "6.0", ")", ";", "DoubleMatrix", "z", "=", "new", "DoubleMatrix", "(", "3", ",", "1", ",", "5.0", ",", "7.0", ",", "9.0", ")", ";", "check", "(", "\"checking vector addition\"", ",", "x", ".", "add", "(", "y", ")", ".", "equals", "(", "z", ")", ")", ";", "}" ]
Check whether vector addition works. This is pure Java code and should work.
[ "Check", "whether", "vector", "addition", "works", ".", "This", "is", "pure", "Java", "code", "and", "should", "work", "." ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/SanityChecks.java#L64-L70
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java
WidgetsUtils.replaceOrAppend
private static void replaceOrAppend(Element oldElement, Element newElement) { assert oldElement != null && newElement != null; if (matchesTags(oldElement, appendingTags)) { GQuery.$(oldElement).html("").append(newElement); } else { GQuery.$(oldElement).replaceWith(newElement); // copy class String c = oldElement.getClassName(); if (!c.isEmpty()) { newElement.addClassName(c); } // copy id newElement.setId(oldElement.getId()); // ensure no duplicate id oldElement.setId(""); } }
java
private static void replaceOrAppend(Element oldElement, Element newElement) { assert oldElement != null && newElement != null; if (matchesTags(oldElement, appendingTags)) { GQuery.$(oldElement).html("").append(newElement); } else { GQuery.$(oldElement).replaceWith(newElement); // copy class String c = oldElement.getClassName(); if (!c.isEmpty()) { newElement.addClassName(c); } // copy id newElement.setId(oldElement.getId()); // ensure no duplicate id oldElement.setId(""); } }
[ "private", "static", "void", "replaceOrAppend", "(", "Element", "oldElement", ",", "Element", "newElement", ")", "{", "assert", "oldElement", "!=", "null", "&&", "newElement", "!=", "null", ";", "if", "(", "matchesTags", "(", "oldElement", ",", "appendingTags", ")", ")", "{", "GQuery", ".", "$", "(", "oldElement", ")", ".", "html", "(", "\"\"", ")", ".", "append", "(", "newElement", ")", ";", "}", "else", "{", "GQuery", ".", "$", "(", "oldElement", ")", ".", "replaceWith", "(", "newElement", ")", ";", "// copy class", "String", "c", "=", "oldElement", ".", "getClassName", "(", ")", ";", "if", "(", "!", "c", ".", "isEmpty", "(", ")", ")", "{", "newElement", ".", "addClassName", "(", "c", ")", ";", "}", "// copy id", "newElement", ".", "setId", "(", "oldElement", ".", "getId", "(", ")", ")", ";", "// ensure no duplicate id", "oldElement", ".", "setId", "(", "\"\"", ")", ";", "}", "}" ]
If the <code>oldElement</code> is a td, th, li tags, the new element will replaced its content. In other cases, the <code>oldElement</code> will be replaced by the <code>newElement</code> and the old element classes will be copied to the new element.
[ "If", "the", "<code", ">", "oldElement<", "/", "code", ">", "is", "a", "td", "th", "li", "tags", "the", "new", "element", "will", "replaced", "its", "content", ".", "In", "other", "cases", "the", "<code", ">", "oldElement<", "/", "code", ">", "will", "be", "replaced", "by", "the", "<code", ">", "newElement<", "/", "code", ">", "and", "the", "old", "element", "classes", "will", "be", "copied", "to", "the", "new", "element", "." ]
train
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java#L128-L146
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/walk/AssignabilityTypesVisitor.java
AssignabilityTypesVisitor.checkLowerBounds
private boolean checkLowerBounds(final Type one, final Type two) { final boolean res; // ? super Object is impossible here due to types cleanup in tree walker if (notLowerBounded(one)) { // walker will check compatibility, and compatible type is always assignable to lower bounded wildcard // e.g. Number assignable to ? super Number, but Integer not assignable to ? super Number res = true; } else if (notLowerBounded(two)) { // lower bound could not be assigned to anything else (only opposite way is possible) // for example, List<? super String> is not assignable to List<String>, but // List<String> is assignable to List<? super String> (previous condition) res = false; } else { // left type's bound must be lower: not a mistake! left (super inversion)! res = TypeUtils.isMoreSpecific( ((WildcardType) two).getLowerBounds()[0], ((WildcardType) one).getLowerBounds()[0]); } return res; }
java
private boolean checkLowerBounds(final Type one, final Type two) { final boolean res; // ? super Object is impossible here due to types cleanup in tree walker if (notLowerBounded(one)) { // walker will check compatibility, and compatible type is always assignable to lower bounded wildcard // e.g. Number assignable to ? super Number, but Integer not assignable to ? super Number res = true; } else if (notLowerBounded(two)) { // lower bound could not be assigned to anything else (only opposite way is possible) // for example, List<? super String> is not assignable to List<String>, but // List<String> is assignable to List<? super String> (previous condition) res = false; } else { // left type's bound must be lower: not a mistake! left (super inversion)! res = TypeUtils.isMoreSpecific( ((WildcardType) two).getLowerBounds()[0], ((WildcardType) one).getLowerBounds()[0]); } return res; }
[ "private", "boolean", "checkLowerBounds", "(", "final", "Type", "one", ",", "final", "Type", "two", ")", "{", "final", "boolean", "res", ";", "// ? super Object is impossible here due to types cleanup in tree walker", "if", "(", "notLowerBounded", "(", "one", ")", ")", "{", "// walker will check compatibility, and compatible type is always assignable to lower bounded wildcard", "// e.g. Number assignable to ? super Number, but Integer not assignable to ? super Number", "res", "=", "true", ";", "}", "else", "if", "(", "notLowerBounded", "(", "two", ")", ")", "{", "// lower bound could not be assigned to anything else (only opposite way is possible)", "// for example, List<? super String> is not assignable to List<String>, but", "// List<String> is assignable to List<? super String> (previous condition)", "res", "=", "false", ";", "}", "else", "{", "// left type's bound must be lower: not a mistake! left (super inversion)!", "res", "=", "TypeUtils", ".", "isMoreSpecific", "(", "(", "(", "WildcardType", ")", "two", ")", ".", "getLowerBounds", "(", ")", "[", "0", "]", ",", "(", "(", "WildcardType", ")", "one", ")", ".", "getLowerBounds", "(", ")", "[", "0", "]", ")", ";", "}", "return", "res", ";", "}" ]
Check lower bounded wildcard cases. Method is not called if upper bounds are not assignable. <p> When left is not lower bound - compatibility will be checked by type walker and when compatible always assignable. For example, String compatible (and assignable) with ? super String and Integer is not compatible with ? super Number (and not assignable). <p> Wen right is not lower bound, when left is then it will be never assignable. For example, ? super String is not assignable to String. <p> When both lower wildcards: lower bounds must be from one hierarchy and left type should be lower. For example, ? super Integer and ? super BigInteger are not assignable in spite of the fact that they share some common types. ? super Number is more specific then ? super Integer (super inverse meaning). @param one first type @param two second type @return true when left is assignable to right, false otherwise
[ "Check", "lower", "bounded", "wildcard", "cases", ".", "Method", "is", "not", "called", "if", "upper", "bounds", "are", "not", "assignable", ".", "<p", ">", "When", "left", "is", "not", "lower", "bound", "-", "compatibility", "will", "be", "checked", "by", "type", "walker", "and", "when", "compatible", "always", "assignable", ".", "For", "example", "String", "compatible", "(", "and", "assignable", ")", "with", "?", "super", "String", "and", "Integer", "is", "not", "compatible", "with", "?", "super", "Number", "(", "and", "not", "assignable", ")", ".", "<p", ">", "Wen", "right", "is", "not", "lower", "bound", "when", "left", "is", "then", "it", "will", "be", "never", "assignable", ".", "For", "example", "?", "super", "String", "is", "not", "assignable", "to", "String", ".", "<p", ">", "When", "both", "lower", "wildcards", ":", "lower", "bounds", "must", "be", "from", "one", "hierarchy", "and", "left", "type", "should", "be", "lower", ".", "For", "example", "?", "super", "Integer", "and", "?", "super", "BigInteger", "are", "not", "assignable", "in", "spite", "of", "the", "fact", "that", "they", "share", "some", "common", "types", ".", "?", "super", "Number", "is", "more", "specific", "then", "?", "super", "Integer", "(", "super", "inverse", "meaning", ")", "." ]
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/walk/AssignabilityTypesVisitor.java#L75-L94
baratine/baratine
web/src/main/java/com/caucho/v5/http/dispatch/InvocationManager.java
InvocationManager.buildInvocation
public I buildInvocation(Object protocolKey, I invocation) throws ConfigException { Objects.requireNonNull(invocation); invocation = buildInvocation(invocation); // XXX: see if can remove this, and rely on the invocation cache existing LruCache<Object,I> invocationCache = _invocationCache; if (invocationCache != null) { I oldInvocation; oldInvocation = invocationCache.get(protocolKey); // server/10r2 if (oldInvocation != null && ! oldInvocation.isModified()) { return oldInvocation; } if (invocation.getURLLength() < _maxURLLength) { invocationCache.put(protocolKey, invocation); } } return invocation; }
java
public I buildInvocation(Object protocolKey, I invocation) throws ConfigException { Objects.requireNonNull(invocation); invocation = buildInvocation(invocation); // XXX: see if can remove this, and rely on the invocation cache existing LruCache<Object,I> invocationCache = _invocationCache; if (invocationCache != null) { I oldInvocation; oldInvocation = invocationCache.get(protocolKey); // server/10r2 if (oldInvocation != null && ! oldInvocation.isModified()) { return oldInvocation; } if (invocation.getURLLength() < _maxURLLength) { invocationCache.put(protocolKey, invocation); } } return invocation; }
[ "public", "I", "buildInvocation", "(", "Object", "protocolKey", ",", "I", "invocation", ")", "throws", "ConfigException", "{", "Objects", ".", "requireNonNull", "(", "invocation", ")", ";", "invocation", "=", "buildInvocation", "(", "invocation", ")", ";", "// XXX: see if can remove this, and rely on the invocation cache existing", "LruCache", "<", "Object", ",", "I", ">", "invocationCache", "=", "_invocationCache", ";", "if", "(", "invocationCache", "!=", "null", ")", "{", "I", "oldInvocation", ";", "oldInvocation", "=", "invocationCache", ".", "get", "(", "protocolKey", ")", ";", "// server/10r2", "if", "(", "oldInvocation", "!=", "null", "&&", "!", "oldInvocation", ".", "isModified", "(", ")", ")", "{", "return", "oldInvocation", ";", "}", "if", "(", "invocation", ".", "getURLLength", "(", ")", "<", "_maxURLLength", ")", "{", "invocationCache", ".", "put", "(", "protocolKey", ",", "invocation", ")", ";", "}", "}", "return", "invocation", ";", "}" ]
Builds the invocation, saving its value keyed by the protocol key. @param protocolKey protocol-specific key to save the invocation in @param invocation the invocation to build.
[ "Builds", "the", "invocation", "saving", "its", "value", "keyed", "by", "the", "protocol", "key", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/dispatch/InvocationManager.java#L157-L182
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/Utils.java
Utils.dumpClass
public static void dumpClass(String file, byte[] bytes) { File f = new File(file); try { FileOutputStream fos = new FileOutputStream(f); fos.write(bytes); fos.flush(); fos.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
java
public static void dumpClass(String file, byte[] bytes) { File f = new File(file); try { FileOutputStream fos = new FileOutputStream(f); fos.write(bytes); fos.flush(); fos.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
[ "public", "static", "void", "dumpClass", "(", "String", "file", ",", "byte", "[", "]", "bytes", ")", "{", "File", "f", "=", "new", "File", "(", "file", ")", ";", "try", "{", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "f", ")", ";", "fos", ".", "write", "(", "bytes", ")", ";", "fos", ".", "flush", "(", ")", ";", "fos", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "ioe", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Dump some bytes into the specified file. @param file full filename for where to dump the stuff (e.g. c:/temp/Foo.class) @param bytes the bytes to write to the file
[ "Dump", "some", "bytes", "into", "the", "specified", "file", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/Utils.java#L1200-L1211
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/client/SSLTransportParameters.java
SSLTransportParameters.setTrustStore
public void setTrustStore(String trustStore, String trustPass) { setTrustStore(trustStore, trustPass, null, null); }
java
public void setTrustStore(String trustStore, String trustPass) { setTrustStore(trustStore, trustPass, null, null); }
[ "public", "void", "setTrustStore", "(", "String", "trustStore", ",", "String", "trustPass", ")", "{", "setTrustStore", "(", "trustStore", ",", "trustPass", ",", "null", ",", "null", ")", ";", "}" ]
Set the truststore and password @param trustStore Location of the Truststore on disk @param trustPass Truststore password
[ "Set", "the", "truststore", "and", "password" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/SSLTransportParameters.java#L254-L256
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsStorage.java
EsStorage.updateEntity
private void updateEntity(String type, String id, XContentBuilder source) throws StorageException { try { String doc = source.string(); /* JestResult response = */esClient.execute(new Index.Builder(doc) .setParameter(Parameters.OP_TYPE, "index").index(getIndexName()).type(type).id(id).build()); //$NON-NLS-1$ } catch (Exception e) { throw new StorageException(e); } }
java
private void updateEntity(String type, String id, XContentBuilder source) throws StorageException { try { String doc = source.string(); /* JestResult response = */esClient.execute(new Index.Builder(doc) .setParameter(Parameters.OP_TYPE, "index").index(getIndexName()).type(type).id(id).build()); //$NON-NLS-1$ } catch (Exception e) { throw new StorageException(e); } }
[ "private", "void", "updateEntity", "(", "String", "type", ",", "String", "id", ",", "XContentBuilder", "source", ")", "throws", "StorageException", "{", "try", "{", "String", "doc", "=", "source", ".", "string", "(", ")", ";", "/* JestResult response = */", "esClient", ".", "execute", "(", "new", "Index", ".", "Builder", "(", "doc", ")", ".", "setParameter", "(", "Parameters", ".", "OP_TYPE", ",", "\"index\"", ")", ".", "index", "(", "getIndexName", "(", ")", ")", ".", "type", "(", "type", ")", ".", "id", "(", "id", ")", ".", "build", "(", ")", ")", ";", "//$NON-NLS-1$", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "StorageException", "(", "e", ")", ";", "}", "}" ]
Updates a single entity. @param type @param id @param source @throws StorageException
[ "Updates", "a", "single", "entity", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsStorage.java#L2081-L2089
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getImploded
@Nonnull public static String getImploded (@Nonnull final String sSep, @Nullable final Iterable <?> aElements) { return getImplodedMapped (sSep, aElements, String::valueOf); }
java
@Nonnull public static String getImploded (@Nonnull final String sSep, @Nullable final Iterable <?> aElements) { return getImplodedMapped (sSep, aElements, String::valueOf); }
[ "@", "Nonnull", "public", "static", "String", "getImploded", "(", "@", "Nonnull", "final", "String", "sSep", ",", "@", "Nullable", "final", "Iterable", "<", "?", ">", "aElements", ")", "{", "return", "getImplodedMapped", "(", "sSep", ",", "aElements", ",", "String", "::", "valueOf", ")", ";", "}" ]
Get a concatenated String from all elements of the passed container, separated by the specified separator string. Even <code>null</code> elements are added. @param sSep The separator to use. May not be <code>null</code>. @param aElements The container to convert. May be <code>null</code> or empty. @return The concatenated string.
[ "Get", "a", "concatenated", "String", "from", "all", "elements", "of", "the", "passed", "container", "separated", "by", "the", "specified", "separator", "string", ".", "Even", "<code", ">", "null<", "/", "code", ">", "elements", "are", "added", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L929-L933
lagom/lagom
service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/RequestHeader.java
RequestHeader.withUri
public RequestHeader withUri(URI uri) { return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, principal, headers, lowercaseHeaders); }
java
public RequestHeader withUri(URI uri) { return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, principal, headers, lowercaseHeaders); }
[ "public", "RequestHeader", "withUri", "(", "URI", "uri", ")", "{", "return", "new", "RequestHeader", "(", "method", ",", "uri", ",", "protocol", ",", "acceptedResponseProtocols", ",", "principal", ",", "headers", ",", "lowercaseHeaders", ")", ";", "}" ]
Return a copy of this request header with the given uri set. @param uri The uri to set. @return A copy of this request header.
[ "Return", "a", "copy", "of", "this", "request", "header", "with", "the", "given", "uri", "set", "." ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/RequestHeader.java#L102-L104
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/compiler/Compiler.java
Compiler.compileSource0
private Class<?> compileSource0(String className, String sourceCode) throws Exception { List<MemorySourceJavaFileObject> compUnits = new ArrayList<MemorySourceJavaFileObject>(1); compUnits.add(new MemorySourceJavaFileObject(className + ".java", sourceCode)); DiagnosticCollector<JavaFileObject> diag = new DiagnosticCollector<JavaFileObject>(); Boolean result = compiler.getTask(null, fileManager, diag, compilerOptions, null, compUnits).call(); if (result.equals(Boolean.FALSE)) { throw new RuntimeException(diag.getDiagnostics().toString()); } try { String classDotName = className.replace('/', '.'); return Class.forName(classDotName, true, loader); } catch (ClassNotFoundException e) { throw e; } }
java
private Class<?> compileSource0(String className, String sourceCode) throws Exception { List<MemorySourceJavaFileObject> compUnits = new ArrayList<MemorySourceJavaFileObject>(1); compUnits.add(new MemorySourceJavaFileObject(className + ".java", sourceCode)); DiagnosticCollector<JavaFileObject> diag = new DiagnosticCollector<JavaFileObject>(); Boolean result = compiler.getTask(null, fileManager, diag, compilerOptions, null, compUnits).call(); if (result.equals(Boolean.FALSE)) { throw new RuntimeException(diag.getDiagnostics().toString()); } try { String classDotName = className.replace('/', '.'); return Class.forName(classDotName, true, loader); } catch (ClassNotFoundException e) { throw e; } }
[ "private", "Class", "<", "?", ">", "compileSource0", "(", "String", "className", ",", "String", "sourceCode", ")", "throws", "Exception", "{", "List", "<", "MemorySourceJavaFileObject", ">", "compUnits", "=", "new", "ArrayList", "<", "MemorySourceJavaFileObject", ">", "(", "1", ")", ";", "compUnits", ".", "add", "(", "new", "MemorySourceJavaFileObject", "(", "className", "+", "\".java\"", ",", "sourceCode", ")", ")", ";", "DiagnosticCollector", "<", "JavaFileObject", ">", "diag", "=", "new", "DiagnosticCollector", "<", "JavaFileObject", ">", "(", ")", ";", "Boolean", "result", "=", "compiler", ".", "getTask", "(", "null", ",", "fileManager", ",", "diag", ",", "compilerOptions", ",", "null", ",", "compUnits", ")", ".", "call", "(", ")", ";", "if", "(", "result", ".", "equals", "(", "Boolean", ".", "FALSE", ")", ")", "{", "throw", "new", "RuntimeException", "(", "diag", ".", "getDiagnostics", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "try", "{", "String", "classDotName", "=", "className", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ";", "return", "Class", ".", "forName", "(", "classDotName", ",", "true", ",", "loader", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "e", ";", "}", "}" ]
Compiles multiple sources file and loads the classes. @param sourceFiles the source files to compile. @param parentLoader the parent class loader to use when loading classes. @return a map of compiled classes. This maps class names to Class objects. @throws Exception
[ "Compiles", "multiple", "sources", "file", "and", "loads", "the", "classes", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/compiler/Compiler.java#L100-L115
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.parseDateStrictly
@GwtIncompatible("incompatible method") public static Date parseDateStrictly(final String str, final String... parsePatterns) throws ParseException { return parseDateStrictly(str, null, parsePatterns); }
java
@GwtIncompatible("incompatible method") public static Date parseDateStrictly(final String str, final String... parsePatterns) throws ParseException { return parseDateStrictly(str, null, parsePatterns); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "Date", "parseDateStrictly", "(", "final", "String", "str", ",", "final", "String", "...", "parsePatterns", ")", "throws", "ParseException", "{", "return", "parseDateStrictly", "(", "str", ",", "null", ",", "parsePatterns", ")", ";", "}" ]
<p>Parses a string representing a date by trying a variety of different parsers.</p> <p>The parse will try each parse pattern in turn. A parse is only deemed successful if it parses the whole of the input string. If no parse patterns match, a ParseException is thrown.</p> The parser parses strictly - it does not allow for dates such as "February 942, 1996". @param str the date to parse, not null @param parsePatterns the date format patterns to use, see SimpleDateFormat, not null @return the parsed date @throws IllegalArgumentException if the date string or pattern array is null @throws ParseException if none of the date patterns were suitable @since 2.5
[ "<p", ">", "Parses", "a", "string", "representing", "a", "date", "by", "trying", "a", "variety", "of", "different", "parsers", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L325-L328
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/ExtractorUtils.java
ExtractorUtils.getVcsUrl
public static String getVcsUrl(Map<String, String> env) { String url = env.get("SVN_URL"); if (StringUtils.isBlank(url)) { url = publicGitUrl(env.get("GIT_URL")); } if (StringUtils.isBlank(url)) { url = env.get("P4PORT"); } return url; }
java
public static String getVcsUrl(Map<String, String> env) { String url = env.get("SVN_URL"); if (StringUtils.isBlank(url)) { url = publicGitUrl(env.get("GIT_URL")); } if (StringUtils.isBlank(url)) { url = env.get("P4PORT"); } return url; }
[ "public", "static", "String", "getVcsUrl", "(", "Map", "<", "String", ",", "String", ">", "env", ")", "{", "String", "url", "=", "env", ".", "get", "(", "\"SVN_URL\"", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "url", ")", ")", "{", "url", "=", "publicGitUrl", "(", "env", ".", "get", "(", "\"GIT_URL\"", ")", ")", ";", "}", "if", "(", "StringUtils", ".", "isBlank", "(", "url", ")", ")", "{", "url", "=", "env", ".", "get", "(", "\"P4PORT\"", ")", ";", "}", "return", "url", ";", "}" ]
Get the VCS url from the Jenkins build environment. The search will one of "SVN_REVISION", "GIT_COMMIT", "P4_CHANGELIST" in the environment. @param env Th Jenkins build environment. @return The vcs url for supported VCS
[ "Get", "the", "VCS", "url", "from", "the", "Jenkins", "build", "environment", ".", "The", "search", "will", "one", "of", "SVN_REVISION", "GIT_COMMIT", "P4_CHANGELIST", "in", "the", "environment", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/ExtractorUtils.java#L99-L108
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/request/mapper/HighScoreRequestMapper.java
HighScoreRequestMapper.newComparator
protected Comparator<RequestMapperBean> newComparator() { return new Comparator<RequestMapperBean>() { @Override public int compare(final RequestMapperBean o1, final RequestMapperBean o2) { return o1.getCompatibilityScore() - o2.getCompatibilityScore(); } }; }
java
protected Comparator<RequestMapperBean> newComparator() { return new Comparator<RequestMapperBean>() { @Override public int compare(final RequestMapperBean o1, final RequestMapperBean o2) { return o1.getCompatibilityScore() - o2.getCompatibilityScore(); } }; }
[ "protected", "Comparator", "<", "RequestMapperBean", ">", "newComparator", "(", ")", "{", "return", "new", "Comparator", "<", "RequestMapperBean", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "final", "RequestMapperBean", "o1", ",", "final", "RequestMapperBean", "o2", ")", "{", "return", "o1", ".", "getCompatibilityScore", "(", ")", "-", "o2", ".", "getCompatibilityScore", "(", ")", ";", "}", "}", ";", "}" ]
Factory method for creating a new Comparator for sort the compatibility score. This method is invoked in the method initializeRequestMappers and can be overridden so users can provide their own version of a Comparator. @return the new Comparator.
[ "Factory", "method", "for", "creating", "a", "new", "Comparator", "for", "sort", "the", "compatibility", "score", ".", "This", "method", "is", "invoked", "in", "the", "method", "initializeRequestMappers", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own", "version", "of", "a", "Comparator", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/request/mapper/HighScoreRequestMapper.java#L168-L178
languagetool-org/languagetool
languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java
GermanSpellerRule.getWordAfterEnumerationOrNull
@Nullable private String getWordAfterEnumerationOrNull(List<String> words, int idx) { for (int i = idx; i < words.size(); i++) { String word = words.get(i); if (!(word.endsWith("-") || StringUtils.equalsAny(word, ",", "und", "oder", "sowie") || word.trim().isEmpty())) { return word; } } return null; }
java
@Nullable private String getWordAfterEnumerationOrNull(List<String> words, int idx) { for (int i = idx; i < words.size(); i++) { String word = words.get(i); if (!(word.endsWith("-") || StringUtils.equalsAny(word, ",", "und", "oder", "sowie") || word.trim().isEmpty())) { return word; } } return null; }
[ "@", "Nullable", "private", "String", "getWordAfterEnumerationOrNull", "(", "List", "<", "String", ">", "words", ",", "int", "idx", ")", "{", "for", "(", "int", "i", "=", "idx", ";", "i", "<", "words", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "word", "=", "words", ".", "get", "(", "i", ")", ";", "if", "(", "!", "(", "word", ".", "endsWith", "(", "\"-\"", ")", "||", "StringUtils", ".", "equalsAny", "(", "word", ",", "\",\"", ",", "\"und\"", ",", "\"oder\"", ",", "\"sowie\"", ")", "||", "word", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", ")", "{", "return", "word", ";", "}", "}", "return", "null", ";", "}" ]
for "Stil- und Grammatikprüfung", get "Grammatikprüfung" when at position of "Stil-"
[ "for", "Stil", "-", "und", "Grammatikprüfung", "get", "Grammatikprüfung", "when", "at", "position", "of", "Stil", "-" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java#L1245-L1254
alkacon/opencms-core
src/org/opencms/xml/page/CmsXmlPage.java
CmsXmlPage.addValue
public void addValue(String name, Locale locale) throws CmsIllegalArgumentException { if (name.indexOf('[') >= 0) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_CONTAINS_INDEX_1, name)); } if (hasValue(name, locale)) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_LANG_ELEM_EXISTS_2, name, locale)); } Element pages = m_document.getRootElement(); String localeStr = locale.toString(); Element page = null; // search if a page for the selected language is already available for (Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(pages, NODE_PAGE); i.hasNext();) { Element nextPage = i.next(); String language = nextPage.attributeValue(ATTRIBUTE_LANGUAGE); if (localeStr.equals(language)) { // a page for the selected language was found page = nextPage; break; } } // create the new element Element element; if (page != null) { // page for selected language already available element = page.addElement(NODE_ELEMENT).addAttribute(ATTRIBUTE_NAME, name); } else { // no page for the selected language was found element = pages.addElement(NODE_PAGE).addAttribute(ATTRIBUTE_LANGUAGE, localeStr); element = element.addElement(NODE_ELEMENT).addAttribute(ATTRIBUTE_NAME, name); } // add empty nodes for link table and content to the element element.addElement(NODE_LINKS); element.addElement(NODE_CONTENT); CmsXmlHtmlValue value = new CmsXmlHtmlValue(this, element, locale); // bookmark the element addBookmark(CmsXmlUtils.createXpathElement(name, 1), locale, true, value); }
java
public void addValue(String name, Locale locale) throws CmsIllegalArgumentException { if (name.indexOf('[') >= 0) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_CONTAINS_INDEX_1, name)); } if (hasValue(name, locale)) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_LANG_ELEM_EXISTS_2, name, locale)); } Element pages = m_document.getRootElement(); String localeStr = locale.toString(); Element page = null; // search if a page for the selected language is already available for (Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(pages, NODE_PAGE); i.hasNext();) { Element nextPage = i.next(); String language = nextPage.attributeValue(ATTRIBUTE_LANGUAGE); if (localeStr.equals(language)) { // a page for the selected language was found page = nextPage; break; } } // create the new element Element element; if (page != null) { // page for selected language already available element = page.addElement(NODE_ELEMENT).addAttribute(ATTRIBUTE_NAME, name); } else { // no page for the selected language was found element = pages.addElement(NODE_PAGE).addAttribute(ATTRIBUTE_LANGUAGE, localeStr); element = element.addElement(NODE_ELEMENT).addAttribute(ATTRIBUTE_NAME, name); } // add empty nodes for link table and content to the element element.addElement(NODE_LINKS); element.addElement(NODE_CONTENT); CmsXmlHtmlValue value = new CmsXmlHtmlValue(this, element, locale); // bookmark the element addBookmark(CmsXmlUtils.createXpathElement(name, 1), locale, true, value); }
[ "public", "void", "addValue", "(", "String", "name", ",", "Locale", "locale", ")", "throws", "CmsIllegalArgumentException", "{", "if", "(", "name", ".", "indexOf", "(", "'", "'", ")", ">=", "0", ")", "{", "throw", "new", "CmsIllegalArgumentException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_XML_PAGE_CONTAINS_INDEX_1", ",", "name", ")", ")", ";", "}", "if", "(", "hasValue", "(", "name", ",", "locale", ")", ")", "{", "throw", "new", "CmsIllegalArgumentException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_XML_PAGE_LANG_ELEM_EXISTS_2", ",", "name", ",", "locale", ")", ")", ";", "}", "Element", "pages", "=", "m_document", ".", "getRootElement", "(", ")", ";", "String", "localeStr", "=", "locale", ".", "toString", "(", ")", ";", "Element", "page", "=", "null", ";", "// search if a page for the selected language is already available", "for", "(", "Iterator", "<", "Element", ">", "i", "=", "CmsXmlGenericWrapper", ".", "elementIterator", "(", "pages", ",", "NODE_PAGE", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "Element", "nextPage", "=", "i", ".", "next", "(", ")", ";", "String", "language", "=", "nextPage", ".", "attributeValue", "(", "ATTRIBUTE_LANGUAGE", ")", ";", "if", "(", "localeStr", ".", "equals", "(", "language", ")", ")", "{", "// a page for the selected language was found", "page", "=", "nextPage", ";", "break", ";", "}", "}", "// create the new element", "Element", "element", ";", "if", "(", "page", "!=", "null", ")", "{", "// page for selected language already available", "element", "=", "page", ".", "addElement", "(", "NODE_ELEMENT", ")", ".", "addAttribute", "(", "ATTRIBUTE_NAME", ",", "name", ")", ";", "}", "else", "{", "// no page for the selected language was found", "element", "=", "pages", ".", "addElement", "(", "NODE_PAGE", ")", ".", "addAttribute", "(", "ATTRIBUTE_LANGUAGE", ",", "localeStr", ")", ";", "element", "=", "element", ".", "addElement", "(", "NODE_ELEMENT", ")", ".", "addAttribute", "(", "ATTRIBUTE_NAME", ",", "name", ")", ";", "}", "// add empty nodes for link table and content to the element", "element", ".", "addElement", "(", "NODE_LINKS", ")", ";", "element", ".", "addElement", "(", "NODE_CONTENT", ")", ";", "CmsXmlHtmlValue", "value", "=", "new", "CmsXmlHtmlValue", "(", "this", ",", "element", ",", "locale", ")", ";", "// bookmark the element", "addBookmark", "(", "CmsXmlUtils", ".", "createXpathElement", "(", "name", ",", "1", ")", ",", "locale", ",", "true", ",", "value", ")", ";", "}" ]
Adds a new, empty value with the given name and locale to this XML document.<p> @param name the name of the value @param locale the locale of the value @throws CmsIllegalArgumentException if the name contains an index ("[&lt;number&gt;]") or the value for the given locale already exists in the xmlpage.
[ "Adds", "a", "new", "empty", "value", "with", "the", "given", "name", "and", "locale", "to", "this", "XML", "document", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/page/CmsXmlPage.java#L183-L229
zsoltk/overpasser
library/src/main/java/hu/supercluster/overpasser/library/query/OverpassFilterQuery.java
OverpassFilterQuery.boundingBox
public OverpassFilterQuery boundingBox(double southernLat, double westernLon, double northernLat, double easternLon) { builder.boundingBox(southernLat, westernLon, northernLat, easternLon); return this; }
java
public OverpassFilterQuery boundingBox(double southernLat, double westernLon, double northernLat, double easternLon) { builder.boundingBox(southernLat, westernLon, northernLat, easternLon); return this; }
[ "public", "OverpassFilterQuery", "boundingBox", "(", "double", "southernLat", ",", "double", "westernLon", ",", "double", "northernLat", ",", "double", "easternLon", ")", "{", "builder", ".", "boundingBox", "(", "southernLat", ",", "westernLon", ",", "northernLat", ",", "easternLon", ")", ";", "return", "this", ";", "}" ]
Adds a <i>(southernLat,westernLon,northernLat,easternLon)</i> bounding box filter to the current query. @param southernLat the southern latitude @param westernLon the western longitude @param northernLat the northern latitude @param easternLon the eastern longitude @return the current query object
[ "Adds", "a", "<i", ">", "(", "southernLat", "westernLon", "northernLat", "easternLon", ")", "<", "/", "i", ">", "bounding", "box", "filter", "to", "the", "current", "query", "." ]
train
https://github.com/zsoltk/overpasser/blob/0464d3844e75c5f9393d2458d3a3aedf3e40f30d/library/src/main/java/hu/supercluster/overpasser/library/query/OverpassFilterQuery.java#L221-L225
xebia/Xebium
src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java
SeleniumDriverFixture.doOn
public boolean doOn(final String command, final String target) { LOG.info("Performing | " + command + " | " + target + " |"); return executeDoCommand(command, new String[] { unalias(target) }); }
java
public boolean doOn(final String command, final String target) { LOG.info("Performing | " + command + " | " + target + " |"); return executeDoCommand(command, new String[] { unalias(target) }); }
[ "public", "boolean", "doOn", "(", "final", "String", "command", ",", "final", "String", "target", ")", "{", "LOG", ".", "info", "(", "\"Performing | \"", "+", "command", "+", "\" | \"", "+", "target", "+", "\" |\"", ")", ";", "return", "executeDoCommand", "(", "command", ",", "new", "String", "[", "]", "{", "unalias", "(", "target", ")", "}", ")", ";", "}" ]
<p><code> | ensure | do | <i>open</i> | on | <i>/</i> | </code></p> @param command @param target @return
[ "<p", ">", "<code", ">", "|", "ensure", "|", "do", "|", "<i", ">", "open<", "/", "i", ">", "|", "on", "|", "<i", ">", "/", "<", "/", "i", ">", "|", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/xebia/Xebium/blob/594f6d9e65622acdbd03dba0700b17645981da1f/src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java#L355-L358
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionAffinityManager.java
SessionAffinityManager.getInUseSessionVersion
@Override public int getInUseSessionVersion(ServletRequest req, SessionAffinityContext sac) { int version = sac.getResponseSessionVersion(); if (version == -1) { // not set, use request version version = sac.getRequestedSessionVersion(); } return version; }
java
@Override public int getInUseSessionVersion(ServletRequest req, SessionAffinityContext sac) { int version = sac.getResponseSessionVersion(); if (version == -1) { // not set, use request version version = sac.getRequestedSessionVersion(); } return version; }
[ "@", "Override", "public", "int", "getInUseSessionVersion", "(", "ServletRequest", "req", ",", "SessionAffinityContext", "sac", ")", "{", "int", "version", "=", "sac", ".", "getResponseSessionVersion", "(", ")", ";", "if", "(", "version", "==", "-", "1", ")", "{", "// not set, use request version", "version", "=", "sac", ".", "getRequestedSessionVersion", "(", ")", ";", "}", "return", "version", ";", "}" ]
/* Method to get the appropriate version to use for a new session. May be the response session id if the request has been dispatched adn the response version is already set
[ "/", "*", "Method", "to", "get", "the", "appropriate", "version", "to", "use", "for", "a", "new", "session", ".", "May", "be", "the", "response", "session", "id", "if", "the", "request", "has", "been", "dispatched", "adn", "the", "response", "version", "is", "already", "set" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionAffinityManager.java#L488-L495
nextreports/nextreports-engine
src/ro/nextreports/engine/util/ReportUtil.java
ReportUtil.saveReport
public static void saveReport(Report report, OutputStream out) { XStream xstream = XStreamFactory.createXStream(); xstream.toXML(report, out); }
java
public static void saveReport(Report report, OutputStream out) { XStream xstream = XStreamFactory.createXStream(); xstream.toXML(report, out); }
[ "public", "static", "void", "saveReport", "(", "Report", "report", ",", "OutputStream", "out", ")", "{", "XStream", "xstream", "=", "XStreamFactory", ".", "createXStream", "(", ")", ";", "xstream", ".", "toXML", "(", "report", ",", "out", ")", ";", "}" ]
Write a report object to an output stream @param report report object @param out output stream
[ "Write", "a", "report", "object", "to", "an", "output", "stream" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L198-L201
weld/core
impl/src/main/java/org/jboss/weld/util/bytecode/ClassFileUtils.java
ClassFileUtils.toClass
public static Class<?> toClass(ClassFile ct, ClassLoader loader, ProtectionDomain domain) { try { byte[] b = ct.toBytecode(); java.lang.reflect.Method method; Object[] args; if (domain == null) { method = defineClass1; args = new Object[] { ct.getName(), b, 0, b.length }; } else { method = defineClass2; args = new Object[] { ct.getName(), b, 0, b.length, domain }; } return toClass2(method, loader, args); } catch (RuntimeException e) { throw e; } catch (java.lang.reflect.InvocationTargetException e) { throw new RuntimeException(e.getTargetException()); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static Class<?> toClass(ClassFile ct, ClassLoader loader, ProtectionDomain domain) { try { byte[] b = ct.toBytecode(); java.lang.reflect.Method method; Object[] args; if (domain == null) { method = defineClass1; args = new Object[] { ct.getName(), b, 0, b.length }; } else { method = defineClass2; args = new Object[] { ct.getName(), b, 0, b.length, domain }; } return toClass2(method, loader, args); } catch (RuntimeException e) { throw e; } catch (java.lang.reflect.InvocationTargetException e) { throw new RuntimeException(e.getTargetException()); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "Class", "<", "?", ">", "toClass", "(", "ClassFile", "ct", ",", "ClassLoader", "loader", ",", "ProtectionDomain", "domain", ")", "{", "try", "{", "byte", "[", "]", "b", "=", "ct", ".", "toBytecode", "(", ")", ";", "java", ".", "lang", ".", "reflect", ".", "Method", "method", ";", "Object", "[", "]", "args", ";", "if", "(", "domain", "==", "null", ")", "{", "method", "=", "defineClass1", ";", "args", "=", "new", "Object", "[", "]", "{", "ct", ".", "getName", "(", ")", ",", "b", ",", "0", ",", "b", ".", "length", "}", ";", "}", "else", "{", "method", "=", "defineClass2", ";", "args", "=", "new", "Object", "[", "]", "{", "ct", ".", "getName", "(", ")", ",", "b", ",", "0", ",", "b", ".", "length", ",", "domain", "}", ";", "}", "return", "toClass2", "(", "method", ",", "loader", ",", "args", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "java", ".", "lang", ".", "reflect", ".", "InvocationTargetException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ".", "getTargetException", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Converts the class to a <code>java.lang.Class</code> object. Once this method is called, further modifications are not allowed any more. <p/> <p/> The class file represented by the given <code>CtClass</code> is loaded by the given class loader to construct a <code>java.lang.Class</code> object. Since a private method on the class loader is invoked through the reflection API, the caller must have permissions to do that. <p/> <p/> An easy way to obtain <code>ProtectionDomain</code> object is to call <code>getProtectionDomain()</code> in <code>java.lang.Class</code>. It returns the domain that the class belongs to. <p/> <p/> This method is provided for convenience. If you need more complex functionality, you should write your own class loader. @param loader the class loader used to load this class. For example, the loader returned by <code>getClassLoader()</code> can be used for this parameter. @param domain the protection domain for the class. If it is null, the default domain created by <code>java.lang.ClassLoader</code> is
[ "Converts", "the", "class", "to", "a", "<code", ">", "java", ".", "lang", ".", "Class<", "/", "code", ">", "object", ".", "Once", "this", "method", "is", "called", "further", "modifications", "are", "not", "allowed", "any", "more", ".", "<p", "/", ">", "<p", "/", ">", "The", "class", "file", "represented", "by", "the", "given", "<code", ">", "CtClass<", "/", "code", ">", "is", "loaded", "by", "the", "given", "class", "loader", "to", "construct", "a", "<code", ">", "java", ".", "lang", ".", "Class<", "/", "code", ">", "object", ".", "Since", "a", "private", "method", "on", "the", "class", "loader", "is", "invoked", "through", "the", "reflection", "API", "the", "caller", "must", "have", "permissions", "to", "do", "that", ".", "<p", "/", ">", "<p", "/", ">", "An", "easy", "way", "to", "obtain", "<code", ">", "ProtectionDomain<", "/", "code", ">", "object", "is", "to", "call", "<code", ">", "getProtectionDomain", "()", "<", "/", "code", ">", "in", "<code", ">", "java", ".", "lang", ".", "Class<", "/", "code", ">", ".", "It", "returns", "the", "domain", "that", "the", "class", "belongs", "to", ".", "<p", "/", ">", "<p", "/", ">", "This", "method", "is", "provided", "for", "convenience", ".", "If", "you", "need", "more", "complex", "functionality", "you", "should", "write", "your", "own", "class", "loader", "." ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/bytecode/ClassFileUtils.java#L121-L142
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/extras/Radar.java
Radar.updatePoi
public void updatePoi(final String BLIP_NAME, final Point2D LOCATION) { if (pois.keySet().contains(BLIP_NAME)) { pois.get(BLIP_NAME).setLocation(LOCATION); checkForBlips(); } }
java
public void updatePoi(final String BLIP_NAME, final Point2D LOCATION) { if (pois.keySet().contains(BLIP_NAME)) { pois.get(BLIP_NAME).setLocation(LOCATION); checkForBlips(); } }
[ "public", "void", "updatePoi", "(", "final", "String", "BLIP_NAME", ",", "final", "Point2D", "LOCATION", ")", "{", "if", "(", "pois", ".", "keySet", "(", ")", ".", "contains", "(", "BLIP_NAME", ")", ")", "{", "pois", ".", "get", "(", "BLIP_NAME", ")", ".", "setLocation", "(", "LOCATION", ")", ";", "checkForBlips", "(", ")", ";", "}", "}" ]
Updates the position of the given poi by it's name (BLIP_NAME) on the radar screen. This could be useful to visualize moving points. Keep in mind that only the poi's are visible as blips that are in the range of the radar. @param BLIP_NAME @param LOCATION
[ "Updates", "the", "position", "of", "the", "given", "poi", "by", "it", "s", "name", "(", "BLIP_NAME", ")", "on", "the", "radar", "screen", ".", "This", "could", "be", "useful", "to", "visualize", "moving", "points", ".", "Keep", "in", "mind", "that", "only", "the", "poi", "s", "are", "visible", "as", "blips", "that", "are", "in", "the", "range", "of", "the", "radar", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/extras/Radar.java#L303-L308
apereo/cas
support/cas-server-support-pm-webflow/src/main/java/org/apereo/cas/pm/web/flow/PasswordManagementWebflowUtils.java
PasswordManagementWebflowUtils.putPasswordResetUsername
public static void putPasswordResetUsername(final RequestContext requestContext, final String username) { val flowScope = requestContext.getFlowScope(); flowScope.put("username", username); }
java
public static void putPasswordResetUsername(final RequestContext requestContext, final String username) { val flowScope = requestContext.getFlowScope(); flowScope.put("username", username); }
[ "public", "static", "void", "putPasswordResetUsername", "(", "final", "RequestContext", "requestContext", ",", "final", "String", "username", ")", "{", "val", "flowScope", "=", "requestContext", ".", "getFlowScope", "(", ")", ";", "flowScope", ".", "put", "(", "\"username\"", ",", "username", ")", ";", "}" ]
Put password reset username. @param requestContext the request context @param username the username
[ "Put", "password", "reset", "username", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pm-webflow/src/main/java/org/apereo/cas/pm/web/flow/PasswordManagementWebflowUtils.java#L90-L93
SonarOpenCommunity/sonar-cxx
cxx-sensors/src/main/java/org/sonar/cxx/sensors/utils/CxxReportSensor.java
CxxReportSensor.getContextStringProperty
public static String getContextStringProperty(SensorContext context, String name, String def) { String s = context.config().get(name).orElse(null); if (s == null || s.isEmpty()) { return def; } return s; }
java
public static String getContextStringProperty(SensorContext context, String name, String def) { String s = context.config().get(name).orElse(null); if (s == null || s.isEmpty()) { return def; } return s; }
[ "public", "static", "String", "getContextStringProperty", "(", "SensorContext", "context", ",", "String", "name", ",", "String", "def", ")", "{", "String", "s", "=", "context", ".", "config", "(", ")", ".", "get", "(", "name", ")", ".", "orElse", "(", "null", ")", ";", "if", "(", "s", "==", "null", "||", "s", ".", "isEmpty", "(", ")", ")", "{", "return", "def", ";", "}", "return", "s", ";", "}" ]
Get string property from configuration. If the string is not set or empty, return the default value. @param context sensor context @param name Name of the property @param def Default value @return Value of the property if set and not empty, else default value.
[ "Get", "string", "property", "from", "configuration", ".", "If", "the", "string", "is", "not", "set", "or", "empty", "return", "the", "default", "value", "." ]
train
https://github.com/SonarOpenCommunity/sonar-cxx/blob/7e7a3a44d6d86382a0434652a798f8235503c9b8/cxx-sensors/src/main/java/org/sonar/cxx/sensors/utils/CxxReportSensor.java#L71-L77
michel-kraemer/citeproc-java
citeproc-java/src/main/java/de/undercouch/citeproc/BibliographyFileReader.java
BibliographyFileReader.readBibliographyFile
public ItemDataProvider readBibliographyFile(File bibfile) throws FileNotFoundException, IOException { //open buffered input stream to bibliography file if (!bibfile.exists()) { throw new FileNotFoundException("Bibliography file `" + bibfile.getName() + "' does not exist"); } try (BufferedInputStream bis = new BufferedInputStream( new FileInputStream(bibfile))) { return readBibliographyFile(bis, bibfile.getName()); } }
java
public ItemDataProvider readBibliographyFile(File bibfile) throws FileNotFoundException, IOException { //open buffered input stream to bibliography file if (!bibfile.exists()) { throw new FileNotFoundException("Bibliography file `" + bibfile.getName() + "' does not exist"); } try (BufferedInputStream bis = new BufferedInputStream( new FileInputStream(bibfile))) { return readBibliographyFile(bis, bibfile.getName()); } }
[ "public", "ItemDataProvider", "readBibliographyFile", "(", "File", "bibfile", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "//open buffered input stream to bibliography file", "if", "(", "!", "bibfile", ".", "exists", "(", ")", ")", "{", "throw", "new", "FileNotFoundException", "(", "\"Bibliography file `\"", "+", "bibfile", ".", "getName", "(", ")", "+", "\"' does not exist\"", ")", ";", "}", "try", "(", "BufferedInputStream", "bis", "=", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "bibfile", ")", ")", ")", "{", "return", "readBibliographyFile", "(", "bis", ",", "bibfile", ".", "getName", "(", ")", ")", ";", "}", "}" ]
Reads all items from an input bibliography file and returns a provider serving these items @param bibfile the input file @return the provider @throws FileNotFoundException if the input file was not found @throws IOException if the input file could not be read
[ "Reads", "all", "items", "from", "an", "input", "bibliography", "file", "and", "returns", "a", "provider", "serving", "these", "items" ]
train
https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/BibliographyFileReader.java#L103-L114
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/ObjectBindTransform.java
ObjectBindTransform.generateParseOnXml
@Override public void generateParseOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String parserName, TypeName beanClass, String beanName, BindProperty property) { // TODO QUA // TypeName typeName = resolveTypeName(property.getParent(), // property.getPropertyType().getTypeName()); TypeName typeName = property.getPropertyType().getTypeName(); String bindName = context.getBindMapperName(context, typeName); methodBuilder.addStatement(setter(beanClass, beanName, property, "$L.parseOnXml(xmlParser, eventType)"), bindName); }
java
@Override public void generateParseOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String parserName, TypeName beanClass, String beanName, BindProperty property) { // TODO QUA // TypeName typeName = resolveTypeName(property.getParent(), // property.getPropertyType().getTypeName()); TypeName typeName = property.getPropertyType().getTypeName(); String bindName = context.getBindMapperName(context, typeName); methodBuilder.addStatement(setter(beanClass, beanName, property, "$L.parseOnXml(xmlParser, eventType)"), bindName); }
[ "@", "Override", "public", "void", "generateParseOnXml", "(", "BindTypeContext", "context", ",", "MethodSpec", ".", "Builder", "methodBuilder", ",", "String", "parserName", ",", "TypeName", "beanClass", ",", "String", "beanName", ",", "BindProperty", "property", ")", "{", "// TODO QUA", "// TypeName typeName = resolveTypeName(property.getParent(),", "// property.getPropertyType().getTypeName());", "TypeName", "typeName", "=", "property", ".", "getPropertyType", "(", ")", ".", "getTypeName", "(", ")", ";", "String", "bindName", "=", "context", ".", "getBindMapperName", "(", "context", ",", "typeName", ")", ";", "methodBuilder", ".", "addStatement", "(", "setter", "(", "beanClass", ",", "beanName", ",", "property", ",", "\"$L.parseOnXml(xmlParser, eventType)\"", ")", ",", "bindName", ")", ";", "}" ]
/* (non-Javadoc) @see com.abubusoft.kripton.processor.bind.transform.BindTransform#generateParseOnXml(com.abubusoft.kripton.processor.bind.BindTypeContext, com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.bind.model.BindProperty)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/ObjectBindTransform.java#L48-L57