repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
johnkil/Android-AppMsg
library/src/com/devspark/appmsg/AppMsg.java
AppMsg.makeText
public static AppMsg makeText(Activity context, CharSequence text, Style style, int layoutId) { LayoutInflater inflate = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflate.inflate(layoutId, null); return makeText(context, text, style, v, true); }
java
public static AppMsg makeText(Activity context, CharSequence text, Style style, int layoutId) { LayoutInflater inflate = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflate.inflate(layoutId, null); return makeText(context, text, style, v, true); }
[ "public", "static", "AppMsg", "makeText", "(", "Activity", "context", ",", "CharSequence", "text", ",", "Style", "style", ",", "int", "layoutId", ")", "{", "LayoutInflater", "inflate", "=", "(", "LayoutInflater", ")", "context", ".", "getSystemService", "(", "...
Make a {@link AppMsg} with a custom layout. The layout must have a {@link TextView} com id {@link android.R.id.message} @param context The context to use. Usually your {@link android.app.Activity} object. @param text The text to show. Can be formatted text. @param style The style with a background and a duration.
[ "Make", "a", "{", "@link", "AppMsg", "}", "with", "a", "custom", "layout", ".", "The", "layout", "must", "have", "a", "{", "@link", "TextView", "}", "com", "id", "{", "@link", "android", ".", "R", ".", "id", ".", "message", "}" ]
train
https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L184-L190
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/factory/transform/wavelet/FactoryWaveletTransform.java
FactoryWaveletTransform.create_F32
public static WaveletTransform<GrayF32, GrayF32,WlCoef_F32> create_F32( WaveletDescription<WlCoef_F32> waveletDesc , int numLevels, float minPixelValue , float maxPixelValue ) { return new WaveletTransformFloat32(waveletDesc,numLevels,minPixelValue,maxPixelValue); }
java
public static WaveletTransform<GrayF32, GrayF32,WlCoef_F32> create_F32( WaveletDescription<WlCoef_F32> waveletDesc , int numLevels, float minPixelValue , float maxPixelValue ) { return new WaveletTransformFloat32(waveletDesc,numLevels,minPixelValue,maxPixelValue); }
[ "public", "static", "WaveletTransform", "<", "GrayF32", ",", "GrayF32", ",", "WlCoef_F32", ">", "create_F32", "(", "WaveletDescription", "<", "WlCoef_F32", ">", "waveletDesc", ",", "int", "numLevels", ",", "float", "minPixelValue", ",", "float", "maxPixelValue", "...
Creates a wavelet transform for images that are of type {@link GrayF32}. @param waveletDesc Description of the wavelet. @param numLevels Number of levels in the multi-level transform. @param minPixelValue Minimum pixel intensity value @param maxPixelValue Maximum pixel intensity value @return The transform class.
[ "Creates", "a", "wavelet", "transform", "for", "images", "that", "are", "of", "type", "{", "@link", "GrayF32", "}", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/transform/wavelet/FactoryWaveletTransform.java#L86-L92
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java
BytecodeUtils.offsetOf65KUtf8Bytes
private static int offsetOf65KUtf8Bytes(String str, int startIndex, int endIndex) { // This implementation is based off of Utf8.encodedLength int utf8Length = 0; int i = startIndex; for (; i < endIndex; i++) { char c = str.charAt(i); utf8Length++; if (c < 0x800) { utf8Length += (0x7f - c) >>> 31; // branch free! } else { utf8Length += Character.isSurrogate(c) ? 1 : 2; } if (utf8Length == MAX_CONSTANT_STRING_LENGTH) { return i + 1; } else if (utf8Length > MAX_CONSTANT_STRING_LENGTH) { return i; } } return endIndex; }
java
private static int offsetOf65KUtf8Bytes(String str, int startIndex, int endIndex) { // This implementation is based off of Utf8.encodedLength int utf8Length = 0; int i = startIndex; for (; i < endIndex; i++) { char c = str.charAt(i); utf8Length++; if (c < 0x800) { utf8Length += (0x7f - c) >>> 31; // branch free! } else { utf8Length += Character.isSurrogate(c) ? 1 : 2; } if (utf8Length == MAX_CONSTANT_STRING_LENGTH) { return i + 1; } else if (utf8Length > MAX_CONSTANT_STRING_LENGTH) { return i; } } return endIndex; }
[ "private", "static", "int", "offsetOf65KUtf8Bytes", "(", "String", "str", ",", "int", "startIndex", ",", "int", "endIndex", ")", "{", "// This implementation is based off of Utf8.encodedLength", "int", "utf8Length", "=", "0", ";", "int", "i", "=", "startIndex", ";",...
Returns the largest index between {@code startIndex} and {@code endIdex} such that the UTF8 encoded bytes of {@code str.substring(startIndex, returnValue}} is less than or equal to 65K.
[ "Returns", "the", "largest", "index", "between", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java#L333-L352
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java
ServiceBuilder.withContainerManager
public ServiceBuilder withContainerManager(Function<ComponentSetup, SegmentContainerManager> segmentContainerManagerCreator) { Preconditions.checkNotNull(segmentContainerManagerCreator, "segmentContainerManagerCreator"); this.segmentContainerManagerCreator = segmentContainerManagerCreator; return this; }
java
public ServiceBuilder withContainerManager(Function<ComponentSetup, SegmentContainerManager> segmentContainerManagerCreator) { Preconditions.checkNotNull(segmentContainerManagerCreator, "segmentContainerManagerCreator"); this.segmentContainerManagerCreator = segmentContainerManagerCreator; return this; }
[ "public", "ServiceBuilder", "withContainerManager", "(", "Function", "<", "ComponentSetup", ",", "SegmentContainerManager", ">", "segmentContainerManagerCreator", ")", "{", "Preconditions", ".", "checkNotNull", "(", "segmentContainerManagerCreator", ",", "\"segmentContainerMana...
Attaches the given SegmentContainerManager creator to this ServiceBuilder. The given Function will only not be invoked right away; it will be called when needed. @param segmentContainerManagerCreator The Function to attach. @return This ServiceBuilder.
[ "Attaches", "the", "given", "SegmentContainerManager", "creator", "to", "this", "ServiceBuilder", ".", "The", "given", "Function", "will", "only", "not", "be", "invoked", "right", "away", ";", "it", "will", "be", "called", "when", "needed", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java#L196-L200
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java
ClusterJoinManager.executeJoinRequest
private void executeJoinRequest(JoinRequest joinRequest, Connection connection) { clusterServiceLock.lock(); try { if (checkJoinRequest(joinRequest, connection)) { return; } if (!authenticate(joinRequest)) { return; } if (!validateJoinRequest(joinRequest, joinRequest.getAddress())) { return; } startJoinRequest(joinRequest.toMemberInfo()); } finally { clusterServiceLock.unlock(); } }
java
private void executeJoinRequest(JoinRequest joinRequest, Connection connection) { clusterServiceLock.lock(); try { if (checkJoinRequest(joinRequest, connection)) { return; } if (!authenticate(joinRequest)) { return; } if (!validateJoinRequest(joinRequest, joinRequest.getAddress())) { return; } startJoinRequest(joinRequest.toMemberInfo()); } finally { clusterServiceLock.unlock(); } }
[ "private", "void", "executeJoinRequest", "(", "JoinRequest", "joinRequest", ",", "Connection", "connection", ")", "{", "clusterServiceLock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "checkJoinRequest", "(", "joinRequest", ",", "connection", ")", ")", ...
Executed by a master node to process the {@link JoinRequest} sent by a node attempting to join the cluster. @param joinRequest the join request from a node attempting to join @param connection the connection of this node to the joining node
[ "Executed", "by", "a", "master", "node", "to", "process", "the", "{", "@link", "JoinRequest", "}", "sent", "by", "a", "node", "attempting", "to", "join", "the", "cluster", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java#L248-L267
EXIficient/exificient
src/main/java/com/siemens/ct/exi/main/api/stream/StAXEncoder.java
StAXEncoder.writeCharacters
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException { this.writeCharacters(new String(text, start, len)); }
java
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException { this.writeCharacters(new String(text, start, len)); }
[ "public", "void", "writeCharacters", "(", "char", "[", "]", "text", ",", "int", "start", ",", "int", "len", ")", "throws", "XMLStreamException", "{", "this", ".", "writeCharacters", "(", "new", "String", "(", "text", ",", "start", ",", "len", ")", ")", ...
/* Write text to the output (non-Javadoc) @see javax.xml.stream.XMLStreamWriter#writeCharacters(char[], int, int)
[ "/", "*", "Write", "text", "to", "the", "output" ]
train
https://github.com/EXIficient/exificient/blob/93c7c0d63d74cfccf6ab1d5041b203745ef9ddb8/src/main/java/com/siemens/ct/exi/main/api/stream/StAXEncoder.java#L350-L353
apache/flink
flink-table/flink-table-common/src/main/java/org/apache/flink/table/expressions/ExpressionUtils.java
ExpressionUtils.isFunctionOfType
public static boolean isFunctionOfType(Expression expr, FunctionDefinition.Type type) { return expr instanceof CallExpression && ((CallExpression) expr).getFunctionDefinition().getType() == type; }
java
public static boolean isFunctionOfType(Expression expr, FunctionDefinition.Type type) { return expr instanceof CallExpression && ((CallExpression) expr).getFunctionDefinition().getType() == type; }
[ "public", "static", "boolean", "isFunctionOfType", "(", "Expression", "expr", ",", "FunctionDefinition", ".", "Type", "type", ")", "{", "return", "expr", "instanceof", "CallExpression", "&&", "(", "(", "CallExpression", ")", "expr", ")", ".", "getFunctionDefinitio...
Checks if the expression is a function call of given type. @param expr expression to check @param type expected type of function @return true if the expression is function call of given type, false otherwise
[ "Checks", "if", "the", "expression", "is", "a", "function", "call", "of", "given", "type", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/expressions/ExpressionUtils.java#L58-L61
tipsy/javalin
src/main/java/io/javalin/Javalin.java
Javalin.addHandler
public Javalin addHandler(@NotNull HandlerType handlerType, @NotNull String path, @NotNull Handler handler, @NotNull Set<Role> roles) { servlet.addHandler(handlerType, path, handler, roles); eventManager.fireHandlerAddedEvent(new HandlerMetaInfo(handlerType, Util.prefixContextPath(servlet.getConfig().contextPath, path), handler, roles)); return this; }
java
public Javalin addHandler(@NotNull HandlerType handlerType, @NotNull String path, @NotNull Handler handler, @NotNull Set<Role> roles) { servlet.addHandler(handlerType, path, handler, roles); eventManager.fireHandlerAddedEvent(new HandlerMetaInfo(handlerType, Util.prefixContextPath(servlet.getConfig().contextPath, path), handler, roles)); return this; }
[ "public", "Javalin", "addHandler", "(", "@", "NotNull", "HandlerType", "handlerType", ",", "@", "NotNull", "String", "path", ",", "@", "NotNull", "Handler", "handler", ",", "@", "NotNull", "Set", "<", "Role", ">", "roles", ")", "{", "servlet", ".", "addHan...
Adds a request handler for the specified handlerType and path to the instance. Requires an access manager to be set on the instance. This is the method that all the verb-methods (get/post/put/etc) call. @see AccessManager @see <a href="https://javalin.io/documentation#handlers">Handlers in docs</a>
[ "Adds", "a", "request", "handler", "for", "the", "specified", "handlerType", "and", "path", "to", "the", "instance", ".", "Requires", "an", "access", "manager", "to", "be", "set", "on", "the", "instance", ".", "This", "is", "the", "method", "that", "all", ...
train
https://github.com/tipsy/javalin/blob/68b2f7592f237db1c2b597e645697eb75fdaee53/src/main/java/io/javalin/Javalin.java#L268-L272
mapcode-foundation/mapcode-java
src/main/java/com/mapcode/MapcodeCodec.java
MapcodeCodec.encodeToInternational
@Nonnull public static Mapcode encodeToInternational(final double latDeg, final double lonDeg) throws IllegalArgumentException { // Call mapcode encoder. @Nonnull final List<Mapcode> results = encode(latDeg, lonDeg, Territory.AAA); assert results != null; assert results.size() >= 1; return results.get(results.size() - 1); }
java
@Nonnull public static Mapcode encodeToInternational(final double latDeg, final double lonDeg) throws IllegalArgumentException { // Call mapcode encoder. @Nonnull final List<Mapcode> results = encode(latDeg, lonDeg, Territory.AAA); assert results != null; assert results.size() >= 1; return results.get(results.size() - 1); }
[ "@", "Nonnull", "public", "static", "Mapcode", "encodeToInternational", "(", "final", "double", "latDeg", ",", "final", "double", "lonDeg", ")", "throws", "IllegalArgumentException", "{", "// Call mapcode encoder.", "@", "Nonnull", "final", "List", "<", "Mapcode", "...
Encode a lat/lon pair to its unambiguous, international mapcode. @param latDeg Latitude, accepted range: -90..90. @param lonDeg Longitude, accepted range: -180..180. @return International unambiguous mapcode (always exists), see {@link Mapcode}. @throws IllegalArgumentException Thrown if latitude or longitude are out of range.
[ "Encode", "a", "lat", "/", "lon", "pair", "to", "its", "unambiguous", "international", "mapcode", "." ]
train
https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/MapcodeCodec.java#L266-L275
zamrokk/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/helper/SDKUtil.java
SDKUtil.generateTarGz
public static void generateTarGz(String src, String target) throws IOException { File sourceDirectory = new File(src); File destinationArchive = new File(target); String sourcePath = sourceDirectory.getAbsolutePath(); FileOutputStream destinationOutputStream = new FileOutputStream(destinationArchive); TarArchiveOutputStream archiveOutputStream = new TarArchiveOutputStream(new GzipCompressorOutputStream(new BufferedOutputStream(destinationOutputStream))); archiveOutputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); try { Collection<File> childrenFiles = org.apache.commons.io.FileUtils.listFiles(sourceDirectory, null, true); childrenFiles.remove(destinationArchive); ArchiveEntry archiveEntry; FileInputStream fileInputStream; for (File childFile : childrenFiles) { String childPath = childFile.getAbsolutePath(); String relativePath = childPath.substring((sourcePath.length() + 1), childPath.length()); relativePath = FilenameUtils.separatorsToUnix(relativePath); archiveEntry = new TarArchiveEntry(childFile, relativePath); fileInputStream = new FileInputStream(childFile); archiveOutputStream.putArchiveEntry(archiveEntry); try { IOUtils.copy(fileInputStream, archiveOutputStream); } finally { IOUtils.closeQuietly(fileInputStream); archiveOutputStream.closeArchiveEntry(); } } } finally { IOUtils.closeQuietly(archiveOutputStream); } }
java
public static void generateTarGz(String src, String target) throws IOException { File sourceDirectory = new File(src); File destinationArchive = new File(target); String sourcePath = sourceDirectory.getAbsolutePath(); FileOutputStream destinationOutputStream = new FileOutputStream(destinationArchive); TarArchiveOutputStream archiveOutputStream = new TarArchiveOutputStream(new GzipCompressorOutputStream(new BufferedOutputStream(destinationOutputStream))); archiveOutputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); try { Collection<File> childrenFiles = org.apache.commons.io.FileUtils.listFiles(sourceDirectory, null, true); childrenFiles.remove(destinationArchive); ArchiveEntry archiveEntry; FileInputStream fileInputStream; for (File childFile : childrenFiles) { String childPath = childFile.getAbsolutePath(); String relativePath = childPath.substring((sourcePath.length() + 1), childPath.length()); relativePath = FilenameUtils.separatorsToUnix(relativePath); archiveEntry = new TarArchiveEntry(childFile, relativePath); fileInputStream = new FileInputStream(childFile); archiveOutputStream.putArchiveEntry(archiveEntry); try { IOUtils.copy(fileInputStream, archiveOutputStream); } finally { IOUtils.closeQuietly(fileInputStream); archiveOutputStream.closeArchiveEntry(); } } } finally { IOUtils.closeQuietly(archiveOutputStream); } }
[ "public", "static", "void", "generateTarGz", "(", "String", "src", ",", "String", "target", ")", "throws", "IOException", "{", "File", "sourceDirectory", "=", "new", "File", "(", "src", ")", ";", "File", "destinationArchive", "=", "new", "File", "(", "target...
Compress the given directory src to target tar.gz file @param src The source directory @param target The target tar.gz file @throws IOException
[ "Compress", "the", "given", "directory", "src", "to", "target", "tar", ".", "gz", "file" ]
train
https://github.com/zamrokk/fabric-sdk-java/blob/d4993ca602f72d412cd682e1b92e805e48b27afa/src/main/java/org/hyperledger/fabric/sdk/helper/SDKUtil.java#L124-L159
finmath/finmath-lib
src/main/java6/net/finmath/montecarlo/interestrate/TermStructureModelMonteCarloSimulation.java
TermStructureModelMonteCarloSimulation.getCloneWithModifiedData
public TermStructureModelMonteCarloSimulationInterface getCloneWithModifiedData(String entityKey, Object dataModified) throws CalculationException { Map<String, Object> dataModifiedMap = new HashMap<String, Object>(); dataModifiedMap.put(entityKey, dataModified); return getCloneWithModifiedData(dataModifiedMap); }
java
public TermStructureModelMonteCarloSimulationInterface getCloneWithModifiedData(String entityKey, Object dataModified) throws CalculationException { Map<String, Object> dataModifiedMap = new HashMap<String, Object>(); dataModifiedMap.put(entityKey, dataModified); return getCloneWithModifiedData(dataModifiedMap); }
[ "public", "TermStructureModelMonteCarloSimulationInterface", "getCloneWithModifiedData", "(", "String", "entityKey", ",", "Object", "dataModified", ")", "throws", "CalculationException", "{", "Map", "<", "String", ",", "Object", ">", "dataModifiedMap", "=", "new", "HashMa...
Create a clone of this simulation modifying one of its properties (if any). @param entityKey The entity to modify. @param dataModified The data which should be changed in the new model @return Returns a clone of this model, where the specified part of the data is modified data (then it is no longer a clone :-) @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
[ "Create", "a", "clone", "of", "this", "simulation", "modifying", "one", "of", "its", "properties", "(", "if", "any", ")", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/TermStructureModelMonteCarloSimulation.java#L186-L191
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterClient.java
RouterClient.previewRouter
@BetaApi public final RoutersPreviewResponse previewRouter(String router, Router routerResource) { PreviewRouterHttpRequest request = PreviewRouterHttpRequest.newBuilder() .setRouter(router) .setRouterResource(routerResource) .build(); return previewRouter(request); }
java
@BetaApi public final RoutersPreviewResponse previewRouter(String router, Router routerResource) { PreviewRouterHttpRequest request = PreviewRouterHttpRequest.newBuilder() .setRouter(router) .setRouterResource(routerResource) .build(); return previewRouter(request); }
[ "@", "BetaApi", "public", "final", "RoutersPreviewResponse", "previewRouter", "(", "String", "router", ",", "Router", "routerResource", ")", "{", "PreviewRouterHttpRequest", "request", "=", "PreviewRouterHttpRequest", ".", "newBuilder", "(", ")", ".", "setRouter", "("...
Preview fields auto-generated during router create and update operations. Calling this method does NOT create or update the router. <p>Sample code: <pre><code> try (RouterClient routerClient = RouterClient.create()) { ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); Router routerResource = Router.newBuilder().build(); RoutersPreviewResponse response = routerClient.previewRouter(router.toString(), routerResource); } </code></pre> @param router Name of the Router resource to query. @param routerResource Router resource. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Preview", "fields", "auto", "-", "generated", "during", "router", "create", "and", "update", "operations", ".", "Calling", "this", "method", "does", "NOT", "create", "or", "update", "the", "router", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterClient.java#L1156-L1165
cdk/cdk
base/core/src/main/java/org/openscience/cdk/graph/RegularPathGraph.java
RegularPathGraph.combine
private List<PathEdge> combine(final List<PathEdge> edges, final int x) { final int n = edges.size(); final List<PathEdge> reduced = new ArrayList<PathEdge>(n); for (int i = 0; i < n; i++) { PathEdge e = edges.get(i); for (int j = i + 1; j < n; j++) { PathEdge f = edges.get(j); if (e.disjoint(f)) reduced.add(new ReducedEdge(e, f, x)); } } return reduced; }
java
private List<PathEdge> combine(final List<PathEdge> edges, final int x) { final int n = edges.size(); final List<PathEdge> reduced = new ArrayList<PathEdge>(n); for (int i = 0; i < n; i++) { PathEdge e = edges.get(i); for (int j = i + 1; j < n; j++) { PathEdge f = edges.get(j); if (e.disjoint(f)) reduced.add(new ReducedEdge(e, f, x)); } } return reduced; }
[ "private", "List", "<", "PathEdge", ">", "combine", "(", "final", "List", "<", "PathEdge", ">", "edges", ",", "final", "int", "x", ")", "{", "final", "int", "n", "=", "edges", ".", "size", "(", ")", ";", "final", "List", "<", "PathEdge", ">", "redu...
Pairwise combination of all disjoint <i>edges</i> incident to a vertex <i>x</i>. @param edges edges which are currently incident to <i>x</i> @param x a vertex in the graph @return reduced edges
[ "Pairwise", "combination", "of", "all", "disjoint", "<i", ">", "edges<", "/", "i", ">", "incident", "to", "a", "vertex", "<i", ">", "x<", "/", "i", ">", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/graph/RegularPathGraph.java#L146-L160
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/metadata/statistics/SampledHistogramBuilder.java
SampledHistogramBuilder.newMaxDiffAreaHistogram
public Histogram newMaxDiffAreaHistogram(int numBkts) { Map<String, BucketBuilder> initBbs = new HashMap<String, BucketBuilder>(); for (String fld : schema.fields()) { initBbs.put(fld, new MaxDiffAreaBucketBuilder(frequencies(fld), null)); } return newMaxDiffHistogram(numBkts, initBbs); }
java
public Histogram newMaxDiffAreaHistogram(int numBkts) { Map<String, BucketBuilder> initBbs = new HashMap<String, BucketBuilder>(); for (String fld : schema.fields()) { initBbs.put(fld, new MaxDiffAreaBucketBuilder(frequencies(fld), null)); } return newMaxDiffHistogram(numBkts, initBbs); }
[ "public", "Histogram", "newMaxDiffAreaHistogram", "(", "int", "numBkts", ")", "{", "Map", "<", "String", ",", "BucketBuilder", ">", "initBbs", "=", "new", "HashMap", "<", "String", ",", "BucketBuilder", ">", "(", ")", ";", "for", "(", "String", "fld", ":",...
Constructs a histogram with the "MaxDiff(V, A)" buckets for all fields. All fields must be numeric. @param numBkts the number of buckets to construct for each field @return a "MaxDiff(V, A)" histogram
[ "Constructs", "a", "histogram", "with", "the", "MaxDiff", "(", "V", "A", ")", "buckets", "for", "all", "fields", ".", "All", "fields", "must", "be", "numeric", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/statistics/SampledHistogramBuilder.java#L416-L423
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/BitFieldArgs.java
BitFieldArgs.incrBy
public BitFieldArgs incrBy(BitFieldType bitFieldType, Offset offset, long value) { LettuceAssert.notNull(offset, "BitFieldOffset must not be null"); return addSubCommand(new IncrBy(bitFieldType, offset.isMultiplyByTypeWidth(), offset.getOffset(), value)); }
java
public BitFieldArgs incrBy(BitFieldType bitFieldType, Offset offset, long value) { LettuceAssert.notNull(offset, "BitFieldOffset must not be null"); return addSubCommand(new IncrBy(bitFieldType, offset.isMultiplyByTypeWidth(), offset.getOffset(), value)); }
[ "public", "BitFieldArgs", "incrBy", "(", "BitFieldType", "bitFieldType", ",", "Offset", "offset", ",", "long", "value", ")", "{", "LettuceAssert", ".", "notNull", "(", "offset", ",", "\"BitFieldOffset must not be null\"", ")", ";", "return", "addSubCommand", "(", ...
Adds a new {@code INCRBY} subcommand. @param bitFieldType the bit field type, must not be {@literal null}. @param offset bitfield offset, must not be {@literal null}. @param value the value @return a new {@code INCRBY} subcommand for the given {@code bitFieldType}, {@code offset} and {@code value}. @since 4.3
[ "Adds", "a", "new", "{", "@code", "INCRBY", "}", "subcommand", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/BitFieldArgs.java#L380-L385
dadoonet/elasticsearch-beyonder
src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java
TemplateElasticsearchUpdater.createTemplateWithJsonInElasticsearch
@Deprecated private static void createTemplateWithJsonInElasticsearch(Client client, String template, String json) throws Exception { logger.trace("createTemplate([{}])", template); assert client != null; assert template != null; AcknowledgedResponse response = client.admin().indices() .preparePutTemplate(template) .setSource(json.getBytes(), XContentType.JSON) .get(); if (!response.isAcknowledged()) { logger.warn("Could not create template [{}]", template); throw new Exception("Could not create template ["+template+"]."); } logger.trace("/createTemplate([{}])", template); }
java
@Deprecated private static void createTemplateWithJsonInElasticsearch(Client client, String template, String json) throws Exception { logger.trace("createTemplate([{}])", template); assert client != null; assert template != null; AcknowledgedResponse response = client.admin().indices() .preparePutTemplate(template) .setSource(json.getBytes(), XContentType.JSON) .get(); if (!response.isAcknowledged()) { logger.warn("Could not create template [{}]", template); throw new Exception("Could not create template ["+template+"]."); } logger.trace("/createTemplate([{}])", template); }
[ "@", "Deprecated", "private", "static", "void", "createTemplateWithJsonInElasticsearch", "(", "Client", "client", ",", "String", "template", ",", "String", "json", ")", "throws", "Exception", "{", "logger", ".", "trace", "(", "\"createTemplate([{}])\"", ",", "templa...
Create a new index in Elasticsearch @param client Elasticsearch client @param template Template name @param json JSon content for the template @throws Exception if something goes wrong @deprecated Will be removed when we don't support TransportClient anymore
[ "Create", "a", "new", "index", "in", "Elasticsearch" ]
train
https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java#L104-L122
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/MachinetagsApi.java
MachinetagsApi.getPairs
public Pairs getPairs(String namespace, String predicate, int perPage, int page, boolean sign) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.machinetags.getPairs"); if (!JinxUtils.isNullOrEmpty(namespace)) { params.put("namespace", namespace); } if (!JinxUtils.isNullOrEmpty(predicate)) { params.put("predicate", predicate); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Pairs.class, sign); }
java
public Pairs getPairs(String namespace, String predicate, int perPage, int page, boolean sign) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.machinetags.getPairs"); if (!JinxUtils.isNullOrEmpty(namespace)) { params.put("namespace", namespace); } if (!JinxUtils.isNullOrEmpty(predicate)) { params.put("predicate", predicate); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Pairs.class, sign); }
[ "public", "Pairs", "getPairs", "(", "String", "namespace", ",", "String", "predicate", ",", "int", "perPage", ",", "int", "page", ",", "boolean", "sign", ")", "throws", "JinxException", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", ...
Return a list of unique namespace and predicate pairs, optionally limited by predicate or namespace, in alphabetical order. <br> This method does not require authentication. @param namespace (Optional) Limit the list of pairs returned to those that have this namespace. @param predicate (Optional) Limit the list of pairs returned to those that have this predicate. @param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500. @param page The page of results to return. If this argument is less than 1, it defaults to 1. @param sign if true, the request will be signed. @return object containing a list of unique namespace and predicate parts. @throws JinxException if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.machinetags.getPairs.html">flickr.machinetags.getPairs</a>
[ "Return", "a", "list", "of", "unique", "namespace", "and", "predicate", "pairs", "optionally", "limited", "by", "predicate", "or", "namespace", "in", "alphabetical", "order", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/MachinetagsApi.java#L86-L102
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/LabelsApi.java
LabelsApi.updateLabelColor
public Label updateLabelColor(Object projectIdOrPath, String name, String color, String description, Integer priority) throws GitLabApiException { return (updateLabel(projectIdOrPath, name, null, color, description, priority)); }
java
public Label updateLabelColor(Object projectIdOrPath, String name, String color, String description, Integer priority) throws GitLabApiException { return (updateLabel(projectIdOrPath, name, null, color, description, priority)); }
[ "public", "Label", "updateLabelColor", "(", "Object", "projectIdOrPath", ",", "String", "name", ",", "String", "color", ",", "String", "description", ",", "Integer", "priority", ")", "throws", "GitLabApiException", "{", "return", "(", "updateLabel", "(", "projectI...
Update the specified label @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param name the name for the label @param color the color for the label @param description the description for the label @param priority the priority for the label @return the modified Label instance @throws GitLabApiException if any exception occurs
[ "Update", "the", "specified", "label" ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/LabelsApi.java#L158-L160
lessthanoptimal/ejml
main/ejml-simple/src/org/ejml/equation/Operation.java
Operation.solve
public static Info solve( final Variable A , final Variable B , ManagerTempVariables manager) { Info ret = new Info(); final VariableMatrix output = manager.createMatrix(); ret.output = output; if( A instanceof VariableMatrix && B instanceof VariableMatrix ) { ret.op = new Operation("solve-mm") { LinearSolverDense<DMatrixRMaj> solver; @Override public void process() { DMatrixRMaj a = ((VariableMatrix)A).matrix; DMatrixRMaj b = ((VariableMatrix)B).matrix; if( solver == null ) { solver = LinearSolverFactory_DDRM.leastSquares(a.numRows,a.numCols); } if( !solver.setA(a)) throw new RuntimeException("Solver failed!"); output.matrix.reshape(a.numCols,b.numCols); solver.solve(b, output.matrix); } }; } else { throw new RuntimeException("Expected two matrices got "+A+" "+B); } return ret; }
java
public static Info solve( final Variable A , final Variable B , ManagerTempVariables manager) { Info ret = new Info(); final VariableMatrix output = manager.createMatrix(); ret.output = output; if( A instanceof VariableMatrix && B instanceof VariableMatrix ) { ret.op = new Operation("solve-mm") { LinearSolverDense<DMatrixRMaj> solver; @Override public void process() { DMatrixRMaj a = ((VariableMatrix)A).matrix; DMatrixRMaj b = ((VariableMatrix)B).matrix; if( solver == null ) { solver = LinearSolverFactory_DDRM.leastSquares(a.numRows,a.numCols); } if( !solver.setA(a)) throw new RuntimeException("Solver failed!"); output.matrix.reshape(a.numCols,b.numCols); solver.solve(b, output.matrix); } }; } else { throw new RuntimeException("Expected two matrices got "+A+" "+B); } return ret; }
[ "public", "static", "Info", "solve", "(", "final", "Variable", "A", ",", "final", "Variable", "B", ",", "ManagerTempVariables", "manager", ")", "{", "Info", "ret", "=", "new", "Info", "(", ")", ";", "final", "VariableMatrix", "output", "=", "manager", ".",...
If input is two vectors then it returns the dot product as a double.
[ "If", "input", "is", "two", "vectors", "then", "it", "returns", "the", "dot", "product", "as", "a", "double", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Operation.java#L1499-L1529
alkacon/opencms-core
src/org/opencms/staticexport/A_CmsStaticExportHandler.java
A_CmsStaticExportHandler.purgeFile
protected void purgeFile(String rfsFilePath, String vfsName) { File rfsFile = new File(rfsFilePath); // first delete the base file deleteFile(rfsFile, vfsName); // now delete the file parameter variations // get the parent folder File parent = rfsFile.getParentFile(); if (parent != null) { // list all files in the parent folder that are variations of the base file File[] paramVariants = parent.listFiles(new PrefixFileFilter(rfsFile)); if (paramVariants != null) { for (int v = 0; v < paramVariants.length; v++) { deleteFile(paramVariants[v], vfsName); } } } }
java
protected void purgeFile(String rfsFilePath, String vfsName) { File rfsFile = new File(rfsFilePath); // first delete the base file deleteFile(rfsFile, vfsName); // now delete the file parameter variations // get the parent folder File parent = rfsFile.getParentFile(); if (parent != null) { // list all files in the parent folder that are variations of the base file File[] paramVariants = parent.listFiles(new PrefixFileFilter(rfsFile)); if (paramVariants != null) { for (int v = 0; v < paramVariants.length; v++) { deleteFile(paramVariants[v], vfsName); } } } }
[ "protected", "void", "purgeFile", "(", "String", "rfsFilePath", ",", "String", "vfsName", ")", "{", "File", "rfsFile", "=", "new", "File", "(", "rfsFilePath", ")", ";", "// first delete the base file", "deleteFile", "(", "rfsFile", ",", "vfsName", ")", ";", "/...
Deletes the given file from the RFS if it exists, also deletes all parameter variations of the file.<p> @param rfsFilePath the path of the RFS file to delete @param vfsName the VFS name of the file to delete (required for logging)
[ "Deletes", "the", "given", "file", "from", "the", "RFS", "if", "it", "exists", "also", "deletes", "all", "parameter", "variations", "of", "the", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/A_CmsStaticExportHandler.java#L320-L339
h2oai/h2o-3
h2o-core/src/main/java/water/util/StringUtils.java
StringUtils.toCharacterSet
public static HashSet<Character> toCharacterSet(String src) { int n = src.length(); HashSet<Character> res = new HashSet<>(n); for (int i = 0; i < n; i++) res.add(src.charAt(i)); return res; } public static Character[] toCharacterArray(String src) { return ArrayUtils.box(src.toCharArray()); } public static int unhex(String str) { int res = 0; for (char c : str.toCharArray()) { if (!hexCode.containsKey(c)) throw new NumberFormatException("Not a hexademical character " + c); res = (res << 4) + hexCode.get(c); } return res; } public static byte[] bytesOf(CharSequence str) { return str.toString().getBytes(Charset.forName("UTF-8")); } public static byte[] toBytes(Object value) { return bytesOf(String.valueOf(value)); } public static String toString(byte[] bytes, int from, int length) { return new String(bytes, from, length, Charset.forName("UTF-8")); } }
java
public static HashSet<Character> toCharacterSet(String src) { int n = src.length(); HashSet<Character> res = new HashSet<>(n); for (int i = 0; i < n; i++) res.add(src.charAt(i)); return res; } public static Character[] toCharacterArray(String src) { return ArrayUtils.box(src.toCharArray()); } public static int unhex(String str) { int res = 0; for (char c : str.toCharArray()) { if (!hexCode.containsKey(c)) throw new NumberFormatException("Not a hexademical character " + c); res = (res << 4) + hexCode.get(c); } return res; } public static byte[] bytesOf(CharSequence str) { return str.toString().getBytes(Charset.forName("UTF-8")); } public static byte[] toBytes(Object value) { return bytesOf(String.valueOf(value)); } public static String toString(byte[] bytes, int from, int length) { return new String(bytes, from, length, Charset.forName("UTF-8")); } }
[ "public", "static", "HashSet", "<", "Character", ">", "toCharacterSet", "(", "String", "src", ")", "{", "int", "n", "=", "src", ".", "length", "(", ")", ";", "HashSet", "<", "Character", ">", "res", "=", "new", "HashSet", "<>", "(", "n", ")", ";", ...
Convert a string into the set of its characters. @param src Source string @return Set of characters within the source string
[ "Convert", "a", "string", "into", "the", "set", "of", "its", "characters", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/StringUtils.java#L172-L204
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java
AbstractRadial.create_TITLE_Image
protected BufferedImage create_TITLE_Image(final int WIDTH, final String TITLE, final String UNIT_STRING) { return create_TITLE_Image(WIDTH, TITLE, UNIT_STRING, null); }
java
protected BufferedImage create_TITLE_Image(final int WIDTH, final String TITLE, final String UNIT_STRING) { return create_TITLE_Image(WIDTH, TITLE, UNIT_STRING, null); }
[ "protected", "BufferedImage", "create_TITLE_Image", "(", "final", "int", "WIDTH", ",", "final", "String", "TITLE", ",", "final", "String", "UNIT_STRING", ")", "{", "return", "create_TITLE_Image", "(", "WIDTH", ",", "TITLE", ",", "UNIT_STRING", ",", "null", ")", ...
Returns the image with the given title and unitstring. @param WIDTH @param TITLE @param UNIT_STRING @return the image with the given title and unitstring.
[ "Returns", "the", "image", "with", "the", "given", "title", "and", "unitstring", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java#L1411-L1413
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/DefaultInternalConfiguration.java
DefaultInternalConfiguration.getSubProperties
public Properties getSubProperties(final String prefix, final boolean truncate) { String cacheKey = truncate + prefix; Properties sub = subcontextCache.get(cacheKey); if (sub != null) { // make a copy so users can't change. Properties copy = new Properties(); copy.putAll(sub); return copy; } sub = new Properties(); int length = prefix.length(); for (Map.Entry<String, Object> entry : backing.entrySet()) { String key = entry.getKey(); if (key.startsWith(prefix)) { // If we are truncating, remove the prefix String newKey = key; if (truncate) { newKey = key.substring(length); } sub.setProperty(newKey, (String) entry.getValue()); } } subcontextCache.put(cacheKey, sub); // Make a copy so users can't change. Properties copy = new Properties(); copy.putAll(sub); return copy; }
java
public Properties getSubProperties(final String prefix, final boolean truncate) { String cacheKey = truncate + prefix; Properties sub = subcontextCache.get(cacheKey); if (sub != null) { // make a copy so users can't change. Properties copy = new Properties(); copy.putAll(sub); return copy; } sub = new Properties(); int length = prefix.length(); for (Map.Entry<String, Object> entry : backing.entrySet()) { String key = entry.getKey(); if (key.startsWith(prefix)) { // If we are truncating, remove the prefix String newKey = key; if (truncate) { newKey = key.substring(length); } sub.setProperty(newKey, (String) entry.getValue()); } } subcontextCache.put(cacheKey, sub); // Make a copy so users can't change. Properties copy = new Properties(); copy.putAll(sub); return copy; }
[ "public", "Properties", "getSubProperties", "(", "final", "String", "prefix", ",", "final", "boolean", "truncate", ")", "{", "String", "cacheKey", "=", "truncate", "+", "prefix", ";", "Properties", "sub", "=", "subcontextCache", ".", "get", "(", "cacheKey", ")...
Returns a sub-set of the parameters contained in this configuration. @param prefix the prefix of the parameter keys which should be included. @param truncate if true, the prefix is truncated in the returned properties. @return the properties sub-set, may be empty.
[ "Returns", "a", "sub", "-", "set", "of", "the", "parameters", "contained", "in", "this", "configuration", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/DefaultInternalConfiguration.java#L633-L671
larsga/Duke
duke-core/src/main/java/no/priv/garshol/duke/PropertyImpl.java
PropertyImpl.compare
public double compare(String v1, String v2) { // FIXME: it should be possible here to say that, actually, we // didn't learn anything from comparing these two values, so that // probability is set to 0.5. if (comparator == null) return 0.5; // we ignore properties with no comparator // first, we call the comparator, to get a measure of how similar // these two values are. note that this is not the same as what we // are going to return, which is a probability. double sim = comparator.compare(v1, v2); // we have been configured with a high probability (for equal // values) and a low probability (for different values). given // sim, which is a measure of the similarity somewhere in between // equal and different, we now compute our estimate of the // probability. // if sim = 1.0, we return high. if sim = 0.0, we return low. for // values in between we need to compute a little. the obvious // formula to use would be (sim * (high - low)) + low, which // spreads the values out equally spaced between high and low. // however, if the similarity is higher than 0.5 we don't want to // consider this negative evidence, and so there's a threshold // there. also, users felt Duke was too eager to merge records, // and wanted probabilities to fall off faster with lower // probabilities, and so we square sim in order to achieve this. if (sim >= 0.5) return ((high - 0.5) * (sim * sim)) + 0.5; else return low; }
java
public double compare(String v1, String v2) { // FIXME: it should be possible here to say that, actually, we // didn't learn anything from comparing these two values, so that // probability is set to 0.5. if (comparator == null) return 0.5; // we ignore properties with no comparator // first, we call the comparator, to get a measure of how similar // these two values are. note that this is not the same as what we // are going to return, which is a probability. double sim = comparator.compare(v1, v2); // we have been configured with a high probability (for equal // values) and a low probability (for different values). given // sim, which is a measure of the similarity somewhere in between // equal and different, we now compute our estimate of the // probability. // if sim = 1.0, we return high. if sim = 0.0, we return low. for // values in between we need to compute a little. the obvious // formula to use would be (sim * (high - low)) + low, which // spreads the values out equally spaced between high and low. // however, if the similarity is higher than 0.5 we don't want to // consider this negative evidence, and so there's a threshold // there. also, users felt Duke was too eager to merge records, // and wanted probabilities to fall off faster with lower // probabilities, and so we square sim in order to achieve this. if (sim >= 0.5) return ((high - 0.5) * (sim * sim)) + 0.5; else return low; }
[ "public", "double", "compare", "(", "String", "v1", ",", "String", "v2", ")", "{", "// FIXME: it should be possible here to say that, actually, we", "// didn't learn anything from comparing these two values, so that", "// probability is set to 0.5.", "if", "(", "comparator", "==", ...
Returns the probability that the records v1 and v2 came from represent the same entity, based on high and low probability settings etc.
[ "Returns", "the", "probability", "that", "the", "records", "v1", "and", "v2", "came", "from", "represent", "the", "same", "entity", "based", "on", "high", "and", "low", "probability", "settings", "etc", "." ]
train
https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-core/src/main/java/no/priv/garshol/duke/PropertyImpl.java#L121-L155
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java
CurrencyHelper.getRounded
@Nonnull public static BigDecimal getRounded (@Nullable final ECurrency eCurrency, @Nonnull final BigDecimal aValue) { ValueEnforcer.notNull (aValue, "Value"); final PerCurrencySettings aPCS = getSettings (eCurrency); return aValue.setScale (aPCS.getScale (), aPCS.getRoundingMode ()); }
java
@Nonnull public static BigDecimal getRounded (@Nullable final ECurrency eCurrency, @Nonnull final BigDecimal aValue) { ValueEnforcer.notNull (aValue, "Value"); final PerCurrencySettings aPCS = getSettings (eCurrency); return aValue.setScale (aPCS.getScale (), aPCS.getRoundingMode ()); }
[ "@", "Nonnull", "public", "static", "BigDecimal", "getRounded", "(", "@", "Nullable", "final", "ECurrency", "eCurrency", ",", "@", "Nonnull", "final", "BigDecimal", "aValue", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aValue", ",", "\"Value\"", ")", ";",...
Get the passed value rounded to the appropriate number of fraction digits, based on this currencies default fraction digits.<br> The default scaling of this currency is used. @param eCurrency The currency it is about. If <code>null</code> is provided {@link #DEFAULT_CURRENCY} is used instead. @param aValue The value to be rounded. May not be <code>null</code>. @return The rounded value. Never <code>null</code>.
[ "Get", "the", "passed", "value", "rounded", "to", "the", "appropriate", "number", "of", "fraction", "digits", "based", "on", "this", "currencies", "default", "fraction", "digits", ".", "<br", ">", "The", "default", "scaling", "of", "this", "currency", "is", ...
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java#L661-L667
SnappyDataInc/snappydata
launcher/src/main/java/io/snappydata/tools/QuickLauncher.java
QuickLauncher.readStatus
private void readStatus(boolean emptyForMissing, final Path statusFile) { this.status = null; if (Files.exists(statusFile)) { // try some number of times if dsMsg is null for (int i = 1; i <= 3; i++) { this.status = Status.spinRead(baseName, statusFile); if (this.status.dsMsg != null) break; } } if (this.status == null && emptyForMissing) { this.status = Status.create(baseName, Status.SHUTDOWN, 0, statusFile); } }
java
private void readStatus(boolean emptyForMissing, final Path statusFile) { this.status = null; if (Files.exists(statusFile)) { // try some number of times if dsMsg is null for (int i = 1; i <= 3; i++) { this.status = Status.spinRead(baseName, statusFile); if (this.status.dsMsg != null) break; } } if (this.status == null && emptyForMissing) { this.status = Status.create(baseName, Status.SHUTDOWN, 0, statusFile); } }
[ "private", "void", "readStatus", "(", "boolean", "emptyForMissing", ",", "final", "Path", "statusFile", ")", "{", "this", ".", "status", "=", "null", ";", "if", "(", "Files", ".", "exists", "(", "statusFile", ")", ")", "{", "// try some number of times if dsMs...
Returns the <code>Status</code> of the node. An empty status is returned if status file is missing and <code>emptyForMissing</code> argument is true else null is returned.
[ "Returns", "the", "<code", ">", "Status<", "/", "code", ">", "of", "the", "node", ".", "An", "empty", "status", "is", "returned", "if", "status", "file", "is", "missing", "and", "<code", ">", "emptyForMissing<", "/", "code", ">", "argument", "is", "true"...
train
https://github.com/SnappyDataInc/snappydata/blob/96fe3e37e9f8d407ab68ef9e394083960acad21d/launcher/src/main/java/io/snappydata/tools/QuickLauncher.java#L440-L452
Jasig/uPortal
uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java
PropertiesManager.getPropertyUntrimmed
public static String getPropertyUntrimmed(String name) throws MissingPropertyException { if (PropertiesManager.props == null) loadProps(); if (props == null) { boolean alreadyReported = registerMissingProperty(name); throw new MissingPropertyException(name, alreadyReported); } String val = props.getProperty(name); if (val == null) { boolean alreadyReported = registerMissingProperty(name); throw new MissingPropertyException(name, alreadyReported); } return val; }
java
public static String getPropertyUntrimmed(String name) throws MissingPropertyException { if (PropertiesManager.props == null) loadProps(); if (props == null) { boolean alreadyReported = registerMissingProperty(name); throw new MissingPropertyException(name, alreadyReported); } String val = props.getProperty(name); if (val == null) { boolean alreadyReported = registerMissingProperty(name); throw new MissingPropertyException(name, alreadyReported); } return val; }
[ "public", "static", "String", "getPropertyUntrimmed", "(", "String", "name", ")", "throws", "MissingPropertyException", "{", "if", "(", "PropertiesManager", ".", "props", "==", "null", ")", "loadProps", "(", ")", ";", "if", "(", "props", "==", "null", ")", "...
Returns the value of a property for a given name including whitespace trailing the property value, but not including whitespace leading the property value. An UndeclaredPortalException is thrown if the property cannot be found. This method will never return null. @param name the name of the requested property @return value the value of the property matching the requested name @throws MissingPropertyException - (undeclared) if the requested property is not found
[ "Returns", "the", "value", "of", "a", "property", "for", "a", "given", "name", "including", "whitespace", "trailing", "the", "property", "value", "but", "not", "including", "whitespace", "leading", "the", "property", "value", ".", "An", "UndeclaredPortalException"...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java#L127-L141
hector-client/hector
core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java
HFactory.createKeyspace
public static Keyspace createKeyspace(String keyspace, Cluster cluster, ConsistencyLevelPolicy consistencyLevelPolicy, FailoverPolicy failoverPolicy) { return new ExecutingKeyspace(keyspace, cluster.getConnectionManager(), consistencyLevelPolicy, failoverPolicy, cluster.getCredentials()); }
java
public static Keyspace createKeyspace(String keyspace, Cluster cluster, ConsistencyLevelPolicy consistencyLevelPolicy, FailoverPolicy failoverPolicy) { return new ExecutingKeyspace(keyspace, cluster.getConnectionManager(), consistencyLevelPolicy, failoverPolicy, cluster.getCredentials()); }
[ "public", "static", "Keyspace", "createKeyspace", "(", "String", "keyspace", ",", "Cluster", "cluster", ",", "ConsistencyLevelPolicy", "consistencyLevelPolicy", ",", "FailoverPolicy", "failoverPolicy", ")", "{", "return", "new", "ExecutingKeyspace", "(", "keyspace", ","...
Creates a Keyspace with the given consistency level. For a reference to the consistency level, please refer to http://wiki.apache.org/cassandra/API. @param keyspace @param cluster @param consistencyLevelPolicy @param failoverPolicy @return
[ "Creates", "a", "Keyspace", "with", "the", "given", "consistency", "level", ".", "For", "a", "reference", "to", "the", "consistency", "level", "please", "refer", "to", "http", ":", "//", "wiki", ".", "apache", ".", "org", "/", "cassandra", "/", "API", "....
train
https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java#L271-L276
saxsys/SynchronizeFX
kryo-serializer/src/main/java/de/saxsys/synchronizefx/kryo/KryoSerializer.java
KryoSerializer.registerSerializableClass
public <T> void registerSerializableClass(final Class<T> clazz, final Serializer<T> serializer) { kryo.registerSerializableClass(clazz, serializer); }
java
public <T> void registerSerializableClass(final Class<T> clazz, final Serializer<T> serializer) { kryo.registerSerializableClass(clazz, serializer); }
[ "public", "<", "T", ">", "void", "registerSerializableClass", "(", "final", "Class", "<", "T", ">", "clazz", ",", "final", "Serializer", "<", "T", ">", "serializer", ")", "{", "kryo", ".", "registerSerializableClass", "(", "clazz", ",", "serializer", ")", ...
Registers a class that may be send over the network. Use this method only before the first invocation of either {@link KryoSerializer#serialize(List)} or {@link KryoSerializer#deserialize(byte[])}. If you invoke it after these methods it is not guaranteed that the {@link Kryo} used by these methods will actually use your serializers. @param clazz The class that's maybe send. @param serializer An optional serializer for this class. If it's null than the default serialization of kryo is used. @param <T> see clazz parameter.
[ "Registers", "a", "class", "that", "may", "be", "send", "over", "the", "network", "." ]
train
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/kryo-serializer/src/main/java/de/saxsys/synchronizefx/kryo/KryoSerializer.java#L52-L54
tvesalainen/util
util/src/main/java/org/vesalainen/ui/Transforms.java
Transforms.createScreenTransform
public static AffineTransform createScreenTransform(Rectangle2D userBounds, Rectangle2D screenBounds, boolean keepAspectRatio) { return createScreenTransform(userBounds, screenBounds, keepAspectRatio, new AffineTransform()); }
java
public static AffineTransform createScreenTransform(Rectangle2D userBounds, Rectangle2D screenBounds, boolean keepAspectRatio) { return createScreenTransform(userBounds, screenBounds, keepAspectRatio, new AffineTransform()); }
[ "public", "static", "AffineTransform", "createScreenTransform", "(", "Rectangle2D", "userBounds", ",", "Rectangle2D", "screenBounds", ",", "boolean", "keepAspectRatio", ")", "{", "return", "createScreenTransform", "(", "userBounds", ",", "screenBounds", ",", "keepAspectRa...
Creates translation that translates userBounds in Cartesian coordinates to screenBound in screen coordinates. <p>In Cartesian y grows up while in screen y grows down @param userBounds @param screenBounds @param keepAspectRatio @return
[ "Creates", "translation", "that", "translates", "userBounds", "in", "Cartesian", "coordinates", "to", "screenBound", "in", "screen", "coordinates", ".", "<p", ">", "In", "Cartesian", "y", "grows", "up", "while", "in", "screen", "y", "grows", "down" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/Transforms.java#L43-L46
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.getSplitPath
private Path getSplitPath(FileSplit inputSplit, JobConf conf) throws IOException { Path path = inputSplit.getPath(); if (inputSplit instanceof OrcSplit) { OrcSplit orcSplit = (OrcSplit) inputSplit; List<Long> deltas = orcSplit.getDeltas(); if (!orcSplit.hasBase() && deltas.size() >= 2) { throw new IOException("Cannot read valid StructTypeInfo from delta only file: " + path); } } LOG.debug("Input split path: {}", path); return path; }
java
private Path getSplitPath(FileSplit inputSplit, JobConf conf) throws IOException { Path path = inputSplit.getPath(); if (inputSplit instanceof OrcSplit) { OrcSplit orcSplit = (OrcSplit) inputSplit; List<Long> deltas = orcSplit.getDeltas(); if (!orcSplit.hasBase() && deltas.size() >= 2) { throw new IOException("Cannot read valid StructTypeInfo from delta only file: " + path); } } LOG.debug("Input split path: {}", path); return path; }
[ "private", "Path", "getSplitPath", "(", "FileSplit", "inputSplit", ",", "JobConf", "conf", ")", "throws", "IOException", "{", "Path", "path", "=", "inputSplit", ".", "getPath", "(", ")", ";", "if", "(", "inputSplit", "instanceof", "OrcSplit", ")", "{", "OrcS...
/* This is to work around an issue reading from ORC transactional data sets that contain only deltas. These contain synthesised column names that are not usable to us.
[ "/", "*", "This", "is", "to", "work", "around", "an", "issue", "reading", "from", "ORC", "transactional", "data", "sets", "that", "contain", "only", "deltas", ".", "These", "contain", "synthesised", "column", "names", "that", "are", "not", "usable", "to", ...
train
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L257-L268
monitorjbl/json-view
spring-json-view/src/main/java/com/monitorjbl/json/JsonViewSupportFactoryBean.java
JsonViewSupportFactoryBean.registerCustomSerializer
public <T> void registerCustomSerializer( Class<T> cls, JsonSerializer<T> forType ) { this.converter.registerCustomSerializer( cls, forType ); }
java
public <T> void registerCustomSerializer( Class<T> cls, JsonSerializer<T> forType ) { this.converter.registerCustomSerializer( cls, forType ); }
[ "public", "<", "T", ">", "void", "registerCustomSerializer", "(", "Class", "<", "T", ">", "cls", ",", "JsonSerializer", "<", "T", ">", "forType", ")", "{", "this", ".", "converter", ".", "registerCustomSerializer", "(", "cls", ",", "forType", ")", ";", "...
Registering custom serializer allows to the JSonView to deal with custom serializations for certains field types.<br> This way you could register for instance a JODA serialization as a DateTimeSerializer. <br> Thus, when JSonView find a field of that type (DateTime), it will delegate the serialization to the serializer specified.<br> Example:<br> <code> JsonViewSupportFactoryBean bean = new JsonViewSupportFactoryBean( mapper ); bean.registerCustomSerializer( DateTime.class, new DateTimeSerializer() ); </code> @param <T> Type class of the serializer @param cls {@link Class} the class type you want to add a custom serializer @param forType {@link JsonSerializer} the serializer you want to apply for that type
[ "Registering", "custom", "serializer", "allows", "to", "the", "JSonView", "to", "deal", "with", "custom", "serializations", "for", "certains", "field", "types", ".", "<br", ">", "This", "way", "you", "could", "register", "for", "instance", "a", "JODA", "serial...
train
https://github.com/monitorjbl/json-view/blob/c01505ac76e5416abe8af85c5816f60bd5d483ea/spring-json-view/src/main/java/com/monitorjbl/json/JsonViewSupportFactoryBean.java#L103-L106
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_ips_ip_GET
public OvhIP serviceName_ips_ip_GET(String serviceName, String ip) throws IOException { String qPath = "/xdsl/{serviceName}/ips/{ip}"; StringBuilder sb = path(qPath, serviceName, ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhIP.class); }
java
public OvhIP serviceName_ips_ip_GET(String serviceName, String ip) throws IOException { String qPath = "/xdsl/{serviceName}/ips/{ip}"; StringBuilder sb = path(qPath, serviceName, ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhIP.class); }
[ "public", "OvhIP", "serviceName_ips_ip_GET", "(", "String", "serviceName", ",", "String", "ip", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/ips/{ip}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ...
Get this object properties REST: GET /xdsl/{serviceName}/ips/{ip} @param serviceName [required] The internal name of your XDSL offer @param ip [required] The IP address
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1467-L1472
alexvasilkov/GestureViews
library/src/main/java/com/alexvasilkov/gestures/State.java
State.updateFromMatrix
private void updateFromMatrix(boolean updateZoom, boolean updateRotation) { matrix.getValues(matrixValues); x = matrixValues[2]; y = matrixValues[5]; if (updateZoom) { zoom = (float) Math.hypot(matrixValues[1], matrixValues[4]); } if (updateRotation) { rotation = (float) Math.toDegrees(Math.atan2(matrixValues[3], matrixValues[4])); } }
java
private void updateFromMatrix(boolean updateZoom, boolean updateRotation) { matrix.getValues(matrixValues); x = matrixValues[2]; y = matrixValues[5]; if (updateZoom) { zoom = (float) Math.hypot(matrixValues[1], matrixValues[4]); } if (updateRotation) { rotation = (float) Math.toDegrees(Math.atan2(matrixValues[3], matrixValues[4])); } }
[ "private", "void", "updateFromMatrix", "(", "boolean", "updateZoom", ",", "boolean", "updateRotation", ")", "{", "matrix", ".", "getValues", "(", "matrixValues", ")", ";", "x", "=", "matrixValues", "[", "2", "]", ";", "y", "=", "matrixValues", "[", "5", "]...
Applying state from current matrix. <p> Having matrix: <pre> | a b tx | A = | c d ty | | 0 0 1 | x = tx y = ty scale = sqrt(b^2+d^2) rotation = atan(c/d) = atan(-b/a) </pre> See <a href="http://stackoverflow.com/questions/4361242">here</a>. @param updateZoom Whether to extract zoom from matrix @param updateRotation Whether to extract rotation from matrix
[ "Applying", "state", "from", "current", "matrix", ".", "<p", ">", "Having", "matrix", ":", "<pre", ">", "|", "a", "b", "tx", "|", "A", "=", "|", "c", "d", "ty", "|", "|", "0", "0", "1", "|" ]
train
https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/State.java#L155-L165
OpenLiberty/open-liberty
dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java
SelfExtractor.getCommonRootDir
private String getCommonRootDir(String filePath, HashMap validFilePaths) { for (Iterator it = validFilePaths.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); String path = (String) ((entry).getKey()); if (filePath.startsWith(path)) return (String) entry.getValue(); } return null; }
java
private String getCommonRootDir(String filePath, HashMap validFilePaths) { for (Iterator it = validFilePaths.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); String path = (String) ((entry).getKey()); if (filePath.startsWith(path)) return (String) entry.getValue(); } return null; }
[ "private", "String", "getCommonRootDir", "(", "String", "filePath", ",", "HashMap", "validFilePaths", ")", "{", "for", "(", "Iterator", "it", "=", "validFilePaths", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ...
Retrieves the directory in common between the specified path and the archive root directory. If the file path cannot be found among the valid paths then null is returned. @param filePath Path to the file to check @param validFilePaths A list of valid file paths and their common directories with the root @return The directory in common between the specified path and the root directory
[ "Retrieves", "the", "directory", "in", "common", "between", "the", "specified", "path", "and", "the", "archive", "root", "directory", ".", "If", "the", "file", "path", "cannot", "be", "found", "among", "the", "valid", "paths", "then", "null", "is", "returned...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractor.java#L982-L991
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java
VisualizeCamera2Activity.processImageOuter
private void processImageOuter( ImageBase image ) { long startTime = System.currentTimeMillis(); // this image is owned by only this process and no other. So no need to lock it while // processing processImage(image); // If an old image finished being processes after a more recent one it won't be visualized if( !visualizeOnlyMostRecent || startTime > timeOfLastUpdated ) { timeOfLastUpdated = startTime; // Copy this frame renderBitmapImage(bitmapMode,image); // Update the visualization runOnUiThread(() -> displayView.invalidate()); } // Put the image into the stack if the image type has not changed synchronized (boofImage.imageLock) { if( boofImage.imageType.isSameType(image.getImageType())) boofImage.stackImages.add(image); } }
java
private void processImageOuter( ImageBase image ) { long startTime = System.currentTimeMillis(); // this image is owned by only this process and no other. So no need to lock it while // processing processImage(image); // If an old image finished being processes after a more recent one it won't be visualized if( !visualizeOnlyMostRecent || startTime > timeOfLastUpdated ) { timeOfLastUpdated = startTime; // Copy this frame renderBitmapImage(bitmapMode,image); // Update the visualization runOnUiThread(() -> displayView.invalidate()); } // Put the image into the stack if the image type has not changed synchronized (boofImage.imageLock) { if( boofImage.imageType.isSameType(image.getImageType())) boofImage.stackImages.add(image); } }
[ "private", "void", "processImageOuter", "(", "ImageBase", "image", ")", "{", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "// this image is owned by only this process and no other. So no need to lock it while", "// processing", "processImage", ...
Internal function which manages images and invokes {@link #processImage}.
[ "Internal", "function", "which", "manages", "images", "and", "invokes", "{" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java#L391-L414
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitCall
private void visitCall(NodeTraversal t, Node n) { checkCallConventions(t, n); Node child = n.getFirstChild(); JSType childType = getJSType(child).restrictByNotNullOrUndefined(); if (!childType.canBeCalled()) { report(n, NOT_CALLABLE, childType.toString()); ensureTyped(n); return; } // A couple of types can be called as if they were functions. // If it is a function type, then validate parameters. if (childType.isFunctionType()) { FunctionType functionType = childType.toMaybeFunctionType(); // Non-native constructors should not be called directly // unless they specify a return type if (functionType.isConstructor() && !functionType.isNativeObjectType() && (functionType.getReturnType().isUnknownType() || functionType.getReturnType().isVoidType()) && !n.getFirstChild().isSuper()) { report(n, CONSTRUCTOR_NOT_CALLABLE, childType.toString()); } // Functions with explicit 'this' types must be called in a GETPROP or GETELEM. if (functionType.isOrdinaryFunction() && !NodeUtil.isGet(child)) { JSType receiverType = functionType.getTypeOfThis(); if (receiverType.isUnknownType() || receiverType.isAllType() || receiverType.isVoidType() || (receiverType.isObjectType() && receiverType.toObjectType().isNativeObjectType())) { // Allow these special cases. } else { report(n, EXPECTED_THIS_TYPE, functionType.toString()); } } visitArgumentList(n, functionType); ensureTyped(n, functionType.getReturnType()); } else { ensureTyped(n); } // TODO(nicksantos): Add something to check for calls of RegExp objects, // which is not supported by IE. Either say something about the return type // or warn about the non-portability of the call or both. }
java
private void visitCall(NodeTraversal t, Node n) { checkCallConventions(t, n); Node child = n.getFirstChild(); JSType childType = getJSType(child).restrictByNotNullOrUndefined(); if (!childType.canBeCalled()) { report(n, NOT_CALLABLE, childType.toString()); ensureTyped(n); return; } // A couple of types can be called as if they were functions. // If it is a function type, then validate parameters. if (childType.isFunctionType()) { FunctionType functionType = childType.toMaybeFunctionType(); // Non-native constructors should not be called directly // unless they specify a return type if (functionType.isConstructor() && !functionType.isNativeObjectType() && (functionType.getReturnType().isUnknownType() || functionType.getReturnType().isVoidType()) && !n.getFirstChild().isSuper()) { report(n, CONSTRUCTOR_NOT_CALLABLE, childType.toString()); } // Functions with explicit 'this' types must be called in a GETPROP or GETELEM. if (functionType.isOrdinaryFunction() && !NodeUtil.isGet(child)) { JSType receiverType = functionType.getTypeOfThis(); if (receiverType.isUnknownType() || receiverType.isAllType() || receiverType.isVoidType() || (receiverType.isObjectType() && receiverType.toObjectType().isNativeObjectType())) { // Allow these special cases. } else { report(n, EXPECTED_THIS_TYPE, functionType.toString()); } } visitArgumentList(n, functionType); ensureTyped(n, functionType.getReturnType()); } else { ensureTyped(n); } // TODO(nicksantos): Add something to check for calls of RegExp objects, // which is not supported by IE. Either say something about the return type // or warn about the non-portability of the call or both. }
[ "private", "void", "visitCall", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "checkCallConventions", "(", "t", ",", "n", ")", ";", "Node", "child", "=", "n", ".", "getFirstChild", "(", ")", ";", "JSType", "childType", "=", "getJSType", "(", "...
Visits a CALL node. @param t The node traversal object that supplies context, such as the scope chain to use in name lookups as well as error reporting. @param n The node being visited.
[ "Visits", "a", "CALL", "node", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L2534-L2583
hugegraph/hugegraph-common
src/main/java/com/baidu/hugegraph/util/VersionUtil.java
VersionUtil.match
public static boolean match(Version version, String begin, String end) { E.checkArgumentNotNull(version, "The version to match is null"); return version.compareTo(new Version(begin)) >= 0 && version.compareTo(new Version(end)) < 0; }
java
public static boolean match(Version version, String begin, String end) { E.checkArgumentNotNull(version, "The version to match is null"); return version.compareTo(new Version(begin)) >= 0 && version.compareTo(new Version(end)) < 0; }
[ "public", "static", "boolean", "match", "(", "Version", "version", ",", "String", "begin", ",", "String", "end", ")", "{", "E", ".", "checkArgumentNotNull", "(", "version", ",", "\"The version to match is null\"", ")", ";", "return", "version", ".", "compareTo",...
Compare if a version is inside a range [begin, end) @param version The version to be compared @param begin The lower bound of the range @param end The upper bound of the range @return true if belong to the range, otherwise false
[ "Compare", "if", "a", "version", "is", "inside", "a", "range", "[", "begin", "end", ")" ]
train
https://github.com/hugegraph/hugegraph-common/blob/1eb2414134b639a13f68ca352c1b3eb2d956e7b2/src/main/java/com/baidu/hugegraph/util/VersionUtil.java#L38-L42
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/query/LiteralMapList.java
LiteralMapList.select
public LiteralMapList select(String key, Object value) { LiteralMapList ret = new LiteralMapList(); for (LiteralMap lm : this) { if (isEqual(value, lm.get(key))) ret.add(lm); } return ret; }
java
public LiteralMapList select(String key, Object value) { LiteralMapList ret = new LiteralMapList(); for (LiteralMap lm : this) { if (isEqual(value, lm.get(key))) ret.add(lm); } return ret; }
[ "public", "LiteralMapList", "select", "(", "String", "key", ",", "Object", "value", ")", "{", "LiteralMapList", "ret", "=", "new", "LiteralMapList", "(", ")", ";", "for", "(", "LiteralMap", "lm", ":", "this", ")", "{", "if", "(", "isEqual", "(", "value",...
Answer a LiteralMapList containing only literal maps with the given key and value @param key @param value @return
[ "Answer", "a", "LiteralMapList", "containing", "only", "literal", "maps", "with", "the", "given", "key", "and", "value" ]
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/LiteralMapList.java#L62-L69
likethecolor/Alchemy-API
src/main/java/com/likethecolor/alchemy/api/parser/json/KeywordParser.java
KeywordParser.isValidKeyword
private boolean isValidKeyword(final String keyword, final Double score) { return !StringUtils.isBlank(keyword) || score != null; }
java
private boolean isValidKeyword(final String keyword, final Double score) { return !StringUtils.isBlank(keyword) || score != null; }
[ "private", "boolean", "isValidKeyword", "(", "final", "String", "keyword", ",", "final", "Double", "score", ")", "{", "return", "!", "StringUtils", ".", "isBlank", "(", "keyword", ")", "||", "score", "!=", "null", ";", "}" ]
Return true if at least one of the values is not null/empty. @param keyword the sentiment keyword @param score the sentiment score @return true if at least one of the values is not null/empty
[ "Return", "true", "if", "at", "least", "one", "of", "the", "values", "is", "not", "null", "/", "empty", "." ]
train
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/KeywordParser.java#L114-L117
Azure/azure-sdk-for-java
cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java
BingImagesImpl.searchWithServiceResponseAsync
public Observable<ServiceResponse<ImagesModel>> searchWithServiceResponseAsync(String query, SearchOptionalParameter searchOptionalParameter) { if (query == null) { throw new IllegalArgumentException("Parameter query is required and cannot be null."); } final String acceptLanguage = searchOptionalParameter != null ? searchOptionalParameter.acceptLanguage() : null; final String userAgent = searchOptionalParameter != null ? searchOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = searchOptionalParameter != null ? searchOptionalParameter.clientId() : null; final String clientIp = searchOptionalParameter != null ? searchOptionalParameter.clientIp() : null; final String location = searchOptionalParameter != null ? searchOptionalParameter.location() : null; final ImageAspect aspect = searchOptionalParameter != null ? searchOptionalParameter.aspect() : null; final ImageColor color = searchOptionalParameter != null ? searchOptionalParameter.color() : null; final String countryCode = searchOptionalParameter != null ? searchOptionalParameter.countryCode() : null; final Integer count = searchOptionalParameter != null ? searchOptionalParameter.count() : null; final Freshness freshness = searchOptionalParameter != null ? searchOptionalParameter.freshness() : null; final Integer height = searchOptionalParameter != null ? searchOptionalParameter.height() : null; final String id = searchOptionalParameter != null ? searchOptionalParameter.id() : null; final ImageContent imageContent = searchOptionalParameter != null ? searchOptionalParameter.imageContent() : null; final ImageType imageType = searchOptionalParameter != null ? searchOptionalParameter.imageType() : null; final ImageLicense license = searchOptionalParameter != null ? searchOptionalParameter.license() : null; final String market = searchOptionalParameter != null ? searchOptionalParameter.market() : null; final Long maxFileSize = searchOptionalParameter != null ? searchOptionalParameter.maxFileSize() : null; final Long maxHeight = searchOptionalParameter != null ? searchOptionalParameter.maxHeight() : null; final Long maxWidth = searchOptionalParameter != null ? searchOptionalParameter.maxWidth() : null; final Long minFileSize = searchOptionalParameter != null ? searchOptionalParameter.minFileSize() : null; final Long minHeight = searchOptionalParameter != null ? searchOptionalParameter.minHeight() : null; final Long minWidth = searchOptionalParameter != null ? searchOptionalParameter.minWidth() : null; final Long offset = searchOptionalParameter != null ? searchOptionalParameter.offset() : null; final SafeSearch safeSearch = searchOptionalParameter != null ? searchOptionalParameter.safeSearch() : null; final ImageSize size = searchOptionalParameter != null ? searchOptionalParameter.size() : null; final String setLang = searchOptionalParameter != null ? searchOptionalParameter.setLang() : null; final Integer width = searchOptionalParameter != null ? searchOptionalParameter.width() : null; return searchWithServiceResponseAsync(query, acceptLanguage, userAgent, clientId, clientIp, location, aspect, color, countryCode, count, freshness, height, id, imageContent, imageType, license, market, maxFileSize, maxHeight, maxWidth, minFileSize, minHeight, minWidth, offset, safeSearch, size, setLang, width); }
java
public Observable<ServiceResponse<ImagesModel>> searchWithServiceResponseAsync(String query, SearchOptionalParameter searchOptionalParameter) { if (query == null) { throw new IllegalArgumentException("Parameter query is required and cannot be null."); } final String acceptLanguage = searchOptionalParameter != null ? searchOptionalParameter.acceptLanguage() : null; final String userAgent = searchOptionalParameter != null ? searchOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = searchOptionalParameter != null ? searchOptionalParameter.clientId() : null; final String clientIp = searchOptionalParameter != null ? searchOptionalParameter.clientIp() : null; final String location = searchOptionalParameter != null ? searchOptionalParameter.location() : null; final ImageAspect aspect = searchOptionalParameter != null ? searchOptionalParameter.aspect() : null; final ImageColor color = searchOptionalParameter != null ? searchOptionalParameter.color() : null; final String countryCode = searchOptionalParameter != null ? searchOptionalParameter.countryCode() : null; final Integer count = searchOptionalParameter != null ? searchOptionalParameter.count() : null; final Freshness freshness = searchOptionalParameter != null ? searchOptionalParameter.freshness() : null; final Integer height = searchOptionalParameter != null ? searchOptionalParameter.height() : null; final String id = searchOptionalParameter != null ? searchOptionalParameter.id() : null; final ImageContent imageContent = searchOptionalParameter != null ? searchOptionalParameter.imageContent() : null; final ImageType imageType = searchOptionalParameter != null ? searchOptionalParameter.imageType() : null; final ImageLicense license = searchOptionalParameter != null ? searchOptionalParameter.license() : null; final String market = searchOptionalParameter != null ? searchOptionalParameter.market() : null; final Long maxFileSize = searchOptionalParameter != null ? searchOptionalParameter.maxFileSize() : null; final Long maxHeight = searchOptionalParameter != null ? searchOptionalParameter.maxHeight() : null; final Long maxWidth = searchOptionalParameter != null ? searchOptionalParameter.maxWidth() : null; final Long minFileSize = searchOptionalParameter != null ? searchOptionalParameter.minFileSize() : null; final Long minHeight = searchOptionalParameter != null ? searchOptionalParameter.minHeight() : null; final Long minWidth = searchOptionalParameter != null ? searchOptionalParameter.minWidth() : null; final Long offset = searchOptionalParameter != null ? searchOptionalParameter.offset() : null; final SafeSearch safeSearch = searchOptionalParameter != null ? searchOptionalParameter.safeSearch() : null; final ImageSize size = searchOptionalParameter != null ? searchOptionalParameter.size() : null; final String setLang = searchOptionalParameter != null ? searchOptionalParameter.setLang() : null; final Integer width = searchOptionalParameter != null ? searchOptionalParameter.width() : null; return searchWithServiceResponseAsync(query, acceptLanguage, userAgent, clientId, clientIp, location, aspect, color, countryCode, count, freshness, height, id, imageContent, imageType, license, market, maxFileSize, maxHeight, maxWidth, minFileSize, minHeight, minWidth, offset, safeSearch, size, setLang, width); }
[ "public", "Observable", "<", "ServiceResponse", "<", "ImagesModel", ">", ">", "searchWithServiceResponseAsync", "(", "String", "query", ",", "SearchOptionalParameter", "searchOptionalParameter", ")", "{", "if", "(", "query", "==", "null", ")", "{", "throw", "new", ...
The Image Search API lets you send a search query to Bing and get back a list of relevant images. This section provides technical details about the query parameters and headers that you use to request images and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the Web for Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web). @param query The user's search query term. The term cannot be empty. The term may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit images to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help improve relevance of an insights query (see [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)), you should always include the user's query term. Use this parameter only with the Image Search API.Do not specify this parameter when calling the Trending Images API. @param searchOptionalParameter 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 ImagesModel object
[ "The", "Image", "Search", "API", "lets", "you", "send", "a", "search", "query", "to", "Bing", "and", "get", "back", "a", "list", "of", "relevant", "images", ".", "This", "section", "provides", "technical", "details", "about", "the", "query", "parameters", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java#L140-L173
OpenLiberty/open-liberty
dev/com.ibm.ws.collector/src/com/ibm/ws/collector/Collector.java
Collector.configure
private void configure(Map<String, Object> configuration) throws IOException { List<TaskConfig> configList = new ArrayList<TaskConfig>(); configList.addAll(parseConfig(configuration)); for (TaskConfig taskConfig : configList) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Task config " + this, taskConfig); } if (taskConfig.getEnabled()) { //Create the task, set the configuration and add it to the map if it's not already present. Task task = new TaskImpl(); if (task != null) { //Check if task already exist (by check if the source id is already in the taskMap) //if not, we set the task with the new config and get appropriate handler based on the type of source //else, we simply replace the config in the original task with the modified config if (!taskMap.containsKey(taskConfig.sourceId())) { task.setHandlerName(getHandlerName()); task.setConfig(taskConfig); taskMap.putIfAbsent(taskConfig.sourceId(), task); } else { taskMap.get(taskConfig.sourceId()).setConfig(taskConfig); } } } } }
java
private void configure(Map<String, Object> configuration) throws IOException { List<TaskConfig> configList = new ArrayList<TaskConfig>(); configList.addAll(parseConfig(configuration)); for (TaskConfig taskConfig : configList) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Task config " + this, taskConfig); } if (taskConfig.getEnabled()) { //Create the task, set the configuration and add it to the map if it's not already present. Task task = new TaskImpl(); if (task != null) { //Check if task already exist (by check if the source id is already in the taskMap) //if not, we set the task with the new config and get appropriate handler based on the type of source //else, we simply replace the config in the original task with the modified config if (!taskMap.containsKey(taskConfig.sourceId())) { task.setHandlerName(getHandlerName()); task.setConfig(taskConfig); taskMap.putIfAbsent(taskConfig.sourceId(), task); } else { taskMap.get(taskConfig.sourceId()).setConfig(taskConfig); } } } } }
[ "private", "void", "configure", "(", "Map", "<", "String", ",", "Object", ">", "configuration", ")", "throws", "IOException", "{", "List", "<", "TaskConfig", ">", "configList", "=", "new", "ArrayList", "<", "TaskConfig", ">", "(", ")", ";", "configList", "...
/* Process the configuration and create the relevant tasks Target is also initialized using the information provided in the configuration
[ "/", "*", "Process", "the", "configuration", "and", "create", "the", "relevant", "tasks", "Target", "is", "also", "initialized", "using", "the", "information", "provided", "in", "the", "configuration" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.collector/src/com/ibm/ws/collector/Collector.java#L178-L202
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java
URLUtil.getURL
public static URL getURL(String path, Class<?> clazz) { return ResourceUtil.getResource(path, clazz); }
java
public static URL getURL(String path, Class<?> clazz) { return ResourceUtil.getResource(path, clazz); }
[ "public", "static", "URL", "getURL", "(", "String", "path", ",", "Class", "<", "?", ">", "clazz", ")", "{", "return", "ResourceUtil", ".", "getResource", "(", "path", ",", "clazz", ")", ";", "}" ]
获得URL @param path 相对给定 class所在的路径 @param clazz 指定class @return URL @see ResourceUtil#getResource(String, Class)
[ "获得URL" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L145-L147
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/PatternPool.java
PatternPool.get
public static Pattern get(String regex, int flags) { final RegexWithFlag regexWithFlag = new RegexWithFlag(regex, flags); Pattern pattern = POOL.get(regexWithFlag); if (null == pattern) { pattern = Pattern.compile(regex, flags); POOL.put(regexWithFlag, pattern); } return pattern; }
java
public static Pattern get(String regex, int flags) { final RegexWithFlag regexWithFlag = new RegexWithFlag(regex, flags); Pattern pattern = POOL.get(regexWithFlag); if (null == pattern) { pattern = Pattern.compile(regex, flags); POOL.put(regexWithFlag, pattern); } return pattern; }
[ "public", "static", "Pattern", "get", "(", "String", "regex", ",", "int", "flags", ")", "{", "final", "RegexWithFlag", "regexWithFlag", "=", "new", "RegexWithFlag", "(", "regex", ",", "flags", ")", ";", "Pattern", "pattern", "=", "POOL", ".", "get", "(", ...
先从Pattern池中查找正则对应的{@link Pattern},找不到则编译正则表达式并入池。 @param regex 正则表达式 @param flags 正则标识位集合 {@link Pattern} @return {@link Pattern}
[ "先从Pattern池中查找正则对应的", "{", "@link", "Pattern", "}", ",找不到则编译正则表达式并入池。" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/PatternPool.java#L82-L91
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/util/ProcessUtil.java
ProcessUtil.consumeProcessConsole
public static void consumeProcessConsole(Process process, Listener<String> outputListener, Listener<String> errorListener) { Application app = LCCore.getApplication(); ThreadFactory factory = app.getThreadFactory(); Thread t; ConsoleConsumer cc; cc = new ConsoleConsumer(process.getInputStream(), outputListener); t = factory.newThread(cc); t.setName("Process output console consumer"); cc.app = app; cc.t = t; t.start(); app.toInterruptOnShutdown(t); cc = new ConsoleConsumer(process.getErrorStream(), errorListener); t = factory.newThread(cc); t.setName("Process error console consumer"); cc.app = app; cc.t = t; t.start(); app.toInterruptOnShutdown(t); }
java
public static void consumeProcessConsole(Process process, Listener<String> outputListener, Listener<String> errorListener) { Application app = LCCore.getApplication(); ThreadFactory factory = app.getThreadFactory(); Thread t; ConsoleConsumer cc; cc = new ConsoleConsumer(process.getInputStream(), outputListener); t = factory.newThread(cc); t.setName("Process output console consumer"); cc.app = app; cc.t = t; t.start(); app.toInterruptOnShutdown(t); cc = new ConsoleConsumer(process.getErrorStream(), errorListener); t = factory.newThread(cc); t.setName("Process error console consumer"); cc.app = app; cc.t = t; t.start(); app.toInterruptOnShutdown(t); }
[ "public", "static", "void", "consumeProcessConsole", "(", "Process", "process", ",", "Listener", "<", "String", ">", "outputListener", ",", "Listener", "<", "String", ">", "errorListener", ")", "{", "Application", "app", "=", "LCCore", ".", "getApplication", "("...
Launch 2 threads to consume both output and error streams, and call the listeners for each line read.
[ "Launch", "2", "threads", "to", "consume", "both", "output", "and", "error", "streams", "and", "call", "the", "listeners", "for", "each", "line", "read", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/ProcessUtil.java#L37-L56
joniles/mpxj
src/main/java/net/sf/mpxj/merlin/MerlinReader.java
MerlinReader.getNodeList
private NodeList getNodeList(String document, XPathExpression expression) throws Exception { Document doc = m_documentBuilder.parse(new InputSource(new StringReader(document))); return (NodeList) expression.evaluate(doc, XPathConstants.NODESET); }
java
private NodeList getNodeList(String document, XPathExpression expression) throws Exception { Document doc = m_documentBuilder.parse(new InputSource(new StringReader(document))); return (NodeList) expression.evaluate(doc, XPathConstants.NODESET); }
[ "private", "NodeList", "getNodeList", "(", "String", "document", ",", "XPathExpression", "expression", ")", "throws", "Exception", "{", "Document", "doc", "=", "m_documentBuilder", ".", "parse", "(", "new", "InputSource", "(", "new", "StringReader", "(", "document...
Retrieve a node list based on an XPath expression. @param document XML document to process @param expression compiled XPath expression @return node list
[ "Retrieve", "a", "node", "list", "based", "on", "an", "XPath", "expression", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L666-L670
igniterealtime/Smack
smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java
AgentSession.setStatus
public void setStatus(Presence.Mode presenceMode, int maxChats) throws XMPPException, SmackException, InterruptedException { setStatus(presenceMode, maxChats, null); }
java
public void setStatus(Presence.Mode presenceMode, int maxChats) throws XMPPException, SmackException, InterruptedException { setStatus(presenceMode, maxChats, null); }
[ "public", "void", "setStatus", "(", "Presence", ".", "Mode", "presenceMode", ",", "int", "maxChats", ")", "throws", "XMPPException", ",", "SmackException", ",", "InterruptedException", "{", "setStatus", "(", "presenceMode", ",", "maxChats", ",", "null", ")", ";"...
Sets the agent's current status with the workgroup. The presence mode affects how offers are routed to the agent. The possible presence modes with their meanings are as follows:<ul> <li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more chats (equivalent to Presence.Mode.CHAT). <li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be disturbed. However, special case, or extreme urgency chats may still be offered to the agent. <li>Presence.Mode.AWAY -- the agent is not available and should not have a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).</ul> The max chats value is the maximum number of chats the agent is willing to have routed to them at once. Some servers may be configured to only accept max chat values in a certain range; for example, between two and five. In that case, the maxChats value the agent sends may be adjusted by the server to a value within that range. @param presenceMode the presence mode of the agent. @param maxChats the maximum number of chats the agent is willing to accept. @throws XMPPException if an error occurs setting the agent status. @throws SmackException @throws InterruptedException @throws IllegalStateException if the agent is not online with the workgroup.
[ "Sets", "the", "agent", "s", "current", "status", "with", "the", "workgroup", ".", "The", "presence", "mode", "affects", "how", "offers", "are", "routed", "to", "the", "agent", ".", "The", "possible", "presence", "modes", "with", "their", "meanings", "are", ...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java#L389-L391
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/parser/JSONParserByteArray.java
JSONParserByteArray.parse
public <T> T parse(byte[] in, JsonReaderI<T> mapper) throws ParseException { this.base = mapper.base; this.in = in; this.len = in.length; return parse(mapper); }
java
public <T> T parse(byte[] in, JsonReaderI<T> mapper) throws ParseException { this.base = mapper.base; this.in = in; this.len = in.length; return parse(mapper); }
[ "public", "<", "T", ">", "T", "parse", "(", "byte", "[", "]", "in", ",", "JsonReaderI", "<", "T", ">", "mapper", ")", "throws", "ParseException", "{", "this", ".", "base", "=", "mapper", ".", "base", ";", "this", ".", "in", "=", "in", ";", "this"...
use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory
[ "use", "to", "return", "Primitive", "Type", "or", "String", "Or", "JsonObject", "or", "JsonArray", "generated", "by", "a", "ContainerFactory" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/parser/JSONParserByteArray.java#L54-L59
redkale/redkale
src/org/redkale/asm/ClassReader.java
ClassReader.createLabel
private Label createLabel(int offset, Label[] labels) { Label label = readLabel(offset, labels); label.status &= ~Label.DEBUG; return label; }
java
private Label createLabel(int offset, Label[] labels) { Label label = readLabel(offset, labels); label.status &= ~Label.DEBUG; return label; }
[ "private", "Label", "createLabel", "(", "int", "offset", ",", "Label", "[", "]", "labels", ")", "{", "Label", "label", "=", "readLabel", "(", "offset", ",", "labels", ")", ";", "label", ".", "status", "&=", "~", "Label", ".", "DEBUG", ";", "return", ...
Creates a label without the Label.DEBUG flag set, for the given offset. The label is created with a call to {@link #readLabel} and its Label.DEBUG flag is cleared. @param offset a bytecode offset in a method. @param labels the already created labels, indexed by their offset. @return a Label without the Label.DEBUG flag set.
[ "Creates", "a", "label", "without", "the", "Label", ".", "DEBUG", "flag", "set", "for", "the", "given", "offset", ".", "The", "label", "is", "created", "with", "a", "call", "to", "{", "@link", "#readLabel", "}", "and", "its", "Label", ".", "DEBUG", "fl...
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/asm/ClassReader.java#L2401-L2405
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java
CSSErrorStrategy.consumeUntilGreedy
protected void consumeUntilGreedy(Parser recognizer, IntervalSet set, CSSLexerState.RecoveryMode mode) { CSSToken t; do { Token next = recognizer.getInputStream().LT(1); if (next instanceof CSSToken) { t = (CSSToken) recognizer.getInputStream().LT(1); if (t.getType() == Token.EOF) { logger.trace("token eof "); break; } } else break; /* not a CSSToken, probably EOF */ logger.trace("Skipped greedy: {}", t.getText()); // consume token even if it will match recognizer.consume(); } while (!(t.getLexerState().isBalanced(mode, null, t) && set.contains(t.getType()))); }
java
protected void consumeUntilGreedy(Parser recognizer, IntervalSet set, CSSLexerState.RecoveryMode mode) { CSSToken t; do { Token next = recognizer.getInputStream().LT(1); if (next instanceof CSSToken) { t = (CSSToken) recognizer.getInputStream().LT(1); if (t.getType() == Token.EOF) { logger.trace("token eof "); break; } } else break; /* not a CSSToken, probably EOF */ logger.trace("Skipped greedy: {}", t.getText()); // consume token even if it will match recognizer.consume(); } while (!(t.getLexerState().isBalanced(mode, null, t) && set.contains(t.getType()))); }
[ "protected", "void", "consumeUntilGreedy", "(", "Parser", "recognizer", ",", "IntervalSet", "set", ",", "CSSLexerState", ".", "RecoveryMode", "mode", ")", "{", "CSSToken", "t", ";", "do", "{", "Token", "next", "=", "recognizer", ".", "getInputStream", "(", ")"...
Consumes token until lexer state is function-balanced and token from follow is matched. Matched token is also consumed
[ "Consumes", "token", "until", "lexer", "state", "is", "function", "-", "balanced", "and", "token", "from", "follow", "is", "matched", ".", "Matched", "token", "is", "also", "consumed" ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java#L72-L89
konvergeio/cofoja
src/main/java/com/google/java/contract/util/Predicates.java
Predicates.allEntries
public static <K, V> Predicate<Map<K, V>> allEntries( Predicate<? super Map.Entry<K, V>> p) { return forEntries(Predicates.<Map.Entry<K, V>>all(p)); }
java
public static <K, V> Predicate<Map<K, V>> allEntries( Predicate<? super Map.Entry<K, V>> p) { return forEntries(Predicates.<Map.Entry<K, V>>all(p)); }
[ "public", "static", "<", "K", ",", "V", ">", "Predicate", "<", "Map", "<", "K", ",", "V", ">", ">", "allEntries", "(", "Predicate", "<", "?", "super", "Map", ".", "Entry", "<", "K", ",", "V", ">", ">", "p", ")", "{", "return", "forEntries", "("...
Returns a predicate that applies {@code all(p)} to the entries of its argument.
[ "Returns", "a", "predicate", "that", "applies", "{" ]
train
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/util/Predicates.java#L307-L310
stevespringett/Alpine
alpine/src/main/java/alpine/crypto/DataEncryption.java
DataEncryption.encryptAsBytes
public static byte[] encryptAsBytes(final String plainText) throws Exception { final SecretKey secretKey = KeyManager.getInstance().getSecretKey(); return encryptAsBytes(secretKey, plainText); }
java
public static byte[] encryptAsBytes(final String plainText) throws Exception { final SecretKey secretKey = KeyManager.getInstance().getSecretKey(); return encryptAsBytes(secretKey, plainText); }
[ "public", "static", "byte", "[", "]", "encryptAsBytes", "(", "final", "String", "plainText", ")", "throws", "Exception", "{", "final", "SecretKey", "secretKey", "=", "KeyManager", ".", "getInstance", "(", ")", ".", "getSecretKey", "(", ")", ";", "return", "e...
Encrypts the specified plainText using AES-256. This method uses the default secret key. @param plainText the text to encrypt @return the encrypted bytes @throws Exception a number of exceptions may be thrown @since 1.3.0
[ "Encrypts", "the", "specified", "plainText", "using", "AES", "-", "256", ".", "This", "method", "uses", "the", "default", "secret", "key", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/crypto/DataEncryption.java#L81-L84
alkacon/opencms-core
src/org/opencms/ui/contextmenu/CmsContextMenu.java
CmsContextMenu.openForTable
public void openForTable(ClickEvent event, Object itemId, Object propertyId, Table table) { fireEvent(new ContextMenuOpenedOnTableRowEvent(this, table, itemId, propertyId)); open(event.getClientX(), event.getClientY()); }
java
public void openForTable(ClickEvent event, Object itemId, Object propertyId, Table table) { fireEvent(new ContextMenuOpenedOnTableRowEvent(this, table, itemId, propertyId)); open(event.getClientX(), event.getClientY()); }
[ "public", "void", "openForTable", "(", "ClickEvent", "event", ",", "Object", "itemId", ",", "Object", "propertyId", ",", "Table", "table", ")", "{", "fireEvent", "(", "new", "ContextMenuOpenedOnTableRowEvent", "(", "this", ",", "table", ",", "itemId", ",", "pr...
Opens the context menu of the given table.<p> @param event the click event @param itemId of clicked item @param propertyId of clicked item @param table the table
[ "Opens", "the", "context", "menu", "of", "the", "given", "table", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/contextmenu/CmsContextMenu.java#L1135-L1140
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java
GenericBoJdbcDao.getAllSorted
protected Stream<T> getAllSorted(Connection conn) { return executeSelectAsStream(rowMapper, conn, true, calcSqlSelectAllSorted()); }
java
protected Stream<T> getAllSorted(Connection conn) { return executeSelectAsStream(rowMapper, conn, true, calcSqlSelectAllSorted()); }
[ "protected", "Stream", "<", "T", ">", "getAllSorted", "(", "Connection", "conn", ")", "{", "return", "executeSelectAsStream", "(", "rowMapper", ",", "conn", ",", "true", ",", "calcSqlSelectAllSorted", "(", ")", ")", ";", "}" ]
Fetch all existing BOs from storage, sorted by primary key(s) and return the result as a stream. @param conn @return @since 0.9.0
[ "Fetch", "all", "existing", "BOs", "from", "storage", "sorted", "by", "primary", "key", "(", "s", ")", "and", "return", "the", "result", "as", "a", "stream", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java#L616-L618
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java
Path3d.getPathIteratorProperty
@Pure public PathIterator3d getPathIteratorProperty(Transform3D transform, double flatness) { return new FlatteningPathIterator3d(getWindingRule(), getPathIteratorProperty(transform), flatness, 10); }
java
@Pure public PathIterator3d getPathIteratorProperty(Transform3D transform, double flatness) { return new FlatteningPathIterator3d(getWindingRule(), getPathIteratorProperty(transform), flatness, 10); }
[ "@", "Pure", "public", "PathIterator3d", "getPathIteratorProperty", "(", "Transform3D", "transform", ",", "double", "flatness", ")", "{", "return", "new", "FlatteningPathIterator3d", "(", "getWindingRule", "(", ")", ",", "getPathIteratorProperty", "(", "transform", ")...
Replies an iterator on the path elements. <p> Only {@link PathElementType#MOVE_TO}, {@link PathElementType#LINE_TO}, and {@link PathElementType#CLOSE} types are returned by the iterator. <p> The amount of subdivision of the curved segments is controlled by the flatness parameter, which specifies the maximum distance that any point on the unflattened transformed curve can deviate from the returned flattened path segments. Note that a limit on the accuracy of the flattened path might be silently imposed, causing very small flattening parameters to be treated as larger values. This limit, if there is one, is defined by the particular implementation that is used. <p> The iterator for this class is not multi-threaded safe. @param transform is an optional affine Transform3D to be applied to the coordinates as they are returned in the iteration, or <code>null</code> if untransformed coordinates are desired. @param flatness is the maximum distance that the line segments used to approximate the curved segments are allowed to deviate from any point on the original curve. @return an iterator on the path elements.
[ "Replies", "an", "iterator", "on", "the", "path", "elements", ".", "<p", ">", "Only", "{", "@link", "PathElementType#MOVE_TO", "}", "{", "@link", "PathElementType#LINE_TO", "}", "and", "{", "@link", "PathElementType#CLOSE", "}", "types", "are", "returned", "by",...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L1835-L1838
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/ThemeUtil.java
ThemeUtil.getString
public static String getString(@NonNull final Context context, @AttrRes final int resourceId) { return getString(context, -1, resourceId); }
java
public static String getString(@NonNull final Context context, @AttrRes final int resourceId) { return getString(context, -1, resourceId); }
[ "public", "static", "String", "getString", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "AttrRes", "final", "int", "resourceId", ")", "{", "return", "getString", "(", "context", ",", "-", "1", ",", "resourceId", ")", ";", "}" ]
Obtains the string, which corresponds to a specific resource id, from a context's theme. If the given resource id is invalid, a {@link NotFoundException} will be thrown. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource id of the attribute, which should be obtained, as an {@link Integer} value. The resource id must corresponds to a valid theme attribute @return The string, which has been obtained, as a {@link String}
[ "Obtains", "the", "string", "which", "corresponds", "to", "a", "specific", "resource", "id", "from", "a", "context", "s", "theme", ".", "If", "the", "given", "resource", "id", "is", "invalid", "a", "{", "@link", "NotFoundException", "}", "will", "be", "thr...
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ThemeUtil.java#L202-L204
alkacon/opencms-core
src/org/opencms/jsp/CmsJspActionElement.java
CmsJspActionElement.includeSilent
public void includeSilent(String target, String element) { try { include(target, element, null); } catch (Throwable t) { // ignore } }
java
public void includeSilent(String target, String element) { try { include(target, element, null); } catch (Throwable t) { // ignore } }
[ "public", "void", "includeSilent", "(", "String", "target", ",", "String", "element", ")", "{", "try", "{", "include", "(", "target", ",", "element", ",", "null", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// ignore", "}", "}" ]
Includes a named sub-element suppressing all Exceptions that occur during the include, otherwise the same as using {@link #include(String, String, Map)}.<p> This is a convenience method that allows to include elements on a page without checking if they exist or not. If the target element does not exist, nothing is printed to the JSP output.<p> @param target the target URI of the file in the OpenCms VFS (can be relative or absolute) @param element the element (template selector) to display from the target
[ "Includes", "a", "named", "sub", "-", "element", "suppressing", "all", "Exceptions", "that", "occur", "during", "the", "include", "otherwise", "the", "same", "as", "using", "{", "@link", "#include", "(", "String", "String", "Map", ")", "}", ".", "<p", ">" ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspActionElement.java#L587-L594
jenkinsci/jenkins
core/src/main/java/jenkins/org/apache/commons/validator/routines/DomainValidator.java
DomainValidator.isValidLocalTld
public boolean isValidLocalTld(String lTld) { final String key = chompLeadingDot(unicodeToASCII(lTld).toLowerCase(Locale.ENGLISH)); return arrayContains(LOCAL_TLDS, key); }
java
public boolean isValidLocalTld(String lTld) { final String key = chompLeadingDot(unicodeToASCII(lTld).toLowerCase(Locale.ENGLISH)); return arrayContains(LOCAL_TLDS, key); }
[ "public", "boolean", "isValidLocalTld", "(", "String", "lTld", ")", "{", "final", "String", "key", "=", "chompLeadingDot", "(", "unicodeToASCII", "(", "lTld", ")", ".", "toLowerCase", "(", "Locale", ".", "ENGLISH", ")", ")", ";", "return", "arrayContains", "...
Returns true if the specified <code>String</code> matches any widely used "local" domains (localhost or localdomain). Leading dots are ignored if present. The search is case-insensitive. @param lTld the parameter to check for local TLD status, not null @return true if the parameter is an local TLD
[ "Returns", "true", "if", "the", "specified", "<code", ">", "String<", "/", "code", ">", "matches", "any", "widely", "used", "local", "domains", "(", "localhost", "or", "localdomain", ")", ".", "Leading", "dots", "are", "ignored", "if", "present", ".", "The...
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/org/apache/commons/validator/routines/DomainValidator.java#L258-L261
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/AccountHeader.java
AccountHeader.setActiveProfile
public void setActiveProfile(IProfile profile, boolean fireOnProfileChanged) { final boolean isCurrentSelectedProfile = mAccountHeaderBuilder.switchProfiles(profile); //if the selectionList is shown we should also update the current selected profile in the list if (mAccountHeaderBuilder.mDrawer != null && isSelectionListShown()) { mAccountHeaderBuilder.mDrawer.setSelection(profile.getIdentifier(), false); } //fire the event if enabled and a listener is set if (fireOnProfileChanged && mAccountHeaderBuilder.mOnAccountHeaderListener != null) { mAccountHeaderBuilder.mOnAccountHeaderListener.onProfileChanged(null, profile, isCurrentSelectedProfile); } }
java
public void setActiveProfile(IProfile profile, boolean fireOnProfileChanged) { final boolean isCurrentSelectedProfile = mAccountHeaderBuilder.switchProfiles(profile); //if the selectionList is shown we should also update the current selected profile in the list if (mAccountHeaderBuilder.mDrawer != null && isSelectionListShown()) { mAccountHeaderBuilder.mDrawer.setSelection(profile.getIdentifier(), false); } //fire the event if enabled and a listener is set if (fireOnProfileChanged && mAccountHeaderBuilder.mOnAccountHeaderListener != null) { mAccountHeaderBuilder.mOnAccountHeaderListener.onProfileChanged(null, profile, isCurrentSelectedProfile); } }
[ "public", "void", "setActiveProfile", "(", "IProfile", "profile", ",", "boolean", "fireOnProfileChanged", ")", "{", "final", "boolean", "isCurrentSelectedProfile", "=", "mAccountHeaderBuilder", ".", "switchProfiles", "(", "profile", ")", ";", "//if the selectionList is sh...
Selects the given profile and sets it to the new active profile @param profile
[ "Selects", "the", "given", "profile", "and", "sets", "it", "to", "the", "new", "active", "profile" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/AccountHeader.java#L190-L200
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/AESUtils.java
AESUtils.createCipher
public static Cipher createCipher(int mode, byte[] keyData, byte[] iv, String cipherTransformation) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { if (StringUtils.isBlank(cipherTransformation)) { cipherTransformation = DEFAULT_CIPHER_TRANSFORMATION; } if (!cipherTransformation.startsWith("AES/ECB/")) { // non-ECB requires IV if (iv == null || iv.length == 0) { iv = DEFAULT_IV_BYTES; } } else { // must not use IV with ECB iv = null; } SecretKeySpec aesKey = new SecretKeySpec(keyData, CIPHER_ALGORITHM); Cipher cipher = Cipher.getInstance(cipherTransformation); if (iv == null) { cipher.init(mode, aesKey); } else { AlgorithmParameterSpec spec = cipherTransformation.startsWith("AES/GCM/") ? new GCMParameterSpec(128, iv) : new IvParameterSpec(iv); cipher.init(mode, aesKey, spec); } return cipher; }
java
public static Cipher createCipher(int mode, byte[] keyData, byte[] iv, String cipherTransformation) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { if (StringUtils.isBlank(cipherTransformation)) { cipherTransformation = DEFAULT_CIPHER_TRANSFORMATION; } if (!cipherTransformation.startsWith("AES/ECB/")) { // non-ECB requires IV if (iv == null || iv.length == 0) { iv = DEFAULT_IV_BYTES; } } else { // must not use IV with ECB iv = null; } SecretKeySpec aesKey = new SecretKeySpec(keyData, CIPHER_ALGORITHM); Cipher cipher = Cipher.getInstance(cipherTransformation); if (iv == null) { cipher.init(mode, aesKey); } else { AlgorithmParameterSpec spec = cipherTransformation.startsWith("AES/GCM/") ? new GCMParameterSpec(128, iv) : new IvParameterSpec(iv); cipher.init(mode, aesKey, spec); } return cipher; }
[ "public", "static", "Cipher", "createCipher", "(", "int", "mode", ",", "byte", "[", "]", "keyData", ",", "byte", "[", "]", "iv", ",", "String", "cipherTransformation", ")", "throws", "NoSuchAlgorithmException", ",", "NoSuchPaddingException", ",", "InvalidKeyExcept...
Create and initialize a {@link Cipher} instance. @param mode either {@link Cipher#ENCRYPT_MODE} or {@link Cipher#DECRYPT_MODE} @param keyData @param iv @param cipherTransformation @return @throws NoSuchPaddingException @throws NoSuchAlgorithmException @throws InvalidKeyException @throws InvalidAlgorithmParameterException @since 0.9.2
[ "Create", "and", "initialize", "a", "{", "@link", "Cipher", "}", "instance", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/AESUtils.java#L110-L136
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.existsStrongerInColumn
private boolean existsStrongerInColumn(INode source, INode target) { boolean result = false; char current = defautlMappings.getRelation(source, target); //compare with the other relations in the column for (INode i : defautlMappings.getSourceContext().getNodesList()) { if (i != source && defautlMappings.getRelation(i, target) != IMappingElement.IDK && isPrecedent(defautlMappings.getRelation(i, target), current)) { result = true; break; } } return result; }
java
private boolean existsStrongerInColumn(INode source, INode target) { boolean result = false; char current = defautlMappings.getRelation(source, target); //compare with the other relations in the column for (INode i : defautlMappings.getSourceContext().getNodesList()) { if (i != source && defautlMappings.getRelation(i, target) != IMappingElement.IDK && isPrecedent(defautlMappings.getRelation(i, target), current)) { result = true; break; } } return result; }
[ "private", "boolean", "existsStrongerInColumn", "(", "INode", "source", ",", "INode", "target", ")", "{", "boolean", "result", "=", "false", ";", "char", "current", "=", "defautlMappings", ".", "getRelation", "(", "source", ",", "target", ")", ";", "//compare ...
Checks if there is no other stronger relation in the same column. @param source source node @param target target node @return true if exists stronger relation in the same column, false otherwise.
[ "Checks", "if", "there", "is", "no", "other", "stronger", "relation", "in", "the", "same", "column", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L469-L484
Netflix/ndbench
ndbench-dynamodb-plugins/src/main/java/com/netflix/ndbench/plugin/dynamodb/DynamoDBProgrammaticKeyValue.java
DynamoDBProgrammaticKeyValue.createHighResolutionAlarm
private void createHighResolutionAlarm(String alarmName, String metricName, double threshold) { putMetricAlarm.apply(new PutMetricAlarmRequest() .withNamespace(CUSTOM_TABLE_METRICS_NAMESPACE) .withDimensions(tableDimension) .withMetricName(metricName) .withAlarmName(alarmName) .withStatistic(Statistic.Sum) .withUnit(StandardUnit.Count) .withComparisonOperator(ComparisonOperator.GreaterThanThreshold) .withDatapointsToAlarm(5).withEvaluationPeriods(5) //alarm when 5 out of 5 consecutive measurements are high .withActionsEnabled(false) //TODO add actions in a later PR .withPeriod(10) //high resolution alarm .withThreshold(10 * threshold)); }
java
private void createHighResolutionAlarm(String alarmName, String metricName, double threshold) { putMetricAlarm.apply(new PutMetricAlarmRequest() .withNamespace(CUSTOM_TABLE_METRICS_NAMESPACE) .withDimensions(tableDimension) .withMetricName(metricName) .withAlarmName(alarmName) .withStatistic(Statistic.Sum) .withUnit(StandardUnit.Count) .withComparisonOperator(ComparisonOperator.GreaterThanThreshold) .withDatapointsToAlarm(5).withEvaluationPeriods(5) //alarm when 5 out of 5 consecutive measurements are high .withActionsEnabled(false) //TODO add actions in a later PR .withPeriod(10) //high resolution alarm .withThreshold(10 * threshold)); }
[ "private", "void", "createHighResolutionAlarm", "(", "String", "alarmName", ",", "String", "metricName", ",", "double", "threshold", ")", "{", "putMetricAlarm", ".", "apply", "(", "new", "PutMetricAlarmRequest", "(", ")", ".", "withNamespace", "(", "CUSTOM_TABLE_MET...
A high-resolution alarm is one that is configured to fire on threshold breaches of high-resolution metrics. See this [announcement](https://aws.amazon.com/about-aws/whats-new/2017/07/amazon-cloudwatch-introduces-high-resolution-custom-metrics-and-alarms/). DynamoDB only publishes 1 minute consumed capacity metrics. By publishing high resolution consumed capacity metrics on the client side, you can react and alarm on spikes in load much quicker. @param alarmName name of the high resolution alarm to create @param metricName name of the metric to alarm on @param threshold threshold at which to alarm on after 5 breaches of the threshold
[ "A", "high", "-", "resolution", "alarm", "is", "one", "that", "is", "configured", "to", "fire", "on", "threshold", "breaches", "of", "high", "-", "resolution", "metrics", ".", "See", "this", "[", "announcement", "]", "(", "https", ":", "//", "aws", ".", ...
train
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dynamodb-plugins/src/main/java/com/netflix/ndbench/plugin/dynamodb/DynamoDBProgrammaticKeyValue.java#L169-L182
gfk-ba/senbot
SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java
ElementService.findExpectedFirstMatchedElement
public WebElement findExpectedFirstMatchedElement(int timeoutInSeconds, By... bys) { waitForLoaders(); StringBuilder potentialMatches = new StringBuilder(); for (By by : bys) { try { if (potentialMatches.length() > 0) { potentialMatches.append(", "); } potentialMatches.append(by.toString()); WebElement found = new WebDriverWait(getWebDriver(), timeoutInSeconds).until(ExpectedConditions .presenceOfElementLocated(by)); if (found != null) { return found; } } catch (WebDriverException nsee) { // keep checking } } fail("No matches found for: " + potentialMatches.toString()); return null; }
java
public WebElement findExpectedFirstMatchedElement(int timeoutInSeconds, By... bys) { waitForLoaders(); StringBuilder potentialMatches = new StringBuilder(); for (By by : bys) { try { if (potentialMatches.length() > 0) { potentialMatches.append(", "); } potentialMatches.append(by.toString()); WebElement found = new WebDriverWait(getWebDriver(), timeoutInSeconds).until(ExpectedConditions .presenceOfElementLocated(by)); if (found != null) { return found; } } catch (WebDriverException nsee) { // keep checking } } fail("No matches found for: " + potentialMatches.toString()); return null; }
[ "public", "WebElement", "findExpectedFirstMatchedElement", "(", "int", "timeoutInSeconds", ",", "By", "...", "bys", ")", "{", "waitForLoaders", "(", ")", ";", "StringBuilder", "potentialMatches", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "By", "by"...
From the passed array of {@link By}'s return the first {@link WebElement} found. The {@link By}'s will be processed in the order that they are passed in. If no element matches any of the {@link By}'s an {@link AssertionError} is thrown causing a test method calling this method to fail. @param timeoutInSeconds timeout to wait for elements to be found @param bys - array of {@link By} @return The first {@link WebElement} found @throws AssertionError if no {@link WebElement} is found or the search times out
[ "From", "the", "passed", "array", "of", "{", "@link", "By", "}", "s", "return", "the", "first", "{", "@link", "WebElement", "}", "found", ".", "The", "{", "@link", "By", "}", "s", "will", "be", "processed", "in", "the", "order", "that", "they", "are"...
train
https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java#L179-L199
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/DBObjectBatch.java
DBObjectBatch.addObject
public DBObject addObject(String objID, String tableName) { DBObject dbObj = new DBObject(objID, tableName); m_dbObjList.add(dbObj); return dbObj; }
java
public DBObject addObject(String objID, String tableName) { DBObject dbObj = new DBObject(objID, tableName); m_dbObjList.add(dbObj); return dbObj; }
[ "public", "DBObject", "addObject", "(", "String", "objID", ",", "String", "tableName", ")", "{", "DBObject", "dbObj", "=", "new", "DBObject", "(", "objID", ",", "tableName", ")", ";", "m_dbObjList", ".", "add", "(", "dbObj", ")", ";", "return", "dbObj", ...
Create a new DBObject with the given object ID and table name, add it to this DBObjectBatch, and return it. @param objID New DBObject's object ID, if any. @param tableName New DBObject's table name, if any. @return New DBObject.
[ "Create", "a", "new", "DBObject", "with", "the", "given", "object", "ID", "and", "table", "name", "add", "it", "to", "this", "DBObjectBatch", "and", "return", "it", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/DBObjectBatch.java#L303-L307
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsCopyToProject.java
CmsCopyToProject.actionCopyToProject
public void actionCopyToProject() throws JspException { // save initialized instance of this class in request attribute for included sub-elements getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this); try { // copy the resource to the current project getCms().copyResourceToProject(getParamResource()); // close the dialog actionCloseDialog(); } catch (Throwable e) { // error copying resource to project, include error page includeErrorpage(this, e); } }
java
public void actionCopyToProject() throws JspException { // save initialized instance of this class in request attribute for included sub-elements getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this); try { // copy the resource to the current project getCms().copyResourceToProject(getParamResource()); // close the dialog actionCloseDialog(); } catch (Throwable e) { // error copying resource to project, include error page includeErrorpage(this, e); } }
[ "public", "void", "actionCopyToProject", "(", ")", "throws", "JspException", "{", "// save initialized instance of this class in request attribute for included sub-elements", "getJsp", "(", ")", ".", "getRequest", "(", ")", ".", "setAttribute", "(", "SESSION_WORKPLACE_CLASS", ...
Performs the copy to project action, will be called by the JSP page.<p> @throws JspException if problems including sub-elements occur
[ "Performs", "the", "copy", "to", "project", "action", "will", "be", "called", "by", "the", "JSP", "page", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsCopyToProject.java#L97-L110
brettwooldridge/SansOrm
src/main/java/com/zaxxer/sansorm/SqlClosureElf.java
SqlClosureElf.executeQuery
public static ResultSet executeQuery(Connection connection, String sql, Object... args) throws SQLException { return OrmReader.statementToResultSet(connection.prepareStatement(sql), args); }
java
public static ResultSet executeQuery(Connection connection, String sql, Object... args) throws SQLException { return OrmReader.statementToResultSet(connection.prepareStatement(sql), args); }
[ "public", "static", "ResultSet", "executeQuery", "(", "Connection", "connection", ",", "String", "sql", ",", "Object", "...", "args", ")", "throws", "SQLException", "{", "return", "OrmReader", ".", "statementToResultSet", "(", "connection", ".", "prepareStatement", ...
Execute the specified SQL as a PreparedStatement with the specified arguments. @param connection a Connection @param sql the SQL statement to prepare and execute @param args the optional arguments to execute with the query @return a ResultSet object @throws SQLException if a {@link SQLException} occurs
[ "Execute", "the", "specified", "SQL", "as", "a", "PreparedStatement", "with", "the", "specified", "arguments", "." ]
train
https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L226-L229
zerodhatech/javakiteconnect
kiteconnect/src/com/zerodhatech/kiteconnect/kitehttp/KiteRequestHandler.java
KiteRequestHandler.getRequest
public JSONObject getRequest(String url, String apiKey, String accessToken) throws IOException, KiteException, JSONException { Request request = createGetRequest(url, apiKey, accessToken); Response response = client.newCall(request).execute(); String body = response.body().string(); return new KiteResponseHandler().handle(response, body); }
java
public JSONObject getRequest(String url, String apiKey, String accessToken) throws IOException, KiteException, JSONException { Request request = createGetRequest(url, apiKey, accessToken); Response response = client.newCall(request).execute(); String body = response.body().string(); return new KiteResponseHandler().handle(response, body); }
[ "public", "JSONObject", "getRequest", "(", "String", "url", ",", "String", "apiKey", ",", "String", "accessToken", ")", "throws", "IOException", ",", "KiteException", ",", "JSONException", "{", "Request", "request", "=", "createGetRequest", "(", "url", ",", "api...
Makes a GET request. @return JSONObject which is received by Kite Trade. @param url is the endpoint to which request has to be sent. @param apiKey is the api key of the Kite Connect app. @param accessToken is the access token obtained after successful login process. @throws IOException is thrown when there is a connection related error. @throws KiteException is thrown for all Kite Trade related errors. @throws JSONException is thrown for parsing errors.
[ "Makes", "a", "GET", "request", "." ]
train
https://github.com/zerodhatech/javakiteconnect/blob/4a3f15ff2c8a1b3b6ec61799f8bb047e4dfeb92d/kiteconnect/src/com/zerodhatech/kiteconnect/kitehttp/KiteRequestHandler.java#L49-L54
citrusframework/citrus
modules/citrus-websocket/src/main/java/com/consol/citrus/websocket/handler/WebSocketUrlHandlerMapping.java
WebSocketUrlHandlerMapping.postRegisterUrlHandlers
public void postRegisterUrlHandlers(Map<String, Object> wsHandlers) { registerHandlers(wsHandlers); for (Object handler : wsHandlers.values()) { if (handler instanceof Lifecycle) { ((Lifecycle) handler).start(); } } }
java
public void postRegisterUrlHandlers(Map<String, Object> wsHandlers) { registerHandlers(wsHandlers); for (Object handler : wsHandlers.values()) { if (handler instanceof Lifecycle) { ((Lifecycle) handler).start(); } } }
[ "public", "void", "postRegisterUrlHandlers", "(", "Map", "<", "String", ",", "Object", ">", "wsHandlers", ")", "{", "registerHandlers", "(", "wsHandlers", ")", ";", "for", "(", "Object", "handler", ":", "wsHandlers", ".", "values", "(", ")", ")", "{", "if"...
Workaround for registering the WebSocket request handlers, after the spring context has been initialised. @param wsHandlers
[ "Workaround", "for", "registering", "the", "WebSocket", "request", "handlers", "after", "the", "spring", "context", "has", "been", "initialised", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-websocket/src/main/java/com/consol/citrus/websocket/handler/WebSocketUrlHandlerMapping.java#L36-L44
apache/flink
flink-core/src/main/java/org/apache/flink/types/Record.java
Record.getFieldsIntoCheckingNull
public void getFieldsIntoCheckingNull(int[] positions, Value[] targets) { for (int i = 0; i < positions.length; i++) { if (!getFieldInto(positions[i], targets[i])) { throw new NullKeyFieldException(i); } } }
java
public void getFieldsIntoCheckingNull(int[] positions, Value[] targets) { for (int i = 0; i < positions.length; i++) { if (!getFieldInto(positions[i], targets[i])) { throw new NullKeyFieldException(i); } } }
[ "public", "void", "getFieldsIntoCheckingNull", "(", "int", "[", "]", "positions", ",", "Value", "[", "]", "targets", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "positions", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", ...
Gets the fields at the given positions into an array. If at any position a field is null, then this method throws a @link NullKeyFieldException. All fields that have been successfully read until the failing read are correctly contained in the record. All other fields are not set. @param positions The positions of the fields to get. @param targets The values into which the content of the fields is put. @throws NullKeyFieldException in case of a failing field read.
[ "Gets", "the", "fields", "at", "the", "given", "positions", "into", "an", "array", ".", "If", "at", "any", "position", "a", "field", "is", "null", "then", "this", "method", "throws", "a", "@link", "NullKeyFieldException", ".", "All", "fields", "that", "hav...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Record.java#L357-L363
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/DefaultMessageHeaderValidator.java
DefaultMessageHeaderValidator.getHeaderName
private String getHeaderName(String name, Map<String, Object> receivedHeaders, TestContext context, HeaderValidationContext validationContext) { String headerName = context.resolveDynamicValue(name); if (!receivedHeaders.containsKey(headerName) && validationContext.isHeaderNameIgnoreCase()) { String key = headerName; log.debug(String.format("Finding case insensitive header for key '%s'", key)); headerName = receivedHeaders .entrySet() .parallelStream() .filter(item -> item.getKey().equalsIgnoreCase(key)) .map(Map.Entry::getKey) .findFirst() .orElseThrow(() -> new ValidationException("Validation failed: No matching header for key '" + key + "'")); log.info(String.format("Found matching case insensitive header name: %s", headerName)); } return headerName; }
java
private String getHeaderName(String name, Map<String, Object> receivedHeaders, TestContext context, HeaderValidationContext validationContext) { String headerName = context.resolveDynamicValue(name); if (!receivedHeaders.containsKey(headerName) && validationContext.isHeaderNameIgnoreCase()) { String key = headerName; log.debug(String.format("Finding case insensitive header for key '%s'", key)); headerName = receivedHeaders .entrySet() .parallelStream() .filter(item -> item.getKey().equalsIgnoreCase(key)) .map(Map.Entry::getKey) .findFirst() .orElseThrow(() -> new ValidationException("Validation failed: No matching header for key '" + key + "'")); log.info(String.format("Found matching case insensitive header name: %s", headerName)); } return headerName; }
[ "private", "String", "getHeaderName", "(", "String", "name", ",", "Map", "<", "String", ",", "Object", ">", "receivedHeaders", ",", "TestContext", "context", ",", "HeaderValidationContext", "validationContext", ")", "{", "String", "headerName", "=", "context", "."...
Get header name from control message but also check if header expression is a variable or function. In addition to that find case insensitive header name in received message when feature is activated. @param name @param receivedHeaders @param context @param validationContext @return
[ "Get", "header", "name", "from", "control", "message", "but", "also", "check", "if", "header", "expression", "is", "a", "variable", "or", "function", ".", "In", "addition", "to", "that", "find", "case", "insensitive", "header", "name", "in", "received", "mes...
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/DefaultMessageHeaderValidator.java#L106-L127
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/util/concurrent/Monitor.java
Monitor.waitFor
public boolean waitFor(Guard guard, long time, TimeUnit unit) throws InterruptedException { final long timeoutNanos = toSafeNanos(time, unit); if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) { throw new IllegalMonitorStateException(); } if (guard.isSatisfied()) { return true; } if (Thread.interrupted()) { throw new InterruptedException(); } return awaitNanos(guard, timeoutNanos, true); }
java
public boolean waitFor(Guard guard, long time, TimeUnit unit) throws InterruptedException { final long timeoutNanos = toSafeNanos(time, unit); if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) { throw new IllegalMonitorStateException(); } if (guard.isSatisfied()) { return true; } if (Thread.interrupted()) { throw new InterruptedException(); } return awaitNanos(guard, timeoutNanos, true); }
[ "public", "boolean", "waitFor", "(", "Guard", "guard", ",", "long", "time", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "final", "long", "timeoutNanos", "=", "toSafeNanos", "(", "time", ",", "unit", ")", ";", "if", "(", "!", "(", ...
Waits for the guard to be satisfied. Waits at most the given time, and may be interrupted. May be called only by a thread currently occupying this monitor. @return whether the guard is now satisfied @throws InterruptedException if interrupted while waiting
[ "Waits", "for", "the", "guard", "to", "be", "satisfied", ".", "Waits", "at", "most", "the", "given", "time", "and", "may", "be", "interrupted", ".", "May", "be", "called", "only", "by", "a", "thread", "currently", "occupying", "this", "monitor", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/Monitor.java#L762-L774
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.updateAsync
public Observable<VirtualMachineScaleSetInner> updateAsync(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, parameters).map(new Func1<ServiceResponse<VirtualMachineScaleSetInner>, VirtualMachineScaleSetInner>() { @Override public VirtualMachineScaleSetInner call(ServiceResponse<VirtualMachineScaleSetInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineScaleSetInner> updateAsync(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, parameters).map(new Func1<ServiceResponse<VirtualMachineScaleSetInner>, VirtualMachineScaleSetInner>() { @Override public VirtualMachineScaleSetInner call(ServiceResponse<VirtualMachineScaleSetInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineScaleSetInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "VirtualMachineScaleSetUpdate", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupNam...
Update a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set to create or update. @param parameters The scale set object. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Update", "a", "VM", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L404-L411
betfair/cougar
baseline/baseline-app/src/main/java/com/betfair/cougar/baseline/BaselineServiceImpl.java
BaselineServiceImpl.subscribeToTimeTick
@Override public void subscribeToTimeTick(ExecutionContext ctx, Object[] args, ExecutionObserver executionObserver) { if (getEventTransportIdentity(ctx).getPrincipal().getName().equals(SONIC_TRANSPORT_INSTANCE_ONE)) { this.timeTickPublishingObserver = executionObserver; } }
java
@Override public void subscribeToTimeTick(ExecutionContext ctx, Object[] args, ExecutionObserver executionObserver) { if (getEventTransportIdentity(ctx).getPrincipal().getName().equals(SONIC_TRANSPORT_INSTANCE_ONE)) { this.timeTickPublishingObserver = executionObserver; } }
[ "@", "Override", "public", "void", "subscribeToTimeTick", "(", "ExecutionContext", "ctx", ",", "Object", "[", "]", "args", ",", "ExecutionObserver", "executionObserver", ")", "{", "if", "(", "getEventTransportIdentity", "(", "ctx", ")", ".", "getPrincipal", "(", ...
Please note that this Service method is called by the Execution Venue to establish a communication channel from the transport to the Application to publish events. In essence, the transport subscribes to the app, so this method is called once for each publisher. The application should hold onto the passed in observer, and call onResult on that observer to emit an event. @param ctx @param args @param executionObserver
[ "Please", "note", "that", "this", "Service", "method", "is", "called", "by", "the", "Execution", "Venue", "to", "establish", "a", "communication", "channel", "from", "the", "transport", "to", "the", "Application", "to", "publish", "events", ".", "In", "essence...
train
https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/baseline/baseline-app/src/main/java/com/betfair/cougar/baseline/BaselineServiceImpl.java#L1913-L1918
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java
Settings.getStringArray
public String[] getStringArray(String key) { String effectiveKey = definitions.validKey(key); Optional<PropertyDefinition> def = getDefinition(effectiveKey); if ((def.isPresent()) && (def.get().multiValues())) { String value = getString(key); if (value == null) { return ArrayUtils.EMPTY_STRING_ARRAY; } List<String> values = new ArrayList<>(); for (String v : Splitter.on(",").trimResults().split(value)) { values.add(v.replace("%2C", ",")); } return values.toArray(new String[values.size()]); } return getStringArrayBySeparator(key, ","); }
java
public String[] getStringArray(String key) { String effectiveKey = definitions.validKey(key); Optional<PropertyDefinition> def = getDefinition(effectiveKey); if ((def.isPresent()) && (def.get().multiValues())) { String value = getString(key); if (value == null) { return ArrayUtils.EMPTY_STRING_ARRAY; } List<String> values = new ArrayList<>(); for (String v : Splitter.on(",").trimResults().split(value)) { values.add(v.replace("%2C", ",")); } return values.toArray(new String[values.size()]); } return getStringArrayBySeparator(key, ","); }
[ "public", "String", "[", "]", "getStringArray", "(", "String", "key", ")", "{", "String", "effectiveKey", "=", "definitions", ".", "validKey", "(", "key", ")", ";", "Optional", "<", "PropertyDefinition", ">", "def", "=", "getDefinition", "(", "effectiveKey", ...
Value is split by comma and trimmed. Never returns null. <br> Examples : <ul> <li>"one,two,three " -&gt; ["one", "two", "three"]</li> <li>" one, two, three " -&gt; ["one", "two", "three"]</li> <li>"one, , three" -&gt; ["one", "", "three"]</li> </ul>
[ "Value", "is", "split", "by", "comma", "and", "trimmed", ".", "Never", "returns", "null", ".", "<br", ">", "Examples", ":", "<ul", ">", "<li", ">", "one", "two", "three", "-", "&gt", ";", "[", "one", "two", "three", "]", "<", "/", "li", ">", "<li...
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java#L272-L289
palatable/lambda
src/main/java/com/jnape/palatable/lambda/adt/Either.java
Either.orThrow
public final <T extends Throwable> R orThrow(Function<? super L, ? extends T> throwableFn) throws T { return match((CheckedFn1<T, L, R>) l -> { throw throwableFn.apply(l); }, id()); }
java
public final <T extends Throwable> R orThrow(Function<? super L, ? extends T> throwableFn) throws T { return match((CheckedFn1<T, L, R>) l -> { throw throwableFn.apply(l); }, id()); }
[ "public", "final", "<", "T", "extends", "Throwable", ">", "R", "orThrow", "(", "Function", "<", "?", "super", "L", ",", "?", "extends", "T", ">", "throwableFn", ")", "throws", "T", "{", "return", "match", "(", "(", "CheckedFn1", "<", "T", ",", "L", ...
Return the wrapped value if this is a right; otherwise, map the wrapped left value to a <code>T</code> and throw it. @param throwableFn a function from L to T @param <T> the left parameter type (the throwable type) @return the wrapped value if this is a right @throws T the result of applying the wrapped left value to throwableFn, if this is a left
[ "Return", "the", "wrapped", "value", "if", "this", "is", "a", "right", ";", "otherwise", "map", "the", "wrapped", "left", "value", "to", "a", "<code", ">", "T<", "/", "code", ">", "and", "throw", "it", "." ]
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Either.java#L85-L89
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java
XNodeSet.lessThanOrEqual
public boolean lessThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_LTE); }
java
public boolean lessThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_LTE); }
[ "public", "boolean", "lessThanOrEqual", "(", "XObject", "obj2", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "return", "compare", "(", "obj2", ",", "S_LTE", ")", ";", "}" ]
Tell if one object is less than or equal to the other. @param obj2 object to compare this nodeset to @return see this.compare(...) @throws javax.xml.transform.TransformerException
[ "Tell", "if", "one", "object", "is", "less", "than", "or", "equal", "to", "the", "other", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L658-L661
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendText
public static <T> void sendText(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context, long timeoutmillis) { sendInternal(pooledData, WebSocketFrameType.TEXT, wsChannel, callback, context, timeoutmillis); }
java
public static <T> void sendText(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context, long timeoutmillis) { sendInternal(pooledData, WebSocketFrameType.TEXT, wsChannel, callback, context, timeoutmillis); }
[ "public", "static", "<", "T", ">", "void", "sendText", "(", "final", "PooledByteBuffer", "pooledData", ",", "final", "WebSocketChannel", "wsChannel", ",", "final", "WebSocketCallback", "<", "T", ">", "callback", ",", "T", "context", ",", "long", "timeoutmillis",...
Sends a complete text message, invoking the callback when complete Automatically frees the pooled byte buffer when done. @param pooledData The data to send, it will be freed when done @param wsChannel The web socket channel @param callback The callback to invoke on completion @param context The context object that will be passed to the callback on completion @param timeoutmillis the timeout in milliseconds
[ "Sends", "a", "complete", "text", "message", "invoking", "the", "callback", "when", "complete", "Automatically", "frees", "the", "pooled", "byte", "buffer", "when", "done", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L188-L190
olivergondza/dumpling
core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java
ProcessThread.waitingOnLock
public static @Nonnull Predicate waitingOnLock(final @Nonnull String className) { return new Predicate() { @Override public boolean isValid(@Nonnull ProcessThread<?, ?, ?> thread) { final ThreadLock lock = thread.getWaitingOnLock(); return lock != null && lock.getClassName().equals(className); } }; }
java
public static @Nonnull Predicate waitingOnLock(final @Nonnull String className) { return new Predicate() { @Override public boolean isValid(@Nonnull ProcessThread<?, ?, ?> thread) { final ThreadLock lock = thread.getWaitingOnLock(); return lock != null && lock.getClassName().equals(className); } }; }
[ "public", "static", "@", "Nonnull", "Predicate", "waitingOnLock", "(", "final", "@", "Nonnull", "String", "className", ")", "{", "return", "new", "Predicate", "(", ")", "{", "@", "Override", "public", "boolean", "isValid", "(", "@", "Nonnull", "ProcessThread",...
Match waiting thread waiting for given thread to be notified.
[ "Match", "waiting", "thread", "waiting", "for", "given", "thread", "to", "be", "notified", "." ]
train
https://github.com/olivergondza/dumpling/blob/ac698735fcc7c023db0c1637cc1f522cb3576c7f/core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java#L540-L548
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.toCompoundCurveFromList
public CompoundCurve toCompoundCurveFromList(List<List<LatLng>> polylineList) { return toCompoundCurveFromList(polylineList, false, false); }
java
public CompoundCurve toCompoundCurveFromList(List<List<LatLng>> polylineList) { return toCompoundCurveFromList(polylineList, false, false); }
[ "public", "CompoundCurve", "toCompoundCurveFromList", "(", "List", "<", "List", "<", "LatLng", ">", ">", "polylineList", ")", "{", "return", "toCompoundCurveFromList", "(", "polylineList", ",", "false", ",", "false", ")", ";", "}" ]
Convert a list of List<LatLng> to a {@link CompoundCurve} @param polylineList polyline list @return compound curve
[ "Convert", "a", "list", "of", "List<LatLng", ">", "to", "a", "{", "@link", "CompoundCurve", "}" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L891-L893
geomajas/geomajas-project-client-gwt
plugin/widget-searchandfilter/searchandfilter/src/main/java/org/geomajas/widget/searchandfilter/service/SearchFavouritesServiceInMemoryImpl.java
SearchFavouritesServiceInMemoryImpl.deleteSearchFavourite
public void deleteSearchFavourite(SearchFavourite sf) throws IOException { synchronized (lock) { if (sf == null || sf.getId() == null) { throw new IllegalArgumentException("null, or id not set!"); } else { allFavourites.remove(sf.getId()); if (sf.isShared()) { sharedFavourites.remove(sf.getId()); } else { if (sf.getCreator() != null) { Map<Long, SearchFavourite> favs = privateFavourites.get(sf.getCreator()); if (favs != null) { favs.remove(sf.getId()); } } else { log.warn("Creator is not set! I'm not checking all users so I'm giving up."); } } } } }
java
public void deleteSearchFavourite(SearchFavourite sf) throws IOException { synchronized (lock) { if (sf == null || sf.getId() == null) { throw new IllegalArgumentException("null, or id not set!"); } else { allFavourites.remove(sf.getId()); if (sf.isShared()) { sharedFavourites.remove(sf.getId()); } else { if (sf.getCreator() != null) { Map<Long, SearchFavourite> favs = privateFavourites.get(sf.getCreator()); if (favs != null) { favs.remove(sf.getId()); } } else { log.warn("Creator is not set! I'm not checking all users so I'm giving up."); } } } } }
[ "public", "void", "deleteSearchFavourite", "(", "SearchFavourite", "sf", ")", "throws", "IOException", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "sf", "==", "null", "||", "sf", ".", "getId", "(", ")", "==", "null", ")", "{", "throw", "new", ...
If creator is not set, only shared favourites will be checked (if shared)!
[ "If", "creator", "is", "not", "set", "only", "shared", "favourites", "will", "be", "checked", "(", "if", "shared", ")", "!" ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter/src/main/java/org/geomajas/widget/searchandfilter/service/SearchFavouritesServiceInMemoryImpl.java#L81-L101
alkacon/opencms-core
src/org/opencms/importexport/CmsImportVersion7.java
CmsImportVersion7.addAccountsGroupRules
protected void addAccountsGroupRules(Digester digester, String xpath) { String xp_group = xpath + N_GROUPS + "/" + N_GROUP; digester.addCallMethod(xp_group, "importGroup"); xp_group += "/"; digester.addCallMethod(xp_group + N_NAME, "setGroupName", 0); digester.addCallMethod(xp_group + N_DESCRIPTION, "setGroupDescription", 0); digester.addCallMethod(xp_group + N_FLAGS, "setGroupFlags", 0); digester.addCallMethod(xp_group + N_PARENTGROUP, "setGroupParent", 0); }
java
protected void addAccountsGroupRules(Digester digester, String xpath) { String xp_group = xpath + N_GROUPS + "/" + N_GROUP; digester.addCallMethod(xp_group, "importGroup"); xp_group += "/"; digester.addCallMethod(xp_group + N_NAME, "setGroupName", 0); digester.addCallMethod(xp_group + N_DESCRIPTION, "setGroupDescription", 0); digester.addCallMethod(xp_group + N_FLAGS, "setGroupFlags", 0); digester.addCallMethod(xp_group + N_PARENTGROUP, "setGroupParent", 0); }
[ "protected", "void", "addAccountsGroupRules", "(", "Digester", "digester", ",", "String", "xpath", ")", "{", "String", "xp_group", "=", "xpath", "+", "N_GROUPS", "+", "\"/\"", "+", "N_GROUP", ";", "digester", ".", "addCallMethod", "(", "xp_group", ",", "\"impo...
Adds the XML digester rules for groups.<p> @param digester the digester to add the rules to @param xpath the base xpath for the rules
[ "Adds", "the", "XML", "digester", "rules", "for", "groups", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportVersion7.java#L2976-L2985
twilio/twilio-java
src/main/java/com/twilio/rest/messaging/v1/SessionReader.java
SessionReader.nextPage
@Override public Page<Session> nextPage(final Page<Session> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.MESSAGING.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<Session> nextPage(final Page<Session> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.MESSAGING.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "Session", ">", "nextPage", "(", "final", "Page", "<", "Session", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", ",", ...
Retrieve the next page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Next Page
[ "Retrieve", "the", "next", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/messaging/v1/SessionReader.java#L84-L95
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFunctionConfig.java
CollisionFunctionConfig.exports
public static void exports(Xml root, CollisionFunction function) { Check.notNull(root); Check.notNull(function); final Xml node = root.createChild(FUNCTION); if (function instanceof CollisionFunctionLinear) { final CollisionFunctionLinear linear = (CollisionFunctionLinear) function; node.writeString(TYPE, CollisionFunctionType.LINEAR.name()); node.writeDouble(A, linear.getA()); node.writeDouble(B, linear.getB()); } else { node.writeString(TYPE, String.valueOf(function.getType())); } }
java
public static void exports(Xml root, CollisionFunction function) { Check.notNull(root); Check.notNull(function); final Xml node = root.createChild(FUNCTION); if (function instanceof CollisionFunctionLinear) { final CollisionFunctionLinear linear = (CollisionFunctionLinear) function; node.writeString(TYPE, CollisionFunctionType.LINEAR.name()); node.writeDouble(A, linear.getA()); node.writeDouble(B, linear.getB()); } else { node.writeString(TYPE, String.valueOf(function.getType())); } }
[ "public", "static", "void", "exports", "(", "Xml", "root", ",", "CollisionFunction", "function", ")", "{", "Check", ".", "notNull", "(", "root", ")", ";", "Check", ".", "notNull", "(", "function", ")", ";", "final", "Xml", "node", "=", "root", ".", "cr...
Export the collision function data as a node. @param root The node root (must not be <code>null</code>). @param function The collision function to export (must not be <code>null</code>). @throws LionEngineException If error on writing.
[ "Export", "the", "collision", "function", "data", "as", "a", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFunctionConfig.java#L83-L100
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.getAsync
public CompletableFuture<Object> getAsync(final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> get(configuration), getExecutor()); }
java
public CompletableFuture<Object> getAsync(final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> get(configuration), getExecutor()); }
[ "public", "CompletableFuture", "<", "Object", ">", "getAsync", "(", "final", "Consumer", "<", "HttpConfig", ">", "configuration", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", "->", "get", "(", "configuration", ")", ",", "getExecu...
Executes an asynchronous GET request on the configured URI (asynchronous alias to `get(Consumer)`), with additional configuration provided by the configuration function. This method is generally used for Java-specific configuration. [source,java] ---- HttpBuilder http = HttpBuilder.configure(config -> { config.getRequest().setUri("http://localhost:10101"); }); CompletableFuture<Object> future = http.getAsync(config -> { config.getRequest().getUri().setPath("/foo"); }); Object result = future.get(); ---- The `configuration` function allows additional configuration for this request based on the {@link HttpConfig} interface. @param configuration the additional configuration closure (delegated to {@link HttpConfig}) @return the resulting content wrapped in a {@link CompletableFuture}
[ "Executes", "an", "asynchronous", "GET", "request", "on", "the", "configured", "URI", "(", "asynchronous", "alias", "to", "get", "(", "Consumer", ")", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "function", "." ]
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L440-L442
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/GrowingSparseMatrix.java
GrowingSparseMatrix.set
public void set(int row, int col, double val) { checkIndices(row, col); // Check whether the dimensions need to be updated if (row + 1 > rows) rows = row + 1; if (col + 1 > cols) cols = col + 1; updateRow(row).set(col, val); }
java
public void set(int row, int col, double val) { checkIndices(row, col); // Check whether the dimensions need to be updated if (row + 1 > rows) rows = row + 1; if (col + 1 > cols) cols = col + 1; updateRow(row).set(col, val); }
[ "public", "void", "set", "(", "int", "row", ",", "int", "col", ",", "double", "val", ")", "{", "checkIndices", "(", "row", ",", "col", ")", ";", "// Check whether the dimensions need to be updated", "if", "(", "row", "+", "1", ">", "rows", ")", "rows", "...
{@inheritDoc} <p>The size of the matrix will be expanded if either row or col is larger than the largest previously seen row or column value. When the matrix is expanded by either dimension, the values for the new row/column will all be assumed to be zero.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/GrowingSparseMatrix.java#L200-L210
Tourenathan-G5organisation/SiliCompressor
silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java
SiliCompressor.compressVideo
public String compressVideo(String videoFilePath, String destinationDir) throws URISyntaxException { return compressVideo(videoFilePath, destinationDir, 0, 0, 0); }
java
public String compressVideo(String videoFilePath, String destinationDir) throws URISyntaxException { return compressVideo(videoFilePath, destinationDir, 0, 0, 0); }
[ "public", "String", "compressVideo", "(", "String", "videoFilePath", ",", "String", "destinationDir", ")", "throws", "URISyntaxException", "{", "return", "compressVideo", "(", "videoFilePath", ",", "destinationDir", ",", "0", ",", "0", ",", "0", ")", ";", "}" ]
Perform background video compression. Make sure the videofileUri and destinationUri are valid resources because this method does not account for missing directories hence your converted file could be in an unknown location This uses default values for the converted videos @param videoFilePath source path for the video file @param destinationDir destination directory where converted file should be saved @return The Path of the compressed video file
[ "Perform", "background", "video", "compression", ".", "Make", "sure", "the", "videofileUri", "and", "destinationUri", "are", "valid", "resources", "because", "this", "method", "does", "not", "account", "for", "missing", "directories", "hence", "your", "converted", ...
train
https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L315-L317
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/ContentSpec.java
ContentSpec.appendChild
protected void appendChild(final Node child, boolean checkForType) { if (checkForType && child instanceof KeyValueNode) { appendKeyValueNode((KeyValueNode<?>) child); } else if (checkForType && child instanceof Level) { getBaseLevel().appendChild(child); } else if (checkForType && child instanceof SpecTopic) { getBaseLevel().appendChild(child); } else { nodes.add(child); if (child.getParent() != null) { child.removeParent(); } child.setParent(this); } }
java
protected void appendChild(final Node child, boolean checkForType) { if (checkForType && child instanceof KeyValueNode) { appendKeyValueNode((KeyValueNode<?>) child); } else if (checkForType && child instanceof Level) { getBaseLevel().appendChild(child); } else if (checkForType && child instanceof SpecTopic) { getBaseLevel().appendChild(child); } else { nodes.add(child); if (child.getParent() != null) { child.removeParent(); } child.setParent(this); } }
[ "protected", "void", "appendChild", "(", "final", "Node", "child", ",", "boolean", "checkForType", ")", "{", "if", "(", "checkForType", "&&", "child", "instanceof", "KeyValueNode", ")", "{", "appendKeyValueNode", "(", "(", "KeyValueNode", "<", "?", ">", ")", ...
Adds a Child node to the Content Spec. If the Child node already has a parent, then it is removed from that parent and added to this content spec. @param child A Child Node to be added to the ContentSpec. @param checkForType If the method should check the type of the child, and use a type specific method instead.
[ "Adds", "a", "Child", "node", "to", "the", "Content", "Spec", ".", "If", "the", "Child", "node", "already", "has", "a", "parent", "then", "it", "is", "removed", "from", "that", "parent", "and", "added", "to", "this", "content", "spec", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/ContentSpec.java#L2214-L2228
gallandarakhneorg/afc
advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileField.java
DBaseFileField.updateSizes
@SuppressWarnings("checkstyle:cyclomaticcomplexity") void updateSizes(int fieldLength, int decimalPointPosition) { switch (this.type) { case STRING: if (fieldLength > this.length) { this.length = fieldLength; } break; case FLOATING_NUMBER: case NUMBER: if (decimalPointPosition > this.decimal) { final int intPart = this.length - this.decimal; this.decimal = decimalPointPosition; this.length = intPart + this.decimal; } if (fieldLength > this.length) { this.length = fieldLength; } break; //$CASES-OMITTED$ default: // Do nothing } }
java
@SuppressWarnings("checkstyle:cyclomaticcomplexity") void updateSizes(int fieldLength, int decimalPointPosition) { switch (this.type) { case STRING: if (fieldLength > this.length) { this.length = fieldLength; } break; case FLOATING_NUMBER: case NUMBER: if (decimalPointPosition > this.decimal) { final int intPart = this.length - this.decimal; this.decimal = decimalPointPosition; this.length = intPart + this.decimal; } if (fieldLength > this.length) { this.length = fieldLength; } break; //$CASES-OMITTED$ default: // Do nothing } }
[ "@", "SuppressWarnings", "(", "\"checkstyle:cyclomaticcomplexity\"", ")", "void", "updateSizes", "(", "int", "fieldLength", ",", "int", "decimalPointPosition", ")", "{", "switch", "(", "this", ".", "type", ")", "{", "case", "STRING", ":", "if", "(", "fieldLength...
Update the sizes with the given ones if and only if they are greater than the existing ones. This test is done according to the type of the field. @param fieldLength is the size of this field @param decimalPointPosition is the position of the decimal point.
[ "Update", "the", "sizes", "with", "the", "given", "ones", "if", "and", "only", "if", "they", "are", "greater", "than", "the", "existing", "ones", ".", "This", "test", "is", "done", "according", "to", "the", "type", "of", "the", "field", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileField.java#L254-L277
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyJs.java
RecurlyJs.getRecurlySignature
public static String getRecurlySignature(String privateJsKey, Long unixTime, String nonce, List<String> extraParams) { // Mandatory parameters shared by all signatures (as per spec) extraParams = (extraParams == null) ? new ArrayList<String>() : extraParams; extraParams.add(String.format(PARAMETER_FORMAT, TIMESTAMP_PARAMETER, unixTime)); extraParams.add(String.format(PARAMETER_FORMAT, NONCE_PARAMETER, nonce)); String protectedParams = Joiner.on(PARAMETER_SEPARATOR).join(extraParams); return generateRecurlyHMAC(privateJsKey, protectedParams) + "|" + protectedParams; }
java
public static String getRecurlySignature(String privateJsKey, Long unixTime, String nonce, List<String> extraParams) { // Mandatory parameters shared by all signatures (as per spec) extraParams = (extraParams == null) ? new ArrayList<String>() : extraParams; extraParams.add(String.format(PARAMETER_FORMAT, TIMESTAMP_PARAMETER, unixTime)); extraParams.add(String.format(PARAMETER_FORMAT, NONCE_PARAMETER, nonce)); String protectedParams = Joiner.on(PARAMETER_SEPARATOR).join(extraParams); return generateRecurlyHMAC(privateJsKey, protectedParams) + "|" + protectedParams; }
[ "public", "static", "String", "getRecurlySignature", "(", "String", "privateJsKey", ",", "Long", "unixTime", ",", "String", "nonce", ",", "List", "<", "String", ">", "extraParams", ")", "{", "// Mandatory parameters shared by all signatures (as per spec)", "extraParams", ...
Get Recurly.js Signature with extra parameter strings in the format "[param]=[value]" See spec here: https://docs.recurly.com/deprecated-api-docs/recurlyjs/signatures <p> Returns a signature key for use with recurly.js BuildSubscriptionForm. @param privateJsKey recurly.js private key @param unixTime Unix timestamp, i.e. elapsed seconds since Midnight, Jan 1st 1970, UTC @param nonce A randomly generated string (number used only once) @param extraParams extra parameters to include in the signature @return signature string on success, null otherwise
[ "Get", "Recurly", ".", "js", "Signature", "with", "extra", "parameter", "strings", "in", "the", "format", "[", "param", "]", "=", "[", "value", "]", "See", "spec", "here", ":", "https", ":", "//", "docs", ".", "recurly", ".", "com", "/", "deprecated", ...
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyJs.java#L83-L91
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ReferenceField.java
ReferenceField.getReferenceRecordName
public String getReferenceRecordName() { if (m_recordReference != null) return this.getReferenceRecord().getTableNames(false); else { // This code just takes a guess if (this.getClass().getName().indexOf("Field") != -1) return this.getClass().getName().substring(Math.max(0, this.getClass().getName().lastIndexOf('.') + 1), this.getClass().getName().indexOf("Field")); else if (this.getFieldName(false, false).indexOf("ID") != -1) return this.getFieldName(false, false).substring(0, this.getFieldName(false, false).indexOf("ID")); else this.getFieldName(false, false); } return Constants.BLANK; // Never }
java
public String getReferenceRecordName() { if (m_recordReference != null) return this.getReferenceRecord().getTableNames(false); else { // This code just takes a guess if (this.getClass().getName().indexOf("Field") != -1) return this.getClass().getName().substring(Math.max(0, this.getClass().getName().lastIndexOf('.') + 1), this.getClass().getName().indexOf("Field")); else if (this.getFieldName(false, false).indexOf("ID") != -1) return this.getFieldName(false, false).substring(0, this.getFieldName(false, false).indexOf("ID")); else this.getFieldName(false, false); } return Constants.BLANK; // Never }
[ "public", "String", "getReferenceRecordName", "(", ")", "{", "if", "(", "m_recordReference", "!=", "null", ")", "return", "this", ".", "getReferenceRecord", "(", ")", ".", "getTableNames", "(", "false", ")", ";", "else", "{", "// This code just takes a guess", "...
Get the record name that this field references. @return String Name of the record.
[ "Get", "the", "record", "name", "that", "this", "field", "references", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L136-L150
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listMultiRoleUsagesAsync
public Observable<Page<UsageInner>> listMultiRoleUsagesAsync(final String resourceGroupName, final String name) { return listMultiRoleUsagesWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<UsageInner>>, Page<UsageInner>>() { @Override public Page<UsageInner> call(ServiceResponse<Page<UsageInner>> response) { return response.body(); } }); }
java
public Observable<Page<UsageInner>> listMultiRoleUsagesAsync(final String resourceGroupName, final String name) { return listMultiRoleUsagesWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<UsageInner>>, Page<UsageInner>>() { @Override public Page<UsageInner> call(ServiceResponse<Page<UsageInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "UsageInner", ">", ">", "listMultiRoleUsagesAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "listMultiRoleUsagesWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Get usage metrics for a multi-role pool of an App Service Environment. Get usage metrics for a multi-role pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;UsageInner&gt; object
[ "Get", "usage", "metrics", "for", "a", "multi", "-", "role", "pool", "of", "an", "App", "Service", "Environment", ".", "Get", "usage", "metrics", "for", "a", "multi", "-", "role", "pool", "of", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3540-L3548
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
StructuredQueryBuilder.geoJSONProperty
public GeospatialIndex geoJSONProperty(JSONProperty parent, JSONProperty jsonProperty) { if ( parent == null ) throw new IllegalArgumentException("parent cannot be null"); if ( jsonProperty == null ) throw new IllegalArgumentException("jsonProperty cannot be null"); return new GeoJSONPropertyImpl(parent, jsonProperty); }
java
public GeospatialIndex geoJSONProperty(JSONProperty parent, JSONProperty jsonProperty) { if ( parent == null ) throw new IllegalArgumentException("parent cannot be null"); if ( jsonProperty == null ) throw new IllegalArgumentException("jsonProperty cannot be null"); return new GeoJSONPropertyImpl(parent, jsonProperty); }
[ "public", "GeospatialIndex", "geoJSONProperty", "(", "JSONProperty", "parent", ",", "JSONProperty", "jsonProperty", ")", "{", "if", "(", "parent", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"parent cannot be null\"", ")", ";", "if", "(", ...
Identifies a parent json property with a child json property whose text has the latitude and longitude coordinates to match with a geospatial query. @param parent the parent of the json property with the coordinates @param jsonProperty the json property containing the geospatial coordinates @return the specification for the index on the geospatial coordinates
[ "Identifies", "a", "parent", "json", "property", "with", "a", "child", "json", "property", "whose", "text", "has", "the", "latitude", "and", "longitude", "coordinates", "to", "match", "with", "a", "geospatial", "query", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L844-L848
apache/flink
flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgramUtils.java
PackagedProgramUtils.createJobGraph
public static JobGraph createJobGraph( PackagedProgram packagedProgram, Configuration configuration, int defaultParallelism) throws ProgramInvocationException { return createJobGraph(packagedProgram, configuration, defaultParallelism, null); }
java
public static JobGraph createJobGraph( PackagedProgram packagedProgram, Configuration configuration, int defaultParallelism) throws ProgramInvocationException { return createJobGraph(packagedProgram, configuration, defaultParallelism, null); }
[ "public", "static", "JobGraph", "createJobGraph", "(", "PackagedProgram", "packagedProgram", ",", "Configuration", "configuration", ",", "int", "defaultParallelism", ")", "throws", "ProgramInvocationException", "{", "return", "createJobGraph", "(", "packagedProgram", ",", ...
Creates a {@link JobGraph} with a random {@link JobID} from the given {@link PackagedProgram}. @param packagedProgram to extract the JobGraph from @param configuration to use for the optimizer and job graph generator @param defaultParallelism for the JobGraph @return JobGraph extracted from the PackagedProgram @throws ProgramInvocationException if the JobGraph generation failed
[ "Creates", "a", "{", "@link", "JobGraph", "}", "with", "a", "random", "{", "@link", "JobID", "}", "from", "the", "given", "{", "@link", "PackagedProgram", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgramUtils.java#L118-L123
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/kafka/KafkaConsumerMetrics.java
KafkaConsumerMetrics.registerNotificationListener
private void registerNotificationListener(String type, BiConsumer<ObjectName, Tags> perObject) { NotificationListener notificationListener = (notification, handback) -> { MBeanServerNotification mbs = (MBeanServerNotification) notification; ObjectName o = mbs.getMBeanName(); perObject.accept(o, Tags.concat(tags, nameTag(o))); }; NotificationFilter filter = (NotificationFilter) notification -> { if (!MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notification.getType())) return false; ObjectName obj = ((MBeanServerNotification) notification).getMBeanName(); return obj.getDomain().equals(JMX_DOMAIN) && obj.getKeyProperty("type").equals(type); }; try { mBeanServer.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, notificationListener, filter, null); notificationListenerCleanUpRunnables.add(() -> { try { mBeanServer.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, notificationListener); } catch (InstanceNotFoundException | ListenerNotFoundException ignored) { } }); } catch (InstanceNotFoundException e) { throw new RuntimeException("Error registering Kafka MBean listener", e); } }
java
private void registerNotificationListener(String type, BiConsumer<ObjectName, Tags> perObject) { NotificationListener notificationListener = (notification, handback) -> { MBeanServerNotification mbs = (MBeanServerNotification) notification; ObjectName o = mbs.getMBeanName(); perObject.accept(o, Tags.concat(tags, nameTag(o))); }; NotificationFilter filter = (NotificationFilter) notification -> { if (!MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notification.getType())) return false; ObjectName obj = ((MBeanServerNotification) notification).getMBeanName(); return obj.getDomain().equals(JMX_DOMAIN) && obj.getKeyProperty("type").equals(type); }; try { mBeanServer.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, notificationListener, filter, null); notificationListenerCleanUpRunnables.add(() -> { try { mBeanServer.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, notificationListener); } catch (InstanceNotFoundException | ListenerNotFoundException ignored) { } }); } catch (InstanceNotFoundException e) { throw new RuntimeException("Error registering Kafka MBean listener", e); } }
[ "private", "void", "registerNotificationListener", "(", "String", "type", ",", "BiConsumer", "<", "ObjectName", ",", "Tags", ">", "perObject", ")", "{", "NotificationListener", "notificationListener", "=", "(", "notification", ",", "handback", ")", "->", "{", "MBe...
This notification listener should remain indefinitely since new Kafka consumers can be added at any time. @param type The Kafka JMX type to listen for. @param perObject Metric registration handler when a new MBean is created.
[ "This", "notification", "listener", "should", "remain", "indefinitely", "since", "new", "Kafka", "consumers", "can", "be", "added", "at", "any", "time", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/kafka/KafkaConsumerMetrics.java#L253-L278
sarl/sarl
products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/commands/CompilerCommandModule.java
CompilerCommandModule.getProgressBarConfig
@SuppressWarnings("static-method") @Provides @Singleton public ProgressBarConfig getProgressBarConfig(ConfigurationFactory configFactory, Injector injector) { final ProgressBarConfig config = ProgressBarConfig.getConfiguration(configFactory); injector.injectMembers(config); return config; }
java
@SuppressWarnings("static-method") @Provides @Singleton public ProgressBarConfig getProgressBarConfig(ConfigurationFactory configFactory, Injector injector) { final ProgressBarConfig config = ProgressBarConfig.getConfiguration(configFactory); injector.injectMembers(config); return config; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "@", "Provides", "@", "Singleton", "public", "ProgressBarConfig", "getProgressBarConfig", "(", "ConfigurationFactory", "configFactory", ",", "Injector", "injector", ")", "{", "final", "ProgressBarConfig", "config", ...
Replies the instance of the compiler command configuration. @param configFactory accessor to the bootique factory. @param injector the current injector. @return the compiler command configuration accessor.
[ "Replies", "the", "instance", "of", "the", "compiler", "command", "configuration", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/modules/commands/CompilerCommandModule.java#L92-L99
Axway/Grapes
commons/src/main/java/org/axway/grapes/commons/utils/FileUtils.java
FileUtils.touch
public static void touch(final File folder , final String fileName) throws IOException { if(!folder.exists()){ folder.mkdirs(); } final File touchedFile = new File(folder, fileName); // The JVM will only 'touch' the file if you instantiate a // FileOutputStream instance for the file in question. // You don't actually write any data to the file through // the FileOutputStream. Just instantiate it and close it. try ( FileOutputStream doneFOS = new FileOutputStream(touchedFile); ) { // Touching the file } catch (FileNotFoundException e) { throw new FileNotFoundException("Failed to the find file." + e); } }
java
public static void touch(final File folder , final String fileName) throws IOException { if(!folder.exists()){ folder.mkdirs(); } final File touchedFile = new File(folder, fileName); // The JVM will only 'touch' the file if you instantiate a // FileOutputStream instance for the file in question. // You don't actually write any data to the file through // the FileOutputStream. Just instantiate it and close it. try ( FileOutputStream doneFOS = new FileOutputStream(touchedFile); ) { // Touching the file } catch (FileNotFoundException e) { throw new FileNotFoundException("Failed to the find file." + e); } }
[ "public", "static", "void", "touch", "(", "final", "File", "folder", ",", "final", "String", "fileName", ")", "throws", "IOException", "{", "if", "(", "!", "folder", ".", "exists", "(", ")", ")", "{", "folder", ".", "mkdirs", "(", ")", ";", "}", "fin...
Creates a file @param folder File @param fileName String @throws IOException
[ "Creates", "a", "file" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/utils/FileUtils.java#L87-L107
aboutsip/pkts
pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipParser.java
SipParser.isNext
public static boolean isNext(final Buffer buffer, final byte b) throws IOException { if (buffer.hasReadableBytes()) { final byte actual = buffer.peekByte(); return actual == b; } return false; }
java
public static boolean isNext(final Buffer buffer, final byte b) throws IOException { if (buffer.hasReadableBytes()) { final byte actual = buffer.peekByte(); return actual == b; } return false; }
[ "public", "static", "boolean", "isNext", "(", "final", "Buffer", "buffer", ",", "final", "byte", "b", ")", "throws", "IOException", "{", "if", "(", "buffer", ".", "hasReadableBytes", "(", ")", ")", "{", "final", "byte", "actual", "=", "buffer", ".", "pee...
Will check whether the next readable byte in the buffer is a certain byte @param buffer the buffer to peek into @param b the byte we are checking is the next byte in the buffer to be read @return true if the next byte to read indeed is what we hope it is
[ "Will", "check", "whether", "the", "next", "readable", "byte", "in", "the", "buffer", "is", "a", "certain", "byte" ]
train
https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipParser.java#L513-L520
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java
Drawable.loadSpriteAnimated
public static SpriteAnimated loadSpriteAnimated(ImageBuffer surface, int horizontalFrames, int verticalFrames) { return new SpriteAnimatedImpl(surface, horizontalFrames, verticalFrames); }
java
public static SpriteAnimated loadSpriteAnimated(ImageBuffer surface, int horizontalFrames, int verticalFrames) { return new SpriteAnimatedImpl(surface, horizontalFrames, verticalFrames); }
[ "public", "static", "SpriteAnimated", "loadSpriteAnimated", "(", "ImageBuffer", "surface", ",", "int", "horizontalFrames", ",", "int", "verticalFrames", ")", "{", "return", "new", "SpriteAnimatedImpl", "(", "surface", ",", "horizontalFrames", ",", "verticalFrames", ")...
Load an animated sprite, giving horizontal and vertical frames (sharing the same surface). It may be useful in case of multiple animated sprites. <p> {@link SpriteAnimated#load()} must not be called as surface has already been loaded. </p> @param surface The surface reference (must not be <code>null</code>). @param horizontalFrames The number of horizontal frames (must be strictly positive). @param verticalFrames The number of vertical frames (must be strictly positive). @return The loaded animated sprite. @throws LionEngineException If arguments are invalid.
[ "Load", "an", "animated", "sprite", "giving", "horizontal", "and", "vertical", "frames", "(", "sharing", "the", "same", "surface", ")", ".", "It", "may", "be", "useful", "in", "case", "of", "multiple", "animated", "sprites", ".", "<p", ">", "{", "@link", ...
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java#L197-L200
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java
ComplexMath_F64.sqrt
public static void sqrt(Complex_F64 input, Complex_F64 root) { double r = input.getMagnitude(); double a = input.real; root.real = Math.sqrt((r+a)/2.0); root.imaginary = Math.sqrt((r-a)/2.0); if( input.imaginary < 0 ) root.imaginary = -root.imaginary; }
java
public static void sqrt(Complex_F64 input, Complex_F64 root) { double r = input.getMagnitude(); double a = input.real; root.real = Math.sqrt((r+a)/2.0); root.imaginary = Math.sqrt((r-a)/2.0); if( input.imaginary < 0 ) root.imaginary = -root.imaginary; }
[ "public", "static", "void", "sqrt", "(", "Complex_F64", "input", ",", "Complex_F64", "root", ")", "{", "double", "r", "=", "input", ".", "getMagnitude", "(", ")", ";", "double", "a", "=", "input", ".", "real", ";", "root", ".", "real", "=", "Math", "...
Computes the square root of the complex number. @param input Input complex number. @param root Output. The square root of the input
[ "Computes", "the", "square", "root", "of", "the", "complex", "number", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java#L207-L216
openengsb/openengsb
components/util/src/main/java/org/openengsb/core/util/CipherUtils.java
CipherUtils.generateKeyPair
public static KeyPair generateKeyPair(String algorithm, int keySize) { KeyPairGenerator keyPairGenerator; try { keyPairGenerator = KeyPairGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } keyPairGenerator.initialize(keySize); return keyPairGenerator.generateKeyPair(); }
java
public static KeyPair generateKeyPair(String algorithm, int keySize) { KeyPairGenerator keyPairGenerator; try { keyPairGenerator = KeyPairGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } keyPairGenerator.initialize(keySize); return keyPairGenerator.generateKeyPair(); }
[ "public", "static", "KeyPair", "generateKeyPair", "(", "String", "algorithm", ",", "int", "keySize", ")", "{", "KeyPairGenerator", "keyPairGenerator", ";", "try", "{", "keyPairGenerator", "=", "KeyPairGenerator", ".", "getInstance", "(", "algorithm", ")", ";", "}"...
Generate a {@link KeyPair} for the given assymmetric algorithm and keysize Example: CipherUtils.generateKeyPair("RSA", 2048)
[ "Generate", "a", "{", "@link", "KeyPair", "}", "for", "the", "given", "assymmetric", "algorithm", "and", "keysize" ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/util/src/main/java/org/openengsb/core/util/CipherUtils.java#L173-L182