repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.beginInstallUpdatesAsync
public Observable<Void> beginInstallUpdatesAsync(String deviceName, String resourceGroupName) { return beginInstallUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginInstallUpdatesAsync(String deviceName, String resourceGroupName) { return beginInstallUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginInstallUpdatesAsync", "(", "String", "deviceName", ",", "String", "resourceGroupName", ")", "{", "return", "beginInstallUpdatesWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", ")", ".", "map", "(", ...
Installs the updates on the data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Installs", "the", "updates", "on", "the", "data", "box", "edge", "/", "gateway", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1535-L1542
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SRTServletRequestUtils.java
SRTServletRequestUtils.setPrivateAttribute
public static void setPrivateAttribute(HttpServletRequest req, String key, Object object) { HttpServletRequest sr = getWrappedServletRequestObject(req); if (sr instanceof IPrivateRequestAttributes) { ((IPrivateRequestAttributes) sr).setPrivateAttribute(key, object); } else { if (tc.isDebugEnabled()) { Tr.debug(tc, "getPrivateAttribute called for non-IPrivateRequestAttributes object", req); } } }
java
public static void setPrivateAttribute(HttpServletRequest req, String key, Object object) { HttpServletRequest sr = getWrappedServletRequestObject(req); if (sr instanceof IPrivateRequestAttributes) { ((IPrivateRequestAttributes) sr).setPrivateAttribute(key, object); } else { if (tc.isDebugEnabled()) { Tr.debug(tc, "getPrivateAttribute called for non-IPrivateRequestAttributes object", req); } } }
[ "public", "static", "void", "setPrivateAttribute", "(", "HttpServletRequest", "req", ",", "String", "key", ",", "Object", "object", ")", "{", "HttpServletRequest", "sr", "=", "getWrappedServletRequestObject", "(", "req", ")", ";", "if", "(", "sr", "instanceof", ...
Set a private attribute in the request (if applicable). If the request object is of an unexpected type, no operation occurs. @param req @param key @param object @see IPrivateRequestAttributes#setPrivateAttribute(String, Object)
[ "Set", "a", "private", "attribute", "in", "the", "request", "(", "if", "applicable", ")", ".", "If", "the", "request", "object", "is", "of", "an", "unexpected", "type", "no", "operation", "occurs", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SRTServletRequestUtils.java#L57-L66
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/InternalEventBusSkill.java
InternalEventBusSkill.runDestructionStage
private void runDestructionStage(Event event) { // Immediate synchronous dispatching of Destroy event try { setOwnerState(OwnerState.DYING); try { this.eventDispatcher.immediateDispatch(event); } finally { setOwnerState(OwnerState.DEAD); } } catch (Exception e) { // Log the exception final Logging loggingCapacity = getLoggingSkill(); if (loggingCapacity != null) { loggingCapacity.error(Messages.InternalEventBusSkill_4, e); } else { final LogRecord record = new LogRecord(Level.SEVERE, Messages.InternalEventBusSkill_4); this.logger.getKernelLogger().log( this.logger.prepareLogRecord(record, this.logger.getKernelLogger().getName(), Throwables.getRootCause(e))); } } }
java
private void runDestructionStage(Event event) { // Immediate synchronous dispatching of Destroy event try { setOwnerState(OwnerState.DYING); try { this.eventDispatcher.immediateDispatch(event); } finally { setOwnerState(OwnerState.DEAD); } } catch (Exception e) { // Log the exception final Logging loggingCapacity = getLoggingSkill(); if (loggingCapacity != null) { loggingCapacity.error(Messages.InternalEventBusSkill_4, e); } else { final LogRecord record = new LogRecord(Level.SEVERE, Messages.InternalEventBusSkill_4); this.logger.getKernelLogger().log( this.logger.prepareLogRecord(record, this.logger.getKernelLogger().getName(), Throwables.getRootCause(e))); } } }
[ "private", "void", "runDestructionStage", "(", "Event", "event", ")", "{", "// Immediate synchronous dispatching of Destroy event", "try", "{", "setOwnerState", "(", "OwnerState", ".", "DYING", ")", ";", "try", "{", "this", ".", "eventDispatcher", ".", "immediateDispa...
This function runs the destruction of the agent. @param event the {@link Destroy} occurrence.
[ "This", "function", "runs", "the", "destruction", "of", "the", "agent", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/InternalEventBusSkill.java#L272-L293
loldevs/riotapi
rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java
ThrottledApiHandler.getSummonerNames
public Future<Map<Integer, String>> getSummonerNames(Integer... ids) { return new ApiFuture<>(() -> handler.getSummonerNames(ids)); }
java
public Future<Map<Integer, String>> getSummonerNames(Integer... ids) { return new ApiFuture<>(() -> handler.getSummonerNames(ids)); }
[ "public", "Future", "<", "Map", "<", "Integer", ",", "String", ">", ">", "getSummonerNames", "(", "Integer", "...", "ids", ")", "{", "return", "new", "ApiFuture", "<>", "(", "(", ")", "->", "handler", ".", "getSummonerNames", "(", "ids", ")", ")", ";",...
Retrieve summoner names for the specified ids @param ids The ids to lookup @return A map, mapping user ids to summoner names @see <a href=https://developer.riotgames.com/api/methods#!/620/1934>Official API documentation</a>
[ "Retrieve", "summoner", "names", "for", "the", "specified", "ids" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1151-L1153
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/BasicStreamReader.java
BasicStreamReader.setProperty
@Override public boolean setProperty(String name, Object value) { boolean ok = mConfig.setProperty(name, value); /* To make [WSTX-50] work fully dynamically (i.e. allow * setting BASE_URL after stream reader has been constructed) * need to force */ if (ok && WstxInputProperties.P_BASE_URL.equals(name)) { // Easiest to just access from config: may come in as a String etc mInput.overrideSource(mConfig.getBaseURL()); } return ok; }
java
@Override public boolean setProperty(String name, Object value) { boolean ok = mConfig.setProperty(name, value); /* To make [WSTX-50] work fully dynamically (i.e. allow * setting BASE_URL after stream reader has been constructed) * need to force */ if (ok && WstxInputProperties.P_BASE_URL.equals(name)) { // Easiest to just access from config: may come in as a String etc mInput.overrideSource(mConfig.getBaseURL()); } return ok; }
[ "@", "Override", "public", "boolean", "setProperty", "(", "String", "name", ",", "Object", "value", ")", "{", "boolean", "ok", "=", "mConfig", ".", "setProperty", "(", "name", ",", "value", ")", ";", "/* To make [WSTX-50] work fully dynamically (i.e. allow\n ...
@param name Name of the property to set @param value Value to set property to. @return True, if the specified property was <b>succesfully</b> set to specified value; false if its value was not changed
[ "@param", "name", "Name", "of", "the", "property", "to", "set", "@param", "value", "Value", "to", "set", "property", "to", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/BasicStreamReader.java#L1302-L1315
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getPackageLink
public Content getPackageLink(PackageDoc pkg, String label) { return getPackageLink(pkg, new StringContent(label)); }
java
public Content getPackageLink(PackageDoc pkg, String label) { return getPackageLink(pkg, new StringContent(label)); }
[ "public", "Content", "getPackageLink", "(", "PackageDoc", "pkg", ",", "String", "label", ")", "{", "return", "getPackageLink", "(", "pkg", ",", "new", "StringContent", "(", "label", ")", ")", ";", "}" ]
Return the link to the given package. @param pkg the package to link to. @param label the label for the link. @return a content tree for the package link.
[ "Return", "the", "link", "to", "the", "given", "package", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L948-L950
phax/ph-commons
ph-dao/src/main/java/com/helger/dao/wal/AbstractWALDAO.java
AbstractWALDAO.markAsChanged
@MustBeLocked (ELockType.WRITE) @OverridingMethodsMustInvokeSuper protected void markAsChanged (@Nonnull final DATATYPE aModifiedElement, @Nonnull final EDAOActionType eActionType) { ValueEnforcer.notNull (aModifiedElement, "ModifiedElement"); ValueEnforcer.notNull (eActionType, "ActionType"); // Convert single item to list markAsChanged (new CommonsArrayList <> (aModifiedElement), eActionType); }
java
@MustBeLocked (ELockType.WRITE) @OverridingMethodsMustInvokeSuper protected void markAsChanged (@Nonnull final DATATYPE aModifiedElement, @Nonnull final EDAOActionType eActionType) { ValueEnforcer.notNull (aModifiedElement, "ModifiedElement"); ValueEnforcer.notNull (eActionType, "ActionType"); // Convert single item to list markAsChanged (new CommonsArrayList <> (aModifiedElement), eActionType); }
[ "@", "MustBeLocked", "(", "ELockType", ".", "WRITE", ")", "@", "OverridingMethodsMustInvokeSuper", "protected", "void", "markAsChanged", "(", "@", "Nonnull", "final", "DATATYPE", "aModifiedElement", ",", "@", "Nonnull", "final", "EDAOActionType", "eActionType", ")", ...
This method must be called every time something changed in the DAO. It triggers the writing to a file if auto-save is active. This method must be called within a write-lock as it is not locked! @param aModifiedElement The modified data element. May not be <code>null</code>. @param eActionType The action that was performed. May not be <code>null</code>.
[ "This", "method", "must", "be", "called", "every", "time", "something", "changed", "in", "the", "DAO", ".", "It", "triggers", "the", "writing", "to", "a", "file", "if", "auto", "-", "save", "is", "active", ".", "This", "method", "must", "be", "called", ...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-dao/src/main/java/com/helger/dao/wal/AbstractWALDAO.java#L1102-L1111
adobe/htl-tck
src/main/java/io/sightly/tck/html/HTMLExtractor.java
HTMLExtractor.hasAttributeValue
public static boolean hasAttributeValue(String url, String markup, String selector, String attributeName, String attributeValue) { ensureMarkup(url, markup); Document document = documents.get(url); Elements elements = document.select(selector); return !elements.isEmpty() && elements.hasAttr(attributeName) && attributeValue.equals(elements.attr(attributeName)); }
java
public static boolean hasAttributeValue(String url, String markup, String selector, String attributeName, String attributeValue) { ensureMarkup(url, markup); Document document = documents.get(url); Elements elements = document.select(selector); return !elements.isEmpty() && elements.hasAttr(attributeName) && attributeValue.equals(elements.attr(attributeName)); }
[ "public", "static", "boolean", "hasAttributeValue", "(", "String", "url", ",", "String", "markup", ",", "String", "selector", ",", "String", "attributeName", ",", "String", "attributeValue", ")", "{", "ensureMarkup", "(", "url", ",", "markup", ")", ";", "Docum...
Checks if any of the elements matched by the {@code selector} contain the attribute {@code attributeName} with value {@code attributeValue}. The {@code url} is used only for caching purposes, to avoid parsing multiple times the markup returned for the same resource. @param url the url that identifies the markup @param markup the markup @param selector the selector used for retrieval @param attributeName the attribute's name @param attributeValue the attribute's value @return {@code true} if the attribute was found and has the specified value, {@code false} otherwise
[ "Checks", "if", "any", "of", "the", "elements", "matched", "by", "the", "{", "@code", "selector", "}", "contain", "the", "attribute", "{", "@code", "attributeName", "}", "with", "value", "{", "@code", "attributeValue", "}", ".", "The", "{", "@code", "url",...
train
https://github.com/adobe/htl-tck/blob/2043a9616083c06cefbd685798c9a2b2ac2ea98e/src/main/java/io/sightly/tck/html/HTMLExtractor.java#L109-L114
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
TypeUtils.appendAllTo
private static <T> StringBuilder appendAllTo(final StringBuilder buf, final String sep, final T... types) { Validate.notEmpty(Validate.noNullElements(types)); if (types.length > 0) { buf.append(toString(types[0])); for (int i = 1; i < types.length; i++) { buf.append(sep).append(toString(types[i])); } } return buf; }
java
private static <T> StringBuilder appendAllTo(final StringBuilder buf, final String sep, final T... types) { Validate.notEmpty(Validate.noNullElements(types)); if (types.length > 0) { buf.append(toString(types[0])); for (int i = 1; i < types.length; i++) { buf.append(sep).append(toString(types[i])); } } return buf; }
[ "private", "static", "<", "T", ">", "StringBuilder", "appendAllTo", "(", "final", "StringBuilder", "buf", ",", "final", "String", "sep", ",", "final", "T", "...", "types", ")", "{", "Validate", ".", "notEmpty", "(", "Validate", ".", "noNullElements", "(", ...
Append {@code types} to {@code buf} with separator {@code sep}. @param buf destination @param sep separator @param types to append @return {@code buf} @since 3.2
[ "Append", "{" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java#L1882-L1891
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java
EmbedBuilder.setFooter
public EmbedBuilder setFooter(String text, String iconUrl) { delegate.setFooter(text, iconUrl); return this; }
java
public EmbedBuilder setFooter(String text, String iconUrl) { delegate.setFooter(text, iconUrl); return this; }
[ "public", "EmbedBuilder", "setFooter", "(", "String", "text", ",", "String", "iconUrl", ")", "{", "delegate", ".", "setFooter", "(", "text", ",", "iconUrl", ")", ";", "return", "this", ";", "}" ]
Sets the footer of the embed. @param text The text of the footer. @param iconUrl The url of the footer's icon. @return The current instance in order to chain call methods.
[ "Sets", "the", "footer", "of", "the", "embed", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java#L119-L122
hibernate/hibernate-ogm
mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/dialect/impl/MongoDBTupleSnapshot.java
MongoDBTupleSnapshot.getValue
private Object getValue(Document dbObject, String column) { Object valueOrNull = MongoHelpers.getValueOrNull( dbObject, column ); return valueOrNull; }
java
private Object getValue(Document dbObject, String column) { Object valueOrNull = MongoHelpers.getValueOrNull( dbObject, column ); return valueOrNull; }
[ "private", "Object", "getValue", "(", "Document", "dbObject", ",", "String", "column", ")", "{", "Object", "valueOrNull", "=", "MongoHelpers", ".", "getValueOrNull", "(", "dbObject", ",", "column", ")", ";", "return", "valueOrNull", ";", "}" ]
The internal structure of a {@link Document} is like a tree. Each embedded object is a new {@code Document} itself. We traverse the tree until we've arrived at a leaf and retrieve the value from it.
[ "The", "internal", "structure", "of", "a", "{" ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/dialect/impl/MongoDBTupleSnapshot.java#L83-L86
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeByte
public static byte decodeByte(byte[] src, int srcOffset) throws CorruptEncodingException { try { return (byte)(src[srcOffset] ^ 0x80); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static byte decodeByte(byte[] src, int srcOffset) throws CorruptEncodingException { try { return (byte)(src[srcOffset] ^ 0x80); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "byte", "decodeByte", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "return", "(", "byte", ")", "(", "src", "[", "srcOffset", "]", "^", "0x80", ")", ";", "}", "cat...
Decodes a signed byte from exactly 1 byte. @param src source of encoded bytes @param srcOffset offset into source array @return signed byte value
[ "Decodes", "a", "signed", "byte", "from", "exactly", "1", "byte", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L135-L143
pravega/pravega
segmentstore/contracts/src/main/java/io/pravega/segmentstore/contracts/tables/TableKey.java
TableKey.versioned
public static TableKey versioned(@NonNull ArrayView key, long version) { Preconditions.checkArgument(version >= 0 || version == NOT_EXISTS || version == NO_VERSION, "Version must be a non-negative number."); return new TableKey(key, version); }
java
public static TableKey versioned(@NonNull ArrayView key, long version) { Preconditions.checkArgument(version >= 0 || version == NOT_EXISTS || version == NO_VERSION, "Version must be a non-negative number."); return new TableKey(key, version); }
[ "public", "static", "TableKey", "versioned", "(", "@", "NonNull", "ArrayView", "key", ",", "long", "version", ")", "{", "Preconditions", ".", "checkArgument", "(", "version", ">=", "0", "||", "version", "==", "NOT_EXISTS", "||", "version", "==", "NO_VERSION", ...
Creates a new instance of the TableKey class with a specified version. @param key The Key. @param version The desired version. @return new TableKey with specified version
[ "Creates", "a", "new", "instance", "of", "the", "TableKey", "class", "with", "a", "specified", "version", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/contracts/src/main/java/io/pravega/segmentstore/contracts/tables/TableKey.java#L77-L80
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java
OdsElements.writeContent
public void writeContent(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException { this.logger.log(Level.FINER, "Writing odselement: contentElement to zip file"); this.contentElement.write(xmlUtil, writer); }
java
public void writeContent(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException { this.logger.log(Level.FINER, "Writing odselement: contentElement to zip file"); this.contentElement.write(xmlUtil, writer); }
[ "public", "void", "writeContent", "(", "final", "XMLUtil", "xmlUtil", ",", "final", "ZipUTF8Writer", "writer", ")", "throws", "IOException", "{", "this", ".", "logger", ".", "log", "(", "Level", ".", "FINER", ",", "\"Writing odselement: contentElement to zip file\""...
Write the content element to a writer. @param xmlUtil the xml util @param writer the writer @throws IOException if write fails
[ "Write", "the", "content", "element", "to", "a", "writer", "." ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L373-L376
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java
Drawable.setDpi
public static void setDpi(Resolution baseline, Config config) { Check.notNull(baseline); Check.notNull(config); setDpi(DpiType.from(baseline, config.getOutput())); }
java
public static void setDpi(Resolution baseline, Config config) { Check.notNull(baseline); Check.notNull(config); setDpi(DpiType.from(baseline, config.getOutput())); }
[ "public", "static", "void", "setDpi", "(", "Resolution", "baseline", ",", "Config", "config", ")", "{", "Check", ".", "notNull", "(", "baseline", ")", ";", "Check", ".", "notNull", "(", "config", ")", ";", "setDpi", "(", "DpiType", ".", "from", "(", "b...
Set the DPI to use. Computed automatically depending of the baseline resolution and the current configuration. <p> Resources has to be suffixed with "_DPI" before the extension. For example, baseline resources is "image.png", support for other DPI will need: </p> <ul> <li>image_ldpi.png - support for low resolution</li> <li>image_mdpi.png - support for baseline resolution, same as image.png, not required</li> <li>image_hdpi.png - support for high resolution</li> <li>image_xhdpi.png - support for very high resolution</li> </ul> <p> If there is not dedicated DPI resource, the baseline one will be use instead. </p> <p> <b>Must be set after engine started, before resource loading.</b> </p> @param baseline The baseline resolution (must not be <code>null</code>). @param config The configuration used (must not be <code>null</code>). @throws LionEngineException If invalid arguments.
[ "Set", "the", "DPI", "to", "use", ".", "Computed", "automatically", "depending", "of", "the", "baseline", "resolution", "and", "the", "current", "configuration", ".", "<p", ">", "Resources", "has", "to", "be", "suffixed", "with", "_DPI", "before", "the", "ex...
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java#L73-L79
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/ReferenceEntityLockService.java
ReferenceEntityLockService.renew
@Override public void renew(IEntityLock lock, int duration) throws LockingException { if (isValid(lock)) { Date newExpiration = getNewExpiration(duration); getLockStore().update(lock, newExpiration); ((EntityLockImpl) lock).setExpirationTime(newExpiration); } else { throw new LockingException("Could not renew " + lock + " : lock is invalid."); } }
java
@Override public void renew(IEntityLock lock, int duration) throws LockingException { if (isValid(lock)) { Date newExpiration = getNewExpiration(duration); getLockStore().update(lock, newExpiration); ((EntityLockImpl) lock).setExpirationTime(newExpiration); } else { throw new LockingException("Could not renew " + lock + " : lock is invalid."); } }
[ "@", "Override", "public", "void", "renew", "(", "IEntityLock", "lock", ",", "int", "duration", ")", "throws", "LockingException", "{", "if", "(", "isValid", "(", "lock", ")", ")", "{", "Date", "newExpiration", "=", "getNewExpiration", "(", "duration", ")", ...
Extends the expiration time of the lock by some service-defined increment. @param lock IEntityLock @exception LockingException
[ "Extends", "the", "expiration", "time", "of", "the", "lock", "by", "some", "service", "-", "defined", "increment", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/ReferenceEntityLockService.java#L370-L379
openwms/org.openwms
org.openwms.core.util/src/main/java/org/openwms/core/http/AbstractWebController.java
AbstractWebController.translate
protected String translate(String key, Object... objects) { return messageSource.getMessage(key, objects, null); }
java
protected String translate(String key, Object... objects) { return messageSource.getMessage(key, objects, null); }
[ "protected", "String", "translate", "(", "String", "key", ",", "Object", "...", "objects", ")", "{", "return", "messageSource", ".", "getMessage", "(", "key", ",", "objects", ",", "null", ")", ";", "}" ]
Get the messageSource. @param key The error code to search message text for @param objects Any arguments that are passed into the message text @return the messageSource.
[ "Get", "the", "messageSource", "." ]
train
https://github.com/openwms/org.openwms/blob/b24a95c5d09a7ec3c723d7e107d1cb0039d06a7e/org.openwms.core.util/src/main/java/org/openwms/core/http/AbstractWebController.java#L131-L133
alkacon/opencms-core
src/org/opencms/staticexport/CmsLinkManager.java
CmsLinkManager.getPermalinkForCurrentPage
public String getPermalinkForCurrentPage(CmsObject cms) { return getPermalink(cms, cms.getRequestContext().getUri(), cms.getRequestContext().getDetailContentId()); }
java
public String getPermalinkForCurrentPage(CmsObject cms) { return getPermalink(cms, cms.getRequestContext().getUri(), cms.getRequestContext().getDetailContentId()); }
[ "public", "String", "getPermalinkForCurrentPage", "(", "CmsObject", "cms", ")", "{", "return", "getPermalink", "(", "cms", ",", "cms", ".", "getRequestContext", "(", ")", ".", "getUri", "(", ")", ",", "cms", ".", "getRequestContext", "(", ")", ".", "getDetai...
Returns the perma link for the current page based on the URI and detail content id stored in the CmsObject passed as a parameter.<p< @param cms the CMS context to use to generate the permalink @return the permalink
[ "Returns", "the", "perma", "link", "for", "the", "current", "page", "based", "on", "the", "URI", "and", "detail", "content", "id", "stored", "in", "the", "CmsObject", "passed", "as", "a", "parameter", ".", "<p<" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkManager.java#L470-L473
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java
ZooKeeper.getData
public byte[] getData(final String path, Watcher watcher, Stat stat) throws KeeperException, InterruptedException { verbotenThreadCheck(); final String clientPath = path; PathUtils.validatePath(clientPath); // the watch contains the un-chroot path WatchRegistration wcb = null; if (watcher != null) { wcb = new DataWatchRegistration(watcher, clientPath); } final String serverPath = prependChroot(clientPath); RequestHeader h = new RequestHeader(); h.setType(ZooDefs.OpCode.getData); GetDataRequest request = new GetDataRequest(); request.setPath(serverPath); request.setWatch(watcher != null); GetDataResponse response = new GetDataResponse(); ReplyHeader r = cnxn.submitRequest(h, request, response, wcb); if (r.getErr() != 0) { throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath); } if (stat != null) { DataTree.copyStat(response.getStat(), stat); } return response.getData(); }
java
public byte[] getData(final String path, Watcher watcher, Stat stat) throws KeeperException, InterruptedException { verbotenThreadCheck(); final String clientPath = path; PathUtils.validatePath(clientPath); // the watch contains the un-chroot path WatchRegistration wcb = null; if (watcher != null) { wcb = new DataWatchRegistration(watcher, clientPath); } final String serverPath = prependChroot(clientPath); RequestHeader h = new RequestHeader(); h.setType(ZooDefs.OpCode.getData); GetDataRequest request = new GetDataRequest(); request.setPath(serverPath); request.setWatch(watcher != null); GetDataResponse response = new GetDataResponse(); ReplyHeader r = cnxn.submitRequest(h, request, response, wcb); if (r.getErr() != 0) { throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath); } if (stat != null) { DataTree.copyStat(response.getStat(), stat); } return response.getData(); }
[ "public", "byte", "[", "]", "getData", "(", "final", "String", "path", ",", "Watcher", "watcher", ",", "Stat", "stat", ")", "throws", "KeeperException", ",", "InterruptedException", "{", "verbotenThreadCheck", "(", ")", ";", "final", "String", "clientPath", "=...
Return the data and the stat of the node of the given path. <p> If the watch is non-null and the call is successful (no exception is thrown), a watch will be left on the node with the given path. The watch will be triggered by a successful operation that sets data on the node, or deletes the node. <p> A KeeperException with error code KeeperException.NoNode will be thrown if no node with the given path exists. @param path the given path @param watcher explicit watcher @param stat the stat of the node @return the data of the node @throws KeeperException If the server signals an error with a non-zero error code @throws InterruptedException If the server transaction is interrupted. @throws IllegalArgumentException if an invalid path is specified
[ "Return", "the", "data", "and", "the", "stat", "of", "the", "node", "of", "the", "given", "path", ".", "<p", ">", "If", "the", "watch", "is", "non", "-", "null", "and", "the", "call", "is", "successful", "(", "no", "exception", "is", "thrown", ")", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java#L943-L972
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.getFieldNameByType
public static String getFieldNameByType(Class<?> classType, Class<?> fieldType) { Field[] declaredFields = classType.getDeclaredFields(); for (Field field : declaredFields) { if (field.getType().isAssignableFrom(fieldType)) { return field.getName(); } } if (classType.getSuperclass() != null) { return getFieldNameByType(classType.getSuperclass(), fieldType); } return null; }
java
public static String getFieldNameByType(Class<?> classType, Class<?> fieldType) { Field[] declaredFields = classType.getDeclaredFields(); for (Field field : declaredFields) { if (field.getType().isAssignableFrom(fieldType)) { return field.getName(); } } if (classType.getSuperclass() != null) { return getFieldNameByType(classType.getSuperclass(), fieldType); } return null; }
[ "public", "static", "String", "getFieldNameByType", "(", "Class", "<", "?", ">", "classType", ",", "Class", "<", "?", ">", "fieldType", ")", "{", "Field", "[", "]", "declaredFields", "=", "classType", ".", "getDeclaredFields", "(", ")", ";", "for", "(", ...
Gets the field name by type. @param classType the class type @param fieldType the field type @return the field name by type
[ "Gets", "the", "field", "name", "by", "type", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L786-L797
h2oai/h2o-3
h2o-core/src/main/java/water/rapids/vals/ValRow.java
ValRow.slice
public ValRow slice(int[] cols) { double[] ds = new double[cols.length]; String[] ns = new String[cols.length]; for (int i = 0; i < cols.length; ++i) { ds[i] = _ds[cols[i]]; ns[i] = _names[cols[i]]; } return new ValRow(ds, ns); }
java
public ValRow slice(int[] cols) { double[] ds = new double[cols.length]; String[] ns = new String[cols.length]; for (int i = 0; i < cols.length; ++i) { ds[i] = _ds[cols[i]]; ns[i] = _names[cols[i]]; } return new ValRow(ds, ns); }
[ "public", "ValRow", "slice", "(", "int", "[", "]", "cols", ")", "{", "double", "[", "]", "ds", "=", "new", "double", "[", "cols", ".", "length", "]", ";", "String", "[", "]", "ns", "=", "new", "String", "[", "cols", ".", "length", "]", ";", "fo...
Creates a new ValRow by selecting elements at the specified indices. @param cols array of indices to select. We do not check for AIOOB errors. @return new ValRow object
[ "Creates", "a", "new", "ValRow", "by", "selecting", "elements", "at", "the", "specified", "indices", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/vals/ValRow.java#L37-L45
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/TransactionRequestProcessor.java
TransactionRequestProcessor.validateConfiguration
private void validateConfiguration(AdvancedCache<byte[], byte[]> cache) { Configuration configuration = cache.getCacheConfiguration(); if (!configuration.transaction().transactionMode().isTransactional()) { throw log.expectedTransactionalCache(cache.getName()); } if (configuration.locking().isolationLevel() != IsolationLevel.REPEATABLE_READ) { throw log.unexpectedIsolationLevel(cache.getName()); } //TODO because of ISPN-7672, optimistic and total order transactions needs versions. however, versioning is currently broken if (configuration.transaction().lockingMode() == LockingMode.OPTIMISTIC || configuration.transaction().transactionProtocol() == TransactionProtocol.TOTAL_ORDER) { //no Log. see comment above throw new IllegalStateException( String.format("Cache '%s' cannot use Optimistic neither Total Order transactions.", cache.getName())); } }
java
private void validateConfiguration(AdvancedCache<byte[], byte[]> cache) { Configuration configuration = cache.getCacheConfiguration(); if (!configuration.transaction().transactionMode().isTransactional()) { throw log.expectedTransactionalCache(cache.getName()); } if (configuration.locking().isolationLevel() != IsolationLevel.REPEATABLE_READ) { throw log.unexpectedIsolationLevel(cache.getName()); } //TODO because of ISPN-7672, optimistic and total order transactions needs versions. however, versioning is currently broken if (configuration.transaction().lockingMode() == LockingMode.OPTIMISTIC || configuration.transaction().transactionProtocol() == TransactionProtocol.TOTAL_ORDER) { //no Log. see comment above throw new IllegalStateException( String.format("Cache '%s' cannot use Optimistic neither Total Order transactions.", cache.getName())); } }
[ "private", "void", "validateConfiguration", "(", "AdvancedCache", "<", "byte", "[", "]", ",", "byte", "[", "]", ">", "cache", ")", "{", "Configuration", "configuration", "=", "cache", ".", "getCacheConfiguration", "(", ")", ";", "if", "(", "!", "configuratio...
Checks if the configuration (and the transaction manager) is able to handle client transactions.
[ "Checks", "if", "the", "configuration", "(", "and", "the", "transaction", "manager", ")", "is", "able", "to", "handle", "client", "transactions", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/TransactionRequestProcessor.java#L172-L188
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java
Parameters.getStringList
public List<String> getStringList(final String param) { return get(param, new StringToStringList(","), new AlwaysValid<List<String>>(), "comma-separated list of strings"); }
java
public List<String> getStringList(final String param) { return get(param, new StringToStringList(","), new AlwaysValid<List<String>>(), "comma-separated list of strings"); }
[ "public", "List", "<", "String", ">", "getStringList", "(", "final", "String", "param", ")", "{", "return", "get", "(", "param", ",", "new", "StringToStringList", "(", "\",\"", ")", ",", "new", "AlwaysValid", "<", "List", "<", "String", ">", ">", "(", ...
Gets a parameter whose value is a (possibly empty) comma-separated list of Strings.
[ "Gets", "a", "parameter", "whose", "value", "is", "a", "(", "possibly", "empty", ")", "comma", "-", "separated", "list", "of", "Strings", "." ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L884-L888
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java
CommerceNotificationTemplatePersistenceImpl.findByUUID_G
@Override public CommerceNotificationTemplate findByUUID_G(String uuid, long groupId) throws NoSuchNotificationTemplateException { CommerceNotificationTemplate commerceNotificationTemplate = fetchByUUID_G(uuid, groupId); if (commerceNotificationTemplate == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchNotificationTemplateException(msg.toString()); } return commerceNotificationTemplate; }
java
@Override public CommerceNotificationTemplate findByUUID_G(String uuid, long groupId) throws NoSuchNotificationTemplateException { CommerceNotificationTemplate commerceNotificationTemplate = fetchByUUID_G(uuid, groupId); if (commerceNotificationTemplate == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchNotificationTemplateException(msg.toString()); } return commerceNotificationTemplate; }
[ "@", "Override", "public", "CommerceNotificationTemplate", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchNotificationTemplateException", "{", "CommerceNotificationTemplate", "commerceNotificationTemplate", "=", "fetchByUUID_G", "(", "uui...
Returns the commerce notification template where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchNotificationTemplateException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce notification template @throws NoSuchNotificationTemplateException if a matching commerce notification template could not be found
[ "Returns", "the", "commerce", "notification", "template", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchNotificationTemplateException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L680-L707
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java
DatasetInfo.newBuilder
public static Builder newBuilder(String projectId, String datasetId) { return newBuilder(DatasetId.of(projectId, datasetId)); }
java
public static Builder newBuilder(String projectId, String datasetId) { return newBuilder(DatasetId.of(projectId, datasetId)); }
[ "public", "static", "Builder", "newBuilder", "(", "String", "projectId", ",", "String", "datasetId", ")", "{", "return", "newBuilder", "(", "DatasetId", ".", "of", "(", "projectId", ",", "datasetId", ")", ")", ";", "}" ]
Returns a builder for the DatasetInfo object given it's user-defined project and dataset ids.
[ "Returns", "a", "builder", "for", "the", "DatasetInfo", "object", "given", "it", "s", "user", "-", "defined", "project", "and", "dataset", "ids", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java#L502-L504
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/utils/DbsUtilities.java
DbsUtilities.createPolygonFromEnvelope
public static Polygon createPolygonFromEnvelope( Envelope env ) { double minX = env.getMinX(); double minY = env.getMinY(); double maxY = env.getMaxY(); double maxX = env.getMaxX(); Coordinate[] c = new Coordinate[]{new Coordinate(minX, minY), new Coordinate(minX, maxY), new Coordinate(maxX, maxY), new Coordinate(maxX, minY), new Coordinate(minX, minY)}; return gf().createPolygon(c); }
java
public static Polygon createPolygonFromEnvelope( Envelope env ) { double minX = env.getMinX(); double minY = env.getMinY(); double maxY = env.getMaxY(); double maxX = env.getMaxX(); Coordinate[] c = new Coordinate[]{new Coordinate(minX, minY), new Coordinate(minX, maxY), new Coordinate(maxX, maxY), new Coordinate(maxX, minY), new Coordinate(minX, minY)}; return gf().createPolygon(c); }
[ "public", "static", "Polygon", "createPolygonFromEnvelope", "(", "Envelope", "env", ")", "{", "double", "minX", "=", "env", ".", "getMinX", "(", ")", ";", "double", "minY", "=", "env", ".", "getMinY", "(", ")", ";", "double", "maxY", "=", "env", ".", "...
Create a polygon using an envelope. @param env the envelope to use. @return the created geomerty.
[ "Create", "a", "polygon", "using", "an", "envelope", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/utils/DbsUtilities.java#L117-L125
ops4j/org.ops4j.pax.logging
pax-logging-service/src/main/java/org/apache/log4j/rule/InequalityRule.java
InequalityRule.getRule
public static Rule getRule(final String inequalitySymbol, final String field, final String value) { if (field.equalsIgnoreCase(LoggingEventFieldResolver.LEVEL_FIELD)) { //push the value back on the stack and // allow the level-specific rule pop values return LevelInequalityRule.getRule(inequalitySymbol, value); } else if ( field.equalsIgnoreCase(LoggingEventFieldResolver.TIMESTAMP_FIELD)) { return TimestampInequalityRule.getRule(inequalitySymbol, value); } else { return new InequalityRule(inequalitySymbol, field, value); } }
java
public static Rule getRule(final String inequalitySymbol, final String field, final String value) { if (field.equalsIgnoreCase(LoggingEventFieldResolver.LEVEL_FIELD)) { //push the value back on the stack and // allow the level-specific rule pop values return LevelInequalityRule.getRule(inequalitySymbol, value); } else if ( field.equalsIgnoreCase(LoggingEventFieldResolver.TIMESTAMP_FIELD)) { return TimestampInequalityRule.getRule(inequalitySymbol, value); } else { return new InequalityRule(inequalitySymbol, field, value); } }
[ "public", "static", "Rule", "getRule", "(", "final", "String", "inequalitySymbol", ",", "final", "String", "field", ",", "final", "String", "value", ")", "{", "if", "(", "field", ".", "equalsIgnoreCase", "(", "LoggingEventFieldResolver", ".", "LEVEL_FIELD", ")",...
Create new instance from top two elements on stack. @param inequalitySymbol inequality symbol. @param field field. @param value comparison value. @return rule.
[ "Create", "new", "instance", "from", "top", "two", "elements", "on", "stack", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/rule/InequalityRule.java#L109-L122
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.packEntries
public static void packEntries(File[] filesToPack, File destZipFile) { packEntries(filesToPack, destZipFile, IdentityNameMapper.INSTANCE); }
java
public static void packEntries(File[] filesToPack, File destZipFile) { packEntries(filesToPack, destZipFile, IdentityNameMapper.INSTANCE); }
[ "public", "static", "void", "packEntries", "(", "File", "[", "]", "filesToPack", ",", "File", "destZipFile", ")", "{", "packEntries", "(", "filesToPack", ",", "destZipFile", ",", "IdentityNameMapper", ".", "INSTANCE", ")", ";", "}" ]
Compresses the given files into a ZIP file. <p> The ZIP file must not be a directory and its parent directory must exist. @param filesToPack files that needs to be zipped. @param destZipFile ZIP file that will be created or overwritten.
[ "Compresses", "the", "given", "files", "into", "a", "ZIP", "file", ".", "<p", ">", "The", "ZIP", "file", "must", "not", "be", "a", "directory", "and", "its", "parent", "directory", "must", "exist", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1493-L1495
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.orthoSymmetricLH
public Matrix4f orthoSymmetricLH(float width, float height, float zNear, float zFar, boolean zZeroToOne) { return orthoSymmetricLH(width, height, zNear, zFar, zZeroToOne, thisOrNew()); }
java
public Matrix4f orthoSymmetricLH(float width, float height, float zNear, float zFar, boolean zZeroToOne) { return orthoSymmetricLH(width, height, zNear, zFar, zZeroToOne, thisOrNew()); }
[ "public", "Matrix4f", "orthoSymmetricLH", "(", "float", "width", ",", "float", "height", ",", "float", "zNear", ",", "float", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "return", "orthoSymmetricLH", "(", "width", ",", "height", ",", "zNear", ",", "zFar"...
Apply a symmetric orthographic projection transformation for a left-handed coordinate system using the given NDC z range to this matrix. <p> This method is equivalent to calling {@link #orthoLH(float, float, float, float, float, float, boolean) orthoLH()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetricLH(float, float, float, float, boolean) setOrthoSymmetricLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrthoSymmetricLH(float, float, float, float, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return a matrix holding the result
[ "Apply", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", "to", "this", "matrix", ".", "<p", ">", "This", "method", "is", "equivalent", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7605-L7607
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/EpicsApi.java
EpicsApi.deleteEpic
public void deleteEpic(Object groupIdOrPath, Integer epicIid) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid); }
java
public void deleteEpic(Object groupIdOrPath, Integer epicIid) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid); }
[ "public", "void", "deleteEpic", "(", "Object", "groupIdOrPath", ",", "Integer", "epicIid", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "null", ",", "\"groups\"", ",", "getGroupIdOrPath", "(", "group...
Deletes an epic. <pre><code>GitLab Endpoint: DELETE /groups/:id/epics/:epic_iid</code></pre> @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path @param epicIid the IID of the epic to delete @throws GitLabApiException if any exception occurs
[ "Deletes", "an", "epic", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/EpicsApi.java#L339-L341
flavioarfaria/KenBurnsView
library/src/main/java/com/flaviofaria/kenburnsview/MathUtils.java
MathUtils.haveSameAspectRatio
protected static boolean haveSameAspectRatio(RectF r1, RectF r2) { // Reduces precision to avoid problems when comparing aspect ratios. float srcRectRatio = MathUtils.truncate(MathUtils.getRectRatio(r1), 3); float dstRectRatio = MathUtils.truncate(MathUtils.getRectRatio(r2), 3); // Compares aspect ratios that allows for a tolerance range of [0, 0.01] return (Math.abs(srcRectRatio-dstRectRatio) <= 0.01f); }
java
protected static boolean haveSameAspectRatio(RectF r1, RectF r2) { // Reduces precision to avoid problems when comparing aspect ratios. float srcRectRatio = MathUtils.truncate(MathUtils.getRectRatio(r1), 3); float dstRectRatio = MathUtils.truncate(MathUtils.getRectRatio(r2), 3); // Compares aspect ratios that allows for a tolerance range of [0, 0.01] return (Math.abs(srcRectRatio-dstRectRatio) <= 0.01f); }
[ "protected", "static", "boolean", "haveSameAspectRatio", "(", "RectF", "r1", ",", "RectF", "r2", ")", "{", "// Reduces precision to avoid problems when comparing aspect ratios.", "float", "srcRectRatio", "=", "MathUtils", ".", "truncate", "(", "MathUtils", ".", "getRectRa...
Checks whether two {@link RectF} have the same aspect ratio. @param r1 the first rect. @param r2 the second rect. @return {@code true} if both rectangles have the same aspect ratio, {@code false} otherwise.
[ "Checks", "whether", "two", "{" ]
train
https://github.com/flavioarfaria/KenBurnsView/blob/57a0fd7a586759c5c2e18fda51a3fcb09b48f388/library/src/main/java/com/flaviofaria/kenburnsview/MathUtils.java#L45-L52
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java
AvatarNodeZkUtil.checkZooKeeperBeforeFailover
static ZookeeperTxId checkZooKeeperBeforeFailover(Configuration startupConf, Configuration confg, boolean noverification) throws IOException { AvatarZooKeeperClient zk = null; String fsname = startupConf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY); int maxTries = startupConf.getInt("dfs.avatarnode.zk.retries", 3); Exception lastException = null; for (int i = 0; i < maxTries; i++) { try { zk = new AvatarZooKeeperClient(confg, null, false); LOG.info("Failover: Checking if the primary is empty"); String zkRegistry = zk.getPrimaryAvatarAddress(fsname, new Stat(), false, i > 0); if (zkRegistry != null) { throw new IOException( "Can't switch the AvatarNode to primary since " + "zookeeper record is not clean. Either use shutdownAvatar to kill " + "the current primary and clean the ZooKeeper entry, " + "or clear out the ZooKeeper entry if the primary is dead"); } if (noverification) { return null; } LOG.info("Failover: Obtaining last transaction id from ZK"); String address = startupConf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY); long sessionId = zk.getPrimarySsId(address, i > 0); ZookeeperTxId zkTxId = zk.getPrimaryLastTxId(address, i > 0); if (sessionId != zkTxId.getSessionId()) { throw new IOException("Session Id in the ssid node : " + sessionId + " does not match the session Id in the txid node : " + zkTxId.getSessionId()); } return zkTxId; } catch (Exception e) { LOG.error("Got Exception reading primary node registration " + "from ZooKeeper. Will retry...", e); lastException = e; } finally { shutdownZkClient(zk); } } throw new IOException(lastException); }
java
static ZookeeperTxId checkZooKeeperBeforeFailover(Configuration startupConf, Configuration confg, boolean noverification) throws IOException { AvatarZooKeeperClient zk = null; String fsname = startupConf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY); int maxTries = startupConf.getInt("dfs.avatarnode.zk.retries", 3); Exception lastException = null; for (int i = 0; i < maxTries; i++) { try { zk = new AvatarZooKeeperClient(confg, null, false); LOG.info("Failover: Checking if the primary is empty"); String zkRegistry = zk.getPrimaryAvatarAddress(fsname, new Stat(), false, i > 0); if (zkRegistry != null) { throw new IOException( "Can't switch the AvatarNode to primary since " + "zookeeper record is not clean. Either use shutdownAvatar to kill " + "the current primary and clean the ZooKeeper entry, " + "or clear out the ZooKeeper entry if the primary is dead"); } if (noverification) { return null; } LOG.info("Failover: Obtaining last transaction id from ZK"); String address = startupConf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY); long sessionId = zk.getPrimarySsId(address, i > 0); ZookeeperTxId zkTxId = zk.getPrimaryLastTxId(address, i > 0); if (sessionId != zkTxId.getSessionId()) { throw new IOException("Session Id in the ssid node : " + sessionId + " does not match the session Id in the txid node : " + zkTxId.getSessionId()); } return zkTxId; } catch (Exception e) { LOG.error("Got Exception reading primary node registration " + "from ZooKeeper. Will retry...", e); lastException = e; } finally { shutdownZkClient(zk); } } throw new IOException(lastException); }
[ "static", "ZookeeperTxId", "checkZooKeeperBeforeFailover", "(", "Configuration", "startupConf", ",", "Configuration", "confg", ",", "boolean", "noverification", ")", "throws", "IOException", "{", "AvatarZooKeeperClient", "zk", "=", "null", ";", "String", "fsname", "=", ...
Verifies whether we are in a consistent state before we perform a failover @param startupConf the startup configuration @param confg the current configuration @param noverification whether or not to skip some zookeeper based verification @return the session id and last transaction id information from zookeeper @throws IOException
[ "Verifies", "whether", "we", "are", "in", "a", "consistent", "state", "before", "we", "perform", "a", "failover" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java#L54-L98
UrielCh/ovh-java-sdk
ovh-java-sdk-caascontainers/src/main/java/net/minidev/ovh/api/ApiOvhCaascontainers.java
ApiOvhCaascontainers.serviceName_frameworks_frameworkId_apps_GET
public OvhApplication serviceName_frameworks_frameworkId_apps_GET(String serviceName, String frameworkId) throws IOException { String qPath = "/caas/containers/{serviceName}/frameworks/{frameworkId}/apps"; StringBuilder sb = path(qPath, serviceName, frameworkId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhApplication.class); }
java
public OvhApplication serviceName_frameworks_frameworkId_apps_GET(String serviceName, String frameworkId) throws IOException { String qPath = "/caas/containers/{serviceName}/frameworks/{frameworkId}/apps"; StringBuilder sb = path(qPath, serviceName, frameworkId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhApplication.class); }
[ "public", "OvhApplication", "serviceName_frameworks_frameworkId_apps_GET", "(", "String", "serviceName", ",", "String", "frameworkId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/caas/containers/{serviceName}/frameworks/{frameworkId}/apps\"", ";", "StringBuilde...
List apps in the framework REST: GET /caas/containers/{serviceName}/frameworks/{frameworkId}/apps @param frameworkId [required] framework id @param serviceName [required] service name API beta
[ "List", "apps", "in", "the", "framework" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caascontainers/src/main/java/net/minidev/ovh/api/ApiOvhCaascontainers.java#L215-L220
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/sa/StandardServiceAgentServer.java
StandardServiceAgentServer.handleTCPSrvReg
protected void handleTCPSrvReg(SrvReg srvReg, Socket socket) { try { boolean update = srvReg.isUpdating(); ServiceInfo givenService = ServiceInfo.from(srvReg); ServiceInfoCache.Result<ServiceInfo> result = cacheService(givenService, update); forwardRegistration(givenService, result.getPrevious(), result.getCurrent(), update); tcpSrvAck.perform(socket, srvReg, SLPError.NO_ERROR); } catch (ServiceLocationException x) { tcpSrvAck.perform(socket, srvReg, x.getSLPError()); } }
java
protected void handleTCPSrvReg(SrvReg srvReg, Socket socket) { try { boolean update = srvReg.isUpdating(); ServiceInfo givenService = ServiceInfo.from(srvReg); ServiceInfoCache.Result<ServiceInfo> result = cacheService(givenService, update); forwardRegistration(givenService, result.getPrevious(), result.getCurrent(), update); tcpSrvAck.perform(socket, srvReg, SLPError.NO_ERROR); } catch (ServiceLocationException x) { tcpSrvAck.perform(socket, srvReg, x.getSLPError()); } }
[ "protected", "void", "handleTCPSrvReg", "(", "SrvReg", "srvReg", ",", "Socket", "socket", ")", "{", "try", "{", "boolean", "update", "=", "srvReg", ".", "isUpdating", "(", ")", ";", "ServiceInfo", "givenService", "=", "ServiceInfo", ".", "from", "(", "srvReg...
Handles a unicast TCP SrvReg message arrived to this service agent. <br /> This service agent will reply with an acknowledge containing the result of the registration. @param srvReg the SrvReg message to handle @param socket the socket connected to th client where to write the reply
[ "Handles", "a", "unicast", "TCP", "SrvReg", "message", "arrived", "to", "this", "service", "agent", ".", "<br", "/", ">", "This", "service", "agent", "will", "reply", "with", "an", "acknowledge", "containing", "the", "result", "of", "the", "registration", "....
train
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/sa/StandardServiceAgentServer.java#L168-L182
WiQuery/wiquery
wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/slider/SliderAnimate.java
SliderAnimate.setParam
private void setParam(Boolean booleanParam, AnimateEnum animateEnumParam, Number numberParam) { this.booleanParam = booleanParam; this.animateEnumParam = animateEnumParam; this.numberParam = numberParam; }
java
private void setParam(Boolean booleanParam, AnimateEnum animateEnumParam, Number numberParam) { this.booleanParam = booleanParam; this.animateEnumParam = animateEnumParam; this.numberParam = numberParam; }
[ "private", "void", "setParam", "(", "Boolean", "booleanParam", ",", "AnimateEnum", "animateEnumParam", ",", "Number", "numberParam", ")", "{", "this", ".", "booleanParam", "=", "booleanParam", ";", "this", ".", "animateEnumParam", "=", "animateEnumParam", ";", "th...
Method setting the right parameter @param booleanParam Boolean parameter @param animateEnumParam AnimateEnum parameter @param numberParam Number param
[ "Method", "setting", "the", "right", "parameter" ]
train
https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/slider/SliderAnimate.java#L213-L218
meraki-analytics/datapipelines-java
src/main/java/com/merakianalytics/datapipelines/TypeGraph.java
TypeGraph.getTransform
@SuppressWarnings("unchecked") // Generics are not the strong suit of Hipster4j. public ChainTransform getTransform(final Class from, final Class<?> to) { if(from.equals(to)) { return ChainTransform.identity(to); } final SearchProblem problem = GraphSearchProblem.startingFrom(from).in(graph).extractCostFromEdges(new Function<DataTransformer, Double>() { @Override public Double apply(final DataTransformer transformer) { return new Double(transformer.cost()); } }).build(); final List<Class<?>> path = (List<Class<?>>)Hipster.createDijkstra(problem).search(to).getOptimalPaths().get(0); if(path == null || !path.get(path.size() - 1).equals(to)) { return null; } final List<DataTransformer> transform = new LinkedList<>(); for(int i = 1; i < path.size(); i++) { transform.add(cheapest.get(path.get(i - 1)).get(path.get(i))); } return new ChainTransform(from, to, path, transform); }
java
@SuppressWarnings("unchecked") // Generics are not the strong suit of Hipster4j. public ChainTransform getTransform(final Class from, final Class<?> to) { if(from.equals(to)) { return ChainTransform.identity(to); } final SearchProblem problem = GraphSearchProblem.startingFrom(from).in(graph).extractCostFromEdges(new Function<DataTransformer, Double>() { @Override public Double apply(final DataTransformer transformer) { return new Double(transformer.cost()); } }).build(); final List<Class<?>> path = (List<Class<?>>)Hipster.createDijkstra(problem).search(to).getOptimalPaths().get(0); if(path == null || !path.get(path.size() - 1).equals(to)) { return null; } final List<DataTransformer> transform = new LinkedList<>(); for(int i = 1; i < path.size(); i++) { transform.add(cheapest.get(path.get(i - 1)).get(path.get(i))); } return new ChainTransform(from, to, path, transform); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// Generics are not the strong suit of Hipster4j.", "public", "ChainTransform", "getTransform", "(", "final", "Class", "from", ",", "final", "Class", "<", "?", ">", "to", ")", "{", "if", "(", "from", ".", "equal...
Attempts to find the best {@link com.merakianalytics.datapipelines.ChainTransform} to get from a type to another @param from the type to convert from @param to the type to convert to @return the best {@link com.merakianalytics.datapipelines.ChainTransform} between the types, or null if there is none
[ "Attempts", "to", "find", "the", "best", "{", "@link", "com", ".", "merakianalytics", ".", "datapipelines", ".", "ChainTransform", "}", "to", "get", "from", "a", "type", "to", "another" ]
train
https://github.com/meraki-analytics/datapipelines-java/blob/376ff1e8e1f7c67f2f2a5521d2a66e91467e56b0/src/main/java/com/merakianalytics/datapipelines/TypeGraph.java#L83-L106
baratine/baratine
web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java
RequestHttp1.setHeader
@Override public void setHeader(String key, String value) { int tail; if (_headerSize > 0) { tail = (_headerValues[_headerSize - 1].offset() + _headerValues[_headerSize - 1].length()); } else { tail = 0; } int keyLength = key.length(); int valueLength = value.length(); char []headerBuffer = _headerBuffer; for (int i = keyLength - 1; i >= 0; i--) { headerBuffer[tail + i] = key.charAt(i); } _headerKeys[_headerSize].init(headerBuffer, tail, keyLength); tail += keyLength; for (int i = valueLength - 1; i >= 0; i--) { headerBuffer[tail + i] = value.charAt(i); } _headerValues[_headerSize].init(headerBuffer, tail, valueLength); _headerSize++; // XXX: size }
java
@Override public void setHeader(String key, String value) { int tail; if (_headerSize > 0) { tail = (_headerValues[_headerSize - 1].offset() + _headerValues[_headerSize - 1].length()); } else { tail = 0; } int keyLength = key.length(); int valueLength = value.length(); char []headerBuffer = _headerBuffer; for (int i = keyLength - 1; i >= 0; i--) { headerBuffer[tail + i] = key.charAt(i); } _headerKeys[_headerSize].init(headerBuffer, tail, keyLength); tail += keyLength; for (int i = valueLength - 1; i >= 0; i--) { headerBuffer[tail + i] = value.charAt(i); } _headerValues[_headerSize].init(headerBuffer, tail, valueLength); _headerSize++; // XXX: size }
[ "@", "Override", "public", "void", "setHeader", "(", "String", "key", ",", "String", "value", ")", "{", "int", "tail", ";", "if", "(", "_headerSize", ">", "0", ")", "{", "tail", "=", "(", "_headerValues", "[", "_headerSize", "-", "1", "]", ".", "offs...
Adds a new header. Used only by the caching to simulate If-Modified-Since. @param key the key of the new header @param value the value for the new header
[ "Adds", "a", "new", "header", ".", "Used", "only", "by", "the", "caching", "to", "simulate", "If", "-", "Modified", "-", "Since", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L609-L641
febit/wit
wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java
ClassWriter.newString
private Item newString(final String value) { Item result = get(key2.set(STR, value, null, null)); if (result == null) { pool.putBS(STR, newUTF8(value)); result = new Item(poolIndex++, key2); put(result); } return result; }
java
private Item newString(final String value) { Item result = get(key2.set(STR, value, null, null)); if (result == null) { pool.putBS(STR, newUTF8(value)); result = new Item(poolIndex++, key2); put(result); } return result; }
[ "private", "Item", "newString", "(", "final", "String", "value", ")", "{", "Item", "result", "=", "get", "(", "key2", ".", "set", "(", "STR", ",", "value", ",", "null", ",", "null", ")", ")", ";", "if", "(", "result", "==", "null", ")", "{", "poo...
Adds a string to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item. @param value the String value. @return a new or already existing string item.
[ "Adds", "a", "string", "to", "the", "constant", "pool", "of", "the", "class", "being", "build", ".", "Does", "nothing", "if", "the", "constant", "pool", "already", "contains", "a", "similar", "item", "." ]
train
https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java#L684-L692
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/AtomicGrowingSparseHashMatrix.java
AtomicGrowingSparseHashMatrix.lockColumn
private void lockColumn(int col, int rowsToLock) { // Put in an entry for all the columns's rows for (int row = 0; row < rowsToLock; ++row) { Entry e = new Entry(row, col); // Spin waiting for the entry to be unlocked while (lockedEntries.putIfAbsent(e, new Object()) != null) ; } }
java
private void lockColumn(int col, int rowsToLock) { // Put in an entry for all the columns's rows for (int row = 0; row < rowsToLock; ++row) { Entry e = new Entry(row, col); // Spin waiting for the entry to be unlocked while (lockedEntries.putIfAbsent(e, new Object()) != null) ; } }
[ "private", "void", "lockColumn", "(", "int", "col", ",", "int", "rowsToLock", ")", "{", "// Put in an entry for all the columns's rows", "for", "(", "int", "row", "=", "0", ";", "row", "<", "rowsToLock", ";", "++", "row", ")", "{", "Entry", "e", "=", "new"...
Locks all the row entries for this column, thereby preventing write or read access to the values. Note that the number of rows to lock <b>must</b> be the same value used with {@link #unlockColumn(int,int)}, otherwise the unlock may potentially unlock matrix entries associated with this lock call. @param col the column to lock @param rowsToLock the number of rows to lock. This value should be the number of {@link #rows} at the time of the call.
[ "Locks", "all", "the", "row", "entries", "for", "this", "column", "thereby", "preventing", "write", "or", "read", "access", "to", "the", "values", ".", "Note", "that", "the", "number", "of", "rows", "to", "lock", "<b", ">", "must<", "/", "b", ">", "be"...
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/AtomicGrowingSparseHashMatrix.java#L380-L388
davidmoten/ppk
ppk/src/main/java/com/github/davidmoten/security/PPK.java
PPK.publicKey
public static final Builder publicKey(Class<?> cls, String resource) { return new Builder().publicKey(cls, resource); }
java
public static final Builder publicKey(Class<?> cls, String resource) { return new Builder().publicKey(cls, resource); }
[ "public", "static", "final", "Builder", "publicKey", "(", "Class", "<", "?", ">", "cls", ",", "String", "resource", ")", "{", "return", "new", "Builder", "(", ")", ".", "publicKey", "(", "cls", ",", "resource", ")", ";", "}" ]
Returns a builder having loaded the public key from the classpath relative to the classloader used by {@code cls}. @param cls the class whose classloader is used to load the resource @param resource the resource path @return the PPK builder
[ "Returns", "a", "builder", "having", "loaded", "the", "public", "key", "from", "the", "classpath", "relative", "to", "the", "classloader", "used", "by", "{", "@code", "cls", "}", "." ]
train
https://github.com/davidmoten/ppk/blob/7506ed490445927fbdeec2fe9c70b4a589a951cb/ppk/src/main/java/com/github/davidmoten/security/PPK.java#L184-L186
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/util/MimeTypeUtil.java
MimeTypeUtil.getMimeType
public static String getMimeType(String name, Property property, String defaultValue) { MimeType mimeType = getMimeType(name, property); return mimeType != null ? mimeType.toString() : defaultValue; }
java
public static String getMimeType(String name, Property property, String defaultValue) { MimeType mimeType = getMimeType(name, property); return mimeType != null ? mimeType.toString() : defaultValue; }
[ "public", "static", "String", "getMimeType", "(", "String", "name", ",", "Property", "property", ",", "String", "defaultValue", ")", "{", "MimeType", "mimeType", "=", "getMimeType", "(", "name", ",", "property", ")", ";", "return", "mimeType", "!=", "null", ...
Detects the mime type of a binary property in the context of the nodes name. @param name the name of the node which defines the binary resource (probably a file name) @param property the binary property (for stream parsing) @param defaultValue the default value if the detection has no useful result @return the detected mime type or the default value given
[ "Detects", "the", "mime", "type", "of", "a", "binary", "property", "in", "the", "context", "of", "the", "nodes", "name", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/MimeTypeUtil.java#L72-L75
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/pubmed/ManualDescriptor.java
ManualDescriptor.setChemicalList
public void setChemicalList(int i, Chemical v) { if (ManualDescriptor_Type.featOkTst && ((ManualDescriptor_Type)jcasType).casFeat_chemicalList == null) jcasType.jcas.throwFeatMissing("chemicalList", "de.julielab.jules.types.pubmed.ManualDescriptor"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_chemicalList), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_chemicalList), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setChemicalList(int i, Chemical v) { if (ManualDescriptor_Type.featOkTst && ((ManualDescriptor_Type)jcasType).casFeat_chemicalList == null) jcasType.jcas.throwFeatMissing("chemicalList", "de.julielab.jules.types.pubmed.ManualDescriptor"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_chemicalList), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_chemicalList), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setChemicalList", "(", "int", "i", ",", "Chemical", "v", ")", "{", "if", "(", "ManualDescriptor_Type", ".", "featOkTst", "&&", "(", "(", "ManualDescriptor_Type", ")", "jcasType", ")", ".", "casFeat_chemicalList", "==", "null", ")", "jcasType...
indexed setter for chemicalList - sets an indexed value - A collection of objects of type uima.julielab.uima.Chemical, O @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "chemicalList", "-", "sets", "an", "indexed", "value", "-", "A", "collection", "of", "objects", "of", "type", "uima", ".", "julielab", ".", "uima", ".", "Chemical", "O" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/pubmed/ManualDescriptor.java#L165-L169
h2oai/h2o-3
h2o-core/src/main/java/water/ExternalFrameWriterClient.java
ExternalFrameWriterClient.createChunks
public void createChunks(String frameKey, byte[] expectedTypes, int chunkId, int totalNumRows, int[] maxVecSizes) throws IOException { ab.put1(ExternalFrameHandler.INIT_BYTE); ab.put1(ExternalFrameHandler.CREATE_FRAME); ab.putStr(frameKey); this.expectedTypes = expectedTypes; ab.putA1(expectedTypes); ab.putA4(maxVecSizes); ab.putInt(totalNumRows); ab.putInt(chunkId); writeToChannel(ab, channel); }
java
public void createChunks(String frameKey, byte[] expectedTypes, int chunkId, int totalNumRows, int[] maxVecSizes) throws IOException { ab.put1(ExternalFrameHandler.INIT_BYTE); ab.put1(ExternalFrameHandler.CREATE_FRAME); ab.putStr(frameKey); this.expectedTypes = expectedTypes; ab.putA1(expectedTypes); ab.putA4(maxVecSizes); ab.putInt(totalNumRows); ab.putInt(chunkId); writeToChannel(ab, channel); }
[ "public", "void", "createChunks", "(", "String", "frameKey", ",", "byte", "[", "]", "expectedTypes", ",", "int", "chunkId", ",", "int", "totalNumRows", ",", "int", "[", "]", "maxVecSizes", ")", "throws", "IOException", "{", "ab", ".", "put1", "(", "Externa...
Create chunks on the h2o backend. This method creates chunk in en empty frame. @param frameKey name of the frame @param expectedTypes expected types @param chunkId chunk index @param totalNumRows total number of rows which is about to be sent
[ "Create", "chunks", "on", "the", "h2o", "backend", ".", "This", "method", "creates", "chunk", "in", "en", "empty", "frame", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/ExternalFrameWriterClient.java#L76-L86
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java
ExpressRouteConnectionsInner.beginCreateOrUpdate
public ExpressRouteConnectionInner beginCreateOrUpdate(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).toBlocking().single().body(); }
java
public ExpressRouteConnectionInner beginCreateOrUpdate(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).toBlocking().single().body(); }
[ "public", "ExpressRouteConnectionInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "expressRouteGatewayName", ",", "String", "connectionName", ",", "ExpressRouteConnectionInner", "putExpressRouteConnectionParameters", ")", "{", "return", "beginCrea...
Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. @param resourceGroupName The name of the resource group. @param expressRouteGatewayName The name of the ExpressRoute gateway. @param connectionName The name of the connection subresource. @param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteConnectionInner object if successful.
[ "Creates", "a", "connection", "between", "an", "ExpressRoute", "gateway", "and", "an", "ExpressRoute", "circuit", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java#L178-L180
centic9/commons-dost
src/main/java/org/dstadler/commons/http/NanoHTTPD.java
NanoHTTPD.encodeUri
private String encodeUri( String uri ) { StringBuilder newUri = new StringBuilder(); StringTokenizer st = new StringTokenizer( uri, "/ ", true ); while ( st.hasMoreTokens()) { String tok = st.nextToken(); if ( tok.equals( "/" )) { newUri.append('/'); } else if ( tok.equals( " " )) { newUri.append("%20"); } else { try { newUri.append(URLEncoder.encode( tok, "UTF-8" )); } catch ( UnsupportedEncodingException uee ) { // NOPMD - imported code // imported code } } } return newUri.toString(); }
java
private String encodeUri( String uri ) { StringBuilder newUri = new StringBuilder(); StringTokenizer st = new StringTokenizer( uri, "/ ", true ); while ( st.hasMoreTokens()) { String tok = st.nextToken(); if ( tok.equals( "/" )) { newUri.append('/'); } else if ( tok.equals( " " )) { newUri.append("%20"); } else { try { newUri.append(URLEncoder.encode( tok, "UTF-8" )); } catch ( UnsupportedEncodingException uee ) { // NOPMD - imported code // imported code } } } return newUri.toString(); }
[ "private", "String", "encodeUri", "(", "String", "uri", ")", "{", "StringBuilder", "newUri", "=", "new", "StringBuilder", "(", ")", ";", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "uri", ",", "\"/ \"", ",", "true", ")", ";", "while", "(",...
URL-encodes everything between '/'-characters. Encodes spaces as '%20' instead of '+'.
[ "URL", "-", "encodes", "everything", "between", "/", "-", "characters", ".", "Encodes", "spaces", "as", "%20", "instead", "of", "+", "." ]
train
https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/http/NanoHTTPD.java#L648-L668
lessthanoptimal/ejml
main/ejml-simple/src/org/ejml/simple/SimpleBase.java
SimpleBase.isIdentical
public boolean isIdentical(T a, double tol) { if( a.getType() != getType() ) return false; return ops.isIdentical(mat,a.mat,tol); }
java
public boolean isIdentical(T a, double tol) { if( a.getType() != getType() ) return false; return ops.isIdentical(mat,a.mat,tol); }
[ "public", "boolean", "isIdentical", "(", "T", "a", ",", "double", "tol", ")", "{", "if", "(", "a", ".", "getType", "(", ")", "!=", "getType", "(", ")", ")", "return", "false", ";", "return", "ops", ".", "isIdentical", "(", "mat", ",", "a", ".", "...
Checks to see if matrix 'a' is the same as this matrix within the specified tolerance. @param a The matrix it is being compared against. @param tol How similar they must be to be equals. @return If they are equal within tolerance of each other.
[ "Checks", "to", "see", "if", "matrix", "a", "is", "the", "same", "as", "this", "matrix", "within", "the", "specified", "tolerance", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleBase.java#L904-L908
dbracewell/mango
src/main/java/com/davidbracewell/conversion/Val.java
Val.asMap
public <K, V> Map<K, V> asMap(Class<K> keyClass, Class<V> valueClass) { return asMap(HashMap.class, keyClass, valueClass); }
java
public <K, V> Map<K, V> asMap(Class<K> keyClass, Class<V> valueClass) { return asMap(HashMap.class, keyClass, valueClass); }
[ "public", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "asMap", "(", "Class", "<", "K", ">", "keyClass", ",", "Class", "<", "V", ">", "valueClass", ")", "{", "return", "asMap", "(", "HashMap", ".", "class", ",", "keyClass", ",", "va...
Converts the object to a map @param <K> the type parameter @param <V> the type parameter @param keyClass The key class @param valueClass The value class @return the object as a map
[ "Converts", "the", "object", "to", "a", "map" ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/conversion/Val.java#L143-L145
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/util/concurrent/UnsynchronizedRateLimiter.java
UnsynchronizedRateLimiter.tryAcquire
public boolean tryAcquire(int permits, long timeout, TimeUnit unit) { long timeoutMicros = unit.toMicros(timeout); checkPermits(permits); long microsToWait; long nowMicros = readSafeMicros(); if (nextFreeTicketMicros > nowMicros + timeoutMicros) { return false; } else { microsToWait = reserveNextTicket(permits, nowMicros); } ticker.sleepMicrosUninterruptibly(microsToWait); return true; }
java
public boolean tryAcquire(int permits, long timeout, TimeUnit unit) { long timeoutMicros = unit.toMicros(timeout); checkPermits(permits); long microsToWait; long nowMicros = readSafeMicros(); if (nextFreeTicketMicros > nowMicros + timeoutMicros) { return false; } else { microsToWait = reserveNextTicket(permits, nowMicros); } ticker.sleepMicrosUninterruptibly(microsToWait); return true; }
[ "public", "boolean", "tryAcquire", "(", "int", "permits", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "long", "timeoutMicros", "=", "unit", ".", "toMicros", "(", "timeout", ")", ";", "checkPermits", "(", "permits", ")", ";", "long", "microsT...
Acquires the given number of permits from this {@code UnsynchronizedRateLimiter} if it can be obtained without exceeding the specified {@code timeout}, or returns {@code false} immediately (without waiting) if the permits would not have been granted before the timeout expired. @param permits the number of permits to acquire @param timeout the maximum time to wait for the permits @param unit the time unit of the timeout argument @return {@code true} if the permits were acquired, {@code false} otherwise
[ "Acquires", "the", "given", "number", "of", "permits", "from", "this", "{", "@code", "UnsynchronizedRateLimiter", "}", "if", "it", "can", "be", "obtained", "without", "exceeding", "the", "specified", "{", "@code", "timeout", "}", "or", "returns", "{", "@code",...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/UnsynchronizedRateLimiter.java#L479-L491
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.resumeDomainStream
public ResumeDomainStreamResponse resumeDomainStream(String domain, String app, String stream) { ResumeDomainStreamRequest request = new ResumeDomainStreamRequest(); request.withDomain(domain).withApp(app).withStream(stream); return resumeDomainStream(request); }
java
public ResumeDomainStreamResponse resumeDomainStream(String domain, String app, String stream) { ResumeDomainStreamRequest request = new ResumeDomainStreamRequest(); request.withDomain(domain).withApp(app).withStream(stream); return resumeDomainStream(request); }
[ "public", "ResumeDomainStreamResponse", "resumeDomainStream", "(", "String", "domain", ",", "String", "app", ",", "String", "stream", ")", "{", "ResumeDomainStreamRequest", "request", "=", "new", "ResumeDomainStreamRequest", "(", ")", ";", "request", ".", "withDomain"...
Get detail of stream in the live stream service. @param domain The requested domain which the specific stream belongs to @param app The requested app which the specific stream belongs to @param stream The requested stream to resume @return the response
[ "Get", "detail", "of", "stream", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1556-L1560
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveBinaryOperator
Symbol resolveBinaryOperator(DiagnosticPosition pos, JCTree.Tag optag, Env<AttrContext> env, Type left, Type right) { return resolveOperator(pos, optag, env, List.of(left, right)); }
java
Symbol resolveBinaryOperator(DiagnosticPosition pos, JCTree.Tag optag, Env<AttrContext> env, Type left, Type right) { return resolveOperator(pos, optag, env, List.of(left, right)); }
[ "Symbol", "resolveBinaryOperator", "(", "DiagnosticPosition", "pos", ",", "JCTree", ".", "Tag", "optag", ",", "Env", "<", "AttrContext", ">", "env", ",", "Type", "left", ",", "Type", "right", ")", "{", "return", "resolveOperator", "(", "pos", ",", "optag", ...
Resolve binary operator. @param pos The position to use for error reporting. @param optag The tag of the operation tree. @param env The environment current at the operation. @param left The types of the left operand. @param right The types of the right operand.
[ "Resolve", "binary", "operator", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L2721-L2727
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java
Hdf5Archive.readAttributeAsFixedLengthString
public String readAttributeAsFixedLengthString(String attributeName, int bufferSize) throws UnsupportedKerasConfigurationException { synchronized (Hdf5Archive.LOCK_OBJECT) { Attribute a = this.file.openAttribute(attributeName); String s = readAttributeAsFixedLengthString(a, bufferSize); a.deallocate(); return s; } }
java
public String readAttributeAsFixedLengthString(String attributeName, int bufferSize) throws UnsupportedKerasConfigurationException { synchronized (Hdf5Archive.LOCK_OBJECT) { Attribute a = this.file.openAttribute(attributeName); String s = readAttributeAsFixedLengthString(a, bufferSize); a.deallocate(); return s; } }
[ "public", "String", "readAttributeAsFixedLengthString", "(", "String", "attributeName", ",", "int", "bufferSize", ")", "throws", "UnsupportedKerasConfigurationException", "{", "synchronized", "(", "Hdf5Archive", ".", "LOCK_OBJECT", ")", "{", "Attribute", "a", "=", "this...
Read string attribute from group path. @param attributeName Name of attribute @param bufferSize buffer size to read @return Fixed-length string read from HDF5 attribute name @throws UnsupportedKerasConfigurationException Unsupported Keras config
[ "Read", "string", "attribute", "from", "group", "path", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java#L424-L432
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.listFromComputeNodeNextAsync
public ServiceFuture<List<NodeFile>> listFromComputeNodeNextAsync(final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions, final ServiceFuture<List<NodeFile>> serviceFuture, final ListOperationCallback<NodeFile> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(String nextPageLink) { return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions); } }, serviceCallback); }
java
public ServiceFuture<List<NodeFile>> listFromComputeNodeNextAsync(final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions, final ServiceFuture<List<NodeFile>> serviceFuture, final ListOperationCallback<NodeFile> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(String nextPageLink) { return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "NodeFile", ">", ">", "listFromComputeNodeNextAsync", "(", "final", "String", "nextPageLink", ",", "final", "FileListFromComputeNodeNextOptions", "fileListFromComputeNodeNextOptions", ",", "final", "ServiceFuture", "<", "List", ...
Lists all of the files in task directories on the specified compute node. @param nextPageLink The NextLink from the previous successful call to List operation. @param fileListFromComputeNodeNextOptions Additional parameters for the operation @param serviceFuture the ServiceFuture object tracking the Retrofit calls @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Lists", "all", "of", "the", "files", "in", "task", "directories", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2608-L2618
tango-controls/JTango
dao/src/main/java/fr/esrf/TangoDs/Util.java
Util.init
public static Util init(final String[] argv, final String exec_name) { if (_instance == null) { _instance = new Util(argv, exec_name); } return _instance; }
java
public static Util init(final String[] argv, final String exec_name) { if (_instance == null) { _instance = new Util(argv, exec_name); } return _instance; }
[ "public", "static", "Util", "init", "(", "final", "String", "[", "]", "argv", ",", "final", "String", "exec_name", ")", "{", "if", "(", "_instance", "==", "null", ")", "{", "_instance", "=", "new", "Util", "(", "argv", ",", "exec_name", ")", ";", "}"...
Create and get the singleton object reference. <p> This method returns a reference to the object of the Util class. If the class singleton object has not been created, it will be instanciated @param argv The process argument String array @param exec_name The device server executable name @return The Util object reference
[ "Create", "and", "get", "the", "singleton", "object", "reference", ".", "<p", ">", "This", "method", "returns", "a", "reference", "to", "the", "object", "of", "the", "Util", "class", ".", "If", "the", "class", "singleton", "object", "has", "not", "been", ...
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/Util.java#L366-L371
infinispan/infinispan
core/src/main/java/org/infinispan/cache/impl/CacheImpl.java
CacheImpl.executeCommandWithInjectedTx
private Object executeCommandWithInjectedTx(InvocationContext ctx, VisitableCommand command) { final Object result; try { result = invoker.invoke(ctx, command); } catch (Throwable e) { tryRollback(); throw e; } tryCommit(); return result; }
java
private Object executeCommandWithInjectedTx(InvocationContext ctx, VisitableCommand command) { final Object result; try { result = invoker.invoke(ctx, command); } catch (Throwable e) { tryRollback(); throw e; } tryCommit(); return result; }
[ "private", "Object", "executeCommandWithInjectedTx", "(", "InvocationContext", "ctx", ",", "VisitableCommand", "command", ")", "{", "final", "Object", "result", ";", "try", "{", "result", "=", "invoker", ".", "invoke", "(", "ctx", ",", "command", ")", ";", "}"...
Executes the {@link VisitableCommand} with an injected transaction.
[ "Executes", "the", "{" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/cache/impl/CacheImpl.java#L1937-L1947
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/Expression.java
Expression.eliminateDuplicates
public Expression eliminateDuplicates(final Session session) { // First build the map of child expressions joined by the logical AND // The key is the expression id and the value is the expression itself Map<String, Expression> subExprMap = new HashMap<>(); extractAndSubExpressions(session, this, subExprMap); // Reconstruct the expression if (!subExprMap.isEmpty()) { Iterator<Map.Entry<String, Expression>> itExpr = subExprMap.entrySet().iterator(); Expression finalExpr = itExpr.next().getValue(); while (itExpr.hasNext()) { finalExpr = new ExpressionLogical(OpTypes.AND, finalExpr, itExpr.next().getValue()); } return finalExpr; } return this; }
java
public Expression eliminateDuplicates(final Session session) { // First build the map of child expressions joined by the logical AND // The key is the expression id and the value is the expression itself Map<String, Expression> subExprMap = new HashMap<>(); extractAndSubExpressions(session, this, subExprMap); // Reconstruct the expression if (!subExprMap.isEmpty()) { Iterator<Map.Entry<String, Expression>> itExpr = subExprMap.entrySet().iterator(); Expression finalExpr = itExpr.next().getValue(); while (itExpr.hasNext()) { finalExpr = new ExpressionLogical(OpTypes.AND, finalExpr, itExpr.next().getValue()); } return finalExpr; } return this; }
[ "public", "Expression", "eliminateDuplicates", "(", "final", "Session", "session", ")", "{", "// First build the map of child expressions joined by the logical AND", "// The key is the expression id and the value is the expression itself", "Map", "<", "String", ",", "Expression", ">"...
VoltDB added method to simplify an expression by eliminating identical subexpressions (same id) The original expression must be a logical conjunction of form e1 AND e2 AND e3 AND e4. If subexpression e1 is identical to the subexpression e2 the simplified expression would be e1 AND e3 AND e4. @param session The current Session object may be needed to resolve some names. @return simplified expression.
[ "VoltDB", "added", "method", "to", "simplify", "an", "expression", "by", "eliminating", "identical", "subexpressions", "(", "same", "id", ")", "The", "original", "expression", "must", "be", "a", "logical", "conjunction", "of", "form", "e1", "AND", "e2", "AND",...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Expression.java#L1938-L1953
kiswanij/jk-util
src/main/java/com/jk/util/JKIOUtil.java
JKIOUtil.writeDataToTempFile
public static File writeDataToTempFile(final byte[] data, final String suffix) { try { File file = File.createTempFile("jk-", suffix); return writeDataToFile(data, file); } catch (IOException e) { JKExceptionUtil.handle(e); return null; } }
java
public static File writeDataToTempFile(final byte[] data, final String suffix) { try { File file = File.createTempFile("jk-", suffix); return writeDataToFile(data, file); } catch (IOException e) { JKExceptionUtil.handle(e); return null; } }
[ "public", "static", "File", "writeDataToTempFile", "(", "final", "byte", "[", "]", "data", ",", "final", "String", "suffix", ")", "{", "try", "{", "File", "file", "=", "File", ".", "createTempFile", "(", "\"jk-\"", ",", "suffix", ")", ";", "return", "wri...
Write data to temp file. @param data the data @param suffix the suffix @return the file
[ "Write", "data", "to", "temp", "file", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKIOUtil.java#L405-L413
petergeneric/stdlib
service-manager/service-manager/src/main/java/com/peterphi/servicemanager/service/rest/ui/impl/ServiceManagerResourceUIServiceImpl.java
ServiceManagerResourceUIServiceImpl.getResource
@Override @Transactional public String getResource(String id) { final TemplateCall call = templater.template("resource_template"); final ResourceTemplateEntity entity = resourceProvisionService.getOrCreateTemplate(id); if (entity == null) throw new RestException(404, "No such resource with id: " + id); call.set("entity", entity); call.set("nonce", nonceStore.getValue()); return call.process(); }
java
@Override @Transactional public String getResource(String id) { final TemplateCall call = templater.template("resource_template"); final ResourceTemplateEntity entity = resourceProvisionService.getOrCreateTemplate(id); if (entity == null) throw new RestException(404, "No such resource with id: " + id); call.set("entity", entity); call.set("nonce", nonceStore.getValue()); return call.process(); }
[ "@", "Override", "@", "Transactional", "public", "String", "getResource", "(", "String", "id", ")", "{", "final", "TemplateCall", "call", "=", "templater", ".", "template", "(", "\"resource_template\"", ")", ";", "final", "ResourceTemplateEntity", "entity", "=", ...
N.B. transaction may be read-write because this read operation may result in reading a new template (or discovering an update was made to the template) @param id @return
[ "N", ".", "B", ".", "transaction", "may", "be", "read", "-", "write", "because", "this", "read", "operation", "may", "result", "in", "reading", "a", "new", "template", "(", "or", "discovering", "an", "update", "was", "made", "to", "the", "template", ")" ...
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/service-manager/service-manager/src/main/java/com/peterphi/servicemanager/service/rest/ui/impl/ServiceManagerResourceUIServiceImpl.java#L58-L73
JodaOrg/joda-time
src/main/java/org/joda/time/Duration.java
Duration.standardMinutes
public static Duration standardMinutes(long minutes) { if (minutes == 0) { return ZERO; } return new Duration(FieldUtils.safeMultiply(minutes, DateTimeConstants.MILLIS_PER_MINUTE)); }
java
public static Duration standardMinutes(long minutes) { if (minutes == 0) { return ZERO; } return new Duration(FieldUtils.safeMultiply(minutes, DateTimeConstants.MILLIS_PER_MINUTE)); }
[ "public", "static", "Duration", "standardMinutes", "(", "long", "minutes", ")", "{", "if", "(", "minutes", "==", "0", ")", "{", "return", "ZERO", ";", "}", "return", "new", "Duration", "(", "FieldUtils", ".", "safeMultiply", "(", "minutes", ",", "DateTimeC...
Create a duration with the specified number of minutes assuming that there are the standard number of milliseconds in a minute. <p> This method assumes that there are 60 seconds in a minute and 1000 milliseconds in a second. All currently supplied chronologies use this definition. <p> A Duration is a representation of an amount of time. If you want to express the concept of 'minutes' you should consider using the {@link Minutes} class. @param minutes the number of standard minutes in this duration @return the duration, never null @throws ArithmeticException if the minutes value is too large @since 1.6
[ "Create", "a", "duration", "with", "the", "specified", "number", "of", "minutes", "assuming", "that", "there", "are", "the", "standard", "number", "of", "milliseconds", "in", "a", "minute", ".", "<p", ">", "This", "method", "assumes", "that", "there", "are",...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Duration.java#L128-L133
michael-rapp/AndroidMaterialPreferences
example/src/main/java/de/mrapp/android/preference/example/PreferenceFragment.java
PreferenceFragment.createShowValueAsSummaryListener
private Preference.OnPreferenceChangeListener createShowValueAsSummaryListener() { return new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { boolean showValueAsSummary = (Boolean) newValue; editTextPreference.showValueAsSummary(showValueAsSummary); listPreference.showValueAsSummary(showValueAsSummary); multiChoiceListPreference.showValueAsSummary(showValueAsSummary); seekBarPreference.showValueAsSummary(showValueAsSummary); numberPickerPreference.showValueAsSummary(showValueAsSummary); digitPickerPreference.showValueAsSummary(showValueAsSummary); resolutionPreference.showValueAsSummary(showValueAsSummary); colorPalettePreference.showValueAsSummary(showValueAsSummary); adaptSwitchPreferenceSummary(showValueAsSummary); return true; } }; }
java
private Preference.OnPreferenceChangeListener createShowValueAsSummaryListener() { return new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(final Preference preference, final Object newValue) { boolean showValueAsSummary = (Boolean) newValue; editTextPreference.showValueAsSummary(showValueAsSummary); listPreference.showValueAsSummary(showValueAsSummary); multiChoiceListPreference.showValueAsSummary(showValueAsSummary); seekBarPreference.showValueAsSummary(showValueAsSummary); numberPickerPreference.showValueAsSummary(showValueAsSummary); digitPickerPreference.showValueAsSummary(showValueAsSummary); resolutionPreference.showValueAsSummary(showValueAsSummary); colorPalettePreference.showValueAsSummary(showValueAsSummary); adaptSwitchPreferenceSummary(showValueAsSummary); return true; } }; }
[ "private", "Preference", ".", "OnPreferenceChangeListener", "createShowValueAsSummaryListener", "(", ")", "{", "return", "new", "Preference", ".", "OnPreferenceChangeListener", "(", ")", "{", "@", "Override", "public", "boolean", "onPreferenceChange", "(", "final", "Pre...
Creates and returns a listener, which allows to adapt, whether the preference's values should be shown as summaries, or not, when the corresponding setting has been changed. @return The listener, which has been created, as an instance of the type {@link Preference.OnPreferenceChangeListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "adapt", "whether", "the", "preference", "s", "values", "should", "be", "shown", "as", "summaries", "or", "not", "when", "the", "corresponding", "setting", "has", "been", "changed", "." ]
train
https://github.com/michael-rapp/AndroidMaterialPreferences/blob/73a7e449458313bd041fc8d6038e290506b68eb1/example/src/main/java/de/mrapp/android/preference/example/PreferenceFragment.java#L147-L166
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.subDays
public static long subDays(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.DAY); }
java
public static long subDays(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.DAY); }
[ "public", "static", "long", "subDays", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "return", "subTime", "(", "date1", ",", "date2", ",", "DatePeriod", ".", "DAY", ")", ";", "}" ]
Get how many days between two date. @param date1 date to be tested. @param date2 date to be tested. @return how many days between two date.
[ "Get", "how", "many", "days", "between", "two", "date", "." ]
train
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L462-L465
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/ValidationUtils.java
ValidationUtils.buildValueMismatchErrorMessage
public static String buildValueMismatchErrorMessage(String baseMessage, Object controlValue, Object actualValue) { return baseMessage + ", expected '" + controlValue + "' but was '" + actualValue + "'"; }
java
public static String buildValueMismatchErrorMessage(String baseMessage, Object controlValue, Object actualValue) { return baseMessage + ", expected '" + controlValue + "' but was '" + actualValue + "'"; }
[ "public", "static", "String", "buildValueMismatchErrorMessage", "(", "String", "baseMessage", ",", "Object", "controlValue", ",", "Object", "actualValue", ")", "{", "return", "baseMessage", "+", "\", expected '\"", "+", "controlValue", "+", "\"' but was '\"", "+", "ac...
Constructs proper error message with expected value and actual value. @param baseMessage the base error message. @param controlValue the expected value. @param actualValue the actual value. @return
[ "Constructs", "proper", "error", "message", "with", "expected", "value", "and", "actual", "value", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/ValidationUtils.java#L155-L157
pac4j/pac4j
pac4j-http/src/main/java/org/pac4j/http/credentials/DigestCredentials.java
DigestCredentials.calculateServerDigest
public String calculateServerDigest(boolean passwordAlreadyEncoded, String password) { return generateDigest(passwordAlreadyEncoded, username, realm, password, httpMethod, uri, qop, nonce, nc, cnonce); }
java
public String calculateServerDigest(boolean passwordAlreadyEncoded, String password) { return generateDigest(passwordAlreadyEncoded, username, realm, password, httpMethod, uri, qop, nonce, nc, cnonce); }
[ "public", "String", "calculateServerDigest", "(", "boolean", "passwordAlreadyEncoded", ",", "String", "password", ")", "{", "return", "generateDigest", "(", "passwordAlreadyEncoded", ",", "username", ",", "realm", ",", "password", ",", "httpMethod", ",", "uri", ",",...
This calculates the server digest value based on user stored password. If the server stores password in clear format then passwordAlreadyEncoded should be false. If the server stores the password in ha1, digest then the passwordAlreadyEncoded should be true. @param passwordAlreadyEncoded false if the server stored password is in clear, true otherwise @param password user password stored server-side @return digest value. This value must match the client "response" value in the Authorization http header for a successful digest authentication
[ "This", "calculates", "the", "server", "digest", "value", "based", "on", "user", "stored", "password", ".", "If", "the", "server", "stores", "password", "in", "clear", "format", "then", "passwordAlreadyEncoded", "should", "be", "false", ".", "If", "the", "serv...
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-http/src/main/java/org/pac4j/http/credentials/DigestCredentials.java#L68-L71
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java
RegistriesInner.beginUpdatePolicies
public RegistryPoliciesInner beginUpdatePolicies(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { return beginUpdatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).toBlocking().single().body(); }
java
public RegistryPoliciesInner beginUpdatePolicies(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { return beginUpdatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).toBlocking().single().body(); }
[ "public", "RegistryPoliciesInner", "beginUpdatePolicies", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "RegistryPoliciesInner", "registryPoliciesUpdateParameters", ")", "{", "return", "beginUpdatePoliciesWithServiceResponseAsync", "(", "resourceGroupName"...
Updates the policies for the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. @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 RegistryPoliciesInner object if successful.
[ "Updates", "the", "policies", "for", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L1655-L1657
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java
X509CertSelector.equalNames
static boolean equalNames(Collection<?> object1, Collection<?> object2) { if ((object1 == null) || (object2 == null)) { return object1 == object2; } return object1.equals(object2); }
java
static boolean equalNames(Collection<?> object1, Collection<?> object2) { if ((object1 == null) || (object2 == null)) { return object1 == object2; } return object1.equals(object2); }
[ "static", "boolean", "equalNames", "(", "Collection", "<", "?", ">", "object1", ",", "Collection", "<", "?", ">", "object2", ")", "{", "if", "(", "(", "object1", "==", "null", ")", "||", "(", "object2", "==", "null", ")", ")", "{", "return", "object1...
Compare for equality two objects of the form passed to setSubjectAlternativeNames (or X509CRLSelector.setIssuerNames). Throw an {@code IllegalArgumentException} or a {@code ClassCastException} if one of the objects is malformed. @param object1 a Collection containing the first object to compare @param object2 a Collection containing the second object to compare @return true if the objects are equal, false otherwise
[ "Compare", "for", "equality", "two", "objects", "of", "the", "form", "passed", "to", "setSubjectAlternativeNames", "(", "or", "X509CRLSelector", ".", "setIssuerNames", ")", ".", "Throw", "an", "{", "@code", "IllegalArgumentException", "}", "or", "a", "{", "@code...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java#L876-L881
samskivert/pythagoras
src/main/java/pythagoras/d/Arc.java
Arc.setArc
public void setArc (XY point, IDimension size, double start, double extent, int type) { setArc(point.x(), point.y(), size.width(), size.height(), start, extent, type); }
java
public void setArc (XY point, IDimension size, double start, double extent, int type) { setArc(point.x(), point.y(), size.width(), size.height(), start, extent, type); }
[ "public", "void", "setArc", "(", "XY", "point", ",", "IDimension", "size", ",", "double", "start", ",", "double", "extent", ",", "int", "type", ")", "{", "setArc", "(", "point", ".", "x", "(", ")", ",", "point", ".", "y", "(", ")", ",", "size", "...
Sets the location, size, angular extents, and closure type of this arc to the specified values.
[ "Sets", "the", "location", "size", "angular", "extents", "and", "closure", "type", "of", "this", "arc", "to", "the", "specified", "values", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Arc.java#L143-L145
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/NotificationManager.java
NotificationManager.removeClientNotification
public void removeClientNotification(RESTRequest request, ObjectName objectName, int clientID) { //Get the client area ClientNotificationArea clientArea = getInboxIfAvailable(clientID, null); //Remove the corresponding listener (will also remove from MBeanServer) clientArea.removeClientNotificationListener(request, objectName); }
java
public void removeClientNotification(RESTRequest request, ObjectName objectName, int clientID) { //Get the client area ClientNotificationArea clientArea = getInboxIfAvailable(clientID, null); //Remove the corresponding listener (will also remove from MBeanServer) clientArea.removeClientNotificationListener(request, objectName); }
[ "public", "void", "removeClientNotification", "(", "RESTRequest", "request", ",", "ObjectName", "objectName", ",", "int", "clientID", ")", "{", "//Get the client area ", "ClientNotificationArea", "clientArea", "=", "getInboxIfAvailable", "(", "clientID", ",", "null", ")...
Removes a corresponding client notification for the given ObjectName
[ "Removes", "a", "corresponding", "client", "notification", "for", "the", "given", "ObjectName" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/NotificationManager.java#L158-L164
Samsung/GearVRf
GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRSphericalEmitter.java
GVRSphericalEmitter.generateParticleVelocities
private float[] generateParticleVelocities() { float [] particleVelocities = new float[mEmitRate * 3]; Vector3f temp = new Vector3f(0,0,0); for ( int i = 0; i < mEmitRate * 3 ; i +=3 ) { temp.x = mParticlePositions[i]; temp.y = mParticlePositions[i+1]; temp.z = mParticlePositions[i+2]; float velx = mRandom.nextFloat() * (maxVelocity.x- minVelocity.x) + minVelocity.x; float vely = mRandom.nextFloat() * (maxVelocity.y - minVelocity.y) + minVelocity.y; float velz = mRandom.nextFloat() * (maxVelocity.z - minVelocity.z) + minVelocity.z; temp = temp.normalize(); temp.mul(velx, vely, velz, temp); particleVelocities[i] = temp.x; particleVelocities[i+1] = temp.y; particleVelocities[i+2] = temp.z; } return particleVelocities; }
java
private float[] generateParticleVelocities() { float [] particleVelocities = new float[mEmitRate * 3]; Vector3f temp = new Vector3f(0,0,0); for ( int i = 0; i < mEmitRate * 3 ; i +=3 ) { temp.x = mParticlePositions[i]; temp.y = mParticlePositions[i+1]; temp.z = mParticlePositions[i+2]; float velx = mRandom.nextFloat() * (maxVelocity.x- minVelocity.x) + minVelocity.x; float vely = mRandom.nextFloat() * (maxVelocity.y - minVelocity.y) + minVelocity.y; float velz = mRandom.nextFloat() * (maxVelocity.z - minVelocity.z) + minVelocity.z; temp = temp.normalize(); temp.mul(velx, vely, velz, temp); particleVelocities[i] = temp.x; particleVelocities[i+1] = temp.y; particleVelocities[i+2] = temp.z; } return particleVelocities; }
[ "private", "float", "[", "]", "generateParticleVelocities", "(", ")", "{", "float", "[", "]", "particleVelocities", "=", "new", "float", "[", "mEmitRate", "*", "3", "]", ";", "Vector3f", "temp", "=", "new", "Vector3f", "(", "0", ",", "0", ",", "0", ")"...
Generate random velocities for every particle. The direction is obtained by assuming the position of a particle as a vector. This normalised vector is scaled by the speed range. @return
[ "Generate", "random", "velocities", "for", "every", "particle", ".", "The", "direction", "is", "obtained", "by", "assuming", "the", "position", "of", "a", "particle", "as", "a", "vector", ".", "This", "normalised", "vector", "is", "scaled", "by", "the", "spe...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRSphericalEmitter.java#L113-L142
jayantk/jklol
src/com/jayantkrish/jklol/ccg/lexinduct/CfgAlignmentModel.java
CfgAlignmentModel.getRootFactor
public Factor getRootFactor(ExpressionTree tree, VariableNumMap expressionVar) { List<Assignment> roots = Lists.newArrayList(); if (tree.getSubstitutions().size() == 0) { roots.add(expressionVar.outcomeArrayToAssignment(tree.getExpressionNode())); } else { for (ExpressionTree substitution : tree.getSubstitutions()) { roots.add(expressionVar.outcomeArrayToAssignment(substitution.getExpressionNode())); } } return TableFactor.pointDistribution(expressionVar, roots.toArray(new Assignment[0])); }
java
public Factor getRootFactor(ExpressionTree tree, VariableNumMap expressionVar) { List<Assignment> roots = Lists.newArrayList(); if (tree.getSubstitutions().size() == 0) { roots.add(expressionVar.outcomeArrayToAssignment(tree.getExpressionNode())); } else { for (ExpressionTree substitution : tree.getSubstitutions()) { roots.add(expressionVar.outcomeArrayToAssignment(substitution.getExpressionNode())); } } return TableFactor.pointDistribution(expressionVar, roots.toArray(new Assignment[0])); }
[ "public", "Factor", "getRootFactor", "(", "ExpressionTree", "tree", ",", "VariableNumMap", "expressionVar", ")", "{", "List", "<", "Assignment", ">", "roots", "=", "Lists", ".", "newArrayList", "(", ")", ";", "if", "(", "tree", ".", "getSubstitutions", "(", ...
This method is a hack that enables the use of the "substitutions" field of ExpressionTree at the root of the CFG parse. In the future, these substitutions should be handled using unary rules in the CFG parser.
[ "This", "method", "is", "a", "hack", "that", "enables", "the", "use", "of", "the", "substitutions", "field", "of", "ExpressionTree", "at", "the", "root", "of", "the", "CFG", "parse", ".", "In", "the", "future", "these", "substitutions", "should", "be", "ha...
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/lexinduct/CfgAlignmentModel.java#L327-L338
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/config/Configuration.java
Configuration.setDefaultStyle
public final void setDefaultStyle(final Map<String, Style> defaultStyle) { this.defaultStyle = new HashMap<>(defaultStyle.size()); for (Map.Entry<String, Style> entry: defaultStyle.entrySet()) { String normalizedName = GEOMETRY_NAME_ALIASES.get(entry.getKey().toLowerCase()); if (normalizedName == null) { normalizedName = entry.getKey().toLowerCase(); } this.defaultStyle.put(normalizedName, entry.getValue()); } }
java
public final void setDefaultStyle(final Map<String, Style> defaultStyle) { this.defaultStyle = new HashMap<>(defaultStyle.size()); for (Map.Entry<String, Style> entry: defaultStyle.entrySet()) { String normalizedName = GEOMETRY_NAME_ALIASES.get(entry.getKey().toLowerCase()); if (normalizedName == null) { normalizedName = entry.getKey().toLowerCase(); } this.defaultStyle.put(normalizedName, entry.getValue()); } }
[ "public", "final", "void", "setDefaultStyle", "(", "final", "Map", "<", "String", ",", "Style", ">", "defaultStyle", ")", "{", "this", ".", "defaultStyle", "=", "new", "HashMap", "<>", "(", "defaultStyle", ".", "size", "(", ")", ")", ";", "for", "(", "...
Set the default styles. the case of the keys are not important. The retrieval will be case insensitive. @param defaultStyle the mapping from geometry type name (point, polygon, etc...) to the style to use for that type.
[ "Set", "the", "default", "styles", ".", "the", "case", "of", "the", "keys", "are", "not", "important", ".", "The", "retrieval", "will", "be", "case", "insensitive", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/config/Configuration.java#L446-L457
nohana/Amalgam
amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java
BitmapUtils.storeOnCacheDir
public static File storeOnCacheDir(Context context, Bitmap bitmap, String path, String filename, Bitmap.CompressFormat format, int quality) { File dir = new File(context.getCacheDir(), path); FileUtils.makeDirsIfNeeded(dir); File file = new File(dir, filename); if (!storeAsFile(bitmap, file, format, quality)) { return null; } return file; }
java
public static File storeOnCacheDir(Context context, Bitmap bitmap, String path, String filename, Bitmap.CompressFormat format, int quality) { File dir = new File(context.getCacheDir(), path); FileUtils.makeDirsIfNeeded(dir); File file = new File(dir, filename); if (!storeAsFile(bitmap, file, format, quality)) { return null; } return file; }
[ "public", "static", "File", "storeOnCacheDir", "(", "Context", "context", ",", "Bitmap", "bitmap", ",", "String", "path", ",", "String", "filename", ",", "Bitmap", ".", "CompressFormat", "format", ",", "int", "quality", ")", "{", "File", "dir", "=", "new", ...
Store the bitmap on the cache directory path. @param context the context. @param bitmap to store. @param path file path. @param filename file name. @param format bitmap format. @param quality the quality of the compressed bitmap. @return the compressed bitmap file.
[ "Store", "the", "bitmap", "on", "the", "cache", "directory", "path", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L250-L258
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java
Collections.binarySearch
public static <T> int binarySearch(List<? extends Comparable<? super T>> list, T key) { if (list instanceof RandomAccess || list.size()<BINARYSEARCH_THRESHOLD) return Collections.indexedBinarySearch(list, key); else return Collections.iteratorBinarySearch(list, key); }
java
public static <T> int binarySearch(List<? extends Comparable<? super T>> list, T key) { if (list instanceof RandomAccess || list.size()<BINARYSEARCH_THRESHOLD) return Collections.indexedBinarySearch(list, key); else return Collections.iteratorBinarySearch(list, key); }
[ "public", "static", "<", "T", ">", "int", "binarySearch", "(", "List", "<", "?", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "list", ",", "T", "key", ")", "{", "if", "(", "list", "instanceof", "RandomAccess", "||", "list", ".", "size",...
Searches the specified list for the specified object using the binary search algorithm. The list must be sorted into ascending order according to the {@linkplain Comparable natural ordering} of its elements (as by the {@link #sort(List)} method) prior to making this call. If it is not sorted, the results are undefined. If the list contains multiple elements equal to the specified object, there is no guarantee which one will be found. <p>This method runs in log(n) time for a "random access" list (which provides near-constant-time positional access). If the specified list does not implement the {@link RandomAccess} interface and is large, this method will do an iterator-based binary search that performs O(n) link traversals and O(log n) element comparisons. @param <T> the class of the objects in the list @param list the list to be searched. @param key the key to be searched for. @return the index of the search key, if it is contained in the list; otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>. The <i>insertion point</i> is defined as the point at which the key would be inserted into the list: the index of the first element greater than the key, or <tt>list.size()</tt> if all elements in the list are less than the specified key. Note that this guarantees that the return value will be &gt;= 0 if and only if the key is found. @throws ClassCastException if the list contains elements that are not <i>mutually comparable</i> (for example, strings and integers), or the search key is not mutually comparable with the elements of the list.
[ "Searches", "the", "specified", "list", "for", "the", "specified", "object", "using", "the", "binary", "search", "algorithm", ".", "The", "list", "must", "be", "sorted", "into", "ascending", "order", "according", "to", "the", "{", "@linkplain", "Comparable", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java#L242-L248
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnonymousIndividualImpl_CustomFieldSerializer.java
OWLAnonymousIndividualImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLAnonymousIndividualImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLAnonymousIndividualImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLAnonymousIndividualImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnonymousIndividualImpl_CustomFieldSerializer.java#L83-L86
MenoData/Time4J
base/src/main/java/net/time4j/range/MomentInterval.java
MomentInterval.until
public static MomentInterval until(Moment end) { Boundary<Moment> past = Boundary.infinitePast(); return new MomentInterval(past, Boundary.of(OPEN, end)); }
java
public static MomentInterval until(Moment end) { Boundary<Moment> past = Boundary.infinitePast(); return new MomentInterval(past, Boundary.of(OPEN, end)); }
[ "public", "static", "MomentInterval", "until", "(", "Moment", "end", ")", "{", "Boundary", "<", "Moment", ">", "past", "=", "Boundary", ".", "infinitePast", "(", ")", ";", "return", "new", "MomentInterval", "(", "past", ",", "Boundary", ".", "of", "(", "...
/*[deutsch] <p>Erzeugt ein unbegrenztes offenes Intervall bis zum angegebenen Endzeitpunkt. </p> @param end moment of upper boundary (exclusive) @return new moment interval @since 2.0
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Erzeugt", "ein", "unbegrenztes", "offenes", "Intervall", "bis", "zum", "angegebenen", "Endzeitpunkt", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/MomentInterval.java#L310-L315
samskivert/samskivert
src/main/java/com/samskivert/swing/util/ButtonUtil.java
ButtonUtil.bindToProperty
public static void bindToProperty ( String property, PrefsConfig config, AbstractButton button, boolean defval) { // create a config binding which will take care of everything new ButtonConfigBinding(property, config, button, defval); }
java
public static void bindToProperty ( String property, PrefsConfig config, AbstractButton button, boolean defval) { // create a config binding which will take care of everything new ButtonConfigBinding(property, config, button, defval); }
[ "public", "static", "void", "bindToProperty", "(", "String", "property", ",", "PrefsConfig", "config", ",", "AbstractButton", "button", ",", "boolean", "defval", ")", "{", "// create a config binding which will take care of everything", "new", "ButtonConfigBinding", "(", ...
Binds the supplied button to the named boolean property in the supplied config repository. When the button is pressed, it will update the config property and when the config property is changed (by the button or by other means) it will update the selected state of the button. When the button is made non-visible, it will be unbound to the config's property and rebound again if it is once again visible.
[ "Binds", "the", "supplied", "button", "to", "the", "named", "boolean", "property", "in", "the", "supplied", "config", "repository", ".", "When", "the", "button", "is", "pressed", "it", "will", "update", "the", "config", "property", "and", "when", "the", "con...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/ButtonUtil.java#L55-L60
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
HttpContext.executePatchRequest
protected <T> Optional<T> executePatchRequest(URI uri, Object obj, Map<String, Object> headers, List<String> queryParams, GenericType<T> returnType) { WebTarget target = this.client.target(uri); target = applyQueryParams(target, queryParams); Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON); applyHeaders(invocation, headers); if(obj == null) obj = Entity.text(""); Response response = invocation.method("PATCH", Entity.entity(obj, MediaType.APPLICATION_JSON)); handleResponseError("PATCH", uri, response); logResponse(uri, response); return extractEntityFromResponse(response, returnType); }
java
protected <T> Optional<T> executePatchRequest(URI uri, Object obj, Map<String, Object> headers, List<String> queryParams, GenericType<T> returnType) { WebTarget target = this.client.target(uri); target = applyQueryParams(target, queryParams); Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON); applyHeaders(invocation, headers); if(obj == null) obj = Entity.text(""); Response response = invocation.method("PATCH", Entity.entity(obj, MediaType.APPLICATION_JSON)); handleResponseError("PATCH", uri, response); logResponse(uri, response); return extractEntityFromResponse(response, returnType); }
[ "protected", "<", "T", ">", "Optional", "<", "T", ">", "executePatchRequest", "(", "URI", "uri", ",", "Object", "obj", ",", "Map", "<", "String", ",", "Object", ">", "headers", ",", "List", "<", "String", ">", "queryParams", ",", "GenericType", "<", "T...
Execute a PATCH request with a return object. @param <T> The type parameter used for the return object @param uri The URI to call @param obj The object to use for the PATCH @param headers A set of headers to add to the request @param queryParams A set of query parameters to add to the request @param returnType The type to marshall the result back into @return The return type
[ "Execute", "a", "PATCH", "request", "with", "a", "return", "object", "." ]
train
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L512-L525
alibaba/otter
shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/ObjectProfiler.java
ObjectProfiler.sizeof
public static long sizeof(final Object obj) { if (null == obj || isSharedFlyweight(obj)) { return 0; } final IdentityHashMap visited = new IdentityHashMap(80000); try { return computeSizeof(obj, visited, CLASS_METADATA_CACHE); } catch (RuntimeException re) { // re.printStackTrace();//DEBUG return -1; } catch (NoClassDefFoundError ncdfe) { // BUG: throws "java.lang.NoClassDefFoundError: org.eclipse.core.resources.IWorkspaceRoot" when run in WSAD // 5 // see // http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=958763&Number=15235&page=0&view=collapsed&sb=5&o= // System.err.println(ncdfe);//DEBUG return -1; } }
java
public static long sizeof(final Object obj) { if (null == obj || isSharedFlyweight(obj)) { return 0; } final IdentityHashMap visited = new IdentityHashMap(80000); try { return computeSizeof(obj, visited, CLASS_METADATA_CACHE); } catch (RuntimeException re) { // re.printStackTrace();//DEBUG return -1; } catch (NoClassDefFoundError ncdfe) { // BUG: throws "java.lang.NoClassDefFoundError: org.eclipse.core.resources.IWorkspaceRoot" when run in WSAD // 5 // see // http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=958763&Number=15235&page=0&view=collapsed&sb=5&o= // System.err.println(ncdfe);//DEBUG return -1; } }
[ "public", "static", "long", "sizeof", "(", "final", "Object", "obj", ")", "{", "if", "(", "null", "==", "obj", "||", "isSharedFlyweight", "(", "obj", ")", ")", "{", "return", "0", ";", "}", "final", "IdentityHashMap", "visited", "=", "new", "IdentityHash...
Estimates the full size of the object graph rooted at 'obj'. Duplicate data instances are correctly accounted for. The implementation is not recursive. @param obj input object instance to be measured @return 'obj' size [0 if 'obj' is null']
[ "Estimates", "the", "full", "size", "of", "the", "object", "graph", "rooted", "at", "obj", ".", "Duplicate", "data", "instances", "are", "correctly", "accounted", "for", ".", "The", "implementation", "is", "not", "recursive", "." ]
train
https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/ObjectProfiler.java#L85-L105
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java
PathNormalizer.determineRelativePath
private static String determineRelativePath(String filename, String separator) { if (filename.length() == 0) { return ""; } /* * Count the slashes in the relative filename, but exclude the leading * slash. If the path has no slashes, then the filename is relative to * the current directory. */ int slashCount = StringUtils.countMatches(filename, separator) - 1; if (slashCount <= 0) { return "."; } /* * The relative filename contains one or more slashes indicating that * the file is within one or more directories. Thus, each slash * represents a "../" in the relative path. */ StringBuilder sb = new StringBuilder(); for (int i = 0; i < slashCount; i++) { sb.append("../"); } /* * Finally, return the relative path but strip the trailing slash to * mimic Anakia's behavior. */ return StringUtils.chop(sb.toString()); }
java
private static String determineRelativePath(String filename, String separator) { if (filename.length() == 0) { return ""; } /* * Count the slashes in the relative filename, but exclude the leading * slash. If the path has no slashes, then the filename is relative to * the current directory. */ int slashCount = StringUtils.countMatches(filename, separator) - 1; if (slashCount <= 0) { return "."; } /* * The relative filename contains one or more slashes indicating that * the file is within one or more directories. Thus, each slash * represents a "../" in the relative path. */ StringBuilder sb = new StringBuilder(); for (int i = 0; i < slashCount; i++) { sb.append("../"); } /* * Finally, return the relative path but strip the trailing slash to * mimic Anakia's behavior. */ return StringUtils.chop(sb.toString()); }
[ "private", "static", "String", "determineRelativePath", "(", "String", "filename", ",", "String", "separator", ")", "{", "if", "(", "filename", ".", "length", "(", ")", "==", "0", ")", "{", "return", "\"\"", ";", "}", "/*\n\t\t * Count the slashes in the relativ...
Determines the relative path of a filename. For each separator within the filename (except the leading if present), append the "../" string to the return value. @param filename The filename to parse. @param separator The separator used within the filename. @return The relative path of the filename. This value is not terminated with a forward slash. A zero-length string is returned if: the filename is zero-length.
[ "Determines", "the", "relative", "path", "of", "a", "filename", ".", "For", "each", "separator", "within", "the", "filename", "(", "except", "the", "leading", "if", "present", ")", "append", "the", "..", "/", "string", "to", "the", "return", "value", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java#L866-L896
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsDefaultPageEditor.java
CmsDefaultPageEditor.actionPreview
public void actionPreview() throws IOException, JspException { try { // save content of the editor to the temporary file performSaveContent(getParamElementname(), getElementLocale()); } catch (CmsException e) { // show error page showErrorPage(this, e); } // redirect to the temporary file with current active element language String param = "?" + org.opencms.i18n.CmsLocaleManager.PARAMETER_LOCALE + "=" + getParamElementlanguage(); sendCmsRedirect(getParamTempfile() + param); }
java
public void actionPreview() throws IOException, JspException { try { // save content of the editor to the temporary file performSaveContent(getParamElementname(), getElementLocale()); } catch (CmsException e) { // show error page showErrorPage(this, e); } // redirect to the temporary file with current active element language String param = "?" + org.opencms.i18n.CmsLocaleManager.PARAMETER_LOCALE + "=" + getParamElementlanguage(); sendCmsRedirect(getParamTempfile() + param); }
[ "public", "void", "actionPreview", "(", ")", "throws", "IOException", ",", "JspException", "{", "try", "{", "// save content of the editor to the temporary file", "performSaveContent", "(", "getParamElementname", "(", ")", ",", "getElementLocale", "(", ")", ")", ";", ...
Performs the preview page action in a new browser window.<p> @throws IOException if redirect fails @throws JspException if inclusion of error page fails
[ "Performs", "the", "preview", "page", "action", "in", "a", "new", "browser", "window", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsDefaultPageEditor.java#L273-L286
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/Config.java
Config.getURIString
private static String getURIString(Properties props, String key, String def) { try { URI uri = new URI(props.getProperty(key, def)); return new File(uri).getAbsolutePath(); } catch (Exception ex) { return getString(props, key, def); } }
java
private static String getURIString(Properties props, String key, String def) { try { URI uri = new URI(props.getProperty(key, def)); return new File(uri).getAbsolutePath(); } catch (Exception ex) { return getString(props, key, def); } }
[ "private", "static", "String", "getURIString", "(", "Properties", "props", ",", "String", "key", ",", "String", "def", ")", "{", "try", "{", "URI", "uri", "=", "new", "URI", "(", "props", ".", "getProperty", "(", "key", ",", "def", ")", ")", ";", "re...
This method is used to load path to .ekstazi when the path is given as URI string. We need to use URI to make sure that we support paths (given to javaagent) even if they contain spaces.
[ "This", "method", "is", "used", "to", "load", "path", "to", ".", "ekstazi", "when", "the", "path", "is", "given", "as", "URI", "string", ".", "We", "need", "to", "use", "URI", "to", "make", "sure", "that", "we", "support", "paths", "(", "given", "to"...
train
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/Config.java#L419-L426
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_instance_instanceId_PUT
public void project_serviceName_instance_instanceId_PUT(String serviceName, String instanceId, String instanceName) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/{instanceId}"; StringBuilder sb = path(qPath, serviceName, instanceId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "instanceName", instanceName); exec(qPath, "PUT", sb.toString(), o); }
java
public void project_serviceName_instance_instanceId_PUT(String serviceName, String instanceId, String instanceName) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/{instanceId}"; StringBuilder sb = path(qPath, serviceName, instanceId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "instanceName", instanceName); exec(qPath, "PUT", sb.toString(), o); }
[ "public", "void", "project_serviceName_instance_instanceId_PUT", "(", "String", "serviceName", ",", "String", "instanceId", ",", "String", "instanceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/instance/{instanceId}\"", ";",...
Alter an instance REST: PUT /cloud/project/{serviceName}/instance/{instanceId} @param instanceId [required] Instance id @param instanceName [required] Instance new name @param serviceName [required] Service name
[ "Alter", "an", "instance" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1863-L1869
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/metadata/statistics/StatMgr.java
StatMgr.getTableStatInfo
public synchronized TableStatInfo getTableStatInfo(TableInfo ti, Transaction tx) { if (isRefreshStatOn) { Integer c = updateCounts.get(ti.tableName()); if (c != null && c > REFRESH_THRESHOLD) VanillaDb.taskMgr().runTask( new StatisticsRefreshTask(tx, ti.tableName())); } TableStatInfo tsi = tableStats.get(ti.tableName()); if (tsi == null) { tsi = calcTableStats(ti, tx); tableStats.put(ti.tableName(), tsi); } return tsi; }
java
public synchronized TableStatInfo getTableStatInfo(TableInfo ti, Transaction tx) { if (isRefreshStatOn) { Integer c = updateCounts.get(ti.tableName()); if (c != null && c > REFRESH_THRESHOLD) VanillaDb.taskMgr().runTask( new StatisticsRefreshTask(tx, ti.tableName())); } TableStatInfo tsi = tableStats.get(ti.tableName()); if (tsi == null) { tsi = calcTableStats(ti, tx); tableStats.put(ti.tableName(), tsi); } return tsi; }
[ "public", "synchronized", "TableStatInfo", "getTableStatInfo", "(", "TableInfo", "ti", ",", "Transaction", "tx", ")", "{", "if", "(", "isRefreshStatOn", ")", "{", "Integer", "c", "=", "updateCounts", ".", "get", "(", "ti", ".", "tableName", "(", ")", ")", ...
Returns the statistical information about the specified table. @param ti the table's metadata @param tx the calling transaction @return the statistical information about the table
[ "Returns", "the", "statistical", "information", "about", "the", "specified", "table", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/statistics/StatMgr.java#L79-L94
tommyettinger/RegExodus
src/main/java/regexodus/ds/CharArrayList.java
CharArrayList.getElements
private void getElements(final int from, final char[] a, final int offset, final int length) { CharArrays.ensureOffsetLength(a, offset, length); System.arraycopy(this.a, from, a, offset, length); }
java
private void getElements(final int from, final char[] a, final int offset, final int length) { CharArrays.ensureOffsetLength(a, offset, length); System.arraycopy(this.a, from, a, offset, length); }
[ "private", "void", "getElements", "(", "final", "int", "from", ",", "final", "char", "[", "]", "a", ",", "final", "int", "offset", ",", "final", "int", "length", ")", "{", "CharArrays", ".", "ensureOffsetLength", "(", "a", ",", "offset", ",", "length", ...
Copies element of this type-specific list into the given array using optimized system calls. @param from the start index (inclusive). @param a the destination array. @param offset the offset into the destination array where to store the first element copied. @param length the number of elements to be copied.
[ "Copies", "element", "of", "this", "type", "-", "specific", "list", "into", "the", "given", "array", "using", "optimized", "system", "calls", "." ]
train
https://github.com/tommyettinger/RegExodus/blob/d4af9bb7c132c5f9d29f45b76121f93b2f89de16/src/main/java/regexodus/ds/CharArrayList.java#L469-L472
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/Citrus.java
Citrus.beforeSuite
public void beforeSuite(String suiteName, String ... testGroups) { testSuiteListener.onStart(); if (!CollectionUtils.isEmpty(beforeSuite)) { for (SequenceBeforeSuite sequenceBeforeSuite : beforeSuite) { try { if (sequenceBeforeSuite.shouldExecute(suiteName, testGroups)) { sequenceBeforeSuite.execute(createTestContext()); } } catch (Exception e) { testSuiteListener.onStartFailure(e); afterSuite(suiteName, testGroups); throw new AssertionError("Before suite failed with errors", e); } } testSuiteListener.onStartSuccess(); } else { testSuiteListener.onStartSuccess(); } }
java
public void beforeSuite(String suiteName, String ... testGroups) { testSuiteListener.onStart(); if (!CollectionUtils.isEmpty(beforeSuite)) { for (SequenceBeforeSuite sequenceBeforeSuite : beforeSuite) { try { if (sequenceBeforeSuite.shouldExecute(suiteName, testGroups)) { sequenceBeforeSuite.execute(createTestContext()); } } catch (Exception e) { testSuiteListener.onStartFailure(e); afterSuite(suiteName, testGroups); throw new AssertionError("Before suite failed with errors", e); } } testSuiteListener.onStartSuccess(); } else { testSuiteListener.onStartSuccess(); } }
[ "public", "void", "beforeSuite", "(", "String", "suiteName", ",", "String", "...", "testGroups", ")", "{", "testSuiteListener", ".", "onStart", "(", ")", ";", "if", "(", "!", "CollectionUtils", ".", "isEmpty", "(", "beforeSuite", ")", ")", "{", "for", "(",...
Performs before suite test actions. @param suiteName @param testGroups
[ "Performs", "before", "suite", "test", "actions", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/Citrus.java#L325-L346
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/result/Result.java
Result.newUpdateResultRequest
public static Result newUpdateResultRequest(Type[] types, long id) { Result result = newResult(ResultConstants.UPDATE_RESULT); result.metaData = ResultMetaData.newUpdateResultMetaData(types); result.id = id; result.navigator.add(new Object[]{}); return result; }
java
public static Result newUpdateResultRequest(Type[] types, long id) { Result result = newResult(ResultConstants.UPDATE_RESULT); result.metaData = ResultMetaData.newUpdateResultMetaData(types); result.id = id; result.navigator.add(new Object[]{}); return result; }
[ "public", "static", "Result", "newUpdateResultRequest", "(", "Type", "[", "]", "types", ",", "long", "id", ")", "{", "Result", "result", "=", "newResult", "(", "ResultConstants", ".", "UPDATE_RESULT", ")", ";", "result", ".", "metaData", "=", "ResultMetaData",...
For UPDATE_RESULT The parameters are set afterwards as the Result is reused
[ "For", "UPDATE_RESULT", "The", "parameters", "are", "set", "afterwards", "as", "the", "Result", "is", "reused" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/result/Result.java#L650-L660
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/TagsInner.java
TagsInner.createOrUpdateValueAsync
public Observable<TagValueInner> createOrUpdateValueAsync(String tagName, String tagValue) { return createOrUpdateValueWithServiceResponseAsync(tagName, tagValue).map(new Func1<ServiceResponse<TagValueInner>, TagValueInner>() { @Override public TagValueInner call(ServiceResponse<TagValueInner> response) { return response.body(); } }); }
java
public Observable<TagValueInner> createOrUpdateValueAsync(String tagName, String tagValue) { return createOrUpdateValueWithServiceResponseAsync(tagName, tagValue).map(new Func1<ServiceResponse<TagValueInner>, TagValueInner>() { @Override public TagValueInner call(ServiceResponse<TagValueInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TagValueInner", ">", "createOrUpdateValueAsync", "(", "String", "tagName", ",", "String", "tagValue", ")", "{", "return", "createOrUpdateValueWithServiceResponseAsync", "(", "tagName", ",", "tagValue", ")", ".", "map", "(", "new", "Func...
Creates a tag value. The name of the tag must already exist. @param tagName The name of the tag. @param tagValue The value of the tag to create. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TagValueInner object
[ "Creates", "a", "tag", "value", ".", "The", "name", "of", "the", "tag", "must", "already", "exist", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/TagsInner.java#L209-L216
encoway/edu
edu/src/main/java/com/encoway/edu/EventDrivenUpdatesMap.java
EventDrivenUpdatesMap.add
public void add(String events, String...ids) { for (String event : EventDrivenUpdatesMap.parseEvents(events)) { Set<String> listenerIds = delegate.get(event); if (listenerIds == null) { listenerIds = new HashSet<>(); delegate.put(event, listenerIds); } listenerIds.addAll(Arrays.asList(ids)); } }
java
public void add(String events, String...ids) { for (String event : EventDrivenUpdatesMap.parseEvents(events)) { Set<String> listenerIds = delegate.get(event); if (listenerIds == null) { listenerIds = new HashSet<>(); delegate.put(event, listenerIds); } listenerIds.addAll(Arrays.asList(ids)); } }
[ "public", "void", "add", "(", "String", "events", ",", "String", "...", "ids", ")", "{", "for", "(", "String", "event", ":", "EventDrivenUpdatesMap", ".", "parseEvents", "(", "events", ")", ")", "{", "Set", "<", "String", ">", "listenerIds", "=", "delega...
Maps the the specified {@code ids} as listeners for {@code events}. @param events the events triggering an update of the specified {@code ids} @param ids the ids to be updated
[ "Maps", "the", "the", "specified", "{" ]
train
https://github.com/encoway/edu/blob/52ae92b2207f7d5668e212904359fbeb360f3f05/edu/src/main/java/com/encoway/edu/EventDrivenUpdatesMap.java#L129-L139
apereo/cas
support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java
AbstractServiceValidateController.handleProxyGrantingTicketDelivery
public TicketGrantingTicket handleProxyGrantingTicketDelivery(final String serviceTicketId, final Credential credential) throws AuthenticationException, AbstractTicketException { val serviceTicket = serviceValidateConfigurationContext.getCentralAuthenticationService().getTicket(serviceTicketId, ServiceTicket.class); val authenticationResult = serviceValidateConfigurationContext.getAuthenticationSystemSupport() .handleAndFinalizeSingleAuthenticationTransaction(serviceTicket.getService(), credential); val proxyGrantingTicketId = serviceValidateConfigurationContext.getCentralAuthenticationService() .createProxyGrantingTicket(serviceTicketId, authenticationResult); LOGGER.debug("Generated proxy-granting ticket [{}] off of service ticket [{}] and credential [{}]", proxyGrantingTicketId.getId(), serviceTicketId, credential); return proxyGrantingTicketId; }
java
public TicketGrantingTicket handleProxyGrantingTicketDelivery(final String serviceTicketId, final Credential credential) throws AuthenticationException, AbstractTicketException { val serviceTicket = serviceValidateConfigurationContext.getCentralAuthenticationService().getTicket(serviceTicketId, ServiceTicket.class); val authenticationResult = serviceValidateConfigurationContext.getAuthenticationSystemSupport() .handleAndFinalizeSingleAuthenticationTransaction(serviceTicket.getService(), credential); val proxyGrantingTicketId = serviceValidateConfigurationContext.getCentralAuthenticationService() .createProxyGrantingTicket(serviceTicketId, authenticationResult); LOGGER.debug("Generated proxy-granting ticket [{}] off of service ticket [{}] and credential [{}]", proxyGrantingTicketId.getId(), serviceTicketId, credential); return proxyGrantingTicketId; }
[ "public", "TicketGrantingTicket", "handleProxyGrantingTicketDelivery", "(", "final", "String", "serviceTicketId", ",", "final", "Credential", "credential", ")", "throws", "AuthenticationException", ",", "AbstractTicketException", "{", "val", "serviceTicket", "=", "serviceVali...
Handle proxy granting ticket delivery. @param serviceTicketId the service ticket id @param credential the service credential @return the ticket granting ticket @throws AuthenticationException the authentication exception @throws AbstractTicketException the abstract ticket exception
[ "Handle", "proxy", "granting", "ticket", "delivery", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java#L124-L133
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementBuilder.java
StatementBuilder.appendStatementString
protected void appendStatementString(StringBuilder sb, List<ArgumentHolder> argList) throws SQLException { appendStatementStart(sb, argList); appendWhereStatement(sb, argList, WhereOperation.FIRST); appendStatementEnd(sb, argList); }
java
protected void appendStatementString(StringBuilder sb, List<ArgumentHolder> argList) throws SQLException { appendStatementStart(sb, argList); appendWhereStatement(sb, argList, WhereOperation.FIRST); appendStatementEnd(sb, argList); }
[ "protected", "void", "appendStatementString", "(", "StringBuilder", "sb", ",", "List", "<", "ArgumentHolder", ">", "argList", ")", "throws", "SQLException", "{", "appendStatementStart", "(", "sb", ",", "argList", ")", ";", "appendWhereStatement", "(", "sb", ",", ...
Internal method to build a query while tracking various arguments. Users should use the {@link #prepareStatementString()} method instead. <p> This needs to be protected because of (WARNING: DO NOT MAKE A JAVADOC LINK) InternalQueryBuilder (WARNING: DO NOT MAKE A JAVADOC LINK). </p>
[ "Internal", "method", "to", "build", "a", "query", "while", "tracking", "various", "arguments", ".", "Users", "should", "use", "the", "{", "@link", "#prepareStatementString", "()", "}", "method", "instead", "." ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementBuilder.java#L131-L135
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java
SnowflakeStatementV1.executeQuery
@Override public ResultSet executeQuery(String sql) throws SQLException { raiseSQLExceptionIfStatementIsClosed(); return executeQueryInternal(sql, null); }
java
@Override public ResultSet executeQuery(String sql) throws SQLException { raiseSQLExceptionIfStatementIsClosed(); return executeQueryInternal(sql, null); }
[ "@", "Override", "public", "ResultSet", "executeQuery", "(", "String", "sql", ")", "throws", "SQLException", "{", "raiseSQLExceptionIfStatementIsClosed", "(", ")", ";", "return", "executeQueryInternal", "(", "sql", ",", "null", ")", ";", "}" ]
Execute SQL query @param sql sql statement @return ResultSet @throws SQLException if @link{#executeQueryInternal(String, Map)} throws an exception
[ "Execute", "SQL", "query" ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeStatementV1.java#L159-L164
lucee/Lucee
core/src/main/java/lucee/runtime/net/ntp/NtpMessage.java
NtpMessage.encodeTimestamp
public static void encodeTimestamp(byte[] array, int pointer, double timestamp) { // Converts a double into a 64-bit fixed point for (int i = 0; i < 8; i++) { // 2^24, 2^16, 2^8, .. 2^-32 double base = Math.pow(2, (3 - i) * 8); // Capture byte value array[pointer + i] = (byte) (timestamp / base); // Subtract captured value from remaining total timestamp = timestamp - (unsignedByteToShort(array[pointer + i]) * base); } // From RFC 2030: It is advisable to fill the non-significan't // low order bits of the timestamp with a random, unbiased // bitstring, both to avoid systematic roundoff errors and as // a means of loop detection and replay detection. array[7] = (byte) (Math.random() * 255.0); }
java
public static void encodeTimestamp(byte[] array, int pointer, double timestamp) { // Converts a double into a 64-bit fixed point for (int i = 0; i < 8; i++) { // 2^24, 2^16, 2^8, .. 2^-32 double base = Math.pow(2, (3 - i) * 8); // Capture byte value array[pointer + i] = (byte) (timestamp / base); // Subtract captured value from remaining total timestamp = timestamp - (unsignedByteToShort(array[pointer + i]) * base); } // From RFC 2030: It is advisable to fill the non-significan't // low order bits of the timestamp with a random, unbiased // bitstring, both to avoid systematic roundoff errors and as // a means of loop detection and replay detection. array[7] = (byte) (Math.random() * 255.0); }
[ "public", "static", "void", "encodeTimestamp", "(", "byte", "[", "]", "array", ",", "int", "pointer", ",", "double", "timestamp", ")", "{", "// Converts a double into a 64-bit fixed point", "for", "(", "int", "i", "=", "0", ";", "i", "<", "8", ";", "i", "+...
Encodes a timestamp in the specified position in the message @param array @param pointer @param timestamp
[ "Encodes", "a", "timestamp", "in", "the", "specified", "position", "in", "the", "message" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ntp/NtpMessage.java#L306-L324
real-logic/agrona
agrona/src/main/java/org/agrona/SystemUtil.java
SystemUtil.getDurationInNanos
public static long getDurationInNanos(final String propertyName, final long defaultValue) { final String propertyValue = getProperty(propertyName); if (propertyValue != null) { final long value = parseDuration(propertyName, propertyValue); if (value < 0) { throw new NumberFormatException(propertyName + " must be positive: " + value); } return value; } return defaultValue; }
java
public static long getDurationInNanos(final String propertyName, final long defaultValue) { final String propertyValue = getProperty(propertyName); if (propertyValue != null) { final long value = parseDuration(propertyName, propertyValue); if (value < 0) { throw new NumberFormatException(propertyName + " must be positive: " + value); } return value; } return defaultValue; }
[ "public", "static", "long", "getDurationInNanos", "(", "final", "String", "propertyName", ",", "final", "long", "defaultValue", ")", "{", "final", "String", "propertyValue", "=", "getProperty", "(", "propertyName", ")", ";", "if", "(", "propertyValue", "!=", "nu...
Get a string representation of a time duration with an optional suffix of 's', 'ms', 'us', or 'ns' suffix to indicate seconds, milliseconds, microseconds, or nanoseconds respectively. <p> If the resulting duration is greater than {@link Long#MAX_VALUE} then {@link Long#MAX_VALUE} is used. @param propertyName associated with the duration value. @param defaultValue to be used if the property is not present. @return the long value. @throws NumberFormatException if the value is negative or malformed.
[ "Get", "a", "string", "representation", "of", "a", "time", "duration", "with", "an", "optional", "suffix", "of", "s", "ms", "us", "or", "ns", "suffix", "to", "indicate", "seconds", "milliseconds", "microseconds", "or", "nanoseconds", "respectively", ".", "<p",...
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/SystemUtil.java#L338-L353
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java
Settings.setIntIfNotNull
public void setIntIfNotNull(@NotNull final String key, @Nullable final Integer value) { if (null != value) { setInt(key, value); } }
java
public void setIntIfNotNull(@NotNull final String key, @Nullable final Integer value) { if (null != value) { setInt(key, value); } }
[ "public", "void", "setIntIfNotNull", "(", "@", "NotNull", "final", "String", "key", ",", "@", "Nullable", "final", "Integer", "value", ")", "{", "if", "(", "null", "!=", "value", ")", "{", "setInt", "(", "key", ",", "value", ")", ";", "}", "}" ]
Sets a property value only if the value is not null. @param key the key for the property @param value the value for the property
[ "Sets", "a", "property", "value", "only", "if", "the", "value", "is", "not", "null", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L757-L761
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/StackTraceFilter.java
StackTraceFilter.getFilteredStackTrace
@Deprecated public static String getFilteredStackTrace(Throwable t, boolean shouldFilter) { if (shouldFilter) { return getFilteredStackTrace(t, 0); } StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); pw.close(); return sw.getBuffer().toString(); }
java
@Deprecated public static String getFilteredStackTrace(Throwable t, boolean shouldFilter) { if (shouldFilter) { return getFilteredStackTrace(t, 0); } StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); pw.close(); return sw.getBuffer().toString(); }
[ "@", "Deprecated", "public", "static", "String", "getFilteredStackTrace", "(", "Throwable", "t", ",", "boolean", "shouldFilter", ")", "{", "if", "(", "shouldFilter", ")", "{", "return", "getFilteredStackTrace", "(", "t", ",", "0", ")", ";", "}", "StringWriter"...
Get a filterered stack trace. @param t the throwable @param shouldFilter true in case filtering should be performed. Else stack trace as string will be returned. @return String containing the stack trace. @deprecated since 1.11.1. Use {@link #getStackTrace(Throwable, int)} to get the stack trace without filtering or {@link #getFilteredStackTrace(Throwable)} to get the filtered the stack trace.
[ "Get", "a", "filterered", "stack", "trace", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/StackTraceFilter.java#L223-L236
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseByteCacheSize
private void parseByteCacheSize(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_BYTE_CACHE_SIZE); if (null != value) { try { this.byteCacheSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BYTE_CACHE_SIZE, HttpConfigConstants.MAX_BYTE_CACHE_SIZE); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: byte cache size is " + getByteCacheSize()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseByteCacheSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid bytecache setting of " + value); } } } }
java
private void parseByteCacheSize(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_BYTE_CACHE_SIZE); if (null != value) { try { this.byteCacheSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BYTE_CACHE_SIZE, HttpConfigConstants.MAX_BYTE_CACHE_SIZE); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: byte cache size is " + getByteCacheSize()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseByteCacheSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid bytecache setting of " + value); } } } }
[ "private", "void", "parseByteCacheSize", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_BYTE_CACHE_SIZE", ")", ";", "if", "(", "null", "!=", "value", ...
Check the input configuration for the size of the parse byte cache to use. @param props
[ "Check", "the", "input", "configuration", "for", "the", "size", "of", "the", "parse", "byte", "cache", "to", "use", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L758-L773
pmwmedia/tinylog
benchmarks/src/main/java/org/tinylog/benchmarks/api/WritingBenchmark.java
WritingBenchmark.byteArrayRandomAccessFile
@Benchmark @BenchmarkMode(Mode.AverageTime) public void byteArrayRandomAccessFile(final Configuration configuration) throws IOException { byte[] buffer = new byte[BUFFER_CAPACITY]; int position = 0; try (RandomAccessFile file = new RandomAccessFile(configuration.file, "rw")) { for (long i = 0; i < LINES; ++i) { if (BUFFER_CAPACITY - position < DATA.length) { file.write(buffer, 0, position); position = 0; } if (BUFFER_CAPACITY < DATA.length) { file.write(DATA); } else { System.arraycopy(DATA, 0, buffer, position, DATA.length); position += DATA.length; } } if (position > 0) { file.write(buffer, 0, position); } } }
java
@Benchmark @BenchmarkMode(Mode.AverageTime) public void byteArrayRandomAccessFile(final Configuration configuration) throws IOException { byte[] buffer = new byte[BUFFER_CAPACITY]; int position = 0; try (RandomAccessFile file = new RandomAccessFile(configuration.file, "rw")) { for (long i = 0; i < LINES; ++i) { if (BUFFER_CAPACITY - position < DATA.length) { file.write(buffer, 0, position); position = 0; } if (BUFFER_CAPACITY < DATA.length) { file.write(DATA); } else { System.arraycopy(DATA, 0, buffer, position, DATA.length); position += DATA.length; } } if (position > 0) { file.write(buffer, 0, position); } } }
[ "@", "Benchmark", "@", "BenchmarkMode", "(", "Mode", ".", "AverageTime", ")", "public", "void", "byteArrayRandomAccessFile", "(", "final", "Configuration", "configuration", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", ...
Benchmarks writing via {@link RandomAccessFile} with custom buffering via a byte array. @param configuration Configuration with target file @throws IOException Failed to write to target file
[ "Benchmarks", "writing", "via", "{", "@link", "RandomAccessFile", "}", "with", "custom", "buffering", "via", "a", "byte", "array", "." ]
train
https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/benchmarks/src/main/java/org/tinylog/benchmarks/api/WritingBenchmark.java#L115-L141
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateCitizenIdNumber
public static <T extends CharSequence> T validateCitizenIdNumber(T value, String errorMsg) throws ValidateException { if (false == isCitizenId(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateCitizenIdNumber(T value, String errorMsg) throws ValidateException { if (false == isCitizenId(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateCitizenIdNumber", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isCitizenId", "(", "value", ")", ")", "{", "throw"...
验证是否为身份证号码(18位中国)<br> 出生日期只支持到到2999年 @param <T> 字符串类型 @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为身份证号码(18位中国)<br", ">", "出生日期只支持到到2999年" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L705-L710
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/access/log/LogRequestor.java
LogRequestor.readFully
private void readFully(InputStream in, byte[] bytes) throws IOException { int read = ByteStreams.read(in, bytes, 0, bytes.length); if (read == 0) { throw new NoBytesReadException(); } else if (read != bytes.length) { throw new EOFException("reached end of stream after reading " + read + " bytes; " + bytes.length + " bytes expected"); } }
java
private void readFully(InputStream in, byte[] bytes) throws IOException { int read = ByteStreams.read(in, bytes, 0, bytes.length); if (read == 0) { throw new NoBytesReadException(); } else if (read != bytes.length) { throw new EOFException("reached end of stream after reading " + read + " bytes; " + bytes.length + " bytes expected"); } }
[ "private", "void", "readFully", "(", "InputStream", "in", ",", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "int", "read", "=", "ByteStreams", ".", "read", "(", "in", ",", "bytes", ",", "0", ",", "bytes", ".", "length", ")", ";", "if...
This is a copy of ByteStreams.readFully(), with the slight change that it throws NoBytesReadException if zero bytes are read. Otherwise it is identical. @param in @param bytes @throws IOException
[ "This", "is", "a", "copy", "of", "ByteStreams", ".", "readFully", "()", "with", "the", "slight", "change", "that", "it", "throws", "NoBytesReadException", "if", "zero", "bytes", "are", "read", ".", "Otherwise", "it", "is", "identical", "." ]
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/access/log/LogRequestor.java#L126-L134
lecho/hellocharts-android
hellocharts-library/src/lecho/lib/hellocharts/model/Viewport.java
Viewport.writeToParcel
public void writeToParcel(Parcel out, int flags) { out.writeFloat(left); out.writeFloat(top); out.writeFloat(right); out.writeFloat(bottom); }
java
public void writeToParcel(Parcel out, int flags) { out.writeFloat(left); out.writeFloat(top); out.writeFloat(right); out.writeFloat(bottom); }
[ "public", "void", "writeToParcel", "(", "Parcel", "out", ",", "int", "flags", ")", "{", "out", ".", "writeFloat", "(", "left", ")", ";", "out", ".", "writeFloat", "(", "top", ")", ";", "out", ".", "writeFloat", "(", "right", ")", ";", "out", ".", "...
Write this viewport to the specified parcel. To restore a viewport from a parcel, use readFromParcel() @param out The parcel to write the viewport's coordinates into
[ "Write", "this", "viewport", "to", "the", "specified", "parcel", ".", "To", "restore", "a", "viewport", "from", "a", "parcel", "use", "readFromParcel", "()" ]
train
https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/model/Viewport.java#L370-L375
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.addRows
public void addRows(ArrayList<String> rows, String defaultValue) { CompactCharSequence dv = new CompactCharSequence(defaultValue); int oldlength = data.length; int numColumns = 0; if (data.length > 0 && data[0] != null) { numColumns = data[0].length; } data = (CompactCharSequence[][]) resizeArray(data, data.length + rows.size()); for (int r = 0; r < rows.size(); r++) { data[oldlength + r] = new CompactCharSequence[numColumns]; for (int c = 0; c < numColumns; c++) { data[oldlength + r][c] = dv; } data[oldlength + r][0] = new CompactCharSequence(rows.get(r)); rowLookup.put(rows.get(r), new HeaderInfo(r + oldlength)); } }
java
public void addRows(ArrayList<String> rows, String defaultValue) { CompactCharSequence dv = new CompactCharSequence(defaultValue); int oldlength = data.length; int numColumns = 0; if (data.length > 0 && data[0] != null) { numColumns = data[0].length; } data = (CompactCharSequence[][]) resizeArray(data, data.length + rows.size()); for (int r = 0; r < rows.size(); r++) { data[oldlength + r] = new CompactCharSequence[numColumns]; for (int c = 0; c < numColumns; c++) { data[oldlength + r][c] = dv; } data[oldlength + r][0] = new CompactCharSequence(rows.get(r)); rowLookup.put(rows.get(r), new HeaderInfo(r + oldlength)); } }
[ "public", "void", "addRows", "(", "ArrayList", "<", "String", ">", "rows", ",", "String", "defaultValue", ")", "{", "CompactCharSequence", "dv", "=", "new", "CompactCharSequence", "(", "defaultValue", ")", ";", "int", "oldlength", "=", "data", ".", "length", ...
Add rows to the worksheet and fill in default value @param rows @param defaultValue
[ "Add", "rows", "to", "the", "worksheet", "and", "fill", "in", "default", "value" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L708-L724
kubernetes-client/java
util/src/main/java/io/kubernetes/client/PodLogs.java
PodLogs.streamNamespacedPodLog
public InputStream streamNamespacedPodLog(String namespace, String name, String container) throws ApiException, IOException { return streamNamespacedPodLog(namespace, name, container, null, null, false); }
java
public InputStream streamNamespacedPodLog(String namespace, String name, String container) throws ApiException, IOException { return streamNamespacedPodLog(namespace, name, container, null, null, false); }
[ "public", "InputStream", "streamNamespacedPodLog", "(", "String", "namespace", ",", "String", "name", ",", "String", "container", ")", "throws", "ApiException", ",", "IOException", "{", "return", "streamNamespacedPodLog", "(", "namespace", ",", "name", ",", "contain...
Important note. You must close this stream or else you can leak connections.
[ "Important", "note", ".", "You", "must", "close", "this", "stream", "or", "else", "you", "can", "leak", "connections", "." ]
train
https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/util/src/main/java/io/kubernetes/client/PodLogs.java#L65-L68