repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java
BatchUpdateDaemon.invalidateByTemplate
public void invalidateByTemplate(String template, boolean waitOnInvalidation, DCache cache) { synchronized (this) { BatchUpdateList bul = getUpdateList(cache); bul.invalidateByTemplateEvents.put(template, new InvalidateByTemplateEvent(template, CachePerf.LOCAL)); } if (waitOnInvalidation) { wakeUp(0, 0); } }
java
public void invalidateByTemplate(String template, boolean waitOnInvalidation, DCache cache) { synchronized (this) { BatchUpdateList bul = getUpdateList(cache); bul.invalidateByTemplateEvents.put(template, new InvalidateByTemplateEvent(template, CachePerf.LOCAL)); } if (waitOnInvalidation) { wakeUp(0, 0); } }
[ "public", "void", "invalidateByTemplate", "(", "String", "template", ",", "boolean", "waitOnInvalidation", ",", "DCache", "cache", ")", "{", "synchronized", "(", "this", ")", "{", "BatchUpdateList", "bul", "=", "getUpdateList", "(", "cache", ")", ";", "bul", "...
This invalidates all cache entries in all caches whose template is specified. @param template The Template that is used to to invalidate fragments. @param waitOnInvalidation True indicates that this method should not return until all invalidations have taken effect. False indicates that the invalidations will take effect the next time the BatchUpdateDaemon wakes.
[ "This", "invalidates", "all", "cache", "entries", "in", "all", "caches", "whose", "template", "is", "specified", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java#L95-L103
apache/incubator-gobblin
gobblin-audit/src/main/java/org/apache/gobblin/audit/values/sink/FsAuditSink.java
FsAuditSink.getAuditFilePath
public Path getAuditFilePath() { StringBuilder auditFileNameBuilder = new StringBuilder(); auditFileNameBuilder.append("P=").append(auditMetadata.getPhase()).append(FILE_NAME_DELIMITTER).append("C=") .append(auditMetadata.getCluster()).append(FILE_NAME_DELIMITTER).append("E=") .append(auditMetadata.getExtractId()).append(FILE_NAME_DELIMITTER).append("S=") .append(auditMetadata.getSnapshotId()).append(FILE_NAME_DELIMITTER).append("D=") .append(auditMetadata.getDeltaId()); return new Path(auditDirPath, PathUtils.combinePaths(auditMetadata.getTableMetadata().getDatabase(), auditMetadata .getTableMetadata().getTable(), auditFileNameBuilder.toString(), auditMetadata.getPartFileName())); }
java
public Path getAuditFilePath() { StringBuilder auditFileNameBuilder = new StringBuilder(); auditFileNameBuilder.append("P=").append(auditMetadata.getPhase()).append(FILE_NAME_DELIMITTER).append("C=") .append(auditMetadata.getCluster()).append(FILE_NAME_DELIMITTER).append("E=") .append(auditMetadata.getExtractId()).append(FILE_NAME_DELIMITTER).append("S=") .append(auditMetadata.getSnapshotId()).append(FILE_NAME_DELIMITTER).append("D=") .append(auditMetadata.getDeltaId()); return new Path(auditDirPath, PathUtils.combinePaths(auditMetadata.getTableMetadata().getDatabase(), auditMetadata .getTableMetadata().getTable(), auditFileNameBuilder.toString(), auditMetadata.getPartFileName())); }
[ "public", "Path", "getAuditFilePath", "(", ")", "{", "StringBuilder", "auditFileNameBuilder", "=", "new", "StringBuilder", "(", ")", ";", "auditFileNameBuilder", ".", "append", "(", "\"P=\"", ")", ".", "append", "(", "auditMetadata", ".", "getPhase", "(", ")", ...
Returns the complete path of the audit file. Generate the audit file path with format <pre> |-- &lt;Database&gt; |-- &lt;Table&gt; |-- P=&lt;PHASE&gt;.C=&lt;CLUSTER&gt;.E=&lt;EXTRACT_ID&gt;.S=&lt;SNAPSHOT_ID&gt;.D=&lt;DELTA_ID&gt; |-- *.avro </pre>
[ "Returns", "the", "complete", "path", "of", "the", "audit", "file", ".", "Generate", "the", "audit", "file", "path", "with", "format" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-audit/src/main/java/org/apache/gobblin/audit/values/sink/FsAuditSink.java#L97-L107
ironjacamar/ironjacamar
deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java
AbstractResourceAdapterDeployer.createInboundMapping
private Map<String, ActivationSpecImpl> createInboundMapping(InboundResourceAdapter ira, ClassLoader cl) throws Exception { if (ira != null) { Map<String, ActivationSpecImpl> result = new HashMap<>(); for (org.ironjacamar.common.api.metadata.spec.MessageListener ml : ira.getMessageadapter().getMessagelisteners()) { String type = ml.getMessagelistenerType().getValue(); org.ironjacamar.common.api.metadata.spec.Activationspec as = ml.getActivationspec(); String clzName = as.getActivationspecClass().getValue(); Class<?> clz = Class.forName(clzName, true, cl); Map<String, Class<?>> configProperties = createPropertyMap(clz); Set<String> requiredConfigProperties = new HashSet<>(); if (as.getRequiredConfigProperties() != null) { for (org.ironjacamar.common.api.metadata.spec.RequiredConfigProperty rcp : as.getRequiredConfigProperties()) { requiredConfigProperties.add(rcp.getConfigPropertyName().getValue()); } } validationObj.add(new ValidateClass(Key.ACTIVATION_SPEC, clz, as.getConfigProperties())); ActivationSpecImpl asi = new ActivationSpecImpl(clzName, configProperties, requiredConfigProperties); if (!result.containsKey(type)) result.put(type, asi); } return result; } return null; }
java
private Map<String, ActivationSpecImpl> createInboundMapping(InboundResourceAdapter ira, ClassLoader cl) throws Exception { if (ira != null) { Map<String, ActivationSpecImpl> result = new HashMap<>(); for (org.ironjacamar.common.api.metadata.spec.MessageListener ml : ira.getMessageadapter().getMessagelisteners()) { String type = ml.getMessagelistenerType().getValue(); org.ironjacamar.common.api.metadata.spec.Activationspec as = ml.getActivationspec(); String clzName = as.getActivationspecClass().getValue(); Class<?> clz = Class.forName(clzName, true, cl); Map<String, Class<?>> configProperties = createPropertyMap(clz); Set<String> requiredConfigProperties = new HashSet<>(); if (as.getRequiredConfigProperties() != null) { for (org.ironjacamar.common.api.metadata.spec.RequiredConfigProperty rcp : as.getRequiredConfigProperties()) { requiredConfigProperties.add(rcp.getConfigPropertyName().getValue()); } } validationObj.add(new ValidateClass(Key.ACTIVATION_SPEC, clz, as.getConfigProperties())); ActivationSpecImpl asi = new ActivationSpecImpl(clzName, configProperties, requiredConfigProperties); if (!result.containsKey(type)) result.put(type, asi); } return result; } return null; }
[ "private", "Map", "<", "String", ",", "ActivationSpecImpl", ">", "createInboundMapping", "(", "InboundResourceAdapter", "ira", ",", "ClassLoader", "cl", ")", "throws", "Exception", "{", "if", "(", "ira", "!=", "null", ")", "{", "Map", "<", "String", ",", "Ac...
Create an inbound mapping @param ira The inbound resource adapter definition @param cl The class loader @return The mapping @exception Exception Thrown in case of an error
[ "Create", "an", "inbound", "mapping" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java#L1198-L1234
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/HOSECodeGenerator.java
HOSECodeGenerator.getHOSECode
public String getHOSECode(IAtomContainer ac, IAtom root, int noOfSpheres, boolean ringsize) throws CDKException { ensureIsotopeFactory(); CanonicalLabeler canLabler = new CanonicalLabeler(); canLabler.canonLabel(ac); centerCode = ""; this.atomContainer = ac; maxSphere = noOfSpheres; spheres = new List[noOfSpheres + 1]; for (int i = 0; i < ac.getAtomCount(); i++) { ac.getAtom(i).setFlag(CDKConstants.VISITED, false); } root.setFlag(CDKConstants.VISITED, true); rootNode = new TreeNode(root.getSymbol(), null, root, (double) 0, atomContainer.getConnectedBondsCount(root), 0); /* * All we need to observe is how the ranking of substituents in the * subsequent spheres of the root nodes influences the ranking of the * first sphere, since the order of a node in a sphere depends on the * order the preceding node in its branch */ HOSECode = new StringBuffer(); createCenterCode(root, ac, ringsize); breadthFirstSearch(root, true); createCode(); fillUpSphereDelimiters(); logger.debug("HOSECodeGenerator -> HOSECode: ", HOSECode); return HOSECode.toString(); }
java
public String getHOSECode(IAtomContainer ac, IAtom root, int noOfSpheres, boolean ringsize) throws CDKException { ensureIsotopeFactory(); CanonicalLabeler canLabler = new CanonicalLabeler(); canLabler.canonLabel(ac); centerCode = ""; this.atomContainer = ac; maxSphere = noOfSpheres; spheres = new List[noOfSpheres + 1]; for (int i = 0; i < ac.getAtomCount(); i++) { ac.getAtom(i).setFlag(CDKConstants.VISITED, false); } root.setFlag(CDKConstants.VISITED, true); rootNode = new TreeNode(root.getSymbol(), null, root, (double) 0, atomContainer.getConnectedBondsCount(root), 0); /* * All we need to observe is how the ranking of substituents in the * subsequent spheres of the root nodes influences the ranking of the * first sphere, since the order of a node in a sphere depends on the * order the preceding node in its branch */ HOSECode = new StringBuffer(); createCenterCode(root, ac, ringsize); breadthFirstSearch(root, true); createCode(); fillUpSphereDelimiters(); logger.debug("HOSECodeGenerator -> HOSECode: ", HOSECode); return HOSECode.toString(); }
[ "public", "String", "getHOSECode", "(", "IAtomContainer", "ac", ",", "IAtom", "root", ",", "int", "noOfSpheres", ",", "boolean", "ringsize", ")", "throws", "CDKException", "{", "ensureIsotopeFactory", "(", ")", ";", "CanonicalLabeler", "canLabler", "=", "new", "...
Produces a HOSE code for Atom <code>root</code> in the {@link IAtomContainer} <code>ac</code>. The HOSE code is produced for the number of spheres given by <code>noOfSpheres</code>. IMPORTANT: if you want aromaticity to be included in the code, you need to run the IAtomContainer <code>ac</code> to the {@link org.openscience.cdk.aromaticity.CDKHueckelAromaticityDetector} prior to using <code>getHOSECode()</code>. This method only gives proper results if the molecule is fully saturated (if not, the order of the HOSE code might depend on atoms in higher spheres). This method is known to fail for protons sometimes. IMPORTANT: Your molecule must contain implicit or explicit hydrogens for this method to work properly. @param ac The IAtomContainer with the molecular skeleton in which the root atom resides @param root The root atom for which to produce the HOSE code @param noOfSpheres The number of spheres to look at @param ringsize The size of the ring(s) it is in is included in center atom code @return The HOSECode value @exception org.openscience.cdk.exception.CDKException Thrown if something is wrong
[ "Produces", "a", "HOSE", "code", "for", "Atom", "<code", ">", "root<", "/", "code", ">", "in", "the", "{", "@link", "IAtomContainer", "}", "<code", ">", "ac<", "/", "code", ">", ".", "The", "HOSE", "code", "is", "produced", "for", "the", "number", "o...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/HOSECodeGenerator.java#L239-L265
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.toDateTime
public DateTime toDateTime(Config config, Element el, String attributeName) { String str = el.getAttribute(attributeName); if (str == null) return null; return DateCaster.toDateAdvanced(str, ThreadLocalPageContext.getTimeZone(config), null); }
java
public DateTime toDateTime(Config config, Element el, String attributeName) { String str = el.getAttribute(attributeName); if (str == null) return null; return DateCaster.toDateAdvanced(str, ThreadLocalPageContext.getTimeZone(config), null); }
[ "public", "DateTime", "toDateTime", "(", "Config", "config", ",", "Element", "el", ",", "String", "attributeName", ")", "{", "String", "str", "=", "el", ".", "getAttribute", "(", "attributeName", ")", ";", "if", "(", "str", "==", "null", ")", "return", "...
reads a XML Element Attribute ans cast it to a DateTime Object @param config @param el XML Element to read Attribute from it @param attributeName Name of the Attribute to read @return Attribute Value
[ "reads", "a", "XML", "Element", "Attribute", "ans", "cast", "it", "to", "a", "DateTime", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L243-L247
lastaflute/lastaflute
src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java
TypicalLoginAssist.handleRememberMeCookie
protected Boolean handleRememberMeCookie(String[] valueAry, RememberMeLoginSpecifiedOption option) { if (valueAry.length != 2) { // invalid cookie return null; } final String userKey = valueAry[0]; // resolved by identity login final String expireDate = valueAry[1]; // AccessToken's expire if (isValidRememberMeCookie(userKey, expireDate)) { final ID userId = convertCookieUserKeyToUserId(userKey); return doRememberMe(userId, expireDate, option); } return null; }
java
protected Boolean handleRememberMeCookie(String[] valueAry, RememberMeLoginSpecifiedOption option) { if (valueAry.length != 2) { // invalid cookie return null; } final String userKey = valueAry[0]; // resolved by identity login final String expireDate = valueAry[1]; // AccessToken's expire if (isValidRememberMeCookie(userKey, expireDate)) { final ID userId = convertCookieUserKeyToUserId(userKey); return doRememberMe(userId, expireDate, option); } return null; }
[ "protected", "Boolean", "handleRememberMeCookie", "(", "String", "[", "]", "valueAry", ",", "RememberMeLoginSpecifiedOption", "option", ")", "{", "if", "(", "valueAry", ".", "length", "!=", "2", ")", "{", "// invalid cookie", "return", "null", ";", "}", "final",...
Handle remember-me cookie (and do remember-me). <br> You can change access token's structure by override. #change_access_token @param valueAry The array of cookie values. (NotNull) @param option The option of remember-me login specified by caller. (NotNull) @return The determination of remember-me, true or false or null. (NullAllowed: means invalid cookie)
[ "Handle", "remember", "-", "me", "cookie", "(", "and", "do", "remember", "-", "me", ")", ".", "<br", ">", "You", "can", "change", "access", "token", "s", "structure", "by", "override", ".", "#change_access_token" ]
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java#L574-L585
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SRTServletRequestUtils.java
SRTServletRequestUtils.getHeader
@Sensitive public static String getHeader(HttpServletRequest req, String key) { HttpServletRequest sr = getWrappedServletRequestObject(req); return sr.getHeader(key); }
java
@Sensitive public static String getHeader(HttpServletRequest req, String key) { HttpServletRequest sr = getWrappedServletRequestObject(req); return sr.getHeader(key); }
[ "@", "Sensitive", "public", "static", "String", "getHeader", "(", "HttpServletRequest", "req", ",", "String", "key", ")", "{", "HttpServletRequest", "sr", "=", "getWrappedServletRequestObject", "(", "req", ")", ";", "return", "sr", ".", "getHeader", "(", "key", ...
Obtain the value of the specified header. @param req @param key @return The value of the header @see HttpServletRequest#getHeader(String)
[ "Obtain", "the", "value", "of", "the", "specified", "header", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SRTServletRequestUtils.java#L95-L99
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/BandwidthSchedulesInner.java
BandwidthSchedulesInner.beginCreateOrUpdate
public BandwidthScheduleInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, BandwidthScheduleInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, parameters).toBlocking().single().body(); }
java
public BandwidthScheduleInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, BandwidthScheduleInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, parameters).toBlocking().single().body(); }
[ "public", "BandwidthScheduleInner", "beginCreateOrUpdate", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ",", "BandwidthScheduleInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "deviceName"...
Creates or updates a bandwidth schedule. @param deviceName The device name. @param name The bandwidth schedule name which needs to be added/updated. @param resourceGroupName The resource group name. @param parameters The bandwidth schedule to be added or updated. @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 BandwidthScheduleInner object if successful.
[ "Creates", "or", "updates", "a", "bandwidth", "schedule", "." ]
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/BandwidthSchedulesInner.java#L406-L408
tvesalainen/util
util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java
ChannelHelper.alignedPosition
public static final long alignedPosition(SeekableByteChannel ch, long align) throws IOException { long position = ch.position(); long mod = position % align; if (mod > 0) { return position + align - mod; } else { return position; } }
java
public static final long alignedPosition(SeekableByteChannel ch, long align) throws IOException { long position = ch.position(); long mod = position % align; if (mod > 0) { return position + align - mod; } else { return position; } }
[ "public", "static", "final", "long", "alignedPosition", "(", "SeekableByteChannel", "ch", ",", "long", "align", ")", "throws", "IOException", "{", "long", "position", "=", "ch", ".", "position", "(", ")", ";", "long", "mod", "=", "position", "%", "align", ...
Returns Incremented position so that position mod align == 0, but doesn't change channels position. @param ch @param align @return @throws IOException
[ "Returns", "Incremented", "position", "so", "that", "position", "mod", "align", "==", "0", "but", "doesn", "t", "change", "channels", "position", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L154-L166
dmurph/jgoogleanalyticstracker
src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java
JGoogleAnalyticsTracker.trackPageView
public void trackPageView(String argPageURL, String argPageTitle, String argHostName) { trackPageViewFromReferrer(argPageURL, argPageTitle, argHostName, "http://www.dmurph.com", "/"); }
java
public void trackPageView(String argPageURL, String argPageTitle, String argHostName) { trackPageViewFromReferrer(argPageURL, argPageTitle, argHostName, "http://www.dmurph.com", "/"); }
[ "public", "void", "trackPageView", "(", "String", "argPageURL", ",", "String", "argPageTitle", ",", "String", "argHostName", ")", "{", "trackPageViewFromReferrer", "(", "argPageURL", ",", "argPageTitle", ",", "argHostName", ",", "\"http://www.dmurph.com\"", ",", "\"/\...
Tracks a page view. @param argPageURL required, Google won't track without it. Ex: <code>"org/me/javaclass.java"</code>, or anything you want as the page url. @param argPageTitle content title @param argHostName the host name for the url
[ "Tracks", "a", "page", "view", "." ]
train
https://github.com/dmurph/jgoogleanalyticstracker/blob/69f68caf8e09a53e6f6076477bf05b84bc80e386/src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java#L296-L298
meltmedia/cadmium
servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java
AbstractSecureRedirectStrategy.changeProtocolAndPort
public static URI changeProtocolAndPort(String protocol, int port, URI template) throws URISyntaxException { return new URI(protocol, template.getUserInfo(), template.getHost(), port, template.getPath(), template.getQuery(), null); }
java
public static URI changeProtocolAndPort(String protocol, int port, URI template) throws URISyntaxException { return new URI(protocol, template.getUserInfo(), template.getHost(), port, template.getPath(), template.getQuery(), null); }
[ "public", "static", "URI", "changeProtocolAndPort", "(", "String", "protocol", ",", "int", "port", ",", "URI", "template", ")", "throws", "URISyntaxException", "{", "return", "new", "URI", "(", "protocol", ",", "template", ".", "getUserInfo", "(", ")", ",", ...
Returns a new URI object, based on the specified URI template, with an updated port (scheme) and port. If the port number is -1, then the default port is used in the resulting URI. @param protocol the new protocol (scheme) in the resulting URI. @param port the new port in the resulting URI, or the default port if -1 is provided. @param template the source of all other values for the new URI. @return a new URI object with the updated protocol and port. @throws URISyntaxException
[ "Returns", "a", "new", "URI", "object", "based", "on", "the", "specified", "URI", "template", "with", "an", "updated", "port", "(", "scheme", ")", "and", "port", ".", "If", "the", "port", "number", "is", "-", "1", "then", "the", "default", "port", "is"...
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java#L207-L209
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.getDoubleAttribute
public Double getDoubleAttribute(String name, Double defaultValue) { return getValue(doubleAttributes, name, defaultValue); }
java
public Double getDoubleAttribute(String name, Double defaultValue) { return getValue(doubleAttributes, name, defaultValue); }
[ "public", "Double", "getDoubleAttribute", "(", "String", "name", ",", "Double", "defaultValue", ")", "{", "return", "getValue", "(", "doubleAttributes", ",", "name", ",", "defaultValue", ")", ";", "}" ]
Gets the double value of an attribute. @param name The name of the attribute. Not null. @param defaultValue The default value for the attribute. May be null. This value will be returned if this metadata object does not contain a double value for the specified attribute name. @return Either the double value of the attribute with the specified name, or the value specified by the defaultValue object if this metadata object does not contain a double value for the specified attribute name. @throws NullPointerException if name is null.
[ "Gets", "the", "double", "value", "of", "an", "attribute", "." ]
train
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L390-L392
tvesalainen/lpg
src/main/java/org/vesalainen/parser/util/Input.java
Input.getInstance
public static InputReader getInstance(Reader in, char[] shared) { Set<ParserFeature> features = NO_FEATURES; return new ReadableInput(getFeaturedReader(in, shared.length, features), shared, features); }
java
public static InputReader getInstance(Reader in, char[] shared) { Set<ParserFeature> features = NO_FEATURES; return new ReadableInput(getFeaturedReader(in, shared.length, features), shared, features); }
[ "public", "static", "InputReader", "getInstance", "(", "Reader", "in", ",", "char", "[", "]", "shared", ")", "{", "Set", "<", "ParserFeature", ">", "features", "=", "NO_FEATURES", ";", "return", "new", "ReadableInput", "(", "getFeaturedReader", "(", "in", ",...
Creates an InputReader @param in @param shared Shared ringbuffer. @return
[ "Creates", "an", "InputReader" ]
train
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/util/Input.java#L339-L343
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/blobstore/BlobStore.java
BlobStore.readBlobTo
public void readBlobTo(String key, OutputStream out) throws IOException, KeyNotFoundException { InputStreamWithMeta in = getBlob(key); if (in == null) { throw new IOException("Could not find " + key); } byte[] buffer = new byte[2048]; int len = 0; try{ while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } } finally { in.close(); out.flush(); } }
java
public void readBlobTo(String key, OutputStream out) throws IOException, KeyNotFoundException { InputStreamWithMeta in = getBlob(key); if (in == null) { throw new IOException("Could not find " + key); } byte[] buffer = new byte[2048]; int len = 0; try{ while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } } finally { in.close(); out.flush(); } }
[ "public", "void", "readBlobTo", "(", "String", "key", ",", "OutputStream", "out", ")", "throws", "IOException", ",", "KeyNotFoundException", "{", "InputStreamWithMeta", "in", "=", "getBlob", "(", "key", ")", ";", "if", "(", "in", "==", "null", ")", "{", "t...
Reads the blob from the blob store and writes it into the output stream. @param key Key for the blob. @param out Output stream privilege for the blob. @throws IOException @throws KeyNotFoundException
[ "Reads", "the", "blob", "from", "the", "blob", "store", "and", "writes", "it", "into", "the", "output", "stream", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/blobstore/BlobStore.java#L217-L232
OpenLiberty/open-liberty
dev/com.ibm.ws.filetransfer.routing.archiveExpander/src/com/ibm/ws/filetransfer/routing/archiveExpander/ArchiveExpander.java
ArchiveExpander.expandArchive
public static boolean expandArchive(String sourcePath, String targetPath) { try { return coreExpandArchive(sourcePath, targetPath); } catch (IOException e) { e.printStackTrace(System.err); return false; } }
java
public static boolean expandArchive(String sourcePath, String targetPath) { try { return coreExpandArchive(sourcePath, targetPath); } catch (IOException e) { e.printStackTrace(System.err); return false; } }
[ "public", "static", "boolean", "expandArchive", "(", "String", "sourcePath", ",", "String", "targetPath", ")", "{", "try", "{", "return", "coreExpandArchive", "(", "sourcePath", ",", "targetPath", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e...
Expand the specified archive to the specified location <p> @param sourcePath path of the archive to be expanded. @param targetPath location to where the archive is to be expanded. <p> @returns true if the archive was successfully expanded, false otherwise.
[ "Expand", "the", "specified", "archive", "to", "the", "specified", "location", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.filetransfer.routing.archiveExpander/src/com/ibm/ws/filetransfer/routing/archiveExpander/ArchiveExpander.java#L71-L78
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java
XmlUtil.mapToXml
private static void mapToXml(Document doc, Element element, Map<?, ?> data) { Element filedEle; Object key; for (Entry<?, ?> entry : data.entrySet()) { key = entry.getKey(); if (null != key) { // key作为标签名 filedEle = doc.createElement(key.toString()); element.appendChild(filedEle); final Object value = entry.getValue(); // value作为标签内的值。 if (null != value) { if (value instanceof Map) { // 如果值依旧为map,递归继续 mapToXml(doc, filedEle, (Map<?, ?>) value); element.appendChild(filedEle); } else { filedEle.appendChild(doc.createTextNode(value.toString())); } } } } }
java
private static void mapToXml(Document doc, Element element, Map<?, ?> data) { Element filedEle; Object key; for (Entry<?, ?> entry : data.entrySet()) { key = entry.getKey(); if (null != key) { // key作为标签名 filedEle = doc.createElement(key.toString()); element.appendChild(filedEle); final Object value = entry.getValue(); // value作为标签内的值。 if (null != value) { if (value instanceof Map) { // 如果值依旧为map,递归继续 mapToXml(doc, filedEle, (Map<?, ?>) value); element.appendChild(filedEle); } else { filedEle.appendChild(doc.createTextNode(value.toString())); } } } } }
[ "private", "static", "void", "mapToXml", "(", "Document", "doc", ",", "Element", "element", ",", "Map", "<", "?", ",", "?", ">", "data", ")", "{", "Element", "filedEle", ";", "Object", "key", ";", "for", "(", "Entry", "<", "?", ",", "?", ">", "entr...
将Map转换为XML格式的字符串 @param doc {@link Document} @param element 节点 @param data Map类型数据 @since 4.0.8
[ "将Map转换为XML格式的字符串" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L793-L815
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/locking/AbstractTxLockingInterceptor.java
AbstractTxLockingInterceptor.checkPendingAndLockKey
private KeyAwareLockPromise checkPendingAndLockKey(InvocationContext ctx, Object key, long lockTimeout) throws InterruptedException { final long remaining = pendingLockManager.awaitPendingTransactionsForKey((TxInvocationContext<?>) ctx, key, lockTimeout, TimeUnit.MILLISECONDS); return lockAndRecord(ctx, key, remaining); }
java
private KeyAwareLockPromise checkPendingAndLockKey(InvocationContext ctx, Object key, long lockTimeout) throws InterruptedException { final long remaining = pendingLockManager.awaitPendingTransactionsForKey((TxInvocationContext<?>) ctx, key, lockTimeout, TimeUnit.MILLISECONDS); return lockAndRecord(ctx, key, remaining); }
[ "private", "KeyAwareLockPromise", "checkPendingAndLockKey", "(", "InvocationContext", "ctx", ",", "Object", "key", ",", "long", "lockTimeout", ")", "throws", "InterruptedException", "{", "final", "long", "remaining", "=", "pendingLockManager", ".", "awaitPendingTransactio...
Besides acquiring a lock, this method also handles the following situation: 1. consistentHash("k") == {A, B}, tx1 prepared on A and B. Then node A crashed (A == single lock owner) 2. at this point tx2 which also writes "k" tries to prepare on B. 3. tx2 has to determine that "k" is already locked by another tx (i.e. tx1) and it has to wait for that tx to finish before acquiring the lock. The algorithm used at step 3 is: - the transaction table(TT) associates the current topology id with every remote and local transaction it creates - TT also keeps track of the minimal value of all the topology ids of all the transactions still present in the cache (minTopologyId) - when a tx wants to acquire lock "k": - if tx.topologyId > TT.minTopologyId then "k" might be a key whose owner crashed. If so: - obtain the list LT of transactions that started in a previous topology (txTable.getTransactionsPreparedBefore) - for each t in LT: - if t wants to write "k" then block until t finishes (CacheTransaction.waitForTransactionsToFinishIfItWritesToKey) - only then try to acquire lock on "k" - if tx.topologyId == TT.minTopologyId try to acquire lock straight away. Note: The algorithm described below only when nodes leave the cluster, so it doesn't add a performance burden when the cluster is stable.
[ "Besides", "acquiring", "a", "lock", "this", "method", "also", "handles", "the", "following", "situation", ":", "1", ".", "consistentHash", "(", "k", ")", "==", "{", "A", "B", "}", "tx1", "prepared", "on", "A", "and", "B", ".", "Then", "node", "A", "...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/locking/AbstractTxLockingInterceptor.java#L145-L149
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/spring/spel/PortalSpELServiceImpl.java
PortalSpELServiceImpl.getEvaluationContext
protected EvaluationContext getEvaluationContext(WebRequest request) { final HttpServletRequest httpRequest = this.portalRequestUtils.getOriginalPortalRequest(request); final IUserInstance userInstance = this.userInstanceManager.getUserInstance(httpRequest); final IPerson person = userInstance.getPerson(); final SpELEnvironmentRoot root = new SpELEnvironmentRoot(request, person); final StandardEvaluationContext context = new StandardEvaluationContext(root); context.setBeanResolver(this.beanResolver); return context; }
java
protected EvaluationContext getEvaluationContext(WebRequest request) { final HttpServletRequest httpRequest = this.portalRequestUtils.getOriginalPortalRequest(request); final IUserInstance userInstance = this.userInstanceManager.getUserInstance(httpRequest); final IPerson person = userInstance.getPerson(); final SpELEnvironmentRoot root = new SpELEnvironmentRoot(request, person); final StandardEvaluationContext context = new StandardEvaluationContext(root); context.setBeanResolver(this.beanResolver); return context; }
[ "protected", "EvaluationContext", "getEvaluationContext", "(", "WebRequest", "request", ")", "{", "final", "HttpServletRequest", "httpRequest", "=", "this", ".", "portalRequestUtils", ".", "getOriginalPortalRequest", "(", "request", ")", ";", "final", "IUserInstance", "...
Return a SpEL evaluation context for the supplied web request. @param request @return
[ "Return", "a", "SpEL", "evaluation", "context", "for", "the", "supplied", "web", "request", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/spring/spel/PortalSpELServiceImpl.java#L160-L170
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java
JarWriter.writeNestedLibrary
public void writeNestedLibrary(String destination, Library library) throws IOException { File file = library.getFile(); JarArchiveEntry entry = new JarArchiveEntry(destination + library.getName()); entry.setTime(getNestedLibraryTime(file)); new CrcAndSize(file).setupStoredEntry(entry); writeEntry(entry, new InputStreamEntryWriter(new FileInputStream(file), true), new LibraryUnpackHandler(library)); }
java
public void writeNestedLibrary(String destination, Library library) throws IOException { File file = library.getFile(); JarArchiveEntry entry = new JarArchiveEntry(destination + library.getName()); entry.setTime(getNestedLibraryTime(file)); new CrcAndSize(file).setupStoredEntry(entry); writeEntry(entry, new InputStreamEntryWriter(new FileInputStream(file), true), new LibraryUnpackHandler(library)); }
[ "public", "void", "writeNestedLibrary", "(", "String", "destination", ",", "Library", "library", ")", "throws", "IOException", "{", "File", "file", "=", "library", ".", "getFile", "(", ")", ";", "JarArchiveEntry", "entry", "=", "new", "JarArchiveEntry", "(", "...
Write a nested library. @param destination the destination of the library @param library the library @throws IOException if the write fails
[ "Write", "a", "nested", "library", "." ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java#L179-L187
Azure/azure-sdk-for-java
containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java
ManagedClustersInner.getAccessProfiles
public ManagedClusterAccessProfileInner getAccessProfiles(String resourceGroupName, String resourceName, String roleName) { return getAccessProfilesWithServiceResponseAsync(resourceGroupName, resourceName, roleName).toBlocking().single().body(); }
java
public ManagedClusterAccessProfileInner getAccessProfiles(String resourceGroupName, String resourceName, String roleName) { return getAccessProfilesWithServiceResponseAsync(resourceGroupName, resourceName, roleName).toBlocking().single().body(); }
[ "public", "ManagedClusterAccessProfileInner", "getAccessProfiles", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "roleName", ")", "{", "return", "getAccessProfilesWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ","...
Gets access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. @param resourceGroupName The name of the resource group. @param resourceName The name of the managed cluster resource. @param roleName The name of the role for managed cluster accessProfile resource. @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 ManagedClusterAccessProfileInner object if successful.
[ "Gets", "access", "profile", "of", "a", "managed", "cluster", ".", "Gets", "the", "accessProfile", "for", "the", "specified", "role", "name", "of", "the", "managed", "cluster", "with", "a", "specified", "resource", "group", "and", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2017_08_31/src/main/java/com/microsoft/azure/management/containerservice/v2017_08_31/implementation/ManagedClustersInner.java#L447-L449
google/closure-templates
java/src/com/google/template/soy/msgs/internal/MsgUtils.java
MsgUtils.buildMsgPartsAndComputeMsgIds
private static MsgPartsAndIds buildMsgPartsAndComputeMsgIds( MsgNode msgNode, boolean doComputeMsgIdUsingBracedPhs) { ImmutableList<SoyMsgPart> msgParts = buildMsgParts(msgNode); long msgId = SoyMsgIdComputer.computeMsgId(msgParts, msgNode.getMeaning(), msgNode.getContentType()); long msgIdUsingBracedPhs = doComputeMsgIdUsingBracedPhs ? SoyMsgIdComputer.computeMsgIdUsingBracedPhs( msgParts, msgNode.getMeaning(), msgNode.getContentType()) : -1L; return new MsgPartsAndIds(msgParts, msgId, msgIdUsingBracedPhs); }
java
private static MsgPartsAndIds buildMsgPartsAndComputeMsgIds( MsgNode msgNode, boolean doComputeMsgIdUsingBracedPhs) { ImmutableList<SoyMsgPart> msgParts = buildMsgParts(msgNode); long msgId = SoyMsgIdComputer.computeMsgId(msgParts, msgNode.getMeaning(), msgNode.getContentType()); long msgIdUsingBracedPhs = doComputeMsgIdUsingBracedPhs ? SoyMsgIdComputer.computeMsgIdUsingBracedPhs( msgParts, msgNode.getMeaning(), msgNode.getContentType()) : -1L; return new MsgPartsAndIds(msgParts, msgId, msgIdUsingBracedPhs); }
[ "private", "static", "MsgPartsAndIds", "buildMsgPartsAndComputeMsgIds", "(", "MsgNode", "msgNode", ",", "boolean", "doComputeMsgIdUsingBracedPhs", ")", "{", "ImmutableList", "<", "SoyMsgPart", ">", "msgParts", "=", "buildMsgParts", "(", "msgNode", ")", ";", "long", "m...
Builds the list of SoyMsgParts and computes the unique message id(s) for the given MsgNode. @param msgNode The message parsed from the Soy source. @param doComputeMsgIdUsingBracedPhs Whether to compute the alternate message id using braced placeholders. If set to false, then the field {@code idUsingBracedPhs} in the return value is simply set to -1L. @return A {@code MsgPartsAndIds} object.
[ "Builds", "the", "list", "of", "SoyMsgParts", "and", "computes", "the", "unique", "message", "id", "(", "s", ")", "for", "the", "given", "MsgNode", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/msgs/internal/MsgUtils.java#L126-L138
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
GraphBackedMetadataRepository.deleteTrait
@Override @GraphTransaction public void deleteTrait(String guid, String traitNameToBeDeleted) throws TraitNotFoundException, EntityNotFoundException, RepositoryException { LOG.debug("Deleting trait={} from entity={}", traitNameToBeDeleted, guid); GraphTransactionInterceptor.lockObjectAndReleasePostCommit(guid); AtlasVertex instanceVertex = graphHelper.getVertexForGUID(guid); List<String> traitNames = GraphHelper.getTraitNames(instanceVertex); if (!traitNames.contains(traitNameToBeDeleted)) { throw new TraitNotFoundException( "Could not find trait=" + traitNameToBeDeleted + " in the repository for entity: " + guid); } try { final String entityTypeName = GraphHelper.getTypeName(instanceVertex); String relationshipLabel = GraphHelper.getTraitLabel(entityTypeName, traitNameToBeDeleted); AtlasEdge edge = graphHelper.getEdgeForLabel(instanceVertex, relationshipLabel); if(edge != null) { deleteHandler.deleteEdgeReference(edge, DataTypes.TypeCategory.TRAIT, false, true); } // update the traits in entity once trait removal is successful traitNames.remove(traitNameToBeDeleted); updateTraits(instanceVertex, traitNames); } catch (Exception e) { throw new RepositoryException(e); } }
java
@Override @GraphTransaction public void deleteTrait(String guid, String traitNameToBeDeleted) throws TraitNotFoundException, EntityNotFoundException, RepositoryException { LOG.debug("Deleting trait={} from entity={}", traitNameToBeDeleted, guid); GraphTransactionInterceptor.lockObjectAndReleasePostCommit(guid); AtlasVertex instanceVertex = graphHelper.getVertexForGUID(guid); List<String> traitNames = GraphHelper.getTraitNames(instanceVertex); if (!traitNames.contains(traitNameToBeDeleted)) { throw new TraitNotFoundException( "Could not find trait=" + traitNameToBeDeleted + " in the repository for entity: " + guid); } try { final String entityTypeName = GraphHelper.getTypeName(instanceVertex); String relationshipLabel = GraphHelper.getTraitLabel(entityTypeName, traitNameToBeDeleted); AtlasEdge edge = graphHelper.getEdgeForLabel(instanceVertex, relationshipLabel); if(edge != null) { deleteHandler.deleteEdgeReference(edge, DataTypes.TypeCategory.TRAIT, false, true); } // update the traits in entity once trait removal is successful traitNames.remove(traitNameToBeDeleted); updateTraits(instanceVertex, traitNames); } catch (Exception e) { throw new RepositoryException(e); } }
[ "@", "Override", "@", "GraphTransaction", "public", "void", "deleteTrait", "(", "String", "guid", ",", "String", "traitNameToBeDeleted", ")", "throws", "TraitNotFoundException", ",", "EntityNotFoundException", ",", "RepositoryException", "{", "LOG", ".", "debug", "(",...
Deletes a given trait from an existing entity represented by a guid. @param guid globally unique identifier for the entity @param traitNameToBeDeleted name of the trait @throws RepositoryException
[ "Deletes", "a", "given", "trait", "from", "an", "existing", "entity", "represented", "by", "a", "guid", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java#L376-L404
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyEncoder.java
KeyEncoder.encodeDesc
public static int encodeDesc(BigInteger value, byte[] dst, int dstOffset) { /* Encoding of first byte: 0x00: null high (unused) 0x01: positive signum; four bytes follow for value length 0x02..0x7f: positive signum; value length 7e range, 1..126 0x80..0xfd: negative signum; value length 7e range, 1..126 0xfe: negative signum; four bytes follow for value length 0xff: null low */ if (value == null) { dst[dstOffset] = NULL_BYTE_LOW; return 1; } byte[] bytes = value.toByteArray(); // Always at least one. int bytesLength = bytes.length; int headerSize; if (bytesLength < 0x7f) { if (value.signum() < 0) { dst[dstOffset] = (byte) (bytesLength + 0x7f); } else { dst[dstOffset] = (byte) (0x80 - bytesLength); } headerSize = 1; } else { dst[dstOffset] = (byte) (value.signum() < 0 ? 0xfe : 1); int encodedLen = value.signum() < 0 ? bytesLength : -bytesLength; DataEncoder.encode(encodedLen, dst, dstOffset + 1); headerSize = 5; } dstOffset += headerSize; for (int i=0; i<bytesLength; i++) { dst[dstOffset + i] = (byte) ~bytes[i]; } return headerSize + bytesLength; }
java
public static int encodeDesc(BigInteger value, byte[] dst, int dstOffset) { /* Encoding of first byte: 0x00: null high (unused) 0x01: positive signum; four bytes follow for value length 0x02..0x7f: positive signum; value length 7e range, 1..126 0x80..0xfd: negative signum; value length 7e range, 1..126 0xfe: negative signum; four bytes follow for value length 0xff: null low */ if (value == null) { dst[dstOffset] = NULL_BYTE_LOW; return 1; } byte[] bytes = value.toByteArray(); // Always at least one. int bytesLength = bytes.length; int headerSize; if (bytesLength < 0x7f) { if (value.signum() < 0) { dst[dstOffset] = (byte) (bytesLength + 0x7f); } else { dst[dstOffset] = (byte) (0x80 - bytesLength); } headerSize = 1; } else { dst[dstOffset] = (byte) (value.signum() < 0 ? 0xfe : 1); int encodedLen = value.signum() < 0 ? bytesLength : -bytesLength; DataEncoder.encode(encodedLen, dst, dstOffset + 1); headerSize = 5; } dstOffset += headerSize; for (int i=0; i<bytesLength; i++) { dst[dstOffset + i] = (byte) ~bytes[i]; } return headerSize + bytesLength; }
[ "public", "static", "int", "encodeDesc", "(", "BigInteger", "value", ",", "byte", "[", "]", "dst", ",", "int", "dstOffset", ")", "{", "/* Encoding of first byte:\r\n\r\n 0x00: null high (unused)\r\n 0x01: positive signum; four bytes follow for value length...
Encodes the given optional BigInteger into a variable amount of bytes for descending order. If the BigInteger is null, exactly 1 byte is written. Otherwise, the amount written can be determined by calling calculateEncodedLength. @param value BigInteger value to encode, may be null @param dst destination for encoded bytes @param dstOffset offset into destination array @return amount of bytes written @since 1.2
[ "Encodes", "the", "given", "optional", "BigInteger", "into", "a", "variable", "amount", "of", "bytes", "for", "descending", "order", ".", "If", "the", "BigInteger", "is", "null", "exactly", "1", "byte", "is", "written", ".", "Otherwise", "the", "amount", "wr...
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java#L366-L407
theHilikus/JRoboCom
jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java
BoardPanel.addItem
public void addItem(Point coordinates, Drawable item) { assertEDT(); if (coordinates == null || item == null) { throw new IllegalArgumentException("Coordinates and added item cannot be null"); } log.trace("[addItem] New item added @ {}", coordinates); getPanelAt(coordinates).addModel(item); getPanelAt(coordinates).repaint(); }
java
public void addItem(Point coordinates, Drawable item) { assertEDT(); if (coordinates == null || item == null) { throw new IllegalArgumentException("Coordinates and added item cannot be null"); } log.trace("[addItem] New item added @ {}", coordinates); getPanelAt(coordinates).addModel(item); getPanelAt(coordinates).repaint(); }
[ "public", "void", "addItem", "(", "Point", "coordinates", ",", "Drawable", "item", ")", "{", "assertEDT", "(", ")", ";", "if", "(", "coordinates", "==", "null", "||", "item", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Coord...
Adds an item to draw in a particular position @param coordinates the position of the item @param item the drawable element
[ "Adds", "an", "item", "to", "draw", "in", "a", "particular", "position" ]
train
https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java#L66-L75
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.addSubListAsync
public Observable<Integer> addSubListAsync(UUID appId, String versionId, UUID clEntityId, WordListObject wordListCreateObject) { return addSubListWithServiceResponseAsync(appId, versionId, clEntityId, wordListCreateObject).map(new Func1<ServiceResponse<Integer>, Integer>() { @Override public Integer call(ServiceResponse<Integer> response) { return response.body(); } }); }
java
public Observable<Integer> addSubListAsync(UUID appId, String versionId, UUID clEntityId, WordListObject wordListCreateObject) { return addSubListWithServiceResponseAsync(appId, versionId, clEntityId, wordListCreateObject).map(new Func1<ServiceResponse<Integer>, Integer>() { @Override public Integer call(ServiceResponse<Integer> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Integer", ">", "addSubListAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ",", "WordListObject", "wordListCreateObject", ")", "{", "return", "addSubListWithServiceResponseAsync", "(", "appId", ",", "...
Adds a list to an existing closed list. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list entity extractor ID. @param wordListCreateObject Words list. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Integer object
[ "Adds", "a", "list", "to", "an", "existing", "closed", "list", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L5473-L5480
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CaffeineCacheMetrics.java
CaffeineCacheMetrics.monitor
public static <C extends Cache<?, ?>> C monitor(MeterRegistry registry, C cache, String cacheName, Iterable<Tag> tags) { new CaffeineCacheMetrics(cache, cacheName, tags).bindTo(registry); return cache; }
java
public static <C extends Cache<?, ?>> C monitor(MeterRegistry registry, C cache, String cacheName, Iterable<Tag> tags) { new CaffeineCacheMetrics(cache, cacheName, tags).bindTo(registry); return cache; }
[ "public", "static", "<", "C", "extends", "Cache", "<", "?", ",", "?", ">", ">", "C", "monitor", "(", "MeterRegistry", "registry", ",", "C", "cache", ",", "String", "cacheName", ",", "Iterable", "<", "Tag", ">", "tags", ")", "{", "new", "CaffeineCacheMe...
Record metrics on a Caffeine cache. You must call {@link Caffeine#recordStats()} prior to building the cache for metrics to be recorded. @param registry The registry to bind metrics to. @param cache The cache to instrument. @param cacheName Will be used to tag metrics with "cache". @param tags Tags to apply to all recorded metrics. @param <C> The cache type. @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way. @see CacheStats
[ "Record", "metrics", "on", "a", "Caffeine", "cache", ".", "You", "must", "call", "{", "@link", "Caffeine#recordStats", "()", "}", "prior", "to", "building", "the", "cache", "for", "metrics", "to", "be", "recorded", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CaffeineCacheMetrics.java#L83-L86
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/gpio/OrangePiPin.java
OrangePiPin.createDigitalPin
protected static Pin createDigitalPin(int address, String name) { return createDigitalPin(OrangePiGpioProvider.NAME, address, name); }
java
protected static Pin createDigitalPin(int address, String name) { return createDigitalPin(OrangePiGpioProvider.NAME, address, name); }
[ "protected", "static", "Pin", "createDigitalPin", "(", "int", "address", ",", "String", "name", ")", "{", "return", "createDigitalPin", "(", "OrangePiGpioProvider", ".", "NAME", ",", "address", ",", "name", ")", ";", "}" ]
this pin is permanently pulled up; pin pull settings do not work
[ "this", "pin", "is", "permanently", "pulled", "up", ";", "pin", "pull", "settings", "do", "not", "work" ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/gpio/OrangePiPin.java#L78-L80
app55/app55-java
src/support/java/com/googlecode/openbeans/beancontext/BeanContextServicesSupport.java
BeanContextServicesSupport.releaseService
public void releaseService(BeanContextChild child, Object requestor, Object service) { if (child == null || requestor == null || service == null) { throw new NullPointerException(); } synchronized (globalHierarchyLock) { BCSSChild bcssChild; synchronized (children) { bcssChild = (BCSSChild) children.get(child); } if (bcssChild == null) { throw new IllegalArgumentException(Messages.getString("beans.65")); } releaseServiceWithoutCheck(child, bcssChild, requestor, service, false); } }
java
public void releaseService(BeanContextChild child, Object requestor, Object service) { if (child == null || requestor == null || service == null) { throw new NullPointerException(); } synchronized (globalHierarchyLock) { BCSSChild bcssChild; synchronized (children) { bcssChild = (BCSSChild) children.get(child); } if (bcssChild == null) { throw new IllegalArgumentException(Messages.getString("beans.65")); } releaseServiceWithoutCheck(child, bcssChild, requestor, service, false); } }
[ "public", "void", "releaseService", "(", "BeanContextChild", "child", ",", "Object", "requestor", ",", "Object", "service", ")", "{", "if", "(", "child", "==", "null", "||", "requestor", "==", "null", "||", "service", "==", "null", ")", "{", "throw", "new"...
Release a service which has been requested previously. @param child the child that request the service @param requestor the requestor object @param service the service instance @throws IllegalArgumentException if <code>child</code> is not a child of this context
[ "Release", "a", "service", "which", "has", "been", "requested", "previously", "." ]
train
https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/beancontext/BeanContextServicesSupport.java#L824-L845
maestrano/maestrano-java
src/main/java/com/maestrano/net/ConnecClient.java
ConnecClient.getCollectionUrl
public String getCollectionUrl(String entityName, String groupId) { return connec.getHost() + getCollectionEndpoint(entityName, groupId); }
java
public String getCollectionUrl(String entityName, String groupId) { return connec.getHost() + getCollectionEndpoint(entityName, groupId); }
[ "public", "String", "getCollectionUrl", "(", "String", "entityName", ",", "String", "groupId", ")", "{", "return", "connec", ".", "getHost", "(", ")", "+", "getCollectionEndpoint", "(", "entityName", ",", "groupId", ")", ";", "}" ]
Return the url to the collection endpoint @param entity name @param customerW group id @return collection url
[ "Return", "the", "url", "to", "the", "collection", "endpoint" ]
train
https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/net/ConnecClient.java#L78-L80
OpenLiberty/open-liberty
dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/DiscoveredBdas.java
DiscoveredBdas.wireBdas
private void wireBdas(Collection<WebSphereBeanDeploymentArchive> wireFromBdas, Collection<WebSphereBeanDeploymentArchive> wireToBdas) { for (WebSphereBeanDeploymentArchive wireFromBda : wireFromBdas) { Collection<BeanDeploymentArchive> accessibleBdas = wireFromBda.getBeanDeploymentArchives(); for (WebSphereBeanDeploymentArchive wireToBda : wireToBdas) { if ((wireToBda != wireFromBda) && ((accessibleBdas == null) || !accessibleBdas.contains(wireToBda))) { wireFromBda.addBeanDeploymentArchive(wireToBda); } } } }
java
private void wireBdas(Collection<WebSphereBeanDeploymentArchive> wireFromBdas, Collection<WebSphereBeanDeploymentArchive> wireToBdas) { for (WebSphereBeanDeploymentArchive wireFromBda : wireFromBdas) { Collection<BeanDeploymentArchive> accessibleBdas = wireFromBda.getBeanDeploymentArchives(); for (WebSphereBeanDeploymentArchive wireToBda : wireToBdas) { if ((wireToBda != wireFromBda) && ((accessibleBdas == null) || !accessibleBdas.contains(wireToBda))) { wireFromBda.addBeanDeploymentArchive(wireToBda); } } } }
[ "private", "void", "wireBdas", "(", "Collection", "<", "WebSphereBeanDeploymentArchive", ">", "wireFromBdas", ",", "Collection", "<", "WebSphereBeanDeploymentArchive", ">", "wireToBdas", ")", "{", "for", "(", "WebSphereBeanDeploymentArchive", "wireFromBda", ":", "wireFrom...
Make a wire from the group of bdas to a set of destination bdas @param wireFromBdas the wiring from bda @param wireToBdas the wiring destination bda
[ "Make", "a", "wire", "from", "the", "group", "of", "bdas", "to", "a", "set", "of", "destination", "bdas" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/DiscoveredBdas.java#L139-L148
cdk/cdk
app/depict/src/main/java/org/openscience/cdk/depict/Dimensions.java
Dimensions.determineGrid
static Dimension determineGrid(int nElem) { switch (nElem) { case 0: return new Dimension(0, 0); case 1: return new Dimension(1, 1); case 2: return new Dimension(2, 1); case 3: return new Dimension(3, 1); case 4: return new Dimension(2, 2); case 5: return new Dimension(3, 2); case 6: return new Dimension(3, 2); case 7: return new Dimension(4, 2); case 8: return new Dimension(4, 2); case 9: return new Dimension(3, 3); default: // not great but okay int nrow = (int) Math.floor(Math.sqrt(nElem)); int ncol = (int) Math.ceil(nElem / (double) nrow); return new Dimension(ncol, nrow); } }
java
static Dimension determineGrid(int nElem) { switch (nElem) { case 0: return new Dimension(0, 0); case 1: return new Dimension(1, 1); case 2: return new Dimension(2, 1); case 3: return new Dimension(3, 1); case 4: return new Dimension(2, 2); case 5: return new Dimension(3, 2); case 6: return new Dimension(3, 2); case 7: return new Dimension(4, 2); case 8: return new Dimension(4, 2); case 9: return new Dimension(3, 3); default: // not great but okay int nrow = (int) Math.floor(Math.sqrt(nElem)); int ncol = (int) Math.ceil(nElem / (double) nrow); return new Dimension(ncol, nrow); } }
[ "static", "Dimension", "determineGrid", "(", "int", "nElem", ")", "{", "switch", "(", "nElem", ")", "{", "case", "0", ":", "return", "new", "Dimension", "(", "0", ",", "0", ")", ";", "case", "1", ":", "return", "new", "Dimension", "(", "1", ",", "1...
Determine grid size (nrow, ncol) that could be used for displaying a given number of elements. @param nElem number of elements @return grid dimensions (integers)
[ "Determine", "grid", "size", "(", "nrow", "ncol", ")", "that", "could", "be", "used", "for", "displaying", "a", "given", "number", "of", "elements", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/app/depict/src/main/java/org/openscience/cdk/depict/Dimensions.java#L122-L150
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/message/MessageBundleScriptCreator.java
MessageBundleScriptCreator.createScript
public Reader createScript(Charset charset, ResourceBundle bundle) { Properties props = new Properties(); updateProperties(bundle, props, charset); return doCreateScript(props); }
java
public Reader createScript(Charset charset, ResourceBundle bundle) { Properties props = new Properties(); updateProperties(bundle, props, charset); return doCreateScript(props); }
[ "public", "Reader", "createScript", "(", "Charset", "charset", ",", "ResourceBundle", "bundle", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "updateProperties", "(", "bundle", ",", "props", ",", "charset", ")", ";", "return", "do...
Loads the message resource bundles specified and uses a BundleStringJasonifier to generate the properties. @param charset the charset @param bundle the bundle @return the script
[ "Loads", "the", "message", "resource", "bundles", "specified", "and", "uses", "a", "BundleStringJasonifier", "to", "generate", "the", "properties", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/message/MessageBundleScriptCreator.java#L216-L221
wcm-io/wcm-io-tooling
commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/PackageManagerHelper.java
PackageManagerHelper.executePackageManagerMethodHtmlOutputResponse
public void executePackageManagerMethodHtmlOutputResponse(CloseableHttpClient httpClient, HttpRequestBase method) { PackageManagerHtmlMessageCall call = new PackageManagerHtmlMessageCall(httpClient, method, log); executeHttpCallWithRetry(call, 0); }
java
public void executePackageManagerMethodHtmlOutputResponse(CloseableHttpClient httpClient, HttpRequestBase method) { PackageManagerHtmlMessageCall call = new PackageManagerHtmlMessageCall(httpClient, method, log); executeHttpCallWithRetry(call, 0); }
[ "public", "void", "executePackageManagerMethodHtmlOutputResponse", "(", "CloseableHttpClient", "httpClient", ",", "HttpRequestBase", "method", ")", "{", "PackageManagerHtmlMessageCall", "call", "=", "new", "PackageManagerHtmlMessageCall", "(", "httpClient", ",", "method", ","...
Execute CRX HTTP Package manager method and output HTML response. @param httpClient Http client @param method Get or Post method
[ "Execute", "CRX", "HTTP", "Package", "manager", "method", "and", "output", "HTML", "response", "." ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/PackageManagerHelper.java#L253-L256
jenkinsci/jenkins
core/src/main/java/hudson/model/Executor.java
Executor.recordCauseOfInterruption
public void recordCauseOfInterruption(Run<?,?> build, TaskListener listener) { List<CauseOfInterruption> r; // atomically get&clear causes. lock.writeLock().lock(); try { if (causes.isEmpty()) return; r = new ArrayList<>(causes); causes.clear(); } finally { lock.writeLock().unlock(); } build.addAction(new InterruptedBuildAction(r)); for (CauseOfInterruption c : r) c.print(listener); }
java
public void recordCauseOfInterruption(Run<?,?> build, TaskListener listener) { List<CauseOfInterruption> r; // atomically get&clear causes. lock.writeLock().lock(); try { if (causes.isEmpty()) return; r = new ArrayList<>(causes); causes.clear(); } finally { lock.writeLock().unlock(); } build.addAction(new InterruptedBuildAction(r)); for (CauseOfInterruption c : r) c.print(listener); }
[ "public", "void", "recordCauseOfInterruption", "(", "Run", "<", "?", ",", "?", ">", "build", ",", "TaskListener", "listener", ")", "{", "List", "<", "CauseOfInterruption", ">", "r", ";", "// atomically get&clear causes.", "lock", ".", "writeLock", "(", ")", "....
report cause of interruption and record it to the build, if available. @since 1.425
[ "report", "cause", "of", "interruption", "and", "record", "it", "to", "the", "build", "if", "available", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Executor.java#L267-L283
Devskiller/jfairy
src/main/java/com/devskiller/jfairy/producer/BaseProducer.java
BaseProducer.randomElements
public <T> List<T> randomElements(List<T> elements, int count) { if (elements.size() >= count) { return extractRandomList(elements, count); } else { List<T> randomElements = new ArrayList<T>(); randomElements.addAll(extractRandomList(elements, count % elements.size())); do { randomElements.addAll(extractRandomList(elements, elements.size())); } while (randomElements.size() < count); return randomElements; } }
java
public <T> List<T> randomElements(List<T> elements, int count) { if (elements.size() >= count) { return extractRandomList(elements, count); } else { List<T> randomElements = new ArrayList<T>(); randomElements.addAll(extractRandomList(elements, count % elements.size())); do { randomElements.addAll(extractRandomList(elements, elements.size())); } while (randomElements.size() < count); return randomElements; } }
[ "public", "<", "T", ">", "List", "<", "T", ">", "randomElements", "(", "List", "<", "T", ">", "elements", ",", "int", "count", ")", "{", "if", "(", "elements", ".", "size", "(", ")", ">=", "count", ")", "{", "return", "extractRandomList", "(", "ele...
Creates new list being random subset of the passed list @param <T> element generic type @param elements list to process @param count returned list size @return sublist of the elements list
[ "Creates", "new", "list", "being", "random", "subset", "of", "the", "passed", "list" ]
train
https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/producer/BaseProducer.java#L68-L79
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java
JdbcCpoXaAdapter.retrieveBean
@Override public <T> T retrieveBean(String name, T bean) throws CpoException { return getCurrentResource().retrieveBean(name, bean); }
java
@Override public <T> T retrieveBean(String name, T bean) throws CpoException { return getCurrentResource().retrieveBean(name, bean); }
[ "@", "Override", "public", "<", "T", ">", "T", "retrieveBean", "(", "String", "name", ",", "T", "bean", ")", "throws", "CpoException", "{", "return", "getCurrentResource", "(", ")", ".", "retrieveBean", "(", "name", ",", "bean", ")", ";", "}" ]
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve function defined for this beans returns more than one row, an exception will be thrown. @param name DOCUMENT ME! @param bean This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. The input bean is used to specify the search criteria, the output bean is populated with the results of the function. @return An bean of the same type as the result parameter that is filled in as specified the metadata for the retireve. @throws CpoException Thrown if there are errors accessing the datasource
[ "Retrieves", "the", "bean", "from", "the", "datasource", ".", "The", "assumption", "is", "that", "the", "bean", "exists", "in", "the", "datasource", ".", "If", "the", "retrieve", "function", "defined", "for", "this", "beans", "returns", "more", "than", "one"...
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L1290-L1293
hal/core
ace/src/main/java/edu/ycp/cs/dh/acegwt/client/ace/AceEditor.java
AceEditor.addAnnotation
public void addAnnotation(final int row, final int column, final String text, final AceAnnotationType type) { annotations.push(AceAnnotation.create(row, column, text, type.getName())); }
java
public void addAnnotation(final int row, final int column, final String text, final AceAnnotationType type) { annotations.push(AceAnnotation.create(row, column, text, type.getName())); }
[ "public", "void", "addAnnotation", "(", "final", "int", "row", ",", "final", "int", "column", ",", "final", "String", "text", ",", "final", "AceAnnotationType", "type", ")", "{", "annotations", ".", "push", "(", "AceAnnotation", ".", "create", "(", "row", ...
Add an annotation to a the local <code>annotations</code> JsArray<AceAnnotation>, but does not set it on the editor @param row to which the annotation should be added @param column to which the annotation applies @param text to display as a tooltip with the annotation @param type to be displayed (one of the values in the {@link AceAnnotationType} enumeration)
[ "Add", "an", "annotation", "to", "a", "the", "local", "<code", ">", "annotations<", "/", "code", ">", "JsArray<AceAnnotation", ">", "but", "does", "not", "set", "it", "on", "the", "editor" ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/ace/src/main/java/edu/ycp/cs/dh/acegwt/client/ace/AceEditor.java#L376-L378
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_miniPabx_serviceName_hunting_agent_agentNumber_PUT
public void billingAccount_miniPabx_serviceName_hunting_agent_agentNumber_PUT(String billingAccount, String serviceName, String agentNumber, OvhEasyMiniPabxHuntingAgent body) throws IOException { String qPath = "/telephony/{billingAccount}/miniPabx/{serviceName}/hunting/agent/{agentNumber}"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentNumber); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_miniPabx_serviceName_hunting_agent_agentNumber_PUT(String billingAccount, String serviceName, String agentNumber, OvhEasyMiniPabxHuntingAgent body) throws IOException { String qPath = "/telephony/{billingAccount}/miniPabx/{serviceName}/hunting/agent/{agentNumber}"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentNumber); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_miniPabx_serviceName_hunting_agent_agentNumber_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "String", "agentNumber", ",", "OvhEasyMiniPabxHuntingAgent", "body", ")", "throws", "IOException", "{", "String", "qPath"...
Alter this object properties REST: PUT /telephony/{billingAccount}/miniPabx/{serviceName}/hunting/agent/{agentNumber} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param agentNumber [required] The phone number of the agent
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5255-L5259
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationBinary.java
EvaluationBinary.scoreForMetric
public double scoreForMetric(Metric metric, int outputNum){ switch (metric){ case ACCURACY: return accuracy(outputNum); case F1: return f1(outputNum); case PRECISION: return precision(outputNum); case RECALL: return recall(outputNum); case GMEASURE: return gMeasure(outputNum); case MCC: return matthewsCorrelation(outputNum); case FAR: return falseAlarmRate(outputNum); default: throw new IllegalStateException("Unknown metric: " + metric); } }
java
public double scoreForMetric(Metric metric, int outputNum){ switch (metric){ case ACCURACY: return accuracy(outputNum); case F1: return f1(outputNum); case PRECISION: return precision(outputNum); case RECALL: return recall(outputNum); case GMEASURE: return gMeasure(outputNum); case MCC: return matthewsCorrelation(outputNum); case FAR: return falseAlarmRate(outputNum); default: throw new IllegalStateException("Unknown metric: " + metric); } }
[ "public", "double", "scoreForMetric", "(", "Metric", "metric", ",", "int", "outputNum", ")", "{", "switch", "(", "metric", ")", "{", "case", "ACCURACY", ":", "return", "accuracy", "(", "outputNum", ")", ";", "case", "F1", ":", "return", "f1", "(", "outpu...
Calculate specific metric (see {@link Metric}) for a given label. @param metric The Metric to calculate. @param outputNum Class index to calculate. @return Calculated metric.
[ "Calculate", "specific", "metric", "(", "see", "{", "@link", "Metric", "}", ")", "for", "a", "given", "label", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationBinary.java#L640-L659
apache/incubator-heron
heron/metricsmgr/src/java/org/apache/heron/metricsmgr/sink/AbstractWebSink.java
AbstractWebSink.startHttpServer
protected void startHttpServer(String path, int port) { try { httpServer = HttpServer.create(new InetSocketAddress(port), 0); httpServer.createContext(path, httpExchange -> { byte[] response = generateResponse(); httpExchange.sendResponseHeaders(HTTP_STATUS_OK, response.length); OutputStream os = httpExchange.getResponseBody(); os.write(response); os.close(); LOG.log(Level.INFO, "Received metrics request."); }); LOG.info("Starting web sink server on port: " + port); httpServer.start(); } catch (IOException e) { throw new RuntimeException("Failed to create Http server on port " + port, e); } }
java
protected void startHttpServer(String path, int port) { try { httpServer = HttpServer.create(new InetSocketAddress(port), 0); httpServer.createContext(path, httpExchange -> { byte[] response = generateResponse(); httpExchange.sendResponseHeaders(HTTP_STATUS_OK, response.length); OutputStream os = httpExchange.getResponseBody(); os.write(response); os.close(); LOG.log(Level.INFO, "Received metrics request."); }); LOG.info("Starting web sink server on port: " + port); httpServer.start(); } catch (IOException e) { throw new RuntimeException("Failed to create Http server on port " + port, e); } }
[ "protected", "void", "startHttpServer", "(", "String", "path", ",", "int", "port", ")", "{", "try", "{", "httpServer", "=", "HttpServer", ".", "create", "(", "new", "InetSocketAddress", "(", "port", ")", ",", "0", ")", ";", "httpServer", ".", "createContex...
Start a http server on supplied port that will serve the metrics, as json, on the specified path. @param path @param port
[ "Start", "a", "http", "server", "on", "supplied", "port", "that", "will", "serve", "the", "metrics", "as", "json", "on", "the", "specified", "path", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/metricsmgr/src/java/org/apache/heron/metricsmgr/sink/AbstractWebSink.java#L129-L145
haraldk/TwelveMonkeys
common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java
CollectionUtil.mergeArrays
public static Object mergeArrays(Object pArray1, Object pArray2) { return mergeArrays(pArray1, 0, Array.getLength(pArray1), pArray2, 0, Array.getLength(pArray2)); }
java
public static Object mergeArrays(Object pArray1, Object pArray2) { return mergeArrays(pArray1, 0, Array.getLength(pArray1), pArray2, 0, Array.getLength(pArray2)); }
[ "public", "static", "Object", "mergeArrays", "(", "Object", "pArray1", ",", "Object", "pArray2", ")", "{", "return", "mergeArrays", "(", "pArray1", ",", "0", ",", "Array", ".", "getLength", "(", "pArray1", ")", ",", "pArray2", ",", "0", ",", "Array", "."...
Merges two arrays into a new array. Elements from array1 and array2 will be copied into a new array, that has array1.length + array2.length elements. @param pArray1 First array @param pArray2 Second array, must be compatible with (assignable from) the first array @return A new array, containing the values of array1 and array2. The array (wrapped as an object), will have the length of array1 + array2, and can be safely cast to the type of the array1 parameter. @see #mergeArrays(Object,int,int,Object,int,int) @see java.lang.System#arraycopy(Object,int,Object,int,int)
[ "Merges", "two", "arrays", "into", "a", "new", "array", ".", "Elements", "from", "array1", "and", "array2", "will", "be", "copied", "into", "a", "new", "array", "that", "has", "array1", ".", "length", "+", "array2", ".", "length", "elements", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java#L225-L227
ops4j/org.ops4j.pax.wicket
service/src/main/java/org/ops4j/pax/wicket/spi/support/AbstractPaxWicketInjector.java
AbstractPaxWicketInjector.setField
protected void setField(Object component, Field field, Object proxy) { try { checkAccessabilityOfField(field); field.set(component, proxy); } catch (Exception e) { throw new RuntimeException("Bumm", e); } }
java
protected void setField(Object component, Field field, Object proxy) { try { checkAccessabilityOfField(field); field.set(component, proxy); } catch (Exception e) { throw new RuntimeException("Bumm", e); } }
[ "protected", "void", "setField", "(", "Object", "component", ",", "Field", "field", ",", "Object", "proxy", ")", "{", "try", "{", "checkAccessabilityOfField", "(", "field", ")", ";", "field", ".", "set", "(", "component", ",", "proxy", ")", ";", "}", "ca...
<p>setField.</p> @param component a {@link java.lang.Object} object. @param field a {@link java.lang.reflect.Field} object. @param proxy a {@link java.lang.Object} object.
[ "<p", ">", "setField", ".", "<", "/", "p", ">" ]
train
https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/spi/support/AbstractPaxWicketInjector.java#L102-L109
OpenLiberty/open-liberty
dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java
MongoServerSelector.validateMongoConnection
private static boolean validateMongoConnection(ExternalTestService mongoService) { String method = "validateMongoConnection"; MongoClient mongoClient = null; String host = mongoService.getAddress(); int port = mongoService.getPort(); File trustStore = null; MongoClientOptions.Builder optionsBuilder = new MongoClientOptions.Builder().connectTimeout(30000); try { trustStore = File.createTempFile("mongoTrustStore", "jks"); Map<String, String> serviceProperties = mongoService.getProperties(); String password = serviceProperties.get(TEST_USERNAME + "_password"); // will be null if there's no auth for this server SSLSocketFactory sslSocketFactory = null; try { mongoService.writePropertyAsFile("ca_truststore", trustStore); sslSocketFactory = getSocketFactory(trustStore); } catch (IllegalStateException e) { // Ignore exception thrown if truststore is not present for this server // This indicates that we are not using SSL for this server and sslSocketFactory will be null } if (sslSocketFactory != null) { optionsBuilder.socketFactory(sslSocketFactory); } MongoClientOptions clientOptions = optionsBuilder.build(); List<MongoCredential> credentials = Collections.emptyList(); if (password != null) { MongoCredential credential = MongoCredential.createCredential(TEST_USERNAME, TEST_DATABASE, password.toCharArray()); credentials = Collections.singletonList(credential); } Log.info(c, method, "Attempting to contact server " + host + ":" + port + " with password " + (password != null ? "set" : "not set") + " and truststore " + (sslSocketFactory != null ? "set" : "not set")); mongoClient = new MongoClient(new ServerAddress(host, port), credentials, clientOptions); mongoClient.getDB("default").getCollectionNames(); mongoClient.close(); } catch (Exception e) { Log.info(c, method, "Couldn't create a connection to " + mongoService.getServiceName() + " on " + mongoService.getAddress() + ". " + e.toString()); mongoService.reportUnhealthy("Couldn't connect to server. Exception: " + e.toString()); return false; } finally { if (trustStore != null) { trustStore.delete(); } } return true; }
java
private static boolean validateMongoConnection(ExternalTestService mongoService) { String method = "validateMongoConnection"; MongoClient mongoClient = null; String host = mongoService.getAddress(); int port = mongoService.getPort(); File trustStore = null; MongoClientOptions.Builder optionsBuilder = new MongoClientOptions.Builder().connectTimeout(30000); try { trustStore = File.createTempFile("mongoTrustStore", "jks"); Map<String, String> serviceProperties = mongoService.getProperties(); String password = serviceProperties.get(TEST_USERNAME + "_password"); // will be null if there's no auth for this server SSLSocketFactory sslSocketFactory = null; try { mongoService.writePropertyAsFile("ca_truststore", trustStore); sslSocketFactory = getSocketFactory(trustStore); } catch (IllegalStateException e) { // Ignore exception thrown if truststore is not present for this server // This indicates that we are not using SSL for this server and sslSocketFactory will be null } if (sslSocketFactory != null) { optionsBuilder.socketFactory(sslSocketFactory); } MongoClientOptions clientOptions = optionsBuilder.build(); List<MongoCredential> credentials = Collections.emptyList(); if (password != null) { MongoCredential credential = MongoCredential.createCredential(TEST_USERNAME, TEST_DATABASE, password.toCharArray()); credentials = Collections.singletonList(credential); } Log.info(c, method, "Attempting to contact server " + host + ":" + port + " with password " + (password != null ? "set" : "not set") + " and truststore " + (sslSocketFactory != null ? "set" : "not set")); mongoClient = new MongoClient(new ServerAddress(host, port), credentials, clientOptions); mongoClient.getDB("default").getCollectionNames(); mongoClient.close(); } catch (Exception e) { Log.info(c, method, "Couldn't create a connection to " + mongoService.getServiceName() + " on " + mongoService.getAddress() + ". " + e.toString()); mongoService.reportUnhealthy("Couldn't connect to server. Exception: " + e.toString()); return false; } finally { if (trustStore != null) { trustStore.delete(); } } return true; }
[ "private", "static", "boolean", "validateMongoConnection", "(", "ExternalTestService", "mongoService", ")", "{", "String", "method", "=", "\"validateMongoConnection\"", ";", "MongoClient", "mongoClient", "=", "null", ";", "String", "host", "=", "mongoService", ".", "g...
Creates a connection to the mongo server at the given location using the mongo java client. @param location @param auth @param encrypted @return @throws Exception
[ "Creates", "a", "connection", "to", "the", "mongo", "server", "at", "the", "given", "location", "using", "the", "mongo", "java", "client", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo_fat/fat/src/com/ibm/ws/mongo/fat/MongoServerSelector.java#L190-L242
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/Environment.java
Environment.doHttpPut
public void doHttpPut(String url, HttpResponse result, Map<String, Object> headers, String contentType) { httpClient.put(url, result, headers, contentType); }
java
public void doHttpPut(String url, HttpResponse result, Map<String, Object> headers, String contentType) { httpClient.put(url, result, headers, contentType); }
[ "public", "void", "doHttpPut", "(", "String", "url", ",", "HttpResponse", "result", ",", "Map", "<", "String", ",", "Object", ">", "headers", ",", "String", "contentType", ")", "{", "httpClient", ".", "put", "(", "url", ",", "result", ",", "headers", ","...
Performs PUT to supplied url of result's request. @param url url to put to. @param result result containing request, its response will be filled. @param headers headers to add. @param contentType contentType for request.
[ "Performs", "PUT", "to", "supplied", "url", "of", "result", "s", "request", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L344-L346
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/LowLevelMultiViewOps.java
LowLevelMultiViewOps.computeNormalizationLL
public static void computeNormalizationLL(List<List<Point2D_F64>> points, NormalizationPoint2D normalize ) { double meanX = 0; double meanY = 0; int count = 0; for (int i = 0; i < points.size(); i++) { List<Point2D_F64> l = points.get(i); for (int j = 0; j < l.size(); j++) { Point2D_F64 p = l.get(j); meanX += p.x; meanY += p.y; } count += l.size(); } meanX /= count; meanY /= count; double stdX = 0; double stdY = 0; for (int i = 0; i < points.size(); i++) { List<Point2D_F64> l = points.get(i); for (int j = 0; j < l.size(); j++) { Point2D_F64 p = l.get(j); double dx = p.x - meanX; double dy = p.y - meanY; stdX += dx*dx; stdY += dy*dy; } } normalize.meanX = meanX; normalize.meanY = meanY; normalize.stdX = Math.sqrt(stdX/count); normalize.stdY = Math.sqrt(stdY/count); }
java
public static void computeNormalizationLL(List<List<Point2D_F64>> points, NormalizationPoint2D normalize ) { double meanX = 0; double meanY = 0; int count = 0; for (int i = 0; i < points.size(); i++) { List<Point2D_F64> l = points.get(i); for (int j = 0; j < l.size(); j++) { Point2D_F64 p = l.get(j); meanX += p.x; meanY += p.y; } count += l.size(); } meanX /= count; meanY /= count; double stdX = 0; double stdY = 0; for (int i = 0; i < points.size(); i++) { List<Point2D_F64> l = points.get(i); for (int j = 0; j < l.size(); j++) { Point2D_F64 p = l.get(j); double dx = p.x - meanX; double dy = p.y - meanY; stdX += dx*dx; stdY += dy*dy; } } normalize.meanX = meanX; normalize.meanY = meanY; normalize.stdX = Math.sqrt(stdX/count); normalize.stdY = Math.sqrt(stdY/count); }
[ "public", "static", "void", "computeNormalizationLL", "(", "List", "<", "List", "<", "Point2D_F64", ">", ">", "points", ",", "NormalizationPoint2D", "normalize", ")", "{", "double", "meanX", "=", "0", ";", "double", "meanY", "=", "0", ";", "int", "count", ...
Computes normalization when points are contained in a list of lists @param points Input: List of observed points. Not modified. @param normalize Output: 3x3 normalization matrix for first set of points. Modified.
[ "Computes", "normalization", "when", "points", "are", "contained", "in", "a", "list", "of", "lists" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/LowLevelMultiViewOps.java#L82-L121
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java
Utility.fromHex
public static String fromHex(String string, int minLength, Pattern separator) { StringBuilder buffer = new StringBuilder(); String[] parts = separator.split(string); for (String part : parts) { if (part.length() < minLength) { throw new IllegalArgumentException("code point too short: " + part); } int cp = Integer.parseInt(part, 16); buffer.appendCodePoint(cp); } return buffer.toString(); }
java
public static String fromHex(String string, int minLength, Pattern separator) { StringBuilder buffer = new StringBuilder(); String[] parts = separator.split(string); for (String part : parts) { if (part.length() < minLength) { throw new IllegalArgumentException("code point too short: " + part); } int cp = Integer.parseInt(part, 16); buffer.appendCodePoint(cp); } return buffer.toString(); }
[ "public", "static", "String", "fromHex", "(", "String", "string", ",", "int", "minLength", ",", "Pattern", "separator", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "String", "[", "]", "parts", "=", "separator", ".", "sp...
Parse a list of hex numbers and return a string @param string String of hex numbers. @param minLength Minimal length. @param separator Separator. @return A string from hex numbers.
[ "Parse", "a", "list", "of", "hex", "numbers", "and", "return", "a", "string" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L1802-L1813
dihedron/dihedron-commons
src/main/java/org/dihedron/core/formatters/BitMask.java
BitMask.toBitMask
private static <T extends Number> String toBitMask(T bitmask, int length) { StringBuilder buffer = new StringBuilder(); long bit = 1; for(int i = 0; i < length; ++i) { if(i != 0 && i % 8 == 0) { buffer.append(" "); } else if(i != 0 && i % 4 == 0) { buffer.append(":"); } if((bit & bitmask.longValue()) == bit) { buffer.append("1"); } else { buffer.append("0"); } bit = bit << 1; } return buffer.reverse().toString(); }
java
private static <T extends Number> String toBitMask(T bitmask, int length) { StringBuilder buffer = new StringBuilder(); long bit = 1; for(int i = 0; i < length; ++i) { if(i != 0 && i % 8 == 0) { buffer.append(" "); } else if(i != 0 && i % 4 == 0) { buffer.append(":"); } if((bit & bitmask.longValue()) == bit) { buffer.append("1"); } else { buffer.append("0"); } bit = bit << 1; } return buffer.reverse().toString(); }
[ "private", "static", "<", "T", "extends", "Number", ">", "String", "toBitMask", "(", "T", "bitmask", ",", "int", "length", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "long", "bit", "=", "1", ";", "for", "(", "int",...
Parametric version of the method, which dumps any number as bitmask. @param bitmask the number to be formatted as a bitmask. @param length the length (in bits) of the type (e.g. int's are 32 bits). @return a bitmask (1's and 0's) representation of the given Number.
[ "Parametric", "version", "of", "the", "method", "which", "dumps", "any", "number", "as", "bitmask", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/formatters/BitMask.java#L74-L91
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
HtmlTableRendererBase.encodeBegin
public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException { RendererUtils.checkParamValidity(facesContext, uiComponent, UIData.class); Map<String, List<ClientBehavior>> behaviors = null; if (uiComponent instanceof ClientBehaviorHolder) { behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors(); if (!behaviors.isEmpty()) { ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext, facesContext.getResponseWriter()); } } beforeTable(facesContext, (UIData) uiComponent); startTable(facesContext, uiComponent); }
java
public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException { RendererUtils.checkParamValidity(facesContext, uiComponent, UIData.class); Map<String, List<ClientBehavior>> behaviors = null; if (uiComponent instanceof ClientBehaviorHolder) { behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors(); if (!behaviors.isEmpty()) { ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext, facesContext.getResponseWriter()); } } beforeTable(facesContext, (UIData) uiComponent); startTable(facesContext, uiComponent); }
[ "public", "void", "encodeBegin", "(", "FacesContext", "facesContext", ",", "UIComponent", "uiComponent", ")", "throws", "IOException", "{", "RendererUtils", ".", "checkParamValidity", "(", "facesContext", ",", "uiComponent", ",", "UIData", ".", "class", ")", ";", ...
Render the necessary bits that come before any actual <i>rows</i> in the table. @see javax.faces.render.Renderer#encodeBegin(FacesContext, UIComponent)
[ "Render", "the", "necessary", "bits", "that", "come", "before", "any", "actual", "<i", ">", "rows<", "/", "i", ">", "in", "the", "table", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java#L111-L128
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java
TreeUtil.findComponentsByClass
public static List<ComponentWithContext> findComponentsByClass(final WComponent root, final String className, final boolean includeRoot, final boolean visibleOnly) { FindComponentsByClassVisitor visitor = new FindComponentsByClassVisitor(root, className, includeRoot); doTraverse(root, visibleOnly, visitor); return visitor.getResult() == null ? Collections.EMPTY_LIST : visitor.getResult(); }
java
public static List<ComponentWithContext> findComponentsByClass(final WComponent root, final String className, final boolean includeRoot, final boolean visibleOnly) { FindComponentsByClassVisitor visitor = new FindComponentsByClassVisitor(root, className, includeRoot); doTraverse(root, visibleOnly, visitor); return visitor.getResult() == null ? Collections.EMPTY_LIST : visitor.getResult(); }
[ "public", "static", "List", "<", "ComponentWithContext", ">", "findComponentsByClass", "(", "final", "WComponent", "root", ",", "final", "String", "className", ",", "final", "boolean", "includeRoot", ",", "final", "boolean", "visibleOnly", ")", "{", "FindComponentsB...
Search for components implementing a particular class name. @param root the root component to search from @param className the class name to search for @param includeRoot check the root component as well @param visibleOnly true if process visible only @return the list of components implementing the class name
[ "Search", "for", "components", "implementing", "a", "particular", "class", "name", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java#L107-L115
kotcrab/vis-ui
usl/src/main/java/com/kotcrab/vis/usl/CollectionUtils.java
CollectionUtils.isEqualCollection
public static boolean isEqualCollection (final Collection a, final Collection b) { if (a.size() != b.size()) { return false; } else { Map mapa = getCardinalityMap(a); Map mapb = getCardinalityMap(b); if (mapa.size() != mapb.size()) { return false; } else { Iterator it = mapa.keySet().iterator(); while (it.hasNext()) { Object obj = it.next(); if (getFreq(obj, mapa) != getFreq(obj, mapb)) { return false; } } return true; } } }
java
public static boolean isEqualCollection (final Collection a, final Collection b) { if (a.size() != b.size()) { return false; } else { Map mapa = getCardinalityMap(a); Map mapb = getCardinalityMap(b); if (mapa.size() != mapb.size()) { return false; } else { Iterator it = mapa.keySet().iterator(); while (it.hasNext()) { Object obj = it.next(); if (getFreq(obj, mapa) != getFreq(obj, mapb)) { return false; } } return true; } } }
[ "public", "static", "boolean", "isEqualCollection", "(", "final", "Collection", "a", ",", "final", "Collection", "b", ")", "{", "if", "(", "a", ".", "size", "(", ")", "!=", "b", ".", "size", "(", ")", ")", "{", "return", "false", ";", "}", "else", ...
Returns <tt>true</tt> iff the given {@link Collection}s contain exactly the same elements with exactly the same cardinality. <p> That is, iff the cardinality of <i>e</i> in <i>a</i> is equal to the cardinality of <i>e</i> in <i>b</i>, for each element <i>e</i> in <i>a</i> or <i>b</i>.
[ "Returns", "<tt", ">", "true<", "/", "tt", ">", "iff", "the", "given", "{" ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/usl/src/main/java/com/kotcrab/vis/usl/CollectionUtils.java#L32-L51
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FastSerializer.java
FastSerializer.writeString
public static void writeString(String string, ByteBuffer buffer) throws IOException { if (string == null) { buffer.putInt(VoltType.NULL_STRING_LENGTH); return; } byte[] strbytes = string.getBytes(Constants.UTF8ENCODING); int len = strbytes.length; buffer.putInt(len); buffer.put(strbytes); }
java
public static void writeString(String string, ByteBuffer buffer) throws IOException { if (string == null) { buffer.putInt(VoltType.NULL_STRING_LENGTH); return; } byte[] strbytes = string.getBytes(Constants.UTF8ENCODING); int len = strbytes.length; buffer.putInt(len); buffer.put(strbytes); }
[ "public", "static", "void", "writeString", "(", "String", "string", ",", "ByteBuffer", "buffer", ")", "throws", "IOException", "{", "if", "(", "string", "==", "null", ")", "{", "buffer", ".", "putInt", "(", "VoltType", ".", "NULL_STRING_LENGTH", ")", ";", ...
Write a string in the standard VoltDB way without wrapping the byte buffer.
[ "Write", "a", "string", "in", "the", "standard", "VoltDB", "way", "without", "wrapping", "the", "byte", "buffer", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FastSerializer.java#L230-L241
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/msg/ModbusRequest.java
ModbusRequest.updateResponseWithHeader
ModbusResponse updateResponseWithHeader(ModbusResponse response, boolean ignoreFunctionCode) { // transfer header data response.setHeadless(isHeadless()); if (!isHeadless()) { response.setTransactionID(getTransactionID()); response.setProtocolID(getProtocolID()); } else { response.setHeadless(); } response.setUnitID(getUnitID()); if (!ignoreFunctionCode) { response.setFunctionCode(getFunctionCode()); } return response; }
java
ModbusResponse updateResponseWithHeader(ModbusResponse response, boolean ignoreFunctionCode) { // transfer header data response.setHeadless(isHeadless()); if (!isHeadless()) { response.setTransactionID(getTransactionID()); response.setProtocolID(getProtocolID()); } else { response.setHeadless(); } response.setUnitID(getUnitID()); if (!ignoreFunctionCode) { response.setFunctionCode(getFunctionCode()); } return response; }
[ "ModbusResponse", "updateResponseWithHeader", "(", "ModbusResponse", "response", ",", "boolean", "ignoreFunctionCode", ")", "{", "// transfer header data", "response", ".", "setHeadless", "(", "isHeadless", "(", ")", ")", ";", "if", "(", "!", "isHeadless", "(", ")",...
Updates the response with the header information to match the request @param response Response to update @param ignoreFunctionCode True if the function code should stay unmolested @return Updated response
[ "Updates", "the", "response", "with", "the", "header", "information", "to", "match", "the", "request" ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/msg/ModbusRequest.java#L172-L188
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java
JobsInner.suspendAsync
public Observable<Void> suspendAsync(String resourceGroupName, String automationAccountName, UUID jobId) { return suspendWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> suspendAsync(String resourceGroupName, String automationAccountName, UUID jobId) { return suspendWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "suspendAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "UUID", "jobId", ")", "{", "return", "suspendWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ","...
Suspend the job identified by jobId. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobId The job id. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Suspend", "the", "job", "identified", "by", "jobId", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java#L327-L334
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.getTroubleshootingAsync
public Observable<TroubleshootingResultInner> getTroubleshootingAsync(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters) { return getTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<TroubleshootingResultInner>, TroubleshootingResultInner>() { @Override public TroubleshootingResultInner call(ServiceResponse<TroubleshootingResultInner> response) { return response.body(); } }); }
java
public Observable<TroubleshootingResultInner> getTroubleshootingAsync(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters) { return getTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<TroubleshootingResultInner>, TroubleshootingResultInner>() { @Override public TroubleshootingResultInner call(ServiceResponse<TroubleshootingResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TroubleshootingResultInner", ">", "getTroubleshootingAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "TroubleshootingParameters", "parameters", ")", "{", "return", "getTroubleshootingWithServiceResponseAsync", ...
Initiate troubleshooting on a specified resource. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that define the resource to troubleshoot. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Initiate", "troubleshooting", "on", "a", "specified", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1491-L1498
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/context/GenericsContext.java
GenericsContext.ownerGenericsMap
public Map<String, Type> ownerGenericsMap() { return ownerGenerics.isEmpty() ? Collections.<String, Type>emptyMap() : new LinkedHashMap<String, Type>(ownerGenerics); }
java
public Map<String, Type> ownerGenericsMap() { return ownerGenerics.isEmpty() ? Collections.<String, Type>emptyMap() : new LinkedHashMap<String, Type>(ownerGenerics); }
[ "public", "Map", "<", "String", ",", "Type", ">", "ownerGenericsMap", "(", ")", "{", "return", "ownerGenerics", ".", "isEmpty", "(", ")", "?", "Collections", ".", "<", "String", ",", "Type", ">", "emptyMap", "(", ")", ":", "new", "LinkedHashMap", "<", ...
Inner class may use outer generics like this: <pre>{@code class Owner<T> { class Inner { T field; } }}</pre>. <p> NOTE: contains only owner type generics, not hidden by inner class generics. For example: <pre>{@code class Owner<T, K> { // hides outer generic class Inner<T> {} }}</pre> Here {@code ownerGenericsMap() == ["K": Object]} because owner generic "T" is overridden by inner class declaration. <p> In method or constructor contexts, context specific generics may also override owner generics (e.g. {@code <T> T method();}), but still all reachable by class owner generics wll be returned. This is done for consistency: no matter what context, method will return the same map. The only exception is {@link #visibleGenericsMap()} which return only actually visible generics from current context (class, method or constructor). @return reachable owner type generics if context type is inner class or empty map if not inner class or outer type does not contains generics @see #ownerClass()
[ "Inner", "class", "may", "use", "outer", "generics", "like", "this", ":", "<pre", ">", "{", "@code", "class", "Owner<T", ">", "{", "class", "Inner", "{", "T", "field", ";", "}", "}}", "<", "/", "pre", ">", ".", "<p", ">", "NOTE", ":", "contains", ...
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/context/GenericsContext.java#L117-L120
amzn/ion-java
src/com/amazon/ion/impl/lite/ReverseBinaryEncoder.java
ReverseBinaryEncoder.writePrefix
private void writePrefix(int type, int length) { if (length >= lnIsVarLen) { writeVarUInt(length); length = lnIsVarLen; } int offset = myOffset; if (--offset < 0) { offset = growBuffer(offset); } myBuffer[offset] = (byte) (type | length); myOffset = offset; }
java
private void writePrefix(int type, int length) { if (length >= lnIsVarLen) { writeVarUInt(length); length = lnIsVarLen; } int offset = myOffset; if (--offset < 0) { offset = growBuffer(offset); } myBuffer[offset] = (byte) (type | length); myOffset = offset; }
[ "private", "void", "writePrefix", "(", "int", "type", ",", "int", "length", ")", "{", "if", "(", "length", ">=", "lnIsVarLen", ")", "{", "writeVarUInt", "(", "length", ")", ";", "length", "=", "lnIsVarLen", ";", "}", "int", "offset", "=", "myOffset", "...
Writes the prefix (type and length) preceding the body of an encoded value. This method is only called <em>after</em> a value's body is written to the buffer. @param type the value's type, a four-bit high-nibble mask @param length the number of bytes (octets) in the body, excluding the prefix itself
[ "Writes", "the", "prefix", "(", "type", "and", "length", ")", "preceding", "the", "body", "of", "an", "encoded", "value", ".", "This", "method", "is", "only", "called", "<em", ">", "after<", "/", "em", ">", "a", "value", "s", "body", "is", "written", ...
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/ReverseBinaryEncoder.java#L636-L650
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ChunkedIntArray.java
ChunkedIntArray.writeSlot
void writeSlot(int position, int w0, int w1, int w2, int w3) { position *= slotsize; int chunkpos = position >> lowbits; int slotpos = (position & lowmask); // Grow if needed if (chunkpos > chunks.size() - 1) chunks.addElement(new int[chunkalloc]); int[] chunk = chunks.elementAt(chunkpos); chunk[slotpos] = w0; chunk[slotpos + 1] = w1; chunk[slotpos + 2] = w2; chunk[slotpos + 3] = w3; }
java
void writeSlot(int position, int w0, int w1, int w2, int w3) { position *= slotsize; int chunkpos = position >> lowbits; int slotpos = (position & lowmask); // Grow if needed if (chunkpos > chunks.size() - 1) chunks.addElement(new int[chunkalloc]); int[] chunk = chunks.elementAt(chunkpos); chunk[slotpos] = w0; chunk[slotpos + 1] = w1; chunk[slotpos + 2] = w2; chunk[slotpos + 3] = w3; }
[ "void", "writeSlot", "(", "int", "position", ",", "int", "w0", ",", "int", "w1", ",", "int", "w2", ",", "int", "w3", ")", "{", "position", "*=", "slotsize", ";", "int", "chunkpos", "=", "position", ">>", "lowbits", ";", "int", "slotpos", "=", "(", ...
Overwrite an entire (4-integer) record at the specified index. Mostly used to create record 0, the Document node. @param position integer Record number @param w0 int @param w1 int @param w2 int @param w3 int
[ "Overwrite", "an", "entire", "(", "4", "-", "integer", ")", "record", "at", "the", "specified", "index", ".", "Mostly", "used", "to", "create", "record", "0", "the", "Document", "node", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ChunkedIntArray.java#L221-L235
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.withReader
public static <T> T withReader(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.Reader") Closure<T> closure) throws IOException { return IOGroovyMethods.withReader(newReader(self), closure); }
java
public static <T> T withReader(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.Reader") Closure<T> closure) throws IOException { return IOGroovyMethods.withReader(newReader(self), closure); }
[ "public", "static", "<", "T", ">", "T", "withReader", "(", "Path", "self", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.Reader\"", ")", "Closure", "<", "T", ">", "closure", ")", "throws", "IOEx...
Create a new BufferedReader for this file and then passes it into the closure, ensuring the reader is closed after the closure returns. @param self a file object @param closure a closure @return the value returned by the closure @throws java.io.IOException if an IOException occurs. @since 2.3.0
[ "Create", "a", "new", "BufferedReader", "for", "this", "file", "and", "then", "passes", "it", "into", "the", "closure", "ensuring", "the", "reader", "is", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1429-L1431
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/spout/AmBaseSpout.java
AmBaseSpout.emitWithOnlyKey
protected void emitWithOnlyKey(StreamMessage message, Object messageKey) { if (this.recordHistory) { message.getHeader().addHistory(messageKey.toString()); } this.getCollector().emit(new Values("", message)); }
java
protected void emitWithOnlyKey(StreamMessage message, Object messageKey) { if (this.recordHistory) { message.getHeader().addHistory(messageKey.toString()); } this.getCollector().emit(new Values("", message)); }
[ "protected", "void", "emitWithOnlyKey", "(", "StreamMessage", "message", ",", "Object", "messageKey", ")", "{", "if", "(", "this", ".", "recordHistory", ")", "{", "message", ".", "getHeader", "(", ")", ".", "addHistory", "(", "messageKey", ".", "toString", "...
Use only MessageKey(Use key history's value) and not use MessageId(Id identify by storm).<br> Send message to downstream component.<br> Use following situation. <ol> <li>Use this class's key history function.</li> <li>Not use storm's fault detect function.</li> </ol> @param message sending message @param messageKey MessageKey(Use key history's value)
[ "Use", "only", "MessageKey", "(", "Use", "key", "history", "s", "value", ")", "and", "not", "use", "MessageId", "(", "Id", "identify", "by", "storm", ")", ".", "<br", ">", "Send", "message", "to", "downstream", "component", ".", "<br", ">", "Use", "fol...
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/spout/AmBaseSpout.java#L425-L433
williamwebb/alogger
Utilities/src/main/java/com/jug6ernaut/android/utilites/Eula.java
Eula.show
public static boolean show(final Activity activity) { final SharedPreferences preferences = activity.getSharedPreferences(PREFERENCES_EULA, Activity.MODE_PRIVATE); if (!preferences.getBoolean(PREFERENCE_EULA_ACCEPTED, false)) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle("License"); builder.setCancelable(true); builder.setPositiveButton("Accept", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { accept(preferences); if (activity instanceof OnEulaAgreedTo) { ((OnEulaAgreedTo) activity).onEulaAgreedTo(); } } }); builder.setNegativeButton("Refuse", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { refuse(activity); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { refuse(activity); } }); builder.setMessage(readEula(activity)); builder.create().show(); return false; } return true; }
java
public static boolean show(final Activity activity) { final SharedPreferences preferences = activity.getSharedPreferences(PREFERENCES_EULA, Activity.MODE_PRIVATE); if (!preferences.getBoolean(PREFERENCE_EULA_ACCEPTED, false)) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle("License"); builder.setCancelable(true); builder.setPositiveButton("Accept", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { accept(preferences); if (activity instanceof OnEulaAgreedTo) { ((OnEulaAgreedTo) activity).onEulaAgreedTo(); } } }); builder.setNegativeButton("Refuse", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { refuse(activity); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { refuse(activity); } }); builder.setMessage(readEula(activity)); builder.create().show(); return false; } return true; }
[ "public", "static", "boolean", "show", "(", "final", "Activity", "activity", ")", "{", "final", "SharedPreferences", "preferences", "=", "activity", ".", "getSharedPreferences", "(", "PREFERENCES_EULA", ",", "Activity", ".", "MODE_PRIVATE", ")", ";", "if", "(", ...
Displays the EULA if necessary. This method should be called from the onCreate() method of your main Activity. @param activity The Activity to finish if the user rejects the EULA. @return Whether the user has agreed already.
[ "Displays", "the", "EULA", "if", "necessary", ".", "This", "method", "should", "be", "called", "from", "the", "onCreate", "()", "method", "of", "your", "main", "Activity", "." ]
train
https://github.com/williamwebb/alogger/blob/61fca49e0b8d9c3a76c40da8883ac354b240351e/Utilities/src/main/java/com/jug6ernaut/android/utilites/Eula.java#L62-L92
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java
DiagnosticsInner.listSiteAnalysesSlotWithServiceResponseAsync
public Observable<ServiceResponse<Page<AnalysisDefinitionInner>>> listSiteAnalysesSlotWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String slot) { return listSiteAnalysesSlotSinglePageAsync(resourceGroupName, siteName, diagnosticCategory, slot) .concatMap(new Func1<ServiceResponse<Page<AnalysisDefinitionInner>>, Observable<ServiceResponse<Page<AnalysisDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<AnalysisDefinitionInner>>> call(ServiceResponse<Page<AnalysisDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listSiteAnalysesSlotNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<AnalysisDefinitionInner>>> listSiteAnalysesSlotWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String slot) { return listSiteAnalysesSlotSinglePageAsync(resourceGroupName, siteName, diagnosticCategory, slot) .concatMap(new Func1<ServiceResponse<Page<AnalysisDefinitionInner>>, Observable<ServiceResponse<Page<AnalysisDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<AnalysisDefinitionInner>>> call(ServiceResponse<Page<AnalysisDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listSiteAnalysesSlotNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "AnalysisDefinitionInner", ">", ">", ">", "listSiteAnalysesSlotWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "siteName", ",", "final", "String", "diagnost...
Get Site Analyses. Get Site Analyses. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;AnalysisDefinitionInner&gt; object
[ "Get", "Site", "Analyses", ".", "Get", "Site", "Analyses", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1656-L1668
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/map/AbstractIntObjectMap.java
AbstractIntObjectMap.pairsSortedByKey
public void pairsSortedByKey(final IntArrayList keyList, final ObjectArrayList valueList) { keys(keyList); keyList.sort(); valueList.setSize(keyList.size()); for (int i=keyList.size(); --i >= 0; ) { valueList.setQuick(i,get(keyList.getQuick(i))); } }
java
public void pairsSortedByKey(final IntArrayList keyList, final ObjectArrayList valueList) { keys(keyList); keyList.sort(); valueList.setSize(keyList.size()); for (int i=keyList.size(); --i >= 0; ) { valueList.setQuick(i,get(keyList.getQuick(i))); } }
[ "public", "void", "pairsSortedByKey", "(", "final", "IntArrayList", "keyList", ",", "final", "ObjectArrayList", "valueList", ")", "{", "keys", "(", "keyList", ")", ";", "keyList", ".", "sort", "(", ")", ";", "valueList", ".", "setSize", "(", "keyList", ".", ...
Fills all keys and values <i>sorted ascending by key</i> into the specified lists. Fills into the lists, starting at index 0. After this call returns the specified lists both have a new size that equals <tt>this.size()</tt>. <p> <b>Example:</b> <br> <tt>keys = (8,7,6), values = (1,2,2) --> keyList = (6,7,8), valueList = (2,2,1)</tt> @param keyList the list to be filled with keys, can have any size. @param valueList the list to be filled with values, can have any size.
[ "Fills", "all", "keys", "and", "values", "<i", ">", "sorted", "ascending", "by", "key<", "/", "i", ">", "into", "the", "specified", "lists", ".", "Fills", "into", "the", "lists", "starting", "at", "index", "0", ".", "After", "this", "call", "returns", ...
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/map/AbstractIntObjectMap.java#L282-L289
Harium/keel
src/main/java/com/harium/keel/effect/normal/SimpleNormalMap.java
SimpleNormalMap.apply
@Override public ImageSource apply(ImageSource input) { int w = input.getWidth(); int h = input.getHeight(); MatrixSource output = new MatrixSource(w, h); Vector3 s = new Vector3(1, 0, 0); Vector3 t = new Vector3(0, 1, 0); for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { if (x < border || x == w - border || y < border || y == h - border) { output.setRGB(x, y, VectorHelper.Z_NORMAL); continue; } float dh = input.getR(x + 1, y) - input.getR(x - 1, y); float dv = input.getR(x, y + 1) - input.getR(x, y - 1); s.set(scale, 0, dh); t.set(0, scale, dv); Vector3 cross = s.crs(t).nor(); int rgb = VectorHelper.vectorToColor(cross); output.setRGB(x, y, rgb); } } return new MatrixSource(output); }
java
@Override public ImageSource apply(ImageSource input) { int w = input.getWidth(); int h = input.getHeight(); MatrixSource output = new MatrixSource(w, h); Vector3 s = new Vector3(1, 0, 0); Vector3 t = new Vector3(0, 1, 0); for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { if (x < border || x == w - border || y < border || y == h - border) { output.setRGB(x, y, VectorHelper.Z_NORMAL); continue; } float dh = input.getR(x + 1, y) - input.getR(x - 1, y); float dv = input.getR(x, y + 1) - input.getR(x, y - 1); s.set(scale, 0, dh); t.set(0, scale, dv); Vector3 cross = s.crs(t).nor(); int rgb = VectorHelper.vectorToColor(cross); output.setRGB(x, y, rgb); } } return new MatrixSource(output); }
[ "@", "Override", "public", "ImageSource", "apply", "(", "ImageSource", "input", ")", "{", "int", "w", "=", "input", ".", "getWidth", "(", ")", ";", "int", "h", "=", "input", ".", "getHeight", "(", ")", ";", "MatrixSource", "output", "=", "new", "Matrix...
Simple method to generate bump map from a height map @param input - A height map @return bump map
[ "Simple", "method", "to", "generate", "bump", "map", "from", "a", "height", "map" ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/normal/SimpleNormalMap.java#L19-L50
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java
TemplateList.insertPatternInTable
private void insertPatternInTable(StepPattern pattern, ElemTemplate template) { String target = pattern.getTargetString(); if (null != target) { String pstring = template.getMatch().getPatternString(); TemplateSubPatternAssociation association = new TemplateSubPatternAssociation(template, pattern, pstring); // See if there's already one there boolean isWildCard = association.isWild(); TemplateSubPatternAssociation head = isWildCard ? m_wildCardPatterns : getHead(target); if (null == head) { if (isWildCard) m_wildCardPatterns = association; else putHead(target, association); } else { insertAssociationIntoList(head, association, false); } } }
java
private void insertPatternInTable(StepPattern pattern, ElemTemplate template) { String target = pattern.getTargetString(); if (null != target) { String pstring = template.getMatch().getPatternString(); TemplateSubPatternAssociation association = new TemplateSubPatternAssociation(template, pattern, pstring); // See if there's already one there boolean isWildCard = association.isWild(); TemplateSubPatternAssociation head = isWildCard ? m_wildCardPatterns : getHead(target); if (null == head) { if (isWildCard) m_wildCardPatterns = association; else putHead(target, association); } else { insertAssociationIntoList(head, association, false); } } }
[ "private", "void", "insertPatternInTable", "(", "StepPattern", "pattern", ",", "ElemTemplate", "template", ")", "{", "String", "target", "=", "pattern", ".", "getTargetString", "(", ")", ";", "if", "(", "null", "!=", "target", ")", "{", "String", "pstring", ...
Add a template to the template list. @param pattern @param template
[ "Add", "a", "template", "to", "the", "template", "list", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L343-L372
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerExceptionFactory.java
SpannerExceptionFactory.newSpannerException
public static SpannerException newSpannerException(@Nullable Context context, Throwable cause) { if (cause instanceof SpannerException) { SpannerException e = (SpannerException) cause; return newSpannerExceptionPreformatted(e.getErrorCode(), e.getMessage(), e); } else if (cause instanceof CancellationException) { return newSpannerExceptionForCancellation(context, cause); } else if (cause instanceof ApiException) { return fromApiException((ApiException) cause); } // Extract gRPC status. This will produce "UNKNOWN" for non-gRPC exceptions. Status status = Status.fromThrowable(cause); if (status.getCode() == Status.Code.CANCELLED) { return newSpannerExceptionForCancellation(context, cause); } return newSpannerException(ErrorCode.fromGrpcStatus(status), cause.getMessage(), cause); }
java
public static SpannerException newSpannerException(@Nullable Context context, Throwable cause) { if (cause instanceof SpannerException) { SpannerException e = (SpannerException) cause; return newSpannerExceptionPreformatted(e.getErrorCode(), e.getMessage(), e); } else if (cause instanceof CancellationException) { return newSpannerExceptionForCancellation(context, cause); } else if (cause instanceof ApiException) { return fromApiException((ApiException) cause); } // Extract gRPC status. This will produce "UNKNOWN" for non-gRPC exceptions. Status status = Status.fromThrowable(cause); if (status.getCode() == Status.Code.CANCELLED) { return newSpannerExceptionForCancellation(context, cause); } return newSpannerException(ErrorCode.fromGrpcStatus(status), cause.getMessage(), cause); }
[ "public", "static", "SpannerException", "newSpannerException", "(", "@", "Nullable", "Context", "context", ",", "Throwable", "cause", ")", "{", "if", "(", "cause", "instanceof", "SpannerException", ")", "{", "SpannerException", "e", "=", "(", "SpannerException", "...
Creates a new exception based on {@code cause}. If {@code cause} indicates cancellation, {@code context} will be inspected to establish the type of cancellation. <p>Intended for internal library use; user code should use {@link #newSpannerException(ErrorCode, String)} instead of this method.
[ "Creates", "a", "new", "exception", "based", "on", "{", "@code", "cause", "}", ".", "If", "{", "@code", "cause", "}", "indicates", "cancellation", "{", "@code", "context", "}", "will", "be", "inspected", "to", "establish", "the", "type", "of", "cancellatio...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerExceptionFactory.java#L98-L113
apache/flink
flink-core/src/main/java/org/apache/flink/util/StringUtils.java
StringUtils.generateRandomAlphanumericString
public static String generateRandomAlphanumericString(Random rnd, int length) { checkNotNull(rnd); checkArgument(length >= 0); StringBuilder buffer = new StringBuilder(length); for (int i = 0; i < length; i++) { buffer.append(nextAlphanumericChar(rnd)); } return buffer.toString(); }
java
public static String generateRandomAlphanumericString(Random rnd, int length) { checkNotNull(rnd); checkArgument(length >= 0); StringBuilder buffer = new StringBuilder(length); for (int i = 0; i < length; i++) { buffer.append(nextAlphanumericChar(rnd)); } return buffer.toString(); }
[ "public", "static", "String", "generateRandomAlphanumericString", "(", "Random", "rnd", ",", "int", "length", ")", "{", "checkNotNull", "(", "rnd", ")", ";", "checkArgument", "(", "length", ">=", "0", ")", ";", "StringBuilder", "buffer", "=", "new", "StringBui...
Creates a random alphanumeric string of given length. @param rnd The random number generator to use. @param length The number of alphanumeric characters to append.
[ "Creates", "a", "random", "alphanumeric", "string", "of", "given", "length", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L258-L267
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginCheckConnectivityAsync
public Observable<ConnectivityInformationInner> beginCheckConnectivityAsync(String resourceGroupName, String networkWatcherName, ConnectivityParameters parameters) { return beginCheckConnectivityWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<ConnectivityInformationInner>, ConnectivityInformationInner>() { @Override public ConnectivityInformationInner call(ServiceResponse<ConnectivityInformationInner> response) { return response.body(); } }); }
java
public Observable<ConnectivityInformationInner> beginCheckConnectivityAsync(String resourceGroupName, String networkWatcherName, ConnectivityParameters parameters) { return beginCheckConnectivityWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<ConnectivityInformationInner>, ConnectivityInformationInner>() { @Override public ConnectivityInformationInner call(ServiceResponse<ConnectivityInformationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ConnectivityInformationInner", ">", "beginCheckConnectivityAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "ConnectivityParameters", "parameters", ")", "{", "return", "beginCheckConnectivityWithServiceResponseAsy...
Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that determine how the connectivity check will be performed. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ConnectivityInformationInner object
[ "Verifies", "the", "possibility", "of", "establishing", "a", "direct", "TCP", "connection", "from", "a", "virtual", "machine", "to", "a", "given", "endpoint", "including", "another", "VM", "or", "an", "arbitrary", "remote", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L2242-L2249
auth0/java-jwt
lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java
Algorithm.RSA512
public static Algorithm RSA512(RSAPublicKey publicKey, RSAPrivateKey privateKey) throws IllegalArgumentException { return RSA512(RSAAlgorithm.providerForKeys(publicKey, privateKey)); }
java
public static Algorithm RSA512(RSAPublicKey publicKey, RSAPrivateKey privateKey) throws IllegalArgumentException { return RSA512(RSAAlgorithm.providerForKeys(publicKey, privateKey)); }
[ "public", "static", "Algorithm", "RSA512", "(", "RSAPublicKey", "publicKey", ",", "RSAPrivateKey", "privateKey", ")", "throws", "IllegalArgumentException", "{", "return", "RSA512", "(", "RSAAlgorithm", ".", "providerForKeys", "(", "publicKey", ",", "privateKey", ")", ...
Creates a new Algorithm instance using SHA512withRSA. Tokens specify this as "RS512". @param publicKey the key to use in the verify instance. @param privateKey the key to use in the signing instance. @return a valid RSA512 Algorithm. @throws IllegalArgumentException if both provided Keys are null.
[ "Creates", "a", "new", "Algorithm", "instance", "using", "SHA512withRSA", ".", "Tokens", "specify", "this", "as", "RS512", "." ]
train
https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java#L116-L118
joelittlejohn/jsonschema2pojo
jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/NotRequiredRule.java
NotRequiredRule.apply
@Override public JDocCommentable apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) { // Since NotRequiredRule is executed for all fields that do not have "required" present, // we need to recognize whether the field is part of the RequiredArrayRule. JsonNode requiredArray = schema.getContent().get("required"); if (requiredArray != null) { for (Iterator<JsonNode> iterator = requiredArray.elements(); iterator.hasNext(); ) { String requiredArrayItem = iterator.next().asText(); if (nodeName.equals(requiredArrayItem)) { return generatableType; } } } if (ruleFactory.getGenerationConfig().isIncludeJsr305Annotations() && generatableType instanceof JFieldVar) { generatableType.javadoc().append(NOT_REQUIRED_COMMENT_TEXT); ((JFieldVar) generatableType).annotate(Nullable.class); } return generatableType; }
java
@Override public JDocCommentable apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) { // Since NotRequiredRule is executed for all fields that do not have "required" present, // we need to recognize whether the field is part of the RequiredArrayRule. JsonNode requiredArray = schema.getContent().get("required"); if (requiredArray != null) { for (Iterator<JsonNode> iterator = requiredArray.elements(); iterator.hasNext(); ) { String requiredArrayItem = iterator.next().asText(); if (nodeName.equals(requiredArrayItem)) { return generatableType; } } } if (ruleFactory.getGenerationConfig().isIncludeJsr305Annotations() && generatableType instanceof JFieldVar) { generatableType.javadoc().append(NOT_REQUIRED_COMMENT_TEXT); ((JFieldVar) generatableType).annotate(Nullable.class); } return generatableType; }
[ "@", "Override", "public", "JDocCommentable", "apply", "(", "String", "nodeName", ",", "JsonNode", "node", ",", "JsonNode", "parent", ",", "JDocCommentable", "generatableType", ",", "Schema", "schema", ")", "{", "// Since NotRequiredRule is executed for all fields that do...
Applies this schema rule to take the not required code generation steps. <p> The not required rule adds a Nullable annotation if JSR-305 annotations are desired. @param nodeName the name of the schema node for which this "required" rule has been added @param node the "not required" node, having a value <code>false</code> or <code>no value</code> @param parent the parent node @param generatableType the class or method which may be marked as "not required" @return the JavaDoc comment attached to the generatableType, which <em>may</em> have an added not to mark this construct as not required.
[ "Applies", "this", "schema", "rule", "to", "take", "the", "not", "required", "code", "generation", "steps", ".", "<p", ">", "The", "not", "required", "rule", "adds", "a", "Nullable", "annotation", "if", "JSR", "-", "305", "annotations", "are", "desired", "...
train
https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/NotRequiredRule.java#L67-L90
racc/typesafeconfig-guice
src/main/java/com/github/racc/tscg/TypesafeConfigModule.java
TypesafeConfigModule.fromConfigWithPackage
public static TypesafeConfigModule fromConfigWithPackage(Config config, String packageNamePrefix) { Reflections reflections = createPackageScanningReflections(packageNamePrefix); return fromConfigWithReflections(config, reflections); }
java
public static TypesafeConfigModule fromConfigWithPackage(Config config, String packageNamePrefix) { Reflections reflections = createPackageScanningReflections(packageNamePrefix); return fromConfigWithReflections(config, reflections); }
[ "public", "static", "TypesafeConfigModule", "fromConfigWithPackage", "(", "Config", "config", ",", "String", "packageNamePrefix", ")", "{", "Reflections", "reflections", "=", "createPackageScanningReflections", "(", "packageNamePrefix", ")", ";", "return", "fromConfigWithRe...
Scans the specified packages for annotated classes, and applies Config values to them. @param config the Config to derive values from @param packageNamePrefix the prefix to limit scanning to - e.g. "com.github" @return The constructed TypesafeConfigModule.
[ "Scans", "the", "specified", "packages", "for", "annotated", "classes", "and", "applies", "Config", "values", "to", "them", "." ]
train
https://github.com/racc/typesafeconfig-guice/blob/95e383ced94fe59f4a651d043f9d1764bc618a94/src/main/java/com/github/racc/tscg/TypesafeConfigModule.java#L77-L80
google/closure-compiler
src/com/google/javascript/jscomp/FunctionInjector.java
FunctionInjector.unsafeInline
Node unsafeInline(Reference ref, String fnName, Node fnNode) { return internalInline(ref, fnName, fnNode); }
java
Node unsafeInline(Reference ref, String fnName, Node fnNode) { return internalInline(ref, fnName, fnNode); }
[ "Node", "unsafeInline", "(", "Reference", "ref", ",", "String", "fnName", ",", "Node", "fnNode", ")", "{", "return", "internalInline", "(", "ref", ",", "fnName", ",", "fnNode", ")", ";", "}" ]
Inline a function into the call site. Note that this unsafe version doesn't verify if the AST is normalized. You should use {@link inline} instead, unless you are 100% certain that the bit of code you're inlining is safe without being normalized first.
[ "Inline", "a", "function", "into", "the", "call", "site", ".", "Note", "that", "this", "unsafe", "version", "doesn", "t", "verify", "if", "the", "AST", "is", "normalized", ".", "You", "should", "use", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FunctionInjector.java#L308-L310
nulab/backlog4j
src/main/java/com/nulabinc/backlog4j/BacklogEndPointSupport.java
BacklogEndPointSupport.getSharedFileEndpoint
public String getSharedFileEndpoint(Object projectIdOrKey, Object sharedFileId) throws BacklogException { return buildEndpoint("projects/" + projectIdOrKey + "/files/" + sharedFileId); }
java
public String getSharedFileEndpoint(Object projectIdOrKey, Object sharedFileId) throws BacklogException { return buildEndpoint("projects/" + projectIdOrKey + "/files/" + sharedFileId); }
[ "public", "String", "getSharedFileEndpoint", "(", "Object", "projectIdOrKey", ",", "Object", "sharedFileId", ")", "throws", "BacklogException", "{", "return", "buildEndpoint", "(", "\"projects/\"", "+", "projectIdOrKey", "+", "\"/files/\"", "+", "sharedFileId", ")", "...
Returns the endpoint of shared file. @param projectIdOrKey the project identifier @param sharedFileId the shared file identifier @return the endpoint @throws BacklogException
[ "Returns", "the", "endpoint", "of", "shared", "file", "." ]
train
https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/BacklogEndPointSupport.java#L58-L60
kaazing/java.client
net.api/src/main/java/org/kaazing/net/URLFactory.java
URLFactory.createURL
public static URL createURL(String protocol, String host, String file) throws MalformedURLException { return createURL(protocol, host, -1, file); }
java
public static URL createURL(String protocol, String host, String file) throws MalformedURLException { return createURL(protocol, host, -1, file); }
[ "public", "static", "URL", "createURL", "(", "String", "protocol", ",", "String", "host", ",", "String", "file", ")", "throws", "MalformedURLException", "{", "return", "createURL", "(", "protocol", ",", "host", ",", "-", "1", ",", "file", ")", ";", "}" ]
Creates a URL from the specified protocol name, host name, and file name. The default port for the specified protocol is used. <p/> This method is equivalent to calling the four-argument method with the arguments being protocol, host, -1, and file. No validation of the inputs is performed by this method. @param protocol the name of the protocol to use @param host the name of the host @param file the file on the host @return URL created using specified protocol, host, and file @throws MalformedURLException if an unknown protocol is specified
[ "Creates", "a", "URL", "from", "the", "specified", "protocol", "name", "host", "name", "and", "file", "name", ".", "The", "default", "port", "for", "the", "specified", "protocol", "is", "used", ".", "<p", "/", ">", "This", "method", "is", "equivalent", "...
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/net.api/src/main/java/org/kaazing/net/URLFactory.java#L163-L167
hawkular/hawkular-alerts
actions/actions-plugins/actions-email/src/main/java/org/hawkular/alerts/actions/email/EmailTemplate.java
EmailTemplate.processTemplate
public Map<String, String> processTemplate(ActionMessage msg) throws Exception { Map<String, String> emailProcessed = new HashMap<>(); PluginMessageDescription pmDesc = new PluginMessageDescription(msg); // Prepare emailSubject directly from PluginMessageDescription class emailProcessed.put("emailSubject", pmDesc.getEmailSubject()); // Check if templates are defined in properties String plain; String html; String templateLocale = pmDesc.getProps() != null ? pmDesc.getProps().get(EmailPlugin.PROP_TEMPLATE_LOCALE) : null; if (templateLocale != null) { plain = pmDesc.getProps().get(EmailPlugin.PROP_TEMPLATE_PLAIN + "." + templateLocale); html = pmDesc.getProps().get(EmailPlugin.PROP_TEMPLATE_HTML + "." + templateLocale); } else { plain = pmDesc.getProps() != null ? pmDesc.getProps().get(EmailPlugin.PROP_TEMPLATE_PLAIN) : null; html = pmDesc.getProps() != null ? pmDesc.getProps().get(EmailPlugin.PROP_TEMPLATE_HTML) : null; } /* Invoke freemarker template with PluginMessageDescription as root object for dynamic data. PluginMessageDescription fields are accessible within .ftl templates. */ StringWriter writerPlain = new StringWriter(); StringWriter writerHtml = new StringWriter(); if (!isEmpty(plain)) { StringReader plainReader = new StringReader(plain); ftlTemplate = new Template("plainTemplate", plainReader, ftlCfg); ftlTemplate.process(pmDesc, writerPlain); } else { ftlTemplatePlain.process(pmDesc, writerPlain); } if (!isEmpty(html)) { StringReader htmlReader = new StringReader(html); ftlTemplate = new Template("htmlTemplate", htmlReader, ftlCfg); ftlTemplate.process(pmDesc, writerHtml); } else { ftlTemplateHtml.process(pmDesc, writerHtml); } writerPlain.flush(); writerPlain.close(); emailProcessed.put("emailBodyPlain", writerPlain.toString()); writerHtml.flush(); writerHtml.close(); emailProcessed.put("emailBodyHtml", writerHtml.toString()); return emailProcessed; }
java
public Map<String, String> processTemplate(ActionMessage msg) throws Exception { Map<String, String> emailProcessed = new HashMap<>(); PluginMessageDescription pmDesc = new PluginMessageDescription(msg); // Prepare emailSubject directly from PluginMessageDescription class emailProcessed.put("emailSubject", pmDesc.getEmailSubject()); // Check if templates are defined in properties String plain; String html; String templateLocale = pmDesc.getProps() != null ? pmDesc.getProps().get(EmailPlugin.PROP_TEMPLATE_LOCALE) : null; if (templateLocale != null) { plain = pmDesc.getProps().get(EmailPlugin.PROP_TEMPLATE_PLAIN + "." + templateLocale); html = pmDesc.getProps().get(EmailPlugin.PROP_TEMPLATE_HTML + "." + templateLocale); } else { plain = pmDesc.getProps() != null ? pmDesc.getProps().get(EmailPlugin.PROP_TEMPLATE_PLAIN) : null; html = pmDesc.getProps() != null ? pmDesc.getProps().get(EmailPlugin.PROP_TEMPLATE_HTML) : null; } /* Invoke freemarker template with PluginMessageDescription as root object for dynamic data. PluginMessageDescription fields are accessible within .ftl templates. */ StringWriter writerPlain = new StringWriter(); StringWriter writerHtml = new StringWriter(); if (!isEmpty(plain)) { StringReader plainReader = new StringReader(plain); ftlTemplate = new Template("plainTemplate", plainReader, ftlCfg); ftlTemplate.process(pmDesc, writerPlain); } else { ftlTemplatePlain.process(pmDesc, writerPlain); } if (!isEmpty(html)) { StringReader htmlReader = new StringReader(html); ftlTemplate = new Template("htmlTemplate", htmlReader, ftlCfg); ftlTemplate.process(pmDesc, writerHtml); } else { ftlTemplateHtml.process(pmDesc, writerHtml); } writerPlain.flush(); writerPlain.close(); emailProcessed.put("emailBodyPlain", writerPlain.toString()); writerHtml.flush(); writerHtml.close(); emailProcessed.put("emailBodyHtml", writerHtml.toString()); return emailProcessed; }
[ "public", "Map", "<", "String", ",", "String", ">", "processTemplate", "(", "ActionMessage", "msg", ")", "throws", "Exception", "{", "Map", "<", "String", ",", "String", ">", "emailProcessed", "=", "new", "HashMap", "<>", "(", ")", ";", "PluginMessageDescrip...
Process a PluginMessage and creates email content based on templates. @param msg the PluginMessage to be processed @return a Map with following entries: - "emailSubject": Subject of the email - "emailBodyPlain": Content for plain text email - "emailBodyHtml": Content for html email @throws Exception on any problem
[ "Process", "a", "PluginMessage", "and", "creates", "email", "content", "based", "on", "templates", "." ]
train
https://github.com/hawkular/hawkular-alerts/blob/b4a0c2909b38e03e72cc1828219562ee8fcbf426/actions/actions-plugins/actions-email/src/main/java/org/hawkular/alerts/actions/email/EmailTemplate.java#L133-L186
lessthanoptimal/BoofCV
integration/boofcv-swing/src/main/java/boofcv/gui/ApplicationLauncherApp.java
ApplicationLauncherApp.handleContextMenu
private void handleContextMenu(JTree tree, int x, int y) { TreePath path = tree.getPathForLocation(x, y); tree.setSelectionPath(path); DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (node == null) return; if (!node.isLeaf()) { tree.setSelectionPath(null); return; } final AppInfo info = (AppInfo) node.getUserObject(); JMenuItem copyname = new JMenuItem("Copy Name"); copyname.addActionListener(e -> { Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(info.app.getSimpleName()), null); }); JMenuItem copypath = new JMenuItem("Copy Path"); copypath.addActionListener(e -> { String path1 = UtilIO.getSourcePath(info.app.getPackage().getName(), info.app.getSimpleName()); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(path1), null); }); JMenuItem github = new JMenuItem("Go to Github"); github.addActionListener(e -> openInGitHub(info)); JPopupMenu submenu = new JPopupMenu(); submenu.add(copyname); submenu.add(copypath); submenu.add(github); submenu.show(tree, x, y); }
java
private void handleContextMenu(JTree tree, int x, int y) { TreePath path = tree.getPathForLocation(x, y); tree.setSelectionPath(path); DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (node == null) return; if (!node.isLeaf()) { tree.setSelectionPath(null); return; } final AppInfo info = (AppInfo) node.getUserObject(); JMenuItem copyname = new JMenuItem("Copy Name"); copyname.addActionListener(e -> { Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(info.app.getSimpleName()), null); }); JMenuItem copypath = new JMenuItem("Copy Path"); copypath.addActionListener(e -> { String path1 = UtilIO.getSourcePath(info.app.getPackage().getName(), info.app.getSimpleName()); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(path1), null); }); JMenuItem github = new JMenuItem("Go to Github"); github.addActionListener(e -> openInGitHub(info)); JPopupMenu submenu = new JPopupMenu(); submenu.add(copyname); submenu.add(copypath); submenu.add(github); submenu.show(tree, x, y); }
[ "private", "void", "handleContextMenu", "(", "JTree", "tree", ",", "int", "x", ",", "int", "y", ")", "{", "TreePath", "path", "=", "tree", ".", "getPathForLocation", "(", "x", ",", "y", ")", ";", "tree", ".", "setSelectionPath", "(", "path", ")", ";", ...
Displays a context menu for a class leaf node Allows copying of the name and the path to the source
[ "Displays", "a", "context", "menu", "for", "a", "class", "leaf", "node", "Allows", "copying", "of", "the", "name", "and", "the", "path", "to", "the", "source" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/ApplicationLauncherApp.java#L337-L371
inkstand-io/scribble
scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java
Directory.addPartition
@RuleSetup public void addPartition(String partitionId, String suffix) { this.partitions.put(partitionId, suffix); }
java
@RuleSetup public void addPartition(String partitionId, String suffix) { this.partitions.put(partitionId, suffix); }
[ "@", "RuleSetup", "public", "void", "addPartition", "(", "String", "partitionId", ",", "String", "suffix", ")", "{", "this", ".", "partitions", ".", "put", "(", "partitionId", ",", "suffix", ")", ";", "}" ]
Adds a partition to the rule. The actual parititon is created when the rule is applied. @param partitionId the id of the partition @param suffix the suffix of the partition
[ "Adds", "a", "partition", "to", "the", "rule", ".", "The", "actual", "parititon", "is", "created", "when", "the", "rule", "is", "applied", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java#L371-L375
dbracewell/mango
src/main/java/com/davidbracewell/json/JsonWriter.java
JsonWriter.property
public JsonWriter property(String key, Map<String, ?> map) throws IOException { Preconditions.checkArgument(!inArray(), "Cannot write a property inside an array."); writeName(key); value(map); return this; }
java
public JsonWriter property(String key, Map<String, ?> map) throws IOException { Preconditions.checkArgument(!inArray(), "Cannot write a property inside an array."); writeName(key); value(map); return this; }
[ "public", "JsonWriter", "property", "(", "String", "key", ",", "Map", "<", "String", ",", "?", ">", "map", ")", "throws", "IOException", "{", "Preconditions", ".", "checkArgument", "(", "!", "inArray", "(", ")", ",", "\"Cannot write a property inside an array.\"...
Writes a map with the given key name @param key the key name for the map @param map the map to be written @return This structured writer @throws IOException Something went wrong writing
[ "Writes", "a", "map", "with", "the", "given", "key", "name" ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/json/JsonWriter.java#L307-L312
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java
NLS.getInteger
public int getInteger(String key, int defaultValue) { int result = defaultValue; try { if (key != null) result = getInteger(key); } catch (MissingResourceException e) { } return result; }
java
public int getInteger(String key, int defaultValue) { int result = defaultValue; try { if (key != null) result = getInteger(key); } catch (MissingResourceException e) { } return result; }
[ "public", "int", "getInteger", "(", "String", "key", ",", "int", "defaultValue", ")", "{", "int", "result", "=", "defaultValue", ";", "try", "{", "if", "(", "key", "!=", "null", ")", "result", "=", "getInteger", "(", "key", ")", ";", "}", "catch", "(...
Not sure why this is here. Looks like it is a replacement for Integer.getInteger with error checking for the key (non-null check).
[ "Not", "sure", "why", "this", "is", "here", ".", "Looks", "like", "it", "is", "a", "replacement", "for", "Integer", ".", "getInteger", "with", "error", "checking", "for", "the", "key", "(", "non", "-", "null", "check", ")", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java#L394-L402
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardGenerator.java
StandardGenerator.outerGlow
static IRenderingElement outerGlow(IRenderingElement element, Color color, double glowWidth, double stroke) { if (element instanceof ElementGroup) { ElementGroup orgGroup = (ElementGroup) element; ElementGroup newGroup = new ElementGroup(); for (IRenderingElement child : orgGroup) { newGroup.add(outerGlow(child, color, glowWidth, stroke)); } return newGroup; } else if (element instanceof LineElement) { LineElement lineElement = (LineElement) element; return new LineElement(lineElement.firstPointX, lineElement.firstPointY, lineElement.secondPointX, lineElement.secondPointY, stroke + (2 * (glowWidth * stroke)), color); } else if (element instanceof GeneralPath) { GeneralPath org = (GeneralPath) element; if (org.fill) { return org.outline(2 * (glowWidth * stroke)).recolor(color); } else { return org.outline(stroke + (2 * (glowWidth * stroke))).recolor(color); } } throw new IllegalArgumentException("Cannot generate glow for rendering element, " + element.getClass()); }
java
static IRenderingElement outerGlow(IRenderingElement element, Color color, double glowWidth, double stroke) { if (element instanceof ElementGroup) { ElementGroup orgGroup = (ElementGroup) element; ElementGroup newGroup = new ElementGroup(); for (IRenderingElement child : orgGroup) { newGroup.add(outerGlow(child, color, glowWidth, stroke)); } return newGroup; } else if (element instanceof LineElement) { LineElement lineElement = (LineElement) element; return new LineElement(lineElement.firstPointX, lineElement.firstPointY, lineElement.secondPointX, lineElement.secondPointY, stroke + (2 * (glowWidth * stroke)), color); } else if (element instanceof GeneralPath) { GeneralPath org = (GeneralPath) element; if (org.fill) { return org.outline(2 * (glowWidth * stroke)).recolor(color); } else { return org.outline(stroke + (2 * (glowWidth * stroke))).recolor(color); } } throw new IllegalArgumentException("Cannot generate glow for rendering element, " + element.getClass()); }
[ "static", "IRenderingElement", "outerGlow", "(", "IRenderingElement", "element", ",", "Color", "color", ",", "double", "glowWidth", ",", "double", "stroke", ")", "{", "if", "(", "element", "instanceof", "ElementGroup", ")", "{", "ElementGroup", "orgGroup", "=", ...
Generate an outer glow for the provided rendering element. The glow is defined by the glow width and the stroke size. @param element rendering element @param color color of the glow @param glowWidth the width of the glow @param stroke the stroke width @return generated outer glow
[ "Generate", "an", "outer", "glow", "for", "the", "provided", "rendering", "element", ".", "The", "glow", "is", "defined", "by", "the", "glow", "width", "and", "the", "stroke", "size", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardGenerator.java#L678-L699
hankcs/HanLP
src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/interval/IntervalNode.java
IntervalNode.addToOverlaps
protected void addToOverlaps(Intervalable interval, List<Intervalable> overlaps, List<Intervalable> newOverlaps) { for (Intervalable currentInterval : newOverlaps) { if (!currentInterval.equals(interval)) { overlaps.add(currentInterval); } } }
java
protected void addToOverlaps(Intervalable interval, List<Intervalable> overlaps, List<Intervalable> newOverlaps) { for (Intervalable currentInterval : newOverlaps) { if (!currentInterval.equals(interval)) { overlaps.add(currentInterval); } } }
[ "protected", "void", "addToOverlaps", "(", "Intervalable", "interval", ",", "List", "<", "Intervalable", ">", "overlaps", ",", "List", "<", "Intervalable", ">", "newOverlaps", ")", "{", "for", "(", "Intervalable", "currentInterval", ":", "newOverlaps", ")", "{",...
添加到重叠区间列表中 @param interval 跟此区间重叠 @param overlaps 重叠区间列表 @param newOverlaps 希望将这些区间加入
[ "添加到重叠区间列表中" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/interval/IntervalNode.java#L138-L147
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPaymentPersistenceImpl.java
CommerceOrderPaymentPersistenceImpl.findByCommerceOrderId
@Override public List<CommerceOrderPayment> findByCommerceOrderId( long commerceOrderId, int start, int end) { return findByCommerceOrderId(commerceOrderId, start, end, null); }
java
@Override public List<CommerceOrderPayment> findByCommerceOrderId( long commerceOrderId, int start, int end) { return findByCommerceOrderId(commerceOrderId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceOrderPayment", ">", "findByCommerceOrderId", "(", "long", "commerceOrderId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCommerceOrderId", "(", "commerceOrderId", ",", "start", ",", "end", "...
Returns a range of all the commerce order payments where commerceOrderId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceOrderPaymentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param commerceOrderId the commerce order ID @param start the lower bound of the range of commerce order payments @param end the upper bound of the range of commerce order payments (not inclusive) @return the range of matching commerce order payments
[ "Returns", "a", "range", "of", "all", "the", "commerce", "order", "payments", "where", "commerceOrderId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPaymentPersistenceImpl.java#L142-L146
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.orthoSymmetricLH
public Matrix4f orthoSymmetricLH(float width, float height, float zNear, float zFar) { return orthoSymmetricLH(width, height, zNear, zFar, false, thisOrNew()); }
java
public Matrix4f orthoSymmetricLH(float width, float height, float zNear, float zFar) { return orthoSymmetricLH(width, height, zNear, zFar, false, thisOrNew()); }
[ "public", "Matrix4f", "orthoSymmetricLH", "(", "float", "width", ",", "float", "height", ",", "float", "zNear", ",", "float", "zFar", ")", "{", "return", "orthoSymmetricLH", "(", "width", ",", "height", ",", "zNear", ",", "zFar", ",", "false", ",", "thisOr...
Apply a symmetric orthographic projection transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix. <p> This method is equivalent to calling {@link #orthoLH(float, float, float, float, float, float) 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) 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) @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 @return a matrix holding the result
[ "Apply", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", "..", "+", "1", "]", "<", "/", "code", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7638-L7640
neoremind/fluent-validator
fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/QuickValidator.java
QuickValidator.doAndGetComplexResult
public static ComplexResult doAndGetComplexResult(Decorator decorator, ValidatorContext context) { return validate(decorator, FluentValidator.checkAll(), context, ResultCollectors.toComplex()); }
java
public static ComplexResult doAndGetComplexResult(Decorator decorator, ValidatorContext context) { return validate(decorator, FluentValidator.checkAll(), context, ResultCollectors.toComplex()); }
[ "public", "static", "ComplexResult", "doAndGetComplexResult", "(", "Decorator", "decorator", ",", "ValidatorContext", "context", ")", "{", "return", "validate", "(", "decorator", ",", "FluentValidator", ".", "checkAll", "(", ")", ",", "context", ",", "ResultCollecto...
Execute validation by using a new FluentValidator instance with a shared context. The result type is {@link ComplexResult} @param decorator Same as decorator design pattern, provided to add more functions to the fluentValidator @param context Validation context which can be shared @return ComplexResult
[ "Execute", "validation", "by", "using", "a", "new", "FluentValidator", "instance", "with", "a", "shared", "context", ".", "The", "result", "type", "is", "{", "@link", "ComplexResult", "}" ]
train
https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/QuickValidator.java#L27-L29
haraldk/TwelveMonkeys
common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianDataInputStream.java
LittleEndianDataInputStream.readFully
public final void readFully(byte pBytes[], int pOffset, int pLength) throws IOException { if (pLength < 0) { throw new IndexOutOfBoundsException(); } int count = 0; while (count < pLength) { int read = in.read(pBytes, pOffset + count, pLength - count); if (read < 0) { throw new EOFException(); } count += read; } }
java
public final void readFully(byte pBytes[], int pOffset, int pLength) throws IOException { if (pLength < 0) { throw new IndexOutOfBoundsException(); } int count = 0; while (count < pLength) { int read = in.read(pBytes, pOffset + count, pLength - count); if (read < 0) { throw new EOFException(); } count += read; } }
[ "public", "final", "void", "readFully", "(", "byte", "pBytes", "[", "]", ",", "int", "pOffset", ",", "int", "pLength", ")", "throws", "IOException", "{", "if", "(", "pLength", "<", "0", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";"...
See the general contract of the {@code readFully} method of {@code DataInput}. <p/> Bytes for this operation are read from the contained input stream. @param pBytes the buffer into which the data is read. @param pOffset the start offset of the data. @param pLength the number of bytes to read. @throws EOFException if this input stream reaches the end before reading all the bytes. @throws IOException if an I/O error occurs. @see java.io.FilterInputStream#in
[ "See", "the", "general", "contract", "of", "the", "{", "@code", "readFully", "}", "method", "of", "{", "@code", "DataInput", "}", ".", "<p", "/", ">", "Bytes", "for", "this", "operation", "are", "read", "from", "the", "contained", "input", "stream", "." ...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianDataInputStream.java#L416-L432
kiegroup/drools
drools-core/src/main/java/org/drools/core/rule/LogicTransformer.java
LogicTransformer.fixClonedDeclarations
protected void fixClonedDeclarations( GroupElement and, Map<String, Class<?>> globals ) { Stack<RuleConditionElement> contextStack = new Stack<RuleConditionElement>(); DeclarationScopeResolver resolver = new DeclarationScopeResolver( globals, contextStack ); contextStack.push( and ); processElement( resolver, contextStack, and ); contextStack.pop(); }
java
protected void fixClonedDeclarations( GroupElement and, Map<String, Class<?>> globals ) { Stack<RuleConditionElement> contextStack = new Stack<RuleConditionElement>(); DeclarationScopeResolver resolver = new DeclarationScopeResolver( globals, contextStack ); contextStack.push( and ); processElement( resolver, contextStack, and ); contextStack.pop(); }
[ "protected", "void", "fixClonedDeclarations", "(", "GroupElement", "and", ",", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "globals", ")", "{", "Stack", "<", "RuleConditionElement", ">", "contextStack", "=", "new", "Stack", "<", "RuleConditionEleme...
During the logic transformation, we eventually clone CEs, specially patterns and corresponding declarations. So now we need to fix any references to cloned declarations.
[ "During", "the", "logic", "transformation", "we", "eventually", "clone", "CEs", "specially", "patterns", "and", "corresponding", "declarations", ".", "So", "now", "we", "need", "to", "fix", "any", "references", "to", "cloned", "declarations", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/rule/LogicTransformer.java#L147-L157
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/DeviceTypesApi.java
DeviceTypesApi.getDeviceTypesByApplication
public DeviceTypesEnvelope getDeviceTypesByApplication(String appId, Boolean productInfo, Integer count, Integer offset) throws ApiException { ApiResponse<DeviceTypesEnvelope> resp = getDeviceTypesByApplicationWithHttpInfo(appId, productInfo, count, offset); return resp.getData(); }
java
public DeviceTypesEnvelope getDeviceTypesByApplication(String appId, Boolean productInfo, Integer count, Integer offset) throws ApiException { ApiResponse<DeviceTypesEnvelope> resp = getDeviceTypesByApplicationWithHttpInfo(appId, productInfo, count, offset); return resp.getData(); }
[ "public", "DeviceTypesEnvelope", "getDeviceTypesByApplication", "(", "String", "appId", ",", "Boolean", "productInfo", ",", "Integer", "count", ",", "Integer", "offset", ")", "throws", "ApiException", "{", "ApiResponse", "<", "DeviceTypesEnvelope", ">", "resp", "=", ...
Get Device Types by Application Get Device Types by Application @param appId Application ID. (required) @param productInfo Flag to include the associated ProductInfo if present (optional) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @return DeviceTypesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "Device", "Types", "by", "Application", "Get", "Device", "Types", "by", "Application" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DeviceTypesApi.java#L509-L512
xwiki/xwiki-rendering
xwiki-rendering-xml/src/main/java/org/xwiki/rendering/renderer/printer/XMLWikiPrinter.java
XMLWikiPrinter.printXMLStartElement
public void printXMLStartElement(String name, Attributes attributes) { try { this.xmlWriter.startElement("", name, name, attributes); } catch (SAXException e) { // TODO: add error log here } }
java
public void printXMLStartElement(String name, Attributes attributes) { try { this.xmlWriter.startElement("", name, name, attributes); } catch (SAXException e) { // TODO: add error log here } }
[ "public", "void", "printXMLStartElement", "(", "String", "name", ",", "Attributes", "attributes", ")", "{", "try", "{", "this", ".", "xmlWriter", ".", "startElement", "(", "\"\"", ",", "name", ",", "name", ",", "attributes", ")", ";", "}", "catch", "(", ...
Print the start tag of xml element. In the form {@code <name att1="value1" att2="value2">}. @param name the xml element to print @param attributes the xml attributes of the element to print
[ "Print", "the", "start", "tag", "of", "xml", "element", ".", "In", "the", "form", "{", "@code", "<name", "att1", "=", "value1", "att2", "=", "value2", ">", "}", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-xml/src/main/java/org/xwiki/rendering/renderer/printer/XMLWikiPrinter.java#L177-L184
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/PhotoUtils.java
PhotoUtils.getImageForSize
public static BufferedImage getImageForSize(JinxConstants.PhotoSize size, Photo photo) throws JinxException { if (photo == null || size == null) { throw new JinxException("Cannot look up null photo or size."); } BufferedImage image; try { image = ImageIO.read(getUrlForSize(size, photo)); } catch (JinxException je) { throw je; } catch (Exception e) { throw new JinxException("Unable to get image for size " + size.toString(), e); } return image; }
java
public static BufferedImage getImageForSize(JinxConstants.PhotoSize size, Photo photo) throws JinxException { if (photo == null || size == null) { throw new JinxException("Cannot look up null photo or size."); } BufferedImage image; try { image = ImageIO.read(getUrlForSize(size, photo)); } catch (JinxException je) { throw je; } catch (Exception e) { throw new JinxException("Unable to get image for size " + size.toString(), e); } return image; }
[ "public", "static", "BufferedImage", "getImageForSize", "(", "JinxConstants", ".", "PhotoSize", "size", ",", "Photo", "photo", ")", "throws", "JinxException", "{", "if", "(", "photo", "==", "null", "||", "size", "==", "null", ")", "{", "throw", "new", "JinxE...
Get an image for a photo at a specific size. @param size Required. The the desired size. @param photo Required. The photo to get the image for. @return buffered image data from Flickr. @throws JinxException if any parameter is null, or if there are any errors.
[ "Get", "an", "image", "for", "a", "photo", "at", "a", "specific", "size", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/PhotoUtils.java#L54-L67
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.deleteLabel
public void deleteLabel(Serializable projectId, GitlabLabel label) throws IOException { deleteLabel(projectId, label.getName()); }
java
public void deleteLabel(Serializable projectId, GitlabLabel label) throws IOException { deleteLabel(projectId, label.getName()); }
[ "public", "void", "deleteLabel", "(", "Serializable", "projectId", ",", "GitlabLabel", "label", ")", "throws", "IOException", "{", "deleteLabel", "(", "projectId", ",", "label", ".", "getName", "(", ")", ")", ";", "}" ]
Deletes an existing label. @param projectId The ID of the project containing the label. @param label The label to delete. @throws IOException on gitlab api call error
[ "Deletes", "an", "existing", "label", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2835-L2838
neilboyd/SendLog
sendlog-library/src/main/java/org/l6n/sendlog/library/SendLogActivityBase.java
SendLogActivityBase.getMessageText
protected String getMessageText(final File pZipFile, final PackageManager pPackageManager) { String version = ""; try { final PackageInfo pi = pPackageManager.getPackageInfo(getPackageName(), 0); version = " " + pi.versionName; } catch (final PackageManager.NameNotFoundException e) { Log.e(TAG, "Version name not found", e); } return getString(R.string.email_text, version, Build.MODEL, Build.DEVICE, Build.VERSION.RELEASE, Build.ID, pZipFile.getName(), (pZipFile.length() + 512) / 1024); }
java
protected String getMessageText(final File pZipFile, final PackageManager pPackageManager) { String version = ""; try { final PackageInfo pi = pPackageManager.getPackageInfo(getPackageName(), 0); version = " " + pi.versionName; } catch (final PackageManager.NameNotFoundException e) { Log.e(TAG, "Version name not found", e); } return getString(R.string.email_text, version, Build.MODEL, Build.DEVICE, Build.VERSION.RELEASE, Build.ID, pZipFile.getName(), (pZipFile.length() + 512) / 1024); }
[ "protected", "String", "getMessageText", "(", "final", "File", "pZipFile", ",", "final", "PackageManager", "pPackageManager", ")", "{", "String", "version", "=", "\"\"", ";", "try", "{", "final", "PackageInfo", "pi", "=", "pPackageManager", ".", "getPackageInfo", ...
The text of the email. Override to use different text. @param pZipFile the file containing the zipped log @param pPackageManager the package manager @return the message text
[ "The", "text", "of", "the", "email", ".", "Override", "to", "use", "different", "text", "." ]
train
https://github.com/neilboyd/SendLog/blob/5be734165e48047c53c40149554e52eb88b9598c/sendlog-library/src/main/java/org/l6n/sendlog/library/SendLogActivityBase.java#L89-L100
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectMinCardinalityImpl_CustomFieldSerializer.java
OWLObjectMinCardinalityImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectMinCardinalityImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectMinCardinalityImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLObjectMinCardinalityImpl", "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", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectMinCardinalityImpl_CustomFieldSerializer.java#L95-L98
lessthanoptimal/ejml
examples/src/org/ejml/example/PrincipalComponentAnalysis.java
PrincipalComponentAnalysis.getBasisVector
public double[] getBasisVector( int which ) { if( which < 0 || which >= numComponents ) throw new IllegalArgumentException("Invalid component"); DMatrixRMaj v = new DMatrixRMaj(1,A.numCols); CommonOps_DDRM.extract(V_t,which,which+1,0,A.numCols,v,0,0); return v.data; }
java
public double[] getBasisVector( int which ) { if( which < 0 || which >= numComponents ) throw new IllegalArgumentException("Invalid component"); DMatrixRMaj v = new DMatrixRMaj(1,A.numCols); CommonOps_DDRM.extract(V_t,which,which+1,0,A.numCols,v,0,0); return v.data; }
[ "public", "double", "[", "]", "getBasisVector", "(", "int", "which", ")", "{", "if", "(", "which", "<", "0", "||", "which", ">=", "numComponents", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid component\"", ")", ";", "DMatrixRMaj", "v", "=...
Returns a vector from the PCA's basis. @param which Which component's vector is to be returned. @return Vector from the PCA basis.
[ "Returns", "a", "vector", "from", "the", "PCA", "s", "basis", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/PrincipalComponentAnalysis.java#L160-L168
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/ST_GeomFromText.java
ST_GeomFromText.toGeometry
public static Geometry toGeometry(String wkt) throws SQLException { if(wkt == null) { return null; } WKTReader wktReader = new WKTReader(); try { return wktReader.read(wkt); } catch (ParseException ex) { throw new SQLException("Cannot parse the WKT.",ex); } }
java
public static Geometry toGeometry(String wkt) throws SQLException { if(wkt == null) { return null; } WKTReader wktReader = new WKTReader(); try { return wktReader.read(wkt); } catch (ParseException ex) { throw new SQLException("Cannot parse the WKT.",ex); } }
[ "public", "static", "Geometry", "toGeometry", "(", "String", "wkt", ")", "throws", "SQLException", "{", "if", "(", "wkt", "==", "null", ")", "{", "return", "null", ";", "}", "WKTReader", "wktReader", "=", "new", "WKTReader", "(", ")", ";", "try", "{", ...
Convert well known text parameter into a Geometry @param wkt Well known text @return Geometry instance or null if parameter is null @throws ParseException If wkt is invalid
[ "Convert", "well", "known", "text", "parameter", "into", "a", "Geometry" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/ST_GeomFromText.java#L57-L67
BlueBrain/bluima
modules/bluima_abbreviations/src/main/java/com/wcohen/ss/lookup/SoftDictionary.java
SoftDictionary.put
public void put(String id, StringWrapper toInsert,Object value) { MyWrapper wrapper = asMyWrapper(toInsert); Token[] tokens = wrapper.getTokens(); for (int i=0; i<tokens.length; i++) { ArrayList stringsWithToken = (ArrayList) index.get(tokens[i]); if (stringsWithToken==null) index.put( tokens[i], (stringsWithToken=new ArrayList()) ); stringsWithToken.add( wrapper ); } map.put( wrapper, value ); if (id!=null) idMap.put( wrapper, id ); distance = null; // mark distance as "out of date" totalEntries++; }
java
public void put(String id, StringWrapper toInsert,Object value) { MyWrapper wrapper = asMyWrapper(toInsert); Token[] tokens = wrapper.getTokens(); for (int i=0; i<tokens.length; i++) { ArrayList stringsWithToken = (ArrayList) index.get(tokens[i]); if (stringsWithToken==null) index.put( tokens[i], (stringsWithToken=new ArrayList()) ); stringsWithToken.add( wrapper ); } map.put( wrapper, value ); if (id!=null) idMap.put( wrapper, id ); distance = null; // mark distance as "out of date" totalEntries++; }
[ "public", "void", "put", "(", "String", "id", ",", "StringWrapper", "toInsert", ",", "Object", "value", ")", "{", "MyWrapper", "wrapper", "=", "asMyWrapper", "(", "toInsert", ")", ";", "Token", "[", "]", "tokens", "=", "wrapper", ".", "getTokens", "(", "...
Insert a prepared string into the dictionary. <p>Id is a special tag used to handle 'leave one out' lookups. If you do a lookup on a string with a non-null id, you get the closest matches that do not have the same id.
[ "Insert", "a", "prepared", "string", "into", "the", "dictionary", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/lookup/SoftDictionary.java#L164-L177
m-m-m/util
cli/src/main/java/net/sf/mmm/util/cli/base/CliState.java
CliState.addOption
private void addOption(String nameOrAlias, CliOptionContainer option) { CliOptionContainer old = this.name2OptionMap.put(nameOrAlias, option); if (old != null) { throw new DuplicateObjectException(option, nameOrAlias); } }
java
private void addOption(String nameOrAlias, CliOptionContainer option) { CliOptionContainer old = this.name2OptionMap.put(nameOrAlias, option); if (old != null) { throw new DuplicateObjectException(option, nameOrAlias); } }
[ "private", "void", "addOption", "(", "String", "nameOrAlias", ",", "CliOptionContainer", "option", ")", "{", "CliOptionContainer", "old", "=", "this", ".", "name2OptionMap", ".", "put", "(", "nameOrAlias", ",", "option", ")", ";", "if", "(", "old", "!=", "nu...
This method {@link #getOption(String) registers} the given {@link CliOptionContainer option} with the given {@code name}. @param nameOrAlias is the {@link CliOption#name()} or {@link CliOption#aliases() alias} of the option. @param option is the {@link CliOptionContainer option} to register.
[ "This", "method", "{", "@link", "#getOption", "(", "String", ")", "registers", "}", "the", "given", "{", "@link", "CliOptionContainer", "option", "}", "with", "the", "given", "{", "@code", "name", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/CliState.java#L358-L364
mgormley/optimize
src/main/java/edu/jhu/hlt/util/Utilities.java
Utilities.sampleWithoutReplacement
public static int[] sampleWithoutReplacement(int m, int n) { // This implements a modified form of the genshuf() function from // Programming Pearls pg. 129. // TODO: Design a faster method that only generates min(m, n-m) integers. int[] array = getIndexArray(n); for (int i=0; i<m; i++) { int j = Prng.nextInt(n - i) + i; // Swap array[i] and array[j] int tmp = array[i]; array[i] = array[j]; array[j] = tmp; } return Arrays.copyOf(array, m); }
java
public static int[] sampleWithoutReplacement(int m, int n) { // This implements a modified form of the genshuf() function from // Programming Pearls pg. 129. // TODO: Design a faster method that only generates min(m, n-m) integers. int[] array = getIndexArray(n); for (int i=0; i<m; i++) { int j = Prng.nextInt(n - i) + i; // Swap array[i] and array[j] int tmp = array[i]; array[i] = array[j]; array[j] = tmp; } return Arrays.copyOf(array, m); }
[ "public", "static", "int", "[", "]", "sampleWithoutReplacement", "(", "int", "m", ",", "int", "n", ")", "{", "// This implements a modified form of the genshuf() function from", "// Programming Pearls pg. 129.", "// TODO: Design a faster method that only generates min(m, n-m) integer...
Samples a set of m integers without replacement from the range [0,...,n-1]. @param m The number of integers to return. @param n The number of integers from which to sample. @return The sample as an unsorted integer array.
[ "Samples", "a", "set", "of", "m", "integers", "without", "replacement", "from", "the", "range", "[", "0", "...", "n", "-", "1", "]", "." ]
train
https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/util/Utilities.java#L419-L434
johncarl81/transfuse
transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java
InjectionPointFactory.buildInjectionPoint
public ConstructorInjectionPoint buildInjectionPoint(ASTType containingType, ASTConstructor astConstructor, AnalysisContext context) { ConstructorInjectionPoint constructorInjectionPoint = new ConstructorInjectionPoint(containingType, astConstructor); constructorInjectionPoint.addThrows(astConstructor.getThrowsTypes()); List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>(); //bindingAnnotations for single parameter from method level if (astConstructor.getParameters().size() == 1) { methodAnnotations.addAll(astConstructor.getAnnotations()); } for (ASTParameter astParameter : astConstructor.getParameters()) { List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations); parameterAnnotations.addAll(astParameter.getAnnotations()); constructorInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context)); } return constructorInjectionPoint; }
java
public ConstructorInjectionPoint buildInjectionPoint(ASTType containingType, ASTConstructor astConstructor, AnalysisContext context) { ConstructorInjectionPoint constructorInjectionPoint = new ConstructorInjectionPoint(containingType, astConstructor); constructorInjectionPoint.addThrows(astConstructor.getThrowsTypes()); List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>(); //bindingAnnotations for single parameter from method level if (astConstructor.getParameters().size() == 1) { methodAnnotations.addAll(astConstructor.getAnnotations()); } for (ASTParameter astParameter : astConstructor.getParameters()) { List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations); parameterAnnotations.addAll(astParameter.getAnnotations()); constructorInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context)); } return constructorInjectionPoint; }
[ "public", "ConstructorInjectionPoint", "buildInjectionPoint", "(", "ASTType", "containingType", ",", "ASTConstructor", "astConstructor", ",", "AnalysisContext", "context", ")", "{", "ConstructorInjectionPoint", "constructorInjectionPoint", "=", "new", "ConstructorInjectionPoint",...
Build a Constructor InjectionPoint from the given ASTConstructor @param astConstructor required ASTConstructor @param context required AnalysisContext @return ConstructorInjectionPoint
[ "Build", "a", "Constructor", "InjectionPoint", "from", "the", "given", "ASTConstructor" ]
train
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java#L70-L88
alkacon/opencms-core
src/org/opencms/db/CmsAliasManager.java
CmsAliasManager.saveAliases
public synchronized void saveAliases(CmsObject cms, CmsUUID structureId, List<CmsAlias> aliases) throws CmsException { m_securityManager.saveAliases(cms.getRequestContext(), cms.readResource(structureId), aliases); touch(cms, cms.readResource(structureId)); }
java
public synchronized void saveAliases(CmsObject cms, CmsUUID structureId, List<CmsAlias> aliases) throws CmsException { m_securityManager.saveAliases(cms.getRequestContext(), cms.readResource(structureId), aliases); touch(cms, cms.readResource(structureId)); }
[ "public", "synchronized", "void", "saveAliases", "(", "CmsObject", "cms", ",", "CmsUUID", "structureId", ",", "List", "<", "CmsAlias", ">", "aliases", ")", "throws", "CmsException", "{", "m_securityManager", ".", "saveAliases", "(", "cms", ".", "getRequestContext"...
Saves the aliases for a given structure id, <b>completely replacing</b> any existing aliases for the same structure id.<p> @param cms the current CMS context @param structureId the structure id of a resource @param aliases the list of aliases which should be written @throws CmsException if something goes wrong
[ "Saves", "the", "aliases", "for", "a", "given", "structure", "id", "<b", ">", "completely", "replacing<", "/", "b", ">", "any", "existing", "aliases", "for", "the", "same", "structure", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsAliasManager.java#L240-L245
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressRestrictionPersistenceImpl.java
CommerceAddressRestrictionPersistenceImpl.findByCommerceCountryId
@Override public List<CommerceAddressRestriction> findByCommerceCountryId( long commerceCountryId, int start, int end) { return findByCommerceCountryId(commerceCountryId, start, end, null); }
java
@Override public List<CommerceAddressRestriction> findByCommerceCountryId( long commerceCountryId, int start, int end) { return findByCommerceCountryId(commerceCountryId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceAddressRestriction", ">", "findByCommerceCountryId", "(", "long", "commerceCountryId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCommerceCountryId", "(", "commerceCountryId", ",", "start", ","...
Returns a range of all the commerce address restrictions where commerceCountryId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceAddressRestrictionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param commerceCountryId the commerce country ID @param start the lower bound of the range of commerce address restrictions @param end the upper bound of the range of commerce address restrictions (not inclusive) @return the range of matching commerce address restrictions
[ "Returns", "a", "range", "of", "all", "the", "commerce", "address", "restrictions", "where", "commerceCountryId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressRestrictionPersistenceImpl.java#L144-L148
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java
HttpFields.putDateField
public void putDateField(HttpHeader name, long date) { String d = DateGenerator.formatDate(date); put(name, d); }
java
public void putDateField(HttpHeader name, long date) { String d = DateGenerator.formatDate(date); put(name, d); }
[ "public", "void", "putDateField", "(", "HttpHeader", "name", ",", "long", "date", ")", "{", "String", "d", "=", "DateGenerator", ".", "formatDate", "(", "date", ")", ";", "put", "(", "name", ",", "d", ")", ";", "}" ]
Sets the value of a date field. @param name the field name @param date the field date value
[ "Sets", "the", "value", "of", "a", "date", "field", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java#L673-L676