repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsSitemapHoverbar.java | CmsSitemapHoverbar.installHoverbar | private static void installHoverbar(final CmsSitemapHoverbar hoverbar, CmsListItemWidget widget) {
hoverbar.setVisible(false);
widget.getContentPanel().add(hoverbar);
A_CmsHoverHandler handler = new A_CmsHoverHandler() {
/**
* @see org.opencms.gwt.client.ui.A_CmsHoverHandler#onHoverIn(com.google.gwt.event.dom.client.MouseOverEvent)
*/
@Override
protected void onHoverIn(MouseOverEvent event) {
hoverbar.setHovered(true);
if (hoverbar.isVisible()) {
// prevent show when not needed
return;
}
hoverbar.show();
}
/**
* @see org.opencms.gwt.client.ui.A_CmsHoverHandler#onHoverOut(com.google.gwt.event.dom.client.MouseOutEvent)
*/
@Override
protected void onHoverOut(MouseOutEvent event) {
hoverbar.setHovered(false);
if (!hoverbar.isLocked()) {
hoverbar.hide();
}
}
};
widget.addMouseOutHandler(handler);
widget.addMouseOverHandler(handler);
} | java | private static void installHoverbar(final CmsSitemapHoverbar hoverbar, CmsListItemWidget widget) {
hoverbar.setVisible(false);
widget.getContentPanel().add(hoverbar);
A_CmsHoverHandler handler = new A_CmsHoverHandler() {
/**
* @see org.opencms.gwt.client.ui.A_CmsHoverHandler#onHoverIn(com.google.gwt.event.dom.client.MouseOverEvent)
*/
@Override
protected void onHoverIn(MouseOverEvent event) {
hoverbar.setHovered(true);
if (hoverbar.isVisible()) {
// prevent show when not needed
return;
}
hoverbar.show();
}
/**
* @see org.opencms.gwt.client.ui.A_CmsHoverHandler#onHoverOut(com.google.gwt.event.dom.client.MouseOutEvent)
*/
@Override
protected void onHoverOut(MouseOutEvent event) {
hoverbar.setHovered(false);
if (!hoverbar.isLocked()) {
hoverbar.hide();
}
}
};
widget.addMouseOutHandler(handler);
widget.addMouseOverHandler(handler);
} | [
"private",
"static",
"void",
"installHoverbar",
"(",
"final",
"CmsSitemapHoverbar",
"hoverbar",
",",
"CmsListItemWidget",
"widget",
")",
"{",
"hoverbar",
".",
"setVisible",
"(",
"false",
")",
";",
"widget",
".",
"getContentPanel",
"(",
")",
".",
"add",
"(",
"h... | Installs the given hover bar.<p>
@param hoverbar the hover bar
@param widget the list item widget | [
"Installs",
"the",
"given",
"hover",
"bar",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsSitemapHoverbar.java#L249-L283 |
geomajas/geomajas-project-client-gwt2 | plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java | TmsClient.createLayer | public TmsLayer createLayer(String id, TileConfiguration tileConfiguration, TmsLayerConfiguration
layerConfiguration) {
return new TmsLayer(id, tileConfiguration, layerConfiguration);
} | java | public TmsLayer createLayer(String id, TileConfiguration tileConfiguration, TmsLayerConfiguration
layerConfiguration) {
return new TmsLayer(id, tileConfiguration, layerConfiguration);
} | [
"public",
"TmsLayer",
"createLayer",
"(",
"String",
"id",
",",
"TileConfiguration",
"tileConfiguration",
",",
"TmsLayerConfiguration",
"layerConfiguration",
")",
"{",
"return",
"new",
"TmsLayer",
"(",
"id",
",",
"tileConfiguration",
",",
"layerConfiguration",
")",
";"... | Create a new TMS layer instance.
@param id The unique layer ID.
@param tileConfiguration The tile configuration object.
@param layerConfiguration The layer configuration object.
@return A new TMS layer. | [
"Create",
"a",
"new",
"TMS",
"layer",
"instance",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java#L171-L174 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/env/Diagnostics.java | Diagnostics.systemInfo | @IgnoreJRERequirement //this method safely checks that the com.sun bean is available before attempting to use its methods
public static void systemInfo(final Map<String, Object> infos) {
infos.put("sys.os.name", OS_BEAN.getName());
infos.put("sys.os.version", OS_BEAN.getVersion());
infos.put("sys.os.arch", OS_BEAN.getArch());
infos.put("sys.cpu.num", OS_BEAN.getAvailableProcessors());
infos.put("sys.cpu.loadAvg", OS_BEAN.getSystemLoadAverage());
try {
if (OS_BEAN instanceof com.sun.management.OperatingSystemMXBean) {
com.sun.management.OperatingSystemMXBean sunBean = (com.sun.management.OperatingSystemMXBean) OS_BEAN;
infos.put("proc.cpu.time", sunBean.getProcessCpuTime());
infos.put("mem.physical.total", sunBean.getTotalPhysicalMemorySize());
infos.put("mem.physical.free", sunBean.getFreePhysicalMemorySize());
infos.put("mem.virtual.comitted", sunBean.getCommittedVirtualMemorySize());
infos.put("mem.swap.total", sunBean.getTotalSwapSpaceSize());
infos.put("mem.swap.free", sunBean.getFreeSwapSpaceSize());
}
} catch (final Throwable err) {
LOGGER.debug("com.sun.management.OperatingSystemMXBean not available, skipping extended system info!");
}
} | java | @IgnoreJRERequirement //this method safely checks that the com.sun bean is available before attempting to use its methods
public static void systemInfo(final Map<String, Object> infos) {
infos.put("sys.os.name", OS_BEAN.getName());
infos.put("sys.os.version", OS_BEAN.getVersion());
infos.put("sys.os.arch", OS_BEAN.getArch());
infos.put("sys.cpu.num", OS_BEAN.getAvailableProcessors());
infos.put("sys.cpu.loadAvg", OS_BEAN.getSystemLoadAverage());
try {
if (OS_BEAN instanceof com.sun.management.OperatingSystemMXBean) {
com.sun.management.OperatingSystemMXBean sunBean = (com.sun.management.OperatingSystemMXBean) OS_BEAN;
infos.put("proc.cpu.time", sunBean.getProcessCpuTime());
infos.put("mem.physical.total", sunBean.getTotalPhysicalMemorySize());
infos.put("mem.physical.free", sunBean.getFreePhysicalMemorySize());
infos.put("mem.virtual.comitted", sunBean.getCommittedVirtualMemorySize());
infos.put("mem.swap.total", sunBean.getTotalSwapSpaceSize());
infos.put("mem.swap.free", sunBean.getFreeSwapSpaceSize());
}
} catch (final Throwable err) {
LOGGER.debug("com.sun.management.OperatingSystemMXBean not available, skipping extended system info!");
}
} | [
"@",
"IgnoreJRERequirement",
"//this method safely checks that the com.sun bean is available before attempting to use its methods",
"public",
"static",
"void",
"systemInfo",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"infos",
")",
"{",
"infos",
".",
"put",
"(",... | Collects system information as delivered from the {@link OperatingSystemMXBean}.
@param infos a map where the infos are passed in. | [
"Collects",
"system",
"information",
"as",
"delivered",
"from",
"the",
"{",
"@link",
"OperatingSystemMXBean",
"}",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/Diagnostics.java#L55-L77 |
VoltDB/voltdb | src/frontend/org/voltdb/client/exampleutils/ClientConnection.java | ClientConnection.updateApplicationCatalog | public ClientResponse updateApplicationCatalog(File catalogPath, File deploymentPath)
throws IOException, NoConnectionsException, ProcCallException
{
return Client.updateApplicationCatalog(catalogPath, deploymentPath);
} | java | public ClientResponse updateApplicationCatalog(File catalogPath, File deploymentPath)
throws IOException, NoConnectionsException, ProcCallException
{
return Client.updateApplicationCatalog(catalogPath, deploymentPath);
} | [
"public",
"ClientResponse",
"updateApplicationCatalog",
"(",
"File",
"catalogPath",
",",
"File",
"deploymentPath",
")",
"throws",
"IOException",
",",
"NoConnectionsException",
",",
"ProcCallException",
"{",
"return",
"Client",
".",
"updateApplicationCatalog",
"(",
"catalo... | Synchronously invokes UpdateApplicationCatalog procedure. Blocks until a
result is available. A {@link ProcCallException} is thrown if the
response is anything other then success.
@param catalogPath Path to the catalog jar file.
@param deploymentPath Path to the deployment file
@return array of VoltTable results
@throws IOException If the files cannot be serialized
@throws NoConnectionException
@throws ProcCallException | [
"Synchronously",
"invokes",
"UpdateApplicationCatalog",
"procedure",
".",
"Blocks",
"until",
"a",
"result",
"is",
"available",
".",
"A",
"{",
"@link",
"ProcCallException",
"}",
"is",
"thrown",
"if",
"the",
"response",
"is",
"anything",
"other",
"then",
"success",
... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/exampleutils/ClientConnection.java#L331-L335 |
ops4j/org.ops4j.pax.logging | pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ReusableLogEventFactory.java | ReusableLogEventFactory.createEvent | @Override
public LogEvent createEvent(final String loggerName, final Marker marker,
final String fqcn, final Level level, final Message message,
final List<Property> properties, final Throwable t) {
WeakReference<MutableLogEvent> refResult = mutableLogEventThreadLocal.get();
MutableLogEvent result = refResult == null ? null : refResult.get();
if (result == null || result.reserved) {
final boolean initThreadLocal = result == null;
result = new MutableLogEvent();
// usually no need to re-initialize thread-specific fields since the event is stored in a ThreadLocal
result.setThreadId(Thread.currentThread().getId());
result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call
result.setThreadPriority(Thread.currentThread().getPriority());
if (initThreadLocal) {
refResult = new WeakReference<>(result);
mutableLogEventThreadLocal.set(refResult);
}
}
result.reserved = true;
result.clear(); // ensure any previously cached values (thrownProxy, source, etc.) are cleared
result.setLoggerName(loggerName);
result.setMarker(marker);
result.setLoggerFqcn(fqcn);
result.setLevel(level == null ? Level.OFF : level);
result.setMessage(message);
result.setThrown(t);
result.setContextData(injector.injectContextData(properties, (StringMap) result.getContextData()));
result.setContextStack(ThreadContext.getDepth() == 0 ? ThreadContext.EMPTY_STACK : ThreadContext.cloneStack());// mutable copy
result.setTimeMillis(message instanceof TimestampMessage
? ((TimestampMessage) message).getTimestamp()
: CLOCK.currentTimeMillis());
result.setNanoTime(Log4jLogEvent.getNanoClock().nanoTime());
if (THREAD_NAME_CACHING_STRATEGY == ThreadNameCachingStrategy.UNCACHED) {
result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call
result.setThreadPriority(Thread.currentThread().getPriority());
}
return result;
} | java | @Override
public LogEvent createEvent(final String loggerName, final Marker marker,
final String fqcn, final Level level, final Message message,
final List<Property> properties, final Throwable t) {
WeakReference<MutableLogEvent> refResult = mutableLogEventThreadLocal.get();
MutableLogEvent result = refResult == null ? null : refResult.get();
if (result == null || result.reserved) {
final boolean initThreadLocal = result == null;
result = new MutableLogEvent();
// usually no need to re-initialize thread-specific fields since the event is stored in a ThreadLocal
result.setThreadId(Thread.currentThread().getId());
result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call
result.setThreadPriority(Thread.currentThread().getPriority());
if (initThreadLocal) {
refResult = new WeakReference<>(result);
mutableLogEventThreadLocal.set(refResult);
}
}
result.reserved = true;
result.clear(); // ensure any previously cached values (thrownProxy, source, etc.) are cleared
result.setLoggerName(loggerName);
result.setMarker(marker);
result.setLoggerFqcn(fqcn);
result.setLevel(level == null ? Level.OFF : level);
result.setMessage(message);
result.setThrown(t);
result.setContextData(injector.injectContextData(properties, (StringMap) result.getContextData()));
result.setContextStack(ThreadContext.getDepth() == 0 ? ThreadContext.EMPTY_STACK : ThreadContext.cloneStack());// mutable copy
result.setTimeMillis(message instanceof TimestampMessage
? ((TimestampMessage) message).getTimestamp()
: CLOCK.currentTimeMillis());
result.setNanoTime(Log4jLogEvent.getNanoClock().nanoTime());
if (THREAD_NAME_CACHING_STRATEGY == ThreadNameCachingStrategy.UNCACHED) {
result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call
result.setThreadPriority(Thread.currentThread().getPriority());
}
return result;
} | [
"@",
"Override",
"public",
"LogEvent",
"createEvent",
"(",
"final",
"String",
"loggerName",
",",
"final",
"Marker",
"marker",
",",
"final",
"String",
"fqcn",
",",
"final",
"Level",
"level",
",",
"final",
"Message",
"message",
",",
"final",
"List",
"<",
"Prop... | Creates a log event.
@param loggerName The name of the Logger.
@param marker An optional Marker.
@param fqcn The fully qualified class name of the caller.
@param level The event Level.
@param message The Message.
@param properties Properties to be added to the log event.
@param t An optional Throwable.
@return The LogEvent. | [
"Creates",
"a",
"log",
"event",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ReusableLogEventFactory.java#L58-L98 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java | DateTimePeriod.toMonths | public List<DateTimePeriod> toMonths() {
ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>();
// default "current" month to start datetime
DateTime currentStart = getStart();
// calculate "next" month
DateTime nextStart = currentStart.plusMonths(1);
// continue adding until we've reached the end
while (nextStart.isBefore(getEnd()) || nextStart.isEqual(getEnd())) {
// its okay to add the current
list.add(new DateTimeMonth(currentStart, nextStart));
// increment both
currentStart = nextStart;
nextStart = currentStart.plusMonths(1);
}
return list;
} | java | public List<DateTimePeriod> toMonths() {
ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>();
// default "current" month to start datetime
DateTime currentStart = getStart();
// calculate "next" month
DateTime nextStart = currentStart.plusMonths(1);
// continue adding until we've reached the end
while (nextStart.isBefore(getEnd()) || nextStart.isEqual(getEnd())) {
// its okay to add the current
list.add(new DateTimeMonth(currentStart, nextStart));
// increment both
currentStart = nextStart;
nextStart = currentStart.plusMonths(1);
}
return list;
} | [
"public",
"List",
"<",
"DateTimePeriod",
">",
"toMonths",
"(",
")",
"{",
"ArrayList",
"<",
"DateTimePeriod",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"DateTimePeriod",
">",
"(",
")",
";",
"// default \"current\" month to start datetime",
"DateTime",
"currentStart"... | Converts this period to a list of month periods. Partial months will not be
included. For example, a period of "2009" will return a list
of 12 months - one for each month in 2009. On the other hand, a period
of "January 20, 2009" would return an empty list since partial
months are not included.
@return A list of month periods contained within this period | [
"Converts",
"this",
"period",
"to",
"a",
"list",
"of",
"month",
"periods",
".",
"Partial",
"months",
"will",
"not",
"be",
"included",
".",
"For",
"example",
"a",
"period",
"of",
"2009",
"will",
"return",
"a",
"list",
"of",
"12",
"months",
"-",
"one",
"... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java#L327-L344 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/BosClient.java | BosClient.initiateMultipartUpload | public InitiateMultipartUploadResponse initiateMultipartUpload(String bucketName, String key) {
return this.initiateMultipartUpload(new InitiateMultipartUploadRequest(bucketName, key));
} | java | public InitiateMultipartUploadResponse initiateMultipartUpload(String bucketName, String key) {
return this.initiateMultipartUpload(new InitiateMultipartUploadRequest(bucketName, key));
} | [
"public",
"InitiateMultipartUploadResponse",
"initiateMultipartUpload",
"(",
"String",
"bucketName",
",",
"String",
"key",
")",
"{",
"return",
"this",
".",
"initiateMultipartUpload",
"(",
"new",
"InitiateMultipartUploadRequest",
"(",
"bucketName",
",",
"key",
")",
")",
... | Initiates a multipart upload and returns an InitiateMultipartUploadResponse
which contains an upload ID. This upload ID associates all the parts in
the specific upload and is used in each of your subsequent uploadPart requests.
You also include this upload ID in the final request to either complete, or abort the multipart
upload request.
@param bucketName The name of the Bos bucket containing the object to initiate.
@param key The key of the object to initiate.
@return An InitiateMultipartUploadResponse from Bos. | [
"Initiates",
"a",
"multipart",
"upload",
"and",
"returns",
"an",
"InitiateMultipartUploadResponse",
"which",
"contains",
"an",
"upload",
"ID",
".",
"This",
"upload",
"ID",
"associates",
"all",
"the",
"parts",
"in",
"the",
"specific",
"upload",
"and",
"is",
"used... | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L1082-L1084 |
kejunxia/AndroidMvc | library/poke/src/main/java/com/shipdream/lib/poke/Component.java | Component.unregister | public <T> Component unregister(Class<T> type, Annotation qualifier) throws ProviderMissingException {
//Detach corresponding provider from it's component
Provider<T> provider = findProvider(type, qualifier);
provider.setComponent(null);
String key = PokeHelper.makeProviderKey(type, qualifier);
Component targetComponent = getRootComponent().componentLocator.get(key);
targetComponent.providers.remove(key);
if (targetComponent.scopeCache != null) {
targetComponent.scopeCache.removeInstance(PokeHelper.makeProviderKey(type, qualifier));
}
Component root = getRootComponent();
//Remove it from root component's locator
root.componentLocator.remove(key);
return this;
} | java | public <T> Component unregister(Class<T> type, Annotation qualifier) throws ProviderMissingException {
//Detach corresponding provider from it's component
Provider<T> provider = findProvider(type, qualifier);
provider.setComponent(null);
String key = PokeHelper.makeProviderKey(type, qualifier);
Component targetComponent = getRootComponent().componentLocator.get(key);
targetComponent.providers.remove(key);
if (targetComponent.scopeCache != null) {
targetComponent.scopeCache.removeInstance(PokeHelper.makeProviderKey(type, qualifier));
}
Component root = getRootComponent();
//Remove it from root component's locator
root.componentLocator.remove(key);
return this;
} | [
"public",
"<",
"T",
">",
"Component",
"unregister",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Annotation",
"qualifier",
")",
"throws",
"ProviderMissingException",
"{",
"//Detach corresponding provider from it's component",
"Provider",
"<",
"T",
">",
"provider",
"=... | Find the provider in this {@link Component} and its descents. If the provider is found,
detach it from its associated {@link Component}. After this point, the provider will use its
own scope instances.
@param type The type of the provider
@param qualifier The qualifier of the provider
@return this instance
@throws ProviderMissingException Thrown when the provider with the given type and qualifier
cannot be found under this component | [
"Find",
"the",
"provider",
"in",
"this",
"{",
"@link",
"Component",
"}",
"and",
"its",
"descents",
".",
"If",
"the",
"provider",
"is",
"found",
"detach",
"it",
"from",
"its",
"associated",
"{",
"@link",
"Component",
"}",
".",
"After",
"this",
"point",
"t... | train | https://github.com/kejunxia/AndroidMvc/blob/c7893f0a13119d64297b9eb2988f7323b7da5bbc/library/poke/src/main/java/com/shipdream/lib/poke/Component.java#L209-L227 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java | BitmapUtils.getSize | public static Point getSize(byte[] byteArray, int offset, int length) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(byteArray, offset, length, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
} | java | public static Point getSize(byte[] byteArray, int offset, int length) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(byteArray, offset, length, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
} | [
"public",
"static",
"Point",
"getSize",
"(",
"byte",
"[",
"]",
"byteArray",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"BitmapFactory",
".",
"Options",
"options",
"=",
"new",
"BitmapFactory",
".",
"Options",
"(",
")",
";",
"options",
".",
"inJ... | Get width and height of the bitmap specified with the byte array.
@param byteArray the bitmap itself.
@param offset offset index.
@param length array length.
@return the size. | [
"Get",
"width",
"and",
"height",
"of",
"the",
"bitmap",
"specified",
"with",
"the",
"byte",
"array",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L128-L135 |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java | BitfinexApiCallbackListeners.onMyPositionEvent | public Closeable onMyPositionEvent(final BiConsumer<BitfinexAccountSymbol, Collection<BitfinexPosition>> listener) {
positionConsumers.offer(listener);
return () -> positionConsumers.remove(listener);
} | java | public Closeable onMyPositionEvent(final BiConsumer<BitfinexAccountSymbol, Collection<BitfinexPosition>> listener) {
positionConsumers.offer(listener);
return () -> positionConsumers.remove(listener);
} | [
"public",
"Closeable",
"onMyPositionEvent",
"(",
"final",
"BiConsumer",
"<",
"BitfinexAccountSymbol",
",",
"Collection",
"<",
"BitfinexPosition",
">",
">",
"listener",
")",
"{",
"positionConsumers",
".",
"offer",
"(",
"listener",
")",
";",
"return",
"(",
")",
"-... | registers listener for user account related events - position events
@param listener of event
@return hook of this listener | [
"registers",
"listener",
"for",
"user",
"account",
"related",
"events",
"-",
"position",
"events"
] | train | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java#L118-L121 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.rightString | public String rightString(final int length) {
if (length <= 0) {
return StringUtils.EMPTY;
} else if (length >= size) {
return new String(buffer, 0, size);
} else {
return new String(buffer, size - length, length);
}
} | java | public String rightString(final int length) {
if (length <= 0) {
return StringUtils.EMPTY;
} else if (length >= size) {
return new String(buffer, 0, size);
} else {
return new String(buffer, size - length, length);
}
} | [
"public",
"String",
"rightString",
"(",
"final",
"int",
"length",
")",
"{",
"if",
"(",
"length",
"<=",
"0",
")",
"{",
"return",
"StringUtils",
".",
"EMPTY",
";",
"}",
"else",
"if",
"(",
"length",
">=",
"size",
")",
"{",
"return",
"new",
"String",
"("... | Extracts the rightmost characters from the string builder without
throwing an exception.
<p>
This method extracts the right <code>length</code> characters from
the builder. If this many characters are not available, the whole
builder is returned. Thus the returned string may be shorter than the
length requested.
@param length the number of characters to extract, negative returns empty string
@return the new string | [
"Extracts",
"the",
"rightmost",
"characters",
"from",
"the",
"string",
"builder",
"without",
"throwing",
"an",
"exception",
".",
"<p",
">",
"This",
"method",
"extracts",
"the",
"right",
"<code",
">",
"length<",
"/",
"code",
">",
"characters",
"from",
"the",
... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2318-L2326 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/DataUtil.java | DataUtil.anyValuesInCommon | public static <T> boolean anyValuesInCommon(Collection<T> c1, Collection<T> c2)
{
// Let's always iterate over smaller collection:
if (c1.size() > c2.size()) {
Collection<T> tmp = c1;
c1 = c2;
c2 = tmp;
}
Iterator<T> it = c1.iterator();
while (it.hasNext()) {
if (c2.contains(it.next())) {
return true;
}
}
return false;
} | java | public static <T> boolean anyValuesInCommon(Collection<T> c1, Collection<T> c2)
{
// Let's always iterate over smaller collection:
if (c1.size() > c2.size()) {
Collection<T> tmp = c1;
c1 = c2;
c2 = tmp;
}
Iterator<T> it = c1.iterator();
while (it.hasNext()) {
if (c2.contains(it.next())) {
return true;
}
}
return false;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"anyValuesInCommon",
"(",
"Collection",
"<",
"T",
">",
"c1",
",",
"Collection",
"<",
"T",
">",
"c2",
")",
"{",
"// Let's always iterate over smaller collection:",
"if",
"(",
"c1",
".",
"size",
"(",
")",
">",
"c... | Method that can be used to efficiently check if 2 collections
share at least one common element.
@return True if there is at least one element that's common
to both Collections, ie. that is contained in both of them. | [
"Method",
"that",
"can",
"be",
"used",
"to",
"efficiently",
"check",
"if",
"2",
"collections",
"share",
"at",
"least",
"one",
"common",
"element",
"."
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/DataUtil.java#L83-L98 |
stephenc/simple-java-mail | src/main/java/org/codemonkey/simplejavamail/EmailValidationUtil.java | EmailValidationUtil.isValid | public static boolean isValid(final String email, final EmailAddressValidationCriteria emailAddressValidationCriteria) {
return buildValidEmailPattern(emailAddressValidationCriteria).matcher(email).matches();
} | java | public static boolean isValid(final String email, final EmailAddressValidationCriteria emailAddressValidationCriteria) {
return buildValidEmailPattern(emailAddressValidationCriteria).matcher(email).matches();
} | [
"public",
"static",
"boolean",
"isValid",
"(",
"final",
"String",
"email",
",",
"final",
"EmailAddressValidationCriteria",
"emailAddressValidationCriteria",
")",
"{",
"return",
"buildValidEmailPattern",
"(",
"emailAddressValidationCriteria",
")",
".",
"matcher",
"(",
"ema... | Validates an e-mail with given validation flags.
@param email A complete email address.
@param emailAddressValidationCriteria A set of flags that restrict or relax RFC 2822 compliance.
@return Whether the e-mail address is compliant with RFC 2822, configured using the passed in {@link EmailAddressValidationCriteria}.
@see EmailAddressValidationCriteria#EmailAddressValidationCriteria(boolean, boolean) | [
"Validates",
"an",
"e",
"-",
"mail",
"with",
"given",
"validation",
"flags",
"."
] | train | https://github.com/stephenc/simple-java-mail/blob/8c5897e6bbc23c11e7c7eb5064f407625c653923/src/main/java/org/codemonkey/simplejavamail/EmailValidationUtil.java#L54-L56 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/SPUIComponentProvider.java | SPUIComponentProvider.getHelpLink | public static Link getHelpLink(final VaadinMessageSource i18n, final String uri) {
final Link link = new Link("", new ExternalResource(uri));
link.setTargetName("_blank");
link.setIcon(FontAwesome.QUESTION_CIRCLE);
link.setDescription(i18n.getMessage("tooltip.documentation.link"));
return link;
} | java | public static Link getHelpLink(final VaadinMessageSource i18n, final String uri) {
final Link link = new Link("", new ExternalResource(uri));
link.setTargetName("_blank");
link.setIcon(FontAwesome.QUESTION_CIRCLE);
link.setDescription(i18n.getMessage("tooltip.documentation.link"));
return link;
} | [
"public",
"static",
"Link",
"getHelpLink",
"(",
"final",
"VaadinMessageSource",
"i18n",
",",
"final",
"String",
"uri",
")",
"{",
"final",
"Link",
"link",
"=",
"new",
"Link",
"(",
"\"\"",
",",
"new",
"ExternalResource",
"(",
"uri",
")",
")",
";",
"link",
... | Generates help/documentation links from within management UI.
@param i18n
the i18n
@param uri
to documentation site
@return generated link | [
"Generates",
"help",
"/",
"documentation",
"links",
"from",
"within",
"management",
"UI",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/SPUIComponentProvider.java#L343-L351 |
groovy/groovy-core | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.eachRow | public void eachRow(String sql, Map map, Closure metaClosure, int offset, int maxRows, Closure rowClosure) throws SQLException {
eachRow(sql, singletonList(map), metaClosure, offset, maxRows, rowClosure);
} | java | public void eachRow(String sql, Map map, Closure metaClosure, int offset, int maxRows, Closure rowClosure) throws SQLException {
eachRow(sql, singletonList(map), metaClosure, offset, maxRows, rowClosure);
} | [
"public",
"void",
"eachRow",
"(",
"String",
"sql",
",",
"Map",
"map",
",",
"Closure",
"metaClosure",
",",
"int",
"offset",
",",
"int",
"maxRows",
",",
"Closure",
"rowClosure",
")",
"throws",
"SQLException",
"{",
"eachRow",
"(",
"sql",
",",
"singletonList",
... | A variant of {@link #eachRow(String, java.util.List, groovy.lang.Closure, int, int, groovy.lang.Closure)}
allowing the named parameters to be supplied in a map.
@param sql the sql statement
@param map a map containing the named parameters
@param offset the 1-based offset for the first row to be processed
@param maxRows the maximum number of rows to be processed
@param metaClosure called for meta data (only once after sql execution)
@param rowClosure called for each row with a GroovyResultSet
@throws SQLException if a database access error occurs
@since 1.8.7 | [
"A",
"variant",
"of",
"{",
"@link",
"#eachRow",
"(",
"String",
"java",
".",
"util",
".",
"List",
"groovy",
".",
"lang",
".",
"Closure",
"int",
"int",
"groovy",
".",
"lang",
".",
"Closure",
")",
"}",
"allowing",
"the",
"named",
"parameters",
"to",
"be",... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L1281-L1283 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/block/meta/MasterWorkerInfo.java | MasterWorkerInfo.generateWorkerInfo | public WorkerInfo generateWorkerInfo(Set<WorkerInfoField> fieldRange, boolean isLiveWorker) {
WorkerInfo info = new WorkerInfo();
Set<WorkerInfoField> checkedFieldRange = fieldRange != null ? fieldRange :
new HashSet<>(Arrays.asList(WorkerInfoField.values()));
for (WorkerInfoField field : checkedFieldRange) {
switch (field) {
case ADDRESS:
info.setAddress(mWorkerAddress);
break;
case WORKER_CAPACITY_BYTES:
info.setCapacityBytes(mCapacityBytes);
break;
case WORKER_CAPACITY_BYTES_ON_TIERS:
info.setCapacityBytesOnTiers(mTotalBytesOnTiers);
break;
case ID:
info.setId(mId);
break;
case LAST_CONTACT_SEC:
info.setLastContactSec(
(int) ((CommonUtils.getCurrentMs() - mLastUpdatedTimeMs) / Constants.SECOND_MS));
break;
case START_TIME_MS:
info.setStartTimeMs(mStartTimeMs);
break;
case STATE:
if (isLiveWorker) {
info.setState(LIVE_WORKER_STATE);
} else {
info.setState(LOST_WORKER_STATE);
}
break;
case WORKER_USED_BYTES:
info.setUsedBytes(mUsedBytes);
break;
case WORKER_USED_BYTES_ON_TIERS:
info.setUsedBytesOnTiers(mUsedBytesOnTiers);
break;
default:
LOG.warn("Unrecognized worker info field: " + field);
}
}
return info;
} | java | public WorkerInfo generateWorkerInfo(Set<WorkerInfoField> fieldRange, boolean isLiveWorker) {
WorkerInfo info = new WorkerInfo();
Set<WorkerInfoField> checkedFieldRange = fieldRange != null ? fieldRange :
new HashSet<>(Arrays.asList(WorkerInfoField.values()));
for (WorkerInfoField field : checkedFieldRange) {
switch (field) {
case ADDRESS:
info.setAddress(mWorkerAddress);
break;
case WORKER_CAPACITY_BYTES:
info.setCapacityBytes(mCapacityBytes);
break;
case WORKER_CAPACITY_BYTES_ON_TIERS:
info.setCapacityBytesOnTiers(mTotalBytesOnTiers);
break;
case ID:
info.setId(mId);
break;
case LAST_CONTACT_SEC:
info.setLastContactSec(
(int) ((CommonUtils.getCurrentMs() - mLastUpdatedTimeMs) / Constants.SECOND_MS));
break;
case START_TIME_MS:
info.setStartTimeMs(mStartTimeMs);
break;
case STATE:
if (isLiveWorker) {
info.setState(LIVE_WORKER_STATE);
} else {
info.setState(LOST_WORKER_STATE);
}
break;
case WORKER_USED_BYTES:
info.setUsedBytes(mUsedBytes);
break;
case WORKER_USED_BYTES_ON_TIERS:
info.setUsedBytesOnTiers(mUsedBytesOnTiers);
break;
default:
LOG.warn("Unrecognized worker info field: " + field);
}
}
return info;
} | [
"public",
"WorkerInfo",
"generateWorkerInfo",
"(",
"Set",
"<",
"WorkerInfoField",
">",
"fieldRange",
",",
"boolean",
"isLiveWorker",
")",
"{",
"WorkerInfo",
"info",
"=",
"new",
"WorkerInfo",
"(",
")",
";",
"Set",
"<",
"WorkerInfoField",
">",
"checkedFieldRange",
... | Gets the selected field information for this worker.
@param fieldRange the client selected fields
@param isLiveWorker the worker is live or not
@return generated worker information | [
"Gets",
"the",
"selected",
"field",
"information",
"for",
"this",
"worker",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/block/meta/MasterWorkerInfo.java#L214-L257 |
grpc/grpc-java | okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/ConnectionSpec.java | ConnectionSpec.nonEmptyIntersection | private static boolean nonEmptyIntersection(String[] a, String[] b) {
if (a == null || b == null || a.length == 0 || b.length == 0) {
return false;
}
for (String toFind : a) {
if (contains(b, toFind)) {
return true;
}
}
return false;
} | java | private static boolean nonEmptyIntersection(String[] a, String[] b) {
if (a == null || b == null || a.length == 0 || b.length == 0) {
return false;
}
for (String toFind : a) {
if (contains(b, toFind)) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"nonEmptyIntersection",
"(",
"String",
"[",
"]",
"a",
",",
"String",
"[",
"]",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"null",
"||",
"b",
"==",
"null",
"||",
"a",
".",
"length",
"==",
"0",
"||",
"b",
".",
"length",
"=... | An N*M intersection that terminates if any intersection is found. The sizes of both
arguments are assumed to be so small, and the likelihood of an intersection so great, that it
is not worth the CPU cost of sorting or the memory cost of hashing. | [
"An",
"N",
"*",
"M",
"intersection",
"that",
"terminates",
"if",
"any",
"intersection",
"is",
"found",
".",
"The",
"sizes",
"of",
"both",
"arguments",
"are",
"assumed",
"to",
"be",
"so",
"small",
"and",
"the",
"likelihood",
"of",
"an",
"intersection",
"so"... | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/ConnectionSpec.java#L214-L224 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/panel/PanelRenderer.java | PanelRenderer.encodeEnd | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Panel panel = (Panel) component;
ResponseWriter rw = context.getResponseWriter();
if (panel.isContentDisabled()) {
rw.endElement("fieldset");
}
String clientId = panel.getClientId();
rw.endElement("div"); // panel-body
UIComponent foot = panel.getFacet("footer");
if (foot != null) {
rw.startElement("div", panel); // modal-footer
rw.writeAttribute("class", "panel-footer", "class");
foot.encodeAll(context);
rw.endElement("div"); // panel-footer
}
rw.endElement("div");
rw.endElement("div"); // panel-body
boolean isCollapsible = panel.isCollapsible();
String accordionParent = panel.getAccordionParent();
String responsiveCSS = Responsive.getResponsiveStyleClass(panel, false).trim();
boolean isResponsive = responsiveCSS.length() > 0;
if ((isCollapsible||isResponsive) && null == accordionParent) {
rw.endElement("div");
if (isCollapsible) {
String jQueryClientID = clientId.replace(":", "_");
rw.startElement("input", panel);
rw.writeAttribute("type", "hidden", null);
String hiddenInputFieldID = jQueryClientID + "_collapsed";
rw.writeAttribute("name", hiddenInputFieldID, "name");
rw.writeAttribute("id", hiddenInputFieldID, "id");
rw.writeAttribute("value", String.valueOf(panel.isCollapsed()), "value");
rw.endElement("input");
Map<String, String> eventHandlers = new HashMap<String, String>();
eventHandlers.put("expand", "document.getElementById('" + hiddenInputFieldID
+ "').value='false';");
eventHandlers.put("collapse", "document.getElementById('" + hiddenInputFieldID
+ "').value='true';");
new AJAXRenderer().generateBootsFacesAJAXAndJavaScriptForJQuery(context, component, rw, "#"+jQueryClientID+"content", eventHandlers);
}
}
Tooltip.activateTooltips(context, panel);
} | java | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Panel panel = (Panel) component;
ResponseWriter rw = context.getResponseWriter();
if (panel.isContentDisabled()) {
rw.endElement("fieldset");
}
String clientId = panel.getClientId();
rw.endElement("div"); // panel-body
UIComponent foot = panel.getFacet("footer");
if (foot != null) {
rw.startElement("div", panel); // modal-footer
rw.writeAttribute("class", "panel-footer", "class");
foot.encodeAll(context);
rw.endElement("div"); // panel-footer
}
rw.endElement("div");
rw.endElement("div"); // panel-body
boolean isCollapsible = panel.isCollapsible();
String accordionParent = panel.getAccordionParent();
String responsiveCSS = Responsive.getResponsiveStyleClass(panel, false).trim();
boolean isResponsive = responsiveCSS.length() > 0;
if ((isCollapsible||isResponsive) && null == accordionParent) {
rw.endElement("div");
if (isCollapsible) {
String jQueryClientID = clientId.replace(":", "_");
rw.startElement("input", panel);
rw.writeAttribute("type", "hidden", null);
String hiddenInputFieldID = jQueryClientID + "_collapsed";
rw.writeAttribute("name", hiddenInputFieldID, "name");
rw.writeAttribute("id", hiddenInputFieldID, "id");
rw.writeAttribute("value", String.valueOf(panel.isCollapsed()), "value");
rw.endElement("input");
Map<String, String> eventHandlers = new HashMap<String, String>();
eventHandlers.put("expand", "document.getElementById('" + hiddenInputFieldID
+ "').value='false';");
eventHandlers.put("collapse", "document.getElementById('" + hiddenInputFieldID
+ "').value='true';");
new AJAXRenderer().generateBootsFacesAJAXAndJavaScriptForJQuery(context, component, rw, "#"+jQueryClientID+"content", eventHandlers);
}
}
Tooltip.activateTooltips(context, panel);
} | [
"@",
"Override",
"public",
"void",
"encodeEnd",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"Panel",
"panel",
"=... | This methods generates the HTML code of the current b:panel.
<code>encodeBegin</code> generates the start of the component. After the,
the JSF framework calls <code>encodeChildren()</code> to generate the
HTML code between the beginning and the end of the component. For
instance, in the case of a panel component the content of the panel is
generated by <code>encodeChildren()</code>. After that,
<code>encodeEnd()</code> is called to generate the rest of the HTML code.
@param context
the FacesContext.
@param component
the current b:panel.
@throws IOException
thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"panel",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framework",
... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/panel/PanelRenderer.java#L279-L328 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/bolt/hdfs/HdfsPreProcessor.java | HdfsPreProcessor.renameTmpFile | private static void renameTmpFile(FileSystem hdfs, String targetTmpPath, String tmpSuffix)
{
String basePath = extractBasePath(targetTmpPath, tmpSuffix);
boolean isFileExists = true;
try
{
isFileExists = hdfs.exists(new Path(basePath));
}
catch (IOException ioex)
{
String logFormat = "Failed to search target file exists. Skip file rename. : TargetUri={0}";
String logMessage = MessageFormat.format(logFormat, basePath);
logger.warn(logMessage, ioex);
return;
}
if (isFileExists)
{
String logFormat = "File exists renamed target. Skip file rename. : BeforeUri={0} , AfterUri={1}";
String logMessage = MessageFormat.format(logFormat, targetTmpPath, basePath);
logger.warn(logMessage);
}
else
{
try
{
hdfs.rename(new Path(targetTmpPath), new Path(basePath));
}
catch (IOException ioex)
{
String logFormat = "Failed to HDFS file rename. Skip rename file and continue preprocess. : BeforeUri={0} , AfterUri={1}";
String logMessage = MessageFormat.format(logFormat, targetTmpPath, basePath);
logger.warn(logMessage, ioex);
}
}
} | java | private static void renameTmpFile(FileSystem hdfs, String targetTmpPath, String tmpSuffix)
{
String basePath = extractBasePath(targetTmpPath, tmpSuffix);
boolean isFileExists = true;
try
{
isFileExists = hdfs.exists(new Path(basePath));
}
catch (IOException ioex)
{
String logFormat = "Failed to search target file exists. Skip file rename. : TargetUri={0}";
String logMessage = MessageFormat.format(logFormat, basePath);
logger.warn(logMessage, ioex);
return;
}
if (isFileExists)
{
String logFormat = "File exists renamed target. Skip file rename. : BeforeUri={0} , AfterUri={1}";
String logMessage = MessageFormat.format(logFormat, targetTmpPath, basePath);
logger.warn(logMessage);
}
else
{
try
{
hdfs.rename(new Path(targetTmpPath), new Path(basePath));
}
catch (IOException ioex)
{
String logFormat = "Failed to HDFS file rename. Skip rename file and continue preprocess. : BeforeUri={0} , AfterUri={1}";
String logMessage = MessageFormat.format(logFormat, targetTmpPath, basePath);
logger.warn(logMessage, ioex);
}
}
} | [
"private",
"static",
"void",
"renameTmpFile",
"(",
"FileSystem",
"hdfs",
",",
"String",
"targetTmpPath",
",",
"String",
"tmpSuffix",
")",
"{",
"String",
"basePath",
"=",
"extractBasePath",
"(",
"targetTmpPath",
",",
"tmpSuffix",
")",
";",
"boolean",
"isFileExists"... | 前処理対象ファイルをリネームする。<br>
リネーム先にファイルが存在していた場合はリネームをスキップする。
@param hdfs ファイルシステム
@param targetTmpPath 前処理対象ファイルパス
@param tmpSuffix 一時ファイル名称パターン | [
"前処理対象ファイルをリネームする。<br",
">",
"リネーム先にファイルが存在していた場合はリネームをスキップする。"
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bolt/hdfs/HdfsPreProcessor.java#L120-L157 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.queryString | public String queryString(String sql, Object... params) throws SQLException {
return query(sql, new StringHandler(), params);
} | java | public String queryString(String sql, Object... params) throws SQLException {
return query(sql, new StringHandler(), params);
} | [
"public",
"String",
"queryString",
"(",
"String",
"sql",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"return",
"query",
"(",
"sql",
",",
"new",
"StringHandler",
"(",
")",
",",
"params",
")",
";",
"}"
] | 查询单条单个字段记录,并将其转换为String
@param sql 查询语句
@param params 参数
@return 结果对象
@throws SQLException SQL执行异常 | [
"查询单条单个字段记录",
"并将其转换为String"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L130-L132 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java | GoogleCloudStorageFileSystem.getPath | @Deprecated
public static URI getPath(String bucketName, String objectName, boolean allowEmptyObjectName) {
return LEGACY_PATH_CODEC.getPath(bucketName, objectName, allowEmptyObjectName);
} | java | @Deprecated
public static URI getPath(String bucketName, String objectName, boolean allowEmptyObjectName) {
return LEGACY_PATH_CODEC.getPath(bucketName, objectName, allowEmptyObjectName);
} | [
"@",
"Deprecated",
"public",
"static",
"URI",
"getPath",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
",",
"boolean",
"allowEmptyObjectName",
")",
"{",
"return",
"LEGACY_PATH_CODEC",
".",
"getPath",
"(",
"bucketName",
",",
"objectName",
",",
"allowEmp... | Construct a URI using the legacy path codec.
@deprecated This method is deprecated as each instance of GCS FS can be configured
with a codec. | [
"Construct",
"a",
"URI",
"using",
"the",
"legacy",
"path",
"codec",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java#L1547-L1550 |
ebean-orm/ebean-mocker | src/main/java/io/ebean/MockiEbean.java | MockiEbean.runWithMock | public static <V> V runWithMock(EbeanServer mock, Callable<V> test) throws Exception {
return start(mock).run(test);
} | java | public static <V> V runWithMock(EbeanServer mock, Callable<V> test) throws Exception {
return start(mock).run(test);
} | [
"public",
"static",
"<",
"V",
">",
"V",
"runWithMock",
"(",
"EbeanServer",
"mock",
",",
"Callable",
"<",
"V",
">",
"test",
")",
"throws",
"Exception",
"{",
"return",
"start",
"(",
"mock",
")",
".",
"run",
"(",
"test",
")",
";",
"}"
] | Run the test runnable using the mock EbeanServer and restoring the original EbeanServer afterward.
@param mock the mock instance that becomes the default EbeanServer
@param test typically some test code as a callable | [
"Run",
"the",
"test",
"runnable",
"using",
"the",
"mock",
"EbeanServer",
"and",
"restoring",
"the",
"original",
"EbeanServer",
"afterward",
"."
] | train | https://github.com/ebean-orm/ebean-mocker/blob/98c14a58253e8cd40b2a0c9b49526a307079389a/src/main/java/io/ebean/MockiEbean.java#L107-L110 |
google/closure-compiler | src/com/google/javascript/jscomp/AbstractCommandLineRunner.java | AbstractCommandLineRunner.outputSourceMap | @GwtIncompatible("Unnecessary")
private void outputSourceMap(B options, String associatedName) throws IOException {
if (Strings.isNullOrEmpty(options.sourceMapOutputPath)
|| options.sourceMapOutputPath.equals("/dev/null")) {
return;
}
String outName = expandSourceMapPath(options, null);
maybeCreateDirsForPath(outName);
try (Writer out = fileNameToOutputWriter2(outName)) {
compiler.getSourceMap().appendTo(out, associatedName);
}
} | java | @GwtIncompatible("Unnecessary")
private void outputSourceMap(B options, String associatedName) throws IOException {
if (Strings.isNullOrEmpty(options.sourceMapOutputPath)
|| options.sourceMapOutputPath.equals("/dev/null")) {
return;
}
String outName = expandSourceMapPath(options, null);
maybeCreateDirsForPath(outName);
try (Writer out = fileNameToOutputWriter2(outName)) {
compiler.getSourceMap().appendTo(out, associatedName);
}
} | [
"@",
"GwtIncompatible",
"(",
"\"Unnecessary\"",
")",
"private",
"void",
"outputSourceMap",
"(",
"B",
"options",
",",
"String",
"associatedName",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"options",
".",
"sourceMapOutputPat... | Outputs the source map found in the compiler to the proper path if one exists.
@param options The options to the Compiler. | [
"Outputs",
"the",
"source",
"map",
"found",
"in",
"the",
"compiler",
"to",
"the",
"proper",
"path",
"if",
"one",
"exists",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractCommandLineRunner.java#L1776-L1788 |
meltmedia/cadmium | cli/src/main/java/com/meltmedia/cadmium/cli/AuthCommand.java | AuthCommand.sendRequest | private void sendRequest(HttpUriRequest request, int expectedStatus)
throws Exception {
addAuthHeader(request);
HttpClient client = httpClient();
HttpResponse response = client.execute(request);
if(response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_FOUND) {
EntityUtils.consume(response.getEntity());
System.err.println("Authentication has been disabled for "+args.get(1)+".");
} else if(response.getStatusLine().getStatusCode() == expectedStatus) {
if(expectedStatus == HttpStatus.SC_OK) {
String responseStr = EntityUtils.toString(response.getEntity());
List<String> usernames = new Gson().fromJson(responseStr, new TypeToken<List<String>>(){}.getType());
if(usernames == null || usernames.isEmpty()) {
System.out.println("There have been no site specific users created.");
} else {
System.out.println(usernames.size() + " Users:");
for(String user : usernames) {
System.out.println(user);
}
}
}
} else {
System.err.println(EntityUtils.toString(response.getEntity()));
System.err.println("Unexpected status code returned. "+response.getStatusLine().getStatusCode());
}
} | java | private void sendRequest(HttpUriRequest request, int expectedStatus)
throws Exception {
addAuthHeader(request);
HttpClient client = httpClient();
HttpResponse response = client.execute(request);
if(response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_FOUND) {
EntityUtils.consume(response.getEntity());
System.err.println("Authentication has been disabled for "+args.get(1)+".");
} else if(response.getStatusLine().getStatusCode() == expectedStatus) {
if(expectedStatus == HttpStatus.SC_OK) {
String responseStr = EntityUtils.toString(response.getEntity());
List<String> usernames = new Gson().fromJson(responseStr, new TypeToken<List<String>>(){}.getType());
if(usernames == null || usernames.isEmpty()) {
System.out.println("There have been no site specific users created.");
} else {
System.out.println(usernames.size() + " Users:");
for(String user : usernames) {
System.out.println(user);
}
}
}
} else {
System.err.println(EntityUtils.toString(response.getEntity()));
System.err.println("Unexpected status code returned. "+response.getStatusLine().getStatusCode());
}
} | [
"private",
"void",
"sendRequest",
"(",
"HttpUriRequest",
"request",
",",
"int",
"expectedStatus",
")",
"throws",
"Exception",
"{",
"addAuthHeader",
"(",
"request",
")",
";",
"HttpClient",
"client",
"=",
"httpClient",
"(",
")",
";",
"HttpResponse",
"response",
"=... | Sends a request to the rest endpoint.
@param request
@param expectedStatus
@throws KeyManagementException
@throws UnrecoverableKeyException
@throws NoSuchAlgorithmException
@throws KeyStoreException
@throws IOException
@throws ClientProtocolException | [
"Sends",
"a",
"request",
"to",
"the",
"rest",
"endpoint",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/AuthCommand.java#L121-L148 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Vector3dfx.java | Vector3dfx.lengthSquaredProperty | public ReadOnlyDoubleProperty lengthSquaredProperty() {
if (this.lengthSquareProperty == null) {
this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED);
this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() ->
Vector3dfx.this.x.doubleValue() * Vector3dfx.this.x.doubleValue()
+ Vector3dfx.this.y.doubleValue() * Vector3dfx.this.y.doubleValue()
+ Vector3dfx.this.z.doubleValue() * Vector3dfx.this.z.doubleValue(), this.x, this.y, this.z));
}
return this.lengthSquareProperty.getReadOnlyProperty();
} | java | public ReadOnlyDoubleProperty lengthSquaredProperty() {
if (this.lengthSquareProperty == null) {
this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED);
this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() ->
Vector3dfx.this.x.doubleValue() * Vector3dfx.this.x.doubleValue()
+ Vector3dfx.this.y.doubleValue() * Vector3dfx.this.y.doubleValue()
+ Vector3dfx.this.z.doubleValue() * Vector3dfx.this.z.doubleValue(), this.x, this.y, this.z));
}
return this.lengthSquareProperty.getReadOnlyProperty();
} | [
"public",
"ReadOnlyDoubleProperty",
"lengthSquaredProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"lengthSquareProperty",
"==",
"null",
")",
"{",
"this",
".",
"lengthSquareProperty",
"=",
"new",
"ReadOnlyDoubleWrapper",
"(",
"this",
",",
"MathFXAttributeNames",
".... | Replies the property that represents the length of the vector.
@return the length property | [
"Replies",
"the",
"property",
"that",
"represents",
"the",
"length",
"of",
"the",
"vector",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Vector3dfx.java#L180-L189 |
kaazing/gateway | server/src/main/java/org/kaazing/gateway/server/impl/GatewayCreatorImpl.java | GatewayCreatorImpl.configureGateway | @Override
public void configureGateway(Gateway gateway) {
Properties properties = new Properties();
properties.putAll(System.getProperties());
String gatewayHome = properties.getProperty(Gateway.GATEWAY_HOME_PROPERTY);
if ((gatewayHome == null) || "".equals(gatewayHome)) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL classUrl = loader.getResource("org/kaazing/gateway/server/Gateway.class");
String urlStr;
try {
urlStr = URLDecoder.decode(classUrl.toString(), "UTF-8");
} catch (UnsupportedEncodingException ex) {
// it's not likely that UTF-8 will be unsupported, so in practice this will never occur
throw new RuntimeException("Failed to configure Gateway", ex);
}
// The URL is coming from a JAR file. The format of that is supposed to be
// jar:<url>!/<packagepath>. Normally the first part of the <url> section will be
// 'file:', but could be different if somehow the JAR is loaded from the network.
// We can only handle the 'file' case, so will check.
int packageSeparatorIndex = urlStr.indexOf("!/");
if (packageSeparatorIndex > 0) {
urlStr = urlStr.substring(0, urlStr.indexOf("!/"));
urlStr = urlStr.substring(4); // remove the 'jar:' part.
}
if (!urlStr.startsWith("file:")) {
throw new RuntimeException("The Gateway class was not loaded from a file, so we " +
"cannot determine the location of GATEWAY_HOME");
}
urlStr = urlStr.substring(5); // remove the 'file:' stuff.
File jarFile = new File(urlStr);
gatewayHome = jarFile.getParentFile().getParent();
properties.setProperty("GATEWAY_HOME", gatewayHome);
}
gateway.setProperties(properties);
} | java | @Override
public void configureGateway(Gateway gateway) {
Properties properties = new Properties();
properties.putAll(System.getProperties());
String gatewayHome = properties.getProperty(Gateway.GATEWAY_HOME_PROPERTY);
if ((gatewayHome == null) || "".equals(gatewayHome)) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL classUrl = loader.getResource("org/kaazing/gateway/server/Gateway.class");
String urlStr;
try {
urlStr = URLDecoder.decode(classUrl.toString(), "UTF-8");
} catch (UnsupportedEncodingException ex) {
// it's not likely that UTF-8 will be unsupported, so in practice this will never occur
throw new RuntimeException("Failed to configure Gateway", ex);
}
// The URL is coming from a JAR file. The format of that is supposed to be
// jar:<url>!/<packagepath>. Normally the first part of the <url> section will be
// 'file:', but could be different if somehow the JAR is loaded from the network.
// We can only handle the 'file' case, so will check.
int packageSeparatorIndex = urlStr.indexOf("!/");
if (packageSeparatorIndex > 0) {
urlStr = urlStr.substring(0, urlStr.indexOf("!/"));
urlStr = urlStr.substring(4); // remove the 'jar:' part.
}
if (!urlStr.startsWith("file:")) {
throw new RuntimeException("The Gateway class was not loaded from a file, so we " +
"cannot determine the location of GATEWAY_HOME");
}
urlStr = urlStr.substring(5); // remove the 'file:' stuff.
File jarFile = new File(urlStr);
gatewayHome = jarFile.getParentFile().getParent();
properties.setProperty("GATEWAY_HOME", gatewayHome);
}
gateway.setProperties(properties);
} | [
"@",
"Override",
"public",
"void",
"configureGateway",
"(",
"Gateway",
"gateway",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"putAll",
"(",
"System",
".",
"getProperties",
"(",
")",
")",
";",
"String",
... | Bootstrap the Gateway instance with a GATEWAY_HOME if not already set in System properties. | [
"Bootstrap",
"the",
"Gateway",
"instance",
"with",
"a",
"GATEWAY_HOME",
"if",
"not",
"already",
"set",
"in",
"System",
"properties",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/impl/GatewayCreatorImpl.java#L38-L77 |
jclawson/dropwizardry | dropwizardry-config-hocon/src/main/java/io/dropwizard/configuration/HoconConfigurationFactory.java | HoconConfigurationFactory.build | public T build(ConfigurationSourceProvider provider, String path) throws IOException, ConfigurationException {
try (InputStream input = provider.open(checkNotNull(path))) {
final JsonNode node = mapper.readTree(hoconFactory.createParser(input));
return build(node, path);
} catch (ConfigException e) {
ConfigurationParsingException.Builder builder = ConfigurationParsingException
.builder("Malformed HOCON")
.setCause(e)
.setDetail(e.getMessage());
ConfigOrigin origin = e.origin();
if (origin != null) {
builder.setLocation(origin.lineNumber(), 0);
}
throw builder.build(path);
}
} | java | public T build(ConfigurationSourceProvider provider, String path) throws IOException, ConfigurationException {
try (InputStream input = provider.open(checkNotNull(path))) {
final JsonNode node = mapper.readTree(hoconFactory.createParser(input));
return build(node, path);
} catch (ConfigException e) {
ConfigurationParsingException.Builder builder = ConfigurationParsingException
.builder("Malformed HOCON")
.setCause(e)
.setDetail(e.getMessage());
ConfigOrigin origin = e.origin();
if (origin != null) {
builder.setLocation(origin.lineNumber(), 0);
}
throw builder.build(path);
}
} | [
"public",
"T",
"build",
"(",
"ConfigurationSourceProvider",
"provider",
",",
"String",
"path",
")",
"throws",
"IOException",
",",
"ConfigurationException",
"{",
"try",
"(",
"InputStream",
"input",
"=",
"provider",
".",
"open",
"(",
"checkNotNull",
"(",
"path",
"... | Loads, parses, binds, and validates a configuration object.
@param provider the provider to to use for reading configuration files
@param path the path of the configuration file
@return a validated configuration object
@throws IOException if there is an error reading the file
@throws ConfigurationException if there is an error parsing or validating the file | [
"Loads",
"parses",
"binds",
"and",
"validates",
"a",
"configuration",
"object",
"."
] | train | https://github.com/jclawson/dropwizardry/blob/3dd95da764ddd63d8959792942ce29becf43f80b/dropwizardry-config-hocon/src/main/java/io/dropwizard/configuration/HoconConfigurationFactory.java#L81-L97 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java | TypeExtractionUtils.extractTypeArgument | public static Type extractTypeArgument(Type t, int index) throws InvalidTypesException {
if (t instanceof ParameterizedType) {
Type[] actualTypeArguments = ((ParameterizedType) t).getActualTypeArguments();
if (index < 0 || index >= actualTypeArguments.length) {
throw new InvalidTypesException("Cannot extract the type argument with index " +
index + " because the type has only " + actualTypeArguments.length +
" type arguments.");
} else {
return actualTypeArguments[index];
}
} else {
throw new InvalidTypesException("The given type " + t + " is not a parameterized type.");
}
} | java | public static Type extractTypeArgument(Type t, int index) throws InvalidTypesException {
if (t instanceof ParameterizedType) {
Type[] actualTypeArguments = ((ParameterizedType) t).getActualTypeArguments();
if (index < 0 || index >= actualTypeArguments.length) {
throw new InvalidTypesException("Cannot extract the type argument with index " +
index + " because the type has only " + actualTypeArguments.length +
" type arguments.");
} else {
return actualTypeArguments[index];
}
} else {
throw new InvalidTypesException("The given type " + t + " is not a parameterized type.");
}
} | [
"public",
"static",
"Type",
"extractTypeArgument",
"(",
"Type",
"t",
",",
"int",
"index",
")",
"throws",
"InvalidTypesException",
"{",
"if",
"(",
"t",
"instanceof",
"ParameterizedType",
")",
"{",
"Type",
"[",
"]",
"actualTypeArguments",
"=",
"(",
"(",
"Paramet... | This method extracts the n-th type argument from the given type. An InvalidTypesException
is thrown if the type does not have any type arguments or if the index exceeds the number
of type arguments.
@param t Type to extract the type arguments from
@param index Index of the type argument to extract
@return The extracted type argument
@throws InvalidTypesException if the given type does not have any type arguments or if the
index exceeds the number of type arguments. | [
"This",
"method",
"extracts",
"the",
"n",
"-",
"th",
"type",
"argument",
"from",
"the",
"given",
"type",
".",
"An",
"InvalidTypesException",
"is",
"thrown",
"if",
"the",
"type",
"does",
"not",
"have",
"any",
"type",
"arguments",
"or",
"if",
"the",
"index",... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java#L194-L208 |
JodaOrg/joda-time | src/main/java/org/joda/time/field/UnsupportedDateTimeField.java | UnsupportedDateTimeField.getInstance | public static synchronized UnsupportedDateTimeField getInstance(
DateTimeFieldType type, DurationField durationField) {
UnsupportedDateTimeField field;
if (cCache == null) {
cCache = new HashMap<DateTimeFieldType, UnsupportedDateTimeField>(7);
field = null;
} else {
field = cCache.get(type);
if (field != null && field.getDurationField() != durationField) {
field = null;
}
}
if (field == null) {
field = new UnsupportedDateTimeField(type, durationField);
cCache.put(type, field);
}
return field;
} | java | public static synchronized UnsupportedDateTimeField getInstance(
DateTimeFieldType type, DurationField durationField) {
UnsupportedDateTimeField field;
if (cCache == null) {
cCache = new HashMap<DateTimeFieldType, UnsupportedDateTimeField>(7);
field = null;
} else {
field = cCache.get(type);
if (field != null && field.getDurationField() != durationField) {
field = null;
}
}
if (field == null) {
field = new UnsupportedDateTimeField(type, durationField);
cCache.put(type, field);
}
return field;
} | [
"public",
"static",
"synchronized",
"UnsupportedDateTimeField",
"getInstance",
"(",
"DateTimeFieldType",
"type",
",",
"DurationField",
"durationField",
")",
"{",
"UnsupportedDateTimeField",
"field",
";",
"if",
"(",
"cCache",
"==",
"null",
")",
"{",
"cCache",
"=",
"n... | Gets an instance of UnsupportedDateTimeField for a specific named field.
Names should be of standard format, such as 'monthOfYear' or 'hourOfDay'.
The returned instance is cached.
@param type the type to obtain
@return the instance
@throws IllegalArgumentException if durationField is null | [
"Gets",
"an",
"instance",
"of",
"UnsupportedDateTimeField",
"for",
"a",
"specific",
"named",
"field",
".",
"Names",
"should",
"be",
"of",
"standard",
"format",
"such",
"as",
"monthOfYear",
"or",
"hourOfDay",
".",
"The",
"returned",
"instance",
"is",
"cached",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/UnsupportedDateTimeField.java#L51-L69 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java | CloudMe.getBasicRequestInvoker | private RequestInvoker<CResponse> getBasicRequestInvoker( HttpRequestBase request, CPath path )
{
return new RequestInvoker<CResponse>( new HttpRequestor( request, path, sessionManager ),
BASIC_RESPONSE_VALIDATOR );
} | java | private RequestInvoker<CResponse> getBasicRequestInvoker( HttpRequestBase request, CPath path )
{
return new RequestInvoker<CResponse>( new HttpRequestor( request, path, sessionManager ),
BASIC_RESPONSE_VALIDATOR );
} | [
"private",
"RequestInvoker",
"<",
"CResponse",
">",
"getBasicRequestInvoker",
"(",
"HttpRequestBase",
"request",
",",
"CPath",
"path",
")",
"{",
"return",
"new",
"RequestInvoker",
"<",
"CResponse",
">",
"(",
"new",
"HttpRequestor",
"(",
"request",
",",
"path",
"... | An invoker that does not check response content type : to be used for files downloading
@param request Http request
@return the request invoker for basic requests | [
"An",
"invoker",
"that",
"does",
"not",
"check",
"response",
"content",
"type",
":",
"to",
"be",
"used",
"for",
"files",
"downloading"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java#L129-L133 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.newMap | @SuppressWarnings("unchecked")
public static <T extends Map<?, ?>> T newMap(Type type)
{
Class<?> implementation = MAPS.get(type);
if(implementation == null) {
throw new BugError("No registered implementation for map |%s|.", type);
}
return (T)newInstance(implementation);
} | java | @SuppressWarnings("unchecked")
public static <T extends Map<?, ?>> T newMap(Type type)
{
Class<?> implementation = MAPS.get(type);
if(implementation == null) {
throw new BugError("No registered implementation for map |%s|.", type);
}
return (T)newInstance(implementation);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Map",
"<",
"?",
",",
"?",
">",
">",
"T",
"newMap",
"(",
"Type",
"type",
")",
"{",
"Class",
"<",
"?",
">",
"implementation",
"=",
"MAPS",
".",
"get",
"(",
... | Create new map of given type.
@param type map type.
@param <T> map type.
@return newly created map. | [
"Create",
"new",
"map",
"of",
"given",
"type",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1544-L1552 |
LearnLib/automatalib | commons/smartcollections/src/main/java/net/automatalib/commons/smartcollections/AbstractLinkedList.java | AbstractLinkedList.insertBeforeEntry | protected void insertBeforeEntry(T e, T insertPos) {
T oldPrev = insertPos.getPrev();
e.setNext(insertPos);
e.setPrev(oldPrev);
insertPos.setPrev(e);
if (oldPrev != null) {
oldPrev.setNext(e);
} else {
head = e;
}
size++;
} | java | protected void insertBeforeEntry(T e, T insertPos) {
T oldPrev = insertPos.getPrev();
e.setNext(insertPos);
e.setPrev(oldPrev);
insertPos.setPrev(e);
if (oldPrev != null) {
oldPrev.setNext(e);
} else {
head = e;
}
size++;
} | [
"protected",
"void",
"insertBeforeEntry",
"(",
"T",
"e",
",",
"T",
"insertPos",
")",
"{",
"T",
"oldPrev",
"=",
"insertPos",
".",
"getPrev",
"(",
")",
";",
"e",
".",
"setNext",
"(",
"insertPos",
")",
";",
"e",
".",
"setPrev",
"(",
"oldPrev",
")",
";",... | Inserts a new entry <i>before</i> a given one.
@param e
the entry to add.
@param insertPos
the entry before which to add the new one. | [
"Inserts",
"a",
"new",
"entry",
"<i",
">",
"before<",
"/",
"i",
">",
"a",
"given",
"one",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/smartcollections/src/main/java/net/automatalib/commons/smartcollections/AbstractLinkedList.java#L433-L444 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/platforms/WindowsPlatform.java | WindowsPlatform.encodeVersion | private static void encodeVersion(final StringBuffer buf, final short[] version) {
for (int i = 0; i < 3; i++) {
buf.append(Short.toString(version[i]));
buf.append(',');
}
buf.append(Short.toString(version[3]));
} | java | private static void encodeVersion(final StringBuffer buf, final short[] version) {
for (int i = 0; i < 3; i++) {
buf.append(Short.toString(version[i]));
buf.append(',');
}
buf.append(Short.toString(version[3]));
} | [
"private",
"static",
"void",
"encodeVersion",
"(",
"final",
"StringBuffer",
"buf",
",",
"final",
"short",
"[",
"]",
"version",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"3",
";",
"i",
"++",
")",
"{",
"buf",
".",
"append",
"(",
"S... | Converts parsed version information into a string representation.
@param buf
StringBuffer string buffer to receive version number
@param version
short[] four-element array | [
"Converts",
"parsed",
"version",
"information",
"into",
"a",
"string",
"representation",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/platforms/WindowsPlatform.java#L128-L134 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/reporting/ReportGenerator.java | ReportGenerator.processTemplate | @SuppressFBWarnings(justification = "try with resources will clean up the output stream", value = {"OBL_UNSATISFIED_OBLIGATION"})
protected void processTemplate(String template, File file) throws ReportException {
ensureParentDirectoryExists(file);
try (OutputStream output = new FileOutputStream(file)) {
processTemplate(template, output);
} catch (IOException ex) {
throw new ReportException(String.format("Unable to write to file: %s", file), ex);
}
} | java | @SuppressFBWarnings(justification = "try with resources will clean up the output stream", value = {"OBL_UNSATISFIED_OBLIGATION"})
protected void processTemplate(String template, File file) throws ReportException {
ensureParentDirectoryExists(file);
try (OutputStream output = new FileOutputStream(file)) {
processTemplate(template, output);
} catch (IOException ex) {
throw new ReportException(String.format("Unable to write to file: %s", file), ex);
}
} | [
"@",
"SuppressFBWarnings",
"(",
"justification",
"=",
"\"try with resources will clean up the output stream\"",
",",
"value",
"=",
"{",
"\"OBL_UNSATISFIED_OBLIGATION\"",
"}",
")",
"protected",
"void",
"processTemplate",
"(",
"String",
"template",
",",
"File",
"file",
")",... | Generates a report from a given Velocity Template. The template name
provided can be the name of a template contained in the jar file, such as
'XmlReport' or 'HtmlReport', or the template name can be the path to a
template file.
@param template the name of the template to load
@param file the output file to write the report to
@throws ReportException is thrown when the report cannot be generated | [
"Generates",
"a",
"report",
"from",
"a",
"given",
"Velocity",
"Template",
".",
"The",
"template",
"name",
"provided",
"can",
"be",
"the",
"name",
"of",
"a",
"template",
"contained",
"in",
"the",
"jar",
"file",
"such",
"as",
"XmlReport",
"or",
"HtmlReport",
... | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/reporting/ReportGenerator.java#L309-L317 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.setCharAt | public StrBuilder setCharAt(final int index, final char ch) {
if (index < 0 || index >= length()) {
throw new StringIndexOutOfBoundsException(index);
}
buffer[index] = ch;
return this;
} | java | public StrBuilder setCharAt(final int index, final char ch) {
if (index < 0 || index >= length()) {
throw new StringIndexOutOfBoundsException(index);
}
buffer[index] = ch;
return this;
} | [
"public",
"StrBuilder",
"setCharAt",
"(",
"final",
"int",
"index",
",",
"final",
"char",
"ch",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"length",
"(",
")",
")",
"{",
"throw",
"new",
"StringIndexOutOfBoundsException",
"(",
"index",
")"... | Sets the character at the specified index.
@see #charAt(int)
@see #deleteCharAt(int)
@param index the index to set
@param ch the new character
@return this, to enable chaining
@throws IndexOutOfBoundsException if the index is invalid | [
"Sets",
"the",
"character",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L333-L339 |
facebookarchive/hadoop-20 | src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java | PersistentState.getState | public static ParseState getState(String fname) {
String [] fields = persData.getProperty(fname, "null" + SEPARATOR + "0").split(SEPARATOR, 2);
String firstLine;
long offset;
if (fields.length < 2) {
System.err.println("Malformed persistent state data found");
Environment.logInfo("Malformed persistent state data found");
firstLine = null;
offset = 0;
} else {
firstLine = (fields[0].equals("null") ? null : fields[0]);
offset = Long.parseLong(fields[1]);
}
return new ParseState(fname, firstLine, offset);
} | java | public static ParseState getState(String fname) {
String [] fields = persData.getProperty(fname, "null" + SEPARATOR + "0").split(SEPARATOR, 2);
String firstLine;
long offset;
if (fields.length < 2) {
System.err.println("Malformed persistent state data found");
Environment.logInfo("Malformed persistent state data found");
firstLine = null;
offset = 0;
} else {
firstLine = (fields[0].equals("null") ? null : fields[0]);
offset = Long.parseLong(fields[1]);
}
return new ParseState(fname, firstLine, offset);
} | [
"public",
"static",
"ParseState",
"getState",
"(",
"String",
"fname",
")",
"{",
"String",
"[",
"]",
"fields",
"=",
"persData",
".",
"getProperty",
"(",
"fname",
",",
"\"null\"",
"+",
"SEPARATOR",
"+",
"\"0\"",
")",
".",
"split",
"(",
"SEPARATOR",
",",
"2... | Read and return the state of parsing for a particular log file.
@param fname the log file for which to read the state | [
"Read",
"and",
"return",
"the",
"state",
"of",
"parsing",
"for",
"a",
"particular",
"log",
"file",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java#L76-L92 |
alamkanak/Android-Week-View | library/src/main/java/com/alamkanak/weekview/WeekView.java | WeekView.cacheEvent | private void cacheEvent(WeekViewEvent event) {
if(event.getStartTime().compareTo(event.getEndTime()) >= 0)
return;
List<WeekViewEvent> splitedEvents = event.splitWeekViewEvents();
for(WeekViewEvent splitedEvent: splitedEvents){
mEventRects.add(new EventRect(splitedEvent, event, null));
}
} | java | private void cacheEvent(WeekViewEvent event) {
if(event.getStartTime().compareTo(event.getEndTime()) >= 0)
return;
List<WeekViewEvent> splitedEvents = event.splitWeekViewEvents();
for(WeekViewEvent splitedEvent: splitedEvents){
mEventRects.add(new EventRect(splitedEvent, event, null));
}
} | [
"private",
"void",
"cacheEvent",
"(",
"WeekViewEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getStartTime",
"(",
")",
".",
"compareTo",
"(",
"event",
".",
"getEndTime",
"(",
")",
")",
">=",
"0",
")",
"return",
";",
"List",
"<",
"WeekViewEvent",
... | Cache the event for smooth scrolling functionality.
@param event The event to cache. | [
"Cache",
"the",
"event",
"for",
"smooth",
"scrolling",
"functionality",
"."
] | train | https://github.com/alamkanak/Android-Week-View/blob/dc3f97d65d44785d1a761b52b58527c86c4eee1b/library/src/main/java/com/alamkanak/weekview/WeekView.java#L1053-L1060 |
opentable/otj-logging | core/src/main/java/com/opentable/logging/LogMetadata.java | LogMetadata.and | public LogMetadata and(String key, Object value) {
metadata.put(key, value);
return this;
} | java | public LogMetadata and(String key, Object value) {
metadata.put(key, value);
return this;
} | [
"public",
"LogMetadata",
"and",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"metadata",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Extend a metadata marker with another key-value pair.
@param key the key to add
@param value the value for the key | [
"Extend",
"a",
"metadata",
"marker",
"with",
"another",
"key",
"-",
"value",
"pair",
"."
] | train | https://github.com/opentable/otj-logging/blob/eaa74c877c4721ddb9af8eb7fe1612166f7ac14d/core/src/main/java/com/opentable/logging/LogMetadata.java#L66-L69 |
HeidelTime/heideltime | src/de/unihd/dbs/uima/annotator/heideltime/resources/RePatternManager.java | RePatternManager.finalizeRePattern | private void finalizeRePattern(String name, String rePattern) {
// create correct regular expression
rePattern = rePattern.replaceFirst("\\|", "");
/* this was added to reduce the danger of getting unusable groups from user-made repattern
* files with group-producing parentheses (i.e. "(foo|bar)" while matching against the documents. */
rePattern = rePattern.replaceAll("\\(([^\\?])", "(?:$1");
rePattern = "(" + rePattern + ")";
rePattern = rePattern.replaceAll("\\\\", "\\\\\\\\");
// add rePattern to hmAllRePattern
hmAllRePattern.put(name, rePattern);
} | java | private void finalizeRePattern(String name, String rePattern) {
// create correct regular expression
rePattern = rePattern.replaceFirst("\\|", "");
/* this was added to reduce the danger of getting unusable groups from user-made repattern
* files with group-producing parentheses (i.e. "(foo|bar)" while matching against the documents. */
rePattern = rePattern.replaceAll("\\(([^\\?])", "(?:$1");
rePattern = "(" + rePattern + ")";
rePattern = rePattern.replaceAll("\\\\", "\\\\\\\\");
// add rePattern to hmAllRePattern
hmAllRePattern.put(name, rePattern);
} | [
"private",
"void",
"finalizeRePattern",
"(",
"String",
"name",
",",
"String",
"rePattern",
")",
"{",
"// create correct regular expression",
"rePattern",
"=",
"rePattern",
".",
"replaceFirst",
"(",
"\"\\\\|\"",
",",
"\"\"",
")",
";",
"/* this was added to reduce the dan... | Pattern containing regular expression is finalized, i.e., created correctly and added to hmAllRePattern.
@param name key name
@param rePattern repattern value | [
"Pattern",
"containing",
"regular",
"expression",
"is",
"finalized",
"i",
".",
"e",
".",
"created",
"correctly",
"and",
"added",
"to",
"hmAllRePattern",
"."
] | train | https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/annotator/heideltime/resources/RePatternManager.java#L164-L174 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java | OmemoManager.trustOmemoIdentity | public void trustOmemoIdentity(OmemoDevice device, OmemoFingerprint fingerprint) {
if (trustCallback == null) {
throw new IllegalStateException("No TrustCallback set.");
}
trustCallback.setTrust(device, fingerprint, TrustState.trusted);
} | java | public void trustOmemoIdentity(OmemoDevice device, OmemoFingerprint fingerprint) {
if (trustCallback == null) {
throw new IllegalStateException("No TrustCallback set.");
}
trustCallback.setTrust(device, fingerprint, TrustState.trusted);
} | [
"public",
"void",
"trustOmemoIdentity",
"(",
"OmemoDevice",
"device",
",",
"OmemoFingerprint",
"fingerprint",
")",
"{",
"if",
"(",
"trustCallback",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No TrustCallback set.\"",
")",
";",
"}",
"t... | Trust that a fingerprint belongs to an OmemoDevice.
The fingerprint must be the lowercase, hexadecimal fingerprint of the identityKey of the device and must
be of length 64.
@param device device
@param fingerprint fingerprint | [
"Trust",
"that",
"a",
"fingerprint",
"belongs",
"to",
"an",
"OmemoDevice",
".",
"The",
"fingerprint",
"must",
"be",
"the",
"lowercase",
"hexadecimal",
"fingerprint",
"of",
"the",
"identityKey",
"of",
"the",
"device",
"and",
"must",
"be",
"of",
"length",
"64",
... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java#L420-L426 |
dwdyer/uncommons-maths | demo/src/java/main/org/uncommons/maths/demo/BinomialDistribution.java | BinomialDistribution.getExpectedProbability | private double getExpectedProbability(int successes)
{
double prob = Math.pow(p, successes) * Math.pow(1 - p, n - successes);
BigDecimal coefficient = new BigDecimal(binomialCoefficient(n, successes));
return coefficient.multiply(new BigDecimal(prob)).doubleValue();
} | java | private double getExpectedProbability(int successes)
{
double prob = Math.pow(p, successes) * Math.pow(1 - p, n - successes);
BigDecimal coefficient = new BigDecimal(binomialCoefficient(n, successes));
return coefficient.multiply(new BigDecimal(prob)).doubleValue();
} | [
"private",
"double",
"getExpectedProbability",
"(",
"int",
"successes",
")",
"{",
"double",
"prob",
"=",
"Math",
".",
"pow",
"(",
"p",
",",
"successes",
")",
"*",
"Math",
".",
"pow",
"(",
"1",
"-",
"p",
",",
"n",
"-",
"successes",
")",
";",
"BigDecim... | This is the probability mass function
(http://en.wikipedia.org/wiki/Probability_mass_function) of
the Binomial distribution represented by this number generator.
@param successes The number of successful trials to determine
the probability for.
@return The probability of obtaining the specified number of
successful trials given the current values of n and p. | [
"This",
"is",
"the",
"probability",
"mass",
"function",
"(",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Probability_mass_function",
")",
"of",
"the",
"Binomial",
"distribution",
"represented",
"by",
"this",
"number",
"generator",... | train | https://github.com/dwdyer/uncommons-maths/blob/b7ba13aea70625bb7f37c856783a29e17e354964/demo/src/java/main/org/uncommons/maths/demo/BinomialDistribution.java#L62-L67 |
rzwitserloot/lombok | src/core/lombok/javac/handlers/JavacHandlerUtil.java | JavacHandlerUtil.chainDots | public static JCExpression chainDots(JavacNode node, String elem1, String elem2, String... elems) {
return chainDots(node, -1, elem1, elem2, elems);
} | java | public static JCExpression chainDots(JavacNode node, String elem1, String elem2, String... elems) {
return chainDots(node, -1, elem1, elem2, elems);
} | [
"public",
"static",
"JCExpression",
"chainDots",
"(",
"JavacNode",
"node",
",",
"String",
"elem1",
",",
"String",
"elem2",
",",
"String",
"...",
"elems",
")",
"{",
"return",
"chainDots",
"(",
"node",
",",
"-",
"1",
",",
"elem1",
",",
"elem2",
",",
"elems... | In javac, dotted access of any kind, from {@code java.lang.String} to {@code var.methodName}
is represented by a fold-left of {@code Select} nodes with the leftmost string represented by
a {@code Ident} node. This method generates such an expression.
<p>
The position of the generated node(s) will be unpositioned (-1).
For example, maker.Select(maker.Select(maker.Ident(NAME[java]), NAME[lang]), NAME[String]).
@see com.sun.tools.javac.tree.JCTree.JCIdent
@see com.sun.tools.javac.tree.JCTree.JCFieldAccess | [
"In",
"javac",
"dotted",
"access",
"of",
"any",
"kind",
"from",
"{",
"@code",
"java",
".",
"lang",
".",
"String",
"}",
"to",
"{",
"@code",
"var",
".",
"methodName",
"}",
"is",
"represented",
"by",
"a",
"fold",
"-",
"left",
"of",
"{",
"@code",
"Select... | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1327-L1329 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpProxyRedirect.java | HttpProxyRedirect.getRedirectPort | public static Integer getRedirectPort(String host, int httpPort) {
Integer httpsPort = null;
synchronized (map) {
if (httpPort == DEFAULT_HTTP_PORT && map.get(httpPort) == null) {
// use default redirect of 80 to 443
httpsPort = DEFAULT_HTTPS_PORT;
} else {
Map<String, HttpProxyRedirect> redirectsForThisPort = map.get(httpPort);
if (redirectsForThisPort != null) {
HttpProxyRedirect hdr = redirectsForThisPort.get(host);
if (hdr == null) {
hdr = redirectsForThisPort.get(STAR);
}
if (hdr != null && hdr.enabled) {
httpsPort = hdr.httpsPort;
}
}
}
}
return httpsPort;
} | java | public static Integer getRedirectPort(String host, int httpPort) {
Integer httpsPort = null;
synchronized (map) {
if (httpPort == DEFAULT_HTTP_PORT && map.get(httpPort) == null) {
// use default redirect of 80 to 443
httpsPort = DEFAULT_HTTPS_PORT;
} else {
Map<String, HttpProxyRedirect> redirectsForThisPort = map.get(httpPort);
if (redirectsForThisPort != null) {
HttpProxyRedirect hdr = redirectsForThisPort.get(host);
if (hdr == null) {
hdr = redirectsForThisPort.get(STAR);
}
if (hdr != null && hdr.enabled) {
httpsPort = hdr.httpsPort;
}
}
}
}
return httpsPort;
} | [
"public",
"static",
"Integer",
"getRedirectPort",
"(",
"String",
"host",
",",
"int",
"httpPort",
")",
"{",
"Integer",
"httpsPort",
"=",
"null",
";",
"synchronized",
"(",
"map",
")",
"{",
"if",
"(",
"httpPort",
"==",
"DEFAULT_HTTP_PORT",
"&&",
"map",
".",
"... | <p>
This method returns the secure port number to redirect to given the specified
host and incoming (non-secure) port number. If a proxy redirect has been configured
with the specified host and httpPort, the associated httpsPort will be returned.
</p><p>
If the specified httpPort has been configured but not with the specified host, then
this method will return the httpsPort associated with a proxy redirect that has been
configured with a wildcard if one exists (i.e. <httpProxyRedirect host="*" .../>).
</p><p>
If no proxy redirect has been configured for the specified httpPort, then this method
will return null.
</p>
@return the httpsPort associated with the proxy redirect for the specified host/httpPort. | [
"<p",
">",
"This",
"method",
"returns",
"the",
"secure",
"port",
"number",
"to",
"redirect",
"to",
"given",
"the",
"specified",
"host",
"and",
"incoming",
"(",
"non",
"-",
"secure",
")",
"port",
"number",
".",
"If",
"a",
"proxy",
"redirect",
"has",
"been... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpProxyRedirect.java#L91-L111 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/expressions/Expressions.java | Expressions.isEqual | public static BooleanIsEqual isEqual(BooleanExpression left, Object constant) {
if (!(constant instanceof Boolean))
throw new IllegalArgumentException("constant is not a Boolean");
return new BooleanIsEqual(left, constant((Boolean)constant));
} | java | public static BooleanIsEqual isEqual(BooleanExpression left, Object constant) {
if (!(constant instanceof Boolean))
throw new IllegalArgumentException("constant is not a Boolean");
return new BooleanIsEqual(left, constant((Boolean)constant));
} | [
"public",
"static",
"BooleanIsEqual",
"isEqual",
"(",
"BooleanExpression",
"left",
",",
"Object",
"constant",
")",
"{",
"if",
"(",
"!",
"(",
"constant",
"instanceof",
"Boolean",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"constant is not a Boolean\... | Creates an IsEqual expression from the given expression and constant.
@param left The left expression.
@param constant The constant to compare to (must be a Boolean).
@throws IllegalArgumentException If constant is not a Boolean.
@return A new IsEqual binary expression. | [
"Creates",
"an",
"IsEqual",
"expression",
"from",
"the",
"given",
"expression",
"and",
"constant",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L198-L204 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.stripIndent | public static String stripIndent(CharSequence self, int numChars) {
String s = self.toString();
if (s.length() == 0 || numChars <= 0) return s;
try {
StringBuilder builder = new StringBuilder();
for (String line : readLines((CharSequence) s)) {
// normalize an empty or whitespace line to \n
// or strip the indent for lines containing non-space characters
if (!isAllWhitespace((CharSequence) line)) {
builder.append(stripIndentFromLine(line, numChars));
}
builder.append("\n");
}
// remove the normalized ending line ending if it was not present
if (!s.endsWith("\n")) {
builder.deleteCharAt(builder.length() - 1);
}
return builder.toString();
} catch (IOException e) {
/* ignore */
}
return s;
} | java | public static String stripIndent(CharSequence self, int numChars) {
String s = self.toString();
if (s.length() == 0 || numChars <= 0) return s;
try {
StringBuilder builder = new StringBuilder();
for (String line : readLines((CharSequence) s)) {
// normalize an empty or whitespace line to \n
// or strip the indent for lines containing non-space characters
if (!isAllWhitespace((CharSequence) line)) {
builder.append(stripIndentFromLine(line, numChars));
}
builder.append("\n");
}
// remove the normalized ending line ending if it was not present
if (!s.endsWith("\n")) {
builder.deleteCharAt(builder.length() - 1);
}
return builder.toString();
} catch (IOException e) {
/* ignore */
}
return s;
} | [
"public",
"static",
"String",
"stripIndent",
"(",
"CharSequence",
"self",
",",
"int",
"numChars",
")",
"{",
"String",
"s",
"=",
"self",
".",
"toString",
"(",
")",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
"==",
"0",
"||",
"numChars",
"<=",
"0",
... | Strip <tt>numChar</tt> leading characters from
every line in a CharSequence.
<pre class="groovyTestCase">
assert 'DEF\n456' == '''ABCDEF\n123456'''.stripIndent(3)
</pre>
@param self The CharSequence to strip the characters from
@param numChars The number of characters to strip
@return the stripped String
@since 1.8.2 | [
"Strip",
"<tt",
">",
"numChar<",
"/",
"tt",
">",
"leading",
"characters",
"from",
"every",
"line",
"in",
"a",
"CharSequence",
".",
"<pre",
"class",
"=",
"groovyTestCase",
">",
"assert",
"DEF",
"\\",
"n456",
"==",
"ABCDEF",
"\\",
"n123456",
".",
"stripInden... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2973-L2995 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java | SparseCpuLevel1.sdoti | @Override
protected double sdoti(long N, INDArray X, DataBuffer indx, INDArray Y) {
return cblas_sdoti((int) N, (FloatPointer) X.data().addressPointer(),(IntPointer) indx.addressPointer(),
(FloatPointer) Y.data().addressPointer());
} | java | @Override
protected double sdoti(long N, INDArray X, DataBuffer indx, INDArray Y) {
return cblas_sdoti((int) N, (FloatPointer) X.data().addressPointer(),(IntPointer) indx.addressPointer(),
(FloatPointer) Y.data().addressPointer());
} | [
"@",
"Override",
"protected",
"double",
"sdoti",
"(",
"long",
"N",
",",
"INDArray",
"X",
",",
"DataBuffer",
"indx",
",",
"INDArray",
"Y",
")",
"{",
"return",
"cblas_sdoti",
"(",
"(",
"int",
")",
"N",
",",
"(",
"FloatPointer",
")",
"X",
".",
"data",
"... | Computes the dot product of a compressed sparse float vector by a full-storage real vector.
@param N The number of elements in x and indx
@param X an sparse INDArray. Size at least N
@param indx an Databuffer that specifies the indices for the elements of x. Size at least N
@param Y a dense INDArray. Size at least max(indx[i]) | [
"Computes",
"the",
"dot",
"product",
"of",
"a",
"compressed",
"sparse",
"float",
"vector",
"by",
"a",
"full",
"-",
"storage",
"real",
"vector",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java#L57-L61 |
walkmod/walkmod-core | src/main/java/org/walkmod/WalkModFacade.java | WalkModFacade.addTransformationConfig | public void addTransformationConfig(String chain, String path, boolean recursive,
TransformationConfig transformationCfg, Integer order, String before) throws Exception {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.addTransformationConfig(chain, path, transformationCfg, recursive, order, before);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
} | java | public void addTransformationConfig(String chain, String path, boolean recursive,
TransformationConfig transformationCfg, Integer order, String before) throws Exception {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.addTransformationConfig(chain, path, transformationCfg, recursive, order, before);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
} | [
"public",
"void",
"addTransformationConfig",
"(",
"String",
"chain",
",",
"String",
"path",
",",
"boolean",
"recursive",
",",
"TransformationConfig",
"transformationCfg",
",",
"Integer",
"order",
",",
"String",
"before",
")",
"throws",
"Exception",
"{",
"long",
"s... | Adds a new transformation configuration into the configuration file
@param chain
chain identifier where the transformation will be appended. It can be null.
@param path
the path where the transformation config will be applied if the chain does not
exists or is null.
@param recursive
if the transformation config is added recursively to all the submodules.
@param transformationCfg
transformation configuration to add
@param order
priority order
@param before
defines which is the next chain to execute
@throws Exception
in case that the walkmod configuration file can't be read. | [
"Adds",
"a",
"new",
"transformation",
"configuration",
"into",
"the",
"configuration",
"file"
] | train | https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L430-L451 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.getAttachment | public InputStream getAttachment(String docId, String attachmentName, String revId) {
return db.getAttachment(docId, attachmentName, revId);
} | java | public InputStream getAttachment(String docId, String attachmentName, String revId) {
return db.getAttachment(docId, attachmentName, revId);
} | [
"public",
"InputStream",
"getAttachment",
"(",
"String",
"docId",
",",
"String",
"attachmentName",
",",
"String",
"revId",
")",
"{",
"return",
"db",
".",
"getAttachment",
"(",
"docId",
",",
"attachmentName",
",",
"revId",
")",
";",
"}"
] | Reads an attachment from the database.
The stream must be closed after usage, otherwise http connection leaks will occur.
@param docId the document id
@param attachmentName the attachment name
@param revId the document revision id or {@code null}
@return the attachment in the form of an {@code InputStream}. | [
"Reads",
"an",
"attachment",
"from",
"the",
"database",
"."
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L1218-L1220 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/report/ReportGenerator.java | ReportGenerator.generateHtml5Report | public static AbstractReportGenerator generateHtml5Report() {
AbstractReportGenerator report;
try {
Class<?> aClass = new ReportGenerator().getClass().getClassLoader()
.loadClass( "com.tngtech.jgiven.report.html5.Html5ReportGenerator" );
report = (AbstractReportGenerator) aClass.newInstance();
} catch( ClassNotFoundException e ) {
throw new JGivenInstallationException( "The JGiven HTML5 Report Generator seems not to be on the classpath.\n"
+ "Ensure that you have a dependency to jgiven-html5-report." );
} catch( Exception e ) {
throw new JGivenInternalDefectException( "The HTML5 Report Generator could not be instantiated.", e );
}
return report;
} | java | public static AbstractReportGenerator generateHtml5Report() {
AbstractReportGenerator report;
try {
Class<?> aClass = new ReportGenerator().getClass().getClassLoader()
.loadClass( "com.tngtech.jgiven.report.html5.Html5ReportGenerator" );
report = (AbstractReportGenerator) aClass.newInstance();
} catch( ClassNotFoundException e ) {
throw new JGivenInstallationException( "The JGiven HTML5 Report Generator seems not to be on the classpath.\n"
+ "Ensure that you have a dependency to jgiven-html5-report." );
} catch( Exception e ) {
throw new JGivenInternalDefectException( "The HTML5 Report Generator could not be instantiated.", e );
}
return report;
} | [
"public",
"static",
"AbstractReportGenerator",
"generateHtml5Report",
"(",
")",
"{",
"AbstractReportGenerator",
"report",
";",
"try",
"{",
"Class",
"<",
"?",
">",
"aClass",
"=",
"new",
"ReportGenerator",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getClassLoader"... | Searches the Html5ReportGenerator in Java path and instantiates the report | [
"Searches",
"the",
"Html5ReportGenerator",
"in",
"Java",
"path",
"and",
"instantiates",
"the",
"report"
] | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/report/ReportGenerator.java#L67-L80 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java | Annotate.queueScanTreeAndTypeAnnotate | public void queueScanTreeAndTypeAnnotate(JCTree tree, Env<AttrContext> env, Symbol sym,
DiagnosticPosition deferPos)
{
Assert.checkNonNull(sym);
normal(() -> tree.accept(new TypeAnnotate(env, sym, deferPos)));
} | java | public void queueScanTreeAndTypeAnnotate(JCTree tree, Env<AttrContext> env, Symbol sym,
DiagnosticPosition deferPos)
{
Assert.checkNonNull(sym);
normal(() -> tree.accept(new TypeAnnotate(env, sym, deferPos)));
} | [
"public",
"void",
"queueScanTreeAndTypeAnnotate",
"(",
"JCTree",
"tree",
",",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"Symbol",
"sym",
",",
"DiagnosticPosition",
"deferPos",
")",
"{",
"Assert",
".",
"checkNonNull",
"(",
"sym",
")",
";",
"normal",
"(",
"(... | Enqueue tree for scanning of type annotations, attaching to the Symbol sym. | [
"Enqueue",
"tree",
"for",
"scanning",
"of",
"type",
"annotations",
"attaching",
"to",
"the",
"Symbol",
"sym",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L981-L986 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java | JDBC4DatabaseMetaData.getImportedKeys | @Override
public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException
{
checkClosed();
VoltTable vtable = new VoltTable(
new ColumnInfo("PKTABLE_CAT", VoltType.STRING),
new ColumnInfo("PKTABLE_SCHEM", VoltType.STRING),
new ColumnInfo("PKTABLE_NAME", VoltType.STRING),
new ColumnInfo("PKCOLUMN_NAME", VoltType.STRING),
new ColumnInfo("FKTABLE_CAT", VoltType.STRING),
new ColumnInfo("FKTABLE_SCHEM", VoltType.STRING),
new ColumnInfo("FKTABLE_NAME", VoltType.STRING),
new ColumnInfo("FKCOLUMN_NAME", VoltType.STRING),
new ColumnInfo("KEY_SEQ", VoltType.SMALLINT),
new ColumnInfo("UPDATE_RULE", VoltType.SMALLINT),
new ColumnInfo("DELETE_RULE", VoltType.SMALLINT),
new ColumnInfo("FK_NAME", VoltType.STRING),
new ColumnInfo("PK_NAME", VoltType.STRING),
new ColumnInfo("DEFERRABILITY", VoltType.SMALLINT)
);
//NB: @SystemCatalog(?) will need additional support if we want to
// populate the table.
JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable);
return res;
} | java | @Override
public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException
{
checkClosed();
VoltTable vtable = new VoltTable(
new ColumnInfo("PKTABLE_CAT", VoltType.STRING),
new ColumnInfo("PKTABLE_SCHEM", VoltType.STRING),
new ColumnInfo("PKTABLE_NAME", VoltType.STRING),
new ColumnInfo("PKCOLUMN_NAME", VoltType.STRING),
new ColumnInfo("FKTABLE_CAT", VoltType.STRING),
new ColumnInfo("FKTABLE_SCHEM", VoltType.STRING),
new ColumnInfo("FKTABLE_NAME", VoltType.STRING),
new ColumnInfo("FKCOLUMN_NAME", VoltType.STRING),
new ColumnInfo("KEY_SEQ", VoltType.SMALLINT),
new ColumnInfo("UPDATE_RULE", VoltType.SMALLINT),
new ColumnInfo("DELETE_RULE", VoltType.SMALLINT),
new ColumnInfo("FK_NAME", VoltType.STRING),
new ColumnInfo("PK_NAME", VoltType.STRING),
new ColumnInfo("DEFERRABILITY", VoltType.SMALLINT)
);
//NB: @SystemCatalog(?) will need additional support if we want to
// populate the table.
JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable);
return res;
} | [
"@",
"Override",
"public",
"ResultSet",
"getImportedKeys",
"(",
"String",
"catalog",
",",
"String",
"schema",
",",
"String",
"table",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"VoltTable",
"vtable",
"=",
"new",
"VoltTable",
"(",
"new",
... | Retrieves a description of the primary key columns that are referenced by the given table's foreign key columns (the primary keys imported by a table) throws SQLException. | [
"Retrieves",
"a",
"description",
"of",
"the",
"primary",
"key",
"columns",
"that",
"are",
"referenced",
"by",
"the",
"given",
"table",
"s",
"foreign",
"key",
"columns",
"(",
"the",
"primary",
"keys",
"imported",
"by",
"a",
"table",
")",
"throws",
"SQLExcepti... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L386-L410 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/requests/restaction/pagination/PaginationAction.java | PaginationAction.forEachAsync | public RequestFuture<?> forEachAsync(final Procedure<T> action)
{
return forEachAsync(action, (throwable) ->
{
if (RestAction.DEFAULT_FAILURE != null)
RestAction.DEFAULT_FAILURE.accept(throwable);
} | java | public RequestFuture<?> forEachAsync(final Procedure<T> action)
{
return forEachAsync(action, (throwable) ->
{
if (RestAction.DEFAULT_FAILURE != null)
RestAction.DEFAULT_FAILURE.accept(throwable);
} | [
"public",
"RequestFuture",
"<",
"?",
">",
"forEachAsync",
"(",
"final",
"Procedure",
"<",
"T",
">",
"action",
")",
"{",
"return",
"forEachAsync",
"(",
"action",
",",
"(",
"throwable",
")",
"-",
">",
"{",
"if",
"(",
"RestAction",
".",
"DEFAULT_FAILURE",
"... | Iterates over all entities until the provided action returns {@code false}!
<br>This operation is different from {@link #forEach(Consumer)} as it
uses successive {@link #queue()} tasks to iterate each entity in callback threads instead of
the calling active thread.
This means that this method fully works on different threads to retrieve new entities.
<p><b>This iteration will include already cached entities, in order to exclude cached
entities use {@link #forEachRemainingAsync(Procedure)}</b>
<h1>Example</h1>
<pre>{@code
//deletes messages until it finds a user that is still in guild
public void cleanupMessages(MessagePaginationAction action)
{
action.forEachAsync( (message) ->
{
Guild guild = message.getGuild();
if (!guild.isMember(message.getAuthor()))
message.delete().queue();
else
return false;
return true;
});
}
}</pre>
@param action
{@link net.dv8tion.jda.core.utils.Procedure Procedure} returning {@code true} if iteration should continue!
@throws java.lang.IllegalArgumentException
If the provided Procedure is {@code null}
@return {@link java.util.concurrent.Future Future} that can be cancelled to stop iteration from outside! | [
"Iterates",
"over",
"all",
"entities",
"until",
"the",
"provided",
"action",
"returns",
"{",
"@code",
"false",
"}",
"!",
"<br",
">",
"This",
"operation",
"is",
"different",
"from",
"{",
"@link",
"#forEach",
"(",
"Consumer",
")",
"}",
"as",
"it",
"uses",
... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/restaction/pagination/PaginationAction.java#L412-L418 |
knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/Axis.java | Axis.getXAxisHeightHint | private double getXAxisHeightHint(double workingSpace) {
// Axis title
double titleHeight = 0.0;
if (chart.getXAxisTitle() != null
&& !chart.getXAxisTitle().trim().equalsIgnoreCase("")
&& axesChartStyler.isXAxisTitleVisible()) {
TextLayout textLayout =
new TextLayout(
chart.getXAxisTitle(),
axesChartStyler.getAxisTitleFont(),
new FontRenderContext(null, true, false));
Rectangle2D rectangle = textLayout.getBounds();
titleHeight = rectangle.getHeight() + axesChartStyler.getAxisTitlePadding();
}
this.axisTickCalculator = getAxisTickCalculator(workingSpace);
// Axis tick labels
double axisTickLabelsHeight = 0.0;
if (axesChartStyler.isXAxisTicksVisible()) {
// get some real tick labels
// System.out.println("XAxisHeightHint");
// System.out.println("workingSpace: " + workingSpace);
String sampleLabel = "";
// find the longest String in all the labels
for (int i = 0; i < axisTickCalculator.getTickLabels().size(); i++) {
// System.out.println("label: " + axisTickCalculator.getTickLabels().get(i));
if (axisTickCalculator.getTickLabels().get(i) != null
&& axisTickCalculator.getTickLabels().get(i).length() > sampleLabel.length()) {
sampleLabel = axisTickCalculator.getTickLabels().get(i);
}
}
// System.out.println("sampleLabel: " + sampleLabel);
// get the height of the label including rotation
TextLayout textLayout =
new TextLayout(
sampleLabel.length() == 0 ? " " : sampleLabel,
axesChartStyler.getAxisTickLabelsFont(),
new FontRenderContext(null, true, false));
AffineTransform rot =
axesChartStyler.getXAxisLabelRotation() == 0
? null
: AffineTransform.getRotateInstance(
-1 * Math.toRadians(axesChartStyler.getXAxisLabelRotation()));
Shape shape = textLayout.getOutline(rot);
Rectangle2D rectangle = shape.getBounds();
axisTickLabelsHeight =
rectangle.getHeight()
+ axesChartStyler.getAxisTickPadding()
+ axesChartStyler.getAxisTickMarkLength();
}
return titleHeight + axisTickLabelsHeight;
} | java | private double getXAxisHeightHint(double workingSpace) {
// Axis title
double titleHeight = 0.0;
if (chart.getXAxisTitle() != null
&& !chart.getXAxisTitle().trim().equalsIgnoreCase("")
&& axesChartStyler.isXAxisTitleVisible()) {
TextLayout textLayout =
new TextLayout(
chart.getXAxisTitle(),
axesChartStyler.getAxisTitleFont(),
new FontRenderContext(null, true, false));
Rectangle2D rectangle = textLayout.getBounds();
titleHeight = rectangle.getHeight() + axesChartStyler.getAxisTitlePadding();
}
this.axisTickCalculator = getAxisTickCalculator(workingSpace);
// Axis tick labels
double axisTickLabelsHeight = 0.0;
if (axesChartStyler.isXAxisTicksVisible()) {
// get some real tick labels
// System.out.println("XAxisHeightHint");
// System.out.println("workingSpace: " + workingSpace);
String sampleLabel = "";
// find the longest String in all the labels
for (int i = 0; i < axisTickCalculator.getTickLabels().size(); i++) {
// System.out.println("label: " + axisTickCalculator.getTickLabels().get(i));
if (axisTickCalculator.getTickLabels().get(i) != null
&& axisTickCalculator.getTickLabels().get(i).length() > sampleLabel.length()) {
sampleLabel = axisTickCalculator.getTickLabels().get(i);
}
}
// System.out.println("sampleLabel: " + sampleLabel);
// get the height of the label including rotation
TextLayout textLayout =
new TextLayout(
sampleLabel.length() == 0 ? " " : sampleLabel,
axesChartStyler.getAxisTickLabelsFont(),
new FontRenderContext(null, true, false));
AffineTransform rot =
axesChartStyler.getXAxisLabelRotation() == 0
? null
: AffineTransform.getRotateInstance(
-1 * Math.toRadians(axesChartStyler.getXAxisLabelRotation()));
Shape shape = textLayout.getOutline(rot);
Rectangle2D rectangle = shape.getBounds();
axisTickLabelsHeight =
rectangle.getHeight()
+ axesChartStyler.getAxisTickPadding()
+ axesChartStyler.getAxisTickMarkLength();
}
return titleHeight + axisTickLabelsHeight;
} | [
"private",
"double",
"getXAxisHeightHint",
"(",
"double",
"workingSpace",
")",
"{",
"// Axis title",
"double",
"titleHeight",
"=",
"0.0",
";",
"if",
"(",
"chart",
".",
"getXAxisTitle",
"(",
")",
"!=",
"null",
"&&",
"!",
"chart",
".",
"getXAxisTitle",
"(",
")... | The vertical Y-Axis is drawn first, but to know the lower bounds of it, we need to know how
high the X-Axis paint zone is going to be. Since the tick labels could be rotated, we need to
actually determine the tick labels first to get an idea of how tall the X-Axis tick labels will
be.
@return | [
"The",
"vertical",
"Y",
"-",
"Axis",
"is",
"drawn",
"first",
"but",
"to",
"know",
"the",
"lower",
"bounds",
"of",
"it",
"we",
"need",
"to",
"know",
"how",
"high",
"the",
"X",
"-",
"Axis",
"paint",
"zone",
"is",
"going",
"to",
"be",
".",
"Since",
"t... | train | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/Axis.java#L257-L314 |
wanglinsong/thx-webservice | src/main/java/com/tascape/qa/th/ws/driver/EndpointHandler.java | EndpointHandler.getParameter | public static String getParameter(HttpRequest request, String name) throws URISyntaxException {
NameValuePair nv = URLEncodedUtils.parse(new URI(request.getRequestLine().getUri()), "UTF-8").stream()
.filter(param -> param.getName().equals(name))
.findFirst().get();
if (nv == null) {
return null;
}
return nv.getValue();
} | java | public static String getParameter(HttpRequest request, String name) throws URISyntaxException {
NameValuePair nv = URLEncodedUtils.parse(new URI(request.getRequestLine().getUri()), "UTF-8").stream()
.filter(param -> param.getName().equals(name))
.findFirst().get();
if (nv == null) {
return null;
}
return nv.getValue();
} | [
"public",
"static",
"String",
"getParameter",
"(",
"HttpRequest",
"request",
",",
"String",
"name",
")",
"throws",
"URISyntaxException",
"{",
"NameValuePair",
"nv",
"=",
"URLEncodedUtils",
".",
"parse",
"(",
"new",
"URI",
"(",
"request",
".",
"getRequestLine",
"... | Gets parameter value of request line.
@param request HTTP request
@param name name of the request line parameter
@return parameter value, only the first is returned if there are multiple values for the same name
@throws URISyntaxException in case of URL issue | [
"Gets",
"parameter",
"value",
"of",
"request",
"line",
"."
] | train | https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/driver/EndpointHandler.java#L202-L210 |
dnsjava/dnsjava | org/xbill/DNS/TXTBase.java | TXTBase.getStrings | public List
getStrings() {
List list = new ArrayList(strings.size());
for (int i = 0; i < strings.size(); i++)
list.add(byteArrayToString((byte []) strings.get(i), false));
return list;
}
/**
* Returns the text strings
* @return A list of byte arrays corresponding to the text strings.
*/
public List
getStringsAsByteArrays() {
return strings;
}
void
rrToWire(DNSOutput out, Compression c, boolean canonical) {
Iterator it = strings.iterator();
while (it.hasNext()) {
byte [] b = (byte []) it.next();
out.writeCountedString(b);
}
}
} | java | public List
getStrings() {
List list = new ArrayList(strings.size());
for (int i = 0; i < strings.size(); i++)
list.add(byteArrayToString((byte []) strings.get(i), false));
return list;
}
/**
* Returns the text strings
* @return A list of byte arrays corresponding to the text strings.
*/
public List
getStringsAsByteArrays() {
return strings;
}
void
rrToWire(DNSOutput out, Compression c, boolean canonical) {
Iterator it = strings.iterator();
while (it.hasNext()) {
byte [] b = (byte []) it.next();
out.writeCountedString(b);
}
}
} | [
"public",
"List",
"getStrings",
"(",
")",
"{",
"List",
"list",
"=",
"new",
"ArrayList",
"(",
"strings",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strings",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"... | Returns the text strings
@return A list of Strings corresponding to the text strings. | [
"Returns",
"the",
"text",
"strings"
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/TXTBase.java#L97-L123 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readAliasesByStructureId | public List<CmsAlias> readAliasesByStructureId(CmsDbContext dbc, CmsProject project, CmsUUID structureId)
throws CmsException {
return getVfsDriver(dbc).readAliases(dbc, project, new CmsAliasFilter(null, null, structureId));
} | java | public List<CmsAlias> readAliasesByStructureId(CmsDbContext dbc, CmsProject project, CmsUUID structureId)
throws CmsException {
return getVfsDriver(dbc).readAliases(dbc, project, new CmsAliasFilter(null, null, structureId));
} | [
"public",
"List",
"<",
"CmsAlias",
">",
"readAliasesByStructureId",
"(",
"CmsDbContext",
"dbc",
",",
"CmsProject",
"project",
",",
"CmsUUID",
"structureId",
")",
"throws",
"CmsException",
"{",
"return",
"getVfsDriver",
"(",
"dbc",
")",
".",
"readAliases",
"(",
"... | Reads the aliases which point to a given structure id.<p>
@param dbc the current database context
@param project the current project
@param structureId the structure id for which we want to read the aliases
@return the list of aliases pointing to the structure id
@throws CmsException if something goes wrong | [
"Reads",
"the",
"aliases",
"which",
"point",
"to",
"a",
"given",
"structure",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L6381-L6385 |
diirt/util | src/main/java/org/epics/util/time/Timestamp.java | Timestamp.createWithCarry | private static Timestamp createWithCarry(long seconds, long nanos) {
if (nanos > 999999999) {
seconds = seconds + nanos / 1000000000;
nanos = nanos % 1000000000;
}
if (nanos < 0) {
long pastSec = nanos / 1000000000;
pastSec--;
seconds += pastSec;
nanos -= pastSec * 1000000000;
}
return new Timestamp(seconds, (int) nanos);
} | java | private static Timestamp createWithCarry(long seconds, long nanos) {
if (nanos > 999999999) {
seconds = seconds + nanos / 1000000000;
nanos = nanos % 1000000000;
}
if (nanos < 0) {
long pastSec = nanos / 1000000000;
pastSec--;
seconds += pastSec;
nanos -= pastSec * 1000000000;
}
return new Timestamp(seconds, (int) nanos);
} | [
"private",
"static",
"Timestamp",
"createWithCarry",
"(",
"long",
"seconds",
",",
"long",
"nanos",
")",
"{",
"if",
"(",
"nanos",
">",
"999999999",
")",
"{",
"seconds",
"=",
"seconds",
"+",
"nanos",
"/",
"1000000000",
";",
"nanos",
"=",
"nanos",
"%",
"100... | Creates a new time stamp by carrying nanosecs into seconds if necessary.
@param seconds new seconds
@param ofNanos new nanoseconds (can be the whole long range)
@return the new timestamp | [
"Creates",
"a",
"new",
"time",
"stamp",
"by",
"carrying",
"nanosecs",
"into",
"seconds",
"if",
"necessary",
"."
] | train | https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/time/Timestamp.java#L173-L187 |
gosu-lang/gosu-lang | gosu-lab/src/main/java/editor/util/TextComponentUtil.java | TextComponentUtil.getWhiteSpaceLineStartAfter | public static int getWhiteSpaceLineStartAfter( String script, int end )
{
int endLine = getLineEnd( script, end );
if( endLine < script.length() - 1 )
{
int nextLineStart = endLine + 1;
int nextLineEnd = getLineEnd( script, nextLineStart );
boolean whitespace = GosuStringUtil.isWhitespace( script.substring( nextLineStart, nextLineEnd ) );
if( whitespace )
{
return nextLineStart;
}
}
return -1;
} | java | public static int getWhiteSpaceLineStartAfter( String script, int end )
{
int endLine = getLineEnd( script, end );
if( endLine < script.length() - 1 )
{
int nextLineStart = endLine + 1;
int nextLineEnd = getLineEnd( script, nextLineStart );
boolean whitespace = GosuStringUtil.isWhitespace( script.substring( nextLineStart, nextLineEnd ) );
if( whitespace )
{
return nextLineStart;
}
}
return -1;
} | [
"public",
"static",
"int",
"getWhiteSpaceLineStartAfter",
"(",
"String",
"script",
",",
"int",
"end",
")",
"{",
"int",
"endLine",
"=",
"getLineEnd",
"(",
"script",
",",
"end",
")",
";",
"if",
"(",
"endLine",
"<",
"script",
".",
"length",
"(",
")",
"-",
... | Returns the start of the next line if that line is only whitespace. Returns -1 otherwise. | [
"Returns",
"the",
"start",
"of",
"the",
"next",
"line",
"if",
"that",
"line",
"is",
"only",
"whitespace",
".",
"Returns",
"-",
"1",
"otherwise",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/TextComponentUtil.java#L798-L812 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_siteBuilderFull_options_templates_GET | public ArrayList<OvhSiteBuilderTemplate> packName_siteBuilderFull_options_templates_GET(String packName) throws IOException {
String qPath = "/pack/xdsl/{packName}/siteBuilderFull/options/templates";
StringBuilder sb = path(qPath, packName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | java | public ArrayList<OvhSiteBuilderTemplate> packName_siteBuilderFull_options_templates_GET(String packName) throws IOException {
String qPath = "/pack/xdsl/{packName}/siteBuilderFull/options/templates";
StringBuilder sb = path(qPath, packName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | [
"public",
"ArrayList",
"<",
"OvhSiteBuilderTemplate",
">",
"packName_siteBuilderFull_options_templates_GET",
"(",
"String",
"packName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/siteBuilderFull/options/templates\"",
";",
"StringBuilder",
... | Get the available templates
REST: GET /pack/xdsl/{packName}/siteBuilderFull/options/templates
@param packName [required] The internal name of your pack | [
"Get",
"the",
"available",
"templates"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L524-L529 |
biojava/biojava | biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java | MultipleAlignmentCoordManager.getSeqPos | public int getSeqPos(int aligSeq, Point p) {
int x = p.x - DEFAULT_X_SPACE - DEFAULT_LEGEND_SIZE;
int y = p.y - DEFAULT_Y_SPACE ;
y -= (DEFAULT_LINE_SEPARATION * aligSeq) - DEFAULT_CHAR_SIZE;
int lineNr = y / DEFAULT_Y_STEP;
int linePos = x / DEFAULT_CHAR_SIZE;
return lineNr * DEFAULT_LINE_LENGTH + linePos ;
} | java | public int getSeqPos(int aligSeq, Point p) {
int x = p.x - DEFAULT_X_SPACE - DEFAULT_LEGEND_SIZE;
int y = p.y - DEFAULT_Y_SPACE ;
y -= (DEFAULT_LINE_SEPARATION * aligSeq) - DEFAULT_CHAR_SIZE;
int lineNr = y / DEFAULT_Y_STEP;
int linePos = x / DEFAULT_CHAR_SIZE;
return lineNr * DEFAULT_LINE_LENGTH + linePos ;
} | [
"public",
"int",
"getSeqPos",
"(",
"int",
"aligSeq",
",",
"Point",
"p",
")",
"{",
"int",
"x",
"=",
"p",
".",
"x",
"-",
"DEFAULT_X_SPACE",
"-",
"DEFAULT_LEGEND_SIZE",
";",
"int",
"y",
"=",
"p",
".",
"y",
"-",
"DEFAULT_Y_SPACE",
";",
"y",
"-=",
"(",
... | Convert from an X position in the JPanel to the position
in the sequence alignment.
@param aligSeq sequence number
@param p point on panel
@return the sequence position for a point on the Panel | [
"Convert",
"from",
"an",
"X",
"position",
"in",
"the",
"JPanel",
"to",
"the",
"position",
"in",
"the",
"sequence",
"alignment",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java#L125-L136 |
phax/ph-oton | ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResourceWithCondition.java | WebSiteResourceWithCondition.createForJS | @Nonnull
public static WebSiteResourceWithCondition createForJS (@Nonnull final IJSPathProvider aPP, final boolean bRegular)
{
return createForJS (aPP.getJSItemPath (bRegular), aPP.getConditionalComment (), aPP.isBundlable ());
} | java | @Nonnull
public static WebSiteResourceWithCondition createForJS (@Nonnull final IJSPathProvider aPP, final boolean bRegular)
{
return createForJS (aPP.getJSItemPath (bRegular), aPP.getConditionalComment (), aPP.isBundlable ());
} | [
"@",
"Nonnull",
"public",
"static",
"WebSiteResourceWithCondition",
"createForJS",
"(",
"@",
"Nonnull",
"final",
"IJSPathProvider",
"aPP",
",",
"final",
"boolean",
"bRegular",
")",
"{",
"return",
"createForJS",
"(",
"aPP",
".",
"getJSItemPath",
"(",
"bRegular",
")... | Factory method for JavaScript resources.
@param aPP
The path provider.
@param bRegular
<code>true</code> for regular version, <code>false</code> for the
minified/optimized version.
@return New {@link WebSiteResourceWithCondition} object. Never
<code>null</code>. | [
"Factory",
"method",
"for",
"JavaScript",
"resources",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResourceWithCondition.java#L243-L247 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java | AiMesh.getTexCoordW | public float getTexCoordW(int vertex, int coords) {
if (!hasTexCoords(coords)) {
throw new IllegalStateException(
"mesh has no texture coordinate set " + coords);
}
checkVertexIndexBounds(vertex);
/* bound checks for coords are done by java for us */
if (getNumUVComponents(coords) < 3) {
throw new IllegalArgumentException("coordinate set " + coords +
" does not contain 3D texture coordinates");
}
return m_texcoords[coords].getFloat(
(vertex * m_numUVComponents[coords] + 1) * SIZEOF_FLOAT);
} | java | public float getTexCoordW(int vertex, int coords) {
if (!hasTexCoords(coords)) {
throw new IllegalStateException(
"mesh has no texture coordinate set " + coords);
}
checkVertexIndexBounds(vertex);
/* bound checks for coords are done by java for us */
if (getNumUVComponents(coords) < 3) {
throw new IllegalArgumentException("coordinate set " + coords +
" does not contain 3D texture coordinates");
}
return m_texcoords[coords].getFloat(
(vertex * m_numUVComponents[coords] + 1) * SIZEOF_FLOAT);
} | [
"public",
"float",
"getTexCoordW",
"(",
"int",
"vertex",
",",
"int",
"coords",
")",
"{",
"if",
"(",
"!",
"hasTexCoords",
"(",
"coords",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"mesh has no texture coordinate set \"",
"+",
"coords",
")",
... | Returns the w component of a coordinate from a texture coordinate set.<p>
This method may only be called on 3-dimensional coordinate sets.
Call <code>getNumUVComponents(coords)</code> to determine how may
coordinate components are available.
@param vertex the vertex index
@param coords the texture coordinate set
@return the w component | [
"Returns",
"the",
"w",
"component",
"of",
"a",
"coordinate",
"from",
"a",
"texture",
"coordinate",
"set",
".",
"<p",
">"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L1002-L1019 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/request/JmxReadRequest.java | JmxReadRequest.newCreator | static RequestCreator<JmxReadRequest> newCreator() {
return new RequestCreator<JmxReadRequest>() {
/** {@inheritDoc} */
public JmxReadRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException {
return new JmxReadRequest(
pStack.pop(), // object name
popOrNull(pStack), // attribute(s) (can be null)
prepareExtraArgs(pStack), // path
pParams);
}
/** {@inheritDoc} */
public JmxReadRequest create(Map<String, ?> requestMap, ProcessingParameters pParams)
throws MalformedObjectNameException {
return new JmxReadRequest(requestMap,pParams);
}
};
} | java | static RequestCreator<JmxReadRequest> newCreator() {
return new RequestCreator<JmxReadRequest>() {
/** {@inheritDoc} */
public JmxReadRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException {
return new JmxReadRequest(
pStack.pop(), // object name
popOrNull(pStack), // attribute(s) (can be null)
prepareExtraArgs(pStack), // path
pParams);
}
/** {@inheritDoc} */
public JmxReadRequest create(Map<String, ?> requestMap, ProcessingParameters pParams)
throws MalformedObjectNameException {
return new JmxReadRequest(requestMap,pParams);
}
};
} | [
"static",
"RequestCreator",
"<",
"JmxReadRequest",
">",
"newCreator",
"(",
")",
"{",
"return",
"new",
"RequestCreator",
"<",
"JmxReadRequest",
">",
"(",
")",
"{",
"/** {@inheritDoc} */",
"public",
"JmxReadRequest",
"create",
"(",
"Stack",
"<",
"String",
">",
"pS... | Creator for {@link JmxReadRequest}s
@return the creator implementation | [
"Creator",
"for",
"{",
"@link",
"JmxReadRequest",
"}",
"s"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/request/JmxReadRequest.java#L150-L167 |
Azure/autorest-clientruntime-for-java | azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java | AzureClient.getPutOrPatchResultAsync | public <T> Observable<ServiceResponse<T>> getPutOrPatchResultAsync(Observable<Response<ResponseBody>> observable, final Type resourceType) {
return this.<T>beginPutOrPatchAsync(observable, resourceType)
.toObservable()
.flatMap(new Func1<PollingState<T>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(PollingState<T> pollingState) {
return pollPutOrPatchAsync(pollingState, resourceType);
}
})
.last()
.map(new Func1<PollingState<T>, ServiceResponse<T>>() {
@Override
public ServiceResponse<T> call(PollingState<T> pollingState) {
return new ServiceResponse<>(pollingState.resource(), pollingState.response());
}
});
} | java | public <T> Observable<ServiceResponse<T>> getPutOrPatchResultAsync(Observable<Response<ResponseBody>> observable, final Type resourceType) {
return this.<T>beginPutOrPatchAsync(observable, resourceType)
.toObservable()
.flatMap(new Func1<PollingState<T>, Observable<PollingState<T>>>() {
@Override
public Observable<PollingState<T>> call(PollingState<T> pollingState) {
return pollPutOrPatchAsync(pollingState, resourceType);
}
})
.last()
.map(new Func1<PollingState<T>, ServiceResponse<T>>() {
@Override
public ServiceResponse<T> call(PollingState<T> pollingState) {
return new ServiceResponse<>(pollingState.resource(), pollingState.response());
}
});
} | [
"public",
"<",
"T",
">",
"Observable",
"<",
"ServiceResponse",
"<",
"T",
">",
">",
"getPutOrPatchResultAsync",
"(",
"Observable",
"<",
"Response",
"<",
"ResponseBody",
">",
">",
"observable",
",",
"final",
"Type",
"resourceType",
")",
"{",
"return",
"this",
... | Handles an initial response from a PUT or PATCH operation response by polling the status of the operation
asynchronously, once the operation finishes emits the final response.
@param observable the initial observable from the PUT or PATCH operation.
@param resourceType the java.lang.reflect.Type of the resource.
@param <T> the return type of the caller.
@return the observable of which a subscription will lead to a final response. | [
"Handles",
"an",
"initial",
"response",
"from",
"a",
"PUT",
"or",
"PATCH",
"operation",
"response",
"by",
"polling",
"the",
"status",
"of",
"the",
"operation",
"asynchronously",
"once",
"the",
"operation",
"finishes",
"emits",
"the",
"final",
"response",
"."
] | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java#L125-L141 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/version/Version.java | Version.isBetween | public boolean isBetween(Version from, Version to) {
int thisVersion = this.pack();
int fromVersion = from.pack();
int toVersion = to.pack();
return thisVersion >= fromVersion && thisVersion <= toVersion;
} | java | public boolean isBetween(Version from, Version to) {
int thisVersion = this.pack();
int fromVersion = from.pack();
int toVersion = to.pack();
return thisVersion >= fromVersion && thisVersion <= toVersion;
} | [
"public",
"boolean",
"isBetween",
"(",
"Version",
"from",
",",
"Version",
"to",
")",
"{",
"int",
"thisVersion",
"=",
"this",
".",
"pack",
"(",
")",
";",
"int",
"fromVersion",
"=",
"from",
".",
"pack",
"(",
")",
";",
"int",
"toVersion",
"=",
"to",
"."... | Checks if the version is between specified version (both ends inclusive)
@param from
@param to
@return true if the version is between from and to (both ends inclusive) | [
"Checks",
"if",
"the",
"version",
"is",
"between",
"specified",
"version",
"(",
"both",
"ends",
"inclusive",
")"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/version/Version.java#L239-L244 |
apache/incubator-heron | heron/common/src/java/org/apache/heron/common/utils/logging/LoggingHelper.java | LoggingHelper.getFileHandler | public static FileHandler getFileHandler(String processId,
String loggingDir,
boolean append,
ByteAmount limit,
int count) throws IOException, SecurityException {
String pattern = loggingDir + "/" + processId + ".log.%g";
FileHandler fileHandler = new FileHandler(pattern, (int) limit.asBytes(), count, append);
fileHandler.setFormatter(new SimpleFormatter());
fileHandler.setEncoding(StandardCharsets.UTF_8.toString());
return fileHandler;
} | java | public static FileHandler getFileHandler(String processId,
String loggingDir,
boolean append,
ByteAmount limit,
int count) throws IOException, SecurityException {
String pattern = loggingDir + "/" + processId + ".log.%g";
FileHandler fileHandler = new FileHandler(pattern, (int) limit.asBytes(), count, append);
fileHandler.setFormatter(new SimpleFormatter());
fileHandler.setEncoding(StandardCharsets.UTF_8.toString());
return fileHandler;
} | [
"public",
"static",
"FileHandler",
"getFileHandler",
"(",
"String",
"processId",
",",
"String",
"loggingDir",
",",
"boolean",
"append",
",",
"ByteAmount",
"limit",
",",
"int",
"count",
")",
"throws",
"IOException",
",",
"SecurityException",
"{",
"String",
"pattern... | Initialize a <tt>FileHandler</tt> to write to a set of files
with optional append. When (approximately) the given limit has
been written to one file, another file will be opened. The
output will cycle through a set of count files.
The pattern of file name should be: ${processId}.log.index
<p>
The <tt>FileHandler</tt> is configured based on <tt>LogManager</tt>
properties (or their default values) except that the given pattern
argument is used as the filename pattern, the file limit is
set to the limit argument, and the file count is set to the
given count argument, and the append mode is set to the given
<tt>append</tt> argument.
<p>
The count must be at least 1.
@param limit the maximum number of bytes to write to any one file
@param count the number of files to use
@param append specifies append mode
@throws IOException if there are IO problems opening the files.
@throws SecurityException if a security manager exists and if
the caller does not have <tt>LoggingPermission("control")</tt>.
@throws IllegalArgumentException if {@code limit < 0}, or {@code count < 1}.
@throws IllegalArgumentException if pattern is an empty string | [
"Initialize",
"a",
"<tt",
">",
"FileHandler<",
"/",
"tt",
">",
"to",
"write",
"to",
"a",
"set",
"of",
"files",
"with",
"optional",
"append",
".",
"When",
"(",
"approximately",
")",
"the",
"given",
"limit",
"has",
"been",
"written",
"to",
"one",
"file",
... | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/utils/logging/LoggingHelper.java#L154-L168 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java | GoogleCloudStorageFileSystem.listFileInfo | public List<FileInfo> listFileInfo(URI path) throws IOException {
Preconditions.checkNotNull(path, "path can not be null");
logger.atFine().log("listFileInfo(%s)", path);
StorageResourceId pathId = pathCodec.validatePathAndGetId(path, true);
StorageResourceId dirId =
pathCodec.validatePathAndGetId(FileInfo.convertToDirectoryPath(pathCodec, path), true);
// To improve performance start to list directory items right away.
ExecutorService dirExecutor = Executors.newSingleThreadExecutor(DAEMON_THREAD_FACTORY);
try {
Future<GoogleCloudStorageItemInfo> dirFuture =
dirExecutor.submit(() -> gcs.getItemInfo(dirId));
dirExecutor.shutdown();
if (!pathId.isDirectory()) {
GoogleCloudStorageItemInfo pathInfo = gcs.getItemInfo(pathId);
if (pathInfo.exists()) {
List<FileInfo> listedInfo = new ArrayList<>();
listedInfo.add(FileInfo.fromItemInfo(pathCodec, pathInfo));
return listedInfo;
}
}
try {
GoogleCloudStorageItemInfo dirInfo = dirFuture.get();
List<GoogleCloudStorageItemInfo> dirItemInfos =
dirId.isRoot()
? gcs.listBucketInfo()
: gcs.listObjectInfo(dirId.getBucketName(), dirId.getObjectName(), PATH_DELIMITER);
if (!dirInfo.exists() && dirItemInfos.isEmpty()) {
throw new FileNotFoundException("Item not found: " + path);
}
List<FileInfo> fileInfos = FileInfo.fromItemInfos(pathCodec, dirItemInfos);
fileInfos.sort(FILE_INFO_PATH_COMPARATOR);
return fileInfos;
} catch (InterruptedException | ExecutionException e) {
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
throw new IOException(String.format("Failed to listFileInfo for '%s'", path), e);
}
} finally {
dirExecutor.shutdownNow();
}
} | java | public List<FileInfo> listFileInfo(URI path) throws IOException {
Preconditions.checkNotNull(path, "path can not be null");
logger.atFine().log("listFileInfo(%s)", path);
StorageResourceId pathId = pathCodec.validatePathAndGetId(path, true);
StorageResourceId dirId =
pathCodec.validatePathAndGetId(FileInfo.convertToDirectoryPath(pathCodec, path), true);
// To improve performance start to list directory items right away.
ExecutorService dirExecutor = Executors.newSingleThreadExecutor(DAEMON_THREAD_FACTORY);
try {
Future<GoogleCloudStorageItemInfo> dirFuture =
dirExecutor.submit(() -> gcs.getItemInfo(dirId));
dirExecutor.shutdown();
if (!pathId.isDirectory()) {
GoogleCloudStorageItemInfo pathInfo = gcs.getItemInfo(pathId);
if (pathInfo.exists()) {
List<FileInfo> listedInfo = new ArrayList<>();
listedInfo.add(FileInfo.fromItemInfo(pathCodec, pathInfo));
return listedInfo;
}
}
try {
GoogleCloudStorageItemInfo dirInfo = dirFuture.get();
List<GoogleCloudStorageItemInfo> dirItemInfos =
dirId.isRoot()
? gcs.listBucketInfo()
: gcs.listObjectInfo(dirId.getBucketName(), dirId.getObjectName(), PATH_DELIMITER);
if (!dirInfo.exists() && dirItemInfos.isEmpty()) {
throw new FileNotFoundException("Item not found: " + path);
}
List<FileInfo> fileInfos = FileInfo.fromItemInfos(pathCodec, dirItemInfos);
fileInfos.sort(FILE_INFO_PATH_COMPARATOR);
return fileInfos;
} catch (InterruptedException | ExecutionException e) {
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
throw new IOException(String.format("Failed to listFileInfo for '%s'", path), e);
}
} finally {
dirExecutor.shutdownNow();
}
} | [
"public",
"List",
"<",
"FileInfo",
">",
"listFileInfo",
"(",
"URI",
"path",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"path",
",",
"\"path can not be null\"",
")",
";",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
... | If the given path points to a directory then the information about its children is returned,
otherwise information about the given file is returned.
<p>Note: This function is expensive to call, especially for a directory with many children. Use
the alternative {@link GoogleCloudStorageFileSystem#listFileNames(FileInfo)} if you only need
names of children and no other attributes.
@param path Given path.
@return Information about a file or children of a directory.
@throws FileNotFoundException if the given path does not exist.
@throws IOException | [
"If",
"the",
"given",
"path",
"points",
"to",
"a",
"directory",
"then",
"the",
"information",
"about",
"its",
"children",
"is",
"returned",
"otherwise",
"information",
"about",
"the",
"given",
"file",
"is",
"returned",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java#L1050-L1096 |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/FormalParameterSourceAppender.java | FormalParameterSourceAppender.eInit | public void eInit(XtendExecutable context, String name, IJvmTypeProvider typeContext) {
this.builder.eInit(context, name, typeContext);
} | java | public void eInit(XtendExecutable context, String name, IJvmTypeProvider typeContext) {
this.builder.eInit(context, name, typeContext);
} | [
"public",
"void",
"eInit",
"(",
"XtendExecutable",
"context",
",",
"String",
"name",
",",
"IJvmTypeProvider",
"typeContext",
")",
"{",
"this",
".",
"builder",
".",
"eInit",
"(",
"context",
",",
"name",
",",
"typeContext",
")",
";",
"}"
] | Initialize the formal parameter.
@param context the context of the formal parameter.
@param name the name of the formal parameter. | [
"Initialize",
"the",
"formal",
"parameter",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/FormalParameterSourceAppender.java#L79-L81 |
mangstadt/biweekly | src/main/java/biweekly/util/com/google/ical/iter/RecurrenceIteratorFactory.java | RecurrenceIteratorFactory.createRecurrenceIterable | public static RecurrenceIterable createRecurrenceIterable(final Recurrence rrule, final DateValue dtStart, final TimeZone tzid) {
return new RecurrenceIterable() {
public RecurrenceIterator iterator() {
return createRecurrenceIterator(rrule, dtStart, tzid);
}
};
} | java | public static RecurrenceIterable createRecurrenceIterable(final Recurrence rrule, final DateValue dtStart, final TimeZone tzid) {
return new RecurrenceIterable() {
public RecurrenceIterator iterator() {
return createRecurrenceIterator(rrule, dtStart, tzid);
}
};
} | [
"public",
"static",
"RecurrenceIterable",
"createRecurrenceIterable",
"(",
"final",
"Recurrence",
"rrule",
",",
"final",
"DateValue",
"dtStart",
",",
"final",
"TimeZone",
"tzid",
")",
"{",
"return",
"new",
"RecurrenceIterable",
"(",
")",
"{",
"public",
"RecurrenceIt... | Creates a recurrence iterable from an RRULE.
@param rrule the recurrence rule
@param dtStart the start date of the series
@param tzid the timezone that the start date is in, as well as the
timezone to iterate in
@return the iterable | [
"Creates",
"a",
"recurrence",
"iterable",
"from",
"an",
"RRULE",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/RecurrenceIteratorFactory.java#L117-L123 |
kiswanij/jk-util | src/main/java/com/jk/util/JKIOUtil.java | JKIOUtil.readPropertiesStream | public static Properties readPropertiesStream(InputStream inputStream) {
try {
final Properties prop = new Properties();
// try to read in utf 8
prop.load(new InputStreamReader(inputStream, Charset.forName("utf-8")));
JKCollectionUtil.fixPropertiesKeys(prop);
return prop;
} catch (IOException e) {
JKExceptionUtil.handle(e);
return null;
} finally {
close(inputStream);
}
} | java | public static Properties readPropertiesStream(InputStream inputStream) {
try {
final Properties prop = new Properties();
// try to read in utf 8
prop.load(new InputStreamReader(inputStream, Charset.forName("utf-8")));
JKCollectionUtil.fixPropertiesKeys(prop);
return prop;
} catch (IOException e) {
JKExceptionUtil.handle(e);
return null;
} finally {
close(inputStream);
}
} | [
"public",
"static",
"Properties",
"readPropertiesStream",
"(",
"InputStream",
"inputStream",
")",
"{",
"try",
"{",
"final",
"Properties",
"prop",
"=",
"new",
"Properties",
"(",
")",
";",
"// try to read in utf 8\r",
"prop",
".",
"load",
"(",
"new",
"InputStreamRea... | Read properties stream.
@param inputStream the input stream
@return the properties | [
"Read",
"properties",
"stream",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKIOUtil.java#L368-L381 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.rotate | public static void rotate(Image image, int degree, ImageOutputStream out) throws IORuntimeException {
writeJpg(rotate(image, degree), out);
} | java | public static void rotate(Image image, int degree, ImageOutputStream out) throws IORuntimeException {
writeJpg(rotate(image, degree), out);
} | [
"public",
"static",
"void",
"rotate",
"(",
"Image",
"image",
",",
"int",
"degree",
",",
"ImageOutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"writeJpg",
"(",
"rotate",
"(",
"image",
",",
"degree",
")",
",",
"out",
")",
";",
"}"
] | 旋转图片为指定角度<br>
此方法不会关闭输出流,输出格式为JPG
@param image 目标图像
@param degree 旋转角度
@param out 输出图像流
@since 3.2.2
@throws IORuntimeException IO异常 | [
"旋转图片为指定角度<br",
">",
"此方法不会关闭输出流,输出格式为JPG"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1044-L1046 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.toLEDouble | @Pure
@Inline(value = "Double.longBitsToDouble(EndianNumbers.toLELong($1, $2, $3, $4, $5, $6, $7, $8))",
imported = {EndianNumbers.class})
public static double toLEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return Double.longBitsToDouble(toLELong(b1, b2, b3, b4, b5, b6, b7, b8));
} | java | @Pure
@Inline(value = "Double.longBitsToDouble(EndianNumbers.toLELong($1, $2, $3, $4, $5, $6, $7, $8))",
imported = {EndianNumbers.class})
public static double toLEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return Double.longBitsToDouble(toLELong(b1, b2, b3, b4, b5, b6, b7, b8));
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"Double.longBitsToDouble(EndianNumbers.toLELong($1, $2, $3, $4, $5, $6, $7, $8))\"",
",",
"imported",
"=",
"{",
"EndianNumbers",
".",
"class",
"}",
")",
"public",
"static",
"double",
"toLEDouble",
"(",
"int",
"b1",
",",... | Converting eight bytes to a Little Endian double.
@param b1 the first byte.
@param b2 the second byte.
@param b3 the third byte.
@param b4 the fourth byte.
@param b5 the fifth byte.
@param b6 the sixth byte.
@param b7 the seventh byte.
@param b8 the eighth byte.
@return the conversion result | [
"Converting",
"eight",
"bytes",
"to",
"a",
"Little",
"Endian",
"double",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L145-L150 |
Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/netty/filter/BaseZuulFilterRunner.java | BaseZuulFilterRunner.shouldSkipFilter | protected final boolean shouldSkipFilter(final I inMesg, final ZuulFilter<I, O> filter) {
if (filter.filterType() == ENDPOINT) {
//Endpoints may not be skipped
return false;
}
final SessionContext zuulCtx = inMesg.getContext();
if ((zuulCtx.shouldStopFilterProcessing()) && (!filter.overrideStopFilterProcessing())) {
return true;
}
if (zuulCtx.isCancelled()) {
return true;
}
if (!filter.shouldFilter(inMesg)) {
return true;
}
return false;
} | java | protected final boolean shouldSkipFilter(final I inMesg, final ZuulFilter<I, O> filter) {
if (filter.filterType() == ENDPOINT) {
//Endpoints may not be skipped
return false;
}
final SessionContext zuulCtx = inMesg.getContext();
if ((zuulCtx.shouldStopFilterProcessing()) && (!filter.overrideStopFilterProcessing())) {
return true;
}
if (zuulCtx.isCancelled()) {
return true;
}
if (!filter.shouldFilter(inMesg)) {
return true;
}
return false;
} | [
"protected",
"final",
"boolean",
"shouldSkipFilter",
"(",
"final",
"I",
"inMesg",
",",
"final",
"ZuulFilter",
"<",
"I",
",",
"O",
">",
"filter",
")",
"{",
"if",
"(",
"filter",
".",
"filterType",
"(",
")",
"==",
"ENDPOINT",
")",
"{",
"//Endpoints may not be... | /* This is typically set by a filter when wanting to reject a request and also reduce load on the server by
not processing any more filterChain | [
"/",
"*",
"This",
"is",
"typically",
"set",
"by",
"a",
"filter",
"when",
"wanting",
"to",
"reject",
"a",
"request",
"and",
"also",
"reduce",
"load",
"on",
"the",
"server",
"by",
"not",
"processing",
"any",
"more",
"filterChain"
] | train | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/netty/filter/BaseZuulFilterRunner.java#L202-L218 |
wisdom-framework/wisdom | core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java | ConfigurationImpl.getList | @Override
public List<String> getList(final String key) {
return retrieve(new Callable<List<String>>() {
@Override
public List<String> call() throws Exception {
try {
return configuration.getStringList(key);
} catch (ConfigException.WrongType e) {
// Not a list.
String s = get(key);
if (s != null) {
return ImmutableList.of(s);
} else {
throw new IllegalArgumentException("Cannot create a list for the key '" + key + "'", e);
}
}
}
}, Collections.<String>emptyList());
} | java | @Override
public List<String> getList(final String key) {
return retrieve(new Callable<List<String>>() {
@Override
public List<String> call() throws Exception {
try {
return configuration.getStringList(key);
} catch (ConfigException.WrongType e) {
// Not a list.
String s = get(key);
if (s != null) {
return ImmutableList.of(s);
} else {
throw new IllegalArgumentException("Cannot create a list for the key '" + key + "'", e);
}
}
}
}, Collections.<String>emptyList());
} | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"getList",
"(",
"final",
"String",
"key",
")",
"{",
"return",
"retrieve",
"(",
"new",
"Callable",
"<",
"List",
"<",
"String",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"Str... | Retrieves the values as a list of String, the format is: key=[myval1,myval2].
@param key the key the key used in the configuration file.
@return an list containing the values of that key or empty if not found. | [
"Retrieves",
"the",
"values",
"as",
"a",
"list",
"of",
"String",
"the",
"format",
"is",
":",
"key",
"=",
"[",
"myval1",
"myval2",
"]",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L405-L423 |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java | ExampleFitPolygon.fitCannyEdges | public static void fitCannyEdges( GrayF32 input ) {
BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
// Finds edges inside the image
CannyEdge<GrayF32,GrayF32> canny =
FactoryEdgeDetectors.canny(2, true, true, GrayF32.class, GrayF32.class);
canny.process(input,0.1f,0.3f,null);
List<EdgeContour> contours = canny.getContours();
Graphics2D g2 = displayImage.createGraphics();
g2.setStroke(new BasicStroke(2));
// used to select colors for each line
Random rand = new Random(234);
for( EdgeContour e : contours ) {
g2.setColor(new Color(rand.nextInt()));
for(EdgeSegment s : e.segments ) {
// fit line segments to the point sequence. Note that loop is false
List<PointIndex_I32> vertexes = ShapeFittingOps.fitPolygon(s.points,false, minSide,cornerPenalty);
VisualizeShapes.drawPolygon(vertexes, false, g2);
}
}
gui.addImage(displayImage, "Canny Trace");
} | java | public static void fitCannyEdges( GrayF32 input ) {
BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
// Finds edges inside the image
CannyEdge<GrayF32,GrayF32> canny =
FactoryEdgeDetectors.canny(2, true, true, GrayF32.class, GrayF32.class);
canny.process(input,0.1f,0.3f,null);
List<EdgeContour> contours = canny.getContours();
Graphics2D g2 = displayImage.createGraphics();
g2.setStroke(new BasicStroke(2));
// used to select colors for each line
Random rand = new Random(234);
for( EdgeContour e : contours ) {
g2.setColor(new Color(rand.nextInt()));
for(EdgeSegment s : e.segments ) {
// fit line segments to the point sequence. Note that loop is false
List<PointIndex_I32> vertexes = ShapeFittingOps.fitPolygon(s.points,false, minSide,cornerPenalty);
VisualizeShapes.drawPolygon(vertexes, false, g2);
}
}
gui.addImage(displayImage, "Canny Trace");
} | [
"public",
"static",
"void",
"fitCannyEdges",
"(",
"GrayF32",
"input",
")",
"{",
"BufferedImage",
"displayImage",
"=",
"new",
"BufferedImage",
"(",
"input",
".",
"width",
",",
"input",
".",
"height",
",",
"BufferedImage",
".",
"TYPE_INT_RGB",
")",
";",
"// Find... | Fits a sequence of line-segments into a sequence of points found using the Canny edge detector. In this case
the points are not connected in a loop. The canny detector produces a more complex tree and the fitted
points can be a bit noisy compared to the others. | [
"Fits",
"a",
"sequence",
"of",
"line",
"-",
"segments",
"into",
"a",
"sequence",
"of",
"points",
"found",
"using",
"the",
"Canny",
"edge",
"detector",
".",
"In",
"this",
"case",
"the",
"points",
"are",
"not",
"connected",
"in",
"a",
"loop",
".",
"The",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleFitPolygon.java#L111-L140 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/IfixParser.java | IfixParser.getProvides | private List<String> getProvides(IFixInfo iFixInfo, ParserBase.ExtractedFileInformation xmlInfo) throws RepositoryArchiveInvalidEntryException {
// check for null input
if (null == iFixInfo) {
throw new RepositoryArchiveInvalidEntryException("Null document provided", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive());
}
Resolves resolves = iFixInfo.getResolves();
if (null == resolves) {
throw new RepositoryArchiveInvalidEntryException("Document does not contain a \"resolves\" node", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive());
}
// Get child nodes and look for APAR ids
List<String> retList = new ArrayList<String>();
List<Problem> problems = resolves.getProblems();
if (problems != null) {
for (Problem problem : problems) {
String displayId = problem.getDisplayId();
if (null == displayId) {
throw new RepositoryArchiveInvalidEntryException("Unexpected null getting APAR id", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive());
}
retList.add(displayId);
}
}
return retList;
} | java | private List<String> getProvides(IFixInfo iFixInfo, ParserBase.ExtractedFileInformation xmlInfo) throws RepositoryArchiveInvalidEntryException {
// check for null input
if (null == iFixInfo) {
throw new RepositoryArchiveInvalidEntryException("Null document provided", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive());
}
Resolves resolves = iFixInfo.getResolves();
if (null == resolves) {
throw new RepositoryArchiveInvalidEntryException("Document does not contain a \"resolves\" node", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive());
}
// Get child nodes and look for APAR ids
List<String> retList = new ArrayList<String>();
List<Problem> problems = resolves.getProblems();
if (problems != null) {
for (Problem problem : problems) {
String displayId = problem.getDisplayId();
if (null == displayId) {
throw new RepositoryArchiveInvalidEntryException("Unexpected null getting APAR id", xmlInfo.getSourceArchive(), xmlInfo.getSelectedPathFromArchive());
}
retList.add(displayId);
}
}
return retList;
} | [
"private",
"List",
"<",
"String",
">",
"getProvides",
"(",
"IFixInfo",
"iFixInfo",
",",
"ParserBase",
".",
"ExtractedFileInformation",
"xmlInfo",
")",
"throws",
"RepositoryArchiveInvalidEntryException",
"{",
"// check for null input",
"if",
"(",
"null",
"==",
"iFixInfo"... | Get a list of the APARs fixed by this iFix
@param iFixInfo
@return The list of fixed APARs
@throws MassiveInvalidXmlException | [
"Get",
"a",
"list",
"of",
"the",
"APARs",
"fixed",
"by",
"this",
"iFix"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/IfixParser.java#L161-L187 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PermissionsImpl.java | PermissionsImpl.deleteWithServiceResponseAsync | public Observable<ServiceResponse<OperationStatus>> deleteWithServiceResponseAsync(UUID appId, DeletePermissionsOptionalParameter deleteOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
final String email = deleteOptionalParameter != null ? deleteOptionalParameter.email() : null;
return deleteWithServiceResponseAsync(appId, email);
} | java | public Observable<ServiceResponse<OperationStatus>> deleteWithServiceResponseAsync(UUID appId, DeletePermissionsOptionalParameter deleteOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
final String email = deleteOptionalParameter != null ? deleteOptionalParameter.email() : null;
return deleteWithServiceResponseAsync(appId, email);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"OperationStatus",
">",
">",
"deleteWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"DeletePermissionsOptionalParameter",
"deleteOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"endpoint",
... | Removes a user from the allowed list of users to access this LUIS application. Users are removed using their email address.
@param appId The application ID.
@param deleteOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Removes",
"a",
"user",
"from",
"the",
"allowed",
"list",
"of",
"users",
"to",
"access",
"this",
"LUIS",
"application",
".",
"Users",
"are",
"removed",
"using",
"their",
"email",
"address",
"."
] | 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/PermissionsImpl.java#L370-L380 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/tools/IPConfig.java | IPConfig.createRemoteAdapter | private PropertyAdapter createRemoteAdapter(InetSocketAddress local,
InetSocketAddress host, Map options) throws KNXException
{
final KNXMediumSettings medium = (KNXMediumSettings) options.get("medium");
if (options.containsKey("serial")) {
// create FT1.2 network link
final String p = (String) options.get("serial");
try {
lnk = new KNXNetworkLinkFT12(Integer.parseInt(p), medium);
}
catch (final NumberFormatException e) {
lnk = new KNXNetworkLinkFT12(p, medium);
}
}
else {
final int mode = options.containsKey("routing") ? KNXNetworkLinkIP.ROUTER
: KNXNetworkLinkIP.TUNNEL;
lnk = new KNXNetworkLinkIP(mode, local, host, options.containsKey("nat"),
medium);
}
final IndividualAddress remote = (IndividualAddress) options.get("remote");
// if an authorization key was supplied, the adapter uses
// connection oriented mode and tries to authenticate
final byte[] authKey = (byte[]) options.get("authorize");
if (authKey != null)
return new RemotePropertyServiceAdapter(lnk, remote, null, authKey);
return new RemotePropertyServiceAdapter(lnk, remote, null, options
.containsKey("connect"));
} | java | private PropertyAdapter createRemoteAdapter(InetSocketAddress local,
InetSocketAddress host, Map options) throws KNXException
{
final KNXMediumSettings medium = (KNXMediumSettings) options.get("medium");
if (options.containsKey("serial")) {
// create FT1.2 network link
final String p = (String) options.get("serial");
try {
lnk = new KNXNetworkLinkFT12(Integer.parseInt(p), medium);
}
catch (final NumberFormatException e) {
lnk = new KNXNetworkLinkFT12(p, medium);
}
}
else {
final int mode = options.containsKey("routing") ? KNXNetworkLinkIP.ROUTER
: KNXNetworkLinkIP.TUNNEL;
lnk = new KNXNetworkLinkIP(mode, local, host, options.containsKey("nat"),
medium);
}
final IndividualAddress remote = (IndividualAddress) options.get("remote");
// if an authorization key was supplied, the adapter uses
// connection oriented mode and tries to authenticate
final byte[] authKey = (byte[]) options.get("authorize");
if (authKey != null)
return new RemotePropertyServiceAdapter(lnk, remote, null, authKey);
return new RemotePropertyServiceAdapter(lnk, remote, null, options
.containsKey("connect"));
} | [
"private",
"PropertyAdapter",
"createRemoteAdapter",
"(",
"InetSocketAddress",
"local",
",",
"InetSocketAddress",
"host",
",",
"Map",
"options",
")",
"throws",
"KNXException",
"{",
"final",
"KNXMediumSettings",
"medium",
"=",
"(",
"KNXMediumSettings",
")",
"options",
... | Creates a remote property service adapter for one device in the KNX network.
<p>
The adapter uses a KNX network link for access, also is created by this method.
@param local local socket address
@param host remote socket address of host
@param options contains parameters for property adapter creation
@return remote property service adapter
@throws KNXException on adapter creation problem | [
"Creates",
"a",
"remote",
"property",
"service",
"adapter",
"for",
"one",
"device",
"in",
"the",
"KNX",
"network",
".",
"<p",
">",
"The",
"adapter",
"uses",
"a",
"KNX",
"network",
"link",
"for",
"access",
"also",
"is",
"created",
"by",
"this",
"method",
... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/tools/IPConfig.java#L440-L468 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java | ExpressRouteCrossConnectionsInner.getByResourceGroup | public ExpressRouteCrossConnectionInner getByResourceGroup(String resourceGroupName, String crossConnectionName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, crossConnectionName).toBlocking().single().body();
} | java | public ExpressRouteCrossConnectionInner getByResourceGroup(String resourceGroupName, String crossConnectionName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, crossConnectionName).toBlocking().single().body();
} | [
"public",
"ExpressRouteCrossConnectionInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"crossConnectionName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"crossConnectionName",
")",
".",
"toBlo... | Gets details about the specified ExpressRouteCrossConnection.
@param resourceGroupName The name of the resource group (peering location of the circuit).
@param crossConnectionName The name of the ExpressRouteCrossConnection (service key of the circuit).
@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 ExpressRouteCrossConnectionInner object if successful. | [
"Gets",
"details",
"about",
"the",
"specified",
"ExpressRouteCrossConnection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L359-L361 |
apereo/cas | core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/CoreAuthenticationUtils.java | CoreAuthenticationUtils.isRememberMeAuthentication | public static boolean isRememberMeAuthentication(final Authentication model, final Assertion assertion) {
val authnAttributes = model.getAttributes();
val authnMethod = authnAttributes.get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME);
return authnMethod != null && authnMethod.contains(Boolean.TRUE) && assertion.isFromNewLogin();
} | java | public static boolean isRememberMeAuthentication(final Authentication model, final Assertion assertion) {
val authnAttributes = model.getAttributes();
val authnMethod = authnAttributes.get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME);
return authnMethod != null && authnMethod.contains(Boolean.TRUE) && assertion.isFromNewLogin();
} | [
"public",
"static",
"boolean",
"isRememberMeAuthentication",
"(",
"final",
"Authentication",
"model",
",",
"final",
"Assertion",
"assertion",
")",
"{",
"val",
"authnAttributes",
"=",
"model",
".",
"getAttributes",
"(",
")",
";",
"val",
"authnMethod",
"=",
"authnAt... | Is remember me authentication?
looks at the authentication object to find {@link RememberMeCredential#AUTHENTICATION_ATTRIBUTE_REMEMBER_ME}
and expects the assertion to also note a new login session.
@param model the model
@param assertion the assertion
@return true if remember-me, false if otherwise. | [
"Is",
"remember",
"me",
"authentication?",
"looks",
"at",
"the",
"authentication",
"object",
"to",
"find",
"{",
"@link",
"RememberMeCredential#AUTHENTICATION_ATTRIBUTE_REMEMBER_ME",
"}",
"and",
"expects",
"the",
"assertion",
"to",
"also",
"note",
"a",
"new",
"login",
... | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/CoreAuthenticationUtils.java#L143-L147 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/ChainedTransformationTools.java | ChainedTransformationTools.nextInChainResource | public static ResourceTransformationContext nextInChainResource(ResourceTransformationContext context, PlaceholderResolver placeholderResolver) {
assert context instanceof ResourceTransformationContextImpl : "Wrong type of context";
ResourceTransformationContextImpl ctx = (ResourceTransformationContextImpl)context;
ResourceTransformationContext copy = ctx.copyAndReplaceOriginalModel(placeholderResolver);
return copy;
} | java | public static ResourceTransformationContext nextInChainResource(ResourceTransformationContext context, PlaceholderResolver placeholderResolver) {
assert context instanceof ResourceTransformationContextImpl : "Wrong type of context";
ResourceTransformationContextImpl ctx = (ResourceTransformationContextImpl)context;
ResourceTransformationContext copy = ctx.copyAndReplaceOriginalModel(placeholderResolver);
return copy;
} | [
"public",
"static",
"ResourceTransformationContext",
"nextInChainResource",
"(",
"ResourceTransformationContext",
"context",
",",
"PlaceholderResolver",
"placeholderResolver",
")",
"{",
"assert",
"context",
"instanceof",
"ResourceTransformationContextImpl",
":",
"\"Wrong type of co... | Call when transforming a new model version delta for a resource. This will copy the {@link ResourceTransformationContext} instance, using the extra resolver
to resolve the children of the placeholder resource.
@param context the context to copy. It should be at a chained placeholder
@param placeholderResolver the extra resolver to use to resolve the placeholder's children for the model version delta we are transforming
@return a new {@code ResourceTransformationContext} instance using the extra resolver | [
"Call",
"when",
"transforming",
"a",
"new",
"model",
"version",
"delta",
"for",
"a",
"resource",
".",
"This",
"will",
"copy",
"the",
"{",
"@link",
"ResourceTransformationContext",
"}",
"instance",
"using",
"the",
"extra",
"resolver",
"to",
"resolve",
"the",
"c... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/ChainedTransformationTools.java#L59-L65 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.appendQuoted | public static void appendQuoted (@Nonnull final Appendable aTarget, @Nullable final String sSource) throws IOException
{
if (sSource == null)
aTarget.append ("null");
else
aTarget.append ('\'').append (sSource).append ('\'');
} | java | public static void appendQuoted (@Nonnull final Appendable aTarget, @Nullable final String sSource) throws IOException
{
if (sSource == null)
aTarget.append ("null");
else
aTarget.append ('\'').append (sSource).append ('\'');
} | [
"public",
"static",
"void",
"appendQuoted",
"(",
"@",
"Nonnull",
"final",
"Appendable",
"aTarget",
",",
"@",
"Nullable",
"final",
"String",
"sSource",
")",
"throws",
"IOException",
"{",
"if",
"(",
"sSource",
"==",
"null",
")",
"aTarget",
".",
"append",
"(",
... | Append the provided string quoted or unquoted if it is <code>null</code>.
@param aTarget
The target to write to. May not be <code>null</code>.
@param sSource
Source string. May be <code>null</code>.
@throws IOException
in case of IO error
@see #getQuoted(String)
@since 9.2.0 | [
"Append",
"the",
"provided",
"string",
"quoted",
"or",
"unquoted",
"if",
"it",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2531-L2537 |
StripesFramework/stripes-stuff | src/main/java/org/stripesstuff/plugin/jstl/JstlBundleInterceptor.java | JstlBundleInterceptor.setOtherResourceBundles | @Override
protected void setOtherResourceBundles(HttpServletRequest request)
{
Locale locale = request.getLocale();
if (errorBundleName != null)
{
ResourceBundle errorBundle = getLocalizationBundleFactory().getErrorMessageBundle(locale);
Config.set(request, errorBundleName, new LocalizationContext(errorBundle, locale));
LOGGER.debug("Loaded Stripes error message bundle ", errorBundle, " as ", errorBundleName);
}
if (fieldBundleName != null)
{
ResourceBundle fieldBundle = getLocalizationBundleFactory().getFormFieldBundle(locale);
Config.set(request, fieldBundleName, new LocalizationContext(fieldBundle, locale));
LOGGER.debug("Loaded Stripes field name bundle ", fieldBundle, " as ", fieldBundleName);
}
} | java | @Override
protected void setOtherResourceBundles(HttpServletRequest request)
{
Locale locale = request.getLocale();
if (errorBundleName != null)
{
ResourceBundle errorBundle = getLocalizationBundleFactory().getErrorMessageBundle(locale);
Config.set(request, errorBundleName, new LocalizationContext(errorBundle, locale));
LOGGER.debug("Loaded Stripes error message bundle ", errorBundle, " as ", errorBundleName);
}
if (fieldBundleName != null)
{
ResourceBundle fieldBundle = getLocalizationBundleFactory().getFormFieldBundle(locale);
Config.set(request, fieldBundleName, new LocalizationContext(fieldBundle, locale));
LOGGER.debug("Loaded Stripes field name bundle ", fieldBundle, " as ", fieldBundleName);
}
} | [
"@",
"Override",
"protected",
"void",
"setOtherResourceBundles",
"(",
"HttpServletRequest",
"request",
")",
"{",
"Locale",
"locale",
"=",
"request",
".",
"getLocale",
"(",
")",
";",
"if",
"(",
"errorBundleName",
"!=",
"null",
")",
"{",
"ResourceBundle",
"errorBu... | Sets the Stripes error and field resource bundles in the request, if their names have been configured. | [
"Sets",
"the",
"Stripes",
"error",
"and",
"field",
"resource",
"bundles",
"in",
"the",
"request",
"if",
"their",
"names",
"have",
"been",
"configured",
"."
] | train | https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/jstl/JstlBundleInterceptor.java#L115-L133 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGate.java | ManagementGate.insertForwardEdge | void insertForwardEdge(final ManagementEdge managementEdge, final int index) {
while (index >= this.forwardEdges.size()) {
this.forwardEdges.add(null);
}
this.forwardEdges.set(index, managementEdge);
} | java | void insertForwardEdge(final ManagementEdge managementEdge, final int index) {
while (index >= this.forwardEdges.size()) {
this.forwardEdges.add(null);
}
this.forwardEdges.set(index, managementEdge);
} | [
"void",
"insertForwardEdge",
"(",
"final",
"ManagementEdge",
"managementEdge",
",",
"final",
"int",
"index",
")",
"{",
"while",
"(",
"index",
">=",
"this",
".",
"forwardEdges",
".",
"size",
"(",
")",
")",
"{",
"this",
".",
"forwardEdges",
".",
"add",
"(",
... | Adds a new edge which originates at this gate.
@param managementEdge
the edge to be added
@param index
the index at which the edge shall be added | [
"Adds",
"a",
"new",
"edge",
"which",
"originates",
"at",
"this",
"gate",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGate.java#L100-L107 |
cloudfoundry/uaa | server/src/main/java/org/cloudfoundry/identity/uaa/oauth/beans/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java | DefaultRedirectResolver.redirectMatches | protected boolean redirectMatches(String requestedRedirect, String redirectUri) {
try {
URL req = new URL(requestedRedirect);
URL reg = new URL(redirectUri);
int requestedPort = req.getPort() != -1 ? req.getPort() : req.getDefaultPort();
int registeredPort = reg.getPort() != -1 ? reg.getPort() : reg.getDefaultPort();
boolean portsMatch = matchPorts ? (registeredPort == requestedPort) : true;
if (reg.getProtocol().equals(req.getProtocol()) &&
hostMatches(reg.getHost(), req.getHost()) &&
portsMatch) {
return StringUtils.cleanPath(req.getPath()).startsWith(StringUtils.cleanPath(reg.getPath()));
}
}
catch (MalformedURLException e) {
}
return requestedRedirect.equals(redirectUri);
} | java | protected boolean redirectMatches(String requestedRedirect, String redirectUri) {
try {
URL req = new URL(requestedRedirect);
URL reg = new URL(redirectUri);
int requestedPort = req.getPort() != -1 ? req.getPort() : req.getDefaultPort();
int registeredPort = reg.getPort() != -1 ? reg.getPort() : reg.getDefaultPort();
boolean portsMatch = matchPorts ? (registeredPort == requestedPort) : true;
if (reg.getProtocol().equals(req.getProtocol()) &&
hostMatches(reg.getHost(), req.getHost()) &&
portsMatch) {
return StringUtils.cleanPath(req.getPath()).startsWith(StringUtils.cleanPath(reg.getPath()));
}
}
catch (MalformedURLException e) {
}
return requestedRedirect.equals(redirectUri);
} | [
"protected",
"boolean",
"redirectMatches",
"(",
"String",
"requestedRedirect",
",",
"String",
"redirectUri",
")",
"{",
"try",
"{",
"URL",
"req",
"=",
"new",
"URL",
"(",
"requestedRedirect",
")",
";",
"URL",
"reg",
"=",
"new",
"URL",
"(",
"redirectUri",
")",
... | Whether the requested redirect URI "matches" the specified redirect URI. For a URL, this implementation tests if
the user requested redirect starts with the registered redirect, so it would have the same host and root path if
it is an HTTP URL. The port is also matched.
<p>
For other (non-URL) cases, such as for some implicit clients, the redirect_uri must be an exact match.
@param requestedRedirect The requested redirect URI.
@param redirectUri The registered redirect URI.
@return Whether the requested redirect URI "matches" the specified redirect URI. | [
"Whether",
"the",
"requested",
"redirect",
"URI",
"matches",
"the",
"specified",
"redirect",
"URI",
".",
"For",
"a",
"URL",
"this",
"implementation",
"tests",
"if",
"the",
"user",
"requested",
"redirect",
"starts",
"with",
"the",
"registered",
"redirect",
"so",
... | train | https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/oauth/beans/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java#L133-L152 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/RestClient.java | RestClient.getAttachment | @Override
public InputStream getAttachment(final Asset asset, final Attachment attachment) throws IOException, BadVersionException, RequestFailureException {
// accept license for type CONTENT
HttpURLConnection connection;
if (attachment.getType() == AttachmentType.CONTENT) {
connection = createHttpURLConnection(attachment.getUrl() + "?license=agree");
} else {
connection = createHttpURLConnection(attachment.getUrl());
}
// If the attachment was a link and we have a basic auth userid + password specified
// we are attempting to access the files staged from a protected site so authorise for it
if (attachment.getLinkType() == AttachmentLinkType.DIRECT) {
if ((loginInfo.getAttachmentBasicAuthUserId() != null) && (loginInfo.getAttachmentBasicAuthPassword() != null)) {
String userpass = loginInfo.getAttachmentBasicAuthUserId() + ":" + loginInfo.getAttachmentBasicAuthPassword();
String basicAuth = "Basic " + encode(userpass.getBytes(Charset.forName("UTF-8")));
connection.setRequestProperty("Authorization", basicAuth);
}
}
connection.setRequestMethod("GET");
testResponseCode(connection);
return connection.getInputStream();
} | java | @Override
public InputStream getAttachment(final Asset asset, final Attachment attachment) throws IOException, BadVersionException, RequestFailureException {
// accept license for type CONTENT
HttpURLConnection connection;
if (attachment.getType() == AttachmentType.CONTENT) {
connection = createHttpURLConnection(attachment.getUrl() + "?license=agree");
} else {
connection = createHttpURLConnection(attachment.getUrl());
}
// If the attachment was a link and we have a basic auth userid + password specified
// we are attempting to access the files staged from a protected site so authorise for it
if (attachment.getLinkType() == AttachmentLinkType.DIRECT) {
if ((loginInfo.getAttachmentBasicAuthUserId() != null) && (loginInfo.getAttachmentBasicAuthPassword() != null)) {
String userpass = loginInfo.getAttachmentBasicAuthUserId() + ":" + loginInfo.getAttachmentBasicAuthPassword();
String basicAuth = "Basic " + encode(userpass.getBytes(Charset.forName("UTF-8")));
connection.setRequestProperty("Authorization", basicAuth);
}
}
connection.setRequestMethod("GET");
testResponseCode(connection);
return connection.getInputStream();
} | [
"@",
"Override",
"public",
"InputStream",
"getAttachment",
"(",
"final",
"Asset",
"asset",
",",
"final",
"Attachment",
"attachment",
")",
"throws",
"IOException",
",",
"BadVersionException",
",",
"RequestFailureException",
"{",
"// accept license for type CONTENT",
"HttpU... | Returns the contents of an attachment
@param assetId
The ID of the asset owning the attachment
@param attachmentId
The ID of the attachment
@return The input stream for the attachment
@throws IOException
@throws RequestFailureException | [
"Returns",
"the",
"contents",
"of",
"an",
"attachment"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/RestClient.java#L466-L490 |
codescape/bitvunit | bitvunit-core/src/main/java/de/codescape/bitvunit/util/Assert.java | Assert.notEmpty | public static void notEmpty(String message, String string) {
if (string == null || string.trim().isEmpty()) {
throw new IllegalArgumentException(message);
}
} | java | public static void notEmpty(String message, String string) {
if (string == null || string.trim().isEmpty()) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"notEmpty",
"(",
"String",
"message",
",",
"String",
"string",
")",
"{",
"if",
"(",
"string",
"==",
"null",
"||",
"string",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",... | Verifies that the given string is neither <code>null</code> nor empty and throws an
<code>IllegalArgumentException</code> with the given message otherwise.
@param message message that should be included in case of an error
@param string string that should be checked | [
"Verifies",
"that",
"the",
"given",
"string",
"is",
"neither",
"<code",
">",
"null<",
"/",
"code",
">",
"nor",
"empty",
"and",
"throws",
"an",
"<code",
">",
"IllegalArgumentException<",
"/",
"code",
">",
"with",
"the",
"given",
"message",
"otherwise",
"."
] | train | https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/util/Assert.java#L68-L72 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/internal/EvaluateSquaredErrors.java | EvaluateSquaredErrors.evaluateClustering | public double evaluateClustering(Database db, Relation<? extends NumberVector> rel, Clustering<?> c) {
boolean square = !distance.isSquared();
int ignorednoise = 0;
List<? extends Cluster<?>> clusters = c.getAllClusters();
double ssq = 0, sum = 0;
for(Cluster<?> cluster : clusters) {
if(cluster.size() <= 1 || cluster.isNoise()) {
switch(noiseOption){
case IGNORE_NOISE:
ignorednoise += cluster.size();
continue;
case TREAT_NOISE_AS_SINGLETONS:
continue;
case MERGE_NOISE:
break; // Treat as cluster below:
}
}
NumberVector center = ModelUtil.getPrototypeOrCentroid(cluster.getModel(), rel, cluster.getIDs());
for(DBIDIter it1 = cluster.getIDs().iter(); it1.valid(); it1.advance()) {
final double d = distance.distance(center, rel.get(it1));
sum += d;
ssq += square ? d * d : d;
}
}
final int div = Math.max(1, rel.size() - ignorednoise);
if(LOG.isStatistics()) {
LOG.statistics(new DoubleStatistic(key + ".mean", sum / div));
LOG.statistics(new DoubleStatistic(key + ".ssq", ssq));
LOG.statistics(new DoubleStatistic(key + ".rmsd", FastMath.sqrt(ssq / div)));
}
EvaluationResult ev = EvaluationResult.findOrCreate(db.getHierarchy(), c, "Internal Clustering Evaluation", "internal evaluation");
MeasurementGroup g = ev.findOrCreateGroup("Distance-based Evaluation");
g.addMeasure("Mean distance", sum / div, 0., Double.POSITIVE_INFINITY, true);
g.addMeasure("Sum of Squares", ssq, 0., Double.POSITIVE_INFINITY, true);
g.addMeasure("RMSD", FastMath.sqrt(ssq / div), 0., Double.POSITIVE_INFINITY, true);
db.getHierarchy().add(c, ev);
return ssq;
} | java | public double evaluateClustering(Database db, Relation<? extends NumberVector> rel, Clustering<?> c) {
boolean square = !distance.isSquared();
int ignorednoise = 0;
List<? extends Cluster<?>> clusters = c.getAllClusters();
double ssq = 0, sum = 0;
for(Cluster<?> cluster : clusters) {
if(cluster.size() <= 1 || cluster.isNoise()) {
switch(noiseOption){
case IGNORE_NOISE:
ignorednoise += cluster.size();
continue;
case TREAT_NOISE_AS_SINGLETONS:
continue;
case MERGE_NOISE:
break; // Treat as cluster below:
}
}
NumberVector center = ModelUtil.getPrototypeOrCentroid(cluster.getModel(), rel, cluster.getIDs());
for(DBIDIter it1 = cluster.getIDs().iter(); it1.valid(); it1.advance()) {
final double d = distance.distance(center, rel.get(it1));
sum += d;
ssq += square ? d * d : d;
}
}
final int div = Math.max(1, rel.size() - ignorednoise);
if(LOG.isStatistics()) {
LOG.statistics(new DoubleStatistic(key + ".mean", sum / div));
LOG.statistics(new DoubleStatistic(key + ".ssq", ssq));
LOG.statistics(new DoubleStatistic(key + ".rmsd", FastMath.sqrt(ssq / div)));
}
EvaluationResult ev = EvaluationResult.findOrCreate(db.getHierarchy(), c, "Internal Clustering Evaluation", "internal evaluation");
MeasurementGroup g = ev.findOrCreateGroup("Distance-based Evaluation");
g.addMeasure("Mean distance", sum / div, 0., Double.POSITIVE_INFINITY, true);
g.addMeasure("Sum of Squares", ssq, 0., Double.POSITIVE_INFINITY, true);
g.addMeasure("RMSD", FastMath.sqrt(ssq / div), 0., Double.POSITIVE_INFINITY, true);
db.getHierarchy().add(c, ev);
return ssq;
} | [
"public",
"double",
"evaluateClustering",
"(",
"Database",
"db",
",",
"Relation",
"<",
"?",
"extends",
"NumberVector",
">",
"rel",
",",
"Clustering",
"<",
"?",
">",
"c",
")",
"{",
"boolean",
"square",
"=",
"!",
"distance",
".",
"isSquared",
"(",
")",
";"... | Evaluate a single clustering.
@param db Database
@param rel Data relation
@param c Clustering
@return ssq | [
"Evaluate",
"a",
"single",
"clustering",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/internal/EvaluateSquaredErrors.java#L113-L152 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java | WebhooksInner.pingAsync | public Observable<EventInfoInner> pingAsync(String resourceGroupName, String registryName, String webhookName) {
return pingWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<EventInfoInner>, EventInfoInner>() {
@Override
public EventInfoInner call(ServiceResponse<EventInfoInner> response) {
return response.body();
}
});
} | java | public Observable<EventInfoInner> pingAsync(String resourceGroupName, String registryName, String webhookName) {
return pingWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<EventInfoInner>, EventInfoInner>() {
@Override
public EventInfoInner call(ServiceResponse<EventInfoInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EventInfoInner",
">",
"pingAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"webhookName",
")",
"{",
"return",
"pingWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"w... | Triggers a ping event to be sent to the webhook.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param webhookName The name of the webhook.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EventInfoInner object | [
"Triggers",
"a",
"ping",
"event",
"to",
"be",
"sent",
"to",
"the",
"webhook",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L901-L908 |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/stereo/ExampleStereoTwoViewsOneCamera.java | ExampleStereoTwoViewsOneCamera.estimateCameraMotion | public static Se3_F64 estimateCameraMotion(CameraPinholeBrown intrinsic,
List<AssociatedPair> matchedNorm, List<AssociatedPair> inliers)
{
ModelMatcherMultiview<Se3_F64, AssociatedPair> epipolarMotion =
FactoryMultiViewRobust.baselineRansac(new ConfigEssential(),new ConfigRansac(200,0.5));
epipolarMotion.setIntrinsic(0,intrinsic);
epipolarMotion.setIntrinsic(1,intrinsic);
if (!epipolarMotion.process(matchedNorm))
throw new RuntimeException("Motion estimation failed");
// save inlier set for debugging purposes
inliers.addAll(epipolarMotion.getMatchSet());
return epipolarMotion.getModelParameters();
} | java | public static Se3_F64 estimateCameraMotion(CameraPinholeBrown intrinsic,
List<AssociatedPair> matchedNorm, List<AssociatedPair> inliers)
{
ModelMatcherMultiview<Se3_F64, AssociatedPair> epipolarMotion =
FactoryMultiViewRobust.baselineRansac(new ConfigEssential(),new ConfigRansac(200,0.5));
epipolarMotion.setIntrinsic(0,intrinsic);
epipolarMotion.setIntrinsic(1,intrinsic);
if (!epipolarMotion.process(matchedNorm))
throw new RuntimeException("Motion estimation failed");
// save inlier set for debugging purposes
inliers.addAll(epipolarMotion.getMatchSet());
return epipolarMotion.getModelParameters();
} | [
"public",
"static",
"Se3_F64",
"estimateCameraMotion",
"(",
"CameraPinholeBrown",
"intrinsic",
",",
"List",
"<",
"AssociatedPair",
">",
"matchedNorm",
",",
"List",
"<",
"AssociatedPair",
">",
"inliers",
")",
"{",
"ModelMatcherMultiview",
"<",
"Se3_F64",
",",
"Associ... | Estimates the camera motion robustly using RANSAC and a set of associated points.
@param intrinsic Intrinsic camera parameters
@param matchedNorm set of matched point features in normalized image coordinates
@param inliers OUTPUT: Set of inlier features from RANSAC
@return Found camera motion. Note translation has an arbitrary scale | [
"Estimates",
"the",
"camera",
"motion",
"robustly",
"using",
"RANSAC",
"and",
"a",
"set",
"of",
"associated",
"points",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/stereo/ExampleStereoTwoViewsOneCamera.java#L155-L170 |
JosePaumard/streams-utils | src/main/java/org/paumard/streams/StreamsUtils.java | StreamsUtils.shiftingWindowSummarizingDouble | public static <E> Stream<DoubleSummaryStatistics> shiftingWindowSummarizingDouble(Stream<E> stream, int rollingFactor, ToDoubleFunction<? super E> mapper) {
Objects.requireNonNull(stream);
Objects.requireNonNull(mapper);
DoubleStream doubleStream = stream.mapToDouble(mapper);
return shiftingWindowSummarizingLong(doubleStream, rollingFactor);
} | java | public static <E> Stream<DoubleSummaryStatistics> shiftingWindowSummarizingDouble(Stream<E> stream, int rollingFactor, ToDoubleFunction<? super E> mapper) {
Objects.requireNonNull(stream);
Objects.requireNonNull(mapper);
DoubleStream doubleStream = stream.mapToDouble(mapper);
return shiftingWindowSummarizingLong(doubleStream, rollingFactor);
} | [
"public",
"static",
"<",
"E",
">",
"Stream",
"<",
"DoubleSummaryStatistics",
">",
"shiftingWindowSummarizingDouble",
"(",
"Stream",
"<",
"E",
">",
"stream",
",",
"int",
"rollingFactor",
",",
"ToDoubleFunction",
"<",
"?",
"super",
"E",
">",
"mapper",
")",
"{",
... | <p>Generates a stream that is computed from a provided stream following two steps.</p>
<p>The first steps maps this stream to a <code>DoubleStream</code> that is then rolled following
the same principle as the <code>roll()</code> method. This steps builds a <code>Stream<DoubleStream></code>.
</p>
<p>Then double summary statistics are computed on each <code>DoubleStream</code> using a <code>collect()</code> call,
and a <code>Stream<DoubleSummaryStatistics></code> is returned.</p>
<p>The resulting stream has the same number of elements as the provided stream,
minus the size of the window width, to preserve consistency of each collection. </p>
<p>A <code>NullPointerException</code> will be thrown if the provided stream is null.</p>
@param stream the processed stream
@param rollingFactor the size of the window to apply the collector on
@param mapper the mapper applied
@param <E> the type of the provided stream
@return a stream in which each value is the collection of the provided stream | [
"<p",
">",
"Generates",
"a",
"stream",
"that",
"is",
"computed",
"from",
"a",
"provided",
"stream",
"following",
"two",
"steps",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"first",
"steps",
"maps",
"this",
"stream",
"to",
"a",
"<code",
">",
"DoubleStre... | train | https://github.com/JosePaumard/streams-utils/blob/56152574af0aca44c5f679761202a8f90984ab73/src/main/java/org/paumard/streams/StreamsUtils.java#L804-L810 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/tracer/Tracer.java | Tracer.createManagedConnectionPool | public static synchronized void createManagedConnectionPool(String poolName, Object mcp)
{
log.tracef("%s", new TraceEvent(poolName,
Integer.toHexString(System.identityHashCode(mcp)),
TraceEvent.MANAGED_CONNECTION_POOL_CREATE,
"NONE"));
} | java | public static synchronized void createManagedConnectionPool(String poolName, Object mcp)
{
log.tracef("%s", new TraceEvent(poolName,
Integer.toHexString(System.identityHashCode(mcp)),
TraceEvent.MANAGED_CONNECTION_POOL_CREATE,
"NONE"));
} | [
"public",
"static",
"synchronized",
"void",
"createManagedConnectionPool",
"(",
"String",
"poolName",
",",
"Object",
"mcp",
")",
"{",
"log",
".",
"tracef",
"(",
"\"%s\"",
",",
"new",
"TraceEvent",
"(",
"poolName",
",",
"Integer",
".",
"toHexString",
"(",
"Syst... | Create managed connection pool
@param poolName The name of the pool
@param mcp The managed connection pool | [
"Create",
"managed",
"connection",
"pool"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tracer/Tracer.java#L558-L564 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.createGraphics | public java.awt.Graphics2D createGraphics(float width, float height) {
return new PdfGraphics2D(this, width, height, null, false, false, 0);
} | java | public java.awt.Graphics2D createGraphics(float width, float height) {
return new PdfGraphics2D(this, width, height, null, false, false, 0);
} | [
"public",
"java",
".",
"awt",
".",
"Graphics2D",
"createGraphics",
"(",
"float",
"width",
",",
"float",
"height",
")",
"{",
"return",
"new",
"PdfGraphics2D",
"(",
"this",
",",
"width",
",",
"height",
",",
"null",
",",
"false",
",",
"false",
",",
"0",
"... | Gets a <CODE>Graphics2D</CODE> to write on. The graphics
are translated to PDF commands.
@param width the width of the panel
@param height the height of the panel
@return a <CODE>Graphics2D</CODE> | [
"Gets",
"a",
"<CODE",
">",
"Graphics2D<",
"/",
"CODE",
">",
"to",
"write",
"on",
".",
"The",
"graphics",
"are",
"translated",
"to",
"PDF",
"commands",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2812-L2814 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/ServletMessage.java | ServletMessage.sendMessage | public InputStream sendMessage(Properties args, int method)
throws IOException {
// Set this up any way you want -- POST can be used for all calls,
// but request headers cannot be set in JDK 1.0.2 so the query
// string still must be used to pass arguments.
if (method == GET)
{
URL url = new URL(servlet.toExternalForm() + "?" + toEncodedString(args));
return url.openStream();
}
else
{
URLConnection conn = servlet.openConnection();
conn.setDoOutput(true);
conn.setUseCaches(false);
// POST the request data (html form encoded)
PrintStream out = new PrintStream(conn.getOutputStream());
if (args != null && args.size() > 0)
{
out.print(toEncodedString(args));
}
out.close(); // ESSENTIAL for this to work!
// Read the POST response data
return conn.getInputStream();
}
} | java | public InputStream sendMessage(Properties args, int method)
throws IOException {
// Set this up any way you want -- POST can be used for all calls,
// but request headers cannot be set in JDK 1.0.2 so the query
// string still must be used to pass arguments.
if (method == GET)
{
URL url = new URL(servlet.toExternalForm() + "?" + toEncodedString(args));
return url.openStream();
}
else
{
URLConnection conn = servlet.openConnection();
conn.setDoOutput(true);
conn.setUseCaches(false);
// POST the request data (html form encoded)
PrintStream out = new PrintStream(conn.getOutputStream());
if (args != null && args.size() > 0)
{
out.print(toEncodedString(args));
}
out.close(); // ESSENTIAL for this to work!
// Read the POST response data
return conn.getInputStream();
}
} | [
"public",
"InputStream",
"sendMessage",
"(",
"Properties",
"args",
",",
"int",
"method",
")",
"throws",
"IOException",
"{",
"// Set this up any way you want -- POST can be used for all calls,",
"// but request headers cannot be set in JDK 1.0.2 so the query",
"// string still must be u... | Send the request. Return the input stream with the response if
the request succeeds.
@param args the arguments to send to the servlet
@param method GET or POST
@exception IOException if error sending request
@return the response from the servlet to this message | [
"Send",
"the",
"request",
".",
"Return",
"the",
"input",
"stream",
"with",
"the",
"response",
"if",
"the",
"request",
"succeeds",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/ServletMessage.java#L68-L96 |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/util/SearchHelper.java | SearchHelper.setFilterNot | public void setFilterNot( final String attributeName, final String value )
{
this.setFilter( attributeName, value );
filter = "(!" + filter + ")";
} | java | public void setFilterNot( final String attributeName, final String value )
{
this.setFilter( attributeName, value );
filter = "(!" + filter + ")";
} | [
"public",
"void",
"setFilterNot",
"(",
"final",
"String",
"attributeName",
",",
"final",
"String",
"value",
")",
"{",
"this",
".",
"setFilter",
"(",
"attributeName",
",",
"value",
")",
";",
"filter",
"=",
"\"(!\"",
"+",
"filter",
"+",
"\")\"",
";",
"}"
] | Set up a not exists filter for an attribute name and value pair.
<table border="1"><caption>Example Values</caption>
<tr><td><b>Attribute</b></td><td><b>Value</b></td></tr>
<tr><td>givenName</td><td>John</td></tr>
</table>
<p><i>Result</i></p>
<code>(!(givenName=John))</code>
@param attributeName A valid attribute name
@param value A value that, if it exists, will cause the object to be excluded from the result set. | [
"Set",
"up",
"a",
"not",
"exists",
"filter",
"for",
"an",
"attribute",
"name",
"and",
"value",
"pair",
"."
] | train | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/util/SearchHelper.java#L575-L579 |
jtmelton/appsensor | appsensor-core/src/main/java/org/owasp/appsensor/core/util/XmlUtils.java | XmlUtils.validateXMLSchema | public static void validateXMLSchema(InputStream xsdStream, InputStream xmlStream) throws IOException, SAXException {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(new StreamSource(xsdStream));
Validator validator = schema.newValidator();
validator.validate(new StreamSource(xmlStream));
} | java | public static void validateXMLSchema(InputStream xsdStream, InputStream xmlStream) throws IOException, SAXException {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(new StreamSource(xsdStream));
Validator validator = schema.newValidator();
validator.validate(new StreamSource(xmlStream));
} | [
"public",
"static",
"void",
"validateXMLSchema",
"(",
"InputStream",
"xsdStream",
",",
"InputStream",
"xmlStream",
")",
"throws",
"IOException",
",",
"SAXException",
"{",
"SchemaFactory",
"factory",
"=",
"SchemaFactory",
".",
"newInstance",
"(",
"XMLConstants",
".",
... | Validate XML matches XSD. Stream-based method.
@param xsdStream resource based path to XSD file
@param xmlStream resource based path to XML file
@throws IOException io exception for loading files
@throws SAXException sax exception for parsing files | [
"Validate",
"XML",
"matches",
"XSD",
".",
"Stream",
"-",
"based",
"method",
"."
] | train | https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/appsensor-core/src/main/java/org/owasp/appsensor/core/util/XmlUtils.java#L83-L88 |
sarxos/webcam-capture | webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamDriverUtils.java | WebcamDriverUtils.getClasses | protected static Class<?>[] getClasses(String pkgname, boolean flat) {
List<File> dirs = new ArrayList<File>();
List<Class<?>> classes = new ArrayList<Class<?>>();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
String path = pkgname.replace('.', '/');
Enumeration<URL> resources = null;
try {
resources = classLoader.getResources(path);
} catch (IOException e) {
throw new RuntimeException("Cannot read path " + path, e);
}
while (resources.hasMoreElements()) {
URL resource = resources.nextElement();
dirs.add(new File(resource.getFile()));
}
for (File directory : dirs) {
try {
classes.addAll(findClasses(directory, pkgname, flat));
} catch (ClassNotFoundException e) {
throw new RuntimeException("Class not found", e);
}
}
return classes.toArray(new Class<?>[classes.size()]);
} | java | protected static Class<?>[] getClasses(String pkgname, boolean flat) {
List<File> dirs = new ArrayList<File>();
List<Class<?>> classes = new ArrayList<Class<?>>();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
String path = pkgname.replace('.', '/');
Enumeration<URL> resources = null;
try {
resources = classLoader.getResources(path);
} catch (IOException e) {
throw new RuntimeException("Cannot read path " + path, e);
}
while (resources.hasMoreElements()) {
URL resource = resources.nextElement();
dirs.add(new File(resource.getFile()));
}
for (File directory : dirs) {
try {
classes.addAll(findClasses(directory, pkgname, flat));
} catch (ClassNotFoundException e) {
throw new RuntimeException("Class not found", e);
}
}
return classes.toArray(new Class<?>[classes.size()]);
} | [
"protected",
"static",
"Class",
"<",
"?",
">",
"[",
"]",
"getClasses",
"(",
"String",
"pkgname",
",",
"boolean",
"flat",
")",
"{",
"List",
"<",
"File",
">",
"dirs",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"List",
"<",
"Class",
"<"... | Scans all classes accessible from the context class loader which belong
to the given package and subpackages.
@param packageName The base package
@param flat scan only one package level, do not dive into subdirectories
@return The classes
@throws ClassNotFoundException
@throws IOException | [
"Scans",
"all",
"classes",
"accessible",
"from",
"the",
"context",
"class",
"loader",
"which",
"belong",
"to",
"the",
"given",
"package",
"and",
"subpackages",
"."
] | train | https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamDriverUtils.java#L81-L110 |
frostwire/frostwire-jlibtorrent | src/main/java/com/frostwire/jlibtorrent/SessionHandle.java | SessionHandle.removeTorrent | public void removeTorrent(TorrentHandle th, remove_flags_t options) {
if (th.isValid()) {
s.remove_torrent(th.swig(), options);
}
} | java | public void removeTorrent(TorrentHandle th, remove_flags_t options) {
if (th.isValid()) {
s.remove_torrent(th.swig(), options);
}
} | [
"public",
"void",
"removeTorrent",
"(",
"TorrentHandle",
"th",
",",
"remove_flags_t",
"options",
")",
"{",
"if",
"(",
"th",
".",
"isValid",
"(",
")",
")",
"{",
"s",
".",
"remove_torrent",
"(",
"th",
".",
"swig",
"(",
")",
",",
"options",
")",
";",
"}... | This method will close all peer connections associated with the torrent and tell the
tracker that we've stopped participating in the swarm. This operation cannot fail.
When it completes, you will receive a torrent_removed_alert.
<p>
The optional second argument options can be used to delete all the files downloaded
by this torrent. To do so, pass in the value session::delete_files. The removal of
the torrent is asynchronous, there is no guarantee that adding the same torrent immediately
after it was removed will not throw a libtorrent_exception exception. Once the torrent
is deleted, a torrent_deleted_alert is posted.
@param th the handle | [
"This",
"method",
"will",
"close",
"all",
"peer",
"connections",
"associated",
"with",
"the",
"torrent",
"and",
"tell",
"the",
"tracker",
"that",
"we",
"ve",
"stopped",
"participating",
"in",
"the",
"swarm",
".",
"This",
"operation",
"cannot",
"fail",
".",
"... | train | https://github.com/frostwire/frostwire-jlibtorrent/blob/a29249a940d34aba8c4677d238b472ef01833506/src/main/java/com/frostwire/jlibtorrent/SessionHandle.java#L282-L286 |
xmlunit/xmlunit | xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java | DefaultComparisonFormatter.getDetails | @Override
public String getDetails(Comparison.Detail difference, ComparisonType type, boolean formatXml) {
if (difference.getTarget() == null) {
return "<NULL>";
}
return getFullFormattedXml(difference.getTarget(), type, formatXml);
} | java | @Override
public String getDetails(Comparison.Detail difference, ComparisonType type, boolean formatXml) {
if (difference.getTarget() == null) {
return "<NULL>";
}
return getFullFormattedXml(difference.getTarget(), type, formatXml);
} | [
"@",
"Override",
"public",
"String",
"getDetails",
"(",
"Comparison",
".",
"Detail",
"difference",
",",
"ComparisonType",
"type",
",",
"boolean",
"formatXml",
")",
"{",
"if",
"(",
"difference",
".",
"getTarget",
"(",
")",
"==",
"null",
")",
"{",
"return",
... | Return the xml node from {@link Detail#getTarget()} as formatted String.
<p>Delegates to {@link #getFullFormattedXml} unless the {@code Comparison.Detail}'s {@code target} is null.</p>
@param difference The {@link Comparison#getControlDetails()} or {@link Comparison#getTestDetails()}.
@param type the implementation can return different details depending on the ComparisonType.
@param formatXml set this to true if the Comparison was generated with {@link
org.xmlunit.builder.DiffBuilder#ignoreWhitespace()} - this affects the indentation of the generated output.
@return the full xml node. | [
"Return",
"the",
"xml",
"node",
"from",
"{",
"@link",
"Detail#getTarget",
"()",
"}",
"as",
"formatted",
"String",
"."
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java#L336-L342 |
aws/aws-sdk-java | aws-java-sdk-codedeploy/src/main/java/com/amazonaws/services/codedeploy/model/CreateDeploymentGroupRequest.java | CreateDeploymentGroupRequest.getTriggerConfigurations | public java.util.List<TriggerConfig> getTriggerConfigurations() {
if (triggerConfigurations == null) {
triggerConfigurations = new com.amazonaws.internal.SdkInternalList<TriggerConfig>();
}
return triggerConfigurations;
} | java | public java.util.List<TriggerConfig> getTriggerConfigurations() {
if (triggerConfigurations == null) {
triggerConfigurations = new com.amazonaws.internal.SdkInternalList<TriggerConfig>();
}
return triggerConfigurations;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"TriggerConfig",
">",
"getTriggerConfigurations",
"(",
")",
"{",
"if",
"(",
"triggerConfigurations",
"==",
"null",
")",
"{",
"triggerConfigurations",
"=",
"new",
"com",
".",
"amazonaws",
".",
"internal",
".",
... | <p>
Information about triggers to create when the deployment group is created. For examples, see <a
href="https://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-notify-sns.html">Create a Trigger for an AWS
CodeDeploy Event</a> in the AWS CodeDeploy User Guide.
</p>
@return Information about triggers to create when the deployment group is created. For examples, see <a
href="https://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-notify-sns.html">Create a Trigger
for an AWS CodeDeploy Event</a> in the AWS CodeDeploy User Guide. | [
"<p",
">",
"Information",
"about",
"triggers",
"to",
"create",
"when",
"the",
"deployment",
"group",
"is",
"created",
".",
"For",
"examples",
"see",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"codedeploy",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-codedeploy/src/main/java/com/amazonaws/services/codedeploy/model/CreateDeploymentGroupRequest.java#L621-L626 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.