repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
amplexus/java-flac-encoder
src/main/java/net/sourceforge/javaflacencoder/FLACEncoder.java
FLACEncoder.setOutputStream
public void setOutputStream(FLACOutputStream fos) { if(fos == null) throw new IllegalArgumentException("FLACOutputStream fos must not be null."); if(flacWriter == null) flacWriter = new FLACStreamController(fos,streamConfig); else flacWriter.setFLACOutputStream(fos); }
java
public void setOutputStream(FLACOutputStream fos) { if(fos == null) throw new IllegalArgumentException("FLACOutputStream fos must not be null."); if(flacWriter == null) flacWriter = new FLACStreamController(fos,streamConfig); else flacWriter.setFLACOutputStream(fos); }
[ "public", "void", "setOutputStream", "(", "FLACOutputStream", "fos", ")", "{", "if", "(", "fos", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"FLACOutputStream fos must not be null.\"", ")", ";", "if", "(", "flacWriter", "==", "null", ")",...
Set the output stream to use. This must not be called while an encode process is active, or a flac stream is already opened. @param fos output stream to use. This must not be null.
[ "Set", "the", "output", "stream", "to", "use", ".", "This", "must", "not", "be", "called", "while", "an", "encode", "process", "is", "active", "or", "a", "flac", "stream", "is", "already", "opened", "." ]
train
https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/FLACEncoder.java#L688-L695
buyi/RecyclerViewPagerIndicator
recycler-viewpager-indicator/src/main/java/com/viewpagerindicator/as/library/pageview/RecyclerViewHeader.java
RecyclerViewHeader.attachTo
public void attachTo(RecyclerView recycler, boolean headerAlreadyAligned) { validateRecycler(recycler, headerAlreadyAligned); mRecycler = recycler; mAlreadyAligned = headerAlreadyAligned; mReversed = isLayoutManagerReversed(recycler); setupAlignment(recycler); setupHeader(recycler); // final TypedArray styledAttributes = getContext().getTheme().obtainStyledAttributes( // new int[]{android.R.attr.actionBarSize}); // int mActionBarSize = (int) styledAttributes.getDimension(0, 0); // styledAttributes.recycle(); // int height = mActionBarSize; recycler.addItemDecoration(new HeaderItemDecoration(this.getResources().getDrawable(R.drawable.divider),recycler.getLayoutManager(), 0), 0); }
java
public void attachTo(RecyclerView recycler, boolean headerAlreadyAligned) { validateRecycler(recycler, headerAlreadyAligned); mRecycler = recycler; mAlreadyAligned = headerAlreadyAligned; mReversed = isLayoutManagerReversed(recycler); setupAlignment(recycler); setupHeader(recycler); // final TypedArray styledAttributes = getContext().getTheme().obtainStyledAttributes( // new int[]{android.R.attr.actionBarSize}); // int mActionBarSize = (int) styledAttributes.getDimension(0, 0); // styledAttributes.recycle(); // int height = mActionBarSize; recycler.addItemDecoration(new HeaderItemDecoration(this.getResources().getDrawable(R.drawable.divider),recycler.getLayoutManager(), 0), 0); }
[ "public", "void", "attachTo", "(", "RecyclerView", "recycler", ",", "boolean", "headerAlreadyAligned", ")", "{", "validateRecycler", "(", "recycler", ",", "headerAlreadyAligned", ")", ";", "mRecycler", "=", "recycler", ";", "mAlreadyAligned", "=", "headerAlreadyAligne...
Attaches <code>RecyclerViewHeader</code> to <code>RecyclerView</code>. Be sure that <code>setLayoutManager(...)</code> has been called for <code>RecyclerView</code> before calling this method. Also, if you were planning to use <code>setOnScrollListener(...)</code> method for your <code>RecyclerView</code>, be sure to do it before calling this method. @param recycler <code>RecyclerView</code> to attach <code>RecyclerViewHeader</code> to. @param headerAlreadyAligned If set to <code>false</code>, method will perform necessary actions to properly align the header within <code>RecyclerView</code>. If set to <code>true</code> method will assume, that user has already aligned <code>RecyclerViewHeader</code> properly.
[ "Attaches", "<code", ">", "RecyclerViewHeader<", "/", "code", ">", "to", "<code", ">", "RecyclerView<", "/", "code", ">", ".", "Be", "sure", "that", "<code", ">", "setLayoutManager", "(", "...", ")", "<", "/", "code", ">", "has", "been", "called", "for",...
train
https://github.com/buyi/RecyclerViewPagerIndicator/blob/b3b5283801b60d40f7325c7f590c945262194fad/recycler-viewpager-indicator/src/main/java/com/viewpagerindicator/as/library/pageview/RecyclerViewHeader.java#L109-L125
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest.java
MergeableManifest.write
@Override public void write(OutputStream out) throws IOException { DataOutputStream dos = new DataOutputStream(out); // Write out the main attributes for the manifest getMainAttributes().myWriteMain(dos); // Now write out the pre-entry attributes Iterator<Map.Entry<String, Attributes>> it = getEntries().entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, Attributes> e = it.next(); StringBuffer buffer = new StringBuffer("Name: "); String value = e.getKey(); if (value != null) { byte[] vb = value.getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); } buffer.append(value); buffer.append(lineDelimiter); dos.writeBytes(make512Safe(buffer, lineDelimiter)); ((OrderAwareAttributes) e.getValue()).myWrite(dos); } dos.flush(); }
java
@Override public void write(OutputStream out) throws IOException { DataOutputStream dos = new DataOutputStream(out); // Write out the main attributes for the manifest getMainAttributes().myWriteMain(dos); // Now write out the pre-entry attributes Iterator<Map.Entry<String, Attributes>> it = getEntries().entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, Attributes> e = it.next(); StringBuffer buffer = new StringBuffer("Name: "); String value = e.getKey(); if (value != null) { byte[] vb = value.getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); } buffer.append(value); buffer.append(lineDelimiter); dos.writeBytes(make512Safe(buffer, lineDelimiter)); ((OrderAwareAttributes) e.getValue()).myWrite(dos); } dos.flush(); }
[ "@", "Override", "public", "void", "write", "(", "OutputStream", "out", ")", "throws", "IOException", "{", "DataOutputStream", "dos", "=", "new", "DataOutputStream", "(", "out", ")", ";", "// Write out the main attributes for the manifest", "getMainAttributes", "(", "...
/* Copied from base class to omit the call to make72Safe(..).
[ "/", "*", "Copied", "from", "base", "class", "to", "omit", "the", "call", "to", "make72Safe", "(", "..", ")", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/MergeableManifest.java#L300-L321
craftercms/commons
utilities/src/main/java/org/craftercms/commons/crypto/PGPUtils.java
PGPUtils.findSecretKey
protected static PGPPrivateKey findSecretKey(InputStream keyStream, long keyId, char[] password) throws Exception { PGPSecretKeyRingCollection keyRings = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyStream), new BcKeyFingerprintCalculator()); PGPSecretKey secretKey = keyRings.getSecretKey(keyId); if(secretKey == null) { return null; } PBESecretKeyDecryptor decryptor = new JcePBESecretKeyDecryptorBuilder( new JcaPGPDigestCalculatorProviderBuilder().setProvider(PROVIDER).build()) .setProvider(PROVIDER).build(password); return secretKey.extractPrivateKey(decryptor); }
java
protected static PGPPrivateKey findSecretKey(InputStream keyStream, long keyId, char[] password) throws Exception { PGPSecretKeyRingCollection keyRings = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyStream), new BcKeyFingerprintCalculator()); PGPSecretKey secretKey = keyRings.getSecretKey(keyId); if(secretKey == null) { return null; } PBESecretKeyDecryptor decryptor = new JcePBESecretKeyDecryptorBuilder( new JcaPGPDigestCalculatorProviderBuilder().setProvider(PROVIDER).build()) .setProvider(PROVIDER).build(password); return secretKey.extractPrivateKey(decryptor); }
[ "protected", "static", "PGPPrivateKey", "findSecretKey", "(", "InputStream", "keyStream", ",", "long", "keyId", ",", "char", "[", "]", "password", ")", "throws", "Exception", "{", "PGPSecretKeyRingCollection", "keyRings", "=", "new", "PGPSecretKeyRingCollection", "(",...
Extracts the PGP private key from an encoded stream. @param keyStream stream providing the encoded private key @param keyId id of the secret key to extract @param password passphrase for the secret key @return the private key object @throws IOException if there is an error reading from the stream @throws PGPException if the secret key cannot be extracted
[ "Extracts", "the", "PGP", "private", "key", "from", "an", "encoded", "stream", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/crypto/PGPUtils.java#L228-L239
dickschoeller/gedbrowser
geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java
GeocodeResultBuilder.toGeoServiceGeometry
public FeatureCollection toGeoServiceGeometry(final Geometry geometry) { if (geometry == null) { return GeoServiceGeometry.createFeatureCollection( toLocationFeature(new LatLng(Double.NaN, Double.NaN), LocationType.UNKNOWN), null, null); } return GeoServiceGeometry.createFeatureCollection( toLocationFeature(geometry.location, geometry.locationType), toBox("bounds", geometry.bounds), toBox("viewport", geometry.viewport)); }
java
public FeatureCollection toGeoServiceGeometry(final Geometry geometry) { if (geometry == null) { return GeoServiceGeometry.createFeatureCollection( toLocationFeature(new LatLng(Double.NaN, Double.NaN), LocationType.UNKNOWN), null, null); } return GeoServiceGeometry.createFeatureCollection( toLocationFeature(geometry.location, geometry.locationType), toBox("bounds", geometry.bounds), toBox("viewport", geometry.viewport)); }
[ "public", "FeatureCollection", "toGeoServiceGeometry", "(", "final", "Geometry", "geometry", ")", "{", "if", "(", "geometry", "==", "null", ")", "{", "return", "GeoServiceGeometry", ".", "createFeatureCollection", "(", "toLocationFeature", "(", "new", "LatLng", "(",...
Create a GeoServiceGeometry from a Geometry. @param geometry the Geometry @return the GeoServiceGeometry
[ "Create", "a", "GeoServiceGeometry", "from", "a", "Geometry", "." ]
train
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/builder/GeocodeResultBuilder.java#L200-L211
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java
Logger.getAnonymousLogger
@CallerSensitive public static Logger getAnonymousLogger(String resourceBundleName) { LogManager manager = LogManager.getLogManager(); // cleanup some Loggers that have been GC'ed manager.drainLoggerRefQueueBounded(); // Android-changed: Use VMStack.getStackClass1. /* J2ObjC modified. Logger result = new Logger(null, resourceBundleName, VMStack.getStackClass1()); */ Logger result = new Logger(null, resourceBundleName, null); result.anonymous = true; Logger root = manager.getLogger(""); result.doSetParent(root); return result; }
java
@CallerSensitive public static Logger getAnonymousLogger(String resourceBundleName) { LogManager manager = LogManager.getLogManager(); // cleanup some Loggers that have been GC'ed manager.drainLoggerRefQueueBounded(); // Android-changed: Use VMStack.getStackClass1. /* J2ObjC modified. Logger result = new Logger(null, resourceBundleName, VMStack.getStackClass1()); */ Logger result = new Logger(null, resourceBundleName, null); result.anonymous = true; Logger root = manager.getLogger(""); result.doSetParent(root); return result; }
[ "@", "CallerSensitive", "public", "static", "Logger", "getAnonymousLogger", "(", "String", "resourceBundleName", ")", "{", "LogManager", "manager", "=", "LogManager", ".", "getLogManager", "(", ")", ";", "// cleanup some Loggers that have been GC'ed", "manager", ".", "d...
adding a new anonymous Logger object is handled by doSetParent().
[ "adding", "a", "new", "anonymous", "Logger", "object", "is", "handled", "by", "doSetParent", "()", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L549-L564
wildfly/wildfly-core
logging/src/main/java/org/jboss/as/logging/LoggingSubsystemParser.java
LoggingSubsystemParser.parsePropertyElement
static void parsePropertyElement(final ModelNode operation, final XMLExtendedStreamReader reader, final String wrapperName) throws XMLStreamException { while (reader.nextTag() != END_ELEMENT) { final int cnt = reader.getAttributeCount(); String name = null; String value = null; for (int i = 0; i < cnt; i++) { requireNoNamespaceAttribute(reader, i); final String attrValue = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NAME: { name = attrValue; break; } case VALUE: { value = attrValue; break; } default: throw unexpectedAttribute(reader, i); } } if (name == null) { throw missingRequired(reader, Collections.singleton(Attribute.NAME.getLocalName())); } operation.get(wrapperName).add(name, (value == null ? new ModelNode() : new ModelNode(value))); if (reader.nextTag() != END_ELEMENT) { throw unexpectedElement(reader); } } }
java
static void parsePropertyElement(final ModelNode operation, final XMLExtendedStreamReader reader, final String wrapperName) throws XMLStreamException { while (reader.nextTag() != END_ELEMENT) { final int cnt = reader.getAttributeCount(); String name = null; String value = null; for (int i = 0; i < cnt; i++) { requireNoNamespaceAttribute(reader, i); final String attrValue = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NAME: { name = attrValue; break; } case VALUE: { value = attrValue; break; } default: throw unexpectedAttribute(reader, i); } } if (name == null) { throw missingRequired(reader, Collections.singleton(Attribute.NAME.getLocalName())); } operation.get(wrapperName).add(name, (value == null ? new ModelNode() : new ModelNode(value))); if (reader.nextTag() != END_ELEMENT) { throw unexpectedElement(reader); } } }
[ "static", "void", "parsePropertyElement", "(", "final", "ModelNode", "operation", ",", "final", "XMLExtendedStreamReader", "reader", ",", "final", "String", "wrapperName", ")", "throws", "XMLStreamException", "{", "while", "(", "reader", ".", "nextTag", "(", ")", ...
Parses a property element. <p> The {@code name} attribute is required. If the {@code value} attribute is not present an {@linkplain org.jboss.dmr.ModelNode UNDEFINED ModelNode} will set on the operation. </p> @param operation the operation to add the parsed properties to @param reader the reader to use @param wrapperName the name of the attribute that wraps the key and value attributes @throws XMLStreamException if a parsing error occurs
[ "Parses", "a", "property", "element", ".", "<p", ">" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/LoggingSubsystemParser.java#L140-L170
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java
FacesImpl.verifyFaceToFaceAsync
public Observable<VerifyResult> verifyFaceToFaceAsync(UUID faceId1, UUID faceId2) { return verifyFaceToFaceWithServiceResponseAsync(faceId1, faceId2).map(new Func1<ServiceResponse<VerifyResult>, VerifyResult>() { @Override public VerifyResult call(ServiceResponse<VerifyResult> response) { return response.body(); } }); }
java
public Observable<VerifyResult> verifyFaceToFaceAsync(UUID faceId1, UUID faceId2) { return verifyFaceToFaceWithServiceResponseAsync(faceId1, faceId2).map(new Func1<ServiceResponse<VerifyResult>, VerifyResult>() { @Override public VerifyResult call(ServiceResponse<VerifyResult> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VerifyResult", ">", "verifyFaceToFaceAsync", "(", "UUID", "faceId1", ",", "UUID", "faceId2", ")", "{", "return", "verifyFaceToFaceWithServiceResponseAsync", "(", "faceId1", ",", "faceId2", ")", ".", "map", "(", "new", "Func1", "<", ...
Verify whether two faces belong to a same person or whether one face belongs to a person. @param faceId1 FaceId of the first face, comes from Face - Detect @param faceId2 FaceId of the second face, comes from Face - Detect @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VerifyResult object
[ "Verify", "whether", "two", "faces", "belong", "to", "a", "same", "person", "or", "whether", "one", "face", "belongs", "to", "a", "person", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java#L594-L601
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindContentProviderBuilder.java
BindContentProviderBuilder.defineJavadocForContentUri
private void defineJavadocForContentUri(MethodSpec.Builder builder, SQLiteModelMethod method) { String contentUri = method.contentProviderUri().replace("*", "[*]"); classBuilder.addJavadoc("<tr><td><pre>$L</pre></td><td>{@link $LImpl#$L}</td></tr>\n", contentUri, method.getParent().getName(), method.contentProviderMethodName); builder.addJavadoc("<tr><td><pre>$L</pre></td><td>{@link $LImpl#$L}</td></tr>\n", contentUri, method.getParent().getName(), method.contentProviderMethodName); }
java
private void defineJavadocForContentUri(MethodSpec.Builder builder, SQLiteModelMethod method) { String contentUri = method.contentProviderUri().replace("*", "[*]"); classBuilder.addJavadoc("<tr><td><pre>$L</pre></td><td>{@link $LImpl#$L}</td></tr>\n", contentUri, method.getParent().getName(), method.contentProviderMethodName); builder.addJavadoc("<tr><td><pre>$L</pre></td><td>{@link $LImpl#$L}</td></tr>\n", contentUri, method.getParent().getName(), method.contentProviderMethodName); }
[ "private", "void", "defineJavadocForContentUri", "(", "MethodSpec", ".", "Builder", "builder", ",", "SQLiteModelMethod", "method", ")", "{", "String", "contentUri", "=", "method", ".", "contentProviderUri", "(", ")", ".", "replace", "(", "\"*\"", ",", "\"[*]\"", ...
Define javadoc for content uri. @param builder the builder @param method the method
[ "Define", "javadoc", "for", "content", "uri", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindContentProviderBuilder.java#L489-L495
javagl/ND
nd-distance/src/main/java/de/javagl/nd/distance/tuples/j/LongTupleDistanceFunctions.java
LongTupleDistanceFunctions.computeEuclideanSquared
static double computeEuclideanSquared(LongTuple t0, LongTuple t1) { Utils.checkForEqualSize(t0, t1); long sum = 0; for (int i=0; i<t0.getSize(); i++) { long d = t0.get(i)-t1.get(i); sum += d*d; } return sum; }
java
static double computeEuclideanSquared(LongTuple t0, LongTuple t1) { Utils.checkForEqualSize(t0, t1); long sum = 0; for (int i=0; i<t0.getSize(); i++) { long d = t0.get(i)-t1.get(i); sum += d*d; } return sum; }
[ "static", "double", "computeEuclideanSquared", "(", "LongTuple", "t0", ",", "LongTuple", "t1", ")", "{", "Utils", ".", "checkForEqualSize", "(", "t0", ",", "t1", ")", ";", "long", "sum", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<",...
Computes the squared Euclidean distance between the given tuples @param t0 The first tuple @param t1 The second tuple @return The distance @throws IllegalArgumentException If the given tuples do not have the same {@link Tuple#getSize() size}
[ "Computes", "the", "squared", "Euclidean", "distance", "between", "the", "given", "tuples" ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-distance/src/main/java/de/javagl/nd/distance/tuples/j/LongTupleDistanceFunctions.java#L197-L207
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/repository/query/StringQueryParameterBinder.java
StringQueryParameterBinder.getBindingFor
private ParameterBinding getBindingFor(Object ebeanQuery, int position, Parameter parameter) { Assert.notNull(ebeanQuery, "EbeanQueryWrapper must not be null!"); Assert.notNull(parameter, "Parameter must not be null!"); if (parameter.isNamedParameter()) { return query.getBindingFor(parameter.getName().orElseThrow(() -> new IllegalArgumentException("Parameter needs to be named!"))); } try { return query.getBindingFor(position); } catch (IllegalArgumentException ex) { // We should actually reject parameters unavailable, but as EclipseLink doesn't implement ….getParameter(int) for // native queries correctly we need to fall back to an indexed parameter // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=427892 return new ParameterBinding(position); } }
java
private ParameterBinding getBindingFor(Object ebeanQuery, int position, Parameter parameter) { Assert.notNull(ebeanQuery, "EbeanQueryWrapper must not be null!"); Assert.notNull(parameter, "Parameter must not be null!"); if (parameter.isNamedParameter()) { return query.getBindingFor(parameter.getName().orElseThrow(() -> new IllegalArgumentException("Parameter needs to be named!"))); } try { return query.getBindingFor(position); } catch (IllegalArgumentException ex) { // We should actually reject parameters unavailable, but as EclipseLink doesn't implement ….getParameter(int) for // native queries correctly we need to fall back to an indexed parameter // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=427892 return new ParameterBinding(position); } }
[ "private", "ParameterBinding", "getBindingFor", "(", "Object", "ebeanQuery", ",", "int", "position", ",", "Parameter", "parameter", ")", "{", "Assert", ".", "notNull", "(", "ebeanQuery", ",", "\"EbeanQueryWrapper must not be null!\"", ")", ";", "Assert", ".", "notNu...
Finds the {@link LikeParameterBinding} to be applied before binding a parameter value to the query. @param ebeanQuery must not be {@literal null}. @param position @param parameter must not be {@literal null}. @return the {@link ParameterBinding} for the given parameters or {@literal null} if none available.
[ "Finds", "the", "{", "@link", "LikeParameterBinding", "}", "to", "be", "applied", "before", "binding", "a", "parameter", "value", "to", "the", "query", "." ]
train
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/repository/query/StringQueryParameterBinder.java#L67-L87
alkacon/opencms-core
src/org/opencms/xml/page/CmsXmlPage.java
CmsXmlPage.getLinkTable
public CmsLinkTable getLinkTable(String name, Locale locale) { CmsXmlHtmlValue value = (CmsXmlHtmlValue)getValue(name, locale); if (value != null) { return value.getLinkTable(); } return new CmsLinkTable(); }
java
public CmsLinkTable getLinkTable(String name, Locale locale) { CmsXmlHtmlValue value = (CmsXmlHtmlValue)getValue(name, locale); if (value != null) { return value.getLinkTable(); } return new CmsLinkTable(); }
[ "public", "CmsLinkTable", "getLinkTable", "(", "String", "name", ",", "Locale", "locale", ")", "{", "CmsXmlHtmlValue", "value", "=", "(", "CmsXmlHtmlValue", ")", "getValue", "(", "name", ",", "locale", ")", ";", "if", "(", "value", "!=", "null", ")", "{", ...
Returns the link table of an element.<p> @param name name of the element @param locale locale of the element @return the link table
[ "Returns", "the", "link", "table", "of", "an", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/page/CmsXmlPage.java#L295-L302
casmi/casmi
src/main/java/casmi/graphics/element/Ellipse.java
Ellipse.setCenterColor
public void setCenterColor(Color color) { if (centerColor == null) { centerColor = new RGBColor(0.0, 0.0, 0.0); } setGradation(true); this.centerColor = color; }
java
public void setCenterColor(Color color) { if (centerColor == null) { centerColor = new RGBColor(0.0, 0.0, 0.0); } setGradation(true); this.centerColor = color; }
[ "public", "void", "setCenterColor", "(", "Color", "color", ")", "{", "if", "(", "centerColor", "==", "null", ")", "{", "centerColor", "=", "new", "RGBColor", "(", "0.0", ",", "0.0", ",", "0.0", ")", ";", "}", "setGradation", "(", "true", ")", ";", "t...
Sets the color of this Ellipse's center. @param color The color of the Ellipse's center.
[ "Sets", "the", "color", "of", "this", "Ellipse", "s", "center", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Ellipse.java#L313-L319
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java
ExecutionGraph.getInputVertex
public ExecutionVertex getInputVertex(final int stage, final int index) { try { final ExecutionStage s = this.stages.get(stage); if (s == null) { return null; } return s.getInputExecutionVertex(index); } catch (ArrayIndexOutOfBoundsException e) { return null; } }
java
public ExecutionVertex getInputVertex(final int stage, final int index) { try { final ExecutionStage s = this.stages.get(stage); if (s == null) { return null; } return s.getInputExecutionVertex(index); } catch (ArrayIndexOutOfBoundsException e) { return null; } }
[ "public", "ExecutionVertex", "getInputVertex", "(", "final", "int", "stage", ",", "final", "int", "index", ")", "{", "try", "{", "final", "ExecutionStage", "s", "=", "this", ".", "stages", ".", "get", "(", "stage", ")", ";", "if", "(", "s", "==", "null...
Returns the input vertex with the specified index for the given stage @param stage the index of the stage @param index the index of the input vertex to return @return the input vertex with the specified index or <code>null</code> if no input vertex with such an index exists in that stage
[ "Returns", "the", "input", "vertex", "with", "the", "specified", "index", "for", "the", "given", "stage" ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java#L676-L689
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.lookAtLH
public Matrix4f lookAtLH(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) { return lookAtLH(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ, thisOrNew()); }
java
public Matrix4f lookAtLH(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) { return lookAtLH(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ, thisOrNew()); }
[ "public", "Matrix4f", "lookAtLH", "(", "float", "eyeX", ",", "float", "eyeY", ",", "float", "eyeZ", ",", "float", "centerX", ",", "float", "centerY", ",", "float", "centerZ", ",", "float", "upX", ",", "float", "upY", ",", "float", "upZ", ")", "{", "ret...
Apply a "lookat" transformation to this matrix for a left-handed coordinate system, that aligns <code>+z</code> with <code>center - eye</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix, then the new matrix will be <code>M * L</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * L * v</code>, the lookat transformation will be applied first! <p> In order to set the matrix to a lookat transformation without post-multiplying it, use {@link #setLookAtLH(float, float, float, float, float, float, float, float, float) setLookAtLH()}. @see #lookAtLH(Vector3fc, Vector3fc, Vector3fc) @see #setLookAtLH(float, float, float, float, float, float, float, float, float) @param eyeX the x-coordinate of the eye/camera location @param eyeY the y-coordinate of the eye/camera location @param eyeZ the z-coordinate of the eye/camera location @param centerX the x-coordinate of the point to look at @param centerY the y-coordinate of the point to look at @param centerZ the z-coordinate of the point to look at @param upX the x-coordinate of the up vector @param upY the y-coordinate of the up vector @param upZ the z-coordinate of the up vector @return a matrix holding the result
[ "Apply", "a", "lookat", "transformation", "to", "this", "matrix", "for", "a", "left", "-", "handed", "coordinate", "system", "that", "aligns", "<code", ">", "+", "z<", "/", "code", ">", "with", "<code", ">", "center", "-", "eye<", "/", "code", ">", "."...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L9091-L9095
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java
MathBindings.subtractExact
public static LongBinding subtractExact(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.subtractExact(x.get(), y.get()), x, y); }
java
public static LongBinding subtractExact(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.subtractExact(x.get(), y.get()), x, y); }
[ "public", "static", "LongBinding", "subtractExact", "(", "final", "ObservableLongValue", "x", ",", "final", "ObservableLongValue", "y", ")", "{", "return", "createLongBinding", "(", "(", ")", "->", "Math", ".", "subtractExact", "(", "x", ".", "get", "(", ")", ...
Binding for {@link java.lang.Math#subtractExact(long, long)} @param x the first value @param y the second value to subtract from the first @return the result @throws ArithmeticException if the result overflows a long
[ "Binding", "for", "{", "@link", "java", ".", "lang", ".", "Math#subtractExact", "(", "long", "long", ")", "}" ]
train
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L1440-L1442
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/Tree.java
Tree.renderDefaultJavaScript
private String renderDefaultJavaScript(HttpServletRequest request, String realId) { String idScript = null; // map the tagId to the real id if (TagConfig.isDefaultJavaScript()) { ScriptRequestState srs = ScriptRequestState.getScriptRequestState(request); idScript = srs.mapTagId(getScriptReporter(), _trs.tagId, realId, null); } return idScript; }
java
private String renderDefaultJavaScript(HttpServletRequest request, String realId) { String idScript = null; // map the tagId to the real id if (TagConfig.isDefaultJavaScript()) { ScriptRequestState srs = ScriptRequestState.getScriptRequestState(request); idScript = srs.mapTagId(getScriptReporter(), _trs.tagId, realId, null); } return idScript; }
[ "private", "String", "renderDefaultJavaScript", "(", "HttpServletRequest", "request", ",", "String", "realId", ")", "{", "String", "idScript", "=", "null", ";", "// map the tagId to the real id", "if", "(", "TagConfig", ".", "isDefaultJavaScript", "(", ")", ")", "{"...
Much of the code below is taken from the HtmlBaseTag. We need to eliminate this duplication through some type of helper methods.
[ "Much", "of", "the", "code", "below", "is", "taken", "from", "the", "HtmlBaseTag", ".", "We", "need", "to", "eliminate", "this", "duplication", "through", "some", "type", "of", "helper", "methods", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/Tree.java#L1045-L1055
alibaba/ARouter
arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java
Postcard.withParcelable
public Postcard withParcelable(@Nullable String key, @Nullable Parcelable value) { mBundle.putParcelable(key, value); return this; }
java
public Postcard withParcelable(@Nullable String key, @Nullable Parcelable value) { mBundle.putParcelable(key, value); return this; }
[ "public", "Postcard", "withParcelable", "(", "@", "Nullable", "String", "key", ",", "@", "Nullable", "Parcelable", "value", ")", "{", "mBundle", ".", "putParcelable", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a Parcelable value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Parcelable object, or null @return current
[ "Inserts", "a", "Parcelable", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L374-L377
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toNodeList
public static NodeList toNodeList(Object o) throws PageException { // print.ln("nodeList:"+o); if (o instanceof NodeList) { return (NodeList) o; } else if (o instanceof ObjectWrap) { return toNodeList(((ObjectWrap) o).getEmbededObject()); } throw new CasterException(o, "NodeList"); }
java
public static NodeList toNodeList(Object o) throws PageException { // print.ln("nodeList:"+o); if (o instanceof NodeList) { return (NodeList) o; } else if (o instanceof ObjectWrap) { return toNodeList(((ObjectWrap) o).getEmbededObject()); } throw new CasterException(o, "NodeList"); }
[ "public", "static", "NodeList", "toNodeList", "(", "Object", "o", ")", "throws", "PageException", "{", "// print.ln(\"nodeList:\"+o);", "if", "(", "o", "instanceof", "NodeList", ")", "{", "return", "(", "NodeList", ")", "o", ";", "}", "else", "if", "(", "o",...
casts a Object to a Node List @param o Object to Cast @return NodeList from Object @throws PageException
[ "casts", "a", "Object", "to", "a", "Node", "List" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L4271-L4280
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogram.java
FixedBucketsHistogram.writeByteBufferSerdeHeader
private void writeByteBufferSerdeHeader(ByteBuffer buf, byte mode) { buf.put(SERIALIZATION_VERSION); buf.put(mode); }
java
private void writeByteBufferSerdeHeader(ByteBuffer buf, byte mode) { buf.put(SERIALIZATION_VERSION); buf.put(mode); }
[ "private", "void", "writeByteBufferSerdeHeader", "(", "ByteBuffer", "buf", ",", "byte", "mode", ")", "{", "buf", ".", "put", "(", "SERIALIZATION_VERSION", ")", ";", "buf", ".", "put", "(", "mode", ")", ";", "}" ]
Write a serialization header containing the serde version byte and full/sparse encoding mode byte. This header is not needed when serializing the histogram for localized internal use within the buffer aggregator implementation. @param buf Destination buffer @param mode Full or sparse mode
[ "Write", "a", "serialization", "header", "containing", "the", "serde", "version", "byte", "and", "full", "/", "sparse", "encoding", "mode", "byte", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogram.java#L788-L792
atomix/atomix
cluster/src/main/java/io/atomix/cluster/protocol/SwimMembershipProtocol.java
SwimMembershipProtocol.handleProbe
private ImmutableMember handleProbe(Pair<ImmutableMember, ImmutableMember> members) { ImmutableMember remoteMember = members.getLeft(); ImmutableMember localMember = members.getRight(); LOGGER.trace("{} - Received probe {} from {}", this.localMember.id(), localMember, remoteMember); // If the probe indicates a term greater than the local term, update the local term, increment and respond. if (localMember.incarnationNumber() > this.localMember.getIncarnationNumber()) { this.localMember.setIncarnationNumber(localMember.incarnationNumber() + 1); if (config.isBroadcastDisputes()) { broadcast(this.localMember.copy()); } } // If the probe indicates this member is suspect, increment the local term and respond. else if (localMember.state() == State.SUSPECT) { this.localMember.setIncarnationNumber(this.localMember.getIncarnationNumber() + 1); if (config.isBroadcastDisputes()) { broadcast(this.localMember.copy()); } } // Update the state of the probing member. updateState(remoteMember); return this.localMember.copy(); }
java
private ImmutableMember handleProbe(Pair<ImmutableMember, ImmutableMember> members) { ImmutableMember remoteMember = members.getLeft(); ImmutableMember localMember = members.getRight(); LOGGER.trace("{} - Received probe {} from {}", this.localMember.id(), localMember, remoteMember); // If the probe indicates a term greater than the local term, update the local term, increment and respond. if (localMember.incarnationNumber() > this.localMember.getIncarnationNumber()) { this.localMember.setIncarnationNumber(localMember.incarnationNumber() + 1); if (config.isBroadcastDisputes()) { broadcast(this.localMember.copy()); } } // If the probe indicates this member is suspect, increment the local term and respond. else if (localMember.state() == State.SUSPECT) { this.localMember.setIncarnationNumber(this.localMember.getIncarnationNumber() + 1); if (config.isBroadcastDisputes()) { broadcast(this.localMember.copy()); } } // Update the state of the probing member. updateState(remoteMember); return this.localMember.copy(); }
[ "private", "ImmutableMember", "handleProbe", "(", "Pair", "<", "ImmutableMember", ",", "ImmutableMember", ">", "members", ")", "{", "ImmutableMember", "remoteMember", "=", "members", ".", "getLeft", "(", ")", ";", "ImmutableMember", "localMember", "=", "members", ...
Handles a probe from another peer. @param members the probing member and local member info @return the current term
[ "Handles", "a", "probe", "from", "another", "peer", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/cluster/src/main/java/io/atomix/cluster/protocol/SwimMembershipProtocol.java#L437-L461
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java
GitFlowGraphMonitor.getEdgeConfigWithOverrides
private Config getEdgeConfigWithOverrides(Config edgeConfig, Path edgeFilePath) { String source = edgeFilePath.getParent().getParent().getName(); String destination = edgeFilePath.getParent().getName(); String edgeName = Files.getNameWithoutExtension(edgeFilePath.getName()); return edgeConfig.withValue(FlowGraphConfigurationKeys.FLOW_EDGE_SOURCE_KEY, ConfigValueFactory.fromAnyRef(source)) .withValue(FlowGraphConfigurationKeys.FLOW_EDGE_DESTINATION_KEY, ConfigValueFactory.fromAnyRef(destination)) .withValue(FlowGraphConfigurationKeys.FLOW_EDGE_ID_KEY, ConfigValueFactory.fromAnyRef(getEdgeId(source, destination, edgeName))); }
java
private Config getEdgeConfigWithOverrides(Config edgeConfig, Path edgeFilePath) { String source = edgeFilePath.getParent().getParent().getName(); String destination = edgeFilePath.getParent().getName(); String edgeName = Files.getNameWithoutExtension(edgeFilePath.getName()); return edgeConfig.withValue(FlowGraphConfigurationKeys.FLOW_EDGE_SOURCE_KEY, ConfigValueFactory.fromAnyRef(source)) .withValue(FlowGraphConfigurationKeys.FLOW_EDGE_DESTINATION_KEY, ConfigValueFactory.fromAnyRef(destination)) .withValue(FlowGraphConfigurationKeys.FLOW_EDGE_ID_KEY, ConfigValueFactory.fromAnyRef(getEdgeId(source, destination, edgeName))); }
[ "private", "Config", "getEdgeConfigWithOverrides", "(", "Config", "edgeConfig", ",", "Path", "edgeFilePath", ")", "{", "String", "source", "=", "edgeFilePath", ".", "getParent", "(", ")", ".", "getParent", "(", ")", ".", "getName", "(", ")", ";", "String", "...
Helper that overrides the flow edge properties with name derived from the edge file path @param edgeConfig edge config @param edgeFilePath path of the edge file @return config with overridden edge properties
[ "Helper", "that", "overrides", "the", "flow", "edge", "properties", "with", "name", "derived", "from", "the", "edge", "file", "path" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java#L324-L332
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java
ResolvableType.forClass
public static ResolvableType forClass(Class<?> sourceClass, Class<?> implementationClass) { LettuceAssert.notNull(sourceClass, "Source class must not be null"); ResolvableType asType = forType(implementationClass).as(sourceClass); return (asType == NONE ? forType(sourceClass) : asType); }
java
public static ResolvableType forClass(Class<?> sourceClass, Class<?> implementationClass) { LettuceAssert.notNull(sourceClass, "Source class must not be null"); ResolvableType asType = forType(implementationClass).as(sourceClass); return (asType == NONE ? forType(sourceClass) : asType); }
[ "public", "static", "ResolvableType", "forClass", "(", "Class", "<", "?", ">", "sourceClass", ",", "Class", "<", "?", ">", "implementationClass", ")", "{", "LettuceAssert", ".", "notNull", "(", "sourceClass", ",", "\"Source class must not be null\"", ")", ";", "...
Return a {@link ResolvableType} for the specified {@link Class} with a given implementation. For example: {@code ResolvableType.forClass(List.class, MyArrayList.class)}. @param sourceClass the source class (must not be {@code null} @param implementationClass the implementation class @return a {@link ResolvableType} for the specified class backed by the given implementation class @see #forClass(Class) @see #forClassWithGenerics(Class, Class...)
[ "Return", "a", "{", "@link", "ResolvableType", "}", "for", "the", "specified", "{", "@link", "Class", "}", "with", "a", "given", "implementation", ".", "For", "example", ":", "{", "@code", "ResolvableType", ".", "forClass", "(", "List", ".", "class", "MyAr...
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java#L863-L867
EvidentSolutions/dalesbred
dalesbred/src/main/java/org/dalesbred/dialect/Dialect.java
Dialect.bindArgument
public void bindArgument(@NotNull PreparedStatement ps, int index, @Nullable Object value) throws SQLException { ArgumentBinder.bindArgument(ps, index, value); }
java
public void bindArgument(@NotNull PreparedStatement ps, int index, @Nullable Object value) throws SQLException { ArgumentBinder.bindArgument(ps, index, value); }
[ "public", "void", "bindArgument", "(", "@", "NotNull", "PreparedStatement", "ps", ",", "int", "index", ",", "@", "Nullable", "Object", "value", ")", "throws", "SQLException", "{", "ArgumentBinder", ".", "bindArgument", "(", "ps", ",", "index", ",", "value", ...
Bind object to {@link PreparedStatement}. Can be overridden by subclasses to implement custom argument binding. @param ps statement to bind object to @param index index of the parameter @param value to bind @throws SQLException if something fails
[ "Bind", "object", "to", "{", "@link", "PreparedStatement", "}", ".", "Can", "be", "overridden", "by", "subclasses", "to", "implement", "custom", "argument", "binding", "." ]
train
https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/dialect/Dialect.java#L155-L157
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImpl.java
DoublesUnionImpl.directInstance
static DoublesUnionImpl directInstance(final int maxK, final WritableMemory dstMem) { final DirectUpdateDoublesSketch sketch = DirectUpdateDoublesSketch.newInstance(maxK, dstMem); final DoublesUnionImpl union = new DoublesUnionImpl(maxK); union.maxK_ = maxK; union.gadget_ = sketch; return union; }
java
static DoublesUnionImpl directInstance(final int maxK, final WritableMemory dstMem) { final DirectUpdateDoublesSketch sketch = DirectUpdateDoublesSketch.newInstance(maxK, dstMem); final DoublesUnionImpl union = new DoublesUnionImpl(maxK); union.maxK_ = maxK; union.gadget_ = sketch; return union; }
[ "static", "DoublesUnionImpl", "directInstance", "(", "final", "int", "maxK", ",", "final", "WritableMemory", "dstMem", ")", "{", "final", "DirectUpdateDoublesSketch", "sketch", "=", "DirectUpdateDoublesSketch", ".", "newInstance", "(", "maxK", ",", "dstMem", ")", ";...
Returns a empty DoublesUnion object that refers to the given direct, off-heap Memory, which will be initialized to the empty state. @param maxK determines the accuracy and size of the union and is a maximum value. The effective <i>k</i> can be smaller due to unions with smaller <i>k</i> sketches. It is recommended that <i>maxK</i> be a power of 2 to enable unioning of sketches with different values of <i>k</i>. @param dstMem the Memory to be used by the sketch @return a DoublesUnion object
[ "Returns", "a", "empty", "DoublesUnion", "object", "that", "refers", "to", "the", "given", "direct", "off", "-", "heap", "Memory", "which", "will", "be", "initialized", "to", "the", "empty", "state", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImpl.java#L48-L54
zaproxy/zaproxy
src/org/parosproxy/paros/view/WorkbenchPanel.java
WorkbenchPanel.getSortedPanels
public SortedSet<AbstractPanel> getSortedPanels(PanelType panelType) { validateNotNull(panelType, "panelType"); List<AbstractPanel> panels = getPanels(panelType); SortedSet<AbstractPanel> sortedPanels = new TreeSet<>(new Comparator<AbstractPanel>() { @Override public int compare(AbstractPanel abstractPanel, AbstractPanel otherAbstractPanel) { String name = abstractPanel.getName(); String otherName = otherAbstractPanel.getName(); if (name == null) { if (otherName == null) { return 0; } return -1; } else if (otherName == null) { return 1; } return name.compareTo(otherName); } }); sortedPanels.addAll(panels); return sortedPanels; }
java
public SortedSet<AbstractPanel> getSortedPanels(PanelType panelType) { validateNotNull(panelType, "panelType"); List<AbstractPanel> panels = getPanels(panelType); SortedSet<AbstractPanel> sortedPanels = new TreeSet<>(new Comparator<AbstractPanel>() { @Override public int compare(AbstractPanel abstractPanel, AbstractPanel otherAbstractPanel) { String name = abstractPanel.getName(); String otherName = otherAbstractPanel.getName(); if (name == null) { if (otherName == null) { return 0; } return -1; } else if (otherName == null) { return 1; } return name.compareTo(otherName); } }); sortedPanels.addAll(panels); return sortedPanels; }
[ "public", "SortedSet", "<", "AbstractPanel", ">", "getSortedPanels", "(", "PanelType", "panelType", ")", "{", "validateNotNull", "(", "panelType", ",", "\"panelType\"", ")", ";", "List", "<", "AbstractPanel", ">", "panels", "=", "getPanels", "(", "panelType", ")...
Gets the panels, sorted by name, that were added to the workbench with the given panel type. @param panelType the type of the panel @return a {@code List} with the sorted panels of the given type @throws IllegalArgumentException if the given parameter is {@code null}. @since 2.5.0
[ "Gets", "the", "panels", "sorted", "by", "name", "that", "were", "added", "to", "the", "workbench", "with", "the", "given", "panel", "type", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L1067-L1090
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/jni/Serial.java
Serial.write
public synchronized static void write(int fd, CharSequence ... data) throws IllegalStateException, IOException { write(fd, StandardCharsets.US_ASCII, data); }
java
public synchronized static void write(int fd, CharSequence ... data) throws IllegalStateException, IOException { write(fd, StandardCharsets.US_ASCII, data); }
[ "public", "synchronized", "static", "void", "write", "(", "int", "fd", ",", "CharSequence", "...", "data", ")", "throws", "IllegalStateException", ",", "IOException", "{", "write", "(", "fd", ",", "StandardCharsets", ".", "US_ASCII", ",", "data", ")", ";", "...
<p>Sends one or more ASCII string objects to the serial port/device identified by the given file descriptor.</p> @param fd The file descriptor of the serial port/device. @param data One or more ASCII string objects (or an array) of data to be transmitted. (variable-length-argument)
[ "<p", ">", "Sends", "one", "or", "more", "ASCII", "string", "objects", "to", "the", "serial", "port", "/", "device", "identified", "by", "the", "given", "file", "descriptor", ".", "<", "/", "p", ">" ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/jni/Serial.java#L868-L870
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.multTransA
public static void multTransA(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { if( b.numCols == 1 ) { // todo check a.numCols == 1 and do inner product? // there are significantly faster algorithms when dealing with vectors if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixVectorMult_DDRM.multTransA_reorder(a,b,c); } else { MatrixVectorMult_DDRM.multTransA_small(a,b,c); } } else if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH || b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixMatrixMult_DDRM.multTransA_reorder(a, b, c); } else { MatrixMatrixMult_DDRM.multTransA_small(a, b, c); } }
java
public static void multTransA(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { if( b.numCols == 1 ) { // todo check a.numCols == 1 and do inner product? // there are significantly faster algorithms when dealing with vectors if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixVectorMult_DDRM.multTransA_reorder(a,b,c); } else { MatrixVectorMult_DDRM.multTransA_small(a,b,c); } } else if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH || b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixMatrixMult_DDRM.multTransA_reorder(a, b, c); } else { MatrixMatrixMult_DDRM.multTransA_small(a, b, c); } }
[ "public", "static", "void", "multTransA", "(", "DMatrix1Row", "a", ",", "DMatrix1Row", "b", ",", "DMatrix1Row", "c", ")", "{", "if", "(", "b", ".", "numCols", "==", "1", ")", "{", "// todo check a.numCols == 1 and do inner product?", "// there are significantly fast...
<p>Performs the following operation:<br> <br> c = a<sup>T</sup> * b <br> <br> c<sub>ij</sub> = &sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>kj</sub>} </p> @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "a<sup", ">", "T<", "/", "sup", ">", "*", "b", "<br", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&sum", ";", "<sub", ">", "k", "=...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L121-L137
meltmedia/cadmium
servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java
AbstractSecureRedirectStrategy.secureUrl
public String secureUrl(HttpServletRequest request, HttpServletResponse response) throws IOException { String protocol = getProtocol(request); if( protocol.equalsIgnoreCase(HTTP_PROTOCOL) ) { int port = mapPort(TO_SECURE_PORT_MAP, getPort(request)); try { URI newUri = changeProtocolAndPort(HTTPS_PROTOCOL, port == DEFAULT_HTTPS_PORT ? -1 : port, request); return newUri.toString(); } catch (URISyntaxException e) { throw new IllegalStateException("Failed to create URI.", e); } } else { throw new UnsupportedProtocolException("Cannot build secure url for "+protocol); } }
java
public String secureUrl(HttpServletRequest request, HttpServletResponse response) throws IOException { String protocol = getProtocol(request); if( protocol.equalsIgnoreCase(HTTP_PROTOCOL) ) { int port = mapPort(TO_SECURE_PORT_MAP, getPort(request)); try { URI newUri = changeProtocolAndPort(HTTPS_PROTOCOL, port == DEFAULT_HTTPS_PORT ? -1 : port, request); return newUri.toString(); } catch (URISyntaxException e) { throw new IllegalStateException("Failed to create URI.", e); } } else { throw new UnsupportedProtocolException("Cannot build secure url for "+protocol); } }
[ "public", "String", "secureUrl", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", "{", "String", "protocol", "=", "getProtocol", "(", "request", ")", ";", "if", "(", "protocol", ".", "equalsIgnoreCase", "(...
Returns the secure version of the original URL for the request. @param request the insecure request that was made. @param response the response for the request. @return the secure version of the original URL for the request. @throws IOException if the url could not be created.
[ "Returns", "the", "secure", "version", "of", "the", "original", "URL", "for", "the", "request", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java#L109-L123
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ListUtil.java
ListUtil.sortIgnoreEmpty
public static String sortIgnoreEmpty(String list, String sortType, String sortOrder, String delimiter) throws PageException { return _sort(toStringArray(listToArrayRemoveEmpty(list, delimiter)), sortType, sortOrder, delimiter); }
java
public static String sortIgnoreEmpty(String list, String sortType, String sortOrder, String delimiter) throws PageException { return _sort(toStringArray(listToArrayRemoveEmpty(list, delimiter)), sortType, sortOrder, delimiter); }
[ "public", "static", "String", "sortIgnoreEmpty", "(", "String", "list", ",", "String", "sortType", ",", "String", "sortOrder", ",", "String", "delimiter", ")", "throws", "PageException", "{", "return", "_sort", "(", "toStringArray", "(", "listToArrayRemoveEmpty", ...
sorts a string list @param list list to sort @param sortType sort type (numeric,text,textnocase) @param sortOrder sort order (asc,desc) @param delimiter list delimiter @return sorted list @throws PageException
[ "sorts", "a", "string", "list" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ListUtil.java#L1143-L1145
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/GammaDistribution.java
GammaDistribution.logpdf
public static double logpdf(double x, double k, double theta) { if(x < 0) { return Double.NEGATIVE_INFINITY; } if(x == 0) { return (k == 1.0) ? FastMath.log(theta) : Double.NEGATIVE_INFINITY; } if(k == 1.0) { return FastMath.log(theta) - x * theta; } final double xt = x * theta; return (xt == Double.POSITIVE_INFINITY) ? Double.NEGATIVE_INFINITY : // FastMath.log(theta) + (k - 1.0) * FastMath.log(xt) - xt - logGamma(k); }
java
public static double logpdf(double x, double k, double theta) { if(x < 0) { return Double.NEGATIVE_INFINITY; } if(x == 0) { return (k == 1.0) ? FastMath.log(theta) : Double.NEGATIVE_INFINITY; } if(k == 1.0) { return FastMath.log(theta) - x * theta; } final double xt = x * theta; return (xt == Double.POSITIVE_INFINITY) ? Double.NEGATIVE_INFINITY : // FastMath.log(theta) + (k - 1.0) * FastMath.log(xt) - xt - logGamma(k); }
[ "public", "static", "double", "logpdf", "(", "double", "x", ",", "double", "k", ",", "double", "theta", ")", "{", "if", "(", "x", "<", "0", ")", "{", "return", "Double", ".", "NEGATIVE_INFINITY", ";", "}", "if", "(", "x", "==", "0", ")", "{", "re...
Gamma distribution PDF (with 0.0 for x &lt; 0) @param x query value @param k Alpha @param theta Theta = 1 / Beta @return probability density
[ "Gamma", "distribution", "PDF", "(", "with", "0", ".", "0", "for", "x", "&lt", ";", "0", ")" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/GammaDistribution.java#L240-L253
twitter/scalding
scalding-core/src/main/java/com/twitter/scalding/tap/GlobHfs.java
GlobHfs.getSize
public static long getSize(Path path, JobConf conf) throws IOException { FileSystem fs = path.getFileSystem(conf); FileStatus[] statuses = fs.globStatus(path); if (statuses == null) { throw new FileNotFoundException(String.format("File not found: %s", path)); } long size = 0; for (FileStatus status : statuses) { size += fs.getContentSummary(status.getPath()).getLength(); } return size; }
java
public static long getSize(Path path, JobConf conf) throws IOException { FileSystem fs = path.getFileSystem(conf); FileStatus[] statuses = fs.globStatus(path); if (statuses == null) { throw new FileNotFoundException(String.format("File not found: %s", path)); } long size = 0; for (FileStatus status : statuses) { size += fs.getContentSummary(status.getPath()).getLength(); } return size; }
[ "public", "static", "long", "getSize", "(", "Path", "path", ",", "JobConf", "conf", ")", "throws", "IOException", "{", "FileSystem", "fs", "=", "path", ".", "getFileSystem", "(", "conf", ")", ";", "FileStatus", "[", "]", "statuses", "=", "fs", ".", "glob...
Get the total size of the file(s) specified by the Hfs, which may contain a glob pattern in its path, so we must be ready to handle that case.
[ "Get", "the", "total", "size", "of", "the", "file", "(", "s", ")", "specified", "by", "the", "Hfs", "which", "may", "contain", "a", "glob", "pattern", "in", "its", "path", "so", "we", "must", "be", "ready", "to", "handle", "that", "case", "." ]
train
https://github.com/twitter/scalding/blob/428b5507279655676e507d52c669c3cbc7812dc0/scalding-core/src/main/java/com/twitter/scalding/tap/GlobHfs.java#L37-L50
OpenLiberty/open-liberty
dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java
IFixUtils.getExistingMatchingIfixID
private static String getExistingMatchingIfixID(BundleFile bundleFile, Set<String> existingIDs, Map<String, BundleFile> bundleFiles) { String existingIfixKey = null; // Iterate over the known ids. for (String existingID : existingIDs) { // If we have a corresponding BundleFile for the existing ID, we need to check it matches the currently processed file. if (bundleFiles.containsKey(existingID)) { BundleFile existingBundleFile = bundleFiles.get(existingID); // If our symbolic name match the supplied BundleFile then move on to the version checking. if (bundleFile.getSymbolicName().equals(existingBundleFile.getSymbolicName())) { //Get the versions of both the checking bundle and the existing bundle. Check that the version, excluding the qualifier match // and if they do, we have a match. Version existingBundleVersion = new Version(existingBundleFile.getVersion()); Version bundleVersion = new Version(bundleFile.getVersion()); if (bundleVersion.getMajor() == existingBundleVersion.getMajor() && bundleVersion.getMinor() == existingBundleVersion.getMinor() && bundleVersion.getMicro() == existingBundleVersion.getMicro()) existingIfixKey = existingID; } } } return existingIfixKey; }
java
private static String getExistingMatchingIfixID(BundleFile bundleFile, Set<String> existingIDs, Map<String, BundleFile> bundleFiles) { String existingIfixKey = null; // Iterate over the known ids. for (String existingID : existingIDs) { // If we have a corresponding BundleFile for the existing ID, we need to check it matches the currently processed file. if (bundleFiles.containsKey(existingID)) { BundleFile existingBundleFile = bundleFiles.get(existingID); // If our symbolic name match the supplied BundleFile then move on to the version checking. if (bundleFile.getSymbolicName().equals(existingBundleFile.getSymbolicName())) { //Get the versions of both the checking bundle and the existing bundle. Check that the version, excluding the qualifier match // and if they do, we have a match. Version existingBundleVersion = new Version(existingBundleFile.getVersion()); Version bundleVersion = new Version(bundleFile.getVersion()); if (bundleVersion.getMajor() == existingBundleVersion.getMajor() && bundleVersion.getMinor() == existingBundleVersion.getMinor() && bundleVersion.getMicro() == existingBundleVersion.getMicro()) existingIfixKey = existingID; } } } return existingIfixKey; }
[ "private", "static", "String", "getExistingMatchingIfixID", "(", "BundleFile", "bundleFile", ",", "Set", "<", "String", ">", "existingIDs", ",", "Map", "<", "String", ",", "BundleFile", ">", "bundleFiles", ")", "{", "String", "existingIfixKey", "=", "null", ";",...
This method takes a ifix ID finds any existing IFix IDs that refer to the same base bundle. Because the ifix jars will have different qualifiers, we need to be able to work out which ids are related. @param bundleFile - The bundleFile that maps to the current jar file we're processing. @param existingIDs - A Set of Strings that represent the existing updateIds. @param bundleFiles - All the known bundleFile objects. @return - The existing key that maps to the same base bundle.
[ "This", "method", "takes", "a", "ifix", "ID", "finds", "any", "existing", "IFix", "IDs", "that", "refer", "to", "the", "same", "base", "bundle", ".", "Because", "the", "ifix", "jars", "will", "have", "different", "qualifiers", "we", "need", "to", "be", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.product.utility/src/com/ibm/ws/product/utility/extension/IFixUtils.java#L489-L510
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/implementation/util/FluxUtil.java
FluxUtil.byteBufStreamFromFile
public static Flux<ByteBuf> byteBufStreamFromFile(AsynchronousFileChannel fileChannel) { try { long size = fileChannel.size(); return byteBufStreamFromFile(fileChannel, DEFAULT_CHUNK_SIZE, 0, size); } catch (IOException e) { return Flux.error(e); } }
java
public static Flux<ByteBuf> byteBufStreamFromFile(AsynchronousFileChannel fileChannel) { try { long size = fileChannel.size(); return byteBufStreamFromFile(fileChannel, DEFAULT_CHUNK_SIZE, 0, size); } catch (IOException e) { return Flux.error(e); } }
[ "public", "static", "Flux", "<", "ByteBuf", ">", "byteBufStreamFromFile", "(", "AsynchronousFileChannel", "fileChannel", ")", "{", "try", "{", "long", "size", "=", "fileChannel", ".", "size", "(", ")", ";", "return", "byteBufStreamFromFile", "(", "fileChannel", ...
Creates a {@link Flux} from an {@link AsynchronousFileChannel} which reads the entire file. @param fileChannel The file channel. @return The AsyncInputStream.
[ "Creates", "a", "{", "@link", "Flux", "}", "from", "an", "{", "@link", "AsynchronousFileChannel", "}", "which", "reads", "the", "entire", "file", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/util/FluxUtil.java#L188-L195
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteClosedListEntityRole
public OperationStatus deleteClosedListEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { return deleteClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
java
public OperationStatus deleteClosedListEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { return deleteClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
[ "public", "OperationStatus", "deleteClosedListEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ")", "{", "return", "deleteClosedListEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", ...
Delete an entity role. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role Id. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Delete", "an", "entity", "role", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L11853-L11855
jnr/jnr-x86asm
src/main/java/jnr/x86asm/SerializerIntrinsics.java
SerializerIntrinsics.pcmpestri
public final void pcmpestri(XMMRegister dst, XMMRegister src, Immediate imm8) { emitX86(INST_PCMPESTRI, dst, src, imm8); }
java
public final void pcmpestri(XMMRegister dst, XMMRegister src, Immediate imm8) { emitX86(INST_PCMPESTRI, dst, src, imm8); }
[ "public", "final", "void", "pcmpestri", "(", "XMMRegister", "dst", ",", "XMMRegister", "src", ",", "Immediate", "imm8", ")", "{", "emitX86", "(", "INST_PCMPESTRI", ",", "dst", ",", "src", ",", "imm8", ")", ";", "}" ]
Packed Compare Explicit Length Strings, Return Index (SSE4.2).
[ "Packed", "Compare", "Explicit", "Length", "Strings", "Return", "Index", "(", "SSE4", ".", "2", ")", "." ]
train
https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/SerializerIntrinsics.java#L6529-L6532
apache/incubator-shardingsphere
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/OptimizeEngineFactory.java
OptimizeEngineFactory.newInstance
public static OptimizeEngine newInstance(final EncryptRule encryptRule, final SQLStatement sqlStatement, final List<Object> parameters) { if (sqlStatement instanceof InsertStatement) { return new EncryptInsertOptimizeEngine(encryptRule, (InsertStatement) sqlStatement, parameters); } return new EncryptDefaultOptimizeEngine(); }
java
public static OptimizeEngine newInstance(final EncryptRule encryptRule, final SQLStatement sqlStatement, final List<Object> parameters) { if (sqlStatement instanceof InsertStatement) { return new EncryptInsertOptimizeEngine(encryptRule, (InsertStatement) sqlStatement, parameters); } return new EncryptDefaultOptimizeEngine(); }
[ "public", "static", "OptimizeEngine", "newInstance", "(", "final", "EncryptRule", "encryptRule", ",", "final", "SQLStatement", "sqlStatement", ",", "final", "List", "<", "Object", ">", "parameters", ")", "{", "if", "(", "sqlStatement", "instanceof", "InsertStatement...
Create encrypt optimize engine instance. @param encryptRule encrypt rule @param sqlStatement sql statement @param parameters parameters @return encrypt optimize engine instance
[ "Create", "encrypt", "optimize", "engine", "instance", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/OptimizeEngineFactory.java#L74-L79
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/ui/groupeditor/CmsInheritanceContainerEditor.java
CmsInheritanceContainerEditor.createOptionBar
private CmsElementOptionBar createOptionBar(CmsContainerPageElementPanel elementWidget) { CmsElementOptionBar optionBar = new CmsElementOptionBar(elementWidget); CmsPushButton button = new CmsRemoveOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); button = new CmsFavoritesOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); button = new CmsSettingsOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); button = new CmsInfoOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); button = new CmsAddOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); button = new CmsInheritedOptionButton(elementWidget, this); optionBar.add(button); button = new CmsMoveOptionButton(elementWidget, this); // setting the drag and drop handler button.addMouseDownHandler(getController().getDndHandler()); optionBar.add(button); button = new CmsEditOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); return optionBar; }
java
private CmsElementOptionBar createOptionBar(CmsContainerPageElementPanel elementWidget) { CmsElementOptionBar optionBar = new CmsElementOptionBar(elementWidget); CmsPushButton button = new CmsRemoveOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); button = new CmsFavoritesOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); button = new CmsSettingsOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); button = new CmsInfoOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); button = new CmsAddOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); button = new CmsInheritedOptionButton(elementWidget, this); optionBar.add(button); button = new CmsMoveOptionButton(elementWidget, this); // setting the drag and drop handler button.addMouseDownHandler(getController().getDndHandler()); optionBar.add(button); button = new CmsEditOptionButton(elementWidget, this); button.addClickHandler(m_optionClickHandler); optionBar.add(button); return optionBar; }
[ "private", "CmsElementOptionBar", "createOptionBar", "(", "CmsContainerPageElementPanel", "elementWidget", ")", "{", "CmsElementOptionBar", "optionBar", "=", "new", "CmsElementOptionBar", "(", "elementWidget", ")", ";", "CmsPushButton", "button", "=", "new", "CmsRemoveOptio...
Creates an option bar for the given element.<p> @param elementWidget the element widget @return the option bar
[ "Creates", "an", "option", "bar", "for", "the", "given", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/groupeditor/CmsInheritanceContainerEditor.java#L528-L564
socialsensor/socialsensor-framework-client
src/main/java/eu/socialsensor/framework/client/search/visual/VisualIndexHandler.java
VisualIndexHandler.getSimilarImages
public JsonResultSet getSimilarImages(String imageId, double threshold) { JsonResultSet similar = new JsonResultSet(); PostMethod queryMethod = null; String response = null; try { Part[] parts = { new StringPart("id", imageId), new StringPart("threshold", String.valueOf(threshold)) }; queryMethod = new PostMethod(webServiceHost + "/rest/visual/query_id/" + collectionName); queryMethod.setRequestEntity(new MultipartRequestEntity(parts, queryMethod.getParams())); int code = httpClient.executeMethod(queryMethod); if (code == 200) { InputStream inputStream = queryMethod.getResponseBodyAsStream(); StringWriter writer = new StringWriter(); IOUtils.copy(inputStream, writer); response = writer.toString(); queryMethod.releaseConnection(); similar = parseResponse(response); } else { _logger.error("Http returned code: " + code); } } catch (Exception e) { _logger.error("Exception for ID: " + imageId, e); response = null; } finally { if (queryMethod != null) { queryMethod.releaseConnection(); } } return similar; }
java
public JsonResultSet getSimilarImages(String imageId, double threshold) { JsonResultSet similar = new JsonResultSet(); PostMethod queryMethod = null; String response = null; try { Part[] parts = { new StringPart("id", imageId), new StringPart("threshold", String.valueOf(threshold)) }; queryMethod = new PostMethod(webServiceHost + "/rest/visual/query_id/" + collectionName); queryMethod.setRequestEntity(new MultipartRequestEntity(parts, queryMethod.getParams())); int code = httpClient.executeMethod(queryMethod); if (code == 200) { InputStream inputStream = queryMethod.getResponseBodyAsStream(); StringWriter writer = new StringWriter(); IOUtils.copy(inputStream, writer); response = writer.toString(); queryMethod.releaseConnection(); similar = parseResponse(response); } else { _logger.error("Http returned code: " + code); } } catch (Exception e) { _logger.error("Exception for ID: " + imageId, e); response = null; } finally { if (queryMethod != null) { queryMethod.releaseConnection(); } } return similar; }
[ "public", "JsonResultSet", "getSimilarImages", "(", "String", "imageId", ",", "double", "threshold", ")", "{", "JsonResultSet", "similar", "=", "new", "JsonResultSet", "(", ")", ";", "PostMethod", "queryMethod", "=", "null", ";", "String", "response", "=", "null...
Get similar images for a specific media item @param imageId @param threshold @return
[ "Get", "similar", "images", "for", "a", "specific", "media", "item" ]
train
https://github.com/socialsensor/socialsensor-framework-client/blob/67cd45c5d8e096d5f76ace49f453ff6438920473/src/main/java/eu/socialsensor/framework/client/search/visual/VisualIndexHandler.java#L74-L111
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsDateTimeUtil.java
CmsDateTimeUtil.getTime
public static String getTime(Date date, Format format) { DateTimeFormat df; switch (format) { case FULL: df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_FULL); break; case LONG: df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_LONG); break; case MEDIUM: df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_MEDIUM); break; case SHORT: df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_SHORT); break; default: // can never happen, just to prevent stupid warning return ""; } return df.format(date); }
java
public static String getTime(Date date, Format format) { DateTimeFormat df; switch (format) { case FULL: df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_FULL); break; case LONG: df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_LONG); break; case MEDIUM: df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_MEDIUM); break; case SHORT: df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.TIME_SHORT); break; default: // can never happen, just to prevent stupid warning return ""; } return df.format(date); }
[ "public", "static", "String", "getTime", "(", "Date", "date", ",", "Format", "format", ")", "{", "DateTimeFormat", "df", ";", "switch", "(", "format", ")", "{", "case", "FULL", ":", "df", "=", "DateTimeFormat", ".", "getFormat", "(", "DateTimeFormat", ".",...
Returns a formated time String from a Date value, the formatting based on the provided options.<p> @param date the Date object to format as String @param format the format to use @return the formatted time
[ "Returns", "a", "formated", "time", "String", "from", "a", "Date", "value", "the", "formatting", "based", "on", "the", "provided", "options", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDateTimeUtil.java#L155-L176
aws/aws-sdk-java
aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/GrantConstraints.java
GrantConstraints.withEncryptionContextSubset
public GrantConstraints withEncryptionContextSubset(java.util.Map<String, String> encryptionContextSubset) { setEncryptionContextSubset(encryptionContextSubset); return this; }
java
public GrantConstraints withEncryptionContextSubset(java.util.Map<String, String> encryptionContextSubset) { setEncryptionContextSubset(encryptionContextSubset); return this; }
[ "public", "GrantConstraints", "withEncryptionContextSubset", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "encryptionContextSubset", ")", "{", "setEncryptionContextSubset", "(", "encryptionContextSubset", ")", ";", "return", "this", ";", ...
<p> A list of key-value pairs, all of which must be present in the encryption context of certain subsequent operations that the grant allows. When certain subsequent operations allowed by the grant include encryption context that matches this list or is a superset of this list, the grant allows the operation. Otherwise, the grant does not allow the operation. </p> @param encryptionContextSubset A list of key-value pairs, all of which must be present in the encryption context of certain subsequent operations that the grant allows. When certain subsequent operations allowed by the grant include encryption context that matches this list or is a superset of this list, the grant allows the operation. Otherwise, the grant does not allow the operation. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "list", "of", "key", "-", "value", "pairs", "all", "of", "which", "must", "be", "present", "in", "the", "encryption", "context", "of", "certain", "subsequent", "operations", "that", "the", "grant", "allows", ".", "When", "certain", "subsequ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/GrantConstraints.java#L117-L120
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java
RedBlackTreeInteger.searchNearestLower
public Node<T> searchNearestLower(int value, boolean acceptEquals) { if (root == null) return null; return searchNearestLower(root, value, acceptEquals); }
java
public Node<T> searchNearestLower(int value, boolean acceptEquals) { if (root == null) return null; return searchNearestLower(root, value, acceptEquals); }
[ "public", "Node", "<", "T", ">", "searchNearestLower", "(", "int", "value", ",", "boolean", "acceptEquals", ")", "{", "if", "(", "root", "==", "null", ")", "return", "null", ";", "return", "searchNearestLower", "(", "root", ",", "value", ",", "acceptEquals...
Returns the node containing the highest value strictly lower than the given one.
[ "Returns", "the", "node", "containing", "the", "highest", "value", "strictly", "lower", "than", "the", "given", "one", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeInteger.java#L275-L278
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/expression/Strings.java
Strings.defaultString
public String defaultString(final Object target, final Object defaultValue) { if (target == null) { if (defaultValue == null) { return "null"; } return defaultValue.toString(); } String targetString = target.toString(); if (StringUtils.isEmptyOrWhitespace(targetString)) { if (defaultValue == null) { return "null"; } return defaultValue.toString(); } return targetString; }
java
public String defaultString(final Object target, final Object defaultValue) { if (target == null) { if (defaultValue == null) { return "null"; } return defaultValue.toString(); } String targetString = target.toString(); if (StringUtils.isEmptyOrWhitespace(targetString)) { if (defaultValue == null) { return "null"; } return defaultValue.toString(); } return targetString; }
[ "public", "String", "defaultString", "(", "final", "Object", "target", ",", "final", "Object", "defaultValue", ")", "{", "if", "(", "target", "==", "null", ")", "{", "if", "(", "defaultValue", "==", "null", ")", "{", "return", "\"null\"", ";", "}", "retu...
<p> Checks if target text is empty and uses either target, or if the target is empty uses {@code defaultValue}. </p> @param target value that to be checked if is null or empty If non-String objects, toString() will be called. @param defaultValue value to use if target is empty If non-String objects, toString() will be called. @return either target, or if the target is empty {@code defaultValue} @since 2.1.3
[ "<p", ">", "Checks", "if", "target", "text", "is", "empty", "and", "uses", "either", "target", "or", "if", "the", "target", "is", "empty", "uses", "{", "@code", "defaultValue", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/expression/Strings.java#L2153-L2170
aws/aws-sdk-java
aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/CreateCustomMetadataRequest.java
CreateCustomMetadataRequest.withCustomMetadata
public CreateCustomMetadataRequest withCustomMetadata(java.util.Map<String, String> customMetadata) { setCustomMetadata(customMetadata); return this; }
java
public CreateCustomMetadataRequest withCustomMetadata(java.util.Map<String, String> customMetadata) { setCustomMetadata(customMetadata); return this; }
[ "public", "CreateCustomMetadataRequest", "withCustomMetadata", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "customMetadata", ")", "{", "setCustomMetadata", "(", "customMetadata", ")", ";", "return", "this", ";", "}" ]
<p> Custom metadata in the form of name-value pairs. </p> @param customMetadata Custom metadata in the form of name-value pairs. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Custom", "metadata", "in", "the", "form", "of", "name", "-", "value", "pairs", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/CreateCustomMetadataRequest.java#L215-L218
opentable/otj-jaxrs
client/src/main/java/com/opentable/jaxrs/CalculateThreads.java
CalculateThreads.calculateThreads
public static int calculateThreads(final int executorThreads, final String name) { // For current standard 8 core machines this is 10 regardless. // On Java 10, you might get less than 8 core reported, but it will still size as if it's 8 // Beyond 8 core you MIGHT undersize if running on Docker, but otherwise should be fine. final int optimalThreads= Math.max(BASE_OPTIMAL_THREADS, (Runtime.getRuntime().availableProcessors() + THREAD_OVERHEAD)); int threadsChosen = optimalThreads; if (executorThreads > optimalThreads) { // They requested more, sure we can do that! threadsChosen = executorThreads; LOG.warn("Requested more than optimal threads. This is not necessarily an error, but you may be overallocating."); } else { // They weren't auto tuning (<0)) if (executorThreads > 0) { LOG.warn("You requested less than optimal threads. We've ignored that."); } } LOG.debug("For factory {}, Optimal Threads {}, Configured Threads {}", name, optimalThreads, threadsChosen); return threadsChosen; }
java
public static int calculateThreads(final int executorThreads, final String name) { // For current standard 8 core machines this is 10 regardless. // On Java 10, you might get less than 8 core reported, but it will still size as if it's 8 // Beyond 8 core you MIGHT undersize if running on Docker, but otherwise should be fine. final int optimalThreads= Math.max(BASE_OPTIMAL_THREADS, (Runtime.getRuntime().availableProcessors() + THREAD_OVERHEAD)); int threadsChosen = optimalThreads; if (executorThreads > optimalThreads) { // They requested more, sure we can do that! threadsChosen = executorThreads; LOG.warn("Requested more than optimal threads. This is not necessarily an error, but you may be overallocating."); } else { // They weren't auto tuning (<0)) if (executorThreads > 0) { LOG.warn("You requested less than optimal threads. We've ignored that."); } } LOG.debug("For factory {}, Optimal Threads {}, Configured Threads {}", name, optimalThreads, threadsChosen); return threadsChosen; }
[ "public", "static", "int", "calculateThreads", "(", "final", "int", "executorThreads", ",", "final", "String", "name", ")", "{", "// For current standard 8 core machines this is 10 regardless.", "// On Java 10, you might get less than 8 core reported, but it will still size as if it's ...
Calculate optimal threads. If they exceed the specified executorThreads, use optimal threads instead. Emit appropriate logging @param executorThreads executor threads - what the caller wishes to use for size @param name client pool name. Used for logging. @return int actual threads to use
[ "Calculate", "optimal", "threads", ".", "If", "they", "exceed", "the", "specified", "executorThreads", "use", "optimal", "threads", "instead", ".", "Emit", "appropriate", "logging" ]
train
https://github.com/opentable/otj-jaxrs/blob/384e7094fe5a56d41b2a9970bfd783fa85cbbcb8/client/src/main/java/com/opentable/jaxrs/CalculateThreads.java#L29-L48
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java
ContainerServicesInner.beginCreateOrUpdate
public ContainerServiceInner beginCreateOrUpdate(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).toBlocking().single().body(); }
java
public ContainerServiceInner beginCreateOrUpdate(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).toBlocking().single().body(); }
[ "public", "ContainerServiceInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "containerServiceName", ",", "ContainerServiceInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "co...
Creates or updates a container service. Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. @param resourceGroupName The name of the resource group. @param containerServiceName The name of the container service in the specified subscription and resource group. @param parameters Parameters supplied to the Create or Update a Container Service operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ContainerServiceInner object if successful.
[ "Creates", "or", "updates", "a", "container", "service", ".", "Creates", "or", "updates", "a", "container", "service", "with", "the", "specified", "configuration", "of", "orchestrator", "masters", "and", "agents", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java#L310-L312
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/math/NoiseInstance.java
NoiseInstance.turbulence2
public float turbulence2(float x, float y, float octaves) { float t = 0.0f; for (float f = 1.0f; f <= octaves; f *= 2) t += Math.abs(noise2(f * x, f * y)) / f; return t; }
java
public float turbulence2(float x, float y, float octaves) { float t = 0.0f; for (float f = 1.0f; f <= octaves; f *= 2) t += Math.abs(noise2(f * x, f * y)) / f; return t; }
[ "public", "float", "turbulence2", "(", "float", "x", ",", "float", "y", ",", "float", "octaves", ")", "{", "float", "t", "=", "0.0f", ";", "for", "(", "float", "f", "=", "1.0f", ";", "f", "<=", "octaves", ";", "f", "*=", "2", ")", "t", "+=", "M...
Compute turbulence using Perlin noise. @param x the x value @param y the y value @param octaves number of octaves of turbulence @return turbulence value at (x,y)
[ "Compute", "turbulence", "using", "Perlin", "noise", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/math/NoiseInstance.java#L52-L58
kiegroup/droolsjbpm-knowledge
kie-internal/src/main/java/org/kie/internal/runtime/manager/deploy/DeploymentDescriptorIO.java
DeploymentDescriptorIO.fromXml
public static DeploymentDescriptor fromXml(InputStream inputStream) { try { Unmarshaller unmarshaller = getContext().createUnmarshaller(); unmarshaller.setSchema(schema); DeploymentDescriptor descriptor = (DeploymentDescriptor) unmarshaller.unmarshal(inputStream); return descriptor; } catch (Exception e) { throw new RuntimeException("Unable to read deployment descriptor from xml", e); } }
java
public static DeploymentDescriptor fromXml(InputStream inputStream) { try { Unmarshaller unmarshaller = getContext().createUnmarshaller(); unmarshaller.setSchema(schema); DeploymentDescriptor descriptor = (DeploymentDescriptor) unmarshaller.unmarshal(inputStream); return descriptor; } catch (Exception e) { throw new RuntimeException("Unable to read deployment descriptor from xml", e); } }
[ "public", "static", "DeploymentDescriptor", "fromXml", "(", "InputStream", "inputStream", ")", "{", "try", "{", "Unmarshaller", "unmarshaller", "=", "getContext", "(", ")", ".", "createUnmarshaller", "(", ")", ";", "unmarshaller", ".", "setSchema", "(", "schema", ...
Reads XML data from given input stream and produces valid instance of <code>DeploymentDescriptor</code> @param inputStream input stream that comes with xml data of the descriptor @return instance of the descriptor after deserialization
[ "Reads", "XML", "data", "from", "given", "input", "stream", "and", "produces", "valid", "instance", "of", "<code", ">", "DeploymentDescriptor<", "/", "code", ">" ]
train
https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/runtime/manager/deploy/DeploymentDescriptorIO.java#L51-L61
sevensource/html-email-service
src/main/java/org/sevensource/commons/email/model/DefaultEmailModel.java
DefaultEmailModel.setFrom
public void setFrom(String address, String personal) throws AddressException { from = toInternetAddress(address, personal); }
java
public void setFrom(String address, String personal) throws AddressException { from = toInternetAddress(address, personal); }
[ "public", "void", "setFrom", "(", "String", "address", ",", "String", "personal", ")", "throws", "AddressException", "{", "from", "=", "toInternetAddress", "(", "address", ",", "personal", ")", ";", "}" ]
set the From address of the email @param address a valid email address @param personal the real world name of the sender (can be null) @throws AddressException in case of an invalid email address
[ "set", "the", "From", "address", "of", "the", "email" ]
train
https://github.com/sevensource/html-email-service/blob/a55d9ef1a2173917cb5f870854bc24e5aaebd182/src/main/java/org/sevensource/commons/email/model/DefaultEmailModel.java#L71-L73
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.prependActionsToActionStateExecutionList
public void prependActionsToActionStateExecutionList(final Flow flow, final ActionState actionStateId, final EvaluateAction... actions) { addActionsToActionStateExecutionListAt(flow, actionStateId.getId(), 0, actions); }
java
public void prependActionsToActionStateExecutionList(final Flow flow, final ActionState actionStateId, final EvaluateAction... actions) { addActionsToActionStateExecutionListAt(flow, actionStateId.getId(), 0, actions); }
[ "public", "void", "prependActionsToActionStateExecutionList", "(", "final", "Flow", "flow", ",", "final", "ActionState", "actionStateId", ",", "final", "EvaluateAction", "...", "actions", ")", "{", "addActionsToActionStateExecutionListAt", "(", "flow", ",", "actionStateId...
Prepend actions to action state execution list. @param flow the flow @param actionStateId the action state id @param actions the actions
[ "Prepend", "actions", "to", "action", "state", "execution", "list", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L833-L835
graphql-java/java-dataloader
src/main/java/org/dataloader/DataLoader.java
DataLoader.newMappedDataLoaderWithTry
public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoaderWithContext<K, Try<V>> batchLoadFunction) { return newMappedDataLoaderWithTry(batchLoadFunction, null); }
java
public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoaderWithContext<K, Try<V>> batchLoadFunction) { return newMappedDataLoaderWithTry(batchLoadFunction, null); }
[ "public", "static", "<", "K", ",", "V", ">", "DataLoader", "<", "K", ",", "V", ">", "newMappedDataLoaderWithTry", "(", "MappedBatchLoaderWithContext", "<", "K", ",", "Try", "<", "V", ">", ">", "batchLoadFunction", ")", "{", "return", "newMappedDataLoaderWithTr...
Creates new DataLoader with the specified batch loader function and default options (batching, caching and unlimited batch size) where the batch loader function returns a list of {@link org.dataloader.Try} objects. <p> If its important you to know the exact status of each item in a batch call and whether it threw exceptions then you can use this form to create the data loader. <p> Using Try objects allows you to capture a value returned or an exception that might have occurred trying to get a value. . @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects @param <K> the key type @param <V> the value type @return a new DataLoader
[ "Creates", "new", "DataLoader", "with", "the", "specified", "batch", "loader", "function", "and", "default", "options", "(", "batching", "caching", "and", "unlimited", "batch", "size", ")", "where", "the", "batch", "loader", "function", "returns", "a", "list", ...
train
https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoader.java#L313-L315
OpenLiberty/open-liberty
dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileArtifactNotifier.java
ZipFileArtifactNotifier.validateNotification
@Trivial private String validateNotification(Collection<?> added, Collection<?> removed, Collection<?> updated) { boolean isAddition = !added.isEmpty(); boolean isRemoval = !removed.isEmpty(); boolean isUpdate = !updated.isEmpty(); if ( !isAddition && !isRemoval && !isUpdate ) { // Should never occur: // Completely null changes are detected and cause an early return // before reaching the validation method. return "null"; } else if ( isAddition ) { return "Addition of [ " + added.toString() + " ]"; } else if ( isUpdate && isRemoval ) { return "Update of [ " + updated.toString() + " ]" + " with removal of [ " + removed.toString() + " ]"; } else { return null; } }
java
@Trivial private String validateNotification(Collection<?> added, Collection<?> removed, Collection<?> updated) { boolean isAddition = !added.isEmpty(); boolean isRemoval = !removed.isEmpty(); boolean isUpdate = !updated.isEmpty(); if ( !isAddition && !isRemoval && !isUpdate ) { // Should never occur: // Completely null changes are detected and cause an early return // before reaching the validation method. return "null"; } else if ( isAddition ) { return "Addition of [ " + added.toString() + " ]"; } else if ( isUpdate && isRemoval ) { return "Update of [ " + updated.toString() + " ]" + " with removal of [ " + removed.toString() + " ]"; } else { return null; } }
[ "@", "Trivial", "private", "String", "validateNotification", "(", "Collection", "<", "?", ">", "added", ",", "Collection", "<", "?", ">", "removed", ",", "Collection", "<", "?", ">", "updated", ")", "{", "boolean", "isAddition", "=", "!", "added", ".", "...
Validate change data, which is expected to be collections of files or collections of entry paths. Since the single root zip file is registered, the change is expected to be a single element in exactly one of the change collections. Null changes are unexpected. Additions are unexpected. Updates with removals are unexpected. The net is to allow updates alone or removals alone. @return A validation message if unexpected changes are noted. Null if the changes are expected.
[ "Validate", "change", "data", "which", "is", "expected", "to", "be", "collections", "of", "files", "or", "collections", "of", "entry", "paths", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileArtifactNotifier.java#L745-L767
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java
MicroWriter.getNodeAsBytes
@Nullable public static byte [] getNodeAsBytes (@Nonnull final IMicroNode aNode, @Nonnull final IXMLWriterSettings aSettings) { ValueEnforcer.notNull (aNode, "Node"); ValueEnforcer.notNull (aSettings, "Settings"); try ( final NonBlockingByteArrayOutputStream aBAOS = new NonBlockingByteArrayOutputStream (50 * CGlobal.BYTES_PER_KILOBYTE)) { // start serializing if (writeToStream (aNode, aBAOS, aSettings).isSuccess ()) return aBAOS.toByteArray (); } catch (final Exception ex) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Error serializing MicroDOM with settings " + aSettings.toString (), ex); } return null; }
java
@Nullable public static byte [] getNodeAsBytes (@Nonnull final IMicroNode aNode, @Nonnull final IXMLWriterSettings aSettings) { ValueEnforcer.notNull (aNode, "Node"); ValueEnforcer.notNull (aSettings, "Settings"); try ( final NonBlockingByteArrayOutputStream aBAOS = new NonBlockingByteArrayOutputStream (50 * CGlobal.BYTES_PER_KILOBYTE)) { // start serializing if (writeToStream (aNode, aBAOS, aSettings).isSuccess ()) return aBAOS.toByteArray (); } catch (final Exception ex) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Error serializing MicroDOM with settings " + aSettings.toString (), ex); } return null; }
[ "@", "Nullable", "public", "static", "byte", "[", "]", "getNodeAsBytes", "(", "@", "Nonnull", "final", "IMicroNode", "aNode", ",", "@", "Nonnull", "final", "IXMLWriterSettings", "aSettings", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aNode", ",", "\"Node...
Convert the passed micro node to an XML byte array using the provided settings. @param aNode The node to be converted to a byte array. May not be <code>null</code> . @param aSettings The XML writer settings to use. May not be <code>null</code>. @return The byte array representation of the passed node. @since 8.6.3
[ "Convert", "the", "passed", "micro", "node", "to", "an", "XML", "byte", "array", "using", "the", "provided", "settings", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java#L310-L330
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Document.java
Document.setValues
public void setValues(int i, Entity v) { if (Document_Type.featOkTst && ((Document_Type)jcasType).casFeat_values == null) jcasType.jcas.throwFeatMissing("values", "de.julielab.jules.types.ace.Document"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_values), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_values), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setValues(int i, Entity v) { if (Document_Type.featOkTst && ((Document_Type)jcasType).casFeat_values == null) jcasType.jcas.throwFeatMissing("values", "de.julielab.jules.types.ace.Document"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_values), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_values), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setValues", "(", "int", "i", ",", "Entity", "v", ")", "{", "if", "(", "Document_Type", ".", "featOkTst", "&&", "(", "(", "Document_Type", ")", "jcasType", ")", ".", "casFeat_values", "==", "null", ")", "jcasType", ".", "jcas", ".", "...
indexed setter for values - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "values", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Document.java#L182-L186
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/Token.java
Token.matchOnLength
public CharSequence matchOnLength(final Supplier<CharSequence> one, final Supplier<CharSequence> many) { final int arrayLength = arrayLength(); if (arrayLength == 1) { return one.get(); } else if (arrayLength > 1) { return many.get(); } return ""; }
java
public CharSequence matchOnLength(final Supplier<CharSequence> one, final Supplier<CharSequence> many) { final int arrayLength = arrayLength(); if (arrayLength == 1) { return one.get(); } else if (arrayLength > 1) { return many.get(); } return ""; }
[ "public", "CharSequence", "matchOnLength", "(", "final", "Supplier", "<", "CharSequence", ">", "one", ",", "final", "Supplier", "<", "CharSequence", ">", "many", ")", "{", "final", "int", "arrayLength", "=", "arrayLength", "(", ")", ";", "if", "(", "arrayLen...
Match which approach to take based on the length of the token. If length is zero then an empty {@link String} is returned. @param one to be used when length is one. @param many to be used when length is greater than one. @return the {@link CharSequence} representing the token depending on the length.
[ "Match", "which", "approach", "to", "take", "based", "on", "the", "length", "of", "the", "token", ".", "If", "length", "is", "zero", "then", "an", "empty", "{", "@link", "String", "}", "is", "returned", "." ]
train
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/Token.java#L264-L278
intel/jndn-utils
src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java
SegmentationHelper.parseSegment
public static long parseSegment(Name name, byte marker) throws EncodingException { if (name.size() == 0) { throw new EncodingException("No components to parse."); } return name.get(-1).toNumberWithMarker(marker); }
java
public static long parseSegment(Name name, byte marker) throws EncodingException { if (name.size() == 0) { throw new EncodingException("No components to parse."); } return name.get(-1).toNumberWithMarker(marker); }
[ "public", "static", "long", "parseSegment", "(", "Name", "name", ",", "byte", "marker", ")", "throws", "EncodingException", "{", "if", "(", "name", ".", "size", "(", ")", "==", "0", ")", "{", "throw", "new", "EncodingException", "(", "\"No components to pars...
Retrieve the segment number from the last component of a name. @param name the name of a packet @param marker the marker type (the initial byte of the component) @return the segment number @throws EncodingException if the name does not have a final component of the correct marker type
[ "Retrieve", "the", "segment", "number", "from", "the", "last", "component", "of", "a", "name", "." ]
train
https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/impl/SegmentationHelper.java#L68-L73
apache/flink
flink-core/src/main/java/org/apache/flink/util/AbstractCloseableRegistry.java
AbstractCloseableRegistry.registerCloseable
public final void registerCloseable(C closeable) throws IOException { if (null == closeable) { return; } synchronized (getSynchronizationLock()) { if (!closed) { doRegister(closeable, closeableToRef); return; } } IOUtils.closeQuietly(closeable); throw new IOException("Cannot register Closeable, registry is already closed. Closing argument."); }
java
public final void registerCloseable(C closeable) throws IOException { if (null == closeable) { return; } synchronized (getSynchronizationLock()) { if (!closed) { doRegister(closeable, closeableToRef); return; } } IOUtils.closeQuietly(closeable); throw new IOException("Cannot register Closeable, registry is already closed. Closing argument."); }
[ "public", "final", "void", "registerCloseable", "(", "C", "closeable", ")", "throws", "IOException", "{", "if", "(", "null", "==", "closeable", ")", "{", "return", ";", "}", "synchronized", "(", "getSynchronizationLock", "(", ")", ")", "{", "if", "(", "!",...
Registers a {@link Closeable} with the registry. In case the registry is already closed, this method throws an {@link IllegalStateException} and closes the passed {@link Closeable}. @param closeable Closeable tor register @throws IOException exception when the registry was closed before
[ "Registers", "a", "{", "@link", "Closeable", "}", "with", "the", "registry", ".", "In", "case", "the", "registry", "is", "already", "closed", "this", "method", "throws", "an", "{", "@link", "IllegalStateException", "}", "and", "closes", "the", "passed", "{",...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/AbstractCloseableRegistry.java#L71-L86
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/RoutesInner.java
RoutesInner.beginCreateOrUpdateAsync
public Observable<RouteInner> beginCreateOrUpdateAsync(String resourceGroupName, String routeTableName, String routeName, RouteInner routeParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, routeName, routeParameters).map(new Func1<ServiceResponse<RouteInner>, RouteInner>() { @Override public RouteInner call(ServiceResponse<RouteInner> response) { return response.body(); } }); }
java
public Observable<RouteInner> beginCreateOrUpdateAsync(String resourceGroupName, String routeTableName, String routeName, RouteInner routeParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, routeName, routeParameters).map(new Func1<ServiceResponse<RouteInner>, RouteInner>() { @Override public RouteInner call(ServiceResponse<RouteInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RouteInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "routeTableName", ",", "String", "routeName", ",", "RouteInner", "routeParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsyn...
Creates or updates a route in the specified route table. @param resourceGroupName The name of the resource group. @param routeTableName The name of the route table. @param routeName The name of the route. @param routeParameters Parameters supplied to the create or update route operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RouteInner object
[ "Creates", "or", "updates", "a", "route", "in", "the", "specified", "route", "table", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/RoutesInner.java#L473-L480
deeplearning4j/deeplearning4j
nd4j/nd4j-serde/nd4j-arrow/src/main/java/org/nd4j/arrow/ArrowSerde.java
ArrowSerde.addDataForArr
public static int addDataForArr(FlatBufferBuilder bufferBuilder, INDArray arr) { DataBuffer toAdd = arr.isView() ? arr.dup().data() : arr.data(); int offset = DataBufferStruct.createDataBufferStruct(bufferBuilder,toAdd); int ret = Buffer.createBuffer(bufferBuilder,offset,toAdd.length() * toAdd.getElementSize()); return ret; }
java
public static int addDataForArr(FlatBufferBuilder bufferBuilder, INDArray arr) { DataBuffer toAdd = arr.isView() ? arr.dup().data() : arr.data(); int offset = DataBufferStruct.createDataBufferStruct(bufferBuilder,toAdd); int ret = Buffer.createBuffer(bufferBuilder,offset,toAdd.length() * toAdd.getElementSize()); return ret; }
[ "public", "static", "int", "addDataForArr", "(", "FlatBufferBuilder", "bufferBuilder", ",", "INDArray", "arr", ")", "{", "DataBuffer", "toAdd", "=", "arr", ".", "isView", "(", ")", "?", "arr", ".", "dup", "(", ")", ".", "data", "(", ")", ":", "arr", "....
Create a {@link Buffer} representing the location metadata of the actual data contents for the ndarrays' {@link DataBuffer} @param bufferBuilder the buffer builder in use @param arr the array to add the underlying data for @return the offset added
[ "Create", "a", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-arrow/src/main/java/org/nd4j/arrow/ArrowSerde.java#L104-L110
anotheria/moskito
moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java
MonitoringAspect.doProfilingMethod
@Around (value = "execution(@(@net.anotheria.moskito.aop.annotation.Monitor *) * *(..)) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)") public Object doProfilingMethod(final ProceedingJoinPoint pjp) throws Throwable { return doProfilingMethod(pjp, resolveAnnotation(pjp)); }
java
@Around (value = "execution(@(@net.anotheria.moskito.aop.annotation.Monitor *) * *(..)) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)") public Object doProfilingMethod(final ProceedingJoinPoint pjp) throws Throwable { return doProfilingMethod(pjp, resolveAnnotation(pjp)); }
[ "@", "Around", "(", "value", "=", "\"execution(@(@net.anotheria.moskito.aop.annotation.Monitor *) * *(..)) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)\"", ")", "public", "Object", "doProfilingMethod", "(", "final", "ProceedingJoinPoint", "pjp", ")", "throws", "T...
Special method profiling entry-point, which allow to fetch {@link Monitor} from one lvl up of method annotation. Pattern will pre-select 2-nd lvl annotation on method scope. @param pjp {@link ProceedingJoinPoint} @return call result @throws Throwable in case of error during {@link ProceedingJoinPoint#proceed()}
[ "Special", "method", "profiling", "entry", "-", "point", "which", "allow", "to", "fetch", "{", "@link", "Monitor", "}", "from", "one", "lvl", "up", "of", "method", "annotation", ".", "Pattern", "will", "pre", "-", "select", "2", "-", "nd", "lvl", "annota...
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java#L67-L70
cdk/cdk
base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java
SmilesValencyChecker.isSaturated
public boolean isSaturated(IBond bond, IAtomContainer atomContainer) throws CDKException { logger.debug("isBondSaturated?: ", bond); IAtom[] atoms = BondManipulator.getAtomArray(bond); boolean isSaturated = true; for (int i = 0; i < atoms.length; i++) { logger.debug("isSaturated(Bond, AC): atom I=", i); isSaturated = isSaturated && isSaturated(atoms[i], atomContainer); } logger.debug("isSaturated(Bond, AC): result=", isSaturated); return isSaturated; }
java
public boolean isSaturated(IBond bond, IAtomContainer atomContainer) throws CDKException { logger.debug("isBondSaturated?: ", bond); IAtom[] atoms = BondManipulator.getAtomArray(bond); boolean isSaturated = true; for (int i = 0; i < atoms.length; i++) { logger.debug("isSaturated(Bond, AC): atom I=", i); isSaturated = isSaturated && isSaturated(atoms[i], atomContainer); } logger.debug("isSaturated(Bond, AC): result=", isSaturated); return isSaturated; }
[ "public", "boolean", "isSaturated", "(", "IBond", "bond", ",", "IAtomContainer", "atomContainer", ")", "throws", "CDKException", "{", "logger", ".", "debug", "(", "\"isBondSaturated?: \"", ",", "bond", ")", ";", "IAtom", "[", "]", "atoms", "=", "BondManipulator"...
Returns whether a bond is saturated. A bond is saturated if <b>both</b> Atoms in the bond are saturated.
[ "Returns", "whether", "a", "bond", "is", "saturated", ".", "A", "bond", "is", "saturated", "if", "<b", ">", "both<", "/", "b", ">", "Atoms", "in", "the", "bond", "are", "saturated", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java#L198-L208
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/runtime/AbstractEJBRuntime.java
AbstractEJBRuntime.createPersistentAutomaticTimers
protected int createPersistentAutomaticTimers(String appName, String moduleName, List<AutomaticTimerBean> timerBeans) throws RuntimeWarning { for (AutomaticTimerBean timerBean : timerBeans) { if (timerBean.getNumPersistentTimers() != 0) { Tr.warning(tc, "AUTOMATIC_PERSISTENT_TIMERS_NOT_SUPPORTED_CNTR0330W", new Object[] { timerBean.getBeanMetaData().getName(), moduleName, appName }); } } return 0; }
java
protected int createPersistentAutomaticTimers(String appName, String moduleName, List<AutomaticTimerBean> timerBeans) throws RuntimeWarning { for (AutomaticTimerBean timerBean : timerBeans) { if (timerBean.getNumPersistentTimers() != 0) { Tr.warning(tc, "AUTOMATIC_PERSISTENT_TIMERS_NOT_SUPPORTED_CNTR0330W", new Object[] { timerBean.getBeanMetaData().getName(), moduleName, appName }); } } return 0; }
[ "protected", "int", "createPersistentAutomaticTimers", "(", "String", "appName", ",", "String", "moduleName", ",", "List", "<", "AutomaticTimerBean", ">", "timerBeans", ")", "throws", "RuntimeWarning", "{", "for", "(", "AutomaticTimerBean", "timerBean", ":", "timerBea...
Only called if persistent timers exist <p> Creates the persistent automatic timers for the specified module. <p> The default behavior is that persistent timers are not supported and warnings will be logged if they are present. Subclasses should override this method if different behavior is required. <p> @param appName the application name @param moduleName the module name @param timerBeans the beans with automatic timers @return the number of timers created
[ "Only", "called", "if", "persistent", "timers", "exist", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/runtime/AbstractEJBRuntime.java#L1779-L1787
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodeConfigurationsInner.java
DscNodeConfigurationsInner.createOrUpdateAsync
public Observable<DscNodeConfigurationInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String nodeConfigurationName, DscNodeConfigurationCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeConfigurationName, parameters).map(new Func1<ServiceResponse<DscNodeConfigurationInner>, DscNodeConfigurationInner>() { @Override public DscNodeConfigurationInner call(ServiceResponse<DscNodeConfigurationInner> response) { return response.body(); } }); }
java
public Observable<DscNodeConfigurationInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String nodeConfigurationName, DscNodeConfigurationCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeConfigurationName, parameters).map(new Func1<ServiceResponse<DscNodeConfigurationInner>, DscNodeConfigurationInner>() { @Override public DscNodeConfigurationInner call(ServiceResponse<DscNodeConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DscNodeConfigurationInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "nodeConfigurationName", ",", "DscNodeConfigurationCreateOrUpdateParameters", "parameters", ")", "{",...
Create the node configuration identified by node configuration name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param nodeConfigurationName The create or update parameters for configuration. @param parameters The create or update parameters for configuration. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DscNodeConfigurationInner object
[ "Create", "the", "node", "configuration", "identified", "by", "node", "configuration", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodeConfigurationsInner.java#L309-L316
chr78rm/tracelogger
src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java
AbstractTracer.logException
public void logException(LogLevel logLevel, Throwable throwable, Class clazz, String methodName) { Date timeStamp = new Date(); char border[] = new char[logLevel.toString().length() + 4]; Arrays.fill(border, '*'); String message; if (throwable.getMessage() != null) { message = throwable.getMessage().trim(); message = message.replace(System.getProperty("line.separator"), " => "); } else { message = "No message."; } synchronized (this.syncObject) { this.tracePrintStream.println(border); this.tracePrintStream.printf("* %s * [%tc] [%d,%s] [%s] [%s] \"%s\"%n", logLevel.toString(), timeStamp, Thread.currentThread().getId(), Thread.currentThread().getName(), clazz.getName(), methodName, message); this.tracePrintStream.println(border); throwable.printStackTrace(this.tracePrintStream); } }
java
public void logException(LogLevel logLevel, Throwable throwable, Class clazz, String methodName) { Date timeStamp = new Date(); char border[] = new char[logLevel.toString().length() + 4]; Arrays.fill(border, '*'); String message; if (throwable.getMessage() != null) { message = throwable.getMessage().trim(); message = message.replace(System.getProperty("line.separator"), " => "); } else { message = "No message."; } synchronized (this.syncObject) { this.tracePrintStream.println(border); this.tracePrintStream.printf("* %s * [%tc] [%d,%s] [%s] [%s] \"%s\"%n", logLevel.toString(), timeStamp, Thread.currentThread().getId(), Thread.currentThread().getName(), clazz.getName(), methodName, message); this.tracePrintStream.println(border); throwable.printStackTrace(this.tracePrintStream); } }
[ "public", "void", "logException", "(", "LogLevel", "logLevel", ",", "Throwable", "throwable", ",", "Class", "clazz", ",", "String", "methodName", ")", "{", "Date", "timeStamp", "=", "new", "Date", "(", ")", ";", "char", "border", "[", "]", "=", "new", "c...
Logs an exception with the given logLevel and the originating class. @param logLevel one of the predefined levels INFO, WARNING, ERROR, FATAL and SEVERE @param throwable the to be logged throwable @param clazz the originating class @param methodName the name of the relevant method
[ "Logs", "an", "exception", "with", "the", "given", "logLevel", "and", "the", "originating", "class", "." ]
train
https://github.com/chr78rm/tracelogger/blob/ad22452b20f8111ad4d367302c2b26a100a20200/src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java#L542-L563
twotoasters/JazzyListView
library-recyclerview/src/main/java/com/twotoasters/jazzylistview/recyclerview/JazzyRecyclerViewScrollListener.java
JazzyRecyclerViewScrollListener.notifyAdditionalOnScrolledListener
private void notifyAdditionalOnScrolledListener(RecyclerView recyclerView, int dx, int dy) { if (mAdditionalOnScrollListener != null) { mAdditionalOnScrollListener.onScrolled(recyclerView, dx, dy); } }
java
private void notifyAdditionalOnScrolledListener(RecyclerView recyclerView, int dx, int dy) { if (mAdditionalOnScrollListener != null) { mAdditionalOnScrollListener.onScrolled(recyclerView, dx, dy); } }
[ "private", "void", "notifyAdditionalOnScrolledListener", "(", "RecyclerView", "recyclerView", ",", "int", "dx", ",", "int", "dy", ")", "{", "if", "(", "mAdditionalOnScrollListener", "!=", "null", ")", "{", "mAdditionalOnScrollListener", ".", "onScrolled", "(", "recy...
Notifies the OnScrollListener of an onScroll event, since JazzyListView is the primary listener for onScroll events.
[ "Notifies", "the", "OnScrollListener", "of", "an", "onScroll", "event", "since", "JazzyListView", "is", "the", "primary", "listener", "for", "onScroll", "events", "." ]
train
https://github.com/twotoasters/JazzyListView/blob/4a69239f90374a71e7d4073448ca049bd074f7fe/library-recyclerview/src/main/java/com/twotoasters/jazzylistview/recyclerview/JazzyRecyclerViewScrollListener.java#L107-L111
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.getScaledCopy
public Image getScaledCopy(int width, int height) { init(); Image image = copy(); image.width = width; image.height = height; image.centerX = width / 2; image.centerY = height / 2; image.textureOffsetX *= (width/(float) this.width); image.textureOffsetY *= (height/(float) this.height); image.textureWidth *= (width/(float) this.width); image.textureHeight *= (height/(float) this.height); return image; }
java
public Image getScaledCopy(int width, int height) { init(); Image image = copy(); image.width = width; image.height = height; image.centerX = width / 2; image.centerY = height / 2; image.textureOffsetX *= (width/(float) this.width); image.textureOffsetY *= (height/(float) this.height); image.textureWidth *= (width/(float) this.width); image.textureHeight *= (height/(float) this.height); return image; }
[ "public", "Image", "getScaledCopy", "(", "int", "width", ",", "int", "height", ")", "{", "init", "(", ")", ";", "Image", "image", "=", "copy", "(", ")", ";", "image", ".", "width", "=", "width", ";", "image", ".", "height", "=", "height", ";", "ima...
<p>Get a scaled copy of this image.</p> <p>This will only scale the <strong>canvas</strong>, it will not scale the underlying texture data. For a downscale, the texture will get clipped. For an upscale, the texture will be repetated on both axis</p> <p>Also note that the underlying texture might be bigger than the initial image that was loaded because its size is fixed to the next power of two of the size of the image. So if a 100x100 image was loaded, the underlying texture is 128x128. If it's then scaled to 200x200, there will be a gap between 100 to 128 (black), and then the texture will be repeated.</p> <img src="doc-files/Image-getScaledCopy.png" /> <p>This especially has nasty side effects when you scale a flipped image...</p> @param width The width of the copy @param height The height of the copy @return The new scaled image
[ "<p", ">", "Get", "a", "scaled", "copy", "of", "this", "image", ".", "<", "/", "p", ">" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L1236-L1250
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.objIntConsumer
public static <T> ObjIntConsumer<T> objIntConsumer(CheckedObjIntConsumer<T> consumer, Consumer<Throwable> handler) { return (t, u) -> { try { consumer.accept(t, u); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
java
public static <T> ObjIntConsumer<T> objIntConsumer(CheckedObjIntConsumer<T> consumer, Consumer<Throwable> handler) { return (t, u) -> { try { consumer.accept(t, u); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
[ "public", "static", "<", "T", ">", "ObjIntConsumer", "<", "T", ">", "objIntConsumer", "(", "CheckedObjIntConsumer", "<", "T", ">", "consumer", ",", "Consumer", "<", "Throwable", ">", "handler", ")", "{", "return", "(", "t", ",", "u", ")", "->", "{", "t...
Wrap a {@link CheckedObjIntConsumer} in a {@link ObjIntConsumer} with a custom handler for checked exceptions.
[ "Wrap", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L253-L264
line/armeria
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/SlidingWindowCounter.java
SlidingWindowCounter.trimAndSum
private EventCount trimAndSum(long tickerNanos) { final long oldLimit = tickerNanos - slidingWindowNanos; final Iterator<Bucket> iterator = reservoir.iterator(); long success = 0; long failure = 0; while (iterator.hasNext()) { final Bucket bucket = iterator.next(); if (bucket.timestamp < oldLimit) { // removes old bucket iterator.remove(); } else { success += bucket.success(); failure += bucket.failure(); } } return new EventCount(success, failure); }
java
private EventCount trimAndSum(long tickerNanos) { final long oldLimit = tickerNanos - slidingWindowNanos; final Iterator<Bucket> iterator = reservoir.iterator(); long success = 0; long failure = 0; while (iterator.hasNext()) { final Bucket bucket = iterator.next(); if (bucket.timestamp < oldLimit) { // removes old bucket iterator.remove(); } else { success += bucket.success(); failure += bucket.failure(); } } return new EventCount(success, failure); }
[ "private", "EventCount", "trimAndSum", "(", "long", "tickerNanos", ")", "{", "final", "long", "oldLimit", "=", "tickerNanos", "-", "slidingWindowNanos", ";", "final", "Iterator", "<", "Bucket", ">", "iterator", "=", "reservoir", ".", "iterator", "(", ")", ";",...
Sums up buckets within the time window, and removes all the others.
[ "Sums", "up", "buckets", "within", "the", "time", "window", "and", "removes", "all", "the", "others", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/circuitbreaker/SlidingWindowCounter.java#L123-L140
SvenEwald/xmlbeam
src/main/java/org/xmlbeam/ProjectionInvocationHandler.java
ProjectionInvocationHandler.unwrapArgs
private static void unwrapArgs(final Class<?>[] types, final Object[] args) { if (args == null) { return; } try { for (int i = 0; i < args.length; ++i) { args[i] = ReflectionHelper.unwrap(types[i], args[i]); } } catch (Exception e) { throw new IllegalArgumentException(e); } }
java
private static void unwrapArgs(final Class<?>[] types, final Object[] args) { if (args == null) { return; } try { for (int i = 0; i < args.length; ++i) { args[i] = ReflectionHelper.unwrap(types[i], args[i]); } } catch (Exception e) { throw new IllegalArgumentException(e); } }
[ "private", "static", "void", "unwrapArgs", "(", "final", "Class", "<", "?", ">", "[", "]", "types", ",", "final", "Object", "[", "]", "args", ")", "{", "if", "(", "args", "==", "null", ")", "{", "return", ";", "}", "try", "{", "for", "(", "int", ...
If parameter is instance of Callable or Supplier then resolve its value. @param args @param args2
[ "If", "parameter", "is", "instance", "of", "Callable", "or", "Supplier", "then", "resolve", "its", "value", "." ]
train
https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/ProjectionInvocationHandler.java#L893-L905
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java
FeatureInfoBuilder.buildResultsInfoMessageAndClose
public String buildResultsInfoMessageAndClose(FeatureIndexResults results, double tolerance, LatLng clickLocation, Projection projection) { String message = null; try { message = buildResultsInfoMessage(results, tolerance, clickLocation, projection); } finally { results.close(); } return message; }
java
public String buildResultsInfoMessageAndClose(FeatureIndexResults results, double tolerance, LatLng clickLocation, Projection projection) { String message = null; try { message = buildResultsInfoMessage(results, tolerance, clickLocation, projection); } finally { results.close(); } return message; }
[ "public", "String", "buildResultsInfoMessageAndClose", "(", "FeatureIndexResults", "results", ",", "double", "tolerance", ",", "LatLng", "clickLocation", ",", "Projection", "projection", ")", "{", "String", "message", "=", "null", ";", "try", "{", "message", "=", ...
Build a feature results information message and close the results @param results feature index results @param tolerance distance tolerance @param clickLocation map click location @param projection desired geometry projection @return results message or null if no results
[ "Build", "a", "feature", "results", "information", "message", "and", "close", "the", "results" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java#L276-L286
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.tracev
public void tracev(String format, Object param1) { if (isEnabled(Level.TRACE)) { doLog(Level.TRACE, FQCN, format, new Object[] { param1 }, null); } }
java
public void tracev(String format, Object param1) { if (isEnabled(Level.TRACE)) { doLog(Level.TRACE, FQCN, format, new Object[] { param1 }, null); } }
[ "public", "void", "tracev", "(", "String", "format", ",", "Object", "param1", ")", "{", "if", "(", "isEnabled", "(", "Level", ".", "TRACE", ")", ")", "{", "doLog", "(", "Level", ".", "TRACE", ",", "FQCN", ",", "format", ",", "new", "Object", "[", "...
Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting. @param format the message format string @param param1 the sole parameter
[ "Issue", "a", "log", "message", "with", "a", "level", "of", "TRACE", "using", "{", "@link", "java", ".", "text", ".", "MessageFormat", "}", "-", "style", "formatting", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L184-L188
jenkinsci/jenkins
core/src/main/java/jenkins/org/apache/commons/validator/routines/UrlValidator.java
UrlValidator.isValidPath
protected boolean isValidPath(String path) { if (path == null) { return false; } if (!PATH_PATTERN.matcher(path).matches()) { return false; } try { URI uri = new URI(null,null,path,null); String norm = uri.normalize().getPath(); if (norm.startsWith("/../") // Trying to go via the parent dir || norm.equals("/..")) { // Trying to go to the parent dir return false; } } catch (URISyntaxException e) { return false; } int slash2Count = countToken("//", path); if (isOff(ALLOW_2_SLASHES) && (slash2Count > 0)) { return false; } return true; }
java
protected boolean isValidPath(String path) { if (path == null) { return false; } if (!PATH_PATTERN.matcher(path).matches()) { return false; } try { URI uri = new URI(null,null,path,null); String norm = uri.normalize().getPath(); if (norm.startsWith("/../") // Trying to go via the parent dir || norm.equals("/..")) { // Trying to go to the parent dir return false; } } catch (URISyntaxException e) { return false; } int slash2Count = countToken("//", path); if (isOff(ALLOW_2_SLASHES) && (slash2Count > 0)) { return false; } return true; }
[ "protected", "boolean", "isValidPath", "(", "String", "path", ")", "{", "if", "(", "path", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "!", "PATH_PATTERN", ".", "matcher", "(", "path", ")", ".", "matches", "(", ")", ")", "{", "r...
Returns true if the path is valid. A <code>null</code> value is considered invalid. @param path Path value to validate. @return true if path is valid.
[ "Returns", "true", "if", "the", "path", "is", "valid", ".", "A", "<code", ">", "null<", "/", "code", ">", "value", "is", "considered", "invalid", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/org/apache/commons/validator/routines/UrlValidator.java#L450-L476
kiegroup/drools
drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java
DroolsStreamUtils.streamIn
public static Object streamIn(InputStream in) throws IOException, ClassNotFoundException { return streamIn(in, null, false); }
java
public static Object streamIn(InputStream in) throws IOException, ClassNotFoundException { return streamIn(in, null, false); }
[ "public", "static", "Object", "streamIn", "(", "InputStream", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "return", "streamIn", "(", "in", ",", "null", ",", "false", ")", ";", "}" ]
This method reads the contents from the given input stream and returns the object. It is expected that the contents in the given stream was not compressed, and it was written by the corresponding streamOut methods of this class. @param in @return @throws IOException @throws ClassNotFoundException
[ "This", "method", "reads", "the", "contents", "from", "the", "given", "input", "stream", "and", "returns", "the", "object", ".", "It", "is", "expected", "that", "the", "contents", "in", "the", "given", "stream", "was", "not", "compressed", "and", "it", "wa...
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java#L173-L175
google/closure-compiler
src/com/google/javascript/jscomp/CheckJSDoc.java
CheckJSDoc.validateTypeAnnotations
private void validateTypeAnnotations(Node n, JSDocInfo info) { if (info != null && info.hasType()) { boolean valid = false; switch (n.getToken()) { // Function declarations are valid case FUNCTION: valid = NodeUtil.isFunctionDeclaration(n); break; // Object literal properties, catch declarations and variable // initializers are valid. case NAME: valid = isTypeAnnotationAllowedForName(n); break; case ARRAY_PATTERN: case OBJECT_PATTERN: // allow JSDoc like // function f(/** !Object */ {x}) {} // function f(/** !Array */ [x]) {} valid = n.getParent().isParamList(); break; // Casts, exports, and Object literal properties are valid. case CAST: case EXPORT: case STRING_KEY: case GETTER_DEF: case SETTER_DEF: valid = true; break; // Declarations are valid iff they only contain simple names // /** @type {number} */ var x = 3; // ok // /** @type {number} */ var {x} = obj; // forbidden case VAR: case LET: case CONST: valid = !NodeUtil.isDestructuringDeclaration(n); break; // Property assignments are valid, if at the root of an expression. case ASSIGN: { Node lvalue = n.getFirstChild(); valid = n.getParent().isExprResult() && (lvalue.isGetProp() || lvalue.isGetElem() || lvalue.matchesQualifiedName("exports")); break; } case GETPROP: valid = n.getParent().isExprResult() && n.isQualifiedName(); break; case CALL: valid = info.isDefine(); break; default: break; } if (!valid) { reportMisplaced(n, "type", "Type annotations are not allowed here. " + "Are you missing parentheses?"); } } }
java
private void validateTypeAnnotations(Node n, JSDocInfo info) { if (info != null && info.hasType()) { boolean valid = false; switch (n.getToken()) { // Function declarations are valid case FUNCTION: valid = NodeUtil.isFunctionDeclaration(n); break; // Object literal properties, catch declarations and variable // initializers are valid. case NAME: valid = isTypeAnnotationAllowedForName(n); break; case ARRAY_PATTERN: case OBJECT_PATTERN: // allow JSDoc like // function f(/** !Object */ {x}) {} // function f(/** !Array */ [x]) {} valid = n.getParent().isParamList(); break; // Casts, exports, and Object literal properties are valid. case CAST: case EXPORT: case STRING_KEY: case GETTER_DEF: case SETTER_DEF: valid = true; break; // Declarations are valid iff they only contain simple names // /** @type {number} */ var x = 3; // ok // /** @type {number} */ var {x} = obj; // forbidden case VAR: case LET: case CONST: valid = !NodeUtil.isDestructuringDeclaration(n); break; // Property assignments are valid, if at the root of an expression. case ASSIGN: { Node lvalue = n.getFirstChild(); valid = n.getParent().isExprResult() && (lvalue.isGetProp() || lvalue.isGetElem() || lvalue.matchesQualifiedName("exports")); break; } case GETPROP: valid = n.getParent().isExprResult() && n.isQualifiedName(); break; case CALL: valid = info.isDefine(); break; default: break; } if (!valid) { reportMisplaced(n, "type", "Type annotations are not allowed here. " + "Are you missing parentheses?"); } } }
[ "private", "void", "validateTypeAnnotations", "(", "Node", "n", ",", "JSDocInfo", "info", ")", "{", "if", "(", "info", "!=", "null", "&&", "info", ".", "hasType", "(", ")", ")", "{", "boolean", "valid", "=", "false", ";", "switch", "(", "n", ".", "ge...
Check that JSDoc with a {@code @type} annotation is in a valid place.
[ "Check", "that", "JSDoc", "with", "a", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckJSDoc.java#L532-L592
documents4j/documents4j
documents4j-server-standalone/src/main/java/com/documents4j/builder/ConverterServerBuilder.java
ConverterServerBuilder.requestTimeout
public ConverterServerBuilder requestTimeout(long timeout, TimeUnit unit) { assertNumericArgument(timeout, true); this.requestTimeout = unit.toMillis(timeout); return this; }
java
public ConverterServerBuilder requestTimeout(long timeout, TimeUnit unit) { assertNumericArgument(timeout, true); this.requestTimeout = unit.toMillis(timeout); return this; }
[ "public", "ConverterServerBuilder", "requestTimeout", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "assertNumericArgument", "(", "timeout", ",", "true", ")", ";", "this", ".", "requestTimeout", "=", "unit", ".", "toMillis", "(", "timeout", ")", "...
Specifies the timeout for a network request. @param timeout The timeout for a network request. @param unit The time unit of the specified timeout. @return This builder instance.
[ "Specifies", "the", "timeout", "for", "a", "network", "request", "." ]
train
https://github.com/documents4j/documents4j/blob/eebb3ede43ffeb5fbfc85b3134f67a9c379a5594/documents4j-server-standalone/src/main/java/com/documents4j/builder/ConverterServerBuilder.java#L137-L141
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ComboBoxArrowButtonPainter.java
ComboBoxArrowButtonPainter.getComboBoxButtonBorderPaint
public Paint getComboBoxButtonBorderPaint(Shape s, CommonControlState type) { TwoColors colors = getCommonBorderColors(type); return createVerticalGradient(s, colors); }
java
public Paint getComboBoxButtonBorderPaint(Shape s, CommonControlState type) { TwoColors colors = getCommonBorderColors(type); return createVerticalGradient(s, colors); }
[ "public", "Paint", "getComboBoxButtonBorderPaint", "(", "Shape", "s", ",", "CommonControlState", "type", ")", "{", "TwoColors", "colors", "=", "getCommonBorderColors", "(", "type", ")", ";", "return", "createVerticalGradient", "(", "s", ",", "colors", ")", ";", ...
DOCUMENT ME! @param s DOCUMENT ME! @param type DOCUMENT ME! @return DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ComboBoxArrowButtonPainter.java#L230-L234
VoltDB/voltdb
src/frontend/org/voltdb/compiler/VoltDDLElementTracker.java
VoltDDLElementTracker.addProcedurePartitionInfoTo
public void addProcedurePartitionInfoTo(String procedureName, ProcedurePartitionData data) throws VoltCompilerException { ProcedureDescriptor descriptor = m_procedureMap.get(procedureName); if( descriptor == null) { throw m_compiler.new VoltCompilerException(String.format( "Partition references an undefined procedure \"%s\"", procedureName)); } // need to re-instantiate as descriptor fields are final if( descriptor.m_stmtLiterals == null) { // the longer form constructor asserts on singleStatement descriptor = m_compiler.new ProcedureDescriptor( descriptor.m_authGroups, descriptor.m_class, data); } else { descriptor = m_compiler.new ProcedureDescriptor( descriptor.m_authGroups, descriptor.m_className, descriptor.m_stmtLiterals, descriptor.m_joinOrder, data, false, descriptor.m_class); } m_procedureMap.put(procedureName, descriptor); }
java
public void addProcedurePartitionInfoTo(String procedureName, ProcedurePartitionData data) throws VoltCompilerException { ProcedureDescriptor descriptor = m_procedureMap.get(procedureName); if( descriptor == null) { throw m_compiler.new VoltCompilerException(String.format( "Partition references an undefined procedure \"%s\"", procedureName)); } // need to re-instantiate as descriptor fields are final if( descriptor.m_stmtLiterals == null) { // the longer form constructor asserts on singleStatement descriptor = m_compiler.new ProcedureDescriptor( descriptor.m_authGroups, descriptor.m_class, data); } else { descriptor = m_compiler.new ProcedureDescriptor( descriptor.m_authGroups, descriptor.m_className, descriptor.m_stmtLiterals, descriptor.m_joinOrder, data, false, descriptor.m_class); } m_procedureMap.put(procedureName, descriptor); }
[ "public", "void", "addProcedurePartitionInfoTo", "(", "String", "procedureName", ",", "ProcedurePartitionData", "data", ")", "throws", "VoltCompilerException", "{", "ProcedureDescriptor", "descriptor", "=", "m_procedureMap", ".", "get", "(", "procedureName", ")", ";", "...
Associates the given partition info to the given tracked procedure @param procedureName the short name of the procedure name @param partitionInfo the partition info to associate with the procedure @throws VoltCompilerException when there is no corresponding tracked procedure
[ "Associates", "the", "given", "partition", "info", "to", "the", "given", "tracked", "procedure" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/VoltDDLElementTracker.java#L151-L179
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.createStateDefaultTransition
public void createStateDefaultTransition(final TransitionableState state, final String targetState) { if (state == null) { LOGGER.trace("Cannot add default transition of [{}] to the given state is null and cannot be found in the flow.", targetState); return; } val transition = createTransition(targetState); state.getTransitionSet().add(transition); }
java
public void createStateDefaultTransition(final TransitionableState state, final String targetState) { if (state == null) { LOGGER.trace("Cannot add default transition of [{}] to the given state is null and cannot be found in the flow.", targetState); return; } val transition = createTransition(targetState); state.getTransitionSet().add(transition); }
[ "public", "void", "createStateDefaultTransition", "(", "final", "TransitionableState", "state", ",", "final", "String", "targetState", ")", "{", "if", "(", "state", "==", "null", ")", "{", "LOGGER", ".", "trace", "(", "\"Cannot add default transition of [{}] to the gi...
Add a default transition to a given state. @param state the state to include the default transition @param targetState the id of the destination state to which the flow should transfer
[ "Add", "a", "default", "transition", "to", "a", "given", "state", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L268-L275
jglobus/JGlobus
axis/src/main/java/org/globus/axis/transport/HTTPUtils.java
HTTPUtils.setTimeout
public static void setTimeout(Stub stub, int timeout) { if (stub instanceof org.apache.axis.client.Stub) { ((org.apache.axis.client.Stub)stub).setTimeout(timeout); } }
java
public static void setTimeout(Stub stub, int timeout) { if (stub instanceof org.apache.axis.client.Stub) { ((org.apache.axis.client.Stub)stub).setTimeout(timeout); } }
[ "public", "static", "void", "setTimeout", "(", "Stub", "stub", ",", "int", "timeout", ")", "{", "if", "(", "stub", "instanceof", "org", ".", "apache", ".", "axis", ".", "client", ".", "Stub", ")", "{", "(", "(", "org", ".", "apache", ".", "axis", "...
Sets connection timeout. @param stub The stub to set the property on @param timeout the new timeout value in milliseconds
[ "Sets", "connection", "timeout", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/axis/src/main/java/org/globus/axis/transport/HTTPUtils.java#L36-L40
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java
CheckArg.isGreaterThan
public static void isGreaterThan( int argument, int greaterThanValue, String name ) { if (argument <= greaterThanValue) { throw new IllegalArgumentException(CommonI18n.argumentMustBeGreaterThan.text(name, argument, greaterThanValue)); } }
java
public static void isGreaterThan( int argument, int greaterThanValue, String name ) { if (argument <= greaterThanValue) { throw new IllegalArgumentException(CommonI18n.argumentMustBeGreaterThan.text(name, argument, greaterThanValue)); } }
[ "public", "static", "void", "isGreaterThan", "(", "int", "argument", ",", "int", "greaterThanValue", ",", "String", "name", ")", "{", "if", "(", "argument", "<=", "greaterThanValue", ")", "{", "throw", "new", "IllegalArgumentException", "(", "CommonI18n", ".", ...
Check that the argument is greater than the supplied value @param argument The argument @param greaterThanValue the value that is to be used to check the value @param name The name of the argument @throws IllegalArgumentException If argument is not greater than the supplied value
[ "Check", "that", "the", "argument", "is", "greater", "than", "the", "supplied", "value" ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L73-L79
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java
HtmlSerialFieldWriter.addMemberDescription
public void addMemberDescription(VariableElement field, Content contentTree) { if (!utils.getFullBody(field).isEmpty()) { writer.addInlineComment(field, contentTree); } List<? extends DocTree> tags = utils.getBlockTags(field, DocTree.Kind.SERIAL); if (!tags.isEmpty()) { writer.addInlineComment(field, tags.get(0), contentTree); } }
java
public void addMemberDescription(VariableElement field, Content contentTree) { if (!utils.getFullBody(field).isEmpty()) { writer.addInlineComment(field, contentTree); } List<? extends DocTree> tags = utils.getBlockTags(field, DocTree.Kind.SERIAL); if (!tags.isEmpty()) { writer.addInlineComment(field, tags.get(0), contentTree); } }
[ "public", "void", "addMemberDescription", "(", "VariableElement", "field", ",", "Content", "contentTree", ")", "{", "if", "(", "!", "utils", ".", "getFullBody", "(", "field", ")", ".", "isEmpty", "(", ")", ")", "{", "writer", ".", "addInlineComment", "(", ...
Add the description text for this member. @param field the field to document. @param contentTree the tree to which the deprecated info will be added
[ "Add", "the", "description", "text", "for", "this", "member", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java#L161-L169
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java
AccountsImpl.listPoolNodeCounts
public PagedList<PoolNodeCounts> listPoolNodeCounts(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions) { ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders> response = listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions).toBlocking().single(); return new PagedList<PoolNodeCounts>(response.body()) { @Override public Page<PoolNodeCounts> nextPage(String nextPageLink) { AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null; if (accountListPoolNodeCountsOptions != null) { accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions(); accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId()); accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId()); accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate()); } return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions).toBlocking().single().body(); } }; }
java
public PagedList<PoolNodeCounts> listPoolNodeCounts(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions) { ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders> response = listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions).toBlocking().single(); return new PagedList<PoolNodeCounts>(response.body()) { @Override public Page<PoolNodeCounts> nextPage(String nextPageLink) { AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null; if (accountListPoolNodeCountsOptions != null) { accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions(); accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId()); accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId()); accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate()); } return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "PoolNodeCounts", ">", "listPoolNodeCounts", "(", "final", "AccountListPoolNodeCountsOptions", "accountListPoolNodeCountsOptions", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "PoolNodeCounts", ">", ",", "AccountListPoolNodeCountsHeaders...
Gets the number of nodes in each state, grouped by pool. @param accountListPoolNodeCountsOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;PoolNodeCounts&gt; object if successful.
[ "Gets", "the", "number", "of", "nodes", "in", "each", "state", "grouped", "by", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java#L483-L498
openengsb/openengsb
api/core/src/main/java/org/openengsb/core/api/model/ContextId.java
ContextId.fromMetaData
public static ContextId fromMetaData(Map<String, String> metaData) { return new ContextId(metaData.get(META_KEY_ID)); }
java
public static ContextId fromMetaData(Map<String, String> metaData) { return new ContextId(metaData.get(META_KEY_ID)); }
[ "public", "static", "ContextId", "fromMetaData", "(", "Map", "<", "String", ",", "String", ">", "metaData", ")", "{", "return", "new", "ContextId", "(", "metaData", ".", "get", "(", "META_KEY_ID", ")", ")", ";", "}" ]
parses a ContextId object from a Map-representation used in {@link org.openengsb.core.api.persistence.ConfigPersistenceService}
[ "parses", "a", "ContextId", "object", "from", "a", "Map", "-", "representation", "used", "in", "{" ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/core/src/main/java/org/openengsb/core/api/model/ContextId.java#L65-L67
aws/aws-sdk-java
aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java
SimpleDBUtils.decodeRealNumberRangeLong
public static long decodeRealNumberRangeLong(String value, long offsetValue) { long offsetNumber = Long.parseLong(value, 10); return (long) (offsetNumber - offsetValue); }
java
public static long decodeRealNumberRangeLong(String value, long offsetValue) { long offsetNumber = Long.parseLong(value, 10); return (long) (offsetNumber - offsetValue); }
[ "public", "static", "long", "decodeRealNumberRangeLong", "(", "String", "value", ",", "long", "offsetValue", ")", "{", "long", "offsetNumber", "=", "Long", ".", "parseLong", "(", "value", ",", "10", ")", ";", "return", "(", "long", ")", "(", "offsetNumber", ...
Decodes a long value from the string representation that was created by using encodeRealNumberRange(..) function. @param value string representation of the long value @param offsetValue offset value that was used in the original encoding @return original long value
[ "Decodes", "a", "long", "value", "from", "the", "string", "representation", "that", "was", "created", "by", "using", "encodeRealNumberRange", "(", "..", ")", "function", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java#L256-L259
Azure/azure-sdk-for-java
iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java
AppsInner.beginUpdate
public AppInner beginUpdate(String resourceGroupName, String resourceName, AppPatch appPatch) { return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName, appPatch).toBlocking().single().body(); }
java
public AppInner beginUpdate(String resourceGroupName, String resourceName, AppPatch appPatch) { return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName, appPatch).toBlocking().single().body(); }
[ "public", "AppInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "AppPatch", "appPatch", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "appPatch", ")", ".", "t...
Update the metadata of an IoT Central application. @param resourceGroupName The name of the resource group that contains the IoT Central application. @param resourceName The ARM resource name of the IoT Central application. @param appPatch The IoT Central application metadata and security metadata. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorDetailsException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AppInner object if successful.
[ "Update", "the", "metadata", "of", "an", "IoT", "Central", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java#L468-L470
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.data_setCookie
public boolean data_setCookie(Integer userId, CharSequence cookieName, CharSequence cookieValue) throws FacebookException, IOException { return data_setCookie(userId, cookieName, cookieValue, /*expiresTimestamp*/null, /*path*/ null); }
java
public boolean data_setCookie(Integer userId, CharSequence cookieName, CharSequence cookieValue) throws FacebookException, IOException { return data_setCookie(userId, cookieName, cookieValue, /*expiresTimestamp*/null, /*path*/ null); }
[ "public", "boolean", "data_setCookie", "(", "Integer", "userId", ",", "CharSequence", "cookieName", ",", "CharSequence", "cookieValue", ")", "throws", "FacebookException", ",", "IOException", "{", "return", "data_setCookie", "(", "userId", ",", "cookieName", ",", "c...
Sets a cookie for a given user and application. @param userId The user for whom this cookie needs to be set @param cookieName Name of the cookie. @param cookieValue Value of the cookie. @return true if cookie was successfully set, false otherwise @see <a href="http://wiki.developers.facebook.com/index.php/Data.getCookies"> Developers Wiki: Data.setCookie</a> @see <a href="http://wiki.developers.facebook.com/index.php/Cookies"> Developers Wiki: Cookies</a>
[ "Sets", "a", "cookie", "for", "a", "given", "user", "and", "application", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L2317-L2320
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/utils/EventUtils.java
EventUtils.getAddressForUrl
public static String getAddressForUrl(String address, boolean resolveForIp) { if (address == null) { return null; } // drop schema int pos = address.indexOf("://"); if (pos > 0) { address = address.substring(pos + 3); } // drop user authentication information pos = address.indexOf('@'); if (pos > 0) { address = address.substring(pos + 1); } // drop trailing parts: port number, query parameters, path, fragment for (int i = 0; i < address.length(); ++i) { char c = address.charAt(i); if ((c == ':') || (c == '?') || (c == '/') || (c == '#')) { return address.substring(0, i); } } return address; }
java
public static String getAddressForUrl(String address, boolean resolveForIp) { if (address == null) { return null; } // drop schema int pos = address.indexOf("://"); if (pos > 0) { address = address.substring(pos + 3); } // drop user authentication information pos = address.indexOf('@'); if (pos > 0) { address = address.substring(pos + 1); } // drop trailing parts: port number, query parameters, path, fragment for (int i = 0; i < address.length(); ++i) { char c = address.charAt(i); if ((c == ':') || (c == '?') || (c == '/') || (c == '#')) { return address.substring(0, i); } } return address; }
[ "public", "static", "String", "getAddressForUrl", "(", "String", "address", ",", "boolean", "resolveForIp", ")", "{", "if", "(", "address", "==", "null", ")", "{", "return", "null", ";", "}", "// drop schema", "int", "pos", "=", "address", ".", "indexOf", ...
Extract host name from the given endpoint URI. @see <a href="http://tools.ietf.org/html/rfc3986#section-3">RFC 3986, Section 3</a> @param address endpoint URI or bare IP address. @param resolveForIp dummy. @return host name contained in the URI.
[ "Extract", "host", "name", "from", "the", "given", "endpoint", "URI", ".", "@see", "<a", "href", "=", "http", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc3986#section", "-", "3", ">", "RFC", "3986", "Section", "3<", "/", "a", ...
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/utils/EventUtils.java#L34-L59
tvesalainen/util
util/src/main/java/org/vesalainen/util/CmdArgs.java
CmdArgs.addOption
public final <T> void addOption(String name, String description) { addOption(String.class, name, description, null); }
java
public final <T> void addOption(String name, String description) { addOption(String.class, name, description, null); }
[ "public", "final", "<", "T", ">", "void", "addOption", "(", "String", "name", ",", "String", "description", ")", "{", "addOption", "(", "String", ".", "class", ",", "name", ",", "description", ",", "null", ")", ";", "}" ]
Add a mandatory string option @param <T> Type of option @param name Option name Option name without @param description Option description
[ "Add", "a", "mandatory", "string", "option" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CmdArgs.java#L320-L323
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/function/Actions.java
Actions.toFunc
public static <T1, T2, R> Func2<T1, T2, R> toFunc(final Action2<T1, T2> action, final R result) { return new Func2<T1, T2, R>() { @Override public R call(T1 t1, T2 t2) { action.call(t1, t2); return result; } }; }
java
public static <T1, T2, R> Func2<T1, T2, R> toFunc(final Action2<T1, T2> action, final R result) { return new Func2<T1, T2, R>() { @Override public R call(T1 t1, T2 t2) { action.call(t1, t2); return result; } }; }
[ "public", "static", "<", "T1", ",", "T2", ",", "R", ">", "Func2", "<", "T1", ",", "T2", ",", "R", ">", "toFunc", "(", "final", "Action2", "<", "T1", ",", "T2", ">", "action", ",", "final", "R", "result", ")", "{", "return", "new", "Func2", "<",...
Converts an {@link Action2} to a function that calls the action and returns a specified value. @param action the {@link Action2} to convert @param result the value to return from the function call @return a {@link Func2} that calls {@code action} and returns {@code result}
[ "Converts", "an", "{", "@link", "Action2", "}", "to", "a", "function", "that", "calls", "the", "action", "and", "returns", "a", "specified", "value", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/function/Actions.java#L236-L244
RuedigerMoeller/kontraktor
examples/misc/pub-sub/tcp-based/src/main/java/pubsub/point2point/MediatorActor.java
MediatorActor.tellSubscribers
public void tellSubscribers( Actor sender, String topic, Object message) { List<ReceiverActor> subscriber = topic2Subscriber.get(topic); if ( subscriber != null ) { subscriber.stream() .filter(subs -> !subs.equals(sender)) // do not receive self sent .forEach(subs -> subs.receiveTell(topic, message) ); } }
java
public void tellSubscribers( Actor sender, String topic, Object message) { List<ReceiverActor> subscriber = topic2Subscriber.get(topic); if ( subscriber != null ) { subscriber.stream() .filter(subs -> !subs.equals(sender)) // do not receive self sent .forEach(subs -> subs.receiveTell(topic, message) ); } }
[ "public", "void", "tellSubscribers", "(", "Actor", "sender", ",", "String", "topic", ",", "Object", "message", ")", "{", "List", "<", "ReceiverActor", ">", "subscriber", "=", "topic2Subscriber", ".", "get", "(", "topic", ")", ";", "if", "(", "subscriber", ...
send a fire and forget message to all @param sender @param topic @param message
[ "send", "a", "fire", "and", "forget", "message", "to", "all" ]
train
https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/examples/misc/pub-sub/tcp-based/src/main/java/pubsub/point2point/MediatorActor.java#L63-L70
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java
AStar.removeAStarListener
public void removeAStarListener(AStarListener<ST, PT> listener) { if (this.listeners != null) { this.listeners.remove(listener); if (this.listeners.isEmpty()) { this.listeners = null; } } }
java
public void removeAStarListener(AStarListener<ST, PT> listener) { if (this.listeners != null) { this.listeners.remove(listener); if (this.listeners.isEmpty()) { this.listeners = null; } } }
[ "public", "void", "removeAStarListener", "(", "AStarListener", "<", "ST", ",", "PT", ">", "listener", ")", "{", "if", "(", "this", ".", "listeners", "!=", "null", ")", "{", "this", ".", "listeners", ".", "remove", "(", "listener", ")", ";", "if", "(", ...
Remove listener on A* algorithm events. @param listener the listener.
[ "Remove", "listener", "on", "A", "*", "algorithm", "events", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L102-L109
kiegroup/drools
drools-templates/src/main/java/org/drools/template/DataProviderCompiler.java
DataProviderCompiler.compile
public String compile(final DataProvider dataProvider, final InputStream templateStream, boolean replaceOptionals) { DefaultTemplateContainer tc = new DefaultTemplateContainer(templateStream, replaceOptionals); closeStream(templateStream); return compile(dataProvider, new TemplateDataListener(tc)); }
java
public String compile(final DataProvider dataProvider, final InputStream templateStream, boolean replaceOptionals) { DefaultTemplateContainer tc = new DefaultTemplateContainer(templateStream, replaceOptionals); closeStream(templateStream); return compile(dataProvider, new TemplateDataListener(tc)); }
[ "public", "String", "compile", "(", "final", "DataProvider", "dataProvider", ",", "final", "InputStream", "templateStream", ",", "boolean", "replaceOptionals", ")", "{", "DefaultTemplateContainer", "tc", "=", "new", "DefaultTemplateContainer", "(", "templateStream", ","...
Generates DRL from a data provider for the spreadsheet data and templates. @param dataProvider the data provider for the spreadsheet data @param templateStream the InputStream for reading the templates @return the generated DRL text as a String
[ "Generates", "DRL", "from", "a", "data", "provider", "for", "the", "spreadsheet", "data", "and", "templates", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-templates/src/main/java/org/drools/template/DataProviderCompiler.java#L94-L101
apache/incubator-gobblin
gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/BaseJdbcBufferedInserter.java
BaseJdbcBufferedInserter.initializeBatch
protected void initializeBatch(String databaseName, String table) throws SQLException { this.insertStmtPrefix = createInsertStatementStr(databaseName, table); this.insertPstmtForFixedBatch = this.conn.prepareStatement(createPrepareStatementStr(this.batchSize)); LOG.info(String.format("Initialized for %s insert " + this, (this.batchSize > 1) ? "batch" : "")); }
java
protected void initializeBatch(String databaseName, String table) throws SQLException { this.insertStmtPrefix = createInsertStatementStr(databaseName, table); this.insertPstmtForFixedBatch = this.conn.prepareStatement(createPrepareStatementStr(this.batchSize)); LOG.info(String.format("Initialized for %s insert " + this, (this.batchSize > 1) ? "batch" : "")); }
[ "protected", "void", "initializeBatch", "(", "String", "databaseName", ",", "String", "table", ")", "throws", "SQLException", "{", "this", ".", "insertStmtPrefix", "=", "createInsertStatementStr", "(", "databaseName", ",", "table", ")", ";", "this", ".", "insertPs...
Initializes variables for batch insert and pre-compute PreparedStatement based on requested batch size and parameter size. @param databaseName @param table @throws SQLException
[ "Initializes", "variables", "for", "batch", "insert", "and", "pre", "-", "compute", "PreparedStatement", "based", "on", "requested", "batch", "size", "and", "parameter", "size", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/BaseJdbcBufferedInserter.java#L132-L138
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/webhook/WebhookMessage.java
WebhookMessage.embeds
public static WebhookMessage embeds(MessageEmbed first, MessageEmbed... embeds) { Checks.notNull(first, "Embeds"); Checks.noneNull(embeds, "Embeds"); List<MessageEmbed> list = new ArrayList<>(1 + embeds.length); list.add(first); Collections.addAll(list, embeds); return new WebhookMessage(null, null, null, list, false, null); }
java
public static WebhookMessage embeds(MessageEmbed first, MessageEmbed... embeds) { Checks.notNull(first, "Embeds"); Checks.noneNull(embeds, "Embeds"); List<MessageEmbed> list = new ArrayList<>(1 + embeds.length); list.add(first); Collections.addAll(list, embeds); return new WebhookMessage(null, null, null, list, false, null); }
[ "public", "static", "WebhookMessage", "embeds", "(", "MessageEmbed", "first", ",", "MessageEmbed", "...", "embeds", ")", "{", "Checks", ".", "notNull", "(", "first", ",", "\"Embeds\"", ")", ";", "Checks", ".", "noneNull", "(", "embeds", ",", "\"Embeds\"", ")...
forcing first embed as we expect at least one entry (Effective Java 3rd. Edition - Item 53)
[ "forcing", "first", "embed", "as", "we", "expect", "at", "least", "one", "entry", "(", "Effective", "Java", "3rd", ".", "Edition", "-", "Item", "53", ")" ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookMessage.java#L77-L85
ReactiveX/RxJavaFX
src/main/java/io/reactivex/rxjavafx/transformers/FxObservableTransformers.java
FxObservableTransformers.doOnNextCount
public static <T> ObservableTransformer<T,T> doOnNextCount(Consumer<Integer> onNext) { return obs -> obs.lift(new OperatorEmissionCounter<>(new CountObserver(onNext,null,null))); }
java
public static <T> ObservableTransformer<T,T> doOnNextCount(Consumer<Integer> onNext) { return obs -> obs.lift(new OperatorEmissionCounter<>(new CountObserver(onNext,null,null))); }
[ "public", "static", "<", "T", ">", "ObservableTransformer", "<", "T", ",", "T", ">", "doOnNextCount", "(", "Consumer", "<", "Integer", ">", "onNext", ")", "{", "return", "obs", "->", "obs", ".", "lift", "(", "new", "OperatorEmissionCounter", "<>", "(", "...
Performs an action on onNext with the provided emission count @param onNext @param <T>
[ "Performs", "an", "action", "on", "onNext", "with", "the", "provided", "emission", "count" ]
train
https://github.com/ReactiveX/RxJavaFX/blob/8f44d4cc1caba9a8919f01cb1897aaea5514c7e5/src/main/java/io/reactivex/rxjavafx/transformers/FxObservableTransformers.java#L113-L115
j256/ormlite-core
src/main/java/com/j256/ormlite/table/TableUtils.java
TableUtils.dropTable
public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); }
java
public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); }
[ "public", "static", "<", "T", ",", "ID", ">", "int", "dropTable", "(", "ConnectionSource", "connectionSource", ",", "Class", "<", "T", ">", "dataClass", ",", "boolean", "ignoreErrors", ")", "throws", "SQLException", "{", "Dao", "<", "T", ",", "ID", ">", ...
Issue the database statements to drop the table associated with a class. <p> <b>WARNING:</b> This is [obviously] very destructive and is unrecoverable. </p> @param connectionSource Associated connection source. @param dataClass The class for which a table will be dropped. @param ignoreErrors If set to true then try each statement regardless of {@link SQLException} thrown previously. @return The number of statements executed to do so.
[ "Issue", "the", "database", "statements", "to", "drop", "the", "table", "associated", "with", "a", "class", "." ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/table/TableUtils.java#L170-L174
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.greaterThan
@ArgumentsChecked @Throws(IllegalNotGreaterThanException.class) public static byte greaterThan(final byte expected, final byte check) { if (expected >= check) { throw new IllegalNotGreaterThanException(check); } return check; }
java
@ArgumentsChecked @Throws(IllegalNotGreaterThanException.class) public static byte greaterThan(final byte expected, final byte check) { if (expected >= check) { throw new IllegalNotGreaterThanException(check); } return check; }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "IllegalNotGreaterThanException", ".", "class", ")", "public", "static", "byte", "greaterThan", "(", "final", "byte", "expected", ",", "final", "byte", "check", ")", "{", "if", "(", "expected", ">=", "check", ")", ...
Ensures that a passed {@code byte} is greater to another {@code byte}. @param expected Expected value @param check Comparable to be checked @return the passed {@code Comparable} argument {@code check} @throws IllegalNotGreaterThanException if the argument value {@code check} is not greater than value {@code expected}
[ "Ensures", "that", "a", "passed", "{", "@code", "byte", "}", "is", "greater", "to", "another", "{", "@code", "byte", "}", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L731-L739
hyperledger/fabric-chaincode-java
fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/Handler.java
Handler.markIsTransaction
private synchronized boolean markIsTransaction(String channelId, String uuid, boolean isTransaction) { if (this.isTransaction == null) { return false; } String key = getTxKey(channelId, uuid); this.isTransaction.put(key, isTransaction); return true; }
java
private synchronized boolean markIsTransaction(String channelId, String uuid, boolean isTransaction) { if (this.isTransaction == null) { return false; } String key = getTxKey(channelId, uuid); this.isTransaction.put(key, isTransaction); return true; }
[ "private", "synchronized", "boolean", "markIsTransaction", "(", "String", "channelId", ",", "String", "uuid", ",", "boolean", "isTransaction", ")", "{", "if", "(", "this", ".", "isTransaction", "==", "null", ")", "{", "return", "false", ";", "}", "String", "...
Marks a CHANNELID+UUID as either a transaction or a query @param uuid ID to be marked @param isTransaction true for transaction, false for query @return whether or not the UUID was successfully marked
[ "Marks", "a", "CHANNELID", "+", "UUID", "as", "either", "a", "transaction", "or", "a", "query" ]
train
https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/Handler.java#L216-L224
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/io/Files.java
Files.newWriter
public static BufferedWriter newWriter(File file, Charset charset) throws FileNotFoundException { checkNotNull(file); checkNotNull(charset); return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset)); }
java
public static BufferedWriter newWriter(File file, Charset charset) throws FileNotFoundException { checkNotNull(file); checkNotNull(charset); return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset)); }
[ "public", "static", "BufferedWriter", "newWriter", "(", "File", "file", ",", "Charset", "charset", ")", "throws", "FileNotFoundException", "{", "checkNotNull", "(", "file", ")", ";", "checkNotNull", "(", "charset", ")", ";", "return", "new", "BufferedWriter", "(...
Returns a buffered writer that writes to a file using the given character set. @param file the file to write to @param charset the charset used to encode the output stream; see {@link StandardCharsets} for helpful predefined constants @return the buffered writer
[ "Returns", "a", "buffered", "writer", "that", "writes", "to", "a", "file", "using", "the", "given", "character", "set", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/io/Files.java#L95-L99
spring-projects/spring-android
spring-android-core/src/main/java/org/springframework/util/ReflectionUtils.java
ReflectionUtils.invokeJdbcMethod
public static Object invokeJdbcMethod(Method method, Object target, Object... args) throws SQLException { try { return method.invoke(target, args); } catch (IllegalAccessException ex) { handleReflectionException(ex); } catch (InvocationTargetException ex) { if (ex.getTargetException() instanceof SQLException) { throw (SQLException) ex.getTargetException(); } handleInvocationTargetException(ex); } throw new IllegalStateException("Should never get here"); }
java
public static Object invokeJdbcMethod(Method method, Object target, Object... args) throws SQLException { try { return method.invoke(target, args); } catch (IllegalAccessException ex) { handleReflectionException(ex); } catch (InvocationTargetException ex) { if (ex.getTargetException() instanceof SQLException) { throw (SQLException) ex.getTargetException(); } handleInvocationTargetException(ex); } throw new IllegalStateException("Should never get here"); }
[ "public", "static", "Object", "invokeJdbcMethod", "(", "Method", "method", ",", "Object", "target", ",", "Object", "...", "args", ")", "throws", "SQLException", "{", "try", "{", "return", "method", ".", "invoke", "(", "target", ",", "args", ")", ";", "}", ...
Invoke the specified JDBC API {@link Method} against the supplied target object with the supplied arguments. @param method the method to invoke @param target the target object to invoke the method on @param args the invocation arguments (may be {@code null}) @return the invocation result, if any @throws SQLException the JDBC API SQLException to rethrow (if any) @see #invokeMethod(java.lang.reflect.Method, Object, Object[])
[ "Invoke", "the", "specified", "JDBC", "API", "{" ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ReflectionUtils.java#L228-L242