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
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/util/TransparentReplicaGetHelper.java
TransparentReplicaGetHelper.getFirstPrimaryOrReplica
@InterfaceStability.Experimental @InterfaceAudience.Public public Single<JsonDocument> getFirstPrimaryOrReplica(final String id, final Bucket bucket) { return getFirstPrimaryOrReplica(id, bucket, bucket.environment().kvTimeout()); }
java
@InterfaceStability.Experimental @InterfaceAudience.Public public Single<JsonDocument> getFirstPrimaryOrReplica(final String id, final Bucket bucket) { return getFirstPrimaryOrReplica(id, bucket, bucket.environment().kvTimeout()); }
[ "@", "InterfaceStability", ".", "Experimental", "@", "InterfaceAudience", ".", "Public", "public", "Single", "<", "JsonDocument", ">", "getFirstPrimaryOrReplica", "(", "final", "String", "id", ",", "final", "Bucket", "bucket", ")", "{", "return", "getFirstPrimaryOrR...
Asynchronously fetch the document from the primary and if that operations fails try all the replicas and return the first document that comes back from them (using the environments KV timeout for both primary and replica). @param id the document ID to fetch. @param bucket the bucket to use when fetching the doc. @return an {@link Single} with either 0 or 1 {@link JsonDocument}.
[ "Asynchronously", "fetch", "the", "document", "from", "the", "primary", "and", "if", "that", "operations", "fails", "try", "all", "the", "replicas", "and", "return", "the", "first", "document", "that", "comes", "back", "from", "them", "(", "using", "the", "e...
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/TransparentReplicaGetHelper.java#L88-L92
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java
Node.addItemDeleteListener
public void addItemDeleteListener(ItemDeleteListener listener) { StanzaListener delListener = new ItemDeleteTranslator(listener); itemDeleteToListenerMap.put(listener, delListener); EventContentFilter deleteItem = new EventContentFilter(EventElementType.items.toString(), "retract"); EventContentFilter purge = new EventContentFilter(EventElementType.purge.toString()); // TODO: Use AsyncButOrdered (with Node as Key?) pubSubManager.getConnection().addSyncStanzaListener(delListener, new OrFilter(deleteItem, purge)); }
java
public void addItemDeleteListener(ItemDeleteListener listener) { StanzaListener delListener = new ItemDeleteTranslator(listener); itemDeleteToListenerMap.put(listener, delListener); EventContentFilter deleteItem = new EventContentFilter(EventElementType.items.toString(), "retract"); EventContentFilter purge = new EventContentFilter(EventElementType.purge.toString()); // TODO: Use AsyncButOrdered (with Node as Key?) pubSubManager.getConnection().addSyncStanzaListener(delListener, new OrFilter(deleteItem, purge)); }
[ "public", "void", "addItemDeleteListener", "(", "ItemDeleteListener", "listener", ")", "{", "StanzaListener", "delListener", "=", "new", "ItemDeleteTranslator", "(", "listener", ")", ";", "itemDeleteToListenerMap", ".", "put", "(", "listener", ",", "delListener", ")",...
Register an listener for item delete events. This listener gets called whenever an item is deleted from the node. @param listener The handler for the event
[ "Register", "an", "listener", "for", "item", "delete", "events", ".", "This", "listener", "gets", "called", "whenever", "an", "item", "is", "deleted", "from", "the", "node", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L546-L554
foundation-runtime/service-directory
1.1/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java
DirectoryRegistrationService.unregisterService
public void unregisterService(String serviceName, String providerId) { getServiceDirectoryClient().unregisterInstance(serviceName, providerId, disableOwnerError); }
java
public void unregisterService(String serviceName, String providerId) { getServiceDirectoryClient().unregisterInstance(serviceName, providerId, disableOwnerError); }
[ "public", "void", "unregisterService", "(", "String", "serviceName", ",", "String", "providerId", ")", "{", "getServiceDirectoryClient", "(", ")", ".", "unregisterInstance", "(", "serviceName", ",", "providerId", ",", "disableOwnerError", ")", ";", "}" ]
Unregister a ProvidedServiceInstance The ProvidedServiceInstance is uniquely identified by serviceName and providerId @param serviceName the serviceName of ProvidedServiceInstance. @param providerId the provierId of ProvidedServiceInstance.
[ "Unregister", "a", "ProvidedServiceInstance", "The", "ProvidedServiceInstance", "is", "uniquely", "identified", "by", "serviceName", "and", "providerId" ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.1/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java#L165-L167
lviggiano/owner
owner/src/main/java/org/aeonbits/owner/ConfigCache.java
ConfigCache.getOrCreate
public static <T extends Config> T getOrCreate(Class<? extends T> clazz, Map<?, ?>... imports) { return getOrCreate(ConfigFactory.INSTANCE, clazz, clazz, imports); }
java
public static <T extends Config> T getOrCreate(Class<? extends T> clazz, Map<?, ?>... imports) { return getOrCreate(ConfigFactory.INSTANCE, clazz, clazz, imports); }
[ "public", "static", "<", "T", "extends", "Config", ">", "T", "getOrCreate", "(", "Class", "<", "?", "extends", "T", ">", "clazz", ",", "Map", "<", "?", ",", "?", ">", "...", "imports", ")", "{", "return", "getOrCreate", "(", "ConfigFactory", ".", "IN...
Gets from the cache or create, an instance of the given class using the given imports. The factory used to create new instances is the static {@link ConfigFactory#INSTANCE}. @param clazz the interface extending from {@link Config} that you want to instantiate. @param imports additional variables to be used to resolve the properties. @param <T> type of the interface. @return an object implementing the given interface, that can be taken from the cache, which maps methods to property values.
[ "Gets", "from", "the", "cache", "or", "create", "an", "instance", "of", "the", "given", "class", "using", "the", "given", "imports", ".", "The", "factory", "used", "to", "create", "new", "instances", "is", "the", "static", "{", "@link", "ConfigFactory#INSTAN...
train
https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner/src/main/java/org/aeonbits/owner/ConfigCache.java#L41-L43
cdk/cdk
descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java
Tanimoto.calculate
public static double calculate(IBitFingerprint fingerprint1, IBitFingerprint fingerprint2) { if (fingerprint1.size() != fingerprint2.size()) { throw new IllegalArgumentException("Fingerprints must have the same size"); } int cardinality1 = fingerprint1.cardinality(); int cardinality2 = fingerprint2.cardinality(); // If the fingerprint is an IntArrayFingeprint that could mean a big // fingerprint so let's take the safe way out and create a // new IntArrayfingerprint IBitFingerprint one_and_two = fingerprint1 instanceof IntArrayFingerprint ? new IntArrayFingerprint( fingerprint1) : new BitSetFingerprint(fingerprint1); one_and_two.and(fingerprint2); double cardinalityCommon = one_and_two.cardinality(); return cardinalityCommon / (cardinality1 + cardinality2 - cardinalityCommon); }
java
public static double calculate(IBitFingerprint fingerprint1, IBitFingerprint fingerprint2) { if (fingerprint1.size() != fingerprint2.size()) { throw new IllegalArgumentException("Fingerprints must have the same size"); } int cardinality1 = fingerprint1.cardinality(); int cardinality2 = fingerprint2.cardinality(); // If the fingerprint is an IntArrayFingeprint that could mean a big // fingerprint so let's take the safe way out and create a // new IntArrayfingerprint IBitFingerprint one_and_two = fingerprint1 instanceof IntArrayFingerprint ? new IntArrayFingerprint( fingerprint1) : new BitSetFingerprint(fingerprint1); one_and_two.and(fingerprint2); double cardinalityCommon = one_and_two.cardinality(); return cardinalityCommon / (cardinality1 + cardinality2 - cardinalityCommon); }
[ "public", "static", "double", "calculate", "(", "IBitFingerprint", "fingerprint1", ",", "IBitFingerprint", "fingerprint2", ")", "{", "if", "(", "fingerprint1", ".", "size", "(", ")", "!=", "fingerprint2", ".", "size", "(", ")", ")", "{", "throw", "new", "Ill...
Evaluates Tanimoto coefficient for two <code>IBitFingerprint</code>. <p> @param fingerprint1 fingerprint for the first molecule @param fingerprint2 fingerprint for the second molecule @return The Tanimoto coefficient @throws IllegalArgumentException if bitsets are not of the same length
[ "Evaluates", "Tanimoto", "coefficient", "for", "two", "<code", ">", "IBitFingerprint<", "/", "code", ">", ".", "<p", ">" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java#L98-L112
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/contentcensor/AipContentCensor.java
AipContentCensor.imageCensorComb
public JSONObject imageCensorComb(byte[] imgData, List<String> scenes, HashMap<String, String> options) { AipRequest request = new AipRequest(); String base64Content = Base64Util.encode(imgData); request.addBody("image", base64Content); return imageCensorCombHelper(request, scenes, options); }
java
public JSONObject imageCensorComb(byte[] imgData, List<String> scenes, HashMap<String, String> options) { AipRequest request = new AipRequest(); String base64Content = Base64Util.encode(imgData); request.addBody("image", base64Content); return imageCensorCombHelper(request, scenes, options); }
[ "public", "JSONObject", "imageCensorComb", "(", "byte", "[", "]", "imgData", ",", "List", "<", "String", ">", "scenes", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", "...
组合审核接口 @param imgData 图片二进制数据 @param scenes 需要审核的服务类型 @param options 可选参数 @return JSONObject
[ "组合审核接口" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/contentcensor/AipContentCensor.java#L183-L190
keenon/loglinear
src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java
GraphicalModel.addStaticBinaryFactor
public Factor addStaticBinaryFactor(int a, int b, BiFunction<Integer, Integer, Double> value) { int[] variableDims = getVariableSizes(); assert a < variableDims.length; assert b < variableDims.length; return addStaticFactor(new int[]{a, b}, new int[]{variableDims[a], variableDims[b]}, assignment -> value.apply(assignment[0], assignment[1])); }
java
public Factor addStaticBinaryFactor(int a, int b, BiFunction<Integer, Integer, Double> value) { int[] variableDims = getVariableSizes(); assert a < variableDims.length; assert b < variableDims.length; return addStaticFactor(new int[]{a, b}, new int[]{variableDims[a], variableDims[b]}, assignment -> value.apply(assignment[0], assignment[1])); }
[ "public", "Factor", "addStaticBinaryFactor", "(", "int", "a", ",", "int", "b", ",", "BiFunction", "<", "Integer", ",", "Integer", ",", "Double", ">", "value", ")", "{", "int", "[", "]", "variableDims", "=", "getVariableSizes", "(", ")", ";", "assert", "a...
Add a binary factor, where we just want to hard-code the value of the factor. @param a The index of the first variable. @param b The index of the second variable. @param value A mapping from assignments of the two variables, to a factor value. @return a reference to the created factor. This can be safely ignored, as the factor is already saved in the model
[ "Add", "a", "binary", "factor", "where", "we", "just", "want", "to", "hard", "-", "code", "the", "value", "of", "the", "factor", "." ]
train
https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java#L469-L475
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java
ProfilePackageIndexFrameWriter.getPackage
protected Content getPackage(PackageDoc pd, String profileName) { Content packageLinkContent; Content pkgLabel; if (pd.name().length() > 0) { pkgLabel = getPackageLabel(pd.name()); packageLinkContent = getHyperLink(pathString(pd, DocPaths.profilePackageFrame(profileName)), pkgLabel, "", "packageFrame"); } else { pkgLabel = new StringContent("<unnamed package>"); packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME, pkgLabel, "", "packageFrame"); } Content li = HtmlTree.LI(packageLinkContent); return li; }
java
protected Content getPackage(PackageDoc pd, String profileName) { Content packageLinkContent; Content pkgLabel; if (pd.name().length() > 0) { pkgLabel = getPackageLabel(pd.name()); packageLinkContent = getHyperLink(pathString(pd, DocPaths.profilePackageFrame(profileName)), pkgLabel, "", "packageFrame"); } else { pkgLabel = new StringContent("<unnamed package>"); packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME, pkgLabel, "", "packageFrame"); } Content li = HtmlTree.LI(packageLinkContent); return li; }
[ "protected", "Content", "getPackage", "(", "PackageDoc", "pd", ",", "String", "profileName", ")", "{", "Content", "packageLinkContent", ";", "Content", "pkgLabel", ";", "if", "(", "pd", ".", "name", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", ...
Gets each package name as a separate link. @param pd PackageDoc @param profileName the name of the profile being documented @return content for the package link
[ "Gets", "each", "package", "name", "as", "a", "separate", "link", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java#L112-L127
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java
X509CertSelector.setSubject
public void setSubject(byte[] subjectDN) throws IOException { try { subject = (subjectDN == null ? null : new X500Principal(subjectDN)); } catch (IllegalArgumentException e) { throw new IOException("Invalid name", e); } }
java
public void setSubject(byte[] subjectDN) throws IOException { try { subject = (subjectDN == null ? null : new X500Principal(subjectDN)); } catch (IllegalArgumentException e) { throw new IOException("Invalid name", e); } }
[ "public", "void", "setSubject", "(", "byte", "[", "]", "subjectDN", ")", "throws", "IOException", "{", "try", "{", "subject", "=", "(", "subjectDN", "==", "null", "?", "null", ":", "new", "X500Principal", "(", "subjectDN", ")", ")", ";", "}", "catch", ...
Sets the subject criterion. The specified distinguished name must match the subject distinguished name in the {@code X509Certificate}. If {@code null}, any subject distinguished name will do. <p> If {@code subjectDN} is not {@code null}, it should contain a single DER encoded distinguished name, as defined in X.501. For the ASN.1 notation for this structure, see {@link #setIssuer(byte [] issuerDN) setIssuer(byte [] issuerDN)}. @param subjectDN a byte array containing the distinguished name in ASN.1 DER format (or {@code null}) @throws IOException if an encoding error occurs (incorrect form for DN)
[ "Sets", "the", "subject", "criterion", ".", "The", "specified", "distinguished", "name", "must", "match", "the", "subject", "distinguished", "name", "in", "the", "{", "@code", "X509Certificate", "}", ".", "If", "{", "@code", "null", "}", "any", "subject", "d...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java#L341-L347
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/CreditBasedPartitionRequestClientHandler.java
CreditBasedPartitionRequestClientHandler.userEventTriggered
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof RemoteInputChannel) { boolean triggerWrite = inputChannelsWithCredit.isEmpty(); inputChannelsWithCredit.add((RemoteInputChannel) msg); if (triggerWrite) { writeAndFlushNextMessageIfPossible(ctx.channel()); } } else { ctx.fireUserEventTriggered(msg); } }
java
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof RemoteInputChannel) { boolean triggerWrite = inputChannelsWithCredit.isEmpty(); inputChannelsWithCredit.add((RemoteInputChannel) msg); if (triggerWrite) { writeAndFlushNextMessageIfPossible(ctx.channel()); } } else { ctx.fireUserEventTriggered(msg); } }
[ "@", "Override", "public", "void", "userEventTriggered", "(", "ChannelHandlerContext", "ctx", ",", "Object", "msg", ")", "throws", "Exception", "{", "if", "(", "msg", "instanceof", "RemoteInputChannel", ")", "{", "boolean", "triggerWrite", "=", "inputChannelsWithCre...
Triggered by notifying credit available in the client handler pipeline. <p>Enqueues the input channel and will trigger write&flush unannounced credits for this input channel if it is the first one in the queue.
[ "Triggered", "by", "notifying", "credit", "available", "in", "the", "client", "handler", "pipeline", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/CreditBasedPartitionRequestClientHandler.java#L187-L200
eclipse/xtext-extras
org.eclipse.xtext.smap/src/org/eclipse/xtext/smap/SmapStratum.java
SmapStratum.addFile
public void addFile(String filename, String filePath) { int pathIndex = filePathList.indexOf(filePath); if (pathIndex == -1) { fileNameList.add(filename); filePathList.add(filePath); } }
java
public void addFile(String filename, String filePath) { int pathIndex = filePathList.indexOf(filePath); if (pathIndex == -1) { fileNameList.add(filename); filePathList.add(filePath); } }
[ "public", "void", "addFile", "(", "String", "filename", ",", "String", "filePath", ")", "{", "int", "pathIndex", "=", "filePathList", ".", "indexOf", "(", "filePath", ")", ";", "if", "(", "pathIndex", "==", "-", "1", ")", "{", "fileNameList", ".", "add",...
Adds record of a new file, by filename and path. The path may be relative to a source compilation path. @param filename the filename to add, unqualified by path @param filePath the path for the filename, potentially relative to a source compilation path
[ "Adds", "record", "of", "a", "new", "file", "by", "filename", "and", "path", ".", "The", "path", "may", "be", "relative", "to", "a", "source", "compilation", "path", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.smap/src/org/eclipse/xtext/smap/SmapStratum.java#L161-L167
Teddy-Zhu/SilentGo
framework/src/main/java/com/silentgo/servlet/oreilly/multipart/BufferedServletInputStream.java
BufferedServletInputStream.findeol
private static int findeol(byte b[], int pos, int len) { int end = pos + len; int i = pos; while (i < end) { if (b[i++] == '\n') { return i - pos; } } return -1; }
java
private static int findeol(byte b[], int pos, int len) { int end = pos + len; int i = pos; while (i < end) { if (b[i++] == '\n') { return i - pos; } } return -1; }
[ "private", "static", "int", "findeol", "(", "byte", "b", "[", "]", ",", "int", "pos", ",", "int", "len", ")", "{", "int", "end", "=", "pos", "+", "len", ";", "int", "i", "=", "pos", ";", "while", "(", "i", "<", "end", ")", "{", "if", "(", "...
Attempt to find the '\n' end of line marker as defined in the comment of the <code>readLine</code> method of <code>ServletInputStream</code>. @param b byte array to search. @param pos position in byte array to search from. @param len maximum number of bytes to search. @return the number of bytes including the \n, or -1 if none found.
[ "Attempt", "to", "find", "the", "\\", "n", "end", "of", "line", "marker", "as", "defined", "in", "the", "comment", "of", "the", "<code", ">", "readLine<", "/", "code", ">", "method", "of", "<code", ">", "ServletInputStream<", "/", "code", ">", "." ]
train
https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/framework/src/main/java/com/silentgo/servlet/oreilly/multipart/BufferedServletInputStream.java#L151-L160
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java
CollationRootElements.getPrimaryAfter
long getPrimaryAfter(long p, int index, boolean isCompressible) { assert(p == (elements[index] & 0xffffff00L) || isEndOfPrimaryRange(elements[index + 1])); long q = elements[++index]; int step; if((q & SEC_TER_DELTA_FLAG) == 0 && (step = (int)q & PRIMARY_STEP_MASK) != 0) { // Return the next primary in this range. if((p & 0xffff) == 0) { return Collation.incTwoBytePrimaryByOffset(p, isCompressible, step); } else { return Collation.incThreeBytePrimaryByOffset(p, isCompressible, step); } } else { // Return the next primary in the list. while((q & SEC_TER_DELTA_FLAG) != 0) { q = elements[++index]; } assert((q & PRIMARY_STEP_MASK) == 0); return q; } }
java
long getPrimaryAfter(long p, int index, boolean isCompressible) { assert(p == (elements[index] & 0xffffff00L) || isEndOfPrimaryRange(elements[index + 1])); long q = elements[++index]; int step; if((q & SEC_TER_DELTA_FLAG) == 0 && (step = (int)q & PRIMARY_STEP_MASK) != 0) { // Return the next primary in this range. if((p & 0xffff) == 0) { return Collation.incTwoBytePrimaryByOffset(p, isCompressible, step); } else { return Collation.incThreeBytePrimaryByOffset(p, isCompressible, step); } } else { // Return the next primary in the list. while((q & SEC_TER_DELTA_FLAG) != 0) { q = elements[++index]; } assert((q & PRIMARY_STEP_MASK) == 0); return q; } }
[ "long", "getPrimaryAfter", "(", "long", "p", ",", "int", "index", ",", "boolean", "isCompressible", ")", "{", "assert", "(", "p", "==", "(", "elements", "[", "index", "]", "&", "0xffffff00", "L", ")", "||", "isEndOfPrimaryRange", "(", "elements", "[", "i...
Returns the primary weight after p where index=findPrimary(p). p must be at least the first root primary.
[ "Returns", "the", "primary", "weight", "after", "p", "where", "index", "=", "findPrimary", "(", "p", ")", ".", "p", "must", "be", "at", "least", "the", "first", "root", "primary", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java#L323-L342
cdk/cdk
base/dict/src/main/java/org/openscience/cdk/dict/DictionaryDatabase.java
DictionaryDatabase.readDictionary
public void readDictionary(Reader reader, String name) { name = name.toLowerCase(); logger.debug("Reading dictionary: ", name); if (!dictionaries.containsKey(name)) { try { Dictionary dictionary = Dictionary.unmarshal(reader); dictionaries.put(name, dictionary); logger.debug(" ... loaded and stored"); } catch (Exception exception) { logger.error("Could not read dictionary: ", name); logger.debug(exception); } } else { logger.error("Dictionary already loaded: ", name); } }
java
public void readDictionary(Reader reader, String name) { name = name.toLowerCase(); logger.debug("Reading dictionary: ", name); if (!dictionaries.containsKey(name)) { try { Dictionary dictionary = Dictionary.unmarshal(reader); dictionaries.put(name, dictionary); logger.debug(" ... loaded and stored"); } catch (Exception exception) { logger.error("Could not read dictionary: ", name); logger.debug(exception); } } else { logger.error("Dictionary already loaded: ", name); } }
[ "public", "void", "readDictionary", "(", "Reader", "reader", ",", "String", "name", ")", "{", "name", "=", "name", ".", "toLowerCase", "(", ")", ";", "logger", ".", "debug", "(", "\"Reading dictionary: \"", ",", "name", ")", ";", "if", "(", "!", "diction...
Reads a custom dictionary into the database. @param reader The reader from which the dictionary data will be read @param name The name of the dictionary
[ "Reads", "a", "custom", "dictionary", "into", "the", "database", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/dict/src/main/java/org/openscience/cdk/dict/DictionaryDatabase.java#L112-L127
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java
AbstractJsonDeserializer.getDateParam
protected Date getDateParam(String paramName, String errorMessage, Map<String, Object> mapToUse) throws IOException { String dateInString = getStringParam(paramName, errorMessage, mapToUse); if (dateInString == null) { if (errorMessage == null) { return null; } else { throw new IOException(errorMessage); } } try { DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); return formatter.parse(dateInString); } catch (ParseException ignored) { DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); try { return formatter.parse(dateInString); } catch (ParseException e) { if (errorMessage == null) { return null; } else { throw new IOException(errorMessage, e); } } } }
java
protected Date getDateParam(String paramName, String errorMessage, Map<String, Object> mapToUse) throws IOException { String dateInString = getStringParam(paramName, errorMessage, mapToUse); if (dateInString == null) { if (errorMessage == null) { return null; } else { throw new IOException(errorMessage); } } try { DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); return formatter.parse(dateInString); } catch (ParseException ignored) { DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); try { return formatter.parse(dateInString); } catch (ParseException e) { if (errorMessage == null) { return null; } else { throw new IOException(errorMessage, e); } } } }
[ "protected", "Date", "getDateParam", "(", "String", "paramName", ",", "String", "errorMessage", ",", "Map", "<", "String", ",", "Object", ">", "mapToUse", ")", "throws", "IOException", "{", "String", "dateInString", "=", "getStringParam", "(", "paramName", ",", ...
Parses a date from either dd/MM/yyyy or yyyy-MM-dd format @param paramName the name of the parameter containing the date @param errorMessage the message to put in an error if one occurs @param mapToUse the external map that should be used as inputsource for parameters @return a date object correcponding with the jsonobject @throws IOException If something went wrong
[ "Parses", "a", "date", "from", "either", "dd", "/", "MM", "/", "yyyy", "or", "yyyy", "-", "MM", "-", "dd", "format" ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java#L357-L381
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermListsImpl.java
ListManagementTermListsImpl.refreshIndexMethodAsync
public Observable<RefreshIndex> refreshIndexMethodAsync(String listId, String language) { return refreshIndexMethodWithServiceResponseAsync(listId, language).map(new Func1<ServiceResponse<RefreshIndex>, RefreshIndex>() { @Override public RefreshIndex call(ServiceResponse<RefreshIndex> response) { return response.body(); } }); }
java
public Observable<RefreshIndex> refreshIndexMethodAsync(String listId, String language) { return refreshIndexMethodWithServiceResponseAsync(listId, language).map(new Func1<ServiceResponse<RefreshIndex>, RefreshIndex>() { @Override public RefreshIndex call(ServiceResponse<RefreshIndex> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RefreshIndex", ">", "refreshIndexMethodAsync", "(", "String", "listId", ",", "String", "language", ")", "{", "return", "refreshIndexMethodWithServiceResponseAsync", "(", "listId", ",", "language", ")", ".", "map", "(", "new", "Func1", ...
Refreshes the index of the list with list Id equal to list ID passed. @param listId List Id of the image list. @param language Language of the terms. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RefreshIndex object
[ "Refreshes", "the", "index", "of", "the", "list", "with", "list", "Id", "equal", "to", "list", "ID", "passed", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermListsImpl.java#L527-L534
assertthat/selenium-shutterbug
src/main/java/com/assertthat/selenium_shutterbug/core/Snapshot.java
Snapshot.withThumbnail
public T withThumbnail(Path path, String name, double scale) { return withThumbnail(path.toString(),name,scale); }
java
public T withThumbnail(Path path, String name, double scale) { return withThumbnail(path.toString(),name,scale); }
[ "public", "T", "withThumbnail", "(", "Path", "path", ",", "String", "name", ",", "double", "scale", ")", "{", "return", "withThumbnail", "(", "path", ".", "toString", "(", ")", ",", "name", ",", "scale", ")", ";", "}" ]
Generate a thumbnail of the original screenshot. Will save different thumbnails depends on when it was called in the chain. @param path to save thumbnail image to @param name of the resulting image @param scale to apply @return instance of type Snapshot
[ "Generate", "a", "thumbnail", "of", "the", "original", "screenshot", ".", "Will", "save", "different", "thumbnails", "depends", "on", "when", "it", "was", "called", "in", "the", "chain", "." ]
train
https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/core/Snapshot.java#L158-L160
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.listPreparationAndReleaseTaskStatusNext
public PagedList<JobPreparationAndReleaseTaskExecutionInformation> listPreparationAndReleaseTaskStatusNext(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions) { ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders> response = listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions).toBlocking().single(); return new PagedList<JobPreparationAndReleaseTaskExecutionInformation>(response.body()) { @Override public Page<JobPreparationAndReleaseTaskExecutionInformation> nextPage(String nextPageLink) { return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions).toBlocking().single().body(); } }; }
java
public PagedList<JobPreparationAndReleaseTaskExecutionInformation> listPreparationAndReleaseTaskStatusNext(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions) { ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders> response = listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions).toBlocking().single(); return new PagedList<JobPreparationAndReleaseTaskExecutionInformation>(response.body()) { @Override public Page<JobPreparationAndReleaseTaskExecutionInformation> nextPage(String nextPageLink) { return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "JobPreparationAndReleaseTaskExecutionInformation", ">", "listPreparationAndReleaseTaskStatusNext", "(", "final", "String", "nextPageLink", ",", "final", "JobListPreparationAndReleaseTaskStatusNextOptions", "jobListPreparationAndReleaseTaskStatusNextOptions", ...
Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. @param nextPageLink The NextLink from the previous successful call to List operation. @param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;JobPreparationAndReleaseTaskExecutionInformation&gt; object if successful.
[ "Lists", "the", "execution", "status", "of", "the", "Job", "Preparation", "and", "Job", "Release", "task", "for", "the", "specified", "job", "across", "the", "compute", "nodes", "where", "the", "job", "has", "run", ".", "This", "API", "returns", "the", "Jo...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L3923-L3931
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/SessionNode.java
SessionNode.getSegment
protected final Segment getSegment( NodeCache cache, CachedNode parent ) { if (parent != null) { ChildReference ref = parent.getChildReferences(cache).getChild(key); if (ref == null) { // This node doesn't exist in the parent throw new NodeNotFoundInParentException(key, parent.getKey()); } return ref.getSegment(); } // This is the root node ... return workspace(cache).childReferenceForRoot().getSegment(); }
java
protected final Segment getSegment( NodeCache cache, CachedNode parent ) { if (parent != null) { ChildReference ref = parent.getChildReferences(cache).getChild(key); if (ref == null) { // This node doesn't exist in the parent throw new NodeNotFoundInParentException(key, parent.getKey()); } return ref.getSegment(); } // This is the root node ... return workspace(cache).childReferenceForRoot().getSegment(); }
[ "protected", "final", "Segment", "getSegment", "(", "NodeCache", "cache", ",", "CachedNode", "parent", ")", "{", "if", "(", "parent", "!=", "null", ")", "{", "ChildReference", "ref", "=", "parent", ".", "getChildReferences", "(", "cache", ")", ".", "getChild...
Get the segment for this node. @param cache the cache @param parent the parent node @return the segment @throws NodeNotFoundInParentException if the node doesn't exist in the referenced parent
[ "Get", "the", "segment", "for", "this", "node", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/SessionNode.java#L429-L441
graphql-java/java-dataloader
src/main/java/org/dataloader/DataLoader.java
DataLoader.newDataLoaderWithTry
public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoaderWithContext<K, Try<V>> batchLoadFunction) { return newDataLoaderWithTry(batchLoadFunction, null); }
java
public static <K, V> DataLoader<K, V> newDataLoaderWithTry(BatchLoaderWithContext<K, Try<V>> batchLoadFunction) { return newDataLoaderWithTry(batchLoadFunction, null); }
[ "public", "static", "<", "K", ",", "V", ">", "DataLoader", "<", "K", ",", "V", ">", "newDataLoaderWithTry", "(", "BatchLoaderWithContext", "<", "K", ",", "Try", "<", "V", ">", ">", "batchLoadFunction", ")", "{", "return", "newDataLoaderWithTry", "(", "batc...
Creates new DataLoader with the specified batch loader function and default options (batching, caching and unlimited batch size) where the batch loader function returns a list of {@link org.dataloader.Try} objects. <p> If its important you to know the exact status of each item in a batch call and whether it threw exceptions then you can use this form to create the data loader. <p> Using Try objects allows you to capture a value returned or an exception that might have occurred trying to get a value. . @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects @param <K> the key type @param <V> the value type @return a new DataLoader
[ "Creates", "new", "DataLoader", "with", "the", "specified", "batch", "loader", "function", "and", "default", "options", "(", "batching", "caching", "and", "unlimited", "batch", "size", ")", "where", "the", "batch", "loader", "function", "returns", "a", "list", ...
train
https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoader.java#L177-L179
aws/aws-sdk-java
aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/PlacementTemplate.java
PlacementTemplate.withDefaultAttributes
public PlacementTemplate withDefaultAttributes(java.util.Map<String, String> defaultAttributes) { setDefaultAttributes(defaultAttributes); return this; }
java
public PlacementTemplate withDefaultAttributes(java.util.Map<String, String> defaultAttributes) { setDefaultAttributes(defaultAttributes); return this; }
[ "public", "PlacementTemplate", "withDefaultAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "defaultAttributes", ")", "{", "setDefaultAttributes", "(", "defaultAttributes", ")", ";", "return", "this", ";", "}" ]
<p> The default attributes (key/value pairs) to be applied to all placements using this template. </p> @param defaultAttributes The default attributes (key/value pairs) to be applied to all placements using this template. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "default", "attributes", "(", "key", "/", "value", "pairs", ")", "to", "be", "applied", "to", "all", "placements", "using", "this", "template", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/PlacementTemplate.java#L79-L82
apiman/apiman
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/LocalClientFactory.java
LocalClientFactory.createLocalClient
public JestClient createLocalClient(String className, String fieldName, String indexName, String defaultIndexName) { String clientKey = "local:" + className + '/' + fieldName; //$NON-NLS-1$ synchronized (clients) { if (clients.containsKey(clientKey)) { return clients.get(clientKey); } else { try { Class<?> clientLocClass = Class.forName(className); Field field = clientLocClass.getField(fieldName); JestClient client = (JestClient) field.get(null); clients.put(clientKey, client); initializeClient(client, indexName, defaultIndexName); return client; } catch (ClassNotFoundException | NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("Error using local elasticsearch client.", e); //$NON-NLS-1$ } } } }
java
public JestClient createLocalClient(String className, String fieldName, String indexName, String defaultIndexName) { String clientKey = "local:" + className + '/' + fieldName; //$NON-NLS-1$ synchronized (clients) { if (clients.containsKey(clientKey)) { return clients.get(clientKey); } else { try { Class<?> clientLocClass = Class.forName(className); Field field = clientLocClass.getField(fieldName); JestClient client = (JestClient) field.get(null); clients.put(clientKey, client); initializeClient(client, indexName, defaultIndexName); return client; } catch (ClassNotFoundException | NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("Error using local elasticsearch client.", e); //$NON-NLS-1$ } } } }
[ "public", "JestClient", "createLocalClient", "(", "String", "className", ",", "String", "fieldName", ",", "String", "indexName", ",", "String", "defaultIndexName", ")", "{", "String", "clientKey", "=", "\"local:\"", "+", "className", "+", "'", "'", "+", "fieldNa...
Creates a cache by looking it up in a static field. Typically used for testing. @param className the class name @param fieldName the field name @param indexName the name of the ES index @param defaultIndexName the name of the default ES index @return the ES client
[ "Creates", "a", "cache", "by", "looking", "it", "up", "in", "a", "static", "field", ".", "Typically", "used", "for", "testing", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/LocalClientFactory.java#L74-L93
LevelFourAB/commons
commons-config/src/main/java/se/l4/commons/config/ConfigKey.java
ConfigKey.asObject
@NonNull public <T> T asObject(String subPath, Class<T> type) { return config.asObject(key + '.' + subPath, type); }
java
@NonNull public <T> T asObject(String subPath, Class<T> type) { return config.asObject(key + '.' + subPath, type); }
[ "@", "NonNull", "public", "<", "T", ">", "T", "asObject", "(", "String", "subPath", ",", "Class", "<", "T", ">", "type", ")", "{", "return", "config", ".", "asObject", "(", "key", "+", "'", "'", "+", "subPath", ",", "type", ")", ";", "}" ]
Get the value of a sub path to this key. @param subPath @param type @return
[ "Get", "the", "value", "of", "a", "sub", "path", "to", "this", "key", "." ]
train
https://github.com/LevelFourAB/commons/blob/aa121b3a5504b43d0c10450a1b984694fcd2b8ee/commons-config/src/main/java/se/l4/commons/config/ConfigKey.java#L65-L69
alkacon/opencms-core
src/org/opencms/file/CmsRequestContext.java
CmsRequestContext.switchUser
protected void switchUser(CmsUser user, CmsProject project, String ouFqn) { m_user = user; m_currentProject = project; setOuFqn(ouFqn); }
java
protected void switchUser(CmsUser user, CmsProject project, String ouFqn) { m_user = user; m_currentProject = project; setOuFqn(ouFqn); }
[ "protected", "void", "switchUser", "(", "CmsUser", "user", ",", "CmsProject", "project", ",", "String", "ouFqn", ")", "{", "m_user", "=", "user", ";", "m_currentProject", "=", "project", ";", "setOuFqn", "(", "ouFqn", ")", ";", "}" ]
Switches the user in the context, required after a login.<p> @param user the new user to use @param project the new users current project @param ouFqn the organizational unit
[ "Switches", "the", "user", "in", "the", "context", "required", "after", "a", "login", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsRequestContext.java#L694-L699
Netflix/dyno
dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/hash/Murmur2Hash.java
Murmur2Hash.hash64
public static long hash64(final String text, int from, int length) { return hash64(text.substring( from, from+length)); }
java
public static long hash64(final String text, int from, int length) { return hash64(text.substring( from, from+length)); }
[ "public", "static", "long", "hash64", "(", "final", "String", "text", ",", "int", "from", ",", "int", "length", ")", "{", "return", "hash64", "(", "text", ".", "substring", "(", "from", ",", "from", "+", "length", ")", ")", ";", "}" ]
Generates 64 bit hash from a substring. @param text string to hash @param from starting index @param length length of the substring to hash @return 64 bit hash of the given array
[ "Generates", "64", "bit", "hash", "from", "a", "substring", "." ]
train
https://github.com/Netflix/dyno/blob/158f807083ea8e9b09c8089cb07f98e954ad5b23/dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/hash/Murmur2Hash.java#L197-L199
marklogic/marklogic-contentpump
mapreduce/src/main/java/com/marklogic/mapreduce/utilities/InternalUtilities.java
InternalUtilities.getInputContentSource
public static ContentSource getInputContentSource(Configuration conf) throws URISyntaxException, XccConfigException, IOException { String host = conf.getStrings(INPUT_HOST)[0]; if (host == null || host.isEmpty()) { throw new IllegalArgumentException(INPUT_HOST + " is not specified."); } return getInputContentSource(conf, host); }
java
public static ContentSource getInputContentSource(Configuration conf) throws URISyntaxException, XccConfigException, IOException { String host = conf.getStrings(INPUT_HOST)[0]; if (host == null || host.isEmpty()) { throw new IllegalArgumentException(INPUT_HOST + " is not specified."); } return getInputContentSource(conf, host); }
[ "public", "static", "ContentSource", "getInputContentSource", "(", "Configuration", "conf", ")", "throws", "URISyntaxException", ",", "XccConfigException", ",", "IOException", "{", "String", "host", "=", "conf", ".", "getStrings", "(", "INPUT_HOST", ")", "[", "0", ...
Get content source for input server. @param conf job configuration. @return ContentSource for input server. @throws URISyntaxException @throws XccConfigException @throws IOException
[ "Get", "content", "source", "for", "input", "server", "." ]
train
https://github.com/marklogic/marklogic-contentpump/blob/4c41e4a953301f81a4c655efb2a847603dee8afc/mapreduce/src/main/java/com/marklogic/mapreduce/utilities/InternalUtilities.java#L94-L103
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Distribution.java
Distribution.simpleGoodTuring
public static <E> Distribution<E> simpleGoodTuring(Counter<E> counter, int numberOfKeys) { // check arguments validateCounter(counter); int numUnseen = numberOfKeys - counter.size(); if (numUnseen < 1) throw new IllegalArgumentException(String.format("ERROR: numberOfKeys %d must be > size of counter %d!", numberOfKeys, counter.size())); // do smoothing int[][] cc = countCounts2IntArrays(collectCountCounts(counter)); int[] r = cc[0]; // counts int[] n = cc[1]; // counts of counts SimpleGoodTuring sgt = new SimpleGoodTuring(r, n); // collate results Counter<Integer> probsByCount = new ClassicCounter<Integer>(); double[] probs = sgt.getProbabilities(); for (int i = 0; i < probs.length; i++) { probsByCount.setCount(r[i], probs[i]); } // make smoothed distribution Distribution<E> dist = new Distribution<E>(); dist.counter = new ClassicCounter<E>(); for (Map.Entry<E, Double> entry : counter.entrySet()) { E item = entry.getKey(); Integer count = (int) Math.round(entry.getValue()); dist.counter.setCount(item, probsByCount.getCount(count)); } dist.numberOfKeys = numberOfKeys; dist.reservedMass = sgt.getProbabilityForUnseen(); return dist; }
java
public static <E> Distribution<E> simpleGoodTuring(Counter<E> counter, int numberOfKeys) { // check arguments validateCounter(counter); int numUnseen = numberOfKeys - counter.size(); if (numUnseen < 1) throw new IllegalArgumentException(String.format("ERROR: numberOfKeys %d must be > size of counter %d!", numberOfKeys, counter.size())); // do smoothing int[][] cc = countCounts2IntArrays(collectCountCounts(counter)); int[] r = cc[0]; // counts int[] n = cc[1]; // counts of counts SimpleGoodTuring sgt = new SimpleGoodTuring(r, n); // collate results Counter<Integer> probsByCount = new ClassicCounter<Integer>(); double[] probs = sgt.getProbabilities(); for (int i = 0; i < probs.length; i++) { probsByCount.setCount(r[i], probs[i]); } // make smoothed distribution Distribution<E> dist = new Distribution<E>(); dist.counter = new ClassicCounter<E>(); for (Map.Entry<E, Double> entry : counter.entrySet()) { E item = entry.getKey(); Integer count = (int) Math.round(entry.getValue()); dist.counter.setCount(item, probsByCount.getCount(count)); } dist.numberOfKeys = numberOfKeys; dist.reservedMass = sgt.getProbabilityForUnseen(); return dist; }
[ "public", "static", "<", "E", ">", "Distribution", "<", "E", ">", "simpleGoodTuring", "(", "Counter", "<", "E", ">", "counter", ",", "int", "numberOfKeys", ")", "{", "// check arguments\r", "validateCounter", "(", "counter", ")", ";", "int", "numUnseen", "="...
Creates a Distribution from the given counter using Gale &amp; Sampsons' "simple Good-Turing" smoothing. @return a new simple Good-Turing smoothed Distribution.
[ "Creates", "a", "Distribution", "from", "the", "given", "counter", "using", "Gale", "&amp", ";", "Sampsons", "simple", "Good", "-", "Turing", "smoothing", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Distribution.java#L450-L483
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/RemoveBrownPtoN_F64.java
RemoveBrownPtoN_F64.compute
@Override public void compute(double x, double y, Point2D_F64 out) { // initial estimate of undistorted point out.x = a11*x + a12*y + a13; out.y = a22*y + a23; removeRadial(out.x, out.y, params.radial, params.t1, params.t2, out, tol ); }
java
@Override public void compute(double x, double y, Point2D_F64 out) { // initial estimate of undistorted point out.x = a11*x + a12*y + a13; out.y = a22*y + a23; removeRadial(out.x, out.y, params.radial, params.t1, params.t2, out, tol ); }
[ "@", "Override", "public", "void", "compute", "(", "double", "x", ",", "double", "y", ",", "Point2D_F64", "out", ")", "{", "// initial estimate of undistorted point", "out", ".", "x", "=", "a11", "*", "x", "+", "a12", "*", "y", "+", "a13", ";", "out", ...
Removes radial distortion @param x Distorted x-coordinate pixel @param y Distorted y-coordinate pixel @param out Undistorted normalized coordinate.
[ "Removes", "radial", "distortion" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/RemoveBrownPtoN_F64.java#L99-L106
Azure/azure-sdk-for-java
batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/JobsInner.java
JobsInner.createAsync
public Observable<JobInner> createAsync(String resourceGroupName, String jobName, JobCreateParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, jobName, parameters).map(new Func1<ServiceResponse<JobInner>, JobInner>() { @Override public JobInner call(ServiceResponse<JobInner> response) { return response.body(); } }); }
java
public Observable<JobInner> createAsync(String resourceGroupName, String jobName, JobCreateParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, jobName, parameters).map(new Func1<ServiceResponse<JobInner>, JobInner>() { @Override public JobInner call(ServiceResponse<JobInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "jobName", ",", "JobCreateParameters", "parameters", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName", ",", "jobName", ",", "p...
Adds a Job that gets executed on a cluster. @param resourceGroupName Name of the resource group to which the resource belongs. @param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param parameters The parameters to provide for job creation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Adds", "a", "Job", "that", "gets", "executed", "on", "a", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/JobsInner.java#L172-L179
jenkinsci/favorite-plugin
src/main/java/hudson/plugins/favorite/Favorites.java
Favorites.addFavorite
public static void addFavorite(@Nonnull User user, @Nonnull Item item) throws FavoriteException { try { if (!isFavorite(user, item)) { FavoriteUserProperty property = getProperty(user); property.addFavorite(item.getFullName()); FavoriteListener.fireOnAddFavourite(item, user); } else { throw new FavoriteException("Favourite is already set for User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">"); } } catch (IOException e) { throw new FavoriteException("Could not add Favorite. User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">", e); } }
java
public static void addFavorite(@Nonnull User user, @Nonnull Item item) throws FavoriteException { try { if (!isFavorite(user, item)) { FavoriteUserProperty property = getProperty(user); property.addFavorite(item.getFullName()); FavoriteListener.fireOnAddFavourite(item, user); } else { throw new FavoriteException("Favourite is already set for User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">"); } } catch (IOException e) { throw new FavoriteException("Could not add Favorite. User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">", e); } }
[ "public", "static", "void", "addFavorite", "(", "@", "Nonnull", "User", "user", ",", "@", "Nonnull", "Item", "item", ")", "throws", "FavoriteException", "{", "try", "{", "if", "(", "!", "isFavorite", "(", "user", ",", "item", ")", ")", "{", "FavoriteUser...
Add an item as a favorite for a user Fires {@link FavoriteListener#fireOnAddFavourite(Item, User)} @param user to add the favorite to @param item to favorite @throws FavoriteException
[ "Add", "an", "item", "as", "a", "favorite", "for", "a", "user", "Fires", "{" ]
train
https://github.com/jenkinsci/favorite-plugin/blob/4ce9b195b4d888190fe12c92d546d64f22728c22/src/main/java/hudson/plugins/favorite/Favorites.java#L72-L84
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/types/TypeUtils.java
TypeUtils.appendModifierKeyword
private static void appendModifierKeyword(final StringBuilder buf, final String modifierKeyword) { if (buf.length() > 0 && buf.charAt(buf.length() - 1) != ' ') { buf.append(' '); } buf.append(modifierKeyword); }
java
private static void appendModifierKeyword(final StringBuilder buf, final String modifierKeyword) { if (buf.length() > 0 && buf.charAt(buf.length() - 1) != ' ') { buf.append(' '); } buf.append(modifierKeyword); }
[ "private", "static", "void", "appendModifierKeyword", "(", "final", "StringBuilder", "buf", ",", "final", "String", "modifierKeyword", ")", "{", "if", "(", "buf", ".", "length", "(", ")", ">", "0", "&&", "buf", ".", "charAt", "(", "buf", ".", "length", "...
Append a space if necessary (if not at the beginning of the buffer, and the last character is not already a space), then append a modifier keyword. @param buf the buf @param modifierKeyword the modifier keyword
[ "Append", "a", "space", "if", "necessary", "(", "if", "not", "at", "the", "beginning", "of", "the", "buffer", "and", "the", "last", "character", "is", "not", "already", "a", "space", ")", "then", "append", "a", "modifier", "keyword", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/types/TypeUtils.java#L112-L117
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.getTimeZoneName
public Name getTimeZoneName(String zoneId, ZonedDateTime date, boolean long_) { TimeZoneNames names = timezoneNames.get(zoneId); if (names != null) { return long_ ? names.longName() : names.shortName(); } zoneId = _CalendarUtils.getMetazone(zoneId, date); if (zoneId == null) { return null; } names = metazoneNames.get(zoneId); if (names != null) { return long_ ? names.longName() : names.shortName(); } return null; }
java
public Name getTimeZoneName(String zoneId, ZonedDateTime date, boolean long_) { TimeZoneNames names = timezoneNames.get(zoneId); if (names != null) { return long_ ? names.longName() : names.shortName(); } zoneId = _CalendarUtils.getMetazone(zoneId, date); if (zoneId == null) { return null; } names = metazoneNames.get(zoneId); if (names != null) { return long_ ? names.longName() : names.shortName(); } return null; }
[ "public", "Name", "getTimeZoneName", "(", "String", "zoneId", ",", "ZonedDateTime", "date", ",", "boolean", "long_", ")", "{", "TimeZoneNames", "names", "=", "timezoneNames", ".", "get", "(", "zoneId", ")", ";", "if", "(", "names", "!=", "null", ")", "{", ...
Lookup the time zone name variants (long or short) for the given zoneId and datetime.
[ "Lookup", "the", "time", "zone", "name", "variants", "(", "long", "or", "short", ")", "for", "the", "given", "zoneId", "and", "datetime", "." ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L234-L249
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.addProperty
private void addProperty(XMLStreamWriter writer, String name, Class<?> propertyType, String readMethod, String writeMethod) throws XMLStreamException { if (name.length() != 0) { writer.writeStartElement("property"); // convert property name to .NET style (i.e. first letter uppercase) String propertyName = name.substring(0, 1).toUpperCase() + name.substring(1); writer.writeAttribute("name", propertyName); String type = getTypeString(propertyType); writer.writeAttribute("sig", "()" + type); if (readMethod != null) { writer.writeStartElement("getter"); writer.writeAttribute("name", readMethod); writer.writeAttribute("sig", "()" + type); writer.writeEndElement(); } if (writeMethod != null) { writer.writeStartElement("setter"); writer.writeAttribute("name", writeMethod); writer.writeAttribute("sig", "(" + type + ")V"); writer.writeEndElement(); } writer.writeEndElement(); } }
java
private void addProperty(XMLStreamWriter writer, String name, Class<?> propertyType, String readMethod, String writeMethod) throws XMLStreamException { if (name.length() != 0) { writer.writeStartElement("property"); // convert property name to .NET style (i.e. first letter uppercase) String propertyName = name.substring(0, 1).toUpperCase() + name.substring(1); writer.writeAttribute("name", propertyName); String type = getTypeString(propertyType); writer.writeAttribute("sig", "()" + type); if (readMethod != null) { writer.writeStartElement("getter"); writer.writeAttribute("name", readMethod); writer.writeAttribute("sig", "()" + type); writer.writeEndElement(); } if (writeMethod != null) { writer.writeStartElement("setter"); writer.writeAttribute("name", writeMethod); writer.writeAttribute("sig", "(" + type + ")V"); writer.writeEndElement(); } writer.writeEndElement(); } }
[ "private", "void", "addProperty", "(", "XMLStreamWriter", "writer", ",", "String", "name", ",", "Class", "<", "?", ">", "propertyType", ",", "String", "readMethod", ",", "String", "writeMethod", ")", "throws", "XMLStreamException", "{", "if", "(", "name", ".",...
Add a simple property to the map file. @param writer xml stream writer @param name property name @param propertyType property type @param readMethod read method name @param writeMethod write method name @throws XMLStreamException
[ "Add", "a", "simple", "property", "to", "the", "map", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L250-L280
riccardove/easyjasub
easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/dictionary/EasyJaSubDictionary.java
EasyJaSubDictionary.addJMDict
public void addJMDict(File file) throws IOException, SAXException { new JMDictParser().parse(file, new DictionaryJMDictReader(trie, errors), threeLetterlanguageCode); }
java
public void addJMDict(File file) throws IOException, SAXException { new JMDictParser().parse(file, new DictionaryJMDictReader(trie, errors), threeLetterlanguageCode); }
[ "public", "void", "addJMDict", "(", "File", "file", ")", "throws", "IOException", ",", "SAXException", "{", "new", "JMDictParser", "(", ")", ".", "parse", "(", "file", ",", "new", "DictionaryJMDictReader", "(", "trie", ",", "errors", ")", ",", "threeLetterla...
Adds entries from a JMDict file @param file an XML JMDict file @throws IOException when reading file @throws SAXException when reading file
[ "Adds", "entries", "from", "a", "JMDict", "file" ]
train
https://github.com/riccardove/easyjasub/blob/58d6af66b1b1c738326c74d9ad5e4ad514120e27/easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/dictionary/EasyJaSubDictionary.java#L95-L99
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/model/BuildWithDetails.java
BuildWithDetails.updateDisplayNameAndDescription
public BuildWithDetails updateDisplayNameAndDescription(String displayName, String description) throws IOException { return updateDisplayNameAndDescription(displayName, description, false); }
java
public BuildWithDetails updateDisplayNameAndDescription(String displayName, String description) throws IOException { return updateDisplayNameAndDescription(displayName, description, false); }
[ "public", "BuildWithDetails", "updateDisplayNameAndDescription", "(", "String", "displayName", ",", "String", "description", ")", "throws", "IOException", "{", "return", "updateDisplayNameAndDescription", "(", "displayName", ",", "description", ",", "false", ")", ";", "...
Update <code>displayName</code> and the <code>description</code> of a build. @param displayName The new displayName which should be set. @param description The description which should be set. @throws IOException in case of errors.
[ "Update", "<code", ">", "displayName<", "/", "code", ">", "and", "the", "<code", ">", "description<", "/", "code", ">", "of", "a", "build", "." ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/model/BuildWithDetails.java#L204-L206
jayantk/jklol
src/com/jayantkrish/jklol/ccg/CcgParserUtils.java
CcgParserUtils.filterExampleCollection
public static <T extends CcgExample> List<T> filterExampleCollection( final CcgParser parser, List<T> examples) { MapReduceExecutor executor = MapReduceConfiguration.getMapReduceExecutor(); List<T> filteredExamples = executor.filter(examples, new Predicate<T>() { @Override public boolean apply(CcgExample example) { return isPossibleExample(parser, example); } }); return filteredExamples; }
java
public static <T extends CcgExample> List<T> filterExampleCollection( final CcgParser parser, List<T> examples) { MapReduceExecutor executor = MapReduceConfiguration.getMapReduceExecutor(); List<T> filteredExamples = executor.filter(examples, new Predicate<T>() { @Override public boolean apply(CcgExample example) { return isPossibleExample(parser, example); } }); return filteredExamples; }
[ "public", "static", "<", "T", "extends", "CcgExample", ">", "List", "<", "T", ">", "filterExampleCollection", "(", "final", "CcgParser", "parser", ",", "List", "<", "T", ">", "examples", ")", "{", "MapReduceExecutor", "executor", "=", "MapReduceConfiguration", ...
Checks whether each example in {@code examples} can be produced by this parser. Invalid examples are filtered out of the returned examples. @param parser @param examples @return
[ "Checks", "whether", "each", "example", "in", "{", "@code", "examples", "}", "can", "be", "produced", "by", "this", "parser", ".", "Invalid", "examples", "are", "filtered", "out", "of", "the", "returned", "examples", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/CcgParserUtils.java#L37-L49
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java
TaskOperations.reactivateTask
public void reactivateTask(String jobId, String taskId) throws BatchErrorException, IOException { reactivateTask(jobId, taskId, null); }
java
public void reactivateTask(String jobId, String taskId) throws BatchErrorException, IOException { reactivateTask(jobId, taskId, null); }
[ "public", "void", "reactivateTask", "(", "String", "jobId", ",", "String", "taskId", ")", "throws", "BatchErrorException", ",", "IOException", "{", "reactivateTask", "(", "jobId", ",", "taskId", ",", "null", ")", ";", "}" ]
Reactivates a task, allowing it to run again even if its retry count has been exhausted. @param jobId The ID of the job containing the task. @param taskId The ID of the task. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Reactivates", "a", "task", "allowing", "it", "to", "run", "again", "even", "if", "its", "retry", "count", "has", "been", "exhausted", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java#L776-L778
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.escapeUriFragmentId
public static void escapeUriFragmentId(final String text, final Writer writer) throws IOException { escapeUriFragmentId(text, writer, DEFAULT_ENCODING); }
java
public static void escapeUriFragmentId(final String text, final Writer writer) throws IOException { escapeUriFragmentId(text, writer, DEFAULT_ENCODING); }
[ "public", "static", "void", "escapeUriFragmentId", "(", "final", "String", "text", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeUriFragmentId", "(", "text", ",", "writer", ",", "DEFAULT_ENCODING", ")", ";", "}" ]
<p> Perform am URI fragment identifier <strong>escape</strong> operation on a <tt>String</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>. </p> <p> The following are the only allowed chars in an URI fragment identifier (will not be escaped): </p> <ul> <li><tt>A-Z a-z 0-9</tt></li> <li><tt>- . _ ~</tt></li> <li><tt>! $ &amp; ' ( ) * + , ; =</tt></li> <li><tt>: @</tt></li> <li><tt>/ ?</tt></li> </ul> <p> All other chars will be escaped by converting them to the sequence of bytes that represents them in the <tt>UTF-8</tt> and then representing each byte in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "fragment", "identifier", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "using", "<tt", ">", "UTF", "-", "8<", "/", "tt", ">", "as", "encoding...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L706-L709
javamelody/javamelody
javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MRtfWriter.java
MRtfWriter.createWriter
@Override protected DocWriter createWriter(final MBasicTable table, final Document document, final OutputStream out) { final RtfWriter2 writer = RtfWriter2.getInstance(document, out); // title final String title = buildTitle(table); if (title != null) { final HeaderFooter header = new RtfHeaderFooter(new Paragraph(title)); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); document.addTitle(title); } // advanced page numbers : x/y final Paragraph footerParagraph = new Paragraph(); final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL); footerParagraph.add(new RtfPageNumber(font)); footerParagraph.add(new Phrase(" / ", font)); footerParagraph.add(new RtfTotalPageNumber(font)); footerParagraph.setAlignment(Element.ALIGN_CENTER); final HeaderFooter footer = new RtfHeaderFooter(footerParagraph); footer.setBorder(Rectangle.TOP); document.setFooter(footer); return writer; }
java
@Override protected DocWriter createWriter(final MBasicTable table, final Document document, final OutputStream out) { final RtfWriter2 writer = RtfWriter2.getInstance(document, out); // title final String title = buildTitle(table); if (title != null) { final HeaderFooter header = new RtfHeaderFooter(new Paragraph(title)); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); document.addTitle(title); } // advanced page numbers : x/y final Paragraph footerParagraph = new Paragraph(); final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL); footerParagraph.add(new RtfPageNumber(font)); footerParagraph.add(new Phrase(" / ", font)); footerParagraph.add(new RtfTotalPageNumber(font)); footerParagraph.setAlignment(Element.ALIGN_CENTER); final HeaderFooter footer = new RtfHeaderFooter(footerParagraph); footer.setBorder(Rectangle.TOP); document.setFooter(footer); return writer; }
[ "@", "Override", "protected", "DocWriter", "createWriter", "(", "final", "MBasicTable", "table", ",", "final", "Document", "document", ",", "final", "OutputStream", "out", ")", "{", "final", "RtfWriter2", "writer", "=", "RtfWriter2", ".", "getInstance", "(", "do...
We create a writer that listens to the document and directs a RTF-stream to out @param table MBasicTable @param document Document @param out OutputStream @return DocWriter
[ "We", "create", "a", "writer", "that", "listens", "to", "the", "document", "and", "directs", "a", "RTF", "-", "stream", "to", "out" ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MRtfWriter.java#L124-L151
JodaOrg/joda-time
src/main/java/org/joda/time/LocalDate.java
LocalDate.withFieldAdded
public LocalDate withFieldAdded(DurationFieldType fieldType, int amount) { if (fieldType == null) { throw new IllegalArgumentException("Field must not be null"); } if (isSupported(fieldType) == false) { throw new IllegalArgumentException("Field '" + fieldType + "' is not supported"); } if (amount == 0) { return this; } long instant = fieldType.getField(getChronology()).add(getLocalMillis(), amount); return withLocalMillis(instant); }
java
public LocalDate withFieldAdded(DurationFieldType fieldType, int amount) { if (fieldType == null) { throw new IllegalArgumentException("Field must not be null"); } if (isSupported(fieldType) == false) { throw new IllegalArgumentException("Field '" + fieldType + "' is not supported"); } if (amount == 0) { return this; } long instant = fieldType.getField(getChronology()).add(getLocalMillis(), amount); return withLocalMillis(instant); }
[ "public", "LocalDate", "withFieldAdded", "(", "DurationFieldType", "fieldType", ",", "int", "amount", ")", "{", "if", "(", "fieldType", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Field must not be null\"", ")", ";", "}", "if", "(...
Returns a copy of this date with the value of the specified field increased. <p> If the addition is zero or the field is null, then <code>this</code> is returned. <p> These three lines are equivalent: <pre> LocalDate added = dt.withFieldAdded(DurationFieldType.years(), 6); LocalDate added = dt.plusYears(6); LocalDate added = dt.plus(Period.years(6)); </pre> @param fieldType the field type to add to, not null @param amount the amount to add @return a copy of this date with the field updated @throws IllegalArgumentException if the field is null or unsupported @throws ArithmeticException if the result exceeds the internal capacity
[ "Returns", "a", "copy", "of", "this", "date", "with", "the", "value", "of", "the", "specified", "field", "increased", ".", "<p", ">", "If", "the", "addition", "is", "zero", "or", "the", "field", "is", "null", "then", "<code", ">", "this<", "/", "code",...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDate.java#L1126-L1138
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortableUtils.java
PortableUtils.validateAndGetArrayQuantifierFromCurrentToken
static int validateAndGetArrayQuantifierFromCurrentToken(String token, String fullPath) { String quantifier = extractArgumentsFromAttributeName(token); if (quantifier == null) { throw new IllegalArgumentException("Malformed quantifier in " + fullPath); } int index = Integer.parseInt(quantifier); if (index < 0) { throw new IllegalArgumentException("Array index " + index + " cannot be negative in " + fullPath); } return index; }
java
static int validateAndGetArrayQuantifierFromCurrentToken(String token, String fullPath) { String quantifier = extractArgumentsFromAttributeName(token); if (quantifier == null) { throw new IllegalArgumentException("Malformed quantifier in " + fullPath); } int index = Integer.parseInt(quantifier); if (index < 0) { throw new IllegalArgumentException("Array index " + index + " cannot be negative in " + fullPath); } return index; }
[ "static", "int", "validateAndGetArrayQuantifierFromCurrentToken", "(", "String", "token", ",", "String", "fullPath", ")", "{", "String", "quantifier", "=", "extractArgumentsFromAttributeName", "(", "token", ")", ";", "if", "(", "quantifier", "==", "null", ")", "{", ...
Extracts and validates the quantifier from the given path token @param token token from which the quantifier is retrieved @param fullPath fullPath to which the token belongs - just for output @return validated quantifier
[ "Extracts", "and", "validates", "the", "quantifier", "from", "the", "given", "path", "token" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortableUtils.java#L44-L54
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/InputElementStack.java
InputElementStack.addNsBinding
public void addNsBinding(String prefix, String uri) { // Unbind? (xml 1.1...) if ((uri == null) || (uri.length() == 0)) { uri = null; } // Default ns declaration? if ((prefix == null) || (prefix.length() == 0)) { prefix = null; mCurrElement.mDefaultNsURI = uri; } mNamespaces.addStrings(prefix, uri); }
java
public void addNsBinding(String prefix, String uri) { // Unbind? (xml 1.1...) if ((uri == null) || (uri.length() == 0)) { uri = null; } // Default ns declaration? if ((prefix == null) || (prefix.length() == 0)) { prefix = null; mCurrElement.mDefaultNsURI = uri; } mNamespaces.addStrings(prefix, uri); }
[ "public", "void", "addNsBinding", "(", "String", "prefix", ",", "String", "uri", ")", "{", "// Unbind? (xml 1.1...)", "if", "(", "(", "uri", "==", "null", ")", "||", "(", "uri", ".", "length", "(", ")", "==", "0", ")", ")", "{", "uri", "=", "null", ...
Callback method called by the namespace default provider. At this point we can trust it to only call this method with somewhat valid arguments (no dups etc).
[ "Callback", "method", "called", "by", "the", "namespace", "default", "provider", ".", "At", "this", "point", "we", "can", "trust", "it", "to", "only", "call", "this", "method", "with", "somewhat", "valid", "arguments", "(", "no", "dups", "etc", ")", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/InputElementStack.java#L893-L906
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java
PreprocessorContext.findVariableForName
@Nullable public Value findVariableForName(@Nullable final String name, final boolean enforceUnknownVarAsNull) { if (name == null) { return null; } final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name)); if (normalized.isEmpty()) { return null; } final SpecialVariableProcessor processor = mapVariableNameToSpecialVarProcessor.get(normalized); if (processor != null) { return processor.getVariable(normalized, this); } final Value val = getLocalVariable(normalized); if (val != null) { return val; } Value result = globalVarTable.get(normalized); if (result == null && !enforceUnknownVarAsNull && this.unknownVariableAsFalse) { logDebug("Unknown variable '" + name + "' is replaced by FALSE!"); result = Value.BOOLEAN_FALSE; } return result; }
java
@Nullable public Value findVariableForName(@Nullable final String name, final boolean enforceUnknownVarAsNull) { if (name == null) { return null; } final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name)); if (normalized.isEmpty()) { return null; } final SpecialVariableProcessor processor = mapVariableNameToSpecialVarProcessor.get(normalized); if (processor != null) { return processor.getVariable(normalized, this); } final Value val = getLocalVariable(normalized); if (val != null) { return val; } Value result = globalVarTable.get(normalized); if (result == null && !enforceUnknownVarAsNull && this.unknownVariableAsFalse) { logDebug("Unknown variable '" + name + "' is replaced by FALSE!"); result = Value.BOOLEAN_FALSE; } return result; }
[ "@", "Nullable", "public", "Value", "findVariableForName", "(", "@", "Nullable", "final", "String", "name", ",", "final", "boolean", "enforceUnknownVarAsNull", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "null", ";", "}", "final", "String"...
Find value among local and global variables for a name. It finds in the order: special processors, local variables, global variables @param name the name for the needed variable, it will be normalized to the supported format @param enforceUnknownVarAsNull if true then state of the unknownVariableAsFalse flag in context will be ignored @return false if either the variable is not found or the name is null, otherwise the variable value
[ "Find", "value", "among", "local", "and", "global", "variables", "for", "a", "name", ".", "It", "finds", "in", "the", "order", ":", "special", "processors", "local", "variables", "global", "variables" ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java#L641-L672
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AbstractAlpineQueryManager.java
AbstractAlpineQueryManager.getObjectByUuid
@SuppressWarnings("unchecked") public <T> T getObjectByUuid(Class<T> clazz, UUID uuid, String fetchGroup) { pm.getFetchPlan().addGroup(fetchGroup); return getObjectByUuid(clazz, uuid); }
java
@SuppressWarnings("unchecked") public <T> T getObjectByUuid(Class<T> clazz, UUID uuid, String fetchGroup) { pm.getFetchPlan().addGroup(fetchGroup); return getObjectByUuid(clazz, uuid); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "getObjectByUuid", "(", "Class", "<", "T", ">", "clazz", ",", "UUID", "uuid", ",", "String", "fetchGroup", ")", "{", "pm", ".", "getFetchPlan", "(", ")", ".", "addGroup", ...
Retrieves an object by its UUID. @param <T> A type parameter. This type will be returned @param clazz the persistence class to retrive the ID for @param uuid the uuid of the object to retrieve @param fetchGroup the JDO fetchgroup to use when making the query @return an object of the specified type @since 1.0.0
[ "Retrieves", "an", "object", "by", "its", "UUID", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AbstractAlpineQueryManager.java#L544-L548
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/ir/transform/statement/ForEachStatementTransformer.java
ForEachStatementTransformer.makeLoop
public static IRForEachStatement makeLoop( TopLevelTransformationContext cc, IRExpression rootExpression, IType type, Symbol identifier, Symbol indexSymbol ) { return new ForEachStatementTransformer( cc, null ) .makeLoopImpl( cc, rootExpression, type, identifier, indexSymbol, null ); }
java
public static IRForEachStatement makeLoop( TopLevelTransformationContext cc, IRExpression rootExpression, IType type, Symbol identifier, Symbol indexSymbol ) { return new ForEachStatementTransformer( cc, null ) .makeLoopImpl( cc, rootExpression, type, identifier, indexSymbol, null ); }
[ "public", "static", "IRForEachStatement", "makeLoop", "(", "TopLevelTransformationContext", "cc", ",", "IRExpression", "rootExpression", ",", "IType", "type", ",", "Symbol", "identifier", ",", "Symbol", "indexSymbol", ")", "{", "return", "new", "ForEachStatementTransfor...
Helper for creating iterative loops. Note that after calling this method, you should compile and call gw.internal.gosu.ir.nodes.statement.IRForEachStatement#setBody(gw.internal.gosu.ir.nodes.IRStatement) on the IRForEachStatement. Since the body often depends on symbols introduced in the loop, you must usually compile it after the loop has been created. Thus it cannot be an argument to this function.
[ "Helper", "for", "creating", "iterative", "loops", ".", "Note", "that", "after", "calling", "this", "method", "you", "should", "compile", "and", "call", "gw", ".", "internal", ".", "gosu", ".", "ir", ".", "nodes", ".", "statement", ".", "IRForEachStatement#s...
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/statement/ForEachStatementTransformer.java#L75-L80
fcrepo3/fcrepo
fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/objecteditor/ContentHandlerFactory.java
ContentHandlerFactory.getViewer
public static ContentViewer getViewer(String type, InputStream data) throws IOException { ContentViewer viewer = (ContentViewer) s_viewers.get(type); if (viewer == null && type.endsWith("+xml")) { viewer = (ContentViewer) s_viewers.get("text/xml"); } return viewer.newInstance(type, data, true); }
java
public static ContentViewer getViewer(String type, InputStream data) throws IOException { ContentViewer viewer = (ContentViewer) s_viewers.get(type); if (viewer == null && type.endsWith("+xml")) { viewer = (ContentViewer) s_viewers.get("text/xml"); } return viewer.newInstance(type, data, true); }
[ "public", "static", "ContentViewer", "getViewer", "(", "String", "type", ",", "InputStream", "data", ")", "throws", "IOException", "{", "ContentViewer", "viewer", "=", "(", "ContentViewer", ")", "s_viewers", ".", "get", "(", "type", ")", ";", "if", "(", "vie...
Get a viewer for the given type, initialized with the given data. This should only be called if the caller knows there is a viewer for the type.
[ "Get", "a", "viewer", "for", "the", "given", "type", "initialized", "with", "the", "given", "data", ".", "This", "should", "only", "be", "called", "if", "the", "caller", "knows", "there", "is", "a", "viewer", "for", "the", "type", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/objecteditor/ContentHandlerFactory.java#L78-L85
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.getImagePerformanceCountWithServiceResponseAsync
public Observable<ServiceResponse<Integer>> getImagePerformanceCountWithServiceResponseAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (iterationId == null) { throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final List<String> tagIds = getImagePerformanceCountOptionalParameter != null ? getImagePerformanceCountOptionalParameter.tagIds() : null; return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, tagIds); }
java
public Observable<ServiceResponse<Integer>> getImagePerformanceCountWithServiceResponseAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (iterationId == null) { throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final List<String> tagIds = getImagePerformanceCountOptionalParameter != null ? getImagePerformanceCountOptionalParameter.tagIds() : null; return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, tagIds); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Integer", ">", ">", "getImagePerformanceCountWithServiceResponseAsync", "(", "UUID", "projectId", ",", "UUID", "iterationId", ",", "GetImagePerformanceCountOptionalParameter", "getImagePerformanceCountOptionalParameter", ")", ...
Gets the number of images tagged with the provided {tagIds} that have prediction results from training for the provided iteration {iterationId}. The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and "Cat" tags, then only images tagged with Dog and/or Cat will be returned. @param projectId The project id @param iterationId The iteration id. Defaults to workspace @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Integer object
[ "Gets", "the", "number", "of", "images", "tagged", "with", "the", "provided", "{", "tagIds", "}", "that", "have", "prediction", "results", "from", "training", "for", "the", "provided", "iteration", "{", "iterationId", "}", ".", "The", "filtering", "is", "on"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L1271-L1284
networknt/light-4j
service/src/main/java/com/networknt/service/ServiceUtil.java
ServiceUtil.constructByNamedParams
public static Object constructByNamedParams(Class clazz, Map params) throws Exception { Object obj = clazz.getConstructor().newInstance(); Method[] allMethods = clazz.getMethods(); for(Method method : allMethods) { if(method.getName().startsWith("set")) { Object [] o = new Object [1]; String propertyName = Introspector.decapitalize(method.getName().substring(3)); if (params.containsKey(propertyName)) { o[0] = params.get(propertyName); method.invoke(obj, o); } } } return obj; }
java
public static Object constructByNamedParams(Class clazz, Map params) throws Exception { Object obj = clazz.getConstructor().newInstance(); Method[] allMethods = clazz.getMethods(); for(Method method : allMethods) { if(method.getName().startsWith("set")) { Object [] o = new Object [1]; String propertyName = Introspector.decapitalize(method.getName().substring(3)); if (params.containsKey(propertyName)) { o[0] = params.get(propertyName); method.invoke(obj, o); } } } return obj; }
[ "public", "static", "Object", "constructByNamedParams", "(", "Class", "clazz", ",", "Map", "params", ")", "throws", "Exception", "{", "Object", "obj", "=", "clazz", ".", "getConstructor", "(", ")", ".", "newInstance", "(", ")", ";", "Method", "[", "]", "al...
Build an object out of a given class and a map for field names to values. @param clazz The class to be created. @param params A map of the parameters. @return An instantiated object. @throws Exception when constructor fails.
[ "Build", "an", "object", "out", "of", "a", "given", "class", "and", "a", "map", "for", "field", "names", "to", "values", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/ServiceUtil.java#L66-L81
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/WeibullDistribution.java
WeibullDistribution.logpdf
public static double logpdf(double x, double k, double lambda, double theta) { if(x <= theta || x == Double.POSITIVE_INFINITY) { return Double.NEGATIVE_INFINITY; } double xl = (x - theta) / lambda; return FastMath.log(k / lambda) + (k - 1) * FastMath.log(xl) - FastMath.pow(xl, k); }
java
public static double logpdf(double x, double k, double lambda, double theta) { if(x <= theta || x == Double.POSITIVE_INFINITY) { return Double.NEGATIVE_INFINITY; } double xl = (x - theta) / lambda; return FastMath.log(k / lambda) + (k - 1) * FastMath.log(xl) - FastMath.pow(xl, k); }
[ "public", "static", "double", "logpdf", "(", "double", "x", ",", "double", "k", ",", "double", "lambda", ",", "double", "theta", ")", "{", "if", "(", "x", "<=", "theta", "||", "x", "==", "Double", ".", "POSITIVE_INFINITY", ")", "{", "return", "Double",...
PDF of Weibull distribution @param x Value @param k Shape parameter @param lambda Scale parameter @param theta Shift offset parameter @return PDF at position x.
[ "PDF", "of", "Weibull", "distribution" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/WeibullDistribution.java#L178-L184
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.getPrebuiltEntityRolesAsync
public Observable<List<EntityRole>> getPrebuiltEntityRolesAsync(UUID appId, String versionId, UUID entityId) { return getPrebuiltEntityRolesWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() { @Override public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) { return response.body(); } }); }
java
public Observable<List<EntityRole>> getPrebuiltEntityRolesAsync(UUID appId, String versionId, UUID entityId) { return getPrebuiltEntityRolesWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() { @Override public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "EntityRole", ">", ">", "getPrebuiltEntityRolesAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ")", "{", "return", "getPrebuiltEntityRolesWithServiceResponseAsync", "(", "appId", ",", "vers...
Get All Entity Roles for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity Id @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;EntityRole&gt; object
[ "Get", "All", "Entity", "Roles", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L7966-L7973
ixa-ehu/kaflib
src/main/java/ixa/kaflib/KAFDocument.java
KAFDocument.newCategory
public Feature newCategory(String lemma, List<Span<Term>> references) { String newId = idManager.getNextId(AnnotationType.CATEGORY); Feature newCategory = new Feature(newId, lemma, references); annotationContainer.add(newCategory, Layer.CATEGORIES, AnnotationType.CATEGORY); return newCategory; }
java
public Feature newCategory(String lemma, List<Span<Term>> references) { String newId = idManager.getNextId(AnnotationType.CATEGORY); Feature newCategory = new Feature(newId, lemma, references); annotationContainer.add(newCategory, Layer.CATEGORIES, AnnotationType.CATEGORY); return newCategory; }
[ "public", "Feature", "newCategory", "(", "String", "lemma", ",", "List", "<", "Span", "<", "Term", ">", ">", "references", ")", "{", "String", "newId", "=", "idManager", ".", "getNextId", "(", "AnnotationType", ".", "CATEGORY", ")", ";", "Feature", "newCat...
Creates a new category. It assigns an appropriate ID to it. The category is added to the document. @param lemma the lemma of the category. @param references different mentions (list of targets) to the same category. @return a new coreference.
[ "Creates", "a", "new", "category", ".", "It", "assigns", "an", "appropriate", "ID", "to", "it", ".", "The", "category", "is", "added", "to", "the", "document", "." ]
train
https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L939-L944
dhanji/sitebricks
sitebricks-converter/src/main/java/com/google/sitebricks/conversion/generics/Generics.java
Generics.getExactReturnType
public static Type getExactReturnType(Method m, Type type) { Type returnType = m.getGenericReturnType(); Type exactDeclaringType = getExactSuperType(capture(type), m.getDeclaringClass()); return mapTypeParameters(returnType, exactDeclaringType); }
java
public static Type getExactReturnType(Method m, Type type) { Type returnType = m.getGenericReturnType(); Type exactDeclaringType = getExactSuperType(capture(type), m.getDeclaringClass()); return mapTypeParameters(returnType, exactDeclaringType); }
[ "public", "static", "Type", "getExactReturnType", "(", "Method", "m", ",", "Type", "type", ")", "{", "Type", "returnType", "=", "m", ".", "getGenericReturnType", "(", ")", ";", "Type", "exactDeclaringType", "=", "getExactSuperType", "(", "capture", "(", "type"...
Returns the exact return type of the given method in the given type. This may be different from <tt>m.getGenericReturnType()</tt> when the method was declared in a superclass, of <tt>type</tt> is a raw type.
[ "Returns", "the", "exact", "return", "type", "of", "the", "given", "method", "in", "the", "given", "type", ".", "This", "may", "be", "different", "from", "<tt", ">", "m", ".", "getGenericReturnType", "()", "<", "/", "tt", ">", "when", "the", "method", ...
train
https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-converter/src/main/java/com/google/sitebricks/conversion/generics/Generics.java#L473-L478
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.setFeatureStyle
public static boolean setFeatureStyle(PolygonOptions polygonOptions, FeatureStyle featureStyle, float density) { boolean featureStyleSet = false; if (featureStyle != null) { featureStyleSet = setStyle(polygonOptions, featureStyle.getStyle(), density); } return featureStyleSet; }
java
public static boolean setFeatureStyle(PolygonOptions polygonOptions, FeatureStyle featureStyle, float density) { boolean featureStyleSet = false; if (featureStyle != null) { featureStyleSet = setStyle(polygonOptions, featureStyle.getStyle(), density); } return featureStyleSet; }
[ "public", "static", "boolean", "setFeatureStyle", "(", "PolygonOptions", "polygonOptions", ",", "FeatureStyle", "featureStyle", ",", "float", "density", ")", "{", "boolean", "featureStyleSet", "=", "false", ";", "if", "(", "featureStyle", "!=", "null", ")", "{", ...
Set the feature style into the polygon options @param polygonOptions polygon options @param featureStyle feature style @param density display density: {@link android.util.DisplayMetrics#density} @return true if style was set into the polygon options
[ "Set", "the", "feature", "style", "into", "the", "polygon", "options" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L567-L578
graphhopper/graphhopper
core/src/main/java/com/graphhopper/routing/util/FootFlagEncoder.java
FootFlagEncoder.getSpeed
@Override double getSpeed(boolean reverse, IntsRef edgeFlags) { double speed = super.getSpeed(reverse, edgeFlags); if (speed == getMaxSpeed()) { // We cannot be sure if it was a long or a short trip return SHORT_TRIP_FERRY_SPEED; } return speed; }
java
@Override double getSpeed(boolean reverse, IntsRef edgeFlags) { double speed = super.getSpeed(reverse, edgeFlags); if (speed == getMaxSpeed()) { // We cannot be sure if it was a long or a short trip return SHORT_TRIP_FERRY_SPEED; } return speed; }
[ "@", "Override", "double", "getSpeed", "(", "boolean", "reverse", ",", "IntsRef", "edgeFlags", ")", "{", "double", "speed", "=", "super", ".", "getSpeed", "(", "reverse", ",", "edgeFlags", ")", ";", "if", "(", "speed", "==", "getMaxSpeed", "(", ")", ")",...
/* This method is a current hack, to allow ferries to be actually faster than our current storable maxSpeed.
[ "/", "*", "This", "method", "is", "a", "current", "hack", "to", "allow", "ferries", "to", "be", "actually", "faster", "than", "our", "current", "storable", "maxSpeed", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/util/FootFlagEncoder.java#L370-L378
raydac/netbeans-mmd-plugin
mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java
Utils.loadXmlDocument
@Nonnull public static Document loadXmlDocument(@Nonnull final InputStream inStream, @Nullable final String charset, final boolean autoClose) throws SAXException, IOException, ParserConfigurationException { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (final ParserConfigurationException ex) { LOGGER.error("Can't set feature for XML parser : " + ex.getMessage(), ex); throw new SAXException("Can't set flag to use security processing of XML file"); } try { factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); factory.setFeature("http://apache.org/xml/features/validation/schema", false); } catch (final ParserConfigurationException ex) { LOGGER.warn("Can't set some features for XML parser : " + ex.getMessage()); } factory.setIgnoringComments(true); factory.setValidating(false); final DocumentBuilder builder = factory.newDocumentBuilder(); final Document document; try { final InputStream stream; if (charset == null) { stream = inStream; } else { stream = new ByteArrayInputStream(IOUtils.toString(inStream, charset).getBytes("UTF-8")); } document = builder.parse(stream); } finally { if (autoClose) { IOUtils.closeQuietly(inStream); } } return document; }
java
@Nonnull public static Document loadXmlDocument(@Nonnull final InputStream inStream, @Nullable final String charset, final boolean autoClose) throws SAXException, IOException, ParserConfigurationException { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (final ParserConfigurationException ex) { LOGGER.error("Can't set feature for XML parser : " + ex.getMessage(), ex); throw new SAXException("Can't set flag to use security processing of XML file"); } try { factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); factory.setFeature("http://apache.org/xml/features/validation/schema", false); } catch (final ParserConfigurationException ex) { LOGGER.warn("Can't set some features for XML parser : " + ex.getMessage()); } factory.setIgnoringComments(true); factory.setValidating(false); final DocumentBuilder builder = factory.newDocumentBuilder(); final Document document; try { final InputStream stream; if (charset == null) { stream = inStream; } else { stream = new ByteArrayInputStream(IOUtils.toString(inStream, charset).getBytes("UTF-8")); } document = builder.parse(stream); } finally { if (autoClose) { IOUtils.closeQuietly(inStream); } } return document; }
[ "@", "Nonnull", "public", "static", "Document", "loadXmlDocument", "(", "@", "Nonnull", "final", "InputStream", "inStream", ",", "@", "Nullable", "final", "String", "charset", ",", "final", "boolean", "autoClose", ")", "throws", "SAXException", ",", "IOException",...
Load and parse XML document from input stream. @param inStream stream to read document @param autoClose true if stream must be closed, false otherwise @return parsed document @throws IOException @throws ParserConfigurationException @throws SAXException @since 1.4.0
[ "Load", "and", "parse", "XML", "document", "from", "input", "stream", "." ]
train
https://github.com/raydac/netbeans-mmd-plugin/blob/997493d23556a25354372b6419a64a0fbd0ac6ba/mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java#L160-L199
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/deref/UnconditionalValueDerefSet.java
UnconditionalValueDerefSet.setDerefSet
public void setDerefSet(ValueNumber vn, Set<Location> derefSet) { if (UnconditionalValueDerefAnalysis.DEBUG) { System.out.println("Adding dereference of " + vn + " for # " + System.identityHashCode(this) + " to " + derefSet); } valueNumbersUnconditionallyDereferenced.set(vn.getNumber()); Set<Location> derefLocationSet = getDerefLocationSet(vn); derefLocationSet.clear(); derefLocationSet.addAll(derefSet); }
java
public void setDerefSet(ValueNumber vn, Set<Location> derefSet) { if (UnconditionalValueDerefAnalysis.DEBUG) { System.out.println("Adding dereference of " + vn + " for # " + System.identityHashCode(this) + " to " + derefSet); } valueNumbersUnconditionallyDereferenced.set(vn.getNumber()); Set<Location> derefLocationSet = getDerefLocationSet(vn); derefLocationSet.clear(); derefLocationSet.addAll(derefSet); }
[ "public", "void", "setDerefSet", "(", "ValueNumber", "vn", ",", "Set", "<", "Location", ">", "derefSet", ")", "{", "if", "(", "UnconditionalValueDerefAnalysis", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "println", "(", "\"Adding dereference of \"", "+...
Set a value as being unconditionally dereferenced at the given set of locations. @param vn the value @param derefSet the Set of dereference Locations
[ "Set", "a", "value", "as", "being", "unconditionally", "dereferenced", "at", "the", "given", "set", "of", "locations", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/deref/UnconditionalValueDerefSet.java#L263-L272
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/AttributeService.java
AttributeService.setAttribute
public void setAttribute(File file, String attribute, Object value, boolean create) { String view = getViewName(attribute); String attr = getSingleAttribute(attribute); setAttributeInternal(file, view, attr, value, create); }
java
public void setAttribute(File file, String attribute, Object value, boolean create) { String view = getViewName(attribute); String attr = getSingleAttribute(attribute); setAttributeInternal(file, view, attr, value, create); }
[ "public", "void", "setAttribute", "(", "File", "file", ",", "String", "attribute", ",", "Object", "value", ",", "boolean", "create", ")", "{", "String", "view", "=", "getViewName", "(", "attribute", ")", ";", "String", "attr", "=", "getSingleAttribute", "(",...
Sets the value of the given attribute to the given value for the given file.
[ "Sets", "the", "value", "of", "the", "given", "attribute", "to", "the", "given", "value", "for", "the", "given", "file", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/AttributeService.java#L228-L232
Sciss/abc4j
abc/src/main/java/abc/ui/swing/JChord.java
JChord.createNormalizedChord
protected JChord createNormalizedChord(MultiNote mNote, ScoreMetrics mtrx, Point2D base) { return new JChord(mNote, getClef(), mtrx, base); }
java
protected JChord createNormalizedChord(MultiNote mNote, ScoreMetrics mtrx, Point2D base) { return new JChord(mNote, getClef(), mtrx, base); }
[ "protected", "JChord", "createNormalizedChord", "(", "MultiNote", "mNote", ",", "ScoreMetrics", "mtrx", ",", "Point2D", "base", ")", "{", "return", "new", "JChord", "(", "mNote", ",", "getClef", "(", ")", ",", "mtrx", ",", "base", ")", ";", "}" ]
Invoked when a multi note is decomposed into multi notes with same strict duration.
[ "Invoked", "when", "a", "multi", "note", "is", "decomposed", "into", "multi", "notes", "with", "same", "strict", "duration", "." ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JChord.java#L150-L152
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.nowAllSet
private static final boolean nowAllSet(int before, int after, int mask) { return ((before & mask) != mask) && ((after & mask) == mask); }
java
private static final boolean nowAllSet(int before, int after, int mask) { return ((before & mask) != mask) && ((after & mask) == mask); }
[ "private", "static", "final", "boolean", "nowAllSet", "(", "int", "before", ",", "int", "after", ",", "int", "mask", ")", "{", "return", "(", "(", "before", "&", "mask", ")", "!=", "mask", ")", "&&", "(", "(", "after", "&", "mask", ")", "==", "mask...
Returns whether or not the bits in the mask have changed to all set. @param before bits before change @param after bits after change @param mask mask for bits @return {@code true} if all the bits in the mask are set in "after" but not in "before"
[ "Returns", "whether", "or", "not", "the", "bits", "in", "the", "mask", "have", "changed", "to", "all", "set", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L1908-L1910
JadiraOrg/jadira
jms/src/main/java/org/jadira/jms/template/BatchedJmsTemplate.java
BatchedJmsTemplate.receiveSelectedBatch
public List<Message> receiveSelectedBatch(String destinationName, String messageSelector) throws JmsException { return receiveSelectedBatch(destinationName, messageSelector, getBatchSize()); }
java
public List<Message> receiveSelectedBatch(String destinationName, String messageSelector) throws JmsException { return receiveSelectedBatch(destinationName, messageSelector, getBatchSize()); }
[ "public", "List", "<", "Message", ">", "receiveSelectedBatch", "(", "String", "destinationName", ",", "String", "messageSelector", ")", "throws", "JmsException", "{", "return", "receiveSelectedBatch", "(", "destinationName", ",", "messageSelector", ",", "getBatchSize", ...
Receive a batch of up to default batch size for given destination name and message selector. Other than batching this method is the same as {@link JmsTemplate#receiveSelected(String, String)} @return A list of {@link Message} @param destinationName The destination name @param messageSelector The Selector @throws JmsException The {@link JmsException}
[ "Receive", "a", "batch", "of", "up", "to", "default", "batch", "size", "for", "given", "destination", "name", "and", "message", "selector", ".", "Other", "than", "batching", "this", "method", "is", "the", "same", "as", "{" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/jms/src/main/java/org/jadira/jms/template/BatchedJmsTemplate.java#L245-L247
xiancloud/xian
xian-cache/xian-redis/src/main/java/info/xiancloud/cache/redis/operate/ServerOperate.java
ServerOperate.getAttributeInInfo
public static String getAttributeInInfo(String info, String attribute) { if (info == null || "".equals(info)) return null; if (attribute == null || "".equals(attribute)) return null; String[] infos = info.split("\r\n"); for (String _info : infos) { if (_info.startsWith(attribute)) { String[] keyValue = _info.split(":"); if (keyValue[0].equals(attribute)) return keyValue[1]; } } return null; }
java
public static String getAttributeInInfo(String info, String attribute) { if (info == null || "".equals(info)) return null; if (attribute == null || "".equals(attribute)) return null; String[] infos = info.split("\r\n"); for (String _info : infos) { if (_info.startsWith(attribute)) { String[] keyValue = _info.split(":"); if (keyValue[0].equals(attribute)) return keyValue[1]; } } return null; }
[ "public", "static", "String", "getAttributeInInfo", "(", "String", "info", ",", "String", "attribute", ")", "{", "if", "(", "info", "==", "null", "||", "\"\"", ".", "equals", "(", "info", ")", ")", "return", "null", ";", "if", "(", "attribute", "==", "...
根据 info 获取具体属性的值 @param info info @param attribute attribute name @return attribute in info
[ "根据", "info", "获取具体属性的值" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-cache/xian-redis/src/main/java/info/xiancloud/cache/redis/operate/ServerOperate.java#L34-L51
opengeospatial/teamengine
teamengine-core/src/main/java/com/occamlab/te/parsers/SoapParser.java
SoapParser.parseSoap11Fault
private void parseSoap11Fault(Document soapMessage, PrintWriter logger) throws Exception { Element envelope = soapMessage.getDocumentElement(); Element element = DomUtils.getElementByTagName(envelope, "faultcode"); if (element == null) { element = DomUtils.getElementByTagNameNS(envelope, SOAP_11_NAMESPACE, "faultcode"); } String faultcode = element.getTextContent(); element = DomUtils.getElementByTagName(envelope, "faultstring"); if (element == null) { element = DomUtils.getElementByTagNameNS(envelope, SOAP_11_NAMESPACE, "faultstring"); } String faultstring = element.getTextContent(); String msg = "SOAP Fault received - [code:" + faultcode + "][fault string:" + faultstring + "]"; logger.println(msg); }
java
private void parseSoap11Fault(Document soapMessage, PrintWriter logger) throws Exception { Element envelope = soapMessage.getDocumentElement(); Element element = DomUtils.getElementByTagName(envelope, "faultcode"); if (element == null) { element = DomUtils.getElementByTagNameNS(envelope, SOAP_11_NAMESPACE, "faultcode"); } String faultcode = element.getTextContent(); element = DomUtils.getElementByTagName(envelope, "faultstring"); if (element == null) { element = DomUtils.getElementByTagNameNS(envelope, SOAP_11_NAMESPACE, "faultstring"); } String faultstring = element.getTextContent(); String msg = "SOAP Fault received - [code:" + faultcode + "][fault string:" + faultstring + "]"; logger.println(msg); }
[ "private", "void", "parseSoap11Fault", "(", "Document", "soapMessage", ",", "PrintWriter", "logger", ")", "throws", "Exception", "{", "Element", "envelope", "=", "soapMessage", ".", "getDocumentElement", "(", ")", ";", "Element", "element", "=", "DomUtils", ".", ...
A method to parse a SOAP 1.1 fault message. @param soapMessage the SOAP 1.1 fault message to parse @param logger the PrintWriter to log all results to @return void @author Simone Gianfranceschi
[ "A", "method", "to", "parse", "a", "SOAP", "1", ".", "1", "fault", "message", "." ]
train
https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/parsers/SoapParser.java#L282-L303
alkacon/opencms-core
src/org/opencms/search/fields/CmsSearchFieldConfiguration.java
CmsSearchFieldConfiguration.addUninvertingMappings
@Override public void addUninvertingMappings(Map<String, Type> uninvertingMap) { for (String fieldName : getFieldNames()) { uninvertingMap.put(fieldName, Type.SORTED); } }
java
@Override public void addUninvertingMappings(Map<String, Type> uninvertingMap) { for (String fieldName : getFieldNames()) { uninvertingMap.put(fieldName, Type.SORTED); } }
[ "@", "Override", "public", "void", "addUninvertingMappings", "(", "Map", "<", "String", ",", "Type", ">", "uninvertingMap", ")", "{", "for", "(", "String", "fieldName", ":", "getFieldNames", "(", ")", ")", "{", "uninvertingMap", ".", "put", "(", "fieldName",...
To allow sorting on a field the field must be added to the map given to {@link org.apache.solr.uninverting.UninvertingReader#wrap(org.apache.lucene.index.DirectoryReader, Map)}. The method adds the configured fields. @param uninvertingMap the map to which the fields are added.
[ "To", "allow", "sorting", "on", "a", "field", "the", "field", "must", "be", "added", "to", "the", "map", "given", "to", "{" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/fields/CmsSearchFieldConfiguration.java#L150-L157
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/comparators/AbsComparator.java
AbsComparator.getComparator
public static final AbsComparator getComparator(final INodeReadTrx paramRtx, final AbsAxis paramOperandOne, final AbsAxis paramOperandTwo, final CompKind paramKind, final String paramVal) { if ("eq".equals(paramVal) || "lt".equals(paramVal) || "le".equals(paramVal) || "gt".equals(paramVal) || "ge".equals(paramVal)) { return new ValueComp(paramRtx, paramOperandOne, paramOperandTwo, paramKind); } else if ("=".equals(paramVal) || "!=".equals(paramVal) || "<".equals(paramVal) || "<=".equals(paramVal) || ">".equals(paramVal) || ">=".equals(paramVal)) { return new GeneralComp(paramRtx, paramOperandOne, paramOperandTwo, paramKind); } else if ("is".equals(paramVal) || "<<".equals(paramVal) || ">>".equals(paramVal)) { return new NodeComp(paramRtx, paramOperandOne, paramOperandTwo, paramKind); } throw new IllegalStateException(paramVal + " is not a valid comparison."); }
java
public static final AbsComparator getComparator(final INodeReadTrx paramRtx, final AbsAxis paramOperandOne, final AbsAxis paramOperandTwo, final CompKind paramKind, final String paramVal) { if ("eq".equals(paramVal) || "lt".equals(paramVal) || "le".equals(paramVal) || "gt".equals(paramVal) || "ge".equals(paramVal)) { return new ValueComp(paramRtx, paramOperandOne, paramOperandTwo, paramKind); } else if ("=".equals(paramVal) || "!=".equals(paramVal) || "<".equals(paramVal) || "<=".equals(paramVal) || ">".equals(paramVal) || ">=".equals(paramVal)) { return new GeneralComp(paramRtx, paramOperandOne, paramOperandTwo, paramKind); } else if ("is".equals(paramVal) || "<<".equals(paramVal) || ">>".equals(paramVal)) { return new NodeComp(paramRtx, paramOperandOne, paramOperandTwo, paramKind); } throw new IllegalStateException(paramVal + " is not a valid comparison."); }
[ "public", "static", "final", "AbsComparator", "getComparator", "(", "final", "INodeReadTrx", "paramRtx", ",", "final", "AbsAxis", "paramOperandOne", ",", "final", "AbsAxis", "paramOperandTwo", ",", "final", "CompKind", "paramKind", ",", "final", "String", "paramVal", ...
Factory method to implement the comparator. @param paramRtx rtx for accessing data @param paramOperandOne operand one to be compared @param paramOperandTwo operand two to be compared @param paramKind kind of comparison @param paramVal string value to estimate @return AbsComparator the comparator of two axis
[ "Factory", "method", "to", "implement", "the", "comparator", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/comparators/AbsComparator.java#L227-L240
eobermuhlner/big-math
ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java
BigDecimalMath.asinh
public static BigDecimal asinh(BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); BigDecimal result = log(x.add(sqrt(x.multiply(x, mc).add(ONE, mc), mc), mc), mc); return round(result, mathContext); }
java
public static BigDecimal asinh(BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 10, mathContext.getRoundingMode()); BigDecimal result = log(x.add(sqrt(x.multiply(x, mc).add(ONE, mc), mc), mc), mc); return round(result, mathContext); }
[ "public", "static", "BigDecimal", "asinh", "(", "BigDecimal", "x", ",", "MathContext", "mathContext", ")", "{", "checkMathContext", "(", "mathContext", ")", ";", "MathContext", "mc", "=", "new", "MathContext", "(", "mathContext", ".", "getPrecision", "(", ")", ...
Calculates the arc hyperbolic sine (inverse hyperbolic sine) of {@link BigDecimal} x. <p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p> @param x the {@link BigDecimal} to calculate the arc hyperbolic sine for @param mathContext the {@link MathContext} used for the result @return the calculated arc hyperbolic sine {@link BigDecimal} with the precision specified in the <code>mathContext</code> @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision
[ "Calculates", "the", "arc", "hyperbolic", "sine", "(", "inverse", "hyperbolic", "sine", ")", "of", "{", "@link", "BigDecimal", "}", "x", "." ]
train
https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java#L1601-L1606
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDQL.java
ParserDQL.readWindowSpecification
private Expression readWindowSpecification(int tokenT, Expression aggExpr) { SortAndSlice sortAndSlice = null; readThis(Tokens.OPENBRACKET); List<Expression> partitionByList = new ArrayList<>(); if (token.tokenType == Tokens.PARTITION) { read(); readThis(Tokens.BY); while (true) { Expression partitionExpr = XreadValueExpression(); partitionByList.add(partitionExpr); if (token.tokenType == Tokens.COMMA) { read(); continue; } break; } } if (token.tokenType == Tokens.ORDER) { // order by clause read(); readThis(Tokens.BY); sortAndSlice = XreadOrderBy(); } readThis(Tokens.CLOSEBRACKET); // We don't really care about aggExpr any more. It has the // aggregate expression as a non-windowed expression. We do // care about its parameters and whether it's specified as // unique though. assert(aggExpr == null || aggExpr instanceof ExpressionAggregate); Expression nodes[]; boolean isDistinct; if (aggExpr != null) { ExpressionAggregate winAggExpr = (ExpressionAggregate)aggExpr; nodes = winAggExpr.nodes; isDistinct = winAggExpr.isDistinctAggregate; } else { nodes = Expression.emptyExpressionArray; isDistinct = false; } ExpressionWindowed windowedExpr = new ExpressionWindowed(tokenT, nodes, isDistinct, sortAndSlice, partitionByList); return windowedExpr; }
java
private Expression readWindowSpecification(int tokenT, Expression aggExpr) { SortAndSlice sortAndSlice = null; readThis(Tokens.OPENBRACKET); List<Expression> partitionByList = new ArrayList<>(); if (token.tokenType == Tokens.PARTITION) { read(); readThis(Tokens.BY); while (true) { Expression partitionExpr = XreadValueExpression(); partitionByList.add(partitionExpr); if (token.tokenType == Tokens.COMMA) { read(); continue; } break; } } if (token.tokenType == Tokens.ORDER) { // order by clause read(); readThis(Tokens.BY); sortAndSlice = XreadOrderBy(); } readThis(Tokens.CLOSEBRACKET); // We don't really care about aggExpr any more. It has the // aggregate expression as a non-windowed expression. We do // care about its parameters and whether it's specified as // unique though. assert(aggExpr == null || aggExpr instanceof ExpressionAggregate); Expression nodes[]; boolean isDistinct; if (aggExpr != null) { ExpressionAggregate winAggExpr = (ExpressionAggregate)aggExpr; nodes = winAggExpr.nodes; isDistinct = winAggExpr.isDistinctAggregate; } else { nodes = Expression.emptyExpressionArray; isDistinct = false; } ExpressionWindowed windowedExpr = new ExpressionWindowed(tokenT, nodes, isDistinct, sortAndSlice, partitionByList); return windowedExpr; }
[ "private", "Expression", "readWindowSpecification", "(", "int", "tokenT", ",", "Expression", "aggExpr", ")", "{", "SortAndSlice", "sortAndSlice", "=", "null", ";", "readThis", "(", "Tokens", ".", "OPENBRACKET", ")", ";", "List", "<", "Expression", ">", "partitio...
This is a minimal parsing of the Window Specification. We only use partition by and order by lists. There is a lot of complexity in the full SQL specification which we don't parse at all. @param tokenT @param aggExpr @return
[ "This", "is", "a", "minimal", "parsing", "of", "the", "Window", "Specification", ".", "We", "only", "use", "partition", "by", "and", "order", "by", "lists", ".", "There", "is", "a", "lot", "of", "complexity", "in", "the", "full", "SQL", "specification", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDQL.java#L1734-L1786
hibernate/hibernate-metamodelgen
src/main/java/org/hibernate/jpamodelgen/annotation/MetaAttributeGenerationVisitor.java
MetaAttributeGenerationVisitor.getTargetEntity
private String getTargetEntity(List<? extends AnnotationMirror> annotations) { String fullyQualifiedTargetEntityName = null; for ( AnnotationMirror mirror : annotations ) { if ( TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ELEMENT_COLLECTION ) ) { fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "targetClass" ); } else if ( TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ONE_TO_MANY ) || TypeUtils.isAnnotationMirrorOfType( mirror, Constants.MANY_TO_MANY ) || TypeUtils.isAnnotationMirrorOfType( mirror, Constants.MANY_TO_ONE ) || TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ONE_TO_ONE ) ) { fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "targetEntity" ); } else if ( TypeUtils.isAnnotationMirrorOfType( mirror, ORG_HIBERNATE_ANNOTATIONS_TARGET ) ) { fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "value" ); } } return fullyQualifiedTargetEntityName; }
java
private String getTargetEntity(List<? extends AnnotationMirror> annotations) { String fullyQualifiedTargetEntityName = null; for ( AnnotationMirror mirror : annotations ) { if ( TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ELEMENT_COLLECTION ) ) { fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "targetClass" ); } else if ( TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ONE_TO_MANY ) || TypeUtils.isAnnotationMirrorOfType( mirror, Constants.MANY_TO_MANY ) || TypeUtils.isAnnotationMirrorOfType( mirror, Constants.MANY_TO_ONE ) || TypeUtils.isAnnotationMirrorOfType( mirror, Constants.ONE_TO_ONE ) ) { fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "targetEntity" ); } else if ( TypeUtils.isAnnotationMirrorOfType( mirror, ORG_HIBERNATE_ANNOTATIONS_TARGET ) ) { fullyQualifiedTargetEntityName = getFullyQualifiedClassNameOfTargetEntity( mirror, "value" ); } } return fullyQualifiedTargetEntityName; }
[ "private", "String", "getTargetEntity", "(", "List", "<", "?", "extends", "AnnotationMirror", ">", "annotations", ")", "{", "String", "fullyQualifiedTargetEntityName", "=", "null", ";", "for", "(", "AnnotationMirror", "mirror", ":", "annotations", ")", "{", "if", ...
@param annotations list of annotation mirrors. @return target entity class name as string or {@code null} if no targetEntity is here or if equals to void
[ "@param", "annotations", "list", "of", "annotation", "mirrors", "." ]
train
https://github.com/hibernate/hibernate-metamodelgen/blob/2c87b262bc03b1a5a541789fc00c54e0531a36b2/src/main/java/org/hibernate/jpamodelgen/annotation/MetaAttributeGenerationVisitor.java#L246-L263
google/closure-templates
java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitorAssistantForMsgs.java
GenJsCodeVisitorAssistantForMsgs.generateSingleMsgVariable
private Expression generateSingleMsgVariable(MsgNode msgNode, String tmpVarName) { String googMsgVarName = buildGoogMsgVarNameHelper(msgNode); // Generate the goog.getMsg call. GoogMsgCodeGenInfo googMsgCodeGenInfo = genGoogGetMsgCallHelper(googMsgVarName, msgNode); if (!msgNode.isPlrselMsg()) { // No postprocessing is needed. Simply use the original goog.getMsg var. return googMsgCodeGenInfo.googMsgVar; } // For plural/select messages, generate the goog.i18n.MessageFormat call. // We don't want to output the result of goog.getMsg() directly. Instead, we send that // string to goog.i18n.MessageFormat for postprocessing. This postprocessing is where we're // handling all placeholder replacements, even ones that have nothing to do with // plural/select. return VariableDeclaration.builder(tmpVarName) .setRhs(getMessageFormatCall(googMsgCodeGenInfo)) .build() .ref(); }
java
private Expression generateSingleMsgVariable(MsgNode msgNode, String tmpVarName) { String googMsgVarName = buildGoogMsgVarNameHelper(msgNode); // Generate the goog.getMsg call. GoogMsgCodeGenInfo googMsgCodeGenInfo = genGoogGetMsgCallHelper(googMsgVarName, msgNode); if (!msgNode.isPlrselMsg()) { // No postprocessing is needed. Simply use the original goog.getMsg var. return googMsgCodeGenInfo.googMsgVar; } // For plural/select messages, generate the goog.i18n.MessageFormat call. // We don't want to output the result of goog.getMsg() directly. Instead, we send that // string to goog.i18n.MessageFormat for postprocessing. This postprocessing is where we're // handling all placeholder replacements, even ones that have nothing to do with // plural/select. return VariableDeclaration.builder(tmpVarName) .setRhs(getMessageFormatCall(googMsgCodeGenInfo)) .build() .ref(); }
[ "private", "Expression", "generateSingleMsgVariable", "(", "MsgNode", "msgNode", ",", "String", "tmpVarName", ")", "{", "String", "googMsgVarName", "=", "buildGoogMsgVarNameHelper", "(", "msgNode", ")", ";", "// Generate the goog.getMsg call.", "GoogMsgCodeGenInfo", "googMs...
Returns a code chunk representing a variable declaration for an {@link MsgNode} with no fallback messages.
[ "Returns", "a", "code", "chunk", "representing", "a", "variable", "declaration", "for", "an", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitorAssistantForMsgs.java#L185-L204
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/report/db/EmoTableAllTablesReportDAO.java
EmoTableAllTablesReportDAO.getReportEntries
@Override public Iterable<TableReportEntry> getReportEntries(String reportId, final AllTablesReportQuery query) { checkNotNull(reportId, "reportId"); final String reportTable = getTableName(reportId); // Set up several filters based on the query attributes final Predicate<String> placementFilter = query.getPlacements().isEmpty() ? Predicates.<String>alwaysTrue() : Predicates.in(query.getPlacements()); final Predicate<Boolean> droppedFilter = query.isIncludeDropped() ? Predicates.<Boolean>alwaysTrue() : Predicates.equalTo(false); final Predicate<Boolean> facadeFilter = query.isIncludeFacades() ? Predicates.<Boolean>alwaysTrue() : Predicates.equalTo(false); return new Iterable<TableReportEntry>() { @Override public Iterator<TableReportEntry> iterator() { return Iterators.limit( Iterators.filter( Iterators.transform( queryDataStoreForTableReportResults(reportTable, query), new Function<Map<String, Object>, TableReportEntry>() { @Nullable @Override public TableReportEntry apply(Map<String, Object> map) { if (Intrinsic.getId(map).startsWith("~")) { // Skip this row, it's the metadata return null; } return convertToTableReportEntry( map, placementFilter, droppedFilter, facadeFilter); } }), Predicates.notNull() ), query.getLimit() ); } }; }
java
@Override public Iterable<TableReportEntry> getReportEntries(String reportId, final AllTablesReportQuery query) { checkNotNull(reportId, "reportId"); final String reportTable = getTableName(reportId); // Set up several filters based on the query attributes final Predicate<String> placementFilter = query.getPlacements().isEmpty() ? Predicates.<String>alwaysTrue() : Predicates.in(query.getPlacements()); final Predicate<Boolean> droppedFilter = query.isIncludeDropped() ? Predicates.<Boolean>alwaysTrue() : Predicates.equalTo(false); final Predicate<Boolean> facadeFilter = query.isIncludeFacades() ? Predicates.<Boolean>alwaysTrue() : Predicates.equalTo(false); return new Iterable<TableReportEntry>() { @Override public Iterator<TableReportEntry> iterator() { return Iterators.limit( Iterators.filter( Iterators.transform( queryDataStoreForTableReportResults(reportTable, query), new Function<Map<String, Object>, TableReportEntry>() { @Nullable @Override public TableReportEntry apply(Map<String, Object> map) { if (Intrinsic.getId(map).startsWith("~")) { // Skip this row, it's the metadata return null; } return convertToTableReportEntry( map, placementFilter, droppedFilter, facadeFilter); } }), Predicates.notNull() ), query.getLimit() ); } }; }
[ "@", "Override", "public", "Iterable", "<", "TableReportEntry", ">", "getReportEntries", "(", "String", "reportId", ",", "final", "AllTablesReportQuery", "query", ")", "{", "checkNotNull", "(", "reportId", ",", "\"reportId\"", ")", ";", "final", "String", "reportT...
Returns the matching table report entries for a report ID and query parameters.
[ "Returns", "the", "matching", "table", "report", "entries", "for", "a", "report", "ID", "and", "query", "parameters", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/report/db/EmoTableAllTablesReportDAO.java#L204-L249
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_tcp_farm_farmId_GET
public OvhBackendTcp serviceName_tcp_farm_farmId_GET(String serviceName, Long farmId) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/tcp/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBackendTcp.class); }
java
public OvhBackendTcp serviceName_tcp_farm_farmId_GET(String serviceName, Long farmId) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/tcp/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBackendTcp.class); }
[ "public", "OvhBackendTcp", "serviceName_tcp_farm_farmId_GET", "(", "String", "serviceName", ",", "Long", "farmId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/tcp/farm/{farmId}\"", ";", "StringBuilder", "sb", "=", "path", "...
Get this object properties REST: GET /ipLoadbalancing/{serviceName}/tcp/farm/{farmId} @param serviceName [required] The internal name of your IP load balancing @param farmId [required] Id of your farm
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1569-L1574
nextreports/nextreports-engine
src/ro/nextreports/engine/util/DateUtil.java
DateUtil.setMinutes
public static Date setMinutes(Date d, int minutes) { Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.set(Calendar.MINUTE, minutes); return cal.getTime(); }
java
public static Date setMinutes(Date d, int minutes) { Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.set(Calendar.MINUTE, minutes); return cal.getTime(); }
[ "public", "static", "Date", "setMinutes", "(", "Date", "d", ",", "int", "minutes", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "d", ")", ";", "cal", ".", "set", "(", "Calendar", ".", ...
Set minutes to a date @param d date @param minutes minutes @return new date
[ "Set", "minutes", "to", "a", "date" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L444-L449
geomajas/geomajas-project-client-gwt2
impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java
JsonService.getStringValue
public static String getStringValue(JSONObject jsonObject, String key) throws JSONException { checkArguments(jsonObject, key); JSONValue value = jsonObject.get(key); if (value != null) { if (value.isString() != null) { return ((JSONString) value).stringValue(); } else { String valueString = value.toString(); if (!"null".equals(valueString)) { if (valueString.charAt(0) == '"') { return valueString.substring(1, valueString.length() - 1); } return valueString; } } } return null; }
java
public static String getStringValue(JSONObject jsonObject, String key) throws JSONException { checkArguments(jsonObject, key); JSONValue value = jsonObject.get(key); if (value != null) { if (value.isString() != null) { return ((JSONString) value).stringValue(); } else { String valueString = value.toString(); if (!"null".equals(valueString)) { if (valueString.charAt(0) == '"') { return valueString.substring(1, valueString.length() - 1); } return valueString; } } } return null; }
[ "public", "static", "String", "getStringValue", "(", "JSONObject", "jsonObject", ",", "String", "key", ")", "throws", "JSONException", "{", "checkArguments", "(", "jsonObject", ",", "key", ")", ";", "JSONValue", "value", "=", "jsonObject", ".", "get", "(", "ke...
Get a string value from a {@link JSONObject}. @param jsonObject The object to get the key value from. @param key The name of the key to search the value for. @return Returns the value for the key in the object or null. @throws JSONException Thrown in case the key could not be found in the JSON object.
[ "Get", "a", "string", "value", "from", "a", "{", "@link", "JSONObject", "}", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java#L138-L155
beangle/beangle3
ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java
BeanDefinitionParser.buildTypedStringValue
protected TypedStringValue buildTypedStringValue(String value, String targetTypeName) throws ClassNotFoundException { TypedStringValue typedValue; if (!StringUtils.hasText(targetTypeName)) typedValue = new TypedStringValue(value); else typedValue = new TypedStringValue(value, targetTypeName); return typedValue; }
java
protected TypedStringValue buildTypedStringValue(String value, String targetTypeName) throws ClassNotFoundException { TypedStringValue typedValue; if (!StringUtils.hasText(targetTypeName)) typedValue = new TypedStringValue(value); else typedValue = new TypedStringValue(value, targetTypeName); return typedValue; }
[ "protected", "TypedStringValue", "buildTypedStringValue", "(", "String", "value", ",", "String", "targetTypeName", ")", "throws", "ClassNotFoundException", "{", "TypedStringValue", "typedValue", ";", "if", "(", "!", "StringUtils", ".", "hasText", "(", "targetTypeName", ...
Build a typed String value Object for the given raw value. @see org.springframework.beans.factory.config.TypedStringValue @param value a {@link java.lang.String} object. @param targetTypeName a {@link java.lang.String} object. @return a {@link org.springframework.beans.factory.config.TypedStringValue} object. @throws java.lang.ClassNotFoundException if any.
[ "Build", "a", "typed", "String", "value", "Object", "for", "the", "given", "raw", "value", "." ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L782-L788
tango-controls/JTango
common/src/main/java/org/tango/utils/ArrayUtils.java
ArrayUtils.toPrimitiveArray
public final static Object toPrimitiveArray(final Object array) { if (!array.getClass().isArray()) { return array; } final Class<?> clazz = OBJ_TO_PRIMITIVE.get(array.getClass().getComponentType()); return setArray(clazz, array); }
java
public final static Object toPrimitiveArray(final Object array) { if (!array.getClass().isArray()) { return array; } final Class<?> clazz = OBJ_TO_PRIMITIVE.get(array.getClass().getComponentType()); return setArray(clazz, array); }
[ "public", "final", "static", "Object", "toPrimitiveArray", "(", "final", "Object", "array", ")", "{", "if", "(", "!", "array", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "return", "array", ";", "}", "final", "Class", "<", "?", ">"...
Convert an array of Objects to primitives if possible. Return input otherwise @param array the array to convert @return The array of primitives
[ "Convert", "an", "array", "of", "Objects", "to", "primitives", "if", "possible", ".", "Return", "input", "otherwise" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/common/src/main/java/org/tango/utils/ArrayUtils.java#L45-L51
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/html/HtmlBuilder.java
HtmlBuilder.simonProperty
public T simonProperty(Simon simon, String propertyName) throws IOException { Getter getter = GetterFactory.getGetter(simon.getClass(), propertyName); if (getter != null) { value(getter.get(simon), getter.getSubType()); } return (T) this; }
java
public T simonProperty(Simon simon, String propertyName) throws IOException { Getter getter = GetterFactory.getGetter(simon.getClass(), propertyName); if (getter != null) { value(getter.get(simon), getter.getSubType()); } return (T) this; }
[ "public", "T", "simonProperty", "(", "Simon", "simon", ",", "String", "propertyName", ")", "throws", "IOException", "{", "Getter", "getter", "=", "GetterFactory", ".", "getGetter", "(", "simon", ".", "getClass", "(", ")", ",", "propertyName", ")", ";", "if",...
Write Simon property (using Java Bean convention). @param simon Simon @param propertyName Property name
[ "Write", "Simon", "property", "(", "using", "Java", "Bean", "convention", ")", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/html/HtmlBuilder.java#L199-L205
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java
ZonedDateTime.withLaterOffsetAtOverlap
@Override public ZonedDateTime withLaterOffsetAtOverlap() { ZoneOffsetTransition trans = getZone().getRules().getTransition(toLocalDateTime()); if (trans != null) { ZoneOffset laterOffset = trans.getOffsetAfter(); if (laterOffset.equals(offset) == false) { return new ZonedDateTime(dateTime, laterOffset, zone); } } return this; }
java
@Override public ZonedDateTime withLaterOffsetAtOverlap() { ZoneOffsetTransition trans = getZone().getRules().getTransition(toLocalDateTime()); if (trans != null) { ZoneOffset laterOffset = trans.getOffsetAfter(); if (laterOffset.equals(offset) == false) { return new ZonedDateTime(dateTime, laterOffset, zone); } } return this; }
[ "@", "Override", "public", "ZonedDateTime", "withLaterOffsetAtOverlap", "(", ")", "{", "ZoneOffsetTransition", "trans", "=", "getZone", "(", ")", ".", "getRules", "(", ")", ".", "getTransition", "(", "toLocalDateTime", "(", ")", ")", ";", "if", "(", "trans", ...
Returns a copy of this date-time changing the zone offset to the later of the two valid offsets at a local time-line overlap. <p> This method only has any effect when the local time-line overlaps, such as at an autumn daylight savings cutover. In this scenario, there are two valid offsets for the local date-time. Calling this method will return a zoned date-time with the later of the two selected. <p> If this method is called when it is not an overlap, {@code this} is returned. <p> This instance is immutable and unaffected by this method call. @return a {@code ZonedDateTime} based on this date-time with the later offset, not null
[ "Returns", "a", "copy", "of", "this", "date", "-", "time", "changing", "the", "zone", "offset", "to", "the", "later", "of", "the", "two", "valid", "offsets", "at", "a", "local", "time", "-", "line", "overlap", ".", "<p", ">", "This", "method", "only", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java#L911-L921
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java
TypeRegistry.instanceFieldInterceptionRequired
@UsedByGeneratedCode public static boolean instanceFieldInterceptionRequired(int ids, String name) { if (nothingReloaded) { return false; } int registryId = ids >>> 16; int typeId = ids & 0xffff; TypeRegistry typeRegistry = registryInstances[registryId].get(); ReloadableType reloadableType = typeRegistry.getReloadableType(typeId); // TODO covers all situations? if (reloadableType != null) { if (reloadableType.hasFieldChangedInHierarchy(name)) { return true; } } return false; }
java
@UsedByGeneratedCode public static boolean instanceFieldInterceptionRequired(int ids, String name) { if (nothingReloaded) { return false; } int registryId = ids >>> 16; int typeId = ids & 0xffff; TypeRegistry typeRegistry = registryInstances[registryId].get(); ReloadableType reloadableType = typeRegistry.getReloadableType(typeId); // TODO covers all situations? if (reloadableType != null) { if (reloadableType.hasFieldChangedInHierarchy(name)) { return true; } } return false; }
[ "@", "UsedByGeneratedCode", "public", "static", "boolean", "instanceFieldInterceptionRequired", "(", "int", "ids", ",", "String", "name", ")", "{", "if", "(", "nothingReloaded", ")", "{", "return", "false", ";", "}", "int", "registryId", "=", "ids", ">>>", "16...
Called for a field operation - trying to determine whether a particular field needs special handling. @param ids packed representation of the registryId (top 16bits) and typeId (bottom 16bits) @param name the name of the instance field about to be accessed @return true if the field operation must be intercepted
[ "Called", "for", "a", "field", "operation", "-", "trying", "to", "determine", "whether", "a", "particular", "field", "needs", "special", "handling", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java#L1747-L1763
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/TransferManager.java
TransferManager.uploadDirectory
public MultipleFileUpload uploadDirectory(String bucketName, String virtualDirectoryKeyPrefix, File directory, boolean includeSubdirectories) { return uploadDirectory(bucketName, virtualDirectoryKeyPrefix, directory, includeSubdirectories, null); }
java
public MultipleFileUpload uploadDirectory(String bucketName, String virtualDirectoryKeyPrefix, File directory, boolean includeSubdirectories) { return uploadDirectory(bucketName, virtualDirectoryKeyPrefix, directory, includeSubdirectories, null); }
[ "public", "MultipleFileUpload", "uploadDirectory", "(", "String", "bucketName", ",", "String", "virtualDirectoryKeyPrefix", ",", "File", "directory", ",", "boolean", "includeSubdirectories", ")", "{", "return", "uploadDirectory", "(", "bucketName", ",", "virtualDirectoryK...
Uploads all files in the directory given to the bucket named, optionally recursing for all subdirectories. <p> S3 will overwrite any existing objects that happen to have the same key, just as when uploading individual files, so use with caution. </p> <p> If you are uploading <a href="http://aws.amazon.com/kms/">AWS KMS</a>-encrypted objects, you need to specify the correct region of the bucket on your client and configure AWS Signature Version 4 for added security. For more information on how to do this, see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html# specify-signature-version </p> @param bucketName The name of the bucket to upload objects to. @param virtualDirectoryKeyPrefix The key prefix of the virtual directory to upload to. Use the null or empty string to upload files to the root of the bucket. @param directory The directory to upload. @param includeSubdirectories Whether to include subdirectories in the upload. If true, files found in subdirectories will be included with an appropriate concatenation to the key prefix.
[ "Uploads", "all", "files", "in", "the", "directory", "given", "to", "the", "bucket", "named", "optionally", "recursing", "for", "all", "subdirectories", ".", "<p", ">", "S3", "will", "overwrite", "any", "existing", "objects", "that", "happen", "to", "have", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/TransferManager.java#L1478-L1480
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointResponse.java
EndpointResponse.withAttributes
public EndpointResponse withAttributes(java.util.Map<String, java.util.List<String>> attributes) { setAttributes(attributes); return this; }
java
public EndpointResponse withAttributes(java.util.Map<String, java.util.List<String>> attributes) { setAttributes(attributes); return this; }
[ "public", "EndpointResponse", "withAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "attributes", ")", "{", "setAttributes", "(", "attributes", ")", ";", "return", "this", "...
Custom attributes that describe the endpoint by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes. @param attributes Custom attributes that describe the endpoint by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes. @return Returns a reference to this object so that method calls can be chained together.
[ "Custom", "attributes", "that", "describe", "the", "endpoint", "by", "associating", "a", "name", "with", "an", "array", "of", "values", ".", "For", "example", "an", "attribute", "named", "interests", "might", "have", "the", "following", "values", ":", "[", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointResponse.java#L221-L224
rzwitserloot/lombok
src/core/lombok/bytecode/ClassFileMetaData.java
ClassFileMetaData.usesMethod
public boolean usesMethod(String className, String methodName) { int classIndex = findClass(className); if (classIndex == NOT_FOUND) return false; int methodNameIndex = findUtf8(methodName); if (methodNameIndex == NOT_FOUND) return false; for (int i = 1; i < maxPoolSize; i++) { if (isMethod(i) && readValue(offsets[i]) == classIndex) { int nameAndTypeIndex = readValue(offsets[i] + 2); if (readValue(offsets[nameAndTypeIndex]) == methodNameIndex) return true; } } return false; }
java
public boolean usesMethod(String className, String methodName) { int classIndex = findClass(className); if (classIndex == NOT_FOUND) return false; int methodNameIndex = findUtf8(methodName); if (methodNameIndex == NOT_FOUND) return false; for (int i = 1; i < maxPoolSize; i++) { if (isMethod(i) && readValue(offsets[i]) == classIndex) { int nameAndTypeIndex = readValue(offsets[i] + 2); if (readValue(offsets[nameAndTypeIndex]) == methodNameIndex) return true; } } return false; }
[ "public", "boolean", "usesMethod", "(", "String", "className", ",", "String", "methodName", ")", "{", "int", "classIndex", "=", "findClass", "(", "className", ")", ";", "if", "(", "classIndex", "==", "NOT_FOUND", ")", "return", "false", ";", "int", "methodNa...
Checks if the constant pool contains a reference to a given method, with any signature (return type and parameter types). @param className must be provided JVM-style, such as {@code java/lang/String}
[ "Checks", "if", "the", "constant", "pool", "contains", "a", "reference", "to", "a", "given", "method", "with", "any", "signature", "(", "return", "type", "and", "parameter", "types", ")", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/bytecode/ClassFileMetaData.java#L184-L197
Terradue/jcatalogue-client
apis/src/main/java/com/terradue/jcatalogue/repository/Proxy.java
Proxy.setType
public Proxy setType( String type ) { if ( this.type.equals( type ) || ( type == null && this.type.length() <= 0 ) ) { return this; } return new Proxy( type, host, port, auth ); }
java
public Proxy setType( String type ) { if ( this.type.equals( type ) || ( type == null && this.type.length() <= 0 ) ) { return this; } return new Proxy( type, host, port, auth ); }
[ "public", "Proxy", "setType", "(", "String", "type", ")", "{", "if", "(", "this", ".", "type", ".", "equals", "(", "type", ")", "||", "(", "type", "==", "null", "&&", "this", ".", "type", ".", "length", "(", ")", "<=", "0", ")", ")", "{", "retu...
Sets the type of the proxy. @param type The type of the proxy, e.g. "http", may be {@code null}. @return The new proxy, never {@code null}.
[ "Sets", "the", "type", "of", "the", "proxy", "." ]
train
https://github.com/Terradue/jcatalogue-client/blob/1f24c4da952d8ad2373c4fa97eed48b0b8a88d21/apis/src/main/java/com/terradue/jcatalogue/repository/Proxy.java#L79-L86
app55/app55-java
src/support/java/com/googlecode/openbeans/PersistenceDelegate.java
PersistenceDelegate.writeObject
public void writeObject(Object oldInstance, Encoder out) { Object newInstance = out.get(oldInstance); Class<?> clazz = oldInstance.getClass(); if (mutatesTo(oldInstance, newInstance)) { initialize(clazz, oldInstance, newInstance, out); } else { out.remove(oldInstance); out.writeExpression(instantiate(oldInstance, out)); newInstance = out.get(oldInstance); if (newInstance != null) { initialize(clazz, oldInstance, newInstance, out); } } }
java
public void writeObject(Object oldInstance, Encoder out) { Object newInstance = out.get(oldInstance); Class<?> clazz = oldInstance.getClass(); if (mutatesTo(oldInstance, newInstance)) { initialize(clazz, oldInstance, newInstance, out); } else { out.remove(oldInstance); out.writeExpression(instantiate(oldInstance, out)); newInstance = out.get(oldInstance); if (newInstance != null) { initialize(clazz, oldInstance, newInstance, out); } } }
[ "public", "void", "writeObject", "(", "Object", "oldInstance", ",", "Encoder", "out", ")", "{", "Object", "newInstance", "=", "out", ".", "get", "(", "oldInstance", ")", ";", "Class", "<", "?", ">", "clazz", "=", "oldInstance", ".", "getClass", "(", ")",...
Writes a bean object to the given encoder. First it is checked whether the simulating new object can be mutated to the old instance. If yes, it is initialized to produce a series of expressions and statements that can be used to restore the old instance. Otherwise, remove the new object in the simulating new environment and writes an expression that can instantiate a new instance of the same type as the old one to the given encoder. @param oldInstance the old instance to be written @param out the encoder that the old instance will be written to
[ "Writes", "a", "bean", "object", "to", "the", "given", "encoder", ".", "First", "it", "is", "checked", "whether", "the", "simulating", "new", "object", "can", "be", "mutated", "to", "the", "old", "instance", ".", "If", "yes", "it", "is", "initialized", "...
train
https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/PersistenceDelegate.java#L99-L117
apache/groovy
src/main/java/org/codehaus/groovy/runtime/typehandling/NumberMath.java
NumberMath.leftShift
public static Number leftShift(Number left, Number right) { if (isFloatingPoint(right) || isBigDecimal(right)) { throw new UnsupportedOperationException("Shift distance must be an integral type, but " + right + " (" + right.getClass().getName() + ") was supplied"); } return getMath(left).leftShiftImpl(left, right); }
java
public static Number leftShift(Number left, Number right) { if (isFloatingPoint(right) || isBigDecimal(right)) { throw new UnsupportedOperationException("Shift distance must be an integral type, but " + right + " (" + right.getClass().getName() + ") was supplied"); } return getMath(left).leftShiftImpl(left, right); }
[ "public", "static", "Number", "leftShift", "(", "Number", "left", ",", "Number", "right", ")", "{", "if", "(", "isFloatingPoint", "(", "right", ")", "||", "isBigDecimal", "(", "right", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"S...
For this operation, consider the operands independently. Throw an exception if the right operand (shift distance) is not an integral type. For the left operand (shift value) also require an integral type, but do NOT promote from Integer to Long. This is consistent with Java, and makes sense for the shift operators.
[ "For", "this", "operation", "consider", "the", "operands", "independently", ".", "Throw", "an", "exception", "if", "the", "right", "operand", "(", "shift", "distance", ")", "is", "not", "an", "integral", "type", ".", "For", "the", "left", "operand", "(", "...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/typehandling/NumberMath.java#L97-L102
UrielCh/ovh-java-sdk
ovh-java-sdk-secret/src/main/java/net/minidev/ovh/api/ApiOvhSecret.java
ApiOvhSecret.retrieve_POST
public OvhSecret retrieve_POST(String id) throws IOException { String qPath = "/secret/retrieve"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "id", id); String resp = execN(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhSecret.class); }
java
public OvhSecret retrieve_POST(String id) throws IOException { String qPath = "/secret/retrieve"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "id", id); String resp = execN(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhSecret.class); }
[ "public", "OvhSecret", "retrieve_POST", "(", "String", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/secret/retrieve\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o"...
Retrieve a secret sent by email REST: POST /secret/retrieve @param id [required] The secret ID
[ "Retrieve", "a", "secret", "sent", "by", "email" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-secret/src/main/java/net/minidev/ovh/api/ApiOvhSecret.java#L25-L32
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMParser.java
OSMParser.createOSMDatabaseModel
private void createOSMDatabaseModel(Connection connection, boolean isH2, TableLocation requestedTable, String osmTableName) throws SQLException { String tagTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.TAG, isH2); tagPreparedStmt = OSMTablesFactory.createTagTable(connection, tagTableName); String nodeTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.NODE, isH2); nodePreparedStmt = OSMTablesFactory.createNodeTable(connection, nodeTableName, isH2); String nodeTagTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.NODE_TAG, isH2); nodeTagPreparedStmt = OSMTablesFactory.createNodeTagTable(connection, nodeTagTableName, tagTableName); String wayTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.WAY, isH2); wayPreparedStmt = OSMTablesFactory.createWayTable(connection, wayTableName, isH2); String wayTagTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.WAY_TAG, isH2); wayTagPreparedStmt = OSMTablesFactory.createWayTagTable(connection, wayTagTableName, tagTableName); String wayNodeTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.WAY_NODE, isH2); wayNodePreparedStmt = OSMTablesFactory.createWayNodeTable(connection, wayNodeTableName); String relationTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.RELATION, isH2); relationPreparedStmt = OSMTablesFactory.createRelationTable(connection, relationTableName); String relationTagTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.RELATION_TAG, isH2); relationTagPreparedStmt = OSMTablesFactory.createRelationTagTable(connection, relationTagTableName, tagTableName); String nodeMemberTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.NODE_MEMBER, isH2); nodeMemberPreparedStmt = OSMTablesFactory.createNodeMemberTable(connection, nodeMemberTableName); String wayMemberTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.WAY_MEMBER, isH2); wayMemberPreparedStmt = OSMTablesFactory.createWayMemberTable(connection, wayMemberTableName); String relationMemberTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.RELATION_MEMBER, isH2); relationMemberPreparedStmt = OSMTablesFactory.createRelationMemberTable(connection, relationMemberTableName); }
java
private void createOSMDatabaseModel(Connection connection, boolean isH2, TableLocation requestedTable, String osmTableName) throws SQLException { String tagTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.TAG, isH2); tagPreparedStmt = OSMTablesFactory.createTagTable(connection, tagTableName); String nodeTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.NODE, isH2); nodePreparedStmt = OSMTablesFactory.createNodeTable(connection, nodeTableName, isH2); String nodeTagTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.NODE_TAG, isH2); nodeTagPreparedStmt = OSMTablesFactory.createNodeTagTable(connection, nodeTagTableName, tagTableName); String wayTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.WAY, isH2); wayPreparedStmt = OSMTablesFactory.createWayTable(connection, wayTableName, isH2); String wayTagTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.WAY_TAG, isH2); wayTagPreparedStmt = OSMTablesFactory.createWayTagTable(connection, wayTagTableName, tagTableName); String wayNodeTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.WAY_NODE, isH2); wayNodePreparedStmt = OSMTablesFactory.createWayNodeTable(connection, wayNodeTableName); String relationTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.RELATION, isH2); relationPreparedStmt = OSMTablesFactory.createRelationTable(connection, relationTableName); String relationTagTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.RELATION_TAG, isH2); relationTagPreparedStmt = OSMTablesFactory.createRelationTagTable(connection, relationTagTableName, tagTableName); String nodeMemberTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.NODE_MEMBER, isH2); nodeMemberPreparedStmt = OSMTablesFactory.createNodeMemberTable(connection, nodeMemberTableName); String wayMemberTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.WAY_MEMBER, isH2); wayMemberPreparedStmt = OSMTablesFactory.createWayMemberTable(connection, wayMemberTableName); String relationMemberTableName = TableUtilities.caseIdentifier(requestedTable, osmTableName + OSMTablesFactory.RELATION_MEMBER, isH2); relationMemberPreparedStmt = OSMTablesFactory.createRelationMemberTable(connection, relationMemberTableName); }
[ "private", "void", "createOSMDatabaseModel", "(", "Connection", "connection", ",", "boolean", "isH2", ",", "TableLocation", "requestedTable", ",", "String", "osmTableName", ")", "throws", "SQLException", "{", "String", "tagTableName", "=", "TableUtilities", ".", "case...
Create the OMS data model to store the content of the file @param connection @param isH2 @param requestedTable @param osmTableName @throws SQLException
[ "Create", "the", "OMS", "data", "model", "to", "store", "the", "content", "of", "the", "file" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMParser.java#L235-L258
rjeschke/txtmark
src/main/java/com/github/rjeschke/txtmark/Emitter.java
Emitter.emitMarkedLines
private void emitMarkedLines(final StringBuilder out, final Line lines) { final StringBuilder in = new StringBuilder(); Line line = lines; while (line != null) { if (!line.isEmpty) { in.append(line.value.substring(line.leading, line.value.length() - line.trailing)); if (line.trailing >= 2) { in.append("<br />"); } } if (line.next != null) { in.append('\n'); } line = line.next; } this.recursiveEmitLine(out, in.toString(), 0, MarkToken.NONE); }
java
private void emitMarkedLines(final StringBuilder out, final Line lines) { final StringBuilder in = new StringBuilder(); Line line = lines; while (line != null) { if (!line.isEmpty) { in.append(line.value.substring(line.leading, line.value.length() - line.trailing)); if (line.trailing >= 2) { in.append("<br />"); } } if (line.next != null) { in.append('\n'); } line = line.next; } this.recursiveEmitLine(out, in.toString(), 0, MarkToken.NONE); }
[ "private", "void", "emitMarkedLines", "(", "final", "StringBuilder", "out", ",", "final", "Line", "lines", ")", "{", "final", "StringBuilder", "in", "=", "new", "StringBuilder", "(", ")", ";", "Line", "line", "=", "lines", ";", "while", "(", "line", "!=", ...
Writes a set of markdown lines into the StringBuilder. @param out The StringBuilder to write to. @param lines The lines to write.
[ "Writes", "a", "set", "of", "markdown", "lines", "into", "the", "StringBuilder", "." ]
train
https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Emitter.java#L903-L925
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/DTDSubsetImpl.java
DTDSubsetImpl.combineMaps
private static <K,V> void combineMaps(Map<K,V> m1, Map<K,V> m2) { for (Map.Entry<K,V> me : m2.entrySet()) { K key = me.getKey(); /* Int. subset has precedence, but let's guess most of * the time there are no collisions: */ V old = m1.put(key, me.getValue()); // Oops, got value! Let's put it back if (old != null) { m1.put(key, old); } } }
java
private static <K,V> void combineMaps(Map<K,V> m1, Map<K,V> m2) { for (Map.Entry<K,V> me : m2.entrySet()) { K key = me.getKey(); /* Int. subset has precedence, but let's guess most of * the time there are no collisions: */ V old = m1.put(key, me.getValue()); // Oops, got value! Let's put it back if (old != null) { m1.put(key, old); } } }
[ "private", "static", "<", "K", ",", "V", ">", "void", "combineMaps", "(", "Map", "<", "K", ",", "V", ">", "m1", ",", "Map", "<", "K", ",", "V", ">", "m2", ")", "{", "for", "(", "Map", ".", "Entry", "<", "K", ",", "V", ">", "me", ":", "m2"...
<p> Note: The first Map argument WILL be modified; second one not. Caller needs to ensure this is acceptable.
[ "<p", ">", "Note", ":", "The", "first", "Map", "argument", "WILL", "be", "modified", ";", "second", "one", "not", ".", "Caller", "needs", "to", "ensure", "this", "is", "acceptable", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDSubsetImpl.java#L451-L464
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java
ApplicationGatewaysInner.createOrUpdateAsync
public Observable<ApplicationGatewayInner> createOrUpdateAsync(String resourceGroupName, String applicationGatewayName, ApplicationGatewayInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, applicationGatewayName, parameters).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() { @Override public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) { return response.body(); } }); }
java
public Observable<ApplicationGatewayInner> createOrUpdateAsync(String resourceGroupName, String applicationGatewayName, ApplicationGatewayInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, applicationGatewayName, parameters).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() { @Override public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationGatewayInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "applicationGatewayName", ",", "ApplicationGatewayInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "r...
Creates or updates the specified application gateway. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @param parameters Parameters supplied to the create or update application gateway operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "the", "specified", "application", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L433-L440
rythmengine/rythmengine
src/main/java/org/rythmengine/toString/ToStringOption.java
ToStringOption.valueOf
public static ToStringOption valueOf(String s) { Pattern p = Pattern.compile("\\{appendStatic *\\: *(true|false) *; *appendTransient *\\: *(true|false) *; *upToClass *: *(.*)\\}"); Matcher m = p.matcher(s); if (!m.matches()) throw new IllegalArgumentException("Unknown ToStringOption: " + s); boolean appendStatic = Boolean.valueOf(m.group(1)); boolean appendTransient = Boolean.valueOf(m.group(2)); String upToClassStr = m.group(3); Class<?> upToClass; if (S.isEmpty(upToClassStr)) upToClass = null; else try { upToClass = Class.forName(upToClassStr); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Cannot find upToClass: " + upToClassStr); } return new ToStringOption(appendStatic, appendTransient, upToClass); }
java
public static ToStringOption valueOf(String s) { Pattern p = Pattern.compile("\\{appendStatic *\\: *(true|false) *; *appendTransient *\\: *(true|false) *; *upToClass *: *(.*)\\}"); Matcher m = p.matcher(s); if (!m.matches()) throw new IllegalArgumentException("Unknown ToStringOption: " + s); boolean appendStatic = Boolean.valueOf(m.group(1)); boolean appendTransient = Boolean.valueOf(m.group(2)); String upToClassStr = m.group(3); Class<?> upToClass; if (S.isEmpty(upToClassStr)) upToClass = null; else try { upToClass = Class.forName(upToClassStr); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Cannot find upToClass: " + upToClassStr); } return new ToStringOption(appendStatic, appendTransient, upToClass); }
[ "public", "static", "ToStringOption", "valueOf", "(", "String", "s", ")", "{", "Pattern", "p", "=", "Pattern", ".", "compile", "(", "\"\\\\{appendStatic *\\\\: *(true|false) *; *appendTransient *\\\\: *(true|false) *; *upToClass *: *(.*)\\\\}\"", ")", ";", "Matcher", "m", "...
Construct a <code>ToStringOption</code> instance out from a string. The format of the String should be the same as the format output of {@link #toString()} method @param s @return an option instance corresponding to the string specified
[ "Construct", "a", "<code", ">", "ToStringOption<", "/", "code", ">", "instance", "out", "from", "a", "string", ".", "The", "format", "of", "the", "String", "should", "be", "the", "same", "as", "the", "format", "output", "of", "{", "@link", "#toString", "...
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/toString/ToStringOption.java#L174-L189
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/nosql/lucene/BaseLuceneStorage.java
BaseLuceneStorage.buildQuery
protected Query buildQuery(String spaceId, String key) { BooleanQuery.Builder builder = new BooleanQuery.Builder(); if (!StringUtils.isBlank(spaceId)) { builder.add(new TermQuery(new Term(FIELD_SPACE_ID, spaceId.trim())), Occur.MUST); } if (!StringUtils.isBlank(key)) { builder.add(new TermQuery(new Term(FIELD_KEY, key.trim())), Occur.MUST); } return builder.build(); }
java
protected Query buildQuery(String spaceId, String key) { BooleanQuery.Builder builder = new BooleanQuery.Builder(); if (!StringUtils.isBlank(spaceId)) { builder.add(new TermQuery(new Term(FIELD_SPACE_ID, spaceId.trim())), Occur.MUST); } if (!StringUtils.isBlank(key)) { builder.add(new TermQuery(new Term(FIELD_KEY, key.trim())), Occur.MUST); } return builder.build(); }
[ "protected", "Query", "buildQuery", "(", "String", "spaceId", ",", "String", "key", ")", "{", "BooleanQuery", ".", "Builder", "builder", "=", "new", "BooleanQuery", ".", "Builder", "(", ")", ";", "if", "(", "!", "StringUtils", ".", "isBlank", "(", "spaceId...
Build query to match entry's space-id and key. @param spaceId @param key @return
[ "Build", "query", "to", "match", "entry", "s", "space", "-", "id", "and", "key", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/nosql/lucene/BaseLuceneStorage.java#L232-L241
voldemort/voldemort
src/java/voldemort/utils/PartitionBalanceUtils.java
PartitionBalanceUtils.analyzeInvalidMetadataRate
public static String analyzeInvalidMetadataRate(final Cluster currentCluster, List<StoreDefinition> currentStoreDefs, final Cluster finalCluster, List<StoreDefinition> finalStoreDefs) { StringBuilder sb = new StringBuilder(); sb.append("Dump of invalid metadata rates per zone").append(Utils.NEWLINE); HashMap<StoreDefinition, Integer> uniqueStores = StoreDefinitionUtils.getUniqueStoreDefinitionsWithCounts(currentStoreDefs); for(StoreDefinition currentStoreDef: uniqueStores.keySet()) { sb.append("Store exemplar: " + currentStoreDef.getName()) .append(Utils.NEWLINE) .append("\tThere are " + uniqueStores.get(currentStoreDef) + " other similar stores.") .append(Utils.NEWLINE); StoreRoutingPlan currentSRP = new StoreRoutingPlan(currentCluster, currentStoreDef); StoreDefinition finalStoreDef = StoreUtils.getStoreDef(finalStoreDefs, currentStoreDef.getName()); StoreRoutingPlan finalSRP = new StoreRoutingPlan(finalCluster, finalStoreDef); // Only care about existing zones for(int zoneId: currentCluster.getZoneIds()) { int zonePrimariesCount = 0; int invalidMetadata = 0; // Examine nodes in current cluster in existing zone. for(int nodeId: currentCluster.getNodeIdsInZone(zoneId)) { // For every zone-primary in current cluster for(int zonePrimaryPartitionId: currentSRP.getZonePrimaryPartitionIds(nodeId)) { zonePrimariesCount++; // Determine if original zone-primary node is still some // form of n-ary in final cluster. If not, // InvalidMetadataException will fire. if(!finalSRP.getZoneNAryPartitionIds(nodeId) .contains(zonePrimaryPartitionId)) { invalidMetadata++; } } } float rate = invalidMetadata / (float) zonePrimariesCount; sb.append("\tZone " + zoneId) .append(" : total zone primaries " + zonePrimariesCount) .append(", # that trigger invalid metadata " + invalidMetadata) .append(" => " + rate) .append(Utils.NEWLINE); } } return sb.toString(); }
java
public static String analyzeInvalidMetadataRate(final Cluster currentCluster, List<StoreDefinition> currentStoreDefs, final Cluster finalCluster, List<StoreDefinition> finalStoreDefs) { StringBuilder sb = new StringBuilder(); sb.append("Dump of invalid metadata rates per zone").append(Utils.NEWLINE); HashMap<StoreDefinition, Integer> uniqueStores = StoreDefinitionUtils.getUniqueStoreDefinitionsWithCounts(currentStoreDefs); for(StoreDefinition currentStoreDef: uniqueStores.keySet()) { sb.append("Store exemplar: " + currentStoreDef.getName()) .append(Utils.NEWLINE) .append("\tThere are " + uniqueStores.get(currentStoreDef) + " other similar stores.") .append(Utils.NEWLINE); StoreRoutingPlan currentSRP = new StoreRoutingPlan(currentCluster, currentStoreDef); StoreDefinition finalStoreDef = StoreUtils.getStoreDef(finalStoreDefs, currentStoreDef.getName()); StoreRoutingPlan finalSRP = new StoreRoutingPlan(finalCluster, finalStoreDef); // Only care about existing zones for(int zoneId: currentCluster.getZoneIds()) { int zonePrimariesCount = 0; int invalidMetadata = 0; // Examine nodes in current cluster in existing zone. for(int nodeId: currentCluster.getNodeIdsInZone(zoneId)) { // For every zone-primary in current cluster for(int zonePrimaryPartitionId: currentSRP.getZonePrimaryPartitionIds(nodeId)) { zonePrimariesCount++; // Determine if original zone-primary node is still some // form of n-ary in final cluster. If not, // InvalidMetadataException will fire. if(!finalSRP.getZoneNAryPartitionIds(nodeId) .contains(zonePrimaryPartitionId)) { invalidMetadata++; } } } float rate = invalidMetadata / (float) zonePrimariesCount; sb.append("\tZone " + zoneId) .append(" : total zone primaries " + zonePrimariesCount) .append(", # that trigger invalid metadata " + invalidMetadata) .append(" => " + rate) .append(Utils.NEWLINE); } } return sb.toString(); }
[ "public", "static", "String", "analyzeInvalidMetadataRate", "(", "final", "Cluster", "currentCluster", ",", "List", "<", "StoreDefinition", ">", "currentStoreDefs", ",", "final", "Cluster", "finalCluster", ",", "List", "<", "StoreDefinition", ">", "finalStoreDefs", ")...
Compares current cluster with final cluster. Uses pertinent store defs for each cluster to determine if a node that hosts a zone-primary in the current cluster will no longer host any zone-nary in the final cluster. This check is the precondition for a server returning an invalid metadata exception to a client on a normal-case put or get. Normal-case being that the zone-primary receives the pseudo-master put or the get operation. @param currentCluster @param currentStoreDefs @param finalCluster @param finalStoreDefs @return pretty-printed string documenting invalid metadata rates for each zone.
[ "Compares", "current", "cluster", "with", "final", "cluster", ".", "Uses", "pertinent", "store", "defs", "for", "each", "cluster", "to", "determine", "if", "a", "node", "that", "hosts", "a", "zone", "-", "primary", "in", "the", "current", "cluster", "will", ...
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/PartitionBalanceUtils.java#L320-L369
OpenLiberty/open-liberty
dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/AnnotatedEndpoint.java
AnnotatedEndpoint.setMaxMessageSize
private void setMaxMessageSize(Method method, EndpointMethodHelper endpointMethodHelper) { OnMessage onMsgAnnotation = method.getAnnotation(OnMessage.class); Long maxMessageSize = onMsgAnnotation.maxMessageSize(); // maxMessageSize is -1 if it is not defined. if (maxMessageSize < -1) { // user has put in an invalid value, so change it to undefined. maxMessageSize = Constants.ANNOTATED_UNDEFINED_MAX_MSG_SIZE; } endpointMethodHelper.getMethodData().setMaxMessageSize(maxMessageSize); if (tc.isDebugEnabled()) { Tr.debug(tc, "setMaxMessageSize: maxMessageSize from annotation: " + maxMessageSize); } }
java
private void setMaxMessageSize(Method method, EndpointMethodHelper endpointMethodHelper) { OnMessage onMsgAnnotation = method.getAnnotation(OnMessage.class); Long maxMessageSize = onMsgAnnotation.maxMessageSize(); // maxMessageSize is -1 if it is not defined. if (maxMessageSize < -1) { // user has put in an invalid value, so change it to undefined. maxMessageSize = Constants.ANNOTATED_UNDEFINED_MAX_MSG_SIZE; } endpointMethodHelper.getMethodData().setMaxMessageSize(maxMessageSize); if (tc.isDebugEnabled()) { Tr.debug(tc, "setMaxMessageSize: maxMessageSize from annotation: " + maxMessageSize); } }
[ "private", "void", "setMaxMessageSize", "(", "Method", "method", ",", "EndpointMethodHelper", "endpointMethodHelper", ")", "{", "OnMessage", "onMsgAnnotation", "=", "method", ".", "getAnnotation", "(", "OnMessage", ".", "class", ")", ";", "Long", "maxMessageSize", "...
/* maxMessageSize attribute in @OnMessage: Specifies the maximum size of message in bytes that the method this annotates will be able to process, or -1 to indicate that there is no maximum defined, and therefore it is undefined which means unlimited.
[ "/", "*", "maxMessageSize", "attribute", "in" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/AnnotatedEndpoint.java#L1170-L1183
Netflix/eureka
eureka-client/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java
EndpointUtils.getZoneBasedDiscoveryUrlsFromRegion
public static Map<String, List<String>> getZoneBasedDiscoveryUrlsFromRegion(EurekaClientConfig clientConfig, String region) { String discoveryDnsName = null; try { discoveryDnsName = "txt." + region + "." + clientConfig.getEurekaServerDNSName(); logger.debug("The region url to be looked up is {} :", discoveryDnsName); Set<String> zoneCnamesForRegion = new TreeSet<String>(DnsResolver.getCNamesFromTxtRecord(discoveryDnsName)); Map<String, List<String>> zoneCnameMapForRegion = new TreeMap<String, List<String>>(); for (String zoneCname : zoneCnamesForRegion) { String zone = null; if (isEC2Url(zoneCname)) { throw new RuntimeException( "Cannot find the right DNS entry for " + discoveryDnsName + ". " + "Expected mapping of the format <aws_zone>.<domain_name>"); } else { String[] cnameTokens = zoneCname.split("\\."); zone = cnameTokens[0]; logger.debug("The zoneName mapped to region {} is {}", region, zone); } List<String> zoneCnamesSet = zoneCnameMapForRegion.get(zone); if (zoneCnamesSet == null) { zoneCnamesSet = new ArrayList<String>(); zoneCnameMapForRegion.put(zone, zoneCnamesSet); } zoneCnamesSet.add(zoneCname); } return zoneCnameMapForRegion; } catch (Throwable e) { throw new RuntimeException("Cannot get cnames bound to the region:" + discoveryDnsName, e); } }
java
public static Map<String, List<String>> getZoneBasedDiscoveryUrlsFromRegion(EurekaClientConfig clientConfig, String region) { String discoveryDnsName = null; try { discoveryDnsName = "txt." + region + "." + clientConfig.getEurekaServerDNSName(); logger.debug("The region url to be looked up is {} :", discoveryDnsName); Set<String> zoneCnamesForRegion = new TreeSet<String>(DnsResolver.getCNamesFromTxtRecord(discoveryDnsName)); Map<String, List<String>> zoneCnameMapForRegion = new TreeMap<String, List<String>>(); for (String zoneCname : zoneCnamesForRegion) { String zone = null; if (isEC2Url(zoneCname)) { throw new RuntimeException( "Cannot find the right DNS entry for " + discoveryDnsName + ". " + "Expected mapping of the format <aws_zone>.<domain_name>"); } else { String[] cnameTokens = zoneCname.split("\\."); zone = cnameTokens[0]; logger.debug("The zoneName mapped to region {} is {}", region, zone); } List<String> zoneCnamesSet = zoneCnameMapForRegion.get(zone); if (zoneCnamesSet == null) { zoneCnamesSet = new ArrayList<String>(); zoneCnameMapForRegion.put(zone, zoneCnamesSet); } zoneCnamesSet.add(zoneCname); } return zoneCnameMapForRegion; } catch (Throwable e) { throw new RuntimeException("Cannot get cnames bound to the region:" + discoveryDnsName, e); } }
[ "public", "static", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "getZoneBasedDiscoveryUrlsFromRegion", "(", "EurekaClientConfig", "clientConfig", ",", "String", "region", ")", "{", "String", "discoveryDnsName", "=", "null", ";", "try", "{", "disc...
Get the zone based CNAMES that are bound to a region. @param region - The region for which the zone names need to be retrieved @return - The list of CNAMES from which the zone-related information can be retrieved
[ "Get", "the", "zone", "based", "CNAMES", "that", "are", "bound", "to", "a", "region", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-client/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java#L317-L349
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.toLineString
public LineString toLineString(Polyline polyline, boolean hasZ, boolean hasM) { return toLineString(polyline.getPoints(), hasZ, hasM); }
java
public LineString toLineString(Polyline polyline, boolean hasZ, boolean hasM) { return toLineString(polyline.getPoints(), hasZ, hasM); }
[ "public", "LineString", "toLineString", "(", "Polyline", "polyline", ",", "boolean", "hasZ", ",", "boolean", "hasM", ")", "{", "return", "toLineString", "(", "polyline", ".", "getPoints", "(", ")", ",", "hasZ", ",", "hasM", ")", ";", "}" ]
Convert a {@link Polyline} to a {@link LineString} @param polyline polyline @param hasZ has z flag @param hasM has m flag @return line string
[ "Convert", "a", "{", "@link", "Polyline", "}", "to", "a", "{", "@link", "LineString", "}" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L302-L304
qspin/qtaste
kernel/src/main/java/com/qspin/qtaste/toolbox/simulators/SimulatorImpl.java
SimulatorImpl.logAndThrowException
private static void logAndThrowException(String message, PyException e) throws Exception { LOGGER.error(message, e); throw new Exception(message + ":\n" + PythonHelper.getMessage(e)); }
java
private static void logAndThrowException(String message, PyException e) throws Exception { LOGGER.error(message, e); throw new Exception(message + ":\n" + PythonHelper.getMessage(e)); }
[ "private", "static", "void", "logAndThrowException", "(", "String", "message", ",", "PyException", "e", ")", "throws", "Exception", "{", "LOGGER", ".", "error", "(", "message", ",", "e", ")", ";", "throw", "new", "Exception", "(", "message", "+", "\":\\n\"",...
Logs message and exception and throws Exception. @param message message @param e PyException @throws java.lang.Exception Exception built with 'message + ":\n" + message_of_e'
[ "Logs", "message", "and", "exception", "and", "throws", "Exception", "." ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/toolbox/simulators/SimulatorImpl.java#L281-L284
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/table/RtfBorderGroup.java
RtfBorderGroup.setBorder
private void setBorder(int borderPosition, int borderStyle, float borderWidth, Color borderColor) { RtfBorder border = new RtfBorder(this.document, this.borderType, borderPosition, borderStyle, borderWidth, borderColor); this.borders.put(Integer.valueOf(borderPosition), border); }
java
private void setBorder(int borderPosition, int borderStyle, float borderWidth, Color borderColor) { RtfBorder border = new RtfBorder(this.document, this.borderType, borderPosition, borderStyle, borderWidth, borderColor); this.borders.put(Integer.valueOf(borderPosition), border); }
[ "private", "void", "setBorder", "(", "int", "borderPosition", ",", "int", "borderStyle", ",", "float", "borderWidth", ",", "Color", "borderColor", ")", "{", "RtfBorder", "border", "=", "new", "RtfBorder", "(", "this", ".", "document", ",", "this", ".", "bord...
Sets a border in the Hashtable of borders @param borderPosition The position of this RtfBorder @param borderStyle The type of borders this RtfBorderGroup contains @param borderWidth The border width to use @param borderColor The border color to use
[ "Sets", "a", "border", "in", "the", "Hashtable", "of", "borders" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/table/RtfBorderGroup.java#L149-L152
h2oai/h2o-3
h2o-algos/src/main/java/hex/deeplearning/DeepLearningTask.java
DeepLearningTask.bpropMiniBatch
static public void bpropMiniBatch(Neurons[] neurons, int n) { neurons[neurons.length - 1].bpropOutputLayer(n); for (int i = neurons.length - 2; i > 0; --i) neurons[i].bprop(n); for (int mb=0;mb<n;++mb) { // all errors are reset to 0 for (int i = 0; i<neurons.length ;++i) { Storage.DenseVector e = neurons[i]._e == null ? null : neurons[i]._e[mb]; if (e==null) continue; Arrays.fill(e.raw(), 0); } } }
java
static public void bpropMiniBatch(Neurons[] neurons, int n) { neurons[neurons.length - 1].bpropOutputLayer(n); for (int i = neurons.length - 2; i > 0; --i) neurons[i].bprop(n); for (int mb=0;mb<n;++mb) { // all errors are reset to 0 for (int i = 0; i<neurons.length ;++i) { Storage.DenseVector e = neurons[i]._e == null ? null : neurons[i]._e[mb]; if (e==null) continue; Arrays.fill(e.raw(), 0); } } }
[ "static", "public", "void", "bpropMiniBatch", "(", "Neurons", "[", "]", "neurons", ",", "int", "n", ")", "{", "neurons", "[", "neurons", ".", "length", "-", "1", "]", ".", "bpropOutputLayer", "(", "n", ")", ";", "for", "(", "int", "i", "=", "neurons"...
Helper to apply back-propagation without clearing out the gradients afterwards Used for gradient checking @param neurons @param n number of trained examples in this last mini batch (usually == mini_batch_size, but can be less)
[ "Helper", "to", "apply", "back", "-", "propagation", "without", "clearing", "out", "the", "gradients", "afterwards", "Used", "for", "gradient", "checking" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/deeplearning/DeepLearningTask.java#L135-L148
classgraph/classgraph
src/main/java/io/github/classgraph/ClassInfo.java
ClassInfo.addSuperclass
void addSuperclass(final String superclassName, final Map<String, ClassInfo> classNameToClassInfo) { if (superclassName != null && !superclassName.equals("java.lang.Object")) { final ClassInfo superclassClassInfo = getOrCreateClassInfo(superclassName, /* classModifiers = */ 0, classNameToClassInfo); this.addRelatedClass(RelType.SUPERCLASSES, superclassClassInfo); superclassClassInfo.addRelatedClass(RelType.SUBCLASSES, this); } }
java
void addSuperclass(final String superclassName, final Map<String, ClassInfo> classNameToClassInfo) { if (superclassName != null && !superclassName.equals("java.lang.Object")) { final ClassInfo superclassClassInfo = getOrCreateClassInfo(superclassName, /* classModifiers = */ 0, classNameToClassInfo); this.addRelatedClass(RelType.SUPERCLASSES, superclassClassInfo); superclassClassInfo.addRelatedClass(RelType.SUBCLASSES, this); } }
[ "void", "addSuperclass", "(", "final", "String", "superclassName", ",", "final", "Map", "<", "String", ",", "ClassInfo", ">", "classNameToClassInfo", ")", "{", "if", "(", "superclassName", "!=", "null", "&&", "!", "superclassName", ".", "equals", "(", "\"java....
Add a superclass to this class. @param superclassName the superclass name @param classNameToClassInfo the map from class name to class info
[ "Add", "a", "superclass", "to", "this", "class", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClassInfo.java#L366-L373
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/vod/VodClient.java
VodClient.getMediaSourceDownload
public GetMediaSourceDownloadResponse getMediaSourceDownload(String mediaId, long expiredInSeconds) { GetMediaSourceDownloadRequest request = new GetMediaSourceDownloadRequest() .withMediaId(mediaId) .withExpiredInSeconds(expiredInSeconds); return getMediaSourceDownload(request); }
java
public GetMediaSourceDownloadResponse getMediaSourceDownload(String mediaId, long expiredInSeconds) { GetMediaSourceDownloadRequest request = new GetMediaSourceDownloadRequest() .withMediaId(mediaId) .withExpiredInSeconds(expiredInSeconds); return getMediaSourceDownload(request); }
[ "public", "GetMediaSourceDownloadResponse", "getMediaSourceDownload", "(", "String", "mediaId", ",", "long", "expiredInSeconds", ")", "{", "GetMediaSourceDownloadRequest", "request", "=", "new", "GetMediaSourceDownloadRequest", "(", ")", ".", "withMediaId", "(", "mediaId", ...
get media source download url. @param mediaId The unique ID for each media resource @param expiredInSeconds The expire time @return
[ "get", "media", "source", "download", "url", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L905-L910
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbCompanies.java
TmdbCompanies.getCompanyMovies
public ResultList<MovieBasic> getCompanyMovies(int companyId, String language, Integer page) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, companyId); parameters.add(Param.LANGUAGE, language); parameters.add(Param.PAGE, page); URL url = new ApiUrl(apiKey, MethodBase.COMPANY).subMethod(MethodSub.MOVIES).buildUrl(parameters); String webpage = httpTools.getRequest(url); WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, webpage); return wrapper.getResultsList(); }
java
public ResultList<MovieBasic> getCompanyMovies(int companyId, String language, Integer page) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, companyId); parameters.add(Param.LANGUAGE, language); parameters.add(Param.PAGE, page); URL url = new ApiUrl(apiKey, MethodBase.COMPANY).subMethod(MethodSub.MOVIES).buildUrl(parameters); String webpage = httpTools.getRequest(url); WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, webpage); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "MovieBasic", ">", "getCompanyMovies", "(", "int", "companyId", ",", "String", "language", ",", "Integer", "page", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "...
This method is used to retrieve the movies associated with a company. These movies are returned in order of most recently released to oldest. The default response will return 20 movies per page. @param companyId @param language @param page @return @throws MovieDbException
[ "This", "method", "is", "used", "to", "retrieve", "the", "movies", "associated", "with", "a", "company", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbCompanies.java#L86-L96