repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.countByC_S
@Override public int countByC_S(long CPDefinitionId, String sku) { """ Returns the number of cp instances where CPDefinitionId = ? and sku = ?. @param CPDefinitionId the cp definition ID @param sku the sku @return the number of matching cp instances """ FinderPath finderPath = FINDER_PATH_COUNT_BY_C_S; Object[] finderArgs = new Object[] { CPDefinitionId, sku }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPINSTANCE_WHERE); query.append(_FINDER_COLUMN_C_S_CPDEFINITIONID_2); boolean bindSku = false; if (sku == null) { query.append(_FINDER_COLUMN_C_S_SKU_1); } else if (sku.equals("")) { query.append(_FINDER_COLUMN_C_S_SKU_3); } else { bindSku = true; query.append(_FINDER_COLUMN_C_S_SKU_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(CPDefinitionId); if (bindSku) { qPos.add(sku); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByC_S(long CPDefinitionId, String sku) { FinderPath finderPath = FINDER_PATH_COUNT_BY_C_S; Object[] finderArgs = new Object[] { CPDefinitionId, sku }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPINSTANCE_WHERE); query.append(_FINDER_COLUMN_C_S_CPDEFINITIONID_2); boolean bindSku = false; if (sku == null) { query.append(_FINDER_COLUMN_C_S_SKU_1); } else if (sku.equals("")) { query.append(_FINDER_COLUMN_C_S_SKU_3); } else { bindSku = true; query.append(_FINDER_COLUMN_C_S_SKU_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(CPDefinitionId); if (bindSku) { qPos.add(sku); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByC_S", "(", "long", "CPDefinitionId", ",", "String", "sku", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_C_S", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "CPDefinitio...
Returns the number of cp instances where CPDefinitionId = ? and sku = ?. @param CPDefinitionId the cp definition ID @param sku the sku @return the number of matching cp instances
[ "Returns", "the", "number", "of", "cp", "instances", "where", "CPDefinitionId", "=", "&#63", ";", "and", "sku", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L4495-L4556
thinkaurelius/titan
titan-core/src/main/java/com/thinkaurelius/titan/graphdb/util/ElementHelper.java
ElementHelper.attachProperties
public static void attachProperties(final TitanVertex vertex, final Object... propertyKeyValues) { """ This is essentially an adjusted copy&paste from TinkerPop's ElementHelper class. The reason for copying it is so that we can determine the cardinality of a property key based on Titan's schema which is tied to this particular transaction and not the graph. @param vertex @param propertyKeyValues """ if (null == vertex) throw Graph.Exceptions.argumentCanNotBeNull("vertex"); for (int i = 0; i < propertyKeyValues.length; i = i + 2) { if (!propertyKeyValues[i].equals(T.id) && !propertyKeyValues[i].equals(T.label)) vertex.property((String) propertyKeyValues[i], propertyKeyValues[i + 1]); } }
java
public static void attachProperties(final TitanVertex vertex, final Object... propertyKeyValues) { if (null == vertex) throw Graph.Exceptions.argumentCanNotBeNull("vertex"); for (int i = 0; i < propertyKeyValues.length; i = i + 2) { if (!propertyKeyValues[i].equals(T.id) && !propertyKeyValues[i].equals(T.label)) vertex.property((String) propertyKeyValues[i], propertyKeyValues[i + 1]); } }
[ "public", "static", "void", "attachProperties", "(", "final", "TitanVertex", "vertex", ",", "final", "Object", "...", "propertyKeyValues", ")", "{", "if", "(", "null", "==", "vertex", ")", "throw", "Graph", ".", "Exceptions", ".", "argumentCanNotBeNull", "(", ...
This is essentially an adjusted copy&paste from TinkerPop's ElementHelper class. The reason for copying it is so that we can determine the cardinality of a property key based on Titan's schema which is tied to this particular transaction and not the graph. @param vertex @param propertyKeyValues
[ "This", "is", "essentially", "an", "adjusted", "copy&paste", "from", "TinkerPop", "s", "ElementHelper", "class", ".", "The", "reason", "for", "copying", "it", "is", "so", "that", "we", "can", "determine", "the", "cardinality", "of", "a", "property", "key", "...
train
https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/graphdb/util/ElementHelper.java#L60-L68
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XMLStringFactoryImpl.java
XMLStringFactoryImpl.newstr
public XMLString newstr(FastStringBuffer fsb, int start, int length) { """ Create a XMLString from a FastStringBuffer. @param fsb FastStringBuffer reference, which must be non-null. @param start The start position in the array. @param length The number of characters to read from the array. @return An XMLString object that wraps the FastStringBuffer reference. """ return new XStringForFSB(fsb, start, length); }
java
public XMLString newstr(FastStringBuffer fsb, int start, int length) { return new XStringForFSB(fsb, start, length); }
[ "public", "XMLString", "newstr", "(", "FastStringBuffer", "fsb", ",", "int", "start", ",", "int", "length", ")", "{", "return", "new", "XStringForFSB", "(", "fsb", ",", "start", ",", "length", ")", ";", "}" ]
Create a XMLString from a FastStringBuffer. @param fsb FastStringBuffer reference, which must be non-null. @param start The start position in the array. @param length The number of characters to read from the array. @return An XMLString object that wraps the FastStringBuffer reference.
[ "Create", "a", "XMLString", "from", "a", "FastStringBuffer", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XMLStringFactoryImpl.java#L71-L74
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/Rational.java
Rational.compareTo
public int compareTo(final BigInteger val) { """ Compares the value of this with another constant. @param val the other constant to compare with @return -1, 0 or 1 if this number is numerically less than, equal to, or greater than val. """ final Rational val2 = new Rational(val, BigInteger.ONE); return (compareTo(val2)); }
java
public int compareTo(final BigInteger val) { final Rational val2 = new Rational(val, BigInteger.ONE); return (compareTo(val2)); }
[ "public", "int", "compareTo", "(", "final", "BigInteger", "val", ")", "{", "final", "Rational", "val2", "=", "new", "Rational", "(", "val", ",", "BigInteger", ".", "ONE", ")", ";", "return", "(", "compareTo", "(", "val2", ")", ")", ";", "}" ]
Compares the value of this with another constant. @param val the other constant to compare with @return -1, 0 or 1 if this number is numerically less than, equal to, or greater than val.
[ "Compares", "the", "value", "of", "this", "with", "another", "constant", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/Rational.java#L441-L444
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/AbstractBoottimeAddStepHandler.java
AbstractBoottimeAddStepHandler.performRuntime
@Override protected final void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { """ If {@link OperationContext#isBooting()} returns {@code true}, invokes {@link #performBoottime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)}, else invokes {@link OperationContext#reloadRequired()}. {@inheritDoc} """ if (context.isBooting()) { performBoottime(context, operation, resource); } else { context.reloadRequired(); } }
java
@Override protected final void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { if (context.isBooting()) { performBoottime(context, operation, resource); } else { context.reloadRequired(); } }
[ "@", "Override", "protected", "final", "void", "performRuntime", "(", "OperationContext", "context", ",", "ModelNode", "operation", ",", "Resource", "resource", ")", "throws", "OperationFailedException", "{", "if", "(", "context", ".", "isBooting", "(", ")", ")", ...
If {@link OperationContext#isBooting()} returns {@code true}, invokes {@link #performBoottime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)}, else invokes {@link OperationContext#reloadRequired()}. {@inheritDoc}
[ "If", "{", "@link", "OperationContext#isBooting", "()", "}", "returns", "{", "@code", "true", "}", "invokes", "{", "@link", "#performBoottime", "(", "OperationContext", "org", ".", "jboss", ".", "dmr", ".", "ModelNode", "org", ".", "jboss", ".", "as", ".", ...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractBoottimeAddStepHandler.java#L116-L123
igniterealtime/jbosh
src/main/java/org/igniterealtime/jbosh/BOSHClientConnEvent.java
BOSHClientConnEvent.createConnectionClosedOnErrorEvent
static BOSHClientConnEvent createConnectionClosedOnErrorEvent( final BOSHClient source, final List<ComposableBody> outstanding, final Throwable cause) { """ Creates a connection closed on error event. This represents an unexpected termination of the client session. @param source client which has been disconnected @param outstanding list of requests which may not have been received by the remote connection manager @param cause cause of termination @return event instance """ return new BOSHClientConnEvent(source, false, outstanding, cause); }
java
static BOSHClientConnEvent createConnectionClosedOnErrorEvent( final BOSHClient source, final List<ComposableBody> outstanding, final Throwable cause) { return new BOSHClientConnEvent(source, false, outstanding, cause); }
[ "static", "BOSHClientConnEvent", "createConnectionClosedOnErrorEvent", "(", "final", "BOSHClient", "source", ",", "final", "List", "<", "ComposableBody", ">", "outstanding", ",", "final", "Throwable", "cause", ")", "{", "return", "new", "BOSHClientConnEvent", "(", "so...
Creates a connection closed on error event. This represents an unexpected termination of the client session. @param source client which has been disconnected @param outstanding list of requests which may not have been received by the remote connection manager @param cause cause of termination @return event instance
[ "Creates", "a", "connection", "closed", "on", "error", "event", ".", "This", "represents", "an", "unexpected", "termination", "of", "the", "client", "session", "." ]
train
https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClientConnEvent.java#L127-L132
craterdog/java-security-framework
java-certificate-management-providers/src/main/java/craterdog/security/RsaCertificateManager.java
RsaCertificateManager.createSigningRequest
public PKCS10CertificationRequest createSigningRequest(PrivateKey privateKey, PublicKey publicKey, String subjectString) { """ This method creates a new certificate signing request (CSR) using the specified key pair and subject string. This is a convenience method that really should be part of the <code>CertificateManagement</code> interface except that it depends on a Bouncy Castle class in the signature. The java security framework does not have a similar class so it has been left out of the interface. @param privateKey The private key to be used to sign the request. @param publicKey The corresponding public key that is to be wrapped in the new certificate. @param subjectString The subject string to be included in the generated certificate. @return The newly created CSR. """ try { logger.entry(); logger.debug("Creating the CSR..."); X500Principal subject = new X500Principal(subjectString); ContentSigner signer = new JcaContentSignerBuilder(ASYMMETRIC_SIGNATURE_ALGORITHM).build(privateKey); PKCS10CertificationRequest result = new JcaPKCS10CertificationRequestBuilder(subject, publicKey) .setLeaveOffEmptyAttributes(true).build(signer); logger.exit(); return result; } catch (OperatorCreationException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to generate a new certificate signing request.", e); logger.error(exception.toString()); throw exception; } }
java
public PKCS10CertificationRequest createSigningRequest(PrivateKey privateKey, PublicKey publicKey, String subjectString) { try { logger.entry(); logger.debug("Creating the CSR..."); X500Principal subject = new X500Principal(subjectString); ContentSigner signer = new JcaContentSignerBuilder(ASYMMETRIC_SIGNATURE_ALGORITHM).build(privateKey); PKCS10CertificationRequest result = new JcaPKCS10CertificationRequestBuilder(subject, publicKey) .setLeaveOffEmptyAttributes(true).build(signer); logger.exit(); return result; } catch (OperatorCreationException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to generate a new certificate signing request.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "PKCS10CertificationRequest", "createSigningRequest", "(", "PrivateKey", "privateKey", ",", "PublicKey", "publicKey", ",", "String", "subjectString", ")", "{", "try", "{", "logger", ".", "entry", "(", ")", ";", "logger", ".", "debug", "(", "\"Creating th...
This method creates a new certificate signing request (CSR) using the specified key pair and subject string. This is a convenience method that really should be part of the <code>CertificateManagement</code> interface except that it depends on a Bouncy Castle class in the signature. The java security framework does not have a similar class so it has been left out of the interface. @param privateKey The private key to be used to sign the request. @param publicKey The corresponding public key that is to be wrapped in the new certificate. @param subjectString The subject string to be included in the generated certificate. @return The newly created CSR.
[ "This", "method", "creates", "a", "new", "certificate", "signing", "request", "(", "CSR", ")", "using", "the", "specified", "key", "pair", "and", "subject", "string", ".", "This", "is", "a", "convenience", "method", "that", "really", "should", "be", "part", ...
train
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-providers/src/main/java/craterdog/security/RsaCertificateManager.java#L113-L132
google/j2objc
jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java
BigDecimal.compareMagnitudeNormalized
private static int compareMagnitudeNormalized(long xs, int xscale, long ys, int yscale) { """ Compare Normalize dividend & divisor so that both fall into [0.1, 0.999...] """ // assert xs!=0 && ys!=0 int sdiff = xscale - yscale; if (sdiff != 0) { if (sdiff < 0) { xs = longMultiplyPowerTen(xs, -sdiff); } else { // sdiff > 0 ys = longMultiplyPowerTen(ys, sdiff); } } if (xs != INFLATED) return (ys != INFLATED) ? longCompareMagnitude(xs, ys) : -1; else return 1; }
java
private static int compareMagnitudeNormalized(long xs, int xscale, long ys, int yscale) { // assert xs!=0 && ys!=0 int sdiff = xscale - yscale; if (sdiff != 0) { if (sdiff < 0) { xs = longMultiplyPowerTen(xs, -sdiff); } else { // sdiff > 0 ys = longMultiplyPowerTen(ys, sdiff); } } if (xs != INFLATED) return (ys != INFLATED) ? longCompareMagnitude(xs, ys) : -1; else return 1; }
[ "private", "static", "int", "compareMagnitudeNormalized", "(", "long", "xs", ",", "int", "xscale", ",", "long", "ys", ",", "int", "yscale", ")", "{", "// assert xs!=0 && ys!=0", "int", "sdiff", "=", "xscale", "-", "yscale", ";", "if", "(", "sdiff", "!=", "...
Compare Normalize dividend & divisor so that both fall into [0.1, 0.999...]
[ "Compare", "Normalize", "dividend", "&", "divisor", "so", "that", "both", "fall", "into", "[", "0", ".", "1", "0", ".", "999", "...", "]" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L4952-L4966
LearnLib/automatalib
util/src/main/java/net/automatalib/util/automata/minimizer/hopcroft/HopcroftMinimization.java
HopcroftMinimization.minimizeMealy
public static <S, I, T, O, A extends MealyMachine<S, I, T, O> & InputAlphabetHolder<I>> CompactMealy<I, O> minimizeMealy( A mealy, PruningMode pruningMode) { """ Minimizes the given Mealy machine. The result is returned in the form of a {@link CompactMealy}, using the alphabet obtained via <code>mealy.{@link InputAlphabetHolder#getInputAlphabet() getInputAlphabet()}</code>. @param mealy the Mealy machine to minimize @param pruningMode the pruning mode (see above) @return a minimized version of the specified Mealy machine """ return doMinimizeMealy(mealy, mealy.getInputAlphabet(), new CompactMealy.Creator<>(), pruningMode); }
java
public static <S, I, T, O, A extends MealyMachine<S, I, T, O> & InputAlphabetHolder<I>> CompactMealy<I, O> minimizeMealy( A mealy, PruningMode pruningMode) { return doMinimizeMealy(mealy, mealy.getInputAlphabet(), new CompactMealy.Creator<>(), pruningMode); }
[ "public", "static", "<", "S", ",", "I", ",", "T", ",", "O", ",", "A", "extends", "MealyMachine", "<", "S", ",", "I", ",", "T", ",", "O", ">", "&", "InputAlphabetHolder", "<", "I", ">", ">", "CompactMealy", "<", "I", ",", "O", ">", "minimizeMealy"...
Minimizes the given Mealy machine. The result is returned in the form of a {@link CompactMealy}, using the alphabet obtained via <code>mealy.{@link InputAlphabetHolder#getInputAlphabet() getInputAlphabet()}</code>. @param mealy the Mealy machine to minimize @param pruningMode the pruning mode (see above) @return a minimized version of the specified Mealy machine
[ "Minimizes", "the", "given", "Mealy", "machine", ".", "The", "result", "is", "returned", "in", "the", "form", "of", "a", "{", "@link", "CompactMealy", "}", "using", "the", "alphabet", "obtained", "via", "<code", ">", "mealy", ".", "{", "@link", "InputAlpha...
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/minimizer/hopcroft/HopcroftMinimization.java#L118-L122
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/ThresholdLocalOtsu.java
ThresholdLocalOtsu.process
public void process(GrayU8 input , GrayU8 output ) { """ Converts the gray scale input image into a binary image @param input Input image @param output Output binary image """ InputSanityCheck.checkSameShape(input, output); regionWidth = regionWidthLength.computeI(Math.min(input.width,input.height)); if (input.width < regionWidth || input.height < regionWidth) { regionWidth = Math.min(input.width,input.height); } numPixels = regionWidth*regionWidth; int y0 = regionWidth/2; int y1 = input.height-(regionWidth-y0); int x0 = regionWidth/2; int x1 = input.width-(regionWidth-x0); final byte a,b; if( down ) { a = 1; b = 0; } else { a = 0; b = 1; } process(input, output, x0, y0, x1, y1, a, b); }
java
public void process(GrayU8 input , GrayU8 output ) { InputSanityCheck.checkSameShape(input, output); regionWidth = regionWidthLength.computeI(Math.min(input.width,input.height)); if (input.width < regionWidth || input.height < regionWidth) { regionWidth = Math.min(input.width,input.height); } numPixels = regionWidth*regionWidth; int y0 = regionWidth/2; int y1 = input.height-(regionWidth-y0); int x0 = regionWidth/2; int x1 = input.width-(regionWidth-x0); final byte a,b; if( down ) { a = 1; b = 0; } else { a = 0; b = 1; } process(input, output, x0, y0, x1, y1, a, b); }
[ "public", "void", "process", "(", "GrayU8", "input", ",", "GrayU8", "output", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "input", ",", "output", ")", ";", "regionWidth", "=", "regionWidthLength", ".", "computeI", "(", "Math", ".", "min", "(", ...
Converts the gray scale input image into a binary image @param input Input image @param output Output binary image
[ "Converts", "the", "gray", "scale", "input", "image", "into", "a", "binary", "image" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/ThresholdLocalOtsu.java#L81-L105
DeveloperPaul123/FilePickerLibrary
library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePickerActivity.java
FilePickerActivity.setHeaderBackground
private void setHeaderBackground(int colorResId, int drawableResId) { """ Set the background color of the header @param colorResId Resource Id of the color @param drawableResId Resource Id of the drawable """ if (drawableResId == -1) { try { header.setBackgroundColor(getResources().getColor(colorResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } else { try { header.setBackgroundDrawable(getResources().getDrawable(drawableResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } }
java
private void setHeaderBackground(int colorResId, int drawableResId) { if (drawableResId == -1) { try { header.setBackgroundColor(getResources().getColor(colorResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } else { try { header.setBackgroundDrawable(getResources().getDrawable(drawableResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } }
[ "private", "void", "setHeaderBackground", "(", "int", "colorResId", ",", "int", "drawableResId", ")", "{", "if", "(", "drawableResId", "==", "-", "1", ")", "{", "try", "{", "header", ".", "setBackgroundColor", "(", "getResources", "(", ")", ".", "getColor", ...
Set the background color of the header @param colorResId Resource Id of the color @param drawableResId Resource Id of the drawable
[ "Set", "the", "background", "color", "of", "the", "header" ]
train
https://github.com/DeveloperPaul123/FilePickerLibrary/blob/320fe48d478d1c7f961327483271db5a5e91da5b/library/src/main/java/com/github/developerpaul123/filepickerlibrary/FilePickerActivity.java#L529-L544
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/CreatorUtils.java
CreatorUtils.getAnnotation
public static <T extends Annotation> Optional<T> getAnnotation( String annotation, List<? extends HasAnnotations> hasAnnotationsList ) { """ Returns the first occurence of the annotation found on the types @param annotation the annotation @param hasAnnotationsList the types @return the first occurence of the annotation found on the types @param <T> a T object. """ try { Class clazz = Class.forName( annotation ); return getAnnotation( clazz, hasAnnotationsList ); } catch ( ClassNotFoundException e ) { return Optional.absent(); } }
java
public static <T extends Annotation> Optional<T> getAnnotation( String annotation, List<? extends HasAnnotations> hasAnnotationsList ) { try { Class clazz = Class.forName( annotation ); return getAnnotation( clazz, hasAnnotationsList ); } catch ( ClassNotFoundException e ) { return Optional.absent(); } }
[ "public", "static", "<", "T", "extends", "Annotation", ">", "Optional", "<", "T", ">", "getAnnotation", "(", "String", "annotation", ",", "List", "<", "?", "extends", "HasAnnotations", ">", "hasAnnotationsList", ")", "{", "try", "{", "Class", "clazz", "=", ...
Returns the first occurence of the annotation found on the types @param annotation the annotation @param hasAnnotationsList the types @return the first occurence of the annotation found on the types @param <T> a T object.
[ "Returns", "the", "first", "occurence", "of", "the", "annotation", "found", "on", "the", "types" ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/CreatorUtils.java#L124-L132
apache/incubator-gobblin
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/InputRecordCountHelper.java
InputRecordCountHelper.writeRecordCount
@Deprecated public static void writeRecordCount (FileSystem fs, Path dir, long count) throws IOException { """ Write record count to a specific directory. File name is {@link InputRecordCountHelper#RECORD_COUNT_FILE} @param fs file system in use @param dir directory where a record file is located """ State state = loadState(fs, dir); state.setProp(CompactionSlaEventHelper.RECORD_COUNT_TOTAL, count); saveState(fs, dir, state); }
java
@Deprecated public static void writeRecordCount (FileSystem fs, Path dir, long count) throws IOException { State state = loadState(fs, dir); state.setProp(CompactionSlaEventHelper.RECORD_COUNT_TOTAL, count); saveState(fs, dir, state); }
[ "@", "Deprecated", "public", "static", "void", "writeRecordCount", "(", "FileSystem", "fs", ",", "Path", "dir", ",", "long", "count", ")", "throws", "IOException", "{", "State", "state", "=", "loadState", "(", "fs", ",", "dir", ")", ";", "state", ".", "s...
Write record count to a specific directory. File name is {@link InputRecordCountHelper#RECORD_COUNT_FILE} @param fs file system in use @param dir directory where a record file is located
[ "Write", "record", "count", "to", "a", "specific", "directory", ".", "File", "name", "is", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/InputRecordCountHelper.java#L185-L190
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/sort/support/HeapSort.java
HeapSort.siftDown
protected <E> void siftDown(final List<E> elements, final int startIndex, final int endIndex) { """ Creates a binary heap with the list of elements with the largest valued element at the root followed by the next largest valued elements as parents down to the leafs. @param <E> the Class type of the elements in the List. @param elements the List of elements to heapify. @param startIndex an integer value indicating the starting index in the heap in the List of elements. @param endIndex an integer value indicating the ending index in the heap in the List of elements. """ int rootIndex = startIndex; while ((rootIndex * 2 + 1) <= endIndex) { int swapIndex = rootIndex; int leftChildIndex = (rootIndex * 2 + 1); int rightChildIndex = (leftChildIndex + 1); if (getOrderBy().compare(elements.get(swapIndex), elements.get(leftChildIndex)) < 0) { swapIndex = leftChildIndex; } if (rightChildIndex <= endIndex && getOrderBy().compare(elements.get(swapIndex), elements.get(rightChildIndex)) < 0) { swapIndex = rightChildIndex; } if (swapIndex != rootIndex) { swap(elements, rootIndex, swapIndex); rootIndex = swapIndex; } else { return; } } }
java
protected <E> void siftDown(final List<E> elements, final int startIndex, final int endIndex) { int rootIndex = startIndex; while ((rootIndex * 2 + 1) <= endIndex) { int swapIndex = rootIndex; int leftChildIndex = (rootIndex * 2 + 1); int rightChildIndex = (leftChildIndex + 1); if (getOrderBy().compare(elements.get(swapIndex), elements.get(leftChildIndex)) < 0) { swapIndex = leftChildIndex; } if (rightChildIndex <= endIndex && getOrderBy().compare(elements.get(swapIndex), elements.get(rightChildIndex)) < 0) { swapIndex = rightChildIndex; } if (swapIndex != rootIndex) { swap(elements, rootIndex, swapIndex); rootIndex = swapIndex; } else { return; } } }
[ "protected", "<", "E", ">", "void", "siftDown", "(", "final", "List", "<", "E", ">", "elements", ",", "final", "int", "startIndex", ",", "final", "int", "endIndex", ")", "{", "int", "rootIndex", "=", "startIndex", ";", "while", "(", "(", "rootIndex", "...
Creates a binary heap with the list of elements with the largest valued element at the root followed by the next largest valued elements as parents down to the leafs. @param <E> the Class type of the elements in the List. @param elements the List of elements to heapify. @param startIndex an integer value indicating the starting index in the heap in the List of elements. @param endIndex an integer value indicating the ending index in the heap in the List of elements.
[ "Creates", "a", "binary", "heap", "with", "the", "list", "of", "elements", "with", "the", "largest", "valued", "element", "at", "the", "root", "followed", "by", "the", "next", "largest", "valued", "elements", "as", "parents", "down", "to", "the", "leafs", ...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/sort/support/HeapSort.java#L75-L99
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/model/TableDef.java
TableDef.addForeignkey
public void addForeignkey(String relationName, String remoteTable, List localColumns, List remoteColumns) { """ Adds a foreignkey to this table. @param relationName The name of the relation represented by the foreignkey @param remoteTable The referenced table @param localColumns The local columns @param remoteColumns The remote columns """ ForeignkeyDef foreignkeyDef = new ForeignkeyDef(relationName, remoteTable); // the field arrays have the same length if we already checked the constraints for (int idx = 0; idx < localColumns.size(); idx++) { foreignkeyDef.addColumnPair((String)localColumns.get(idx), (String)remoteColumns.get(idx)); } // we got to determine whether this foreignkey is already present ForeignkeyDef def = null; for (Iterator it = getForeignkeys(); it.hasNext();) { def = (ForeignkeyDef)it.next(); if (foreignkeyDef.equals(def)) { return; } } foreignkeyDef.setOwner(this); _foreignkeys.add(foreignkeyDef); }
java
public void addForeignkey(String relationName, String remoteTable, List localColumns, List remoteColumns) { ForeignkeyDef foreignkeyDef = new ForeignkeyDef(relationName, remoteTable); // the field arrays have the same length if we already checked the constraints for (int idx = 0; idx < localColumns.size(); idx++) { foreignkeyDef.addColumnPair((String)localColumns.get(idx), (String)remoteColumns.get(idx)); } // we got to determine whether this foreignkey is already present ForeignkeyDef def = null; for (Iterator it = getForeignkeys(); it.hasNext();) { def = (ForeignkeyDef)it.next(); if (foreignkeyDef.equals(def)) { return; } } foreignkeyDef.setOwner(this); _foreignkeys.add(foreignkeyDef); }
[ "public", "void", "addForeignkey", "(", "String", "relationName", ",", "String", "remoteTable", ",", "List", "localColumns", ",", "List", "remoteColumns", ")", "{", "ForeignkeyDef", "foreignkeyDef", "=", "new", "ForeignkeyDef", "(", "relationName", ",", "remoteTable...
Adds a foreignkey to this table. @param relationName The name of the relation represented by the foreignkey @param remoteTable The referenced table @param localColumns The local columns @param remoteColumns The remote columns
[ "Adds", "a", "foreignkey", "to", "this", "table", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/TableDef.java#L129-L153
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.deleteIntent
public OperationStatus deleteIntent(UUID appId, String versionId, UUID intentId, DeleteIntentOptionalParameter deleteIntentOptionalParameter) { """ Deletes an intent classifier from the application. @param appId The application ID. @param versionId The version ID. @param intentId The intent classifier ID. @param deleteIntentOptionalParameter the object representing the optional parameters to be set before calling this API @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. """ return deleteIntentWithServiceResponseAsync(appId, versionId, intentId, deleteIntentOptionalParameter).toBlocking().single().body(); }
java
public OperationStatus deleteIntent(UUID appId, String versionId, UUID intentId, DeleteIntentOptionalParameter deleteIntentOptionalParameter) { return deleteIntentWithServiceResponseAsync(appId, versionId, intentId, deleteIntentOptionalParameter).toBlocking().single().body(); }
[ "public", "OperationStatus", "deleteIntent", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "intentId", ",", "DeleteIntentOptionalParameter", "deleteIntentOptionalParameter", ")", "{", "return", "deleteIntentWithServiceResponseAsync", "(", "appId", ",", "v...
Deletes an intent classifier from the application. @param appId The application ID. @param versionId The version ID. @param intentId The intent classifier ID. @param deleteIntentOptionalParameter the object representing the optional parameters to be set before calling this API @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.
[ "Deletes", "an", "intent", "classifier", "from", "the", "application", "." ]
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#L3100-L3102
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATProxyConsumer.java
CATProxyConsumer.sendEntireMessage
private int sendEntireMessage(SIBusMessage sibMessage, List<DataSlice> messageSlices) throws MessageCopyFailedException, IncorrectMessageTypeException, MessageEncodeFailedException, UnsupportedEncodingException { """ Send the entire message in one big buffer. If the messageSlices parameter is not null then the message has already been encoded and does not need to be done again. This may be in the case where the message was destined to be sent in chunks but is so small that it does not seem worth it. @param sibMessage The entire message to send. @param messageSlices The already encoded message slices. @return Returns the length of the message sent to the client. @throws MessageCopyFailedException @throws IncorrectMessageTypeException @throws MessageEncodeFailedException @throws UnsupportedEncodingException """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendEntireMessage", new Object[]{sibMessage, messageSlices}); int msgLen = 0; try { CommsServerByteBuffer buffer = poolManager.allocate(); ConversationState convState = (ConversationState) getConversation().getAttachment(); buffer.putShort(convState.getConnectionObjectId()); buffer.putShort(mainConsumer.getClientSessionId()); buffer.putShort(mainConsumer.getMessageBatchNumber()); // BIT16 Message batch // Put the entire message into the buffer in whatever way is suitable if (messageSlices == null) { msgLen = buffer.putMessage((JsMessage) sibMessage, convState.getCommsConnection(), getConversation()); } else { msgLen = buffer.putMessgeWithoutEncode(messageSlices); } short jfapPriority = JFapChannelConstants.getJFAPPriority(sibMessage.getPriority()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Sending with JFAP priority of " + jfapPriority); getConversation().send(buffer, JFapChannelConstants.SEG_PROXY_MESSAGE, 0, // No request number jfapPriority, false, ThrottlingPolicy.BLOCK_THREAD, INVALIDATE_CONNECTION_ON_ERROR); messagesSent++; } catch (SIException e1) { FFDCFilter.processException(e1, CLASS_NAME + ".sendEntireMessage", CommsConstants.CATPROXYCONSUMER_SEND_MSG_01, this); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2014", e1); msgLen = 0; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendEntireMessage", msgLen); return msgLen; }
java
private int sendEntireMessage(SIBusMessage sibMessage, List<DataSlice> messageSlices) throws MessageCopyFailedException, IncorrectMessageTypeException, MessageEncodeFailedException, UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendEntireMessage", new Object[]{sibMessage, messageSlices}); int msgLen = 0; try { CommsServerByteBuffer buffer = poolManager.allocate(); ConversationState convState = (ConversationState) getConversation().getAttachment(); buffer.putShort(convState.getConnectionObjectId()); buffer.putShort(mainConsumer.getClientSessionId()); buffer.putShort(mainConsumer.getMessageBatchNumber()); // BIT16 Message batch // Put the entire message into the buffer in whatever way is suitable if (messageSlices == null) { msgLen = buffer.putMessage((JsMessage) sibMessage, convState.getCommsConnection(), getConversation()); } else { msgLen = buffer.putMessgeWithoutEncode(messageSlices); } short jfapPriority = JFapChannelConstants.getJFAPPriority(sibMessage.getPriority()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Sending with JFAP priority of " + jfapPriority); getConversation().send(buffer, JFapChannelConstants.SEG_PROXY_MESSAGE, 0, // No request number jfapPriority, false, ThrottlingPolicy.BLOCK_THREAD, INVALIDATE_CONNECTION_ON_ERROR); messagesSent++; } catch (SIException e1) { FFDCFilter.processException(e1, CLASS_NAME + ".sendEntireMessage", CommsConstants.CATPROXYCONSUMER_SEND_MSG_01, this); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2014", e1); msgLen = 0; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendEntireMessage", msgLen); return msgLen; }
[ "private", "int", "sendEntireMessage", "(", "SIBusMessage", "sibMessage", ",", "List", "<", "DataSlice", ">", "messageSlices", ")", "throws", "MessageCopyFailedException", ",", "IncorrectMessageTypeException", ",", "MessageEncodeFailedException", ",", "UnsupportedEncodingExce...
Send the entire message in one big buffer. If the messageSlices parameter is not null then the message has already been encoded and does not need to be done again. This may be in the case where the message was destined to be sent in chunks but is so small that it does not seem worth it. @param sibMessage The entire message to send. @param messageSlices The already encoded message slices. @return Returns the length of the message sent to the client. @throws MessageCopyFailedException @throws IncorrectMessageTypeException @throws MessageEncodeFailedException @throws UnsupportedEncodingException
[ "Send", "the", "entire", "message", "in", "one", "big", "buffer", ".", "If", "the", "messageSlices", "parameter", "is", "not", "null", "then", "the", "message", "has", "already", "been", "encoded", "and", "does", "not", "need", "to", "be", "done", "again",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATProxyConsumer.java#L804-L861
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java
LocalDateTime.withHour
public LocalDateTime withHour(int hour) { """ Returns a copy of this {@code LocalDateTime} with the hour-of-day altered. <p> This instance is immutable and unaffected by this method call. @param hour the hour-of-day to set in the result, from 0 to 23 @return a {@code LocalDateTime} based on this date-time with the requested hour, not null @throws DateTimeException if the hour value is invalid """ LocalTime newTime = time.withHour(hour); return with(date, newTime); }
java
public LocalDateTime withHour(int hour) { LocalTime newTime = time.withHour(hour); return with(date, newTime); }
[ "public", "LocalDateTime", "withHour", "(", "int", "hour", ")", "{", "LocalTime", "newTime", "=", "time", ".", "withHour", "(", "hour", ")", ";", "return", "with", "(", "date", ",", "newTime", ")", ";", "}" ]
Returns a copy of this {@code LocalDateTime} with the hour-of-day altered. <p> This instance is immutable and unaffected by this method call. @param hour the hour-of-day to set in the result, from 0 to 23 @return a {@code LocalDateTime} based on this date-time with the requested hour, not null @throws DateTimeException if the hour value is invalid
[ "Returns", "a", "copy", "of", "this", "{", "@code", "LocalDateTime", "}", "with", "the", "hour", "-", "of", "-", "day", "altered", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java#L1046-L1049
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/runtime/Interpreter.java
Interpreter.setTracepoint
public Breakpoint setTracepoint(PExp exp, String trace) throws ParserException, LexException { """ Set an expression tracepoint. A tracepoint does not stop execution, but evaluates an expression before continuing. @param exp The expression to trace. @param trace The expression to evaluate. @return The Breakpoint object created. @throws LexException @throws ParserException """ BreakpointManager.setBreakpoint(exp, new Tracepoint(exp.getLocation(), ++nextbreakpoint, trace)); breakpoints.put(nextbreakpoint, BreakpointManager.getBreakpoint(exp)); return BreakpointManager.getBreakpoint(exp); }
java
public Breakpoint setTracepoint(PExp exp, String trace) throws ParserException, LexException { BreakpointManager.setBreakpoint(exp, new Tracepoint(exp.getLocation(), ++nextbreakpoint, trace)); breakpoints.put(nextbreakpoint, BreakpointManager.getBreakpoint(exp)); return BreakpointManager.getBreakpoint(exp); }
[ "public", "Breakpoint", "setTracepoint", "(", "PExp", "exp", ",", "String", "trace", ")", "throws", "ParserException", ",", "LexException", "{", "BreakpointManager", ".", "setBreakpoint", "(", "exp", ",", "new", "Tracepoint", "(", "exp", ".", "getLocation", "(",...
Set an expression tracepoint. A tracepoint does not stop execution, but evaluates an expression before continuing. @param exp The expression to trace. @param trace The expression to evaluate. @return The Breakpoint object created. @throws LexException @throws ParserException
[ "Set", "an", "expression", "tracepoint", ".", "A", "tracepoint", "does", "not", "stop", "execution", "but", "evaluates", "an", "expression", "before", "continuing", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/Interpreter.java#L447-L453
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java
FDBigInteger.leftShift
private static void leftShift(int[] src, int idx, int result[], int bitcount, int anticount, int prev) { """ /*@ @ requires 0 < bitcount && bitcount < 32 && anticount == 32 - bitcount; @ requires src.length >= idx && result.length > idx; @ assignable result[*]; @ ensures AP(result, \old(idx + 1)) == \old((AP(src, idx) + UNSIGNED(prev) << (idx*32)) << bitcount); @ """ for (; idx > 0; idx--) { int v = (prev << bitcount); prev = src[idx - 1]; v |= (prev >>> anticount); result[idx] = v; } int v = prev << bitcount; result[0] = v; }
java
private static void leftShift(int[] src, int idx, int result[], int bitcount, int anticount, int prev){ for (; idx > 0; idx--) { int v = (prev << bitcount); prev = src[idx - 1]; v |= (prev >>> anticount); result[idx] = v; } int v = prev << bitcount; result[0] = v; }
[ "private", "static", "void", "leftShift", "(", "int", "[", "]", "src", ",", "int", "idx", ",", "int", "result", "[", "]", ",", "int", "bitcount", ",", "int", "anticount", ",", "int", "prev", ")", "{", "for", "(", ";", "idx", ">", "0", ";", "idx",...
/*@ @ requires 0 < bitcount && bitcount < 32 && anticount == 32 - bitcount; @ requires src.length >= idx && result.length > idx; @ assignable result[*]; @ ensures AP(result, \old(idx + 1)) == \old((AP(src, idx) + UNSIGNED(prev) << (idx*32)) << bitcount); @
[ "/", "*" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java#L420-L429
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/FileIoUtil.java
FileIoUtil.readPropertiesFromFile
public static Properties readPropertiesFromFile(String _fileName, Properties _props) { """ Read properties from given filename (returns empty {@link Properties} object on failure). @param _fileName The properties file to read @param _props optional properties object, if null a new object created in the method @return {@link Properties} object """ Properties props = _props == null ? new Properties() : _props; LOGGER.debug("Trying to read properties from file: " + _fileName); Properties newProperties = readProperties(new File(_fileName)); if (newProperties != null) { LOGGER.debug("Successfully read properties from file: " + _fileName); props.putAll(newProperties); } return props; }
java
public static Properties readPropertiesFromFile(String _fileName, Properties _props) { Properties props = _props == null ? new Properties() : _props; LOGGER.debug("Trying to read properties from file: " + _fileName); Properties newProperties = readProperties(new File(_fileName)); if (newProperties != null) { LOGGER.debug("Successfully read properties from file: " + _fileName); props.putAll(newProperties); } return props; }
[ "public", "static", "Properties", "readPropertiesFromFile", "(", "String", "_fileName", ",", "Properties", "_props", ")", "{", "Properties", "props", "=", "_props", "==", "null", "?", "new", "Properties", "(", ")", ":", "_props", ";", "LOGGER", ".", "debug", ...
Read properties from given filename (returns empty {@link Properties} object on failure). @param _fileName The properties file to read @param _props optional properties object, if null a new object created in the method @return {@link Properties} object
[ "Read", "properties", "from", "given", "filename", "(", "returns", "empty", "{", "@link", "Properties", "}", "object", "on", "failure", ")", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/FileIoUtil.java#L78-L89
libgdx/box2dlights
src/box2dLight/RayHandler.java
RayHandler.setAmbientLight
public void setAmbientLight(float r, float g, float b, float a) { """ Sets ambient light color. Specifies how shadows colored and their brightness. <p>Default = Color(0, 0, 0, 0) @param r shadows color red component @param g shadows color green component @param b shadows color blue component @param a shadows brightness component @see #setAmbientLight(float) @see #setAmbientLight(Color) """ this.ambientLight.set(r, g, b, a); }
java
public void setAmbientLight(float r, float g, float b, float a) { this.ambientLight.set(r, g, b, a); }
[ "public", "void", "setAmbientLight", "(", "float", "r", ",", "float", "g", ",", "float", "b", ",", "float", "a", ")", "{", "this", ".", "ambientLight", ".", "set", "(", "r", ",", "g", ",", "b", ",", "a", ")", ";", "}" ]
Sets ambient light color. Specifies how shadows colored and their brightness. <p>Default = Color(0, 0, 0, 0) @param r shadows color red component @param g shadows color green component @param b shadows color blue component @param a shadows brightness component @see #setAmbientLight(float) @see #setAmbientLight(Color)
[ "Sets", "ambient", "light", "color", ".", "Specifies", "how", "shadows", "colored", "and", "their", "brightness", "." ]
train
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L530-L532
eyp/serfj
src/main/java/net/sf/serfj/client/Client.java
Client.putRequest
public Object putRequest(String restUrl, Map<String, String> params) throws IOException, WebServiceException { """ Do a PUT HTTP request to the given REST-URL. @param restUrl REST URL. @param params Parameters for adding to the query string. @throws IOException if the request go bad. """ return this.postRequest(HttpMethod.PUT, restUrl, params); }
java
public Object putRequest(String restUrl, Map<String, String> params) throws IOException, WebServiceException { return this.postRequest(HttpMethod.PUT, restUrl, params); }
[ "public", "Object", "putRequest", "(", "String", "restUrl", ",", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "IOException", ",", "WebServiceException", "{", "return", "this", ".", "postRequest", "(", "HttpMethod", ".", "PUT", ",", "res...
Do a PUT HTTP request to the given REST-URL. @param restUrl REST URL. @param params Parameters for adding to the query string. @throws IOException if the request go bad.
[ "Do", "a", "PUT", "HTTP", "request", "to", "the", "given", "REST", "-", "URL", "." ]
train
https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/client/Client.java#L144-L146
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.createMarkerOptions
public static MarkerOptions createMarkerOptions(FeatureStyleExtension featureStyleExtension, FeatureRow featureRow, float density) { """ Create new marker options populated with the feature row style (icon or style) @param featureStyleExtension feature style extension @param featureRow feature row @param density display density: {@link android.util.DisplayMetrics#density} @return marker options populated with the feature style """ MarkerOptions markerOptions = new MarkerOptions(); setFeatureStyle(markerOptions, featureStyleExtension, featureRow, density); return markerOptions; }
java
public static MarkerOptions createMarkerOptions(FeatureStyleExtension featureStyleExtension, FeatureRow featureRow, float density) { MarkerOptions markerOptions = new MarkerOptions(); setFeatureStyle(markerOptions, featureStyleExtension, featureRow, density); return markerOptions; }
[ "public", "static", "MarkerOptions", "createMarkerOptions", "(", "FeatureStyleExtension", "featureStyleExtension", ",", "FeatureRow", "featureRow", ",", "float", "density", ")", "{", "MarkerOptions", "markerOptions", "=", "new", "MarkerOptions", "(", ")", ";", "setFeatu...
Create new marker options populated with the feature row style (icon or style) @param featureStyleExtension feature style extension @param featureRow feature row @param density display density: {@link android.util.DisplayMetrics#density} @return marker options populated with the feature style
[ "Create", "new", "marker", "options", "populated", "with", "the", "feature", "row", "style", "(", "icon", "or", "style", ")" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L94-L100
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java
TimeSeriesUtils.reshapeTimeSeriesMaskToVector
public static INDArray reshapeTimeSeriesMaskToVector(INDArray timeSeriesMask, LayerWorkspaceMgr workspaceMgr, ArrayType arrayType) { """ Reshape time series mask arrays. This should match the assumptions (f order, etc) in RnnOutputLayer @param timeSeriesMask Mask array to reshape to a column vector @return Mask array as a column vector """ if (timeSeriesMask.rank() != 2) throw new IllegalArgumentException("Cannot reshape mask: rank is not 2"); if (timeSeriesMask.ordering() != 'f' || !Shape.hasDefaultStridesForShape(timeSeriesMask)) timeSeriesMask = workspaceMgr.dup(arrayType, timeSeriesMask, 'f'); return workspaceMgr.leverageTo(arrayType, timeSeriesMask.reshape('f', timeSeriesMask.length(), 1)); }
java
public static INDArray reshapeTimeSeriesMaskToVector(INDArray timeSeriesMask, LayerWorkspaceMgr workspaceMgr, ArrayType arrayType) { if (timeSeriesMask.rank() != 2) throw new IllegalArgumentException("Cannot reshape mask: rank is not 2"); if (timeSeriesMask.ordering() != 'f' || !Shape.hasDefaultStridesForShape(timeSeriesMask)) timeSeriesMask = workspaceMgr.dup(arrayType, timeSeriesMask, 'f'); return workspaceMgr.leverageTo(arrayType, timeSeriesMask.reshape('f', timeSeriesMask.length(), 1)); }
[ "public", "static", "INDArray", "reshapeTimeSeriesMaskToVector", "(", "INDArray", "timeSeriesMask", ",", "LayerWorkspaceMgr", "workspaceMgr", ",", "ArrayType", "arrayType", ")", "{", "if", "(", "timeSeriesMask", ".", "rank", "(", ")", "!=", "2", ")", "throw", "new...
Reshape time series mask arrays. This should match the assumptions (f order, etc) in RnnOutputLayer @param timeSeriesMask Mask array to reshape to a column vector @return Mask array as a column vector
[ "Reshape", "time", "series", "mask", "arrays", ".", "This", "should", "match", "the", "assumptions", "(", "f", "order", "etc", ")", "in", "RnnOutputLayer" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java#L79-L87
openbase/jul
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/LabelProcessor.java
LabelProcessor.addLabel
public static Label.Builder addLabel(final Label.Builder labelBuilder, final String languageCode, final String label) { """ Add a label to a labelBuilder by languageCode. If the label is already contained for the language code nothing will be done. If the languageCode already exists and the label is not contained it will be added to the end of the label list by this language code. If no entry for the languageCode exists a new entry will be added and the label added as its first value. @param labelBuilder the label builder to be updated @param languageCode the languageCode for which the label is added @param label the label to be added @return the updated label builder """ for (int i = 0; i < labelBuilder.getEntryCount(); i++) { // found labels for the entry key if (labelBuilder.getEntry(i).getKey().equals(languageCode)) { // check if the new value is not already contained for (String value : labelBuilder.getEntryBuilder(i).getValueList()) { if (value.equalsIgnoreCase(label)) { // return because label is already in there return labelBuilder; } } // add new label labelBuilder.getEntryBuilder(i).addValue(label); return labelBuilder; } } // language code not present yet labelBuilder.addEntryBuilder().setKey(languageCode).addValue(label); return labelBuilder; }
java
public static Label.Builder addLabel(final Label.Builder labelBuilder, final String languageCode, final String label) { for (int i = 0; i < labelBuilder.getEntryCount(); i++) { // found labels for the entry key if (labelBuilder.getEntry(i).getKey().equals(languageCode)) { // check if the new value is not already contained for (String value : labelBuilder.getEntryBuilder(i).getValueList()) { if (value.equalsIgnoreCase(label)) { // return because label is already in there return labelBuilder; } } // add new label labelBuilder.getEntryBuilder(i).addValue(label); return labelBuilder; } } // language code not present yet labelBuilder.addEntryBuilder().setKey(languageCode).addValue(label); return labelBuilder; }
[ "public", "static", "Label", ".", "Builder", "addLabel", "(", "final", "Label", ".", "Builder", "labelBuilder", ",", "final", "String", "languageCode", ",", "final", "String", "label", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "labelBuil...
Add a label to a labelBuilder by languageCode. If the label is already contained for the language code nothing will be done. If the languageCode already exists and the label is not contained it will be added to the end of the label list by this language code. If no entry for the languageCode exists a new entry will be added and the label added as its first value. @param labelBuilder the label builder to be updated @param languageCode the languageCode for which the label is added @param label the label to be added @return the updated label builder
[ "Add", "a", "label", "to", "a", "labelBuilder", "by", "languageCode", ".", "If", "the", "label", "is", "already", "contained", "for", "the", "language", "code", "nothing", "will", "be", "done", ".", "If", "the", "languageCode", "already", "exists", "and", ...
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/LabelProcessor.java#L162-L183
code4everything/util
src/main/java/com/zhazhapan/util/Checker.java
Checker.isNotIn
public static <T> boolean isNotIn(T t, List<T> ts) { """ 检查对象是否不存在某个集合 @param t 对象 @param ts 集合 @param <T> 类型 @return {@link Boolean} @since 1.0.9 """ return isNotIn(t, ts.toArray()); }
java
public static <T> boolean isNotIn(T t, List<T> ts) { return isNotIn(t, ts.toArray()); }
[ "public", "static", "<", "T", ">", "boolean", "isNotIn", "(", "T", "t", ",", "List", "<", "T", ">", "ts", ")", "{", "return", "isNotIn", "(", "t", ",", "ts", ".", "toArray", "(", ")", ")", ";", "}" ]
检查对象是否不存在某个集合 @param t 对象 @param ts 集合 @param <T> 类型 @return {@link Boolean} @since 1.0.9
[ "检查对象是否不存在某个集合" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L693-L695
gallandarakhneorg/afc
advanced/bootique/bootique-printconfig/src/main/java/org/arakhne/afc/bootique/printconfig/commands/PrintConfigCommand.java
PrintConfigCommand.generateYaml
@SuppressWarnings("static-method") protected String generateYaml(Map<String, Object> map) throws JsonProcessingException { """ Generate the Yaml representation of the given map. @param map the map to print out. @return the Yaml representation. @throws JsonProcessingException when the Json cannot be processed. """ final YAMLFactory yamlFactory = new YAMLFactory(); yamlFactory.configure(Feature.WRITE_DOC_START_MARKER, false); final ObjectMapper mapper = new ObjectMapper(yamlFactory); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map); }
java
@SuppressWarnings("static-method") protected String generateYaml(Map<String, Object> map) throws JsonProcessingException { final YAMLFactory yamlFactory = new YAMLFactory(); yamlFactory.configure(Feature.WRITE_DOC_START_MARKER, false); final ObjectMapper mapper = new ObjectMapper(yamlFactory); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map); }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "String", "generateYaml", "(", "Map", "<", "String", ",", "Object", ">", "map", ")", "throws", "JsonProcessingException", "{", "final", "YAMLFactory", "yamlFactory", "=", "new", "YAMLFactory", "(...
Generate the Yaml representation of the given map. @param map the map to print out. @return the Yaml representation. @throws JsonProcessingException when the Json cannot be processed.
[ "Generate", "the", "Yaml", "representation", "of", "the", "given", "map", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-printconfig/src/main/java/org/arakhne/afc/bootique/printconfig/commands/PrintConfigCommand.java#L149-L155
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/assigners/SessionWindowAssigner.java
SessionWindowAssigner.mergeWindow
private TimeWindow mergeWindow(TimeWindow curWindow, TimeWindow other, Collection<TimeWindow> mergedWindow) { """ Merge curWindow and other, return a new window which covers curWindow and other if they are overlapped. Otherwise, returns the curWindow itself. """ if (curWindow.intersects(other)) { mergedWindow.add(other); return curWindow.cover(other); } else { return curWindow; } }
java
private TimeWindow mergeWindow(TimeWindow curWindow, TimeWindow other, Collection<TimeWindow> mergedWindow) { if (curWindow.intersects(other)) { mergedWindow.add(other); return curWindow.cover(other); } else { return curWindow; } }
[ "private", "TimeWindow", "mergeWindow", "(", "TimeWindow", "curWindow", ",", "TimeWindow", "other", ",", "Collection", "<", "TimeWindow", ">", "mergedWindow", ")", "{", "if", "(", "curWindow", ".", "intersects", "(", "other", ")", ")", "{", "mergedWindow", "."...
Merge curWindow and other, return a new window which covers curWindow and other if they are overlapped. Otherwise, returns the curWindow itself.
[ "Merge", "curWindow", "and", "other", "return", "a", "new", "window", "which", "covers", "curWindow", "and", "other", "if", "they", "are", "overlapped", ".", "Otherwise", "returns", "the", "curWindow", "itself", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/assigners/SessionWindowAssigner.java#L81-L88
RestComm/sip-servlets
sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java
SipApplicationSessionImpl.encodeURL
public URL encodeURL(URL url) { """ {@inheritDoc} Adds a get parameter to the URL like this: http://hostname/link -> http://hostname/link?org.mobicents.servlet.sip.ApplicationSessionKey=0 http://hostname/link?something=1 -> http://hostname/link?something=1&org.mobicents.servlet.sip.ApplicationSessionKey=0 """ if(!isValid()) { throw new IllegalStateException("SipApplicationSession already invalidated !"); } String urlStr = url.toExternalForm(); try { URL ret; if (urlStr.contains("?")) { ret = new URL(url + "&" + SIP_APPLICATION_KEY_PARAM_NAME + "=" + getId()); } else { ret = new URL(url + "?" + SIP_APPLICATION_KEY_PARAM_NAME + "=" + getId()); } return ret; } catch (Exception e) { throw new IllegalArgumentException("Failed encoding URL : " + url, e); } }
java
public URL encodeURL(URL url) { if(!isValid()) { throw new IllegalStateException("SipApplicationSession already invalidated !"); } String urlStr = url.toExternalForm(); try { URL ret; if (urlStr.contains("?")) { ret = new URL(url + "&" + SIP_APPLICATION_KEY_PARAM_NAME + "=" + getId()); } else { ret = new URL(url + "?" + SIP_APPLICATION_KEY_PARAM_NAME + "=" + getId()); } return ret; } catch (Exception e) { throw new IllegalArgumentException("Failed encoding URL : " + url, e); } }
[ "public", "URL", "encodeURL", "(", "URL", "url", ")", "{", "if", "(", "!", "isValid", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"SipApplicationSession already invalidated !\"", ")", ";", "}", "String", "urlStr", "=", "url", ".", "to...
{@inheritDoc} Adds a get parameter to the URL like this: http://hostname/link -> http://hostname/link?org.mobicents.servlet.sip.ApplicationSessionKey=0 http://hostname/link?something=1 -> http://hostname/link?something=1&org.mobicents.servlet.sip.ApplicationSessionKey=0
[ "{" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java#L338-L356
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java
Identifiers.createIp4
public static IpAddress createIp4(String value, String admDom) { """ Create an ip-address identifier for IPv4 with the given value and the given administrative-domain. @param value a {@link String} that represents a valid IPv4 address @param admDom the administrative-domain @return the new ip-address identifier """ return createIp(IpAddressType.IPv4, value, admDom); }
java
public static IpAddress createIp4(String value, String admDom) { return createIp(IpAddressType.IPv4, value, admDom); }
[ "public", "static", "IpAddress", "createIp4", "(", "String", "value", ",", "String", "admDom", ")", "{", "return", "createIp", "(", "IpAddressType", ".", "IPv4", ",", "value", ",", "admDom", ")", ";", "}" ]
Create an ip-address identifier for IPv4 with the given value and the given administrative-domain. @param value a {@link String} that represents a valid IPv4 address @param admDom the administrative-domain @return the new ip-address identifier
[ "Create", "an", "ip", "-", "address", "identifier", "for", "IPv4", "with", "the", "given", "value", "and", "the", "given", "administrative", "-", "domain", "." ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java#L616-L618
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/RegistriesInner.java
RegistriesInner.beginCreateAsync
public Observable<RegistryInner> beginCreateAsync(String resourceGroupName, String registryName, RegistryInner registry) { """ Creates a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param registry The parameters for creating a container registry. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RegistryInner object """ return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, registry).map(new Func1<ServiceResponse<RegistryInner>, RegistryInner>() { @Override public RegistryInner call(ServiceResponse<RegistryInner> response) { return response.body(); } }); }
java
public Observable<RegistryInner> beginCreateAsync(String resourceGroupName, String registryName, RegistryInner registry) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, registry).map(new Func1<ServiceResponse<RegistryInner>, RegistryInner>() { @Override public RegistryInner call(ServiceResponse<RegistryInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RegistryInner", ">", "beginCreateAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "RegistryInner", "registry", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryN...
Creates a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param registry The parameters for creating a container registry. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RegistryInner object
[ "Creates", "a", "container", "registry", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/RegistriesInner.java#L417-L424
JoeKerouac/utils
src/main/java/com/joe/utils/common/Algorithm.java
Algorithm.lcs
public static <T> List<T> lcs(List<T> arg0, List<T> arg1, Comparator<T> comparator) { """ 求最长公共子序列(有可能有多种解,该方法只返回其中一种) @param arg0 第一个序列 @param arg1 第二个序列 @param comparator 比较器 @param <T> 数组中数据的实际类型 @return 两个序列的公共子序列(返回的是原队列中的倒序) (集合{1 , 2 , 3 , 4}和集合{2 , 3 , 4 , 1}的公共子序列返回值为{4 , 3 , 2}) """ if (arg0 == null || arg1 == null) { return Collections.emptyList(); } return lcs(arg0, arg1, comparator, 0, 0); }
java
public static <T> List<T> lcs(List<T> arg0, List<T> arg1, Comparator<T> comparator) { if (arg0 == null || arg1 == null) { return Collections.emptyList(); } return lcs(arg0, arg1, comparator, 0, 0); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "lcs", "(", "List", "<", "T", ">", "arg0", ",", "List", "<", "T", ">", "arg1", ",", "Comparator", "<", "T", ">", "comparator", ")", "{", "if", "(", "arg0", "==", "null", "||", "arg1", ...
求最长公共子序列(有可能有多种解,该方法只返回其中一种) @param arg0 第一个序列 @param arg1 第二个序列 @param comparator 比较器 @param <T> 数组中数据的实际类型 @return 两个序列的公共子序列(返回的是原队列中的倒序) (集合{1 , 2 , 3 , 4}和集合{2 , 3 , 4 , 1}的公共子序列返回值为{4 , 3 , 2})
[ "求最长公共子序列(有可能有多种解,该方法只返回其中一种)" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/Algorithm.java#L24-L29
socialsensor/socialsensor-framework-client
src/main/java/eu/socialsensor/framework/client/search/visual/VisualIndexHandler.java
VisualIndexHandler.getSimilarImagesAndIndex
public JsonResultSet getSimilarImagesAndIndex(String id, double[] vector, double threshold) { """ Get similar images by vector @param vector @param threshold @return """ JsonResultSet similar = new JsonResultSet(); byte[] vectorInBytes = new byte[8 * vector.length]; ByteBuffer bbuf = ByteBuffer.wrap(vectorInBytes); for (double value : vector) { bbuf.putDouble(value); } PostMethod queryMethod = null; String response = null; try { ByteArrayPartSource source = new ByteArrayPartSource("bytes", vectorInBytes); Part[] parts = { new StringPart("id", id), new FilePart("vector", source), new StringPart("threshold", String.valueOf(threshold)) }; queryMethod = new PostMethod(webServiceHost + "/rest/visual/qindex/" + 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); } } catch (Exception e) { _logger.error("Exception for vector of length " + vector.length, e); response = null; } finally { if (queryMethod != null) { queryMethod.releaseConnection(); } } return similar; }
java
public JsonResultSet getSimilarImagesAndIndex(String id, double[] vector, double threshold) { JsonResultSet similar = new JsonResultSet(); byte[] vectorInBytes = new byte[8 * vector.length]; ByteBuffer bbuf = ByteBuffer.wrap(vectorInBytes); for (double value : vector) { bbuf.putDouble(value); } PostMethod queryMethod = null; String response = null; try { ByteArrayPartSource source = new ByteArrayPartSource("bytes", vectorInBytes); Part[] parts = { new StringPart("id", id), new FilePart("vector", source), new StringPart("threshold", String.valueOf(threshold)) }; queryMethod = new PostMethod(webServiceHost + "/rest/visual/qindex/" + 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); } } catch (Exception e) { _logger.error("Exception for vector of length " + vector.length, e); response = null; } finally { if (queryMethod != null) { queryMethod.releaseConnection(); } } return similar; }
[ "public", "JsonResultSet", "getSimilarImagesAndIndex", "(", "String", "id", ",", "double", "[", "]", "vector", ",", "double", "threshold", ")", "{", "JsonResultSet", "similar", "=", "new", "JsonResultSet", "(", ")", ";", "byte", "[", "]", "vectorInBytes", "=",...
Get similar images by vector @param vector @param threshold @return
[ "Get", "similar", "images", "by", "vector" ]
train
https://github.com/socialsensor/socialsensor-framework-client/blob/67cd45c5d8e096d5f76ace49f453ff6438920473/src/main/java/eu/socialsensor/framework/client/search/visual/VisualIndexHandler.java#L267-L308
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java
WebContainer.modified
@Modified protected void modified(Map<String, Object> cfg) { """ Called by DS when configuration is updated (post activation). @param cfg """ WebContainerConfiguration webconfig = new WebContainerConfiguration(DEFAULT_PORT); webconfig.setDefaultVirtualHostName(DEFAULT_VHOST_NAME); initialize(webconfig, cfg); }
java
@Modified protected void modified(Map<String, Object> cfg) { WebContainerConfiguration webconfig = new WebContainerConfiguration(DEFAULT_PORT); webconfig.setDefaultVirtualHostName(DEFAULT_VHOST_NAME); initialize(webconfig, cfg); }
[ "@", "Modified", "protected", "void", "modified", "(", "Map", "<", "String", ",", "Object", ">", "cfg", ")", "{", "WebContainerConfiguration", "webconfig", "=", "new", "WebContainerConfiguration", "(", "DEFAULT_PORT", ")", ";", "webconfig", ".", "setDefaultVirtual...
Called by DS when configuration is updated (post activation). @param cfg
[ "Called", "by", "DS", "when", "configuration", "is", "updated", "(", "post", "activation", ")", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/WebContainer.java#L424-L429
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java
RVRendererAdapter.onCreateViewHolder
@Override public RendererViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { """ One of the two main methods in this class. Creates a RendererViewHolder instance with a Renderer inside ready to be used. The RendererBuilder to create a RendererViewHolder using the information given as parameter. @param viewGroup used to create the ViewHolder. @param viewType associated to the renderer. @return ViewHolder extension with the Renderer it has to use inside. """ rendererBuilder.withParent(viewGroup); rendererBuilder.withLayoutInflater(LayoutInflater.from(viewGroup.getContext())); rendererBuilder.withViewType(viewType); RendererViewHolder viewHolder = rendererBuilder.buildRendererViewHolder(); if (viewHolder == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null viewHolder"); } return viewHolder; }
java
@Override public RendererViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { rendererBuilder.withParent(viewGroup); rendererBuilder.withLayoutInflater(LayoutInflater.from(viewGroup.getContext())); rendererBuilder.withViewType(viewType); RendererViewHolder viewHolder = rendererBuilder.buildRendererViewHolder(); if (viewHolder == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null viewHolder"); } return viewHolder; }
[ "@", "Override", "public", "RendererViewHolder", "onCreateViewHolder", "(", "ViewGroup", "viewGroup", ",", "int", "viewType", ")", "{", "rendererBuilder", ".", "withParent", "(", "viewGroup", ")", ";", "rendererBuilder", ".", "withLayoutInflater", "(", "LayoutInflater...
One of the two main methods in this class. Creates a RendererViewHolder instance with a Renderer inside ready to be used. The RendererBuilder to create a RendererViewHolder using the information given as parameter. @param viewGroup used to create the ViewHolder. @param viewType associated to the renderer. @return ViewHolder extension with the Renderer it has to use inside.
[ "One", "of", "the", "two", "main", "methods", "in", "this", "class", ".", "Creates", "a", "RendererViewHolder", "instance", "with", "a", "Renderer", "inside", "ready", "to", "be", "used", ".", "The", "RendererBuilder", "to", "create", "a", "RendererViewHolder"...
train
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java#L95-L104
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java
HttpTrailersImpl.setDeferredTrailer
public void setDeferredTrailer(HeaderKeys hdr, HttpTrailerGenerator htg) { """ Set a trailer based upon a not-yet established value. When the deferred trailer is set, it is the users responsibility to synchronize the deferred trailer list with the Trailer header field up front. For instance if one sets the deferred trailer HDR_CONTENT_LANGUAGE, then the trailer header in the head of the HTTP request/response should contain "Trailer:Content-Language" @param hdr the header to use. @param htg the object which will generate the value for this trailer dynamically. An <code>HttpTrailerGenerator</code> is called immediately after the 0-size chunk is sent, but before closing or recycling the connection. @throws IllegalArgumentException if any parameter is NULL or if the header represented is unsupported. """ if (tc.isDebugEnabled()) { Tr.debug(tc, "setDeferredTrailer(HeaderKeys): " + hdr); } if (null == hdr) { throw new IllegalArgumentException("Null header name"); } if (null == htg) { throw new IllegalArgumentException("Null value generator"); } this.knownTGs.put(hdr, htg); }
java
public void setDeferredTrailer(HeaderKeys hdr, HttpTrailerGenerator htg) { if (tc.isDebugEnabled()) { Tr.debug(tc, "setDeferredTrailer(HeaderKeys): " + hdr); } if (null == hdr) { throw new IllegalArgumentException("Null header name"); } if (null == htg) { throw new IllegalArgumentException("Null value generator"); } this.knownTGs.put(hdr, htg); }
[ "public", "void", "setDeferredTrailer", "(", "HeaderKeys", "hdr", ",", "HttpTrailerGenerator", "htg", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"setDeferredTrailer(HeaderKeys): \"", "+", "hdr", ...
Set a trailer based upon a not-yet established value. When the deferred trailer is set, it is the users responsibility to synchronize the deferred trailer list with the Trailer header field up front. For instance if one sets the deferred trailer HDR_CONTENT_LANGUAGE, then the trailer header in the head of the HTTP request/response should contain "Trailer:Content-Language" @param hdr the header to use. @param htg the object which will generate the value for this trailer dynamically. An <code>HttpTrailerGenerator</code> is called immediately after the 0-size chunk is sent, but before closing or recycling the connection. @throws IllegalArgumentException if any parameter is NULL or if the header represented is unsupported.
[ "Set", "a", "trailer", "based", "upon", "a", "not", "-", "yet", "established", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpTrailersImpl.java#L129-L141
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DateRangeDialog.java
DateRangeDialog.show
public static void show(Date startDefault, Date endDefault, IResponseCallback<DateRange> callback) { """ Displays the date range dialog. @param startDefault Default start date. @param endDefault Default end date. @param callback Callback for returning a date range reflecting the inputs from the dialog. This will be null if the input is cancelled or if an unexpected error occurs. """ show(new DateRange(startDefault, endDefault), callback); }
java
public static void show(Date startDefault, Date endDefault, IResponseCallback<DateRange> callback) { show(new DateRange(startDefault, endDefault), callback); }
[ "public", "static", "void", "show", "(", "Date", "startDefault", ",", "Date", "endDefault", ",", "IResponseCallback", "<", "DateRange", ">", "callback", ")", "{", "show", "(", "new", "DateRange", "(", "startDefault", ",", "endDefault", ")", ",", "callback", ...
Displays the date range dialog. @param startDefault Default start date. @param endDefault Default end date. @param callback Callback for returning a date range reflecting the inputs from the dialog. This will be null if the input is cancelled or if an unexpected error occurs.
[ "Displays", "the", "date", "range", "dialog", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DateRangeDialog.java#L67-L69
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/animation/transformation/Translation.java
Translation.to
public Translation to(float x, float y, float z) { """ Sets the target point of the {@link Translation}. @param x the x @param y the y @param z the z @return the translation """ toX = x; toY = y; toZ = z; return this; }
java
public Translation to(float x, float y, float z) { toX = x; toY = y; toZ = z; return this; }
[ "public", "Translation", "to", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "toX", "=", "x", ";", "toY", "=", "y", ";", "toZ", "=", "z", ";", "return", "this", ";", "}" ]
Sets the target point of the {@link Translation}. @param x the x @param y the y @param z the z @return the translation
[ "Sets", "the", "target", "point", "of", "the", "{", "@link", "Translation", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/Translation.java#L97-L103
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/io/scan/AnnotationClassReader.java
AnnotationClassReader.readUTF8
public String readUTF8(int index, final char[] buf) { """ Reads an UTF8 string constant pool item in {@link #b b}. <i>This method is intended for {@link Attribute} sub classes, and is normally not needed by class generators or adapters.</i> @param index the start index of an unsigned short value in {@link #b b}, whose value is the index of an UTF8 constant pool item. @param buf buffer to be used to read the item. This buffer must be sufficiently large. It is not automatically resized. @return the String corresponding to the specified UTF8 item. """ int item = readUnsignedShort(index); if (index == 0 || item == 0) { return null; } String s = strings[item]; if (s != null) { return s; } index = items[item]; strings[item] = readUTF(index + 2, readUnsignedShort(index), buf); return strings[item]; }
java
public String readUTF8(int index, final char[] buf) { int item = readUnsignedShort(index); if (index == 0 || item == 0) { return null; } String s = strings[item]; if (s != null) { return s; } index = items[item]; strings[item] = readUTF(index + 2, readUnsignedShort(index), buf); return strings[item]; }
[ "public", "String", "readUTF8", "(", "int", "index", ",", "final", "char", "[", "]", "buf", ")", "{", "int", "item", "=", "readUnsignedShort", "(", "index", ")", ";", "if", "(", "index", "==", "0", "||", "item", "==", "0", ")", "{", "return", "null...
Reads an UTF8 string constant pool item in {@link #b b}. <i>This method is intended for {@link Attribute} sub classes, and is normally not needed by class generators or adapters.</i> @param index the start index of an unsigned short value in {@link #b b}, whose value is the index of an UTF8 constant pool item. @param buf buffer to be used to read the item. This buffer must be sufficiently large. It is not automatically resized. @return the String corresponding to the specified UTF8 item.
[ "Reads", "an", "UTF8", "string", "constant", "pool", "item", "in", "{", "@link", "#b", "b", "}", ".", "<i", ">", "This", "method", "is", "intended", "for", "{", "@link", "Attribute", "}", "sub", "classes", "and", "is", "normally", "not", "needed", "by"...
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/io/scan/AnnotationClassReader.java#L899-L911
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/MjdbcLogger.java
MjdbcLogger.getLogger
public static MjdbcLogger getLogger(String name) { """ Creates new MjdbcLogger instance @param name class name @return MjdbcLogger instance """ MjdbcLogger mjdbcLogger = new MjdbcLogger(name, null); if (isSLF4jAvailable() == true) { try { mjdbcLogger = new MjdbcLogger(name, null); mjdbcLogger.setSlfLogger(MappingUtils.invokeStaticFunction(Class.forName("org.slf4j.LoggerFactory"), "getLogger", new Class[]{String.class}, new Object[]{name})); } catch (MjdbcException e) { setSLF4jAvailable(false); } catch (ClassNotFoundException e) { setSLF4jAvailable(false); } } return mjdbcLogger; }
java
public static MjdbcLogger getLogger(String name) { MjdbcLogger mjdbcLogger = new MjdbcLogger(name, null); if (isSLF4jAvailable() == true) { try { mjdbcLogger = new MjdbcLogger(name, null); mjdbcLogger.setSlfLogger(MappingUtils.invokeStaticFunction(Class.forName("org.slf4j.LoggerFactory"), "getLogger", new Class[]{String.class}, new Object[]{name})); } catch (MjdbcException e) { setSLF4jAvailable(false); } catch (ClassNotFoundException e) { setSLF4jAvailable(false); } } return mjdbcLogger; }
[ "public", "static", "MjdbcLogger", "getLogger", "(", "String", "name", ")", "{", "MjdbcLogger", "mjdbcLogger", "=", "new", "MjdbcLogger", "(", "name", ",", "null", ")", ";", "if", "(", "isSLF4jAvailable", "(", ")", "==", "true", ")", "{", "try", "{", "mj...
Creates new MjdbcLogger instance @param name class name @return MjdbcLogger instance
[ "Creates", "new", "MjdbcLogger", "instance" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/MjdbcLogger.java#L64-L79
Netflix/denominator
route53/src/main/java/denominator/route53/Route53ZoneApi.java
Route53ZoneApi.deleteEverythingExceptNSAndSOA
private void deleteEverythingExceptNSAndSOA(String id, String name) { """ Works through the zone, deleting each page of rrsets, except the zone's SOA and the NS rrsets. Once the zone is cleared, it can be deleted. <p/>Users can modify the zone's SOA and NS rrsets, but they cannot be deleted except via deleting the zone. """ List<ActionOnResourceRecordSet> deletes = new ArrayList<ActionOnResourceRecordSet>(); ResourceRecordSetList page = api.listResourceRecordSets(id); while (!page.isEmpty()) { for (ResourceRecordSet<?> rrset : page) { if (rrset.type().equals("SOA") || rrset.type().equals("NS") && rrset.name().equals(name)) { continue; } deletes.add(ActionOnResourceRecordSet.delete(rrset)); } if (!deletes.isEmpty()) { api.changeResourceRecordSets(id, deletes); } if (page.next == null) { page.clear(); } else { deletes.clear(); page = api.listResourceRecordSets(id, page.next.name, page.next.type, page.next.identifier); } } }
java
private void deleteEverythingExceptNSAndSOA(String id, String name) { List<ActionOnResourceRecordSet> deletes = new ArrayList<ActionOnResourceRecordSet>(); ResourceRecordSetList page = api.listResourceRecordSets(id); while (!page.isEmpty()) { for (ResourceRecordSet<?> rrset : page) { if (rrset.type().equals("SOA") || rrset.type().equals("NS") && rrset.name().equals(name)) { continue; } deletes.add(ActionOnResourceRecordSet.delete(rrset)); } if (!deletes.isEmpty()) { api.changeResourceRecordSets(id, deletes); } if (page.next == null) { page.clear(); } else { deletes.clear(); page = api.listResourceRecordSets(id, page.next.name, page.next.type, page.next.identifier); } } }
[ "private", "void", "deleteEverythingExceptNSAndSOA", "(", "String", "id", ",", "String", "name", ")", "{", "List", "<", "ActionOnResourceRecordSet", ">", "deletes", "=", "new", "ArrayList", "<", "ActionOnResourceRecordSet", ">", "(", ")", ";", "ResourceRecordSetList...
Works through the zone, deleting each page of rrsets, except the zone's SOA and the NS rrsets. Once the zone is cleared, it can be deleted. <p/>Users can modify the zone's SOA and NS rrsets, but they cannot be deleted except via deleting the zone.
[ "Works", "through", "the", "zone", "deleting", "each", "page", "of", "rrsets", "except", "the", "zone", "s", "SOA", "and", "the", "NS", "rrsets", ".", "Once", "the", "zone", "is", "cleared", "it", "can", "be", "deleted", "." ]
train
https://github.com/Netflix/denominator/blob/c565e3b8c6043051252e0947029511f9ac5d306f/route53/src/main/java/denominator/route53/Route53ZoneApi.java#L101-L121
forge/furnace
container-api/src/main/java/org/jboss/forge/furnace/util/Annotations.java
Annotations.getAnnotation
public static <A extends Annotation> A getAnnotation(final Annotation a, final Class<A> type) { """ Inspect annotation <b>a</b> for a specific <b>type</b> of annotation. This also discovers annotations defined through a @ {@link Stereotype}. @param m The method to inspect. @param type The targeted annotation class @return The annotation instance found on this method or enclosing class, or null if no matching annotation was found. """ Set<Annotation> seen = new HashSet<>(); return getAnnotation(seen, a, type); }
java
public static <A extends Annotation> A getAnnotation(final Annotation a, final Class<A> type) { Set<Annotation> seen = new HashSet<>(); return getAnnotation(seen, a, type); }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "A", "getAnnotation", "(", "final", "Annotation", "a", ",", "final", "Class", "<", "A", ">", "type", ")", "{", "Set", "<", "Annotation", ">", "seen", "=", "new", "HashSet", "<>", "(", ")", "...
Inspect annotation <b>a</b> for a specific <b>type</b> of annotation. This also discovers annotations defined through a @ {@link Stereotype}. @param m The method to inspect. @param type The targeted annotation class @return The annotation instance found on this method or enclosing class, or null if no matching annotation was found.
[ "Inspect", "annotation", "<b", ">", "a<", "/", "b", ">", "for", "a", "specific", "<b", ">", "type<", "/", "b", ">", "of", "annotation", ".", "This", "also", "discovers", "annotations", "defined", "through", "a", "@", "{", "@link", "Stereotype", "}", "....
train
https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/container-api/src/main/java/org/jboss/forge/furnace/util/Annotations.java#L131-L135
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/threading/Daemon.java
Daemon.startThread
public synchronized Thread startThread(String name) throws IllegalThreadStateException { """ Starts this daemon, creating a new thread for it @param name String The name for the thread @return Thread The daemon's thread @throws IllegalThreadStateException If the daemon is still running """ if (!running) { log.info("[Daemon] {startThread} Starting thread " + name); this.running = true; thisThread = new Thread(this, name); thisThread.setDaemon(shouldStartAsDaemon()); // Set whether we're a daemon thread (false by default) thisThread.start(); return thisThread; } else { throw new IllegalThreadStateException("Daemon must be stopped before it may be started"); } }
java
public synchronized Thread startThread(String name) throws IllegalThreadStateException { if (!running) { log.info("[Daemon] {startThread} Starting thread " + name); this.running = true; thisThread = new Thread(this, name); thisThread.setDaemon(shouldStartAsDaemon()); // Set whether we're a daemon thread (false by default) thisThread.start(); return thisThread; } else { throw new IllegalThreadStateException("Daemon must be stopped before it may be started"); } }
[ "public", "synchronized", "Thread", "startThread", "(", "String", "name", ")", "throws", "IllegalThreadStateException", "{", "if", "(", "!", "running", ")", "{", "log", ".", "info", "(", "\"[Daemon] {startThread} Starting thread \"", "+", "name", ")", ";", "this",...
Starts this daemon, creating a new thread for it @param name String The name for the thread @return Thread The daemon's thread @throws IllegalThreadStateException If the daemon is still running
[ "Starts", "this", "daemon", "creating", "a", "new", "thread", "for", "it" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/threading/Daemon.java#L75-L90
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java
IteratorExtensions.elementsEqual
public static boolean elementsEqual(Iterator<?> iterator, Iterable<?> iterable) { """ Determines whether two iterators contain equal elements in the same order. More specifically, this method returns {@code true} if {@code iterator} and {@code iterable} contain the same number of elements and every element of {@code iterator} is equal to the corresponding element of {@code iterable}. @param iterator an iterator. May not be <code>null</code>. @param iterable an iterable. May not be <code>null</code>. @return <code>true</code> if the two iterators contain equal elements in the same order. """ return Iterators.elementsEqual(iterator, iterable.iterator()); }
java
public static boolean elementsEqual(Iterator<?> iterator, Iterable<?> iterable) { return Iterators.elementsEqual(iterator, iterable.iterator()); }
[ "public", "static", "boolean", "elementsEqual", "(", "Iterator", "<", "?", ">", "iterator", ",", "Iterable", "<", "?", ">", "iterable", ")", "{", "return", "Iterators", ".", "elementsEqual", "(", "iterator", ",", "iterable", ".", "iterator", "(", ")", ")",...
Determines whether two iterators contain equal elements in the same order. More specifically, this method returns {@code true} if {@code iterator} and {@code iterable} contain the same number of elements and every element of {@code iterator} is equal to the corresponding element of {@code iterable}. @param iterator an iterator. May not be <code>null</code>. @param iterable an iterable. May not be <code>null</code>. @return <code>true</code> if the two iterators contain equal elements in the same order.
[ "Determines", "whether", "two", "iterators", "contain", "equal", "elements", "in", "the", "same", "order", ".", "More", "specifically", "this", "method", "returns", "{", "@code", "true", "}", "if", "{", "@code", "iterator", "}", "and", "{", "@code", "iterabl...
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java#L577-L579
srikalyc/Sql4D
Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/sql/MysqlAccessor.java
MysqlAccessor.execute
public boolean execute(Map<String, String> params, String query) { """ Suitable for CRUD operations where no result set is expected. @param params @param query @return """ final AtomicBoolean result = new AtomicBoolean(false); Tuple2<DataSource, Connection> conn = null; try { conn = getConnection(); NamedParameterJdbcTemplate jdbcTemplate = new NamedParameterJdbcTemplate(conn._1()); jdbcTemplate.execute(query, params, new PreparedStatementCallback<Void>() { @Override public Void doInPreparedStatement(PreparedStatement ps) { try { result.set(ps.execute()); } catch(SQLException e) { result.set(false); } return null; } }); } catch (Exception ex) { Logger.getLogger(MysqlAccessor.class.getName()).log(Level.SEVERE, null, ex); result.set(false); } finally { returnConnection(conn); } return result.get(); }
java
public boolean execute(Map<String, String> params, String query) { final AtomicBoolean result = new AtomicBoolean(false); Tuple2<DataSource, Connection> conn = null; try { conn = getConnection(); NamedParameterJdbcTemplate jdbcTemplate = new NamedParameterJdbcTemplate(conn._1()); jdbcTemplate.execute(query, params, new PreparedStatementCallback<Void>() { @Override public Void doInPreparedStatement(PreparedStatement ps) { try { result.set(ps.execute()); } catch(SQLException e) { result.set(false); } return null; } }); } catch (Exception ex) { Logger.getLogger(MysqlAccessor.class.getName()).log(Level.SEVERE, null, ex); result.set(false); } finally { returnConnection(conn); } return result.get(); }
[ "public", "boolean", "execute", "(", "Map", "<", "String", ",", "String", ">", "params", ",", "String", "query", ")", "{", "final", "AtomicBoolean", "result", "=", "new", "AtomicBoolean", "(", "false", ")", ";", "Tuple2", "<", "DataSource", ",", "Connectio...
Suitable for CRUD operations where no result set is expected. @param params @param query @return
[ "Suitable", "for", "CRUD", "operations", "where", "no", "result", "set", "is", "expected", "." ]
train
https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/sql/MysqlAccessor.java#L164-L188
qspin/qtaste
kernel/src/main/java/com/qspin/qtaste/ui/jedit/TextUtilities.java
TextUtilities.tabsToSpaces
public static String tabsToSpaces(String in, int tabSize) { """ Converts tabs to consecutive spaces in the specified string. @param in The string @param tabSize The tab size """ StringBuilder buf = new StringBuilder(); int width = 0; for (int i = 0; i < in.length(); i++) { switch (in.charAt(i)) { case '\t': int count = tabSize - (width % tabSize); width += count; while (--count >= 0) { buf.append(' '); } break; case '\n': width = 0; buf.append(in.charAt(i)); break; default: width++; buf.append(in.charAt(i)); break; } } return buf.toString(); }
java
public static String tabsToSpaces(String in, int tabSize) { StringBuilder buf = new StringBuilder(); int width = 0; for (int i = 0; i < in.length(); i++) { switch (in.charAt(i)) { case '\t': int count = tabSize - (width % tabSize); width += count; while (--count >= 0) { buf.append(' '); } break; case '\n': width = 0; buf.append(in.charAt(i)); break; default: width++; buf.append(in.charAt(i)); break; } } return buf.toString(); }
[ "public", "static", "String", "tabsToSpaces", "(", "String", "in", ",", "int", "tabSize", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "int", "width", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", ...
Converts tabs to consecutive spaces in the specified string. @param in The string @param tabSize The tab size
[ "Converts", "tabs", "to", "consecutive", "spaces", "in", "the", "specified", "string", "." ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/ui/jedit/TextUtilities.java#L239-L262
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.updatePublishStatus
public SheetPublish updatePublishStatus(long id, SheetPublish publish) throws SmartsheetException { """ Sets the publish status of a sheet and returns the new status, including the URLs of any enabled publishings. It mirrors to the following Smartsheet REST API method: PUT /sheet/{sheetId}/publish Exceptions: - IllegalArgumentException : if any argument is null - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ResourceNotFoundException : if the resource can not be found - ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) - SmartsheetRestException : if there is any other REST API related error occurred during the operation - SmartsheetException : if there is any other error occurred during the operation @param id the id @param publish the SheetPublish object limited to the following attributes * readOnlyLiteEnabled * readOnlyFullEnabled * readWriteEnabled * icalEnabled @return the updated SheetPublish (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception """ return this.updateResource("sheets/" + id + "/publish", SheetPublish.class, publish); }
java
public SheetPublish updatePublishStatus(long id, SheetPublish publish) throws SmartsheetException{ return this.updateResource("sheets/" + id + "/publish", SheetPublish.class, publish); }
[ "public", "SheetPublish", "updatePublishStatus", "(", "long", "id", ",", "SheetPublish", "publish", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "updateResource", "(", "\"sheets/\"", "+", "id", "+", "\"/publish\"", ",", "SheetPublish", ".", "c...
Sets the publish status of a sheet and returns the new status, including the URLs of any enabled publishings. It mirrors to the following Smartsheet REST API method: PUT /sheet/{sheetId}/publish Exceptions: - IllegalArgumentException : if any argument is null - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ResourceNotFoundException : if the resource can not be found - ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) - SmartsheetRestException : if there is any other REST API related error occurred during the operation - SmartsheetException : if there is any other error occurred during the operation @param id the id @param publish the SheetPublish object limited to the following attributes * readOnlyLiteEnabled * readOnlyFullEnabled * readWriteEnabled * icalEnabled @return the updated SheetPublish (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Sets", "the", "publish", "status", "of", "a", "sheet", "and", "returns", "the", "new", "status", "including", "the", "URLs", "of", "any", "enabled", "publishings", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L897-L899
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformpolicylabel_binding.java
transformpolicylabel_binding.get
public static transformpolicylabel_binding get(nitro_service service, String labelname) throws Exception { """ Use this API to fetch transformpolicylabel_binding resource of given name . """ transformpolicylabel_binding obj = new transformpolicylabel_binding(); obj.set_labelname(labelname); transformpolicylabel_binding response = (transformpolicylabel_binding) obj.get_resource(service); return response; }
java
public static transformpolicylabel_binding get(nitro_service service, String labelname) throws Exception{ transformpolicylabel_binding obj = new transformpolicylabel_binding(); obj.set_labelname(labelname); transformpolicylabel_binding response = (transformpolicylabel_binding) obj.get_resource(service); return response; }
[ "public", "static", "transformpolicylabel_binding", "get", "(", "nitro_service", "service", ",", "String", "labelname", ")", "throws", "Exception", "{", "transformpolicylabel_binding", "obj", "=", "new", "transformpolicylabel_binding", "(", ")", ";", "obj", ".", "set_...
Use this API to fetch transformpolicylabel_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "transformpolicylabel_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformpolicylabel_binding.java#L120-L125
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/DateTimesHelper.java
DateTimesHelper.toDateTime
public DateTime toDateTime(T dateTime) { """ Converts an API date time to a {@code DateTime} preserving the time zone. """ try { @SuppressWarnings("unchecked") // Expected class. D dateObj = (D) PropertyUtils.getProperty(dateTime, "date"); String timeZoneId = PropertyUtils.isReadable(dateTime, "timeZoneId") ? (String) PropertyUtils.getProperty(dateTime, "timeZoneId") : (String) PropertyUtils.getProperty(dateTime, "timeZoneID"); return new DateTime( (Integer) PropertyUtils.getProperty(dateObj, "year"), (Integer) PropertyUtils.getProperty(dateObj, "month"), (Integer) PropertyUtils.getProperty(dateObj, "day"), (Integer) PropertyUtils.getProperty(dateTime, "hour"), (Integer) PropertyUtils.getProperty(dateTime, "minute"), (Integer) PropertyUtils.getProperty(dateTime, "second"), 0, DateTimeZone.forTimeZone(TimeZone.getTimeZone(timeZoneId))); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not access class.", e); } catch (InvocationTargetException e) { throw new IllegalStateException("Could not get field.", e); } catch (NoSuchMethodException e) { throw new IllegalStateException("Could not get field.", e); } }
java
public DateTime toDateTime(T dateTime) { try { @SuppressWarnings("unchecked") // Expected class. D dateObj = (D) PropertyUtils.getProperty(dateTime, "date"); String timeZoneId = PropertyUtils.isReadable(dateTime, "timeZoneId") ? (String) PropertyUtils.getProperty(dateTime, "timeZoneId") : (String) PropertyUtils.getProperty(dateTime, "timeZoneID"); return new DateTime( (Integer) PropertyUtils.getProperty(dateObj, "year"), (Integer) PropertyUtils.getProperty(dateObj, "month"), (Integer) PropertyUtils.getProperty(dateObj, "day"), (Integer) PropertyUtils.getProperty(dateTime, "hour"), (Integer) PropertyUtils.getProperty(dateTime, "minute"), (Integer) PropertyUtils.getProperty(dateTime, "second"), 0, DateTimeZone.forTimeZone(TimeZone.getTimeZone(timeZoneId))); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not access class.", e); } catch (InvocationTargetException e) { throw new IllegalStateException("Could not get field.", e); } catch (NoSuchMethodException e) { throw new IllegalStateException("Could not get field.", e); } }
[ "public", "DateTime", "toDateTime", "(", "T", "dateTime", ")", "{", "try", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// Expected class.", "D", "dateObj", "=", "(", "D", ")", "PropertyUtils", ".", "getProperty", "(", "dateTime", ",", "\"date\"",...
Converts an API date time to a {@code DateTime} preserving the time zone.
[ "Converts", "an", "API", "date", "time", "to", "a", "{" ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/DateTimesHelper.java#L147-L171
cdapio/tephra
tephra-core/src/main/java/co/cask/tephra/util/TxUtils.java
TxUtils.getOldestVisibleTimestamp
public static long getOldestVisibleTimestamp(Map<byte[], Long> ttlByFamily, Transaction tx, boolean readNonTxnData) { """ Returns the oldest visible timestamp for the given transaction, based on the TTLs configured for each column family. If no TTL is set on any column family, the oldest visible timestamp will be {@code 0}. @param ttlByFamily A map of column family name to TTL value (in milliseconds) @param tx The current transaction @param readNonTxnData indicates that the timestamp returned should allow reading non-transactional data @return The oldest timestamp that will be visible for the given transaction and TTL configuration """ if (readNonTxnData) { long maxTTL = getMaxTTL(ttlByFamily); return maxTTL < Long.MAX_VALUE ? System.currentTimeMillis() - maxTTL : 0; } return getOldestVisibleTimestamp(ttlByFamily, tx); }
java
public static long getOldestVisibleTimestamp(Map<byte[], Long> ttlByFamily, Transaction tx, boolean readNonTxnData) { if (readNonTxnData) { long maxTTL = getMaxTTL(ttlByFamily); return maxTTL < Long.MAX_VALUE ? System.currentTimeMillis() - maxTTL : 0; } return getOldestVisibleTimestamp(ttlByFamily, tx); }
[ "public", "static", "long", "getOldestVisibleTimestamp", "(", "Map", "<", "byte", "[", "]", ",", "Long", ">", "ttlByFamily", ",", "Transaction", "tx", ",", "boolean", "readNonTxnData", ")", "{", "if", "(", "readNonTxnData", ")", "{", "long", "maxTTL", "=", ...
Returns the oldest visible timestamp for the given transaction, based on the TTLs configured for each column family. If no TTL is set on any column family, the oldest visible timestamp will be {@code 0}. @param ttlByFamily A map of column family name to TTL value (in milliseconds) @param tx The current transaction @param readNonTxnData indicates that the timestamp returned should allow reading non-transactional data @return The oldest timestamp that will be visible for the given transaction and TTL configuration
[ "Returns", "the", "oldest", "visible", "timestamp", "for", "the", "given", "transaction", "based", "on", "the", "TTLs", "configured", "for", "each", "column", "family", ".", "If", "no", "TTL", "is", "set", "on", "any", "column", "family", "the", "oldest", ...
train
https://github.com/cdapio/tephra/blob/082c56c15c6ece15002631ff6f89206a00d8915c/tephra-core/src/main/java/co/cask/tephra/util/TxUtils.java#L75-L82
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/vod/VodClient.java
VodClient.stopMediaResource
public StopMediaResourceResponse stopMediaResource(StopMediaResourceRequest request) { """ Stop the specific media resource managed by VOD service, so that it can not be access and played. Disabled media resource can be recovered by method <code>publishMediaResource()</code> later. <p> The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair. @param request The request object containing all the options on how to @return empty response will be returned """ checkStringNotEmpty(request.getMediaId(), "Media ID should not be null or empty!"); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, PATH_MEDIA, request.getMediaId()); internalRequest.addParameter(PARA_DISABLE, null); return invokeHttpClient(internalRequest, StopMediaResourceResponse.class); }
java
public StopMediaResourceResponse stopMediaResource(StopMediaResourceRequest request) { checkStringNotEmpty(request.getMediaId(), "Media ID should not be null or empty!"); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, PATH_MEDIA, request.getMediaId()); internalRequest.addParameter(PARA_DISABLE, null); return invokeHttpClient(internalRequest, StopMediaResourceResponse.class); }
[ "public", "StopMediaResourceResponse", "stopMediaResource", "(", "StopMediaResourceRequest", "request", ")", "{", "checkStringNotEmpty", "(", "request", ".", "getMediaId", "(", ")", ",", "\"Media ID should not be null or empty!\"", ")", ";", "InternalRequest", "internalReques...
Stop the specific media resource managed by VOD service, so that it can not be access and played. Disabled media resource can be recovered by method <code>publishMediaResource()</code> later. <p> The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair. @param request The request object containing all the options on how to @return empty response will be returned
[ "Stop", "the", "specific", "media", "resource", "managed", "by", "VOD", "service", "so", "that", "it", "can", "not", "be", "access", "and", "played", ".", "Disabled", "media", "resource", "can", "be", "recovered", "by", "method", "<code", ">", "publishMediaR...
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L680-L687
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_sshkey_keyId_GET
public OvhSshKeyDetail project_serviceName_sshkey_keyId_GET(String serviceName, String keyId) throws IOException { """ Get SSH key REST: GET /cloud/project/{serviceName}/sshkey/{keyId} @param keyId [required] SSH key id @param serviceName [required] Project name """ String qPath = "/cloud/project/{serviceName}/sshkey/{keyId}"; StringBuilder sb = path(qPath, serviceName, keyId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSshKeyDetail.class); }
java
public OvhSshKeyDetail project_serviceName_sshkey_keyId_GET(String serviceName, String keyId) throws IOException { String qPath = "/cloud/project/{serviceName}/sshkey/{keyId}"; StringBuilder sb = path(qPath, serviceName, keyId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSshKeyDetail.class); }
[ "public", "OvhSshKeyDetail", "project_serviceName_sshkey_keyId_GET", "(", "String", "serviceName", ",", "String", "keyId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/sshkey/{keyId}\"", ";", "StringBuilder", "sb", "=", "path", ...
Get SSH key REST: GET /cloud/project/{serviceName}/sshkey/{keyId} @param keyId [required] SSH key id @param serviceName [required] Project name
[ "Get", "SSH", "key" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1526-L1531
alkacon/opencms-core
src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
CmsDefaultXmlContentHandler.addSearchSetting
protected void addSearchSetting(CmsXmlContentDefinition contentDefinition, String elementName, Boolean value) throws CmsXmlException { """ Adds a search setting for an element.<p> @param contentDefinition the XML content definition this XML content handler belongs to @param elementName the element name to map @param value the search setting value to store @throws CmsXmlException in case an unknown element name is used """ if (contentDefinition.getSchemaType(elementName) == null) { throw new CmsXmlException( Messages.get().container(Messages.ERR_XMLCONTENT_INVALID_ELEM_SEARCHSETTINGS_1, elementName)); } // store the search exclusion as defined m_searchSettings.put(elementName, value); }
java
protected void addSearchSetting(CmsXmlContentDefinition contentDefinition, String elementName, Boolean value) throws CmsXmlException { if (contentDefinition.getSchemaType(elementName) == null) { throw new CmsXmlException( Messages.get().container(Messages.ERR_XMLCONTENT_INVALID_ELEM_SEARCHSETTINGS_1, elementName)); } // store the search exclusion as defined m_searchSettings.put(elementName, value); }
[ "protected", "void", "addSearchSetting", "(", "CmsXmlContentDefinition", "contentDefinition", ",", "String", "elementName", ",", "Boolean", "value", ")", "throws", "CmsXmlException", "{", "if", "(", "contentDefinition", ".", "getSchemaType", "(", "elementName", ")", "...
Adds a search setting for an element.<p> @param contentDefinition the XML content definition this XML content handler belongs to @param elementName the element name to map @param value the search setting value to store @throws CmsXmlException in case an unknown element name is used
[ "Adds", "a", "search", "setting", "for", "an", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L2101-L2110
knowm/Datasets
datasets-hja-birdsong/src/main/java/com/musicg/wave/SpectrogramRender.java
SpectrogramRender.saveSpectrogram
public void saveSpectrogram(Spectrogram spectrogram, String filename) throws IOException { """ Render a spectrogram of a wave file @param spectrogram spectrogram object @param filename output file @throws IOException @see RGB graphic rendered """ BufferedImage bufferedImage = renderSpectrogram(spectrogram); saveSpectrogram(bufferedImage, filename); }
java
public void saveSpectrogram(Spectrogram spectrogram, String filename) throws IOException { BufferedImage bufferedImage = renderSpectrogram(spectrogram); saveSpectrogram(bufferedImage, filename); }
[ "public", "void", "saveSpectrogram", "(", "Spectrogram", "spectrogram", ",", "String", "filename", ")", "throws", "IOException", "{", "BufferedImage", "bufferedImage", "=", "renderSpectrogram", "(", "spectrogram", ")", ";", "saveSpectrogram", "(", "bufferedImage", ","...
Render a spectrogram of a wave file @param spectrogram spectrogram object @param filename output file @throws IOException @see RGB graphic rendered
[ "Render", "a", "spectrogram", "of", "a", "wave", "file" ]
train
https://github.com/knowm/Datasets/blob/4ea16ccda1d4190a551accff78bbbe05c9c38c79/datasets-hja-birdsong/src/main/java/com/musicg/wave/SpectrogramRender.java#L67-L71
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/ExceptionUtils.java
ExceptionUtils.toShortString
public static String toShortString(Throwable e, int stackLevel) { """ 返回消息+简短堆栈信息(e.printStackTrace()的内容) @param e Throwable @param stackLevel 堆栈层级 @return 异常堆栈信息 """ StackTraceElement[] traces = e.getStackTrace(); StringBuilder sb = new StringBuilder(1024); sb.append(e.toString()).append("\t"); if (traces != null) { for (int i = 0; i < traces.length; i++) { if (i < stackLevel) { sb.append("\tat ").append(traces[i]).append("\t"); } else { break; } } } return sb.toString(); }
java
public static String toShortString(Throwable e, int stackLevel) { StackTraceElement[] traces = e.getStackTrace(); StringBuilder sb = new StringBuilder(1024); sb.append(e.toString()).append("\t"); if (traces != null) { for (int i = 0; i < traces.length; i++) { if (i < stackLevel) { sb.append("\tat ").append(traces[i]).append("\t"); } else { break; } } } return sb.toString(); }
[ "public", "static", "String", "toShortString", "(", "Throwable", "e", ",", "int", "stackLevel", ")", "{", "StackTraceElement", "[", "]", "traces", "=", "e", ".", "getStackTrace", "(", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "1024",...
返回消息+简短堆栈信息(e.printStackTrace()的内容) @param e Throwable @param stackLevel 堆栈层级 @return 异常堆栈信息
[ "返回消息", "+", "简短堆栈信息(e", ".", "printStackTrace", "()", "的内容)" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/ExceptionUtils.java#L74-L88
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
StructuredQueryBuilder.geoElementPair
public GeospatialIndex geoElementPair(Element parent, Element lat, Element lon) { """ Identifies a parent element with child latitude and longitude elements to match with a geospatial query. @param parent the parent of the element with the coordinates @param lat the element with the latitude coordinate @param lon the element with the longitude coordinate @return the specification for the index on the geospatial coordinates """ return new GeoElementPairImpl(parent, lat, lon); }
java
public GeospatialIndex geoElementPair(Element parent, Element lat, Element lon) { return new GeoElementPairImpl(parent, lat, lon); }
[ "public", "GeospatialIndex", "geoElementPair", "(", "Element", "parent", ",", "Element", "lat", ",", "Element", "lon", ")", "{", "return", "new", "GeoElementPairImpl", "(", "parent", ",", "lat", ",", "lon", ")", ";", "}" ]
Identifies a parent element with child latitude and longitude elements to match with a geospatial query. @param parent the parent of the element with the coordinates @param lat the element with the latitude coordinate @param lon the element with the longitude coordinate @return the specification for the index on the geospatial coordinates
[ "Identifies", "a", "parent", "element", "with", "child", "latitude", "and", "longitude", "elements", "to", "match", "with", "a", "geospatial", "query", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L890-L892
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/collections/ImmutableMultitable.java
ImmutableMultitable.removeAll
@Deprecated @Override public boolean removeAll(@Nullable final Object rowKey, @Nullable final Object columnKey) { """ Guaranteed to throw an exception and leave the table unmodified. @throws UnsupportedOperationException always @deprecated Unsupported operation. """ throw new UnsupportedOperationException(); }
java
@Deprecated @Override public boolean removeAll(@Nullable final Object rowKey, @Nullable final Object columnKey) { throw new UnsupportedOperationException(); }
[ "@", "Deprecated", "@", "Override", "public", "boolean", "removeAll", "(", "@", "Nullable", "final", "Object", "rowKey", ",", "@", "Nullable", "final", "Object", "columnKey", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}" ]
Guaranteed to throw an exception and leave the table unmodified. @throws UnsupportedOperationException always @deprecated Unsupported operation.
[ "Guaranteed", "to", "throw", "an", "exception", "and", "leave", "the", "table", "unmodified", "." ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/ImmutableMultitable.java#L166-L170
google/closure-compiler
src/com/google/javascript/jscomp/TypedScopeCreator.java
TypedScopeCreator.setDeferredType
void setDeferredType(Node node, JSType type) { """ Set the type for a node now, and enqueue it to be updated with a resolved type later. """ // Other parts of this pass may read the not-yet-resolved type off the node. // (like when we set the LHS of an assign with a typed RHS function.) node.setJSType(type); deferredSetTypes.add(new DeferredSetType(node, type)); }
java
void setDeferredType(Node node, JSType type) { // Other parts of this pass may read the not-yet-resolved type off the node. // (like when we set the LHS of an assign with a typed RHS function.) node.setJSType(type); deferredSetTypes.add(new DeferredSetType(node, type)); }
[ "void", "setDeferredType", "(", "Node", "node", ",", "JSType", "type", ")", "{", "// Other parts of this pass may read the not-yet-resolved type off the node.", "// (like when we set the LHS of an assign with a typed RHS function.)", "node", ".", "setJSType", "(", "type", ")", ";...
Set the type for a node now, and enqueue it to be updated with a resolved type later.
[ "Set", "the", "type", "for", "a", "node", "now", "and", "enqueue", "it", "to", "be", "updated", "with", "a", "resolved", "type", "later", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypedScopeCreator.java#L656-L661
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/context/ExternalContext.java
ExternalContext.setResponseHeader
public void setResponseHeader(String name, String value) { """ <p class="changed_added_2_0">Set the response header with the given name and value.</p> <p><em>Servlet:</em>This must be performed by calling the <code>javax.servlet.http.HttpServletResponse</code> <code>setHeader</code> method.</p> <p>The default implementation throws <code>UnsupportedOperationException</code> and is provided for the sole purpose of not breaking existing applications that extend this class.</p> @param name The name of the response header. @param value The value of the response header. @since 2.0 """ if (defaultExternalContext != null) { defaultExternalContext.setResponseHeader(name, value); } else { throw new UnsupportedOperationException(); } }
java
public void setResponseHeader(String name, String value) { if (defaultExternalContext != null) { defaultExternalContext.setResponseHeader(name, value); } else { throw new UnsupportedOperationException(); } }
[ "public", "void", "setResponseHeader", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "defaultExternalContext", "!=", "null", ")", "{", "defaultExternalContext", ".", "setResponseHeader", "(", "name", ",", "value", ")", ";", "}", "else", ...
<p class="changed_added_2_0">Set the response header with the given name and value.</p> <p><em>Servlet:</em>This must be performed by calling the <code>javax.servlet.http.HttpServletResponse</code> <code>setHeader</code> method.</p> <p>The default implementation throws <code>UnsupportedOperationException</code> and is provided for the sole purpose of not breaking existing applications that extend this class.</p> @param name The name of the response header. @param value The value of the response header. @since 2.0
[ "<p", "class", "=", "changed_added_2_0", ">", "Set", "the", "response", "header", "with", "the", "given", "name", "and", "value", ".", "<", "/", "p", ">" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/context/ExternalContext.java#L1663-L1671
jasminb/jsonapi-converter
src/main/java/com/github/jasminb/jsonapi/ValidationUtils.java
ValidationUtils.ensureNotError
public static void ensureNotError(ObjectMapper mapper, JsonNode resourceNode) { """ Ensures that provided node does not hold 'errors' attribute. @param resourceNode resource node @throws ResourceParseException """ if (resourceNode != null && resourceNode.hasNonNull(JSONAPISpecConstants.ERRORS)) { try { throw new ResourceParseException(ErrorUtils.parseError(mapper, resourceNode, Errors.class)); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }
java
public static void ensureNotError(ObjectMapper mapper, JsonNode resourceNode) { if (resourceNode != null && resourceNode.hasNonNull(JSONAPISpecConstants.ERRORS)) { try { throw new ResourceParseException(ErrorUtils.parseError(mapper, resourceNode, Errors.class)); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }
[ "public", "static", "void", "ensureNotError", "(", "ObjectMapper", "mapper", ",", "JsonNode", "resourceNode", ")", "{", "if", "(", "resourceNode", "!=", "null", "&&", "resourceNode", ".", "hasNonNull", "(", "JSONAPISpecConstants", ".", "ERRORS", ")", ")", "{", ...
Ensures that provided node does not hold 'errors' attribute. @param resourceNode resource node @throws ResourceParseException
[ "Ensures", "that", "provided", "node", "does", "not", "hold", "errors", "attribute", "." ]
train
https://github.com/jasminb/jsonapi-converter/blob/73b41c3b9274e70e62b3425071ca8afdc7bddaf6/src/main/java/com/github/jasminb/jsonapi/ValidationUtils.java#L46-L54
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java
EncodingUtils.verifyJwsSignature
@SneakyThrows public static byte[] verifyJwsSignature(final Key signingKey, final byte[] value) { """ Verify jws signature byte [ ]. @param value the value @param signingKey the signing key @return the byte [ ] """ val asString = new String(value, StandardCharsets.UTF_8); return verifyJwsSignature(signingKey, asString); }
java
@SneakyThrows public static byte[] verifyJwsSignature(final Key signingKey, final byte[] value) { val asString = new String(value, StandardCharsets.UTF_8); return verifyJwsSignature(signingKey, asString); }
[ "@", "SneakyThrows", "public", "static", "byte", "[", "]", "verifyJwsSignature", "(", "final", "Key", "signingKey", ",", "final", "byte", "[", "]", "value", ")", "{", "val", "asString", "=", "new", "String", "(", "value", ",", "StandardCharsets", ".", "UTF...
Verify jws signature byte [ ]. @param value the value @param signingKey the signing key @return the byte [ ]
[ "Verify", "jws", "signature", "byte", "[", "]", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java#L296-L300
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java
UtilMath.getDistance
public static double getDistance(double x1, double y1, double x2, double y2, int w2, int h2) { """ Get distance from point to area. @param x1 The first area x. @param y1 The first area y. @param x2 The second area x. @param y2 The second area y. @param w2 The second area width. @param h2 The second area height. @return The distance between them. """ final double maxX = x2 + w2; final double maxY = y2 + h2; double min = getDistance(x1, y1, x2, y2); for (double x = x2; Double.compare(x, maxX) <= 0; x++) { for (double y = y2; Double.compare(y, maxY) <= 0; y++) { final double dist = getDistance(x1, y1, x, y); if (dist < min) { min = dist; } } } return min; }
java
public static double getDistance(double x1, double y1, double x2, double y2, int w2, int h2) { final double maxX = x2 + w2; final double maxY = y2 + h2; double min = getDistance(x1, y1, x2, y2); for (double x = x2; Double.compare(x, maxX) <= 0; x++) { for (double y = y2; Double.compare(y, maxY) <= 0; y++) { final double dist = getDistance(x1, y1, x, y); if (dist < min) { min = dist; } } } return min; }
[ "public", "static", "double", "getDistance", "(", "double", "x1", ",", "double", "y1", ",", "double", "x2", ",", "double", "y2", ",", "int", "w2", ",", "int", "h2", ")", "{", "final", "double", "maxX", "=", "x2", "+", "w2", ";", "final", "double", ...
Get distance from point to area. @param x1 The first area x. @param y1 The first area y. @param x2 The second area x. @param y2 The second area y. @param w2 The second area width. @param h2 The second area height. @return The distance between them.
[ "Get", "distance", "from", "point", "to", "area", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java#L214-L232
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.mockStaticPartial
public static synchronized void mockStaticPartial(Class<?> clazz, String... methodNames) { """ A utility method that may be used to mock several <b>static</b> methods in an easy way (by just passing in the method names of the method you wish to mock). Note that you cannot uniquely specify a method to mock using this method if there are several methods with the same name in {@code type}. This method will mock ALL methods that match the supplied name regardless of parameter types and signature. If this is the case you should fall-back on using the {@link #mockStatic(Class, Method...)} method instead. @param clazz The class that contains the static methods that should be mocked. @param methodNames The names of the methods that should be mocked. If {@code null}, then this method will have the same effect as just calling {@link #mockStatic(Class, Method...)} with the second parameter as {@code new Method[0]} (i.e. all methods in that class will be mocked). """ mockStatic(clazz, Whitebox.getMethods(clazz, methodNames)); }
java
public static synchronized void mockStaticPartial(Class<?> clazz, String... methodNames) { mockStatic(clazz, Whitebox.getMethods(clazz, methodNames)); }
[ "public", "static", "synchronized", "void", "mockStaticPartial", "(", "Class", "<", "?", ">", "clazz", ",", "String", "...", "methodNames", ")", "{", "mockStatic", "(", "clazz", ",", "Whitebox", ".", "getMethods", "(", "clazz", ",", "methodNames", ")", ")", ...
A utility method that may be used to mock several <b>static</b> methods in an easy way (by just passing in the method names of the method you wish to mock). Note that you cannot uniquely specify a method to mock using this method if there are several methods with the same name in {@code type}. This method will mock ALL methods that match the supplied name regardless of parameter types and signature. If this is the case you should fall-back on using the {@link #mockStatic(Class, Method...)} method instead. @param clazz The class that contains the static methods that should be mocked. @param methodNames The names of the methods that should be mocked. If {@code null}, then this method will have the same effect as just calling {@link #mockStatic(Class, Method...)} with the second parameter as {@code new Method[0]} (i.e. all methods in that class will be mocked).
[ "A", "utility", "method", "that", "may", "be", "used", "to", "mock", "several", "<b", ">", "static<", "/", "b", ">", "methods", "in", "an", "easy", "way", "(", "by", "just", "passing", "in", "the", "method", "names", "of", "the", "method", "you", "wi...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L569-L571
hal/core
gui/src/main/java/org/jboss/as/console/client/v3/dmr/AddressTemplate.java
AddressTemplate.replaceWildcards
public AddressTemplate replaceWildcards(String wildcard, String... wildcards) { """ Replaces one or more wildcards with the specified values starting from left to right and returns a new address template. <p/> This method does <em>not</em> resolve the address template. The returned template is still unresolved. @param wildcard the first wildcard (mandatory) @param wildcards more wildcards (optional) @return a new (still unresolved) address template with the wildcards replaced by the specified values. """ List<String> allWildcards = new ArrayList<>(); allWildcards.add(wildcard); if (wildcards != null) { allWildcards.addAll(Arrays.asList(wildcards)); } LinkedList<Token> replacedTokens = new LinkedList<>(); Iterator<String> wi = allWildcards.iterator(); for (Token token : tokens) { if (wi.hasNext() && token.hasKey() && "*".equals(token.getValue())) { replacedTokens.add(new Token(token.getKey(), wi.next())); } else { replacedTokens.add(new Token(token.key, token.value)); } } return AddressTemplate.of(join(this.optional, replacedTokens)); }
java
public AddressTemplate replaceWildcards(String wildcard, String... wildcards) { List<String> allWildcards = new ArrayList<>(); allWildcards.add(wildcard); if (wildcards != null) { allWildcards.addAll(Arrays.asList(wildcards)); } LinkedList<Token> replacedTokens = new LinkedList<>(); Iterator<String> wi = allWildcards.iterator(); for (Token token : tokens) { if (wi.hasNext() && token.hasKey() && "*".equals(token.getValue())) { replacedTokens.add(new Token(token.getKey(), wi.next())); } else { replacedTokens.add(new Token(token.key, token.value)); } } return AddressTemplate.of(join(this.optional, replacedTokens)); }
[ "public", "AddressTemplate", "replaceWildcards", "(", "String", "wildcard", ",", "String", "...", "wildcards", ")", "{", "List", "<", "String", ">", "allWildcards", "=", "new", "ArrayList", "<>", "(", ")", ";", "allWildcards", ".", "add", "(", "wildcard", ")...
Replaces one or more wildcards with the specified values starting from left to right and returns a new address template. <p/> This method does <em>not</em> resolve the address template. The returned template is still unresolved. @param wildcard the first wildcard (mandatory) @param wildcards more wildcards (optional) @return a new (still unresolved) address template with the wildcards replaced by the specified values.
[ "Replaces", "one", "or", "more", "wildcards", "with", "the", "specified", "values", "starting", "from", "left", "to", "right", "and", "returns", "a", "new", "address", "template", ".", "<p", "/", ">", "This", "method", "does", "<em", ">", "not<", "/", "e...
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/v3/dmr/AddressTemplate.java#L178-L195
pmlopes/yoke
framework/src/main/java/com/jetdrone/vertx/yoke/MimeType.java
MimeType.getCharset
public static String getCharset(@NotNull String mime, String fallback) { """ Gets the default charset for a file. for now all mime types that start with text returns UTF-8 otherwise the fallback. @param mime the mime type to query @param fallback if not found returns fallback @return charset string """ // TODO: exceptions json and which other should also be marked as text if (mime.startsWith("text")) { return defaultContentEncoding; } return fallback; }
java
public static String getCharset(@NotNull String mime, String fallback) { // TODO: exceptions json and which other should also be marked as text if (mime.startsWith("text")) { return defaultContentEncoding; } return fallback; }
[ "public", "static", "String", "getCharset", "(", "@", "NotNull", "String", "mime", ",", "String", "fallback", ")", "{", "// TODO: exceptions json and which other should also be marked as text", "if", "(", "mime", ".", "startsWith", "(", "\"text\"", ")", ")", "{", "r...
Gets the default charset for a file. for now all mime types that start with text returns UTF-8 otherwise the fallback. @param mime the mime type to query @param fallback if not found returns fallback @return charset string
[ "Gets", "the", "default", "charset", "for", "a", "file", ".", "for", "now", "all", "mime", "types", "that", "start", "with", "text", "returns", "UTF", "-", "8", "otherwise", "the", "fallback", "." ]
train
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/MimeType.java#L109-L116
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentFactory.java
CmsXmlContentFactory.createDocument
public static CmsXmlContent createDocument(CmsObject cms, Locale locale, CmsResourceTypeXmlContent resourceType) throws CmsXmlException { """ Creates a new XML content based on a resource type.<p> @param cms the current OpenCms context @param locale the locale to generate the default content for @param resourceType the resource type for which the document should be created @return the created XML content @throws CmsXmlException if something goes wrong """ String schema = resourceType.getSchema(); CmsXmlContentDefinition contentDefinition = CmsXmlContentDefinition.unmarshal(cms, schema); CmsXmlContent xmlContent = CmsXmlContentFactory.createDocument( cms, locale, OpenCms.getSystemInfo().getDefaultEncoding(), contentDefinition); return xmlContent; }
java
public static CmsXmlContent createDocument(CmsObject cms, Locale locale, CmsResourceTypeXmlContent resourceType) throws CmsXmlException { String schema = resourceType.getSchema(); CmsXmlContentDefinition contentDefinition = CmsXmlContentDefinition.unmarshal(cms, schema); CmsXmlContent xmlContent = CmsXmlContentFactory.createDocument( cms, locale, OpenCms.getSystemInfo().getDefaultEncoding(), contentDefinition); return xmlContent; }
[ "public", "static", "CmsXmlContent", "createDocument", "(", "CmsObject", "cms", ",", "Locale", "locale", ",", "CmsResourceTypeXmlContent", "resourceType", ")", "throws", "CmsXmlException", "{", "String", "schema", "=", "resourceType", ".", "getSchema", "(", ")", ";"...
Creates a new XML content based on a resource type.<p> @param cms the current OpenCms context @param locale the locale to generate the default content for @param resourceType the resource type for which the document should be created @return the created XML content @throws CmsXmlException if something goes wrong
[ "Creates", "a", "new", "XML", "content", "based", "on", "a", "resource", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentFactory.java#L79-L90
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/util/Validate.java
Validate.notEmpty
public static void notEmpty(String string, String message) { """ <p>Validate that the specified argument string is neither <code>null</code> nor a length of zero (no characters); otherwise throwing an exception with the specified message. <pre>Validate.notEmpty(myString, "The string must not be empty");</pre> @param string the string to check @param message the exception message if invalid @throws IllegalArgumentException if the string is empty """ if (string == null || string.length() == 0) { throw new IllegalArgumentException(message); } }
java
public static void notEmpty(String string, String message) { if (string == null || string.length() == 0) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "notEmpty", "(", "String", "string", ",", "String", "message", ")", "{", "if", "(", "string", "==", "null", "||", "string", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "messag...
<p>Validate that the specified argument string is neither <code>null</code> nor a length of zero (no characters); otherwise throwing an exception with the specified message. <pre>Validate.notEmpty(myString, "The string must not be empty");</pre> @param string the string to check @param message the exception message if invalid @throws IllegalArgumentException if the string is empty
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "string", "is", "neither", "<code", ">", "null<", "/", "code", ">", "nor", "a", "length", "of", "zero", "(", "no", "characters", ")", ";", "otherwise", "throwing", "an", "exception", "with", ...
train
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/util/Validate.java#L319-L323
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
ValueFileIOHelper.writeValue
protected long writeValue(File file, ValueData value) throws IOException { """ Write value to a file. @param file File @param value ValueData @return size of wrote content @throws IOException if error occurs """ if (value.isByteArray()) { return writeByteArrayValue(file, value); } else { return writeStreamedValue(file, value); } }
java
protected long writeValue(File file, ValueData value) throws IOException { if (value.isByteArray()) { return writeByteArrayValue(file, value); } else { return writeStreamedValue(file, value); } }
[ "protected", "long", "writeValue", "(", "File", "file", ",", "ValueData", "value", ")", "throws", "IOException", "{", "if", "(", "value", ".", "isByteArray", "(", ")", ")", "{", "return", "writeByteArrayValue", "(", "file", ",", "value", ")", ";", "}", "...
Write value to a file. @param file File @param value ValueData @return size of wrote content @throws IOException if error occurs
[ "Write", "value", "to", "a", "file", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L71-L81
facebook/fresco
imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java
ImagePipeline.getDataSourceSupplier
public Supplier<DataSource<CloseableReference<CloseableImage>>> getDataSourceSupplier( final ImageRequest imageRequest, final Object callerContext, final ImageRequest.RequestLevel requestLevel) { """ Returns a DataSource supplier that will on get submit the request for execution and return a DataSource representing the pending results of the task. @param imageRequest the request to submit (what to execute). @param callerContext the caller context of the caller of data source supplier @param requestLevel which level to look down until for the image @return a DataSource representing pending results and completion of the request """ return new Supplier<DataSource<CloseableReference<CloseableImage>>>() { @Override public DataSource<CloseableReference<CloseableImage>> get() { return fetchDecodedImage(imageRequest, callerContext, requestLevel); } @Override public String toString() { return Objects.toStringHelper(this) .add("uri", imageRequest.getSourceUri()) .toString(); } }; }
java
public Supplier<DataSource<CloseableReference<CloseableImage>>> getDataSourceSupplier( final ImageRequest imageRequest, final Object callerContext, final ImageRequest.RequestLevel requestLevel) { return new Supplier<DataSource<CloseableReference<CloseableImage>>>() { @Override public DataSource<CloseableReference<CloseableImage>> get() { return fetchDecodedImage(imageRequest, callerContext, requestLevel); } @Override public String toString() { return Objects.toStringHelper(this) .add("uri", imageRequest.getSourceUri()) .toString(); } }; }
[ "public", "Supplier", "<", "DataSource", "<", "CloseableReference", "<", "CloseableImage", ">", ">", ">", "getDataSourceSupplier", "(", "final", "ImageRequest", "imageRequest", ",", "final", "Object", "callerContext", ",", "final", "ImageRequest", ".", "RequestLevel",...
Returns a DataSource supplier that will on get submit the request for execution and return a DataSource representing the pending results of the task. @param imageRequest the request to submit (what to execute). @param callerContext the caller context of the caller of data source supplier @param requestLevel which level to look down until for the image @return a DataSource representing pending results and completion of the request
[ "Returns", "a", "DataSource", "supplier", "that", "will", "on", "get", "submit", "the", "request", "for", "execution", "and", "return", "a", "DataSource", "representing", "the", "pending", "results", "of", "the", "task", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java#L115-L132
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.createEvaluateActionForExistingActionState
public Action createEvaluateActionForExistingActionState(final Flow flow, final String actionStateId, final String evaluateActionId) { """ Create evaluate action for action state action. @param flow the flow @param actionStateId the action state id @param evaluateActionId the evaluate action id @return the action """ val action = getState(flow, actionStateId, ActionState.class); val actions = action.getActionList().toArray(); Arrays.stream(actions).forEach(action.getActionList()::remove); val evaluateAction = createEvaluateAction(evaluateActionId); action.getActionList().add(evaluateAction); action.getActionList().addAll(actions); return evaluateAction; }
java
public Action createEvaluateActionForExistingActionState(final Flow flow, final String actionStateId, final String evaluateActionId) { val action = getState(flow, actionStateId, ActionState.class); val actions = action.getActionList().toArray(); Arrays.stream(actions).forEach(action.getActionList()::remove); val evaluateAction = createEvaluateAction(evaluateActionId); action.getActionList().add(evaluateAction); action.getActionList().addAll(actions); return evaluateAction; }
[ "public", "Action", "createEvaluateActionForExistingActionState", "(", "final", "Flow", "flow", ",", "final", "String", "actionStateId", ",", "final", "String", "evaluateActionId", ")", "{", "val", "action", "=", "getState", "(", "flow", ",", "actionStateId", ",", ...
Create evaluate action for action state action. @param flow the flow @param actionStateId the action state id @param evaluateActionId the evaluate action id @return the action
[ "Create", "evaluate", "action", "for", "action", "state", "action", "." ]
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#L694-L702
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.buildMethod
protected HttpUriRequest buildMethod(final String method, final String path, final Map<String, Object> params) { """ Helper method that builds the request to the server. @param method the method. @param path the path. @param params the parameters. @return the request. """ if (StringUtils.equalsIgnoreCase(method, HttpGet.METHOD_NAME)) { return generateGetRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpPost.METHOD_NAME)) { return generatePostRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpPut.METHOD_NAME)) { return generatePutRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpDelete.METHOD_NAME)) { return generateDeleteRequest(path); } else { throw new RuntimeException("Must not be here."); } }
java
protected HttpUriRequest buildMethod(final String method, final String path, final Map<String, Object> params) { if (StringUtils.equalsIgnoreCase(method, HttpGet.METHOD_NAME)) { return generateGetRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpPost.METHOD_NAME)) { return generatePostRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpPut.METHOD_NAME)) { return generatePutRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpDelete.METHOD_NAME)) { return generateDeleteRequest(path); } else { throw new RuntimeException("Must not be here."); } }
[ "protected", "HttpUriRequest", "buildMethod", "(", "final", "String", "method", ",", "final", "String", "path", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "{", "if", "(", "StringUtils", ".", "equalsIgnoreCase", "(", "method", ",",...
Helper method that builds the request to the server. @param method the method. @param path the path. @param params the parameters. @return the request.
[ "Helper", "method", "that", "builds", "the", "request", "to", "the", "server", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L571-L583
gallandarakhneorg/afc
core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d2/Transform2D.java
Transform2D.getScaleRotate2x2
@SuppressWarnings("checkstyle:magicnumber") protected void getScaleRotate2x2(double[] scales, double[] rots) { """ Perform SVD on the 2x2 matrix containing the rotation and scaling factors. @param scales the scaling factors. @param rots the rotation factors. """ final double[] tmp = new double[9]; tmp[0] = this.m00; tmp[1] = this.m01; tmp[2] = 0; tmp[3] = this.m10; tmp[4] = this.m11; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0; tmp[8] = 0; computeSVD(tmp, scales, rots); }
java
@SuppressWarnings("checkstyle:magicnumber") protected void getScaleRotate2x2(double[] scales, double[] rots) { final double[] tmp = new double[9]; tmp[0] = this.m00; tmp[1] = this.m01; tmp[2] = 0; tmp[3] = this.m10; tmp[4] = this.m11; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0; tmp[8] = 0; computeSVD(tmp, scales, rots); }
[ "@", "SuppressWarnings", "(", "\"checkstyle:magicnumber\"", ")", "protected", "void", "getScaleRotate2x2", "(", "double", "[", "]", "scales", ",", "double", "[", "]", "rots", ")", "{", "final", "double", "[", "]", "tmp", "=", "new", "double", "[", "9", "]"...
Perform SVD on the 2x2 matrix containing the rotation and scaling factors. @param scales the scaling factors. @param rots the rotation factors.
[ "Perform", "SVD", "on", "the", "2x2", "matrix", "containing", "the", "rotation", "and", "scaling", "factors", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d2/Transform2D.java#L287-L304
jhunters/jprotobuf
v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java
CodedConstant.getFiledType
public static String getFiledType(FieldType type, boolean isList) { """ Gets the filed type. @param type the type @param isList the is list @return the filed type """ if ((type == FieldType.STRING || type == FieldType.BYTES) && !isList) { return "com.google.protobuf.ByteString"; } // add null check String defineType = type.getJavaType(); if (isList) { defineType = "List"; } return defineType; }
java
public static String getFiledType(FieldType type, boolean isList) { if ((type == FieldType.STRING || type == FieldType.BYTES) && !isList) { return "com.google.protobuf.ByteString"; } // add null check String defineType = type.getJavaType(); if (isList) { defineType = "List"; } return defineType; }
[ "public", "static", "String", "getFiledType", "(", "FieldType", "type", ",", "boolean", "isList", ")", "{", "if", "(", "(", "type", "==", "FieldType", ".", "STRING", "||", "type", "==", "FieldType", ".", "BYTES", ")", "&&", "!", "isList", ")", "{", "re...
Gets the filed type. @param type the type @param isList the is list @return the filed type
[ "Gets", "the", "filed", "type", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L179-L192
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IntegerExtensions.java
IntegerExtensions.operator_tripleGreaterThan
@Pure @Inline(value="($1 >>> $2)", constantExpression=true) public static int operator_tripleGreaterThan(int a, int distance) { """ The binary <code>unsigned right shift</code> operator. This is the equivalent to the java <code>&gt;&gt;&gt;</code> operator. Shifts in zeros into as leftmost bits, thus always yielding a positive integer. @param a an integer. @param distance the number of times to shift. @return <code>a&gt;&gt;&gt;distance</code> @since 2.3 """ return a >>> distance; }
java
@Pure @Inline(value="($1 >>> $2)", constantExpression=true) public static int operator_tripleGreaterThan(int a, int distance) { return a >>> distance; }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"($1 >>> $2)\"", ",", "constantExpression", "=", "true", ")", "public", "static", "int", "operator_tripleGreaterThan", "(", "int", "a", ",", "int", "distance", ")", "{", "return", "a", ">>>", "distance", ";", ...
The binary <code>unsigned right shift</code> operator. This is the equivalent to the java <code>&gt;&gt;&gt;</code> operator. Shifts in zeros into as leftmost bits, thus always yielding a positive integer. @param a an integer. @param distance the number of times to shift. @return <code>a&gt;&gt;&gt;distance</code> @since 2.3
[ "The", "binary", "<code", ">", "unsigned", "right", "shift<", "/", "code", ">", "operator", ".", "This", "is", "the", "equivalent", "to", "the", "java", "<code", ">", "&gt", ";", "&gt", ";", "&gt", ";", "<", "/", "code", ">", "operator", ".", "Shifts...
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IntegerExtensions.java#L224-L228
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/systemunderdevelopment/DefaultSystemUnderDevelopment.java
DefaultSystemUnderDevelopment.loadType
protected Type<?> loadType( String name ) { """ <p>loadType.</p> @param name a {@link java.lang.String} object. @return a {@link com.greenpepper.reflect.Type} object. """ Type<?> type = typeLoader.loadType( name ); if (type == null) throw new TypeNotFoundException( name , this.getClass()); return type; }
java
protected Type<?> loadType( String name ) { Type<?> type = typeLoader.loadType( name ); if (type == null) throw new TypeNotFoundException( name , this.getClass()); return type; }
[ "protected", "Type", "<", "?", ">", "loadType", "(", "String", "name", ")", "{", "Type", "<", "?", ">", "type", "=", "typeLoader", ".", "loadType", "(", "name", ")", ";", "if", "(", "type", "==", "null", ")", "throw", "new", "TypeNotFoundException", ...
<p>loadType.</p> @param name a {@link java.lang.String} object. @return a {@link com.greenpepper.reflect.Type} object.
[ "<p", ">", "loadType", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/systemunderdevelopment/DefaultSystemUnderDevelopment.java#L90-L95
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java
VirtualHubsInner.createOrUpdateAsync
public Observable<VirtualHubInner> createOrUpdateAsync(String resourceGroupName, String virtualHubName, VirtualHubInner virtualHubParameters) { """ Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. @param resourceGroupName The resource group name of the VirtualHub. @param virtualHubName The name of the VirtualHub. @param virtualHubParameters Parameters supplied to create or update VirtualHub. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualHubName, virtualHubParameters).map(new Func1<ServiceResponse<VirtualHubInner>, VirtualHubInner>() { @Override public VirtualHubInner call(ServiceResponse<VirtualHubInner> response) { return response.body(); } }); }
java
public Observable<VirtualHubInner> createOrUpdateAsync(String resourceGroupName, String virtualHubName, VirtualHubInner virtualHubParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualHubName, virtualHubParameters).map(new Func1<ServiceResponse<VirtualHubInner>, VirtualHubInner>() { @Override public VirtualHubInner call(ServiceResponse<VirtualHubInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualHubInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "virtualHubName", ",", "VirtualHubInner", "virtualHubParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupNa...
Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. @param resourceGroupName The resource group name of the VirtualHub. @param virtualHubName The name of the VirtualHub. @param virtualHubParameters Parameters supplied to create or update VirtualHub. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "a", "VirtualHub", "resource", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "VirtualHub", "." ]
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/VirtualHubsInner.java#L238-L245
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lnkproducer/LinkGenerator.java
LinkGenerator.writeInt
private void writeInt(int intValue, OutputStream outStream) throws IOException { """ Writes int into stream. @param intValue int value @param outStream stream @throws IOException {@link IOException} """ outStream.write(intValue & 0xFF); outStream.write((intValue >> 8) & 0xFF); }
java
private void writeInt(int intValue, OutputStream outStream) throws IOException { outStream.write(intValue & 0xFF); outStream.write((intValue >> 8) & 0xFF); }
[ "private", "void", "writeInt", "(", "int", "intValue", ",", "OutputStream", "outStream", ")", "throws", "IOException", "{", "outStream", ".", "write", "(", "intValue", "&", "0xFF", ")", ";", "outStream", ".", "write", "(", "(", "intValue", ">>", "8", ")", ...
Writes int into stream. @param intValue int value @param outStream stream @throws IOException {@link IOException}
[ "Writes", "int", "into", "stream", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/lnkproducer/LinkGenerator.java#L371-L375
looly/hutool
hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java
SqlConnRunner.find
public <T> T find(Connection conn, Query query, RsHandler<T> rsh) throws SQLException { """ 查询<br> 此方法不会关闭Connection @param <T> 结果对象类型 @param conn 数据库连接对象 @param query {@link Query} @param rsh 结果集处理对象 @return 结果对象 @throws SQLException SQL执行异常 """ checkConn(conn); Assert.notNull(query, "[query] is null !"); PreparedStatement ps = null; try { ps = dialect.psForFind(conn, query); return SqlExecutor.query(ps, rsh); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
java
public <T> T find(Connection conn, Query query, RsHandler<T> rsh) throws SQLException { checkConn(conn); Assert.notNull(query, "[query] is null !"); PreparedStatement ps = null; try { ps = dialect.psForFind(conn, query); return SqlExecutor.query(ps, rsh); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
[ "public", "<", "T", ">", "T", "find", "(", "Connection", "conn", ",", "Query", "query", ",", "RsHandler", "<", "T", ">", "rsh", ")", "throws", "SQLException", "{", "checkConn", "(", "conn", ")", ";", "Assert", ".", "notNull", "(", "query", ",", "\"[q...
查询<br> 此方法不会关闭Connection @param <T> 结果对象类型 @param conn 数据库连接对象 @param query {@link Query} @param rsh 结果集处理对象 @return 结果对象 @throws SQLException SQL执行异常
[ "查询<br", ">", "此方法不会关闭Connection" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L303-L316
wonderpush/wonderpush-android-sdk
sdk/src/main/java/com/wonderpush/sdk/TimeSync.java
TimeSync.syncTimeWithServer
protected static void syncTimeWithServer(long elapsedRealtimeSend, long elapsedRealtimeReceive, long serverDate, long serverTook) { """ Synchronize time with the WonderPush servers. @param elapsedRealtimeSend The time at which the request was sent. @param elapsedRealtimeReceive The time at which the response was received. @param serverDate The time at which the server received the request, as read in the response. @param serverTook The time the server took to process the request, as read in the response. """ if (serverDate == 0) { return; } // We have two synchronization sources: // - The "startup" sync, bound to the process lifecycle, using SystemClock.elapsedRealtime() // This time source cannot be messed up with. // It is only valid until the device reboots, at which time a new time origin is set. // - The "device" sync, bound to the system clock, using System.currentTimeMillis() // This time source is affected each time the user changes the date and time, // but it is not affected by timezone or daylight saving changes. // The "startup" sync must be saved into a "device" sync in order to persist between runs of the process. // The "startup" sync should only be stored in memory, and no attempt to count reboot should be taken. // Initialization if (deviceDateToServerDateUncertainty == Long.MAX_VALUE) { deviceDateToServerDateUncertainty = WonderPushConfiguration.getDeviceDateSyncUncertainty(); deviceDateToServerDateOffset = WonderPushConfiguration.getDeviceDateSyncOffset(); } long startupToDeviceOffset = System.currentTimeMillis() - SystemClock.elapsedRealtime(); if (startupDateToDeviceDateOffset == Long.MAX_VALUE) { startupDateToDeviceDateOffset = startupToDeviceOffset; } long uncertainty = (elapsedRealtimeReceive - elapsedRealtimeSend - serverTook) / 2; long offset = serverDate + serverTook / 2 - (elapsedRealtimeSend + elapsedRealtimeReceive) / 2; // We must improve the quality of the "startup" sync. We can trust elaspedRealtime() based measures. if ( // Case 1. Lower uncertainty uncertainty < startupDateToServerDateUncertainty // Case 2. Additional check for exceptional server-side time gaps // Calculate whether the two offsets agree within the total uncertainty limit || Math.abs(offset - startupDateToServerDateOffset) > uncertainty+startupDateToServerDateUncertainty // note the RHS overflows with the Long.MAX_VALUE initialization, but case 1 handles that ) { // Case 1. Take the new, more accurate synchronization // Case 2. Forget the old synchronization, time have changed too much startupDateToServerDateOffset = offset; startupDateToServerDateUncertainty = uncertainty; } // We must detect whether the "device" sync is still valid, otherwise we must update it. if ( // Case 1. Lower uncertainty startupDateToServerDateUncertainty < deviceDateToServerDateUncertainty // Case 2. Local clock was updated, or the two time sources have drifted from each other || Math.abs(startupToDeviceOffset - startupDateToDeviceDateOffset) > startupDateToServerDateUncertainty // Case 3. Time gap between the "startup" and "device" sync || Math.abs(deviceDateToServerDateOffset - (startupDateToServerDateOffset - startupDateToDeviceDateOffset)) > deviceDateToServerDateUncertainty + startupDateToServerDateUncertainty // note the RHS overflows with the Long.MAX_VALUE initialization, but case 1 handles that ) { deviceDateToServerDateOffset = startupDateToServerDateOffset - startupDateToDeviceDateOffset; deviceDateToServerDateUncertainty = startupDateToServerDateUncertainty; WonderPushConfiguration.setDeviceDateSyncOffset(deviceDateToServerDateOffset); WonderPushConfiguration.setDeviceDateSyncUncertainty(deviceDateToServerDateUncertainty); } }
java
protected static void syncTimeWithServer(long elapsedRealtimeSend, long elapsedRealtimeReceive, long serverDate, long serverTook) { if (serverDate == 0) { return; } // We have two synchronization sources: // - The "startup" sync, bound to the process lifecycle, using SystemClock.elapsedRealtime() // This time source cannot be messed up with. // It is only valid until the device reboots, at which time a new time origin is set. // - The "device" sync, bound to the system clock, using System.currentTimeMillis() // This time source is affected each time the user changes the date and time, // but it is not affected by timezone or daylight saving changes. // The "startup" sync must be saved into a "device" sync in order to persist between runs of the process. // The "startup" sync should only be stored in memory, and no attempt to count reboot should be taken. // Initialization if (deviceDateToServerDateUncertainty == Long.MAX_VALUE) { deviceDateToServerDateUncertainty = WonderPushConfiguration.getDeviceDateSyncUncertainty(); deviceDateToServerDateOffset = WonderPushConfiguration.getDeviceDateSyncOffset(); } long startupToDeviceOffset = System.currentTimeMillis() - SystemClock.elapsedRealtime(); if (startupDateToDeviceDateOffset == Long.MAX_VALUE) { startupDateToDeviceDateOffset = startupToDeviceOffset; } long uncertainty = (elapsedRealtimeReceive - elapsedRealtimeSend - serverTook) / 2; long offset = serverDate + serverTook / 2 - (elapsedRealtimeSend + elapsedRealtimeReceive) / 2; // We must improve the quality of the "startup" sync. We can trust elaspedRealtime() based measures. if ( // Case 1. Lower uncertainty uncertainty < startupDateToServerDateUncertainty // Case 2. Additional check for exceptional server-side time gaps // Calculate whether the two offsets agree within the total uncertainty limit || Math.abs(offset - startupDateToServerDateOffset) > uncertainty+startupDateToServerDateUncertainty // note the RHS overflows with the Long.MAX_VALUE initialization, but case 1 handles that ) { // Case 1. Take the new, more accurate synchronization // Case 2. Forget the old synchronization, time have changed too much startupDateToServerDateOffset = offset; startupDateToServerDateUncertainty = uncertainty; } // We must detect whether the "device" sync is still valid, otherwise we must update it. if ( // Case 1. Lower uncertainty startupDateToServerDateUncertainty < deviceDateToServerDateUncertainty // Case 2. Local clock was updated, or the two time sources have drifted from each other || Math.abs(startupToDeviceOffset - startupDateToDeviceDateOffset) > startupDateToServerDateUncertainty // Case 3. Time gap between the "startup" and "device" sync || Math.abs(deviceDateToServerDateOffset - (startupDateToServerDateOffset - startupDateToDeviceDateOffset)) > deviceDateToServerDateUncertainty + startupDateToServerDateUncertainty // note the RHS overflows with the Long.MAX_VALUE initialization, but case 1 handles that ) { deviceDateToServerDateOffset = startupDateToServerDateOffset - startupDateToDeviceDateOffset; deviceDateToServerDateUncertainty = startupDateToServerDateUncertainty; WonderPushConfiguration.setDeviceDateSyncOffset(deviceDateToServerDateOffset); WonderPushConfiguration.setDeviceDateSyncUncertainty(deviceDateToServerDateUncertainty); } }
[ "protected", "static", "void", "syncTimeWithServer", "(", "long", "elapsedRealtimeSend", ",", "long", "elapsedRealtimeReceive", ",", "long", "serverDate", ",", "long", "serverTook", ")", "{", "if", "(", "serverDate", "==", "0", ")", "{", "return", ";", "}", "/...
Synchronize time with the WonderPush servers. @param elapsedRealtimeSend The time at which the request was sent. @param elapsedRealtimeReceive The time at which the response was received. @param serverDate The time at which the server received the request, as read in the response. @param serverTook The time the server took to process the request, as read in the response.
[ "Synchronize", "time", "with", "the", "WonderPush", "servers", "." ]
train
https://github.com/wonderpush/wonderpush-android-sdk/blob/ba0a1568f705cdd6206639bfab1e5cf529084b59/sdk/src/main/java/com/wonderpush/sdk/TimeSync.java#L59-L119
stripe/stripe-java
src/main/java/com/stripe/model/CreditNote.java
CreditNote.voidCreditNote
public CreditNote voidCreditNote() throws StripeException { """ Marks a credit note as void. Learn more about <a href="/docs/billing/invoices/credit-notes#voiding">voiding credit notes</a>. """ return voidCreditNote((Map<String, Object>) null, (RequestOptions) null); }
java
public CreditNote voidCreditNote() throws StripeException { return voidCreditNote((Map<String, Object>) null, (RequestOptions) null); }
[ "public", "CreditNote", "voidCreditNote", "(", ")", "throws", "StripeException", "{", "return", "voidCreditNote", "(", "(", "Map", "<", "String", ",", "Object", ">", ")", "null", ",", "(", "RequestOptions", ")", "null", ")", ";", "}" ]
Marks a credit note as void. Learn more about <a href="/docs/billing/invoices/credit-notes#voiding">voiding credit notes</a>.
[ "Marks", "a", "credit", "note", "as", "void", ".", "Learn", "more", "about", "<a", "href", "=", "/", "docs", "/", "billing", "/", "invoices", "/", "credit", "-", "notes#voiding", ">", "voiding", "credit", "notes<", "/", "a", ">", "." ]
train
https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/CreditNote.java#L368-L370
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/MediaIntents.java
MediaIntents.newPlayMediaIntent
public static Intent newPlayMediaIntent(Uri uri, String type) { """ Open the media player to play the given media Uri @param uri The Uri of the media to play. @param type The mime type @return the intent """ Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(uri, type); return intent; }
java
public static Intent newPlayMediaIntent(Uri uri, String type) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(uri, type); return intent; }
[ "public", "static", "Intent", "newPlayMediaIntent", "(", "Uri", "uri", ",", "String", "type", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_VIEW", ")", ";", "intent", ".", "setDataAndType", "(", "uri", ",", "type", ")", ...
Open the media player to play the given media Uri @param uri The Uri of the media to play. @param type The mime type @return the intent
[ "Open", "the", "media", "player", "to", "play", "the", "given", "media", "Uri" ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/MediaIntents.java#L182-L186
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.loadBalancing_serviceName_task_taskId_GET
public OvhLoadBalancingTask loadBalancing_serviceName_task_taskId_GET(String serviceName, Long taskId) throws IOException { """ Get this object properties REST: GET /ip/loadBalancing/{serviceName}/task/{taskId} @param serviceName [required] The internal name of your IP load balancing @param taskId [required] Identifier of your task """ String qPath = "/ip/loadBalancing/{serviceName}/task/{taskId}"; StringBuilder sb = path(qPath, serviceName, taskId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhLoadBalancingTask.class); }
java
public OvhLoadBalancingTask loadBalancing_serviceName_task_taskId_GET(String serviceName, Long taskId) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/task/{taskId}"; StringBuilder sb = path(qPath, serviceName, taskId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhLoadBalancingTask.class); }
[ "public", "OvhLoadBalancingTask", "loadBalancing_serviceName_task_taskId_GET", "(", "String", "serviceName", ",", "Long", "taskId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/loadBalancing/{serviceName}/task/{taskId}\"", ";", "StringBuilder", "sb", "=",...
Get this object properties REST: GET /ip/loadBalancing/{serviceName}/task/{taskId} @param serviceName [required] The internal name of your IP load balancing @param taskId [required] Identifier of your task
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1307-L1312
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.scopeAllowed
public boolean scopeAllowed(String scope, String allowedScopes) { """ Checks whether a scope is contained in allowed scopes. @param scope scope to be checked @param allowedScopes all allowed scopes @return true if the scope is allowed, otherwise false """ String[] allScopes = allowedScopes.split(SPACE); List<String> allowedList = Arrays.asList(allScopes); String[] scopes = scope.split(SPACE); int allowedCount = 0; for (String s : scopes) { if (allowedList.contains(s)) { allowedCount++; } } return (allowedCount == scopes.length); }
java
public boolean scopeAllowed(String scope, String allowedScopes) { String[] allScopes = allowedScopes.split(SPACE); List<String> allowedList = Arrays.asList(allScopes); String[] scopes = scope.split(SPACE); int allowedCount = 0; for (String s : scopes) { if (allowedList.contains(s)) { allowedCount++; } } return (allowedCount == scopes.length); }
[ "public", "boolean", "scopeAllowed", "(", "String", "scope", ",", "String", "allowedScopes", ")", "{", "String", "[", "]", "allScopes", "=", "allowedScopes", ".", "split", "(", "SPACE", ")", ";", "List", "<", "String", ">", "allowedList", "=", "Arrays", "....
Checks whether a scope is contained in allowed scopes. @param scope scope to be checked @param allowedScopes all allowed scopes @return true if the scope is allowed, otherwise false
[ "Checks", "whether", "a", "scope", "is", "contained", "in", "allowed", "scopes", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L160-L171
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java
EnumConstantBuilder.buildSignature
public void buildSignature(XMLNode node, Content enumConstantsTree) { """ Build the signature. @param node the XML element that specifies which components to document @param enumConstantsTree the content tree to which the documentation will be added """ enumConstantsTree.addContent(writer.getSignature( (FieldDoc) enumConstants.get(currentEnumConstantsIndex))); }
java
public void buildSignature(XMLNode node, Content enumConstantsTree) { enumConstantsTree.addContent(writer.getSignature( (FieldDoc) enumConstants.get(currentEnumConstantsIndex))); }
[ "public", "void", "buildSignature", "(", "XMLNode", "node", ",", "Content", "enumConstantsTree", ")", "{", "enumConstantsTree", ".", "addContent", "(", "writer", ".", "getSignature", "(", "(", "FieldDoc", ")", "enumConstants", ".", "get", "(", "currentEnumConstant...
Build the signature. @param node the XML element that specifies which components to document @param enumConstantsTree the content tree to which the documentation will be added
[ "Build", "the", "signature", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java#L179-L182
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java
ElementMatchers.nameEndsWithIgnoreCase
public static <T extends NamedElement> ElementMatcher.Junction<T> nameEndsWithIgnoreCase(String suffix) { """ Matches a {@link NamedElement} for its name's suffix. The name's capitalization is ignored. @param suffix The expected name's suffix. @param <T> The type of the matched object. @return An element matcher for a named element's name's suffix. """ return new NameMatcher<T>(new StringMatcher(suffix, StringMatcher.Mode.ENDS_WITH_IGNORE_CASE)); }
java
public static <T extends NamedElement> ElementMatcher.Junction<T> nameEndsWithIgnoreCase(String suffix) { return new NameMatcher<T>(new StringMatcher(suffix, StringMatcher.Mode.ENDS_WITH_IGNORE_CASE)); }
[ "public", "static", "<", "T", "extends", "NamedElement", ">", "ElementMatcher", ".", "Junction", "<", "T", ">", "nameEndsWithIgnoreCase", "(", "String", "suffix", ")", "{", "return", "new", "NameMatcher", "<", "T", ">", "(", "new", "StringMatcher", "(", "suf...
Matches a {@link NamedElement} for its name's suffix. The name's capitalization is ignored. @param suffix The expected name's suffix. @param <T> The type of the matched object. @return An element matcher for a named element's name's suffix.
[ "Matches", "a", "{", "@link", "NamedElement", "}", "for", "its", "name", "s", "suffix", ".", "The", "name", "s", "capitalization", "is", "ignored", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L712-L714
Impetus/Kundera
src/kundera-spark/spark-core/src/main/java/com/impetus/spark/client/SparkClient.java
SparkClient.getDataFrame
public DataFrame getDataFrame(String query, EntityMetadata m, KunderaQuery kunderaQuery) { """ Gets the data frame. @param query the query @param m the m @param kunderaQuery the kundera query @return the data frame """ PersistenceUnitMetadata puMetadata = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata( persistenceUnit); String clientName = puMetadata.getProperty(DATA_CLIENT).toLowerCase(); SparkDataClient dataClient = SparkDataClientFactory.getDataClient(clientName); if (registeredTables.get(m.getTableName()) == null || !registeredTables.get(m.getTableName())) { dataClient.registerTable(m, this); registeredTables.put(m.getTableName(), true); } // at this level temp table or table should be ready DataFrame dataFrame = sqlContext.sql(query); return dataFrame; }
java
public DataFrame getDataFrame(String query, EntityMetadata m, KunderaQuery kunderaQuery) { PersistenceUnitMetadata puMetadata = kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata( persistenceUnit); String clientName = puMetadata.getProperty(DATA_CLIENT).toLowerCase(); SparkDataClient dataClient = SparkDataClientFactory.getDataClient(clientName); if (registeredTables.get(m.getTableName()) == null || !registeredTables.get(m.getTableName())) { dataClient.registerTable(m, this); registeredTables.put(m.getTableName(), true); } // at this level temp table or table should be ready DataFrame dataFrame = sqlContext.sql(query); return dataFrame; }
[ "public", "DataFrame", "getDataFrame", "(", "String", "query", ",", "EntityMetadata", "m", ",", "KunderaQuery", "kunderaQuery", ")", "{", "PersistenceUnitMetadata", "puMetadata", "=", "kunderaMetadata", ".", "getApplicationMetadata", "(", ")", ".", "getPersistenceUnitMe...
Gets the data frame. @param query the query @param m the m @param kunderaQuery the kundera query @return the data frame
[ "Gets", "the", "data", "frame", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-spark/spark-core/src/main/java/com/impetus/spark/client/SparkClient.java#L333-L349
greatman/craftconomy3
src/main/java/com/greatmancode/craftconomy3/groups/WorldGroupsManager.java
WorldGroupsManager.addWorldToGroup
public void addWorldToGroup(String groupName, String world) { """ Add a world to a group @param groupName the group name @param world the world to add """ if (!groupName.equalsIgnoreCase(DEFAULT_GROUP_NAME)) { if (list.containsKey(groupName)) { list.get(groupName).addWorld(world); } else { WorldGroup group = new WorldGroup(groupName); group.addWorld(world); } } }
java
public void addWorldToGroup(String groupName, String world) { if (!groupName.equalsIgnoreCase(DEFAULT_GROUP_NAME)) { if (list.containsKey(groupName)) { list.get(groupName).addWorld(world); } else { WorldGroup group = new WorldGroup(groupName); group.addWorld(world); } } }
[ "public", "void", "addWorldToGroup", "(", "String", "groupName", ",", "String", "world", ")", "{", "if", "(", "!", "groupName", ".", "equalsIgnoreCase", "(", "DEFAULT_GROUP_NAME", ")", ")", "{", "if", "(", "list", ".", "containsKey", "(", "groupName", ")", ...
Add a world to a group @param groupName the group name @param world the world to add
[ "Add", "a", "world", "to", "a", "group" ]
train
https://github.com/greatman/craftconomy3/blob/51b1b3de7d039e20c7418d1e70b8c4b02b8cf840/src/main/java/com/greatmancode/craftconomy3/groups/WorldGroupsManager.java#L44-L53
camunda/camunda-bpm-platform
engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/hal/cache/HalCachingLinkResolver.java
HalCachingLinkResolver.resolveLinks
public List<HalResource<?>> resolveLinks(String[] linkedIds, ProcessEngine processEngine) { """ Resolve resources for linked ids, if configured uses a cache. """ Cache cache = getCache(); if (cache == null) { return resolveNotCachedLinks(linkedIds, processEngine); } else { ArrayList<String> notCachedLinkedIds = new ArrayList<String>(); List<HalResource<?>> resolvedResources = resolveCachedLinks(linkedIds, cache, notCachedLinkedIds); if (!notCachedLinkedIds.isEmpty()) { List<HalResource<?>> notCachedResources = resolveNotCachedLinks(notCachedLinkedIds.toArray(new String[notCachedLinkedIds.size()]), processEngine); resolvedResources.addAll(notCachedResources); putIntoCache(notCachedResources); } sortResolvedResources(resolvedResources); return resolvedResources; } }
java
public List<HalResource<?>> resolveLinks(String[] linkedIds, ProcessEngine processEngine) { Cache cache = getCache(); if (cache == null) { return resolveNotCachedLinks(linkedIds, processEngine); } else { ArrayList<String> notCachedLinkedIds = new ArrayList<String>(); List<HalResource<?>> resolvedResources = resolveCachedLinks(linkedIds, cache, notCachedLinkedIds); if (!notCachedLinkedIds.isEmpty()) { List<HalResource<?>> notCachedResources = resolveNotCachedLinks(notCachedLinkedIds.toArray(new String[notCachedLinkedIds.size()]), processEngine); resolvedResources.addAll(notCachedResources); putIntoCache(notCachedResources); } sortResolvedResources(resolvedResources); return resolvedResources; } }
[ "public", "List", "<", "HalResource", "<", "?", ">", ">", "resolveLinks", "(", "String", "[", "]", "linkedIds", ",", "ProcessEngine", "processEngine", ")", "{", "Cache", "cache", "=", "getCache", "(", ")", ";", "if", "(", "cache", "==", "null", ")", "{...
Resolve resources for linked ids, if configured uses a cache.
[ "Resolve", "resources", "for", "linked", "ids", "if", "configured", "uses", "a", "cache", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/hal/cache/HalCachingLinkResolver.java#L35-L55
jenetics/jenetics
jenetics/src/main/java/io/jenetics/internal/math/base.java
base.pow
public static long pow(final long b, final long e) { """ Binary exponentiation algorithm. @param b the base number. @param e the exponent. @return {@code b^e}. """ long base = b; long exp = e; long result = 1; while (exp != 0) { if ((exp & 1) != 0) { result *= base; } exp >>>= 1; base *= base; } return result; }
java
public static long pow(final long b, final long e) { long base = b; long exp = e; long result = 1; while (exp != 0) { if ((exp & 1) != 0) { result *= base; } exp >>>= 1; base *= base; } return result; }
[ "public", "static", "long", "pow", "(", "final", "long", "b", ",", "final", "long", "e", ")", "{", "long", "base", "=", "b", ";", "long", "exp", "=", "e", ";", "long", "result", "=", "1", ";", "while", "(", "exp", "!=", "0", ")", "{", "if", "...
Binary exponentiation algorithm. @param b the base number. @param e the exponent. @return {@code b^e}.
[ "Binary", "exponentiation", "algorithm", "." ]
train
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/internal/math/base.java#L84-L98
graknlabs/grakn
server/src/graql/executor/ConceptBuilder.java
ConceptBuilder.setSuper
public static void setSuper(SchemaConcept subConcept, SchemaConcept superConcept) { """ Make the second argument the super of the first argument @throws GraqlQueryException if the types are different, or setting the super to be a meta-type """ if (superConcept.isEntityType()) { subConcept.asEntityType().sup(superConcept.asEntityType()); } else if (superConcept.isRelationType()) { subConcept.asRelationType().sup(superConcept.asRelationType()); } else if (superConcept.isRole()) { subConcept.asRole().sup(superConcept.asRole()); } else if (superConcept.isAttributeType()) { subConcept.asAttributeType().sup(superConcept.asAttributeType()); } else if (superConcept.isRule()) { subConcept.asRule().sup(superConcept.asRule()); } else { throw InvalidKBException.insertMetaType(subConcept.label(), superConcept); } }
java
public static void setSuper(SchemaConcept subConcept, SchemaConcept superConcept) { if (superConcept.isEntityType()) { subConcept.asEntityType().sup(superConcept.asEntityType()); } else if (superConcept.isRelationType()) { subConcept.asRelationType().sup(superConcept.asRelationType()); } else if (superConcept.isRole()) { subConcept.asRole().sup(superConcept.asRole()); } else if (superConcept.isAttributeType()) { subConcept.asAttributeType().sup(superConcept.asAttributeType()); } else if (superConcept.isRule()) { subConcept.asRule().sup(superConcept.asRule()); } else { throw InvalidKBException.insertMetaType(subConcept.label(), superConcept); } }
[ "public", "static", "void", "setSuper", "(", "SchemaConcept", "subConcept", ",", "SchemaConcept", "superConcept", ")", "{", "if", "(", "superConcept", ".", "isEntityType", "(", ")", ")", "{", "subConcept", ".", "asEntityType", "(", ")", ".", "sup", "(", "sup...
Make the second argument the super of the first argument @throws GraqlQueryException if the types are different, or setting the super to be a meta-type
[ "Make", "the", "second", "argument", "the", "super", "of", "the", "first", "argument" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/executor/ConceptBuilder.java#L438-L452
OpenLiberty/open-liberty
dev/com.ibm.ws.jsfContainer_fat_2.3/fat/src/com/ibm/ws/jsf/container/fat/utils/JSFUtils.java
JSFUtils.createHttpUrl
public static URL createHttpUrl(LibertyServer server, String contextRoot, String path) throws Exception { """ Construct a URL for a test case so a request can be made. @param server - The server that is under test, this is used to get the port and host name. @param contextRoot - The context root of the application @param path - Additional path information for the request. @return - A fully formed URL. @throws Exception """ return new URL(createHttpUrlString(server, contextRoot, path)); }
java
public static URL createHttpUrl(LibertyServer server, String contextRoot, String path) throws Exception { return new URL(createHttpUrlString(server, contextRoot, path)); }
[ "public", "static", "URL", "createHttpUrl", "(", "LibertyServer", "server", ",", "String", "contextRoot", ",", "String", "path", ")", "throws", "Exception", "{", "return", "new", "URL", "(", "createHttpUrlString", "(", "server", ",", "contextRoot", ",", "path", ...
Construct a URL for a test case so a request can be made. @param server - The server that is under test, this is used to get the port and host name. @param contextRoot - The context root of the application @param path - Additional path information for the request. @return - A fully formed URL. @throws Exception
[ "Construct", "a", "URL", "for", "a", "test", "case", "so", "a", "request", "can", "be", "made", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsfContainer_fat_2.3/fat/src/com/ibm/ws/jsf/container/fat/utils/JSFUtils.java#L36-L38
deephacks/confit
api-model/src/main/java/org/deephacks/confit/serialization/Reflections.java
Reflections.computeClassHierarchy
private static void computeClassHierarchy(Class<?> clazz, List<Class<?>> classes) { """ Get list superclasses and interfaces recursively. @param clazz The class to start the search with. @param classes List of classes to which to add list found super classes and interfaces. """ for (Class<?> current = clazz; current != null; current = current.getSuperclass()) { if (classes.contains(current)) { return; } classes.add(current); for (Class<?> currentInterface : current.getInterfaces()) { computeClassHierarchy(currentInterface, classes); } } }
java
private static void computeClassHierarchy(Class<?> clazz, List<Class<?>> classes) { for (Class<?> current = clazz; current != null; current = current.getSuperclass()) { if (classes.contains(current)) { return; } classes.add(current); for (Class<?> currentInterface : current.getInterfaces()) { computeClassHierarchy(currentInterface, classes); } } }
[ "private", "static", "void", "computeClassHierarchy", "(", "Class", "<", "?", ">", "clazz", ",", "List", "<", "Class", "<", "?", ">", ">", "classes", ")", "{", "for", "(", "Class", "<", "?", ">", "current", "=", "clazz", ";", "current", "!=", "null",...
Get list superclasses and interfaces recursively. @param clazz The class to start the search with. @param classes List of classes to which to add list found super classes and interfaces.
[ "Get", "list", "superclasses", "and", "interfaces", "recursively", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/api-model/src/main/java/org/deephacks/confit/serialization/Reflections.java#L79-L89
phax/ph-poi
src/main/java/com/helger/poi/excel/WorkbookCreationHelper.java
WorkbookCreationHelper.addMergeRegionInCurrentRow
public int addMergeRegionInCurrentRow (@Nonnegative final int nFirstCol, @Nonnegative final int nLastCol) { """ Add a merge region in the current row. Note: only the content of the first cell is used as the content of the merged cell! @param nFirstCol First column to be merged (inclusive). 0-based @param nLastCol Last column to be merged (inclusive). 0-based, must be larger than {@code nFirstCol} @return index of this region """ final int nCurrentRowIndex = getRowIndex (); return addMergeRegion (nCurrentRowIndex, nCurrentRowIndex, nFirstCol, nLastCol); }
java
public int addMergeRegionInCurrentRow (@Nonnegative final int nFirstCol, @Nonnegative final int nLastCol) { final int nCurrentRowIndex = getRowIndex (); return addMergeRegion (nCurrentRowIndex, nCurrentRowIndex, nFirstCol, nLastCol); }
[ "public", "int", "addMergeRegionInCurrentRow", "(", "@", "Nonnegative", "final", "int", "nFirstCol", ",", "@", "Nonnegative", "final", "int", "nLastCol", ")", "{", "final", "int", "nCurrentRowIndex", "=", "getRowIndex", "(", ")", ";", "return", "addMergeRegion", ...
Add a merge region in the current row. Note: only the content of the first cell is used as the content of the merged cell! @param nFirstCol First column to be merged (inclusive). 0-based @param nLastCol Last column to be merged (inclusive). 0-based, must be larger than {@code nFirstCol} @return index of this region
[ "Add", "a", "merge", "region", "in", "the", "current", "row", ".", "Note", ":", "only", "the", "content", "of", "the", "first", "cell", "is", "used", "as", "the", "content", "of", "the", "merged", "cell!" ]
train
https://github.com/phax/ph-poi/blob/908c5dd434739e6989cf88e55bea48f2f18c6996/src/main/java/com/helger/poi/excel/WorkbookCreationHelper.java#L440-L444
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.setDateReleased
public void setDateReleased(CmsResource resource, long dateReleased, boolean recursive) throws CmsException { """ Changes the "release" date of a resource.<p> @param resource the resource to change @param dateReleased the new release date of the changed resource @param recursive if this operation is to be applied recursively to all resources in a folder @throws CmsException if something goes wrong """ getResourceType(resource).setDateReleased(this, m_securityManager, resource, dateReleased, recursive); }
java
public void setDateReleased(CmsResource resource, long dateReleased, boolean recursive) throws CmsException { getResourceType(resource).setDateReleased(this, m_securityManager, resource, dateReleased, recursive); }
[ "public", "void", "setDateReleased", "(", "CmsResource", "resource", ",", "long", "dateReleased", ",", "boolean", "recursive", ")", "throws", "CmsException", "{", "getResourceType", "(", "resource", ")", ".", "setDateReleased", "(", "this", ",", "m_securityManager",...
Changes the "release" date of a resource.<p> @param resource the resource to change @param dateReleased the new release date of the changed resource @param recursive if this operation is to be applied recursively to all resources in a folder @throws CmsException if something goes wrong
[ "Changes", "the", "release", "date", "of", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3797-L3800
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SetUserIDHandler.java
SetUserIDHandler.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { """ Called when a change is the record status is about to happen/has happened. @param field If this file change is due to a field, this is the field. @param iChangeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code. """ // Write/Update a record int iErrorCode = DBConstants.NORMAL_RETURN; switch (iChangeType) { case DBConstants.REFRESH_TYPE: case DBConstants.UPDATE_TYPE: if (m_bFirstTimeOnly) break; case DBConstants.ADD_TYPE: iErrorCode = this.setUserID(iChangeType, bDisplayOption); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; break; case DBConstants.FIELD_CHANGED_TYPE: if ((this.getOwner().getEditMode() == DBConstants.EDIT_ADD) && (this.getOwner().getField(userIdFieldName).getValue() == -1)) { // Special case - Init Record did not have record owner, but I probably do now. iErrorCode = this.setUserID(iChangeType, bDisplayOption); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; } } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Write/Update a record int iErrorCode = DBConstants.NORMAL_RETURN; switch (iChangeType) { case DBConstants.REFRESH_TYPE: case DBConstants.UPDATE_TYPE: if (m_bFirstTimeOnly) break; case DBConstants.ADD_TYPE: iErrorCode = this.setUserID(iChangeType, bDisplayOption); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; break; case DBConstants.FIELD_CHANGED_TYPE: if ((this.getOwner().getEditMode() == DBConstants.EDIT_ADD) && (this.getOwner().getField(userIdFieldName).getValue() == -1)) { // Special case - Init Record did not have record owner, but I probably do now. iErrorCode = this.setUserID(iChangeType, bDisplayOption); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; } } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "// Write/Update a record", "int", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "switch", "(", "iChangeType", ")", ...
Called when a change is the record status is about to happen/has happened. @param field If this file change is due to a field, this is the field. @param iChangeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SetUserIDHandler.java#L88-L112
recruit-mp/android-RMP-Appirater
library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java
RmpAppirater.appLaunched
public static void appLaunched(Context context, Options options) { """ Tells RMP-Appirater that the app has launched. <p/> Show rating dialog if user isn't rating yet and don't select "Not show again". @param context Context @param options RMP-Appirater options. """ appLaunched(context, null, options, null); }
java
public static void appLaunched(Context context, Options options) { appLaunched(context, null, options, null); }
[ "public", "static", "void", "appLaunched", "(", "Context", "context", ",", "Options", "options", ")", "{", "appLaunched", "(", "context", ",", "null", ",", "options", ",", "null", ")", ";", "}" ]
Tells RMP-Appirater that the app has launched. <p/> Show rating dialog if user isn't rating yet and don't select "Not show again". @param context Context @param options RMP-Appirater options.
[ "Tells", "RMP", "-", "Appirater", "that", "the", "app", "has", "launched", ".", "<p", "/", ">", "Show", "rating", "dialog", "if", "user", "isn", "t", "rating", "yet", "and", "don", "t", "select", "Not", "show", "again", "." ]
train
https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L83-L85
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/J2CUtilityClass.java
J2CUtilityClass.generateExceptionString
public static String generateExceptionString(Throwable t, String delim) { """ <P> Generates a string which consists of the toStrings() of the provided Exception and any linked or chained exceptions and initial causes. @param t The first exception in the chain @param delim The character which will be used to deliminate exceptions. @return a string which includes all the toStrings() of the linked exceptions. """ StringBuffer sb = new StringBuffer(); if (t != null) { sb.append(t.toString()); Throwable nextThrowable = getNextThrowable(t); if (nextThrowable != null) { sb.append(delim); sb.append(generateExceptionString(getNextThrowable(t), delim)); } } return sb.toString(); }
java
public static String generateExceptionString(Throwable t, String delim) { StringBuffer sb = new StringBuffer(); if (t != null) { sb.append(t.toString()); Throwable nextThrowable = getNextThrowable(t); if (nextThrowable != null) { sb.append(delim); sb.append(generateExceptionString(getNextThrowable(t), delim)); } } return sb.toString(); }
[ "public", "static", "String", "generateExceptionString", "(", "Throwable", "t", ",", "String", "delim", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "t", "!=", "null", ")", "{", "sb", ".", "append", "(", "t", "....
<P> Generates a string which consists of the toStrings() of the provided Exception and any linked or chained exceptions and initial causes. @param t The first exception in the chain @param delim The character which will be used to deliminate exceptions. @return a string which includes all the toStrings() of the linked exceptions.
[ "<P", ">", "Generates", "a", "string", "which", "consists", "of", "the", "toStrings", "()", "of", "the", "provided", "Exception", "and", "any", "linked", "or", "chained", "exceptions", "and", "initial", "causes", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/J2CUtilityClass.java#L64-L81
passwordmaker/java-passwordmaker-lib
src/main/java/org/daveware/passwordmaker/RDFDatabaseWriter.java
RDFDatabaseWriter.writeParent
private void writeParent(Account account, XmlStreamWriter writer) throws Exception { """ Writes a parent node to the stream, recursing into any children. @param account The parent account to write. @param writer The XML stream to write to. @throws Exception on who the hell knows. """ // Sequence block writer.writeStartElement("RDF:Seq"); writer.writeAttribute("RDF:about", account.getId()); for (Account child : account.getChildren()) { logger.fine(" Write-RDF:li: " + child.getId()); writer.writeStartElement("RDF:li"); writer.writeAttribute("RDF:resource", child.getId()); writer.writeEndElement(); } writer.writeEndElement(); // Descriptions of all elements including the parent writeDescription(account, writer); for (Account child : account.getChildren()) { logger.fine("Write-RDF:Desc: " + child.getName()); writeDescription(child, writer); } // Recurse into the children for (Account child : account.getChildren()) { if (child.getChildren().size() > 0) { writeParent(child, writer); } } }
java
private void writeParent(Account account, XmlStreamWriter writer) throws Exception { // Sequence block writer.writeStartElement("RDF:Seq"); writer.writeAttribute("RDF:about", account.getId()); for (Account child : account.getChildren()) { logger.fine(" Write-RDF:li: " + child.getId()); writer.writeStartElement("RDF:li"); writer.writeAttribute("RDF:resource", child.getId()); writer.writeEndElement(); } writer.writeEndElement(); // Descriptions of all elements including the parent writeDescription(account, writer); for (Account child : account.getChildren()) { logger.fine("Write-RDF:Desc: " + child.getName()); writeDescription(child, writer); } // Recurse into the children for (Account child : account.getChildren()) { if (child.getChildren().size() > 0) { writeParent(child, writer); } } }
[ "private", "void", "writeParent", "(", "Account", "account", ",", "XmlStreamWriter", "writer", ")", "throws", "Exception", "{", "// Sequence block\r", "writer", ".", "writeStartElement", "(", "\"RDF:Seq\"", ")", ";", "writer", ".", "writeAttribute", "(", "\"RDF:abou...
Writes a parent node to the stream, recursing into any children. @param account The parent account to write. @param writer The XML stream to write to. @throws Exception on who the hell knows.
[ "Writes", "a", "parent", "node", "to", "the", "stream", "recursing", "into", "any", "children", "." ]
train
https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/RDFDatabaseWriter.java#L194-L220
eyp/serfj
src/main/java/net/sf/serfj/client/Client.java
Client.getRequest
public Object getRequest(String restUrl, Map<String, String> params) throws IOException, WebServiceException { """ Do a GET HTTP request to the given REST-URL. @param restUrl REST URL. @param params Parameters for adding to the query string. @throws IOException if the request go bad. """ HttpURLConnection conn = null; try { // Make the URL urlString = new StringBuilder(this.host).append(restUrl); urlString.append(this.makeParamsString(params, true)); LOGGER.debug("Doing HTTP request: GET [{}]", urlString.toString()); // Connection configuration // Proxy proxy = DEBUG_HTTP ? new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8008)) : Proxy.NO_PROXY; URL url = new URL(urlString.toString()); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod(HttpMethod.GET.name()); conn.setRequestProperty("Connection", "Keep-Alive"); // Gets the response return this.readResponse(restUrl, conn); } catch (WebServiceException e) { LOGGER.debug("WebServiceException catched. Request error", e); throw e; } catch (IOException e) { LOGGER.debug("IOException catched. Request error", e); throw e; } catch (Exception e) { LOGGER.debug("Exception catched, throwing a new IOException. Request error", e); throw new IOException(e.getLocalizedMessage()); } finally { if (conn != null) { conn.disconnect(); } } }
java
public Object getRequest(String restUrl, Map<String, String> params) throws IOException, WebServiceException { HttpURLConnection conn = null; try { // Make the URL urlString = new StringBuilder(this.host).append(restUrl); urlString.append(this.makeParamsString(params, true)); LOGGER.debug("Doing HTTP request: GET [{}]", urlString.toString()); // Connection configuration // Proxy proxy = DEBUG_HTTP ? new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8008)) : Proxy.NO_PROXY; URL url = new URL(urlString.toString()); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod(HttpMethod.GET.name()); conn.setRequestProperty("Connection", "Keep-Alive"); // Gets the response return this.readResponse(restUrl, conn); } catch (WebServiceException e) { LOGGER.debug("WebServiceException catched. Request error", e); throw e; } catch (IOException e) { LOGGER.debug("IOException catched. Request error", e); throw e; } catch (Exception e) { LOGGER.debug("Exception catched, throwing a new IOException. Request error", e); throw new IOException(e.getLocalizedMessage()); } finally { if (conn != null) { conn.disconnect(); } } }
[ "public", "Object", "getRequest", "(", "String", "restUrl", ",", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "IOException", ",", "WebServiceException", "{", "HttpURLConnection", "conn", "=", "null", ";", "try", "{", "// Make the URL", "u...
Do a GET HTTP request to the given REST-URL. @param restUrl REST URL. @param params Parameters for adding to the query string. @throws IOException if the request go bad.
[ "Do", "a", "GET", "HTTP", "request", "to", "the", "given", "REST", "-", "URL", "." ]
train
https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/client/Client.java#L88-L118