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
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/DailyCalendar.java
DailyCalendar._validate
private void _validate (final int hourOfDay, final int minute, final int second, final int millis) { """ Checks the specified values for validity as a set of time values. @param hourOfDay the hour of the time to check (in military (24-hour) time) @param minute the minute of the time to check @param second the second of the time to check @param millis the millisecond of the time to check """ if (hourOfDay < 0 || hourOfDay > 23) { throw new IllegalArgumentException (invalidHourOfDay + hourOfDay); } if (minute < 0 || minute > 59) { throw new IllegalArgumentException (invalidMinute + minute); } if (second < 0 || second > 59) { throw new IllegalArgumentException (invalidSecond + second); } if (millis < 0 || millis > 999) { throw new IllegalArgumentException (invalidMillis + millis); } }
java
private void _validate (final int hourOfDay, final int minute, final int second, final int millis) { if (hourOfDay < 0 || hourOfDay > 23) { throw new IllegalArgumentException (invalidHourOfDay + hourOfDay); } if (minute < 0 || minute > 59) { throw new IllegalArgumentException (invalidMinute + minute); } if (second < 0 || second > 59) { throw new IllegalArgumentException (invalidSecond + second); } if (millis < 0 || millis > 999) { throw new IllegalArgumentException (invalidMillis + millis); } }
[ "private", "void", "_validate", "(", "final", "int", "hourOfDay", ",", "final", "int", "minute", ",", "final", "int", "second", ",", "final", "int", "millis", ")", "{", "if", "(", "hourOfDay", "<", "0", "||", "hourOfDay", ">", "23", ")", "{", "throw", "new", "IllegalArgumentException", "(", "invalidHourOfDay", "+", "hourOfDay", ")", ";", "}", "if", "(", "minute", "<", "0", "||", "minute", ">", "59", ")", "{", "throw", "new", "IllegalArgumentException", "(", "invalidMinute", "+", "minute", ")", ";", "}", "if", "(", "second", "<", "0", "||", "second", ">", "59", ")", "{", "throw", "new", "IllegalArgumentException", "(", "invalidSecond", "+", "second", ")", ";", "}", "if", "(", "millis", "<", "0", "||", "millis", ">", "999", ")", "{", "throw", "new", "IllegalArgumentException", "(", "invalidMillis", "+", "millis", ")", ";", "}", "}" ]
Checks the specified values for validity as a set of time values. @param hourOfDay the hour of the time to check (in military (24-hour) time) @param minute the minute of the time to check @param second the second of the time to check @param millis the millisecond of the time to check
[ "Checks", "the", "specified", "values", "for", "validity", "as", "a", "set", "of", "time", "values", "." ]
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/DailyCalendar.java#L925-L943
jglobus/JGlobus
ssl-proxies/src/main/java/org/globus/gsi/GlobusCredential.java
GlobusCredential.verify
public void verify() throws GlobusCredentialException { """ Verifies the validity of the credentials. All certificate path validation is performed using trusted certificates in default locations. @exception GlobusCredentialException if one of the certificates in the chain expired or if path validiation fails. """ try { String caCertsLocation = "file:" + CoGProperties.getDefault().getCaCertLocations(); String crlPattern = caCertsLocation + "/*.r*"; String sigPolPattern = caCertsLocation + "/*.signing_policy"; KeyStore keyStore = KeyStore.getInstance(GlobusProvider.KEYSTORE_TYPE, GlobusProvider.PROVIDER_NAME); CertStore crlStore = CertStore.getInstance(GlobusProvider.CERTSTORE_TYPE, new ResourceCertStoreParameters(null,crlPattern)); ResourceSigningPolicyStore sigPolStore = new ResourceSigningPolicyStore(new ResourceSigningPolicyStoreParameters(sigPolPattern)); keyStore.load(KeyStoreParametersFactory.createTrustStoreParameters(caCertsLocation)); X509ProxyCertPathParameters parameters = new X509ProxyCertPathParameters(keyStore, crlStore, sigPolStore, false); X509ProxyCertPathValidator validator = new X509ProxyCertPathValidator(); validator.engineValidate(CertificateUtil.getCertPath(this.cred.getCertificateChain()), parameters); } catch (Exception e) { e.printStackTrace(); throw new GlobusCredentialException(GlobusCredentialException.FAILURE, e.getMessage(), e); } }
java
public void verify() throws GlobusCredentialException { try { String caCertsLocation = "file:" + CoGProperties.getDefault().getCaCertLocations(); String crlPattern = caCertsLocation + "/*.r*"; String sigPolPattern = caCertsLocation + "/*.signing_policy"; KeyStore keyStore = KeyStore.getInstance(GlobusProvider.KEYSTORE_TYPE, GlobusProvider.PROVIDER_NAME); CertStore crlStore = CertStore.getInstance(GlobusProvider.CERTSTORE_TYPE, new ResourceCertStoreParameters(null,crlPattern)); ResourceSigningPolicyStore sigPolStore = new ResourceSigningPolicyStore(new ResourceSigningPolicyStoreParameters(sigPolPattern)); keyStore.load(KeyStoreParametersFactory.createTrustStoreParameters(caCertsLocation)); X509ProxyCertPathParameters parameters = new X509ProxyCertPathParameters(keyStore, crlStore, sigPolStore, false); X509ProxyCertPathValidator validator = new X509ProxyCertPathValidator(); validator.engineValidate(CertificateUtil.getCertPath(this.cred.getCertificateChain()), parameters); } catch (Exception e) { e.printStackTrace(); throw new GlobusCredentialException(GlobusCredentialException.FAILURE, e.getMessage(), e); } }
[ "public", "void", "verify", "(", ")", "throws", "GlobusCredentialException", "{", "try", "{", "String", "caCertsLocation", "=", "\"file:\"", "+", "CoGProperties", ".", "getDefault", "(", ")", ".", "getCaCertLocations", "(", ")", ";", "String", "crlPattern", "=", "caCertsLocation", "+", "\"/*.r*\"", ";", "String", "sigPolPattern", "=", "caCertsLocation", "+", "\"/*.signing_policy\"", ";", "KeyStore", "keyStore", "=", "KeyStore", ".", "getInstance", "(", "GlobusProvider", ".", "KEYSTORE_TYPE", ",", "GlobusProvider", ".", "PROVIDER_NAME", ")", ";", "CertStore", "crlStore", "=", "CertStore", ".", "getInstance", "(", "GlobusProvider", ".", "CERTSTORE_TYPE", ",", "new", "ResourceCertStoreParameters", "(", "null", ",", "crlPattern", ")", ")", ";", "ResourceSigningPolicyStore", "sigPolStore", "=", "new", "ResourceSigningPolicyStore", "(", "new", "ResourceSigningPolicyStoreParameters", "(", "sigPolPattern", ")", ")", ";", "keyStore", ".", "load", "(", "KeyStoreParametersFactory", ".", "createTrustStoreParameters", "(", "caCertsLocation", ")", ")", ";", "X509ProxyCertPathParameters", "parameters", "=", "new", "X509ProxyCertPathParameters", "(", "keyStore", ",", "crlStore", ",", "sigPolStore", ",", "false", ")", ";", "X509ProxyCertPathValidator", "validator", "=", "new", "X509ProxyCertPathValidator", "(", ")", ";", "validator", ".", "engineValidate", "(", "CertificateUtil", ".", "getCertPath", "(", "this", ".", "cred", ".", "getCertificateChain", "(", ")", ")", ",", "parameters", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "throw", "new", "GlobusCredentialException", "(", "GlobusCredentialException", ".", "FAILURE", ",", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Verifies the validity of the credentials. All certificate path validation is performed using trusted certificates in default locations. @exception GlobusCredentialException if one of the certificates in the chain expired or if path validiation fails.
[ "Verifies", "the", "validity", "of", "the", "credentials", ".", "All", "certificate", "path", "validation", "is", "performed", "using", "trusted", "certificates", "in", "default", "locations", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/GlobusCredential.java#L158-L174
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
ToStringStyle.appendCyclicObject
protected void appendCyclicObject(final StringBuffer buffer, final String fieldName, final Object value) { """ <p>Append to the <code>toString</code> an <code>Object</code> value that has been detected to participate in a cycle. This implementation will print the standard string value of the value.</p> @param buffer the <code>StringBuffer</code> to populate @param fieldName the field name, typically not used as already appended @param value the value to add to the <code>toString</code>, not <code>null</code> @since 2.2 """ ObjectUtils.identityToString(buffer, value); }
java
protected void appendCyclicObject(final StringBuffer buffer, final String fieldName, final Object value) { ObjectUtils.identityToString(buffer, value); }
[ "protected", "void", "appendCyclicObject", "(", "final", "StringBuffer", "buffer", ",", "final", "String", "fieldName", ",", "final", "Object", "value", ")", "{", "ObjectUtils", ".", "identityToString", "(", "buffer", ",", "value", ")", ";", "}" ]
<p>Append to the <code>toString</code> an <code>Object</code> value that has been detected to participate in a cycle. This implementation will print the standard string value of the value.</p> @param buffer the <code>StringBuffer</code> to populate @param fieldName the field name, typically not used as already appended @param value the value to add to the <code>toString</code>, not <code>null</code> @since 2.2
[ "<p", ">", "Append", "to", "the", "<code", ">", "toString<", "/", "code", ">", "an", "<code", ">", "Object<", "/", "code", ">", "value", "that", "has", "been", "detected", "to", "participate", "in", "a", "cycle", ".", "This", "implementation", "will", "print", "the", "standard", "string", "value", "of", "the", "value", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java#L612-L614
google/closure-templates
java/src/com/google/template/soy/parsepasses/contextautoesc/InferenceEngine.java
InferenceEngine.checkBlockEndContext
private static void checkBlockEndContext(RenderUnitNode node, Context endContext) { """ Checks that the end context of a block is compatible with its start context. @throws SoyAutoescapeException if they mismatch. """ if (!endContext.isValidEndContextForContentKind( MoreObjects.firstNonNull(node.getContentKind(), SanitizedContentKind.HTML))) { String msg = String.format( "A block of kind=\"%s\" cannot end in context %s. Likely cause is %s.", node.getContentKind().asAttributeValue(), endContext, endContext.getLikelyEndContextMismatchCause(node.getContentKind())); throw SoyAutoescapeException.createWithNode(msg, node); } }
java
private static void checkBlockEndContext(RenderUnitNode node, Context endContext) { if (!endContext.isValidEndContextForContentKind( MoreObjects.firstNonNull(node.getContentKind(), SanitizedContentKind.HTML))) { String msg = String.format( "A block of kind=\"%s\" cannot end in context %s. Likely cause is %s.", node.getContentKind().asAttributeValue(), endContext, endContext.getLikelyEndContextMismatchCause(node.getContentKind())); throw SoyAutoescapeException.createWithNode(msg, node); } }
[ "private", "static", "void", "checkBlockEndContext", "(", "RenderUnitNode", "node", ",", "Context", "endContext", ")", "{", "if", "(", "!", "endContext", ".", "isValidEndContextForContentKind", "(", "MoreObjects", ".", "firstNonNull", "(", "node", ".", "getContentKind", "(", ")", ",", "SanitizedContentKind", ".", "HTML", ")", ")", ")", "{", "String", "msg", "=", "String", ".", "format", "(", "\"A block of kind=\\\"%s\\\" cannot end in context %s. Likely cause is %s.\"", ",", "node", ".", "getContentKind", "(", ")", ".", "asAttributeValue", "(", ")", ",", "endContext", ",", "endContext", ".", "getLikelyEndContextMismatchCause", "(", "node", ".", "getContentKind", "(", ")", ")", ")", ";", "throw", "SoyAutoescapeException", ".", "createWithNode", "(", "msg", ",", "node", ")", ";", "}", "}" ]
Checks that the end context of a block is compatible with its start context. @throws SoyAutoescapeException if they mismatch.
[ "Checks", "that", "the", "end", "context", "of", "a", "block", "is", "compatible", "with", "its", "start", "context", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/InferenceEngine.java#L113-L124
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/SIBMBeanResultFactory.java
SIBMBeanResultFactory.createSIBSubscription
public static MessagingSubscription createSIBSubscription(SIMPLocalSubscriptionControllable ls) { """ Create a MessagingSubscription instance from the supplied SIMPLocalSubscriptionControllable. @param ls @return """ long depth = 0; String id = null; int maxMsgs = 0; String name = null; String selector = null; String subscriberId = null; String[] topics = null; depth = ls.getNumberOfQueuedMessages(); id = ls.getId(); name = ls.getName(); selector = ls.getSelector(); subscriberId = ls.getSubscriberID(); topics = ls.getTopics(); return new MessagingSubscription(depth, id, maxMsgs, name, selector, subscriberId, topics); }
java
public static MessagingSubscription createSIBSubscription(SIMPLocalSubscriptionControllable ls) { long depth = 0; String id = null; int maxMsgs = 0; String name = null; String selector = null; String subscriberId = null; String[] topics = null; depth = ls.getNumberOfQueuedMessages(); id = ls.getId(); name = ls.getName(); selector = ls.getSelector(); subscriberId = ls.getSubscriberID(); topics = ls.getTopics(); return new MessagingSubscription(depth, id, maxMsgs, name, selector, subscriberId, topics); }
[ "public", "static", "MessagingSubscription", "createSIBSubscription", "(", "SIMPLocalSubscriptionControllable", "ls", ")", "{", "long", "depth", "=", "0", ";", "String", "id", "=", "null", ";", "int", "maxMsgs", "=", "0", ";", "String", "name", "=", "null", ";", "String", "selector", "=", "null", ";", "String", "subscriberId", "=", "null", ";", "String", "[", "]", "topics", "=", "null", ";", "depth", "=", "ls", ".", "getNumberOfQueuedMessages", "(", ")", ";", "id", "=", "ls", ".", "getId", "(", ")", ";", "name", "=", "ls", ".", "getName", "(", ")", ";", "selector", "=", "ls", ".", "getSelector", "(", ")", ";", "subscriberId", "=", "ls", ".", "getSubscriberID", "(", ")", ";", "topics", "=", "ls", ".", "getTopics", "(", ")", ";", "return", "new", "MessagingSubscription", "(", "depth", ",", "id", ",", "maxMsgs", ",", "name", ",", "selector", ",", "subscriberId", ",", "topics", ")", ";", "}" ]
Create a MessagingSubscription instance from the supplied SIMPLocalSubscriptionControllable. @param ls @return
[ "Create", "a", "MessagingSubscription", "instance", "from", "the", "supplied", "SIMPLocalSubscriptionControllable", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/SIBMBeanResultFactory.java#L296-L314
h2oai/h2o-3
h2o-core/src/main/java/hex/grid/Grid.java
Grid.appendFailedModelParameters
void appendFailedModelParameters(MP params, Exception e) { """ This method appends a new item to the list of failed model parameters. <p/> <p> The failed parameters object represents a point in hyper space which cannot be used for model building.</p> <p/> <p> Should be used only from <code>GridSearch</code> job.</p> @param params model parameters which caused model builder failure @params e exception causing a failure """ assert params != null : "Model parameters should be always != null !"; String[] rawParams = ArrayUtils.toString(getHyperValues(params)); appendFailedModelParameters(params, rawParams, e.getMessage(), StringUtils.toString(e)); }
java
void appendFailedModelParameters(MP params, Exception e) { assert params != null : "Model parameters should be always != null !"; String[] rawParams = ArrayUtils.toString(getHyperValues(params)); appendFailedModelParameters(params, rawParams, e.getMessage(), StringUtils.toString(e)); }
[ "void", "appendFailedModelParameters", "(", "MP", "params", ",", "Exception", "e", ")", "{", "assert", "params", "!=", "null", ":", "\"Model parameters should be always != null !\"", ";", "String", "[", "]", "rawParams", "=", "ArrayUtils", ".", "toString", "(", "getHyperValues", "(", "params", ")", ")", ";", "appendFailedModelParameters", "(", "params", ",", "rawParams", ",", "e", ".", "getMessage", "(", ")", ",", "StringUtils", ".", "toString", "(", "e", ")", ")", ";", "}" ]
This method appends a new item to the list of failed model parameters. <p/> <p> The failed parameters object represents a point in hyper space which cannot be used for model building.</p> <p/> <p> Should be used only from <code>GridSearch</code> job.</p> @param params model parameters which caused model builder failure @params e exception causing a failure
[ "This", "method", "appends", "a", "new", "item", "to", "the", "list", "of", "failed", "model", "parameters", ".", "<p", "/", ">", "<p", ">", "The", "failed", "parameters", "object", "represents", "a", "point", "in", "hyper", "space", "which", "cannot", "be", "used", "for", "model", "building", ".", "<", "/", "p", ">", "<p", "/", ">", "<p", ">", "Should", "be", "used", "only", "from", "<code", ">", "GridSearch<", "/", "code", ">", "job", ".", "<", "/", "p", ">" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/grid/Grid.java#L197-L201
dejv78/javafx-commons
jfx-controls/src/main/java/dejv/jfx/controls/radialmenu1/RadialMenuParams.java
RadialMenuParams.setAngles
public RadialMenuParams setAngles(double angleFromDeg, double angleToDeg) { """ Sets limit angles of the menu arc (in degrees). <p> There are two limit angles - "from" (arc start), and "to" (arc end). <p> If the "to" angle is greater than "from" angle, arc direction (order of menu items) is clockwise. If the "to" angle is less than "from" angle, arc direction (order of menu items) is counterclockwise. If the limited arc size is too small to accomodate all menu items, its radius will increase. @param angleFromDeg "From" angle in degrees - start angle of the menu arc @param angleToDeg "To" angle in degrees - end angle of the menu arc @return The current RadialMenuParams instance for fluent setup """ if (angleFromDeg > angleToDeg) { final double tmpDeg = angleFromDeg; angleFromDeg = angleToDeg; angleToDeg = tmpDeg; setDirection(Direction.CCW); } this.angleFromDeg.set(angleFromDeg); this.angleToDeg.set(angleToDeg); return this; }
java
public RadialMenuParams setAngles(double angleFromDeg, double angleToDeg) { if (angleFromDeg > angleToDeg) { final double tmpDeg = angleFromDeg; angleFromDeg = angleToDeg; angleToDeg = tmpDeg; setDirection(Direction.CCW); } this.angleFromDeg.set(angleFromDeg); this.angleToDeg.set(angleToDeg); return this; }
[ "public", "RadialMenuParams", "setAngles", "(", "double", "angleFromDeg", ",", "double", "angleToDeg", ")", "{", "if", "(", "angleFromDeg", ">", "angleToDeg", ")", "{", "final", "double", "tmpDeg", "=", "angleFromDeg", ";", "angleFromDeg", "=", "angleToDeg", ";", "angleToDeg", "=", "tmpDeg", ";", "setDirection", "(", "Direction", ".", "CCW", ")", ";", "}", "this", ".", "angleFromDeg", ".", "set", "(", "angleFromDeg", ")", ";", "this", ".", "angleToDeg", ".", "set", "(", "angleToDeg", ")", ";", "return", "this", ";", "}" ]
Sets limit angles of the menu arc (in degrees). <p> There are two limit angles - "from" (arc start), and "to" (arc end). <p> If the "to" angle is greater than "from" angle, arc direction (order of menu items) is clockwise. If the "to" angle is less than "from" angle, arc direction (order of menu items) is counterclockwise. If the limited arc size is too small to accomodate all menu items, its radius will increase. @param angleFromDeg "From" angle in degrees - start angle of the menu arc @param angleToDeg "To" angle in degrees - end angle of the menu arc @return The current RadialMenuParams instance for fluent setup
[ "Sets", "limit", "angles", "of", "the", "menu", "arc", "(", "in", "degrees", ")", ".", "<p", ">", "There", "are", "two", "limit", "angles", "-", "from", "(", "arc", "start", ")", "and", "to", "(", "arc", "end", ")", ".", "<p", ">", "If", "the", "to", "angle", "is", "greater", "than", "from", "angle", "arc", "direction", "(", "order", "of", "menu", "items", ")", "is", "clockwise", ".", "If", "the", "to", "angle", "is", "less", "than", "from", "angle", "arc", "direction", "(", "order", "of", "menu", "items", ")", "is", "counterclockwise", ".", "If", "the", "limited", "arc", "size", "is", "too", "small", "to", "accomodate", "all", "menu", "items", "its", "radius", "will", "increase", "." ]
train
https://github.com/dejv78/javafx-commons/blob/ea846eeeb4ed43a7628a40931a3e6f27d513592f/jfx-controls/src/main/java/dejv/jfx/controls/radialmenu1/RadialMenuParams.java#L73-L85
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedPriorityQueue.java
DistributedPriorityQueue.putMulti
public boolean putMulti(MultiItem<T> items, int priority, int maxWait, TimeUnit unit) throws Exception { """ Same as {@link #putMulti(MultiItem, int)} but allows a maximum wait time if an upper bound was set via {@link QueueBuilder#maxItems}. @param items items to add @param priority item priority - lower numbers come out of the queue first @param maxWait maximum wait @param unit wait unit @return true if items was added, false if timed out @throws Exception """ queue.checkState(); String priorityHex = priorityToString(priority); return queue.internalPut(null, items, queue.makeItemPath() + priorityHex, maxWait, unit); }
java
public boolean putMulti(MultiItem<T> items, int priority, int maxWait, TimeUnit unit) throws Exception { queue.checkState(); String priorityHex = priorityToString(priority); return queue.internalPut(null, items, queue.makeItemPath() + priorityHex, maxWait, unit); }
[ "public", "boolean", "putMulti", "(", "MultiItem", "<", "T", ">", "items", ",", "int", "priority", ",", "int", "maxWait", ",", "TimeUnit", "unit", ")", "throws", "Exception", "{", "queue", ".", "checkState", "(", ")", ";", "String", "priorityHex", "=", "priorityToString", "(", "priority", ")", ";", "return", "queue", ".", "internalPut", "(", "null", ",", "items", ",", "queue", ".", "makeItemPath", "(", ")", "+", "priorityHex", ",", "maxWait", ",", "unit", ")", ";", "}" ]
Same as {@link #putMulti(MultiItem, int)} but allows a maximum wait time if an upper bound was set via {@link QueueBuilder#maxItems}. @param items items to add @param priority item priority - lower numbers come out of the queue first @param maxWait maximum wait @param unit wait unit @return true if items was added, false if timed out @throws Exception
[ "Same", "as", "{", "@link", "#putMulti", "(", "MultiItem", "int", ")", "}", "but", "allows", "a", "maximum", "wait", "time", "if", "an", "upper", "bound", "was", "set", "via", "{", "@link", "QueueBuilder#maxItems", "}", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedPriorityQueue.java#L153-L159
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPInstanceUtil.java
CPInstanceUtil.findByC_S
public static CPInstance findByC_S(long CPDefinitionId, String sku) throws com.liferay.commerce.product.exception.NoSuchCPInstanceException { """ Returns the cp instance where CPDefinitionId = &#63; and sku = &#63; or throws a {@link NoSuchCPInstanceException} if it could not be found. @param CPDefinitionId the cp definition ID @param sku the sku @return the matching cp instance @throws NoSuchCPInstanceException if a matching cp instance could not be found """ return getPersistence().findByC_S(CPDefinitionId, sku); }
java
public static CPInstance findByC_S(long CPDefinitionId, String sku) throws com.liferay.commerce.product.exception.NoSuchCPInstanceException { return getPersistence().findByC_S(CPDefinitionId, sku); }
[ "public", "static", "CPInstance", "findByC_S", "(", "long", "CPDefinitionId", ",", "String", "sku", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "product", ".", "exception", ".", "NoSuchCPInstanceException", "{", "return", "getPersistence", "(", ")", ".", "findByC_S", "(", "CPDefinitionId", ",", "sku", ")", ";", "}" ]
Returns the cp instance where CPDefinitionId = &#63; and sku = &#63; or throws a {@link NoSuchCPInstanceException} if it could not be found. @param CPDefinitionId the cp definition ID @param sku the sku @return the matching cp instance @throws NoSuchCPInstanceException if a matching cp instance could not be found
[ "Returns", "the", "cp", "instance", "where", "CPDefinitionId", "=", "&#63", ";", "and", "sku", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPInstanceException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPInstanceUtil.java#L1396-L1399
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java
SlotManager.rejectPendingSlotRequest
private void rejectPendingSlotRequest(PendingSlotRequest pendingSlotRequest, Exception cause) { """ Rejects the pending slot request by failing the request future with a {@link SlotAllocationException}. @param pendingSlotRequest to reject @param cause of the rejection """ CompletableFuture<Acknowledge> request = pendingSlotRequest.getRequestFuture(); if (null != request) { request.completeExceptionally(new SlotAllocationException(cause)); } else { LOG.debug("Cannot reject pending slot request {}, since no request has been sent.", pendingSlotRequest.getAllocationId()); } }
java
private void rejectPendingSlotRequest(PendingSlotRequest pendingSlotRequest, Exception cause) { CompletableFuture<Acknowledge> request = pendingSlotRequest.getRequestFuture(); if (null != request) { request.completeExceptionally(new SlotAllocationException(cause)); } else { LOG.debug("Cannot reject pending slot request {}, since no request has been sent.", pendingSlotRequest.getAllocationId()); } }
[ "private", "void", "rejectPendingSlotRequest", "(", "PendingSlotRequest", "pendingSlotRequest", ",", "Exception", "cause", ")", "{", "CompletableFuture", "<", "Acknowledge", ">", "request", "=", "pendingSlotRequest", ".", "getRequestFuture", "(", ")", ";", "if", "(", "null", "!=", "request", ")", "{", "request", ".", "completeExceptionally", "(", "new", "SlotAllocationException", "(", "cause", ")", ")", ";", "}", "else", "{", "LOG", ".", "debug", "(", "\"Cannot reject pending slot request {}, since no request has been sent.\"", ",", "pendingSlotRequest", ".", "getAllocationId", "(", ")", ")", ";", "}", "}" ]
Rejects the pending slot request by failing the request future with a {@link SlotAllocationException}. @param pendingSlotRequest to reject @param cause of the rejection
[ "Rejects", "the", "pending", "slot", "request", "by", "failing", "the", "request", "future", "with", "a", "{", "@link", "SlotAllocationException", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L979-L987
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/DBQuery.java
DBQuery.lessThanEquals
public static Query lessThanEquals(String field, Object value) { """ The field is less than or equal to the given value @param field The field to compare @param value The value to compare to @return the query """ return new Query().lessThanEquals(field, value); }
java
public static Query lessThanEquals(String field, Object value) { return new Query().lessThanEquals(field, value); }
[ "public", "static", "Query", "lessThanEquals", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "new", "Query", "(", ")", ".", "lessThanEquals", "(", "field", ",", "value", ")", ";", "}" ]
The field is less than or equal to the given value @param field The field to compare @param value The value to compare to @return the query
[ "The", "field", "is", "less", "than", "or", "equal", "to", "the", "given", "value" ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBQuery.java#L73-L75
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseKeepAliveEnabled
private void parseKeepAliveEnabled(Map<Object, Object> props) { """ Check the input configuration for the default flag on whether to use persistent connections or not. If this is false, then the other related configuration values will be ignored (such as MaxKeepAliveRequests). @param props """ boolean flag = this.bKeepAliveEnabled; Object value = props.get(HttpConfigConstants.PROPNAME_KEEPALIVE_ENABLED); if (null != value) { flag = convertBoolean(value); } this.bKeepAliveEnabled = flag; if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: KeepAliveEnabled is " + isKeepAliveEnabled()); } }
java
private void parseKeepAliveEnabled(Map<Object, Object> props) { boolean flag = this.bKeepAliveEnabled; Object value = props.get(HttpConfigConstants.PROPNAME_KEEPALIVE_ENABLED); if (null != value) { flag = convertBoolean(value); } this.bKeepAliveEnabled = flag; if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: KeepAliveEnabled is " + isKeepAliveEnabled()); } }
[ "private", "void", "parseKeepAliveEnabled", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "boolean", "flag", "=", "this", ".", "bKeepAliveEnabled", ";", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_KEEPALIVE_ENABLED", ")", ";", "if", "(", "null", "!=", "value", ")", "{", "flag", "=", "convertBoolean", "(", "value", ")", ";", "}", "this", ".", "bKeepAliveEnabled", "=", "flag", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Config: KeepAliveEnabled is \"", "+", "isKeepAliveEnabled", "(", ")", ")", ";", "}", "}" ]
Check the input configuration for the default flag on whether to use persistent connections or not. If this is false, then the other related configuration values will be ignored (such as MaxKeepAliveRequests). @param props
[ "Check", "the", "input", "configuration", "for", "the", "default", "flag", "on", "whether", "to", "use", "persistent", "connections", "or", "not", ".", "If", "this", "is", "false", "then", "the", "other", "related", "configuration", "values", "will", "be", "ignored", "(", "such", "as", "MaxKeepAliveRequests", ")", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L490-L500
wiselenium/wiselenium
wiselenium-factory/src/main/java/com/github/wiselenium/Wiselenium.java
Wiselenium.decorateElement
public static <E> E decorateElement(Class<E> clazz, WebElement webElement) { """ Decorates a webElement. @param clazz The class of the decorated element. Must be either WebElement or a type annotated with Component or Frame. @param webElement The webElement that will be decorated. @return The decorated element or null if the type isn't supported. @since 0.3.0 """ WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(webElement)); return decorator.decorate(clazz, webElement); }
java
public static <E> E decorateElement(Class<E> clazz, WebElement webElement) { WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(webElement)); return decorator.decorate(clazz, webElement); }
[ "public", "static", "<", "E", ">", "E", "decorateElement", "(", "Class", "<", "E", ">", "clazz", ",", "WebElement", "webElement", ")", "{", "WiseDecorator", "decorator", "=", "new", "WiseDecorator", "(", "new", "DefaultElementLocatorFactory", "(", "webElement", ")", ")", ";", "return", "decorator", ".", "decorate", "(", "clazz", ",", "webElement", ")", ";", "}" ]
Decorates a webElement. @param clazz The class of the decorated element. Must be either WebElement or a type annotated with Component or Frame. @param webElement The webElement that will be decorated. @return The decorated element or null if the type isn't supported. @since 0.3.0
[ "Decorates", "a", "webElement", "." ]
train
https://github.com/wiselenium/wiselenium/blob/15de6484d8f516b3d02391d3bd6a56a03e632706/wiselenium-factory/src/main/java/com/github/wiselenium/Wiselenium.java#L86-L89
Nordstrom/JUnit-Foundation
src/main/java/com/nordstrom/automation/junit/RetryHandler.java
RetryHandler.runChildWithRetry
static void runChildWithRetry(Object runner, final FrameworkMethod method, RunNotifier notifier, int maxRetry) { """ Run the specified method, retrying on failure. @param runner JUnit test runner @param method test method to be run @param notifier run notifier through which events are published @param maxRetry maximum number of retry attempts """ boolean doRetry = false; Statement statement = invoke(runner, "methodBlock", method); Description description = invoke(runner, "describeChild", method); AtomicInteger count = new AtomicInteger(maxRetry); do { EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description); eachNotifier.fireTestStarted(); try { statement.evaluate(); doRetry = false; } catch (AssumptionViolatedException thrown) { doRetry = doRetry(method, thrown, count); if (doRetry) { description = RetriedTest.proxyFor(description, thrown); eachNotifier.fireTestIgnored(); } else { eachNotifier.addFailedAssumption(thrown); } } catch (Throwable thrown) { doRetry = doRetry(method, thrown, count); if (doRetry) { description = RetriedTest.proxyFor(description, thrown); eachNotifier.fireTestIgnored(); } else { eachNotifier.addFailure(thrown); } } finally { eachNotifier.fireTestFinished(); } } while (doRetry); }
java
static void runChildWithRetry(Object runner, final FrameworkMethod method, RunNotifier notifier, int maxRetry) { boolean doRetry = false; Statement statement = invoke(runner, "methodBlock", method); Description description = invoke(runner, "describeChild", method); AtomicInteger count = new AtomicInteger(maxRetry); do { EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description); eachNotifier.fireTestStarted(); try { statement.evaluate(); doRetry = false; } catch (AssumptionViolatedException thrown) { doRetry = doRetry(method, thrown, count); if (doRetry) { description = RetriedTest.proxyFor(description, thrown); eachNotifier.fireTestIgnored(); } else { eachNotifier.addFailedAssumption(thrown); } } catch (Throwable thrown) { doRetry = doRetry(method, thrown, count); if (doRetry) { description = RetriedTest.proxyFor(description, thrown); eachNotifier.fireTestIgnored(); } else { eachNotifier.addFailure(thrown); } } finally { eachNotifier.fireTestFinished(); } } while (doRetry); }
[ "static", "void", "runChildWithRetry", "(", "Object", "runner", ",", "final", "FrameworkMethod", "method", ",", "RunNotifier", "notifier", ",", "int", "maxRetry", ")", "{", "boolean", "doRetry", "=", "false", ";", "Statement", "statement", "=", "invoke", "(", "runner", ",", "\"methodBlock\"", ",", "method", ")", ";", "Description", "description", "=", "invoke", "(", "runner", ",", "\"describeChild\"", ",", "method", ")", ";", "AtomicInteger", "count", "=", "new", "AtomicInteger", "(", "maxRetry", ")", ";", "do", "{", "EachTestNotifier", "eachNotifier", "=", "new", "EachTestNotifier", "(", "notifier", ",", "description", ")", ";", "eachNotifier", ".", "fireTestStarted", "(", ")", ";", "try", "{", "statement", ".", "evaluate", "(", ")", ";", "doRetry", "=", "false", ";", "}", "catch", "(", "AssumptionViolatedException", "thrown", ")", "{", "doRetry", "=", "doRetry", "(", "method", ",", "thrown", ",", "count", ")", ";", "if", "(", "doRetry", ")", "{", "description", "=", "RetriedTest", ".", "proxyFor", "(", "description", ",", "thrown", ")", ";", "eachNotifier", ".", "fireTestIgnored", "(", ")", ";", "}", "else", "{", "eachNotifier", ".", "addFailedAssumption", "(", "thrown", ")", ";", "}", "}", "catch", "(", "Throwable", "thrown", ")", "{", "doRetry", "=", "doRetry", "(", "method", ",", "thrown", ",", "count", ")", ";", "if", "(", "doRetry", ")", "{", "description", "=", "RetriedTest", ".", "proxyFor", "(", "description", ",", "thrown", ")", ";", "eachNotifier", ".", "fireTestIgnored", "(", ")", ";", "}", "else", "{", "eachNotifier", ".", "addFailure", "(", "thrown", ")", ";", "}", "}", "finally", "{", "eachNotifier", ".", "fireTestFinished", "(", ")", ";", "}", "}", "while", "(", "doRetry", ")", ";", "}" ]
Run the specified method, retrying on failure. @param runner JUnit test runner @param method test method to be run @param notifier run notifier through which events are published @param maxRetry maximum number of retry attempts
[ "Run", "the", "specified", "method", "retrying", "on", "failure", "." ]
train
https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/RetryHandler.java#L43-L76
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/datastructures/AbstractSearchStructure.java
AbstractSearchStructure.indexVector
public synchronized boolean indexVector(String id, double[] vector) throws Exception { """ Updates the index with the given vector. This is a synchronized method, i.e. when a thread calls this method, all other threads wait for the first thread to complete before executing the method. This ensures that the persistent BDB store will remain consistent when multiple threads call the indexVector method. @param id The id of the vector @param vector The vector @return True if the vector is successfully indexed, false otherwise. @throws Exception """ long startIndexing = System.currentTimeMillis(); // check if we can index more vectors if (loadCounter >= maxNumVectors) { System.out.println("Maximum index capacity reached, no more vectors can be indexed!"); return false; } // check if name is already indexed if (isIndexed(id)) { System.out.println("Vector '" + id + "' already indexed!"); return false; } // do the indexing // persist id to name and the reverse mapping long startMapping = System.currentTimeMillis(); createMapping(id); totalIdMappingTime += System.currentTimeMillis() - startMapping; // method specific indexing long startInternalIndexing = System.currentTimeMillis(); indexVectorInternal(vector); totalInternalVectorIndexingTime += System.currentTimeMillis() - startInternalIndexing; loadCounter++; // increase the loadCounter if (loadCounter % 100 == 0) { // debug message System.out.println(new Date() + " # indexed vectors: " + loadCounter); } totalVectorIndexingTime += System.currentTimeMillis() - startIndexing; return true; }
java
public synchronized boolean indexVector(String id, double[] vector) throws Exception { long startIndexing = System.currentTimeMillis(); // check if we can index more vectors if (loadCounter >= maxNumVectors) { System.out.println("Maximum index capacity reached, no more vectors can be indexed!"); return false; } // check if name is already indexed if (isIndexed(id)) { System.out.println("Vector '" + id + "' already indexed!"); return false; } // do the indexing // persist id to name and the reverse mapping long startMapping = System.currentTimeMillis(); createMapping(id); totalIdMappingTime += System.currentTimeMillis() - startMapping; // method specific indexing long startInternalIndexing = System.currentTimeMillis(); indexVectorInternal(vector); totalInternalVectorIndexingTime += System.currentTimeMillis() - startInternalIndexing; loadCounter++; // increase the loadCounter if (loadCounter % 100 == 0) { // debug message System.out.println(new Date() + " # indexed vectors: " + loadCounter); } totalVectorIndexingTime += System.currentTimeMillis() - startIndexing; return true; }
[ "public", "synchronized", "boolean", "indexVector", "(", "String", "id", ",", "double", "[", "]", "vector", ")", "throws", "Exception", "{", "long", "startIndexing", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "// check if we can index more vectors\r", "if", "(", "loadCounter", ">=", "maxNumVectors", ")", "{", "System", ".", "out", ".", "println", "(", "\"Maximum index capacity reached, no more vectors can be indexed!\"", ")", ";", "return", "false", ";", "}", "// check if name is already indexed\r", "if", "(", "isIndexed", "(", "id", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Vector '\"", "+", "id", "+", "\"' already indexed!\"", ")", ";", "return", "false", ";", "}", "// do the indexing\r", "// persist id to name and the reverse mapping\r", "long", "startMapping", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "createMapping", "(", "id", ")", ";", "totalIdMappingTime", "+=", "System", ".", "currentTimeMillis", "(", ")", "-", "startMapping", ";", "// method specific indexing\r", "long", "startInternalIndexing", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "indexVectorInternal", "(", "vector", ")", ";", "totalInternalVectorIndexingTime", "+=", "System", ".", "currentTimeMillis", "(", ")", "-", "startInternalIndexing", ";", "loadCounter", "++", ";", "// increase the loadCounter\r", "if", "(", "loadCounter", "%", "100", "==", "0", ")", "{", "// debug message\r", "System", ".", "out", ".", "println", "(", "new", "Date", "(", ")", "+", "\" # indexed vectors: \"", "+", "loadCounter", ")", ";", "}", "totalVectorIndexingTime", "+=", "System", ".", "currentTimeMillis", "(", ")", "-", "startIndexing", ";", "return", "true", ";", "}" ]
Updates the index with the given vector. This is a synchronized method, i.e. when a thread calls this method, all other threads wait for the first thread to complete before executing the method. This ensures that the persistent BDB store will remain consistent when multiple threads call the indexVector method. @param id The id of the vector @param vector The vector @return True if the vector is successfully indexed, false otherwise. @throws Exception
[ "Updates", "the", "index", "with", "the", "given", "vector", ".", "This", "is", "a", "synchronized", "method", "i", ".", "e", ".", "when", "a", "thread", "calls", "this", "method", "all", "other", "threads", "wait", "for", "the", "first", "thread", "to", "complete", "before", "executing", "the", "method", ".", "This", "ensures", "that", "the", "persistent", "BDB", "store", "will", "remain", "consistent", "when", "multiple", "threads", "call", "the", "indexVector", "method", "." ]
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/datastructures/AbstractSearchStructure.java#L229-L257
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_easyHunting_serviceName_hunting_agent_agentId_liveStatus_GET
public OvhOvhPabxHuntingAgentLiveStatus billingAccount_easyHunting_serviceName_hunting_agent_agentId_liveStatus_GET(String billingAccount, String serviceName, Long agentId) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}/liveStatus @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param agentId [required] """ String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}/liveStatus"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxHuntingAgentLiveStatus.class); }
java
public OvhOvhPabxHuntingAgentLiveStatus billingAccount_easyHunting_serviceName_hunting_agent_agentId_liveStatus_GET(String billingAccount, String serviceName, Long agentId) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}/liveStatus"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxHuntingAgentLiveStatus.class); }
[ "public", "OvhOvhPabxHuntingAgentLiveStatus", "billingAccount_easyHunting_serviceName_hunting_agent_agentId_liveStatus_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "agentId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}/liveStatus\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "agentId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOvhPabxHuntingAgentLiveStatus", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}/liveStatus @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param agentId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L2343-L2348
ujmp/universal-java-matrix-package
ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java
Ginv.addRowTimes
public static void addRowTimes(Matrix matrix, long diag, long fromCol, long row, double factor) { """ Add a factor times one row to another row @param matrix the matrix to modify @param diag coordinate on the diagonal @param fromCol first column to process @param row row to process @param factor factor to multiply """ long cols = matrix.getColumnCount(); for (long col = fromCol; col < cols; col++) { matrix.setAsDouble( matrix.getAsDouble(row, col) - factor * matrix.getAsDouble(diag, col), row, col); } }
java
public static void addRowTimes(Matrix matrix, long diag, long fromCol, long row, double factor) { long cols = matrix.getColumnCount(); for (long col = fromCol; col < cols; col++) { matrix.setAsDouble( matrix.getAsDouble(row, col) - factor * matrix.getAsDouble(diag, col), row, col); } }
[ "public", "static", "void", "addRowTimes", "(", "Matrix", "matrix", ",", "long", "diag", ",", "long", "fromCol", ",", "long", "row", ",", "double", "factor", ")", "{", "long", "cols", "=", "matrix", ".", "getColumnCount", "(", ")", ";", "for", "(", "long", "col", "=", "fromCol", ";", "col", "<", "cols", ";", "col", "++", ")", "{", "matrix", ".", "setAsDouble", "(", "matrix", ".", "getAsDouble", "(", "row", ",", "col", ")", "-", "factor", "*", "matrix", ".", "getAsDouble", "(", "diag", ",", "col", ")", ",", "row", ",", "col", ")", ";", "}", "}" ]
Add a factor times one row to another row @param matrix the matrix to modify @param diag coordinate on the diagonal @param fromCol first column to process @param row row to process @param factor factor to multiply
[ "Add", "a", "factor", "times", "one", "row", "to", "another", "row" ]
train
https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java#L654-L660
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsOuTree.java
CmsOuTree.getOuFromItem
private String getOuFromItem(Object itemId, I_CmsOuTreeType type) { """ Gets ou from given item.<p> @param itemId to get ou for @param type of given item @return name of ou """ if (type.equals(CmsOuTreeType.OU)) { return ((CmsOrganizationalUnit)itemId).getName(); } Object o = m_treeContainer.getParent(itemId); while (!(o instanceof CmsOrganizationalUnit)) { o = m_treeContainer.getParent(o); } return ((CmsOrganizationalUnit)o).getName(); }
java
private String getOuFromItem(Object itemId, I_CmsOuTreeType type) { if (type.equals(CmsOuTreeType.OU)) { return ((CmsOrganizationalUnit)itemId).getName(); } Object o = m_treeContainer.getParent(itemId); while (!(o instanceof CmsOrganizationalUnit)) { o = m_treeContainer.getParent(o); } return ((CmsOrganizationalUnit)o).getName(); }
[ "private", "String", "getOuFromItem", "(", "Object", "itemId", ",", "I_CmsOuTreeType", "type", ")", "{", "if", "(", "type", ".", "equals", "(", "CmsOuTreeType", ".", "OU", ")", ")", "{", "return", "(", "(", "CmsOrganizationalUnit", ")", "itemId", ")", ".", "getName", "(", ")", ";", "}", "Object", "o", "=", "m_treeContainer", ".", "getParent", "(", "itemId", ")", ";", "while", "(", "!", "(", "o", "instanceof", "CmsOrganizationalUnit", ")", ")", "{", "o", "=", "m_treeContainer", ".", "getParent", "(", "o", ")", ";", "}", "return", "(", "(", "CmsOrganizationalUnit", ")", "o", ")", ".", "getName", "(", ")", ";", "}" ]
Gets ou from given item.<p> @param itemId to get ou for @param type of given item @return name of ou
[ "Gets", "ou", "from", "given", "item", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsOuTree.java#L436-L446
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.logAccessErrorInternal
public void logAccessErrorInternal(Env<AttrContext> env, JCTree tree, Type type) { """ used by TransTypes when checking target type of synthetic cast """ AccessError error = new AccessError(env, env.enclClass.type, type.tsym); logResolveError(error, tree.pos(), env.enclClass.sym, env.enclClass.type, null, null, null); }
java
public void logAccessErrorInternal(Env<AttrContext> env, JCTree tree, Type type) { AccessError error = new AccessError(env, env.enclClass.type, type.tsym); logResolveError(error, tree.pos(), env.enclClass.sym, env.enclClass.type, null, null, null); }
[ "public", "void", "logAccessErrorInternal", "(", "Env", "<", "AttrContext", ">", "env", ",", "JCTree", "tree", ",", "Type", "type", ")", "{", "AccessError", "error", "=", "new", "AccessError", "(", "env", ",", "env", ".", "enclClass", ".", "type", ",", "type", ".", "tsym", ")", ";", "logResolveError", "(", "error", ",", "tree", ".", "pos", "(", ")", ",", "env", ".", "enclClass", ".", "sym", ",", "env", ".", "enclClass", ".", "type", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
used by TransTypes when checking target type of synthetic cast
[ "used", "by", "TransTypes", "when", "checking", "target", "type", "of", "synthetic", "cast" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L3644-L3647
eliwan/jfaker
mockito/src/main/java/be/eliwan/jfaker/mockito/FakerMock.java
FakerMock.withFields
public static <T> T withFields(Class<T> clazz, Object... keysAndValues) { """ Create a mock object with given field values. @param <T> return type @param clazz mock ype @param keysAndValues keys and values for the object. @return mock object """ return Mockito.mock(clazz, new FakerAnswer(keysAndValues)); }
java
public static <T> T withFields(Class<T> clazz, Object... keysAndValues) { return Mockito.mock(clazz, new FakerAnswer(keysAndValues)); }
[ "public", "static", "<", "T", ">", "T", "withFields", "(", "Class", "<", "T", ">", "clazz", ",", "Object", "...", "keysAndValues", ")", "{", "return", "Mockito", ".", "mock", "(", "clazz", ",", "new", "FakerAnswer", "(", "keysAndValues", ")", ")", ";", "}" ]
Create a mock object with given field values. @param <T> return type @param clazz mock ype @param keysAndValues keys and values for the object. @return mock object
[ "Create", "a", "mock", "object", "with", "given", "field", "values", "." ]
train
https://github.com/eliwan/jfaker/blob/e99cce7dadb5cd2c21f7ab64cf27c4fd1c08dae0/mockito/src/main/java/be/eliwan/jfaker/mockito/FakerMock.java#L30-L32
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java
JobSchedulesImpl.listNext
public PagedList<CloudJobSchedule> listNext(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) { """ Lists all of the job schedules in the specified account. @param nextPageLink The NextLink from the previous successful call to List operation. @param jobScheduleListNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;CloudJobSchedule&gt; object if successful. """ ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response = listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single(); return new PagedList<CloudJobSchedule>(response.body()) { @Override public Page<CloudJobSchedule> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single().body(); } }; }
java
public PagedList<CloudJobSchedule> listNext(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) { ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response = listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single(); return new PagedList<CloudJobSchedule>(response.body()) { @Override public Page<CloudJobSchedule> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "CloudJobSchedule", ">", "listNext", "(", "final", "String", "nextPageLink", ",", "final", "JobScheduleListNextOptions", "jobScheduleListNextOptions", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJobSchedule", ">", ",", "JobScheduleListHeaders", ">", "response", "=", "listNextSinglePageAsync", "(", "nextPageLink", ",", "jobScheduleListNextOptions", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ";", "return", "new", "PagedList", "<", "CloudJobSchedule", ">", "(", "response", ".", "body", "(", ")", ")", "{", "@", "Override", "public", "Page", "<", "CloudJobSchedule", ">", "nextPage", "(", "String", "nextPageLink", ")", "{", "return", "listNextSinglePageAsync", "(", "nextPageLink", ",", "jobScheduleListNextOptions", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}", "}", ";", "}" ]
Lists all of the job schedules in the specified account. @param nextPageLink The NextLink from the previous successful call to List operation. @param jobScheduleListNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;CloudJobSchedule&gt; object if successful.
[ "Lists", "all", "of", "the", "job", "schedules", "in", "the", "specified", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java#L2581-L2589
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/protocol/authentication/DefaultAuthenticationProvider.java
DefaultAuthenticationProvider.processAuthPlugin
public static AuthenticationPlugin processAuthPlugin(String plugin, String password, byte[] authData, Options options) throws SQLException { """ Process AuthenticationSwitch. @param plugin plugin name @param password password @param authData auth data @param options connection string options @return authentication response according to parameters @throws SQLException if error occur. """ switch (plugin) { case MYSQL_NATIVE_PASSWORD: return new NativePasswordPlugin(password, authData, options.passwordCharacterEncoding); case MYSQL_OLD_PASSWORD: return new OldPasswordPlugin(password, authData); case MYSQL_CLEAR_PASSWORD: return new ClearPasswordPlugin(password, options.passwordCharacterEncoding); case DIALOG: return new SendPamAuthPacket(password, authData, options.passwordCharacterEncoding); case GSSAPI_CLIENT: return new SendGssApiAuthPacket(authData, options.servicePrincipalName); case MYSQL_ED25519_PASSWORD: return new Ed25519PasswordPlugin(password, authData, options.passwordCharacterEncoding); default: throw new SQLException( "Client does not support authentication protocol requested by server. " + "Consider upgrading MariaDB client. plugin was = " + plugin, "08004", 1251); } }
java
public static AuthenticationPlugin processAuthPlugin(String plugin, String password, byte[] authData, Options options) throws SQLException { switch (plugin) { case MYSQL_NATIVE_PASSWORD: return new NativePasswordPlugin(password, authData, options.passwordCharacterEncoding); case MYSQL_OLD_PASSWORD: return new OldPasswordPlugin(password, authData); case MYSQL_CLEAR_PASSWORD: return new ClearPasswordPlugin(password, options.passwordCharacterEncoding); case DIALOG: return new SendPamAuthPacket(password, authData, options.passwordCharacterEncoding); case GSSAPI_CLIENT: return new SendGssApiAuthPacket(authData, options.servicePrincipalName); case MYSQL_ED25519_PASSWORD: return new Ed25519PasswordPlugin(password, authData, options.passwordCharacterEncoding); default: throw new SQLException( "Client does not support authentication protocol requested by server. " + "Consider upgrading MariaDB client. plugin was = " + plugin, "08004", 1251); } }
[ "public", "static", "AuthenticationPlugin", "processAuthPlugin", "(", "String", "plugin", ",", "String", "password", ",", "byte", "[", "]", "authData", ",", "Options", "options", ")", "throws", "SQLException", "{", "switch", "(", "plugin", ")", "{", "case", "MYSQL_NATIVE_PASSWORD", ":", "return", "new", "NativePasswordPlugin", "(", "password", ",", "authData", ",", "options", ".", "passwordCharacterEncoding", ")", ";", "case", "MYSQL_OLD_PASSWORD", ":", "return", "new", "OldPasswordPlugin", "(", "password", ",", "authData", ")", ";", "case", "MYSQL_CLEAR_PASSWORD", ":", "return", "new", "ClearPasswordPlugin", "(", "password", ",", "options", ".", "passwordCharacterEncoding", ")", ";", "case", "DIALOG", ":", "return", "new", "SendPamAuthPacket", "(", "password", ",", "authData", ",", "options", ".", "passwordCharacterEncoding", ")", ";", "case", "GSSAPI_CLIENT", ":", "return", "new", "SendGssApiAuthPacket", "(", "authData", ",", "options", ".", "servicePrincipalName", ")", ";", "case", "MYSQL_ED25519_PASSWORD", ":", "return", "new", "Ed25519PasswordPlugin", "(", "password", ",", "authData", ",", "options", ".", "passwordCharacterEncoding", ")", ";", "default", ":", "throw", "new", "SQLException", "(", "\"Client does not support authentication protocol requested by server. \"", "+", "\"Consider upgrading MariaDB client. plugin was = \"", "+", "plugin", ",", "\"08004\"", ",", "1251", ")", ";", "}", "}" ]
Process AuthenticationSwitch. @param plugin plugin name @param password password @param authData auth data @param options connection string options @return authentication response according to parameters @throws SQLException if error occur.
[ "Process", "AuthenticationSwitch", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/authentication/DefaultAuthenticationProvider.java#L86-L110
dashorst/wicket-stuff-markup-validator
jing/src/main/java/com/thaiopensource/xml/util/Name.java
Name.compare
static public int compare(Name n1, Name n2) { """ We include this, but don't derive from Comparator<Name> to avoid a dependency on Java 5. """ int ret = n1.namespaceUri.compareTo(n2.namespaceUri); if (ret != 0) return ret; return n1.localName.compareTo(n2.localName); }
java
static public int compare(Name n1, Name n2) { int ret = n1.namespaceUri.compareTo(n2.namespaceUri); if (ret != 0) return ret; return n1.localName.compareTo(n2.localName); }
[ "static", "public", "int", "compare", "(", "Name", "n1", ",", "Name", "n2", ")", "{", "int", "ret", "=", "n1", ".", "namespaceUri", ".", "compareTo", "(", "n2", ".", "namespaceUri", ")", ";", "if", "(", "ret", "!=", "0", ")", "return", "ret", ";", "return", "n1", ".", "localName", ".", "compareTo", "(", "n2", ".", "localName", ")", ";", "}" ]
We include this, but don't derive from Comparator<Name> to avoid a dependency on Java 5.
[ "We", "include", "this", "but", "don", "t", "derive", "from", "Comparator<Name", ">", "to", "avoid", "a", "dependency", "on", "Java", "5", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/xml/util/Name.java#L36-L41
pip-services3-java/pip-services3-components-java
src/org/pipservices3/components/log/CompositeLogger.java
CompositeLogger.setReferences
@Override public void setReferences(IReferences references) { """ Sets references to dependent components. @param references references to locate the component dependencies. """ List<Object> loggers = references.getOptional(new Descriptor(null, "logger", null, null, null)); for (Object logger : loggers) { if (logger instanceof ILogger && logger != this) _loggers.add((ILogger) logger); } }
java
@Override public void setReferences(IReferences references) { List<Object> loggers = references.getOptional(new Descriptor(null, "logger", null, null, null)); for (Object logger : loggers) { if (logger instanceof ILogger && logger != this) _loggers.add((ILogger) logger); } }
[ "@", "Override", "public", "void", "setReferences", "(", "IReferences", "references", ")", "{", "List", "<", "Object", ">", "loggers", "=", "references", ".", "getOptional", "(", "new", "Descriptor", "(", "null", ",", "\"logger\"", ",", "null", ",", "null", ",", "null", ")", ")", ";", "for", "(", "Object", "logger", ":", "loggers", ")", "{", "if", "(", "logger", "instanceof", "ILogger", "&&", "logger", "!=", "this", ")", "_loggers", ".", "add", "(", "(", "ILogger", ")", "logger", ")", ";", "}", "}" ]
Sets references to dependent components. @param references references to locate the component dependencies.
[ "Sets", "references", "to", "dependent", "components", "." ]
train
https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/log/CompositeLogger.java#L66-L74
teatrove/teatrove
build-tools/teacompiler/teacompiler-maven-plugin/src/main/java/org/teatrove/maven/plugins/teacompiler/contextclassbuilder/DefaultContextClassBuilderHelper.java
DefaultContextClassBuilderHelper.getComponent
public Object getComponent(String role, String roleHint) throws ComponentLookupException { """ Gets the component. @param role the role @param roleHint the role hint @return the component @throws org.codehaus.plexus.component.repository.exception.ComponentLookupException the component lookup exception """ return container.lookup(role, roleHint); }
java
public Object getComponent(String role, String roleHint) throws ComponentLookupException { return container.lookup(role, roleHint); }
[ "public", "Object", "getComponent", "(", "String", "role", ",", "String", "roleHint", ")", "throws", "ComponentLookupException", "{", "return", "container", ".", "lookup", "(", "role", ",", "roleHint", ")", ";", "}" ]
Gets the component. @param role the role @param roleHint the role hint @return the component @throws org.codehaus.plexus.component.repository.exception.ComponentLookupException the component lookup exception
[ "Gets", "the", "component", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/teacompiler/teacompiler-maven-plugin/src/main/java/org/teatrove/maven/plugins/teacompiler/contextclassbuilder/DefaultContextClassBuilderHelper.java#L157-L159
NoraUi/NoraUi
src/main/java/com/github/noraui/data/excel/ExcelDataProvider.java
ExcelDataProvider.readCellByType
private String readCellByType(Cell cell, CellType type) { """ readCellByType is used because CELL_TYPE_FORMULA can be CELL_TYPE_NUMERIC, CELL_TYPE_NUMERIC(date) or CELL_TYPE_STRING. @param cellcell read (line and column) @param type CELL_TYPE_FORMULA can be CELL_TYPE_NUMERIC, CELL_TYPE_NUMERIC(date) or CELL_TYPE_STRING @return a string with the data (evalued if CELL_TYPE_FORMULA) """ String txt = ""; if (cell != null) { switch (type) { case NUMERIC: txt = dateOrNumberProcessing(cell); break; case STRING: txt = String.valueOf(cell.getRichStringCellValue()); logger.debug("CELL_TYPE_STRING: {}", txt); break; case FORMULA: txt = readCellByType(cell, cell.getCachedFormulaResultTypeEnum()); logger.debug("CELL_TYPE_FORMULA: {}", txt); break; case BLANK: logger.debug("CELL_TYPE_BLANK (we do nothing)"); break; default: logger.error(Messages.getMessage(EXCEL_DATA_PROVIDER_WRONG_CELL_TYPE_ERROR_MESSAGE), type); break; } } return txt; }
java
private String readCellByType(Cell cell, CellType type) { String txt = ""; if (cell != null) { switch (type) { case NUMERIC: txt = dateOrNumberProcessing(cell); break; case STRING: txt = String.valueOf(cell.getRichStringCellValue()); logger.debug("CELL_TYPE_STRING: {}", txt); break; case FORMULA: txt = readCellByType(cell, cell.getCachedFormulaResultTypeEnum()); logger.debug("CELL_TYPE_FORMULA: {}", txt); break; case BLANK: logger.debug("CELL_TYPE_BLANK (we do nothing)"); break; default: logger.error(Messages.getMessage(EXCEL_DATA_PROVIDER_WRONG_CELL_TYPE_ERROR_MESSAGE), type); break; } } return txt; }
[ "private", "String", "readCellByType", "(", "Cell", "cell", ",", "CellType", "type", ")", "{", "String", "txt", "=", "\"\"", ";", "if", "(", "cell", "!=", "null", ")", "{", "switch", "(", "type", ")", "{", "case", "NUMERIC", ":", "txt", "=", "dateOrNumberProcessing", "(", "cell", ")", ";", "break", ";", "case", "STRING", ":", "txt", "=", "String", ".", "valueOf", "(", "cell", ".", "getRichStringCellValue", "(", ")", ")", ";", "logger", ".", "debug", "(", "\"CELL_TYPE_STRING: {}\"", ",", "txt", ")", ";", "break", ";", "case", "FORMULA", ":", "txt", "=", "readCellByType", "(", "cell", ",", "cell", ".", "getCachedFormulaResultTypeEnum", "(", ")", ")", ";", "logger", ".", "debug", "(", "\"CELL_TYPE_FORMULA: {}\"", ",", "txt", ")", ";", "break", ";", "case", "BLANK", ":", "logger", ".", "debug", "(", "\"CELL_TYPE_BLANK (we do nothing)\"", ")", ";", "break", ";", "default", ":", "logger", ".", "error", "(", "Messages", ".", "getMessage", "(", "EXCEL_DATA_PROVIDER_WRONG_CELL_TYPE_ERROR_MESSAGE", ")", ",", "type", ")", ";", "break", ";", "}", "}", "return", "txt", ";", "}" ]
readCellByType is used because CELL_TYPE_FORMULA can be CELL_TYPE_NUMERIC, CELL_TYPE_NUMERIC(date) or CELL_TYPE_STRING. @param cellcell read (line and column) @param type CELL_TYPE_FORMULA can be CELL_TYPE_NUMERIC, CELL_TYPE_NUMERIC(date) or CELL_TYPE_STRING @return a string with the data (evalued if CELL_TYPE_FORMULA)
[ "readCellByType", "is", "used", "because", "CELL_TYPE_FORMULA", "can", "be", "CELL_TYPE_NUMERIC", "CELL_TYPE_NUMERIC", "(", "date", ")", "or", "CELL_TYPE_STRING", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/data/excel/ExcelDataProvider.java#L294-L318
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/Condition.java
Condition.buildValuePartForIN
private void buildValuePartForIN(StringBuilder conditionStrBuilder, List<Object> paramValues) { """ 构建IN语句中的值部分<br> 开头必须加空格,类似:" (?,?,?)" 或者 " (1,2,3,4)" @param conditionStrBuilder 条件语句构建器 @param paramValues 参数集合,用于参数占位符对应参数回填 """ conditionStrBuilder.append(" ("); final Object value = this.value; if (isPlaceHolder()) { List<?> valuesForIn; // 占位符对应值列表 if (value instanceof CharSequence) { valuesForIn = StrUtil.split((CharSequence) value, ','); } else { valuesForIn = Arrays.asList(Convert.convert(String[].class, value)); if (null == valuesForIn) { valuesForIn = CollUtil.newArrayList(Convert.toStr(value)); } } conditionStrBuilder.append(StrUtil.repeatAndJoin("?", valuesForIn.size(), ",")); if(null != paramValues) { paramValues.addAll(valuesForIn); } } else { conditionStrBuilder.append(StrUtil.join(",", value)); } conditionStrBuilder.append(')'); }
java
private void buildValuePartForIN(StringBuilder conditionStrBuilder, List<Object> paramValues) { conditionStrBuilder.append(" ("); final Object value = this.value; if (isPlaceHolder()) { List<?> valuesForIn; // 占位符对应值列表 if (value instanceof CharSequence) { valuesForIn = StrUtil.split((CharSequence) value, ','); } else { valuesForIn = Arrays.asList(Convert.convert(String[].class, value)); if (null == valuesForIn) { valuesForIn = CollUtil.newArrayList(Convert.toStr(value)); } } conditionStrBuilder.append(StrUtil.repeatAndJoin("?", valuesForIn.size(), ",")); if(null != paramValues) { paramValues.addAll(valuesForIn); } } else { conditionStrBuilder.append(StrUtil.join(",", value)); } conditionStrBuilder.append(')'); }
[ "private", "void", "buildValuePartForIN", "(", "StringBuilder", "conditionStrBuilder", ",", "List", "<", "Object", ">", "paramValues", ")", "{", "conditionStrBuilder", ".", "append", "(", "\" (\"", ")", ";", "final", "Object", "value", "=", "this", ".", "value", ";", "if", "(", "isPlaceHolder", "(", ")", ")", "{", "List", "<", "?", ">", "valuesForIn", ";", "// 占位符对应值列表\r", "if", "(", "value", "instanceof", "CharSequence", ")", "{", "valuesForIn", "=", "StrUtil", ".", "split", "(", "(", "CharSequence", ")", "value", ",", "'", "'", ")", ";", "}", "else", "{", "valuesForIn", "=", "Arrays", ".", "asList", "(", "Convert", ".", "convert", "(", "String", "[", "]", ".", "class", ",", "value", ")", ")", ";", "if", "(", "null", "==", "valuesForIn", ")", "{", "valuesForIn", "=", "CollUtil", ".", "newArrayList", "(", "Convert", ".", "toStr", "(", "value", ")", ")", ";", "}", "}", "conditionStrBuilder", ".", "append", "(", "StrUtil", ".", "repeatAndJoin", "(", "\"?\"", ",", "valuesForIn", ".", "size", "(", ")", ",", "\",\"", ")", ")", ";", "if", "(", "null", "!=", "paramValues", ")", "{", "paramValues", ".", "addAll", "(", "valuesForIn", ")", ";", "}", "}", "else", "{", "conditionStrBuilder", ".", "append", "(", "StrUtil", ".", "join", "(", "\",\"", ",", "value", ")", ")", ";", "}", "conditionStrBuilder", ".", "append", "(", "'", "'", ")", ";", "}" ]
构建IN语句中的值部分<br> 开头必须加空格,类似:" (?,?,?)" 或者 " (1,2,3,4)" @param conditionStrBuilder 条件语句构建器 @param paramValues 参数集合,用于参数占位符对应参数回填
[ "构建IN语句中的值部分<br", ">", "开头必须加空格,类似:", "(", "?", "?", "?", ")", "或者", "(", "1", "2", "3", "4", ")" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/Condition.java#L354-L376
stevespringett/Alpine
alpine/src/main/java/alpine/util/HttpUtil.java
HttpUtil.getRequestAttribute
@SuppressWarnings("unchecked") public static <T> T getRequestAttribute(final HttpServletRequest request, final String key) { """ Returns a request attribute as the type of object stored. @param request request of the attribute @param key the attributes key @param <T> the type of the object expected @return the requested object @since 1.0.0 """ if (request != null) { return (T) request.getAttribute(key); } return null; }
java
@SuppressWarnings("unchecked") public static <T> T getRequestAttribute(final HttpServletRequest request, final String key) { if (request != null) { return (T) request.getAttribute(key); } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getRequestAttribute", "(", "final", "HttpServletRequest", "request", ",", "final", "String", "key", ")", "{", "if", "(", "request", "!=", "null", ")", "{", "return", "(", "T", ")", "request", ".", "getAttribute", "(", "key", ")", ";", "}", "return", "null", ";", "}" ]
Returns a request attribute as the type of object stored. @param request request of the attribute @param key the attributes key @param <T> the type of the object expected @return the requested object @since 1.0.0
[ "Returns", "a", "request", "attribute", "as", "the", "type", "of", "object", "stored", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/util/HttpUtil.java#L58-L64
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/util/FieldInitializer.java
FieldInitializer.initFromSystemProperties
static public void initFromSystemProperties(Object o, Properties prop) { """ /* initFromProperties - initializes fields (static and non-static) in an Object based on system properties. For example, given Object o of class com.company.Foo with field cacheSize. The following system property would change the field -Dcom.company.Foo.cacheSize=100 """ updateFieldsFromProperties(o.getClass(), o, prop); }
java
static public void initFromSystemProperties(Object o, Properties prop) { updateFieldsFromProperties(o.getClass(), o, prop); }
[ "static", "public", "void", "initFromSystemProperties", "(", "Object", "o", ",", "Properties", "prop", ")", "{", "updateFieldsFromProperties", "(", "o", ".", "getClass", "(", ")", ",", "o", ",", "prop", ")", ";", "}" ]
/* initFromProperties - initializes fields (static and non-static) in an Object based on system properties. For example, given Object o of class com.company.Foo with field cacheSize. The following system property would change the field -Dcom.company.Foo.cacheSize=100
[ "/", "*", "initFromProperties", "-", "initializes", "fields", "(", "static", "and", "non", "-", "static", ")", "in", "an", "Object", "based", "on", "system", "properties", ".", "For", "example", "given", "Object", "o", "of", "class", "com", ".", "company", ".", "Foo", "with", "field", "cacheSize", ".", "The", "following", "system", "property", "would", "change", "the", "field", "-", "Dcom", ".", "company", ".", "Foo", ".", "cacheSize", "=", "100" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/util/FieldInitializer.java#L58-L60
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/util/DateUtilities.java
DateUtilities.isBetweenHours
public static boolean isBetweenHours(long dt, TimeZone tz, int from, int to) { """ Returns <CODE>true</CODE> if the given date is inside the start and end hours. @param dt The date to be checked @param from The start hour to check that the date is after @param to The end hour to check that the date is before @param tz The timezone associated with the date @return <CODE>true</CODE> if the given date is inside the start and end hours """ return isBetweenHours(dt, tz, from, to, 0); }
java
public static boolean isBetweenHours(long dt, TimeZone tz, int from, int to) { return isBetweenHours(dt, tz, from, to, 0); }
[ "public", "static", "boolean", "isBetweenHours", "(", "long", "dt", ",", "TimeZone", "tz", ",", "int", "from", ",", "int", "to", ")", "{", "return", "isBetweenHours", "(", "dt", ",", "tz", ",", "from", ",", "to", ",", "0", ")", ";", "}" ]
Returns <CODE>true</CODE> if the given date is inside the start and end hours. @param dt The date to be checked @param from The start hour to check that the date is after @param to The end hour to check that the date is before @param tz The timezone associated with the date @return <CODE>true</CODE> if the given date is inside the start and end hours
[ "Returns", "<CODE", ">", "true<", "/", "CODE", ">", "if", "the", "given", "date", "is", "inside", "the", "start", "and", "end", "hours", "." ]
train
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/DateUtilities.java#L162-L165
UrielCh/ovh-java-sdk
ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java
ApiOvhMsServices.serviceName_account_userPrincipalName_sharepoint_PUT
public void serviceName_account_userPrincipalName_sharepoint_PUT(String serviceName, String userPrincipalName, OvhSharepointInformation body) throws IOException { """ Alter this object properties REST: PUT /msServices/{serviceName}/account/{userPrincipalName}/sharepoint @param body [required] New object properties @param serviceName [required] The internal name of your Active Directory organization @param userPrincipalName [required] User Principal Name API beta """ String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sharepoint"; StringBuilder sb = path(qPath, serviceName, userPrincipalName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_account_userPrincipalName_sharepoint_PUT(String serviceName, String userPrincipalName, OvhSharepointInformation body) throws IOException { String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sharepoint"; StringBuilder sb = path(qPath, serviceName, userPrincipalName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_account_userPrincipalName_sharepoint_PUT", "(", "String", "serviceName", ",", "String", "userPrincipalName", ",", "OvhSharepointInformation", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/msServices/{serviceName}/account/{userPrincipalName}/sharepoint\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "userPrincipalName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /msServices/{serviceName}/account/{userPrincipalName}/sharepoint @param body [required] New object properties @param serviceName [required] The internal name of your Active Directory organization @param userPrincipalName [required] User Principal Name API beta
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java#L339-L343
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CciConnFactoryCodeGen.java
CciConnFactoryCodeGen.writeConnection
private void writeConnection(Definition def, Writer out, int indent) throws IOException { """ Output Connection method @param def definition @param out Writer @param indent space number @throws IOException ioException """ writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Gets a connection to an EIS instance. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Connection instance the EIS instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get a connection to\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public Connection getConnection() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return new " + def.getMcfDefs().get(getNumOfMcf()).getCciConnClass() + "(new " + def.getMcfDefs() .get(getNumOfMcf()).getConnSpecClass() + "());"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Gets a connection to an EIS instance. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param connSpec Connection parameters and security information specified as " + "ConnectionSpec instance\n"); writeWithIndent(out, indent, " * @return Connection instance the EIS instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get a connection to\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public Connection getConnection(ConnectionSpec connSpec) throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return new " + def.getMcfDefs().get(getNumOfMcf()).getCciConnClass() + "(connSpec);"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeConnection(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Gets a connection to an EIS instance. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Connection instance the EIS instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get a connection to\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public Connection getConnection() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return new " + def.getMcfDefs().get(getNumOfMcf()).getCciConnClass() + "(new " + def.getMcfDefs() .get(getNumOfMcf()).getConnSpecClass() + "());"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Gets a connection to an EIS instance. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param connSpec Connection parameters and security information specified as " + "ConnectionSpec instance\n"); writeWithIndent(out, indent, " * @return Connection instance the EIS instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get a connection to\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public Connection getConnection(ConnectionSpec connSpec) throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return new " + def.getMcfDefs().get(getNumOfMcf()).getCciConnClass() + "(connSpec);"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeConnection", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * Gets a connection to an EIS instance. \\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" *\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @return Connection instance the EIS instance.\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @throws ResourceException Failed to get a connection to\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"@Override\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"public Connection getConnection() throws ResourceException\"", ")", ";", "writeLeftCurlyBracket", "(", "out", ",", "indent", ")", ";", "writeWithIndent", "(", "out", ",", "indent", "+", "1", ",", "\"return new \"", "+", "def", ".", "getMcfDefs", "(", ")", ".", "get", "(", "getNumOfMcf", "(", ")", ")", ".", "getCciConnClass", "(", ")", "+", "\"(new \"", "+", "def", ".", "getMcfDefs", "(", ")", ".", "get", "(", "getNumOfMcf", "(", ")", ")", ".", "getConnSpecClass", "(", ")", "+", "\"());\"", ")", ";", "writeRightCurlyBracket", "(", "out", ",", "indent", ")", ";", "writeEol", "(", "out", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * Gets a connection to an EIS instance. \\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" *\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @param connSpec Connection parameters and security information specified as \"", "+", "\"ConnectionSpec instance\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @return Connection instance the EIS instance.\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @throws ResourceException Failed to get a connection to\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"@Override\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"public Connection getConnection(ConnectionSpec connSpec) throws ResourceException\"", ")", ";", "writeLeftCurlyBracket", "(", "out", ",", "indent", ")", ";", "writeWithIndent", "(", "out", ",", "indent", "+", "1", ",", "\"return new \"", "+", "def", ".", "getMcfDefs", "(", ")", ".", "get", "(", "getNumOfMcf", "(", ")", ")", ".", "getCciConnClass", "(", ")", "+", "\"(connSpec);\"", ")", ";", "writeRightCurlyBracket", "(", "out", ",", "indent", ")", ";", "writeEol", "(", "out", ")", ";", "}" ]
Output Connection method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "Connection", "method" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CciConnFactoryCodeGen.java#L117-L153
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicatedCloud_serviceName_filer_GET
public ArrayList<String> dedicatedCloud_serviceName_filer_GET(String serviceName, Long datacenterId, String name, Long quantity) throws IOException { """ Get allowed durations for 'filer' option REST: GET /order/dedicatedCloud/{serviceName}/filer @param name [required] Filer profile you want to order ("name" field in a profile returned by /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/orderableFilerProfiles) @param quantity [required] Quantity of filer you want to order (default 1) @param datacenterId [required] Datacenter where the filer will be mounted (if not precised, will be mounted in each Datacenter of this Private Cloud) @param serviceName [required] """ String qPath = "/order/dedicatedCloud/{serviceName}/filer"; StringBuilder sb = path(qPath, serviceName); query(sb, "datacenterId", datacenterId); query(sb, "name", name); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> dedicatedCloud_serviceName_filer_GET(String serviceName, Long datacenterId, String name, Long quantity) throws IOException { String qPath = "/order/dedicatedCloud/{serviceName}/filer"; StringBuilder sb = path(qPath, serviceName); query(sb, "datacenterId", datacenterId); query(sb, "name", name); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "dedicatedCloud_serviceName_filer_GET", "(", "String", "serviceName", ",", "Long", "datacenterId", ",", "String", "name", ",", "Long", "quantity", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/dedicatedCloud/{serviceName}/filer\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"datacenterId\"", ",", "datacenterId", ")", ";", "query", "(", "sb", ",", "\"name\"", ",", "name", ")", ";", "query", "(", "sb", ",", "\"quantity\"", ",", "quantity", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
Get allowed durations for 'filer' option REST: GET /order/dedicatedCloud/{serviceName}/filer @param name [required] Filer profile you want to order ("name" field in a profile returned by /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/orderableFilerProfiles) @param quantity [required] Quantity of filer you want to order (default 1) @param datacenterId [required] Datacenter where the filer will be mounted (if not precised, will be mounted in each Datacenter of this Private Cloud) @param serviceName [required]
[ "Get", "allowed", "durations", "for", "filer", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5541-L5549
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/conversation/Conversation.java
Conversation.getApplicableInteraction
public Interaction getApplicableInteraction(String eventLabel, boolean verbose) { """ Returns an Interaction for <code>eventLabel</code> if there is one that can be displayed. """ String targetsString = getTargets(); if (targetsString != null) { try { Targets targets = new Targets(getTargets()); String interactionId = targets.getApplicableInteraction(eventLabel, verbose); if (interactionId != null) { String interactionsString = getInteractions(); if (interactionsString != null) { Interactions interactions = new Interactions(interactionsString); return interactions.getInteraction(interactionId); } } } catch (JSONException e) { ApptentiveLog.e(INTERACTIONS, e, "Exception while getting applicable interaction: %s", eventLabel); logException(e); } } return null; }
java
public Interaction getApplicableInteraction(String eventLabel, boolean verbose) { String targetsString = getTargets(); if (targetsString != null) { try { Targets targets = new Targets(getTargets()); String interactionId = targets.getApplicableInteraction(eventLabel, verbose); if (interactionId != null) { String interactionsString = getInteractions(); if (interactionsString != null) { Interactions interactions = new Interactions(interactionsString); return interactions.getInteraction(interactionId); } } } catch (JSONException e) { ApptentiveLog.e(INTERACTIONS, e, "Exception while getting applicable interaction: %s", eventLabel); logException(e); } } return null; }
[ "public", "Interaction", "getApplicableInteraction", "(", "String", "eventLabel", ",", "boolean", "verbose", ")", "{", "String", "targetsString", "=", "getTargets", "(", ")", ";", "if", "(", "targetsString", "!=", "null", ")", "{", "try", "{", "Targets", "targets", "=", "new", "Targets", "(", "getTargets", "(", ")", ")", ";", "String", "interactionId", "=", "targets", ".", "getApplicableInteraction", "(", "eventLabel", ",", "verbose", ")", ";", "if", "(", "interactionId", "!=", "null", ")", "{", "String", "interactionsString", "=", "getInteractions", "(", ")", ";", "if", "(", "interactionsString", "!=", "null", ")", "{", "Interactions", "interactions", "=", "new", "Interactions", "(", "interactionsString", ")", ";", "return", "interactions", ".", "getInteraction", "(", "interactionId", ")", ";", "}", "}", "}", "catch", "(", "JSONException", "e", ")", "{", "ApptentiveLog", ".", "e", "(", "INTERACTIONS", ",", "e", ",", "\"Exception while getting applicable interaction: %s\"", ",", "eventLabel", ")", ";", "logException", "(", "e", ")", ";", "}", "}", "return", "null", ";", "}" ]
Returns an Interaction for <code>eventLabel</code> if there is one that can be displayed.
[ "Returns", "an", "Interaction", "for", "<code", ">", "eventLabel<", "/", "code", ">", "if", "there", "is", "one", "that", "can", "be", "displayed", "." ]
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/conversation/Conversation.java#L197-L216
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java
AbstractNewSarlElementWizardPage.isSarlFile
protected boolean isSarlFile(IPackageFragment packageFragment, String filename) { """ Replies if the given filename is a SARL script or a generated Java file. @param packageFragment the package in which the file should be search for. @param filename the filename to test. @return <code>true</code> if a file (SALR or Java) with the given name exists. """ if (isFileExists(packageFragment, filename, this.sarlFileExtension)) { return true; } final IJavaProject project = getPackageFragmentRoot().getJavaProject(); if (project != null) { try { final String packageName = packageFragment.getElementName(); for (final IPackageFragmentRoot root : project.getPackageFragmentRoots()) { final IPackageFragment fragment = root.getPackageFragment(packageName); if (isFileExists(fragment, filename, JAVA_FILE_EXTENSION)) { return true; } } } catch (JavaModelException exception) { // silent error } } return false; }
java
protected boolean isSarlFile(IPackageFragment packageFragment, String filename) { if (isFileExists(packageFragment, filename, this.sarlFileExtension)) { return true; } final IJavaProject project = getPackageFragmentRoot().getJavaProject(); if (project != null) { try { final String packageName = packageFragment.getElementName(); for (final IPackageFragmentRoot root : project.getPackageFragmentRoots()) { final IPackageFragment fragment = root.getPackageFragment(packageName); if (isFileExists(fragment, filename, JAVA_FILE_EXTENSION)) { return true; } } } catch (JavaModelException exception) { // silent error } } return false; }
[ "protected", "boolean", "isSarlFile", "(", "IPackageFragment", "packageFragment", ",", "String", "filename", ")", "{", "if", "(", "isFileExists", "(", "packageFragment", ",", "filename", ",", "this", ".", "sarlFileExtension", ")", ")", "{", "return", "true", ";", "}", "final", "IJavaProject", "project", "=", "getPackageFragmentRoot", "(", ")", ".", "getJavaProject", "(", ")", ";", "if", "(", "project", "!=", "null", ")", "{", "try", "{", "final", "String", "packageName", "=", "packageFragment", ".", "getElementName", "(", ")", ";", "for", "(", "final", "IPackageFragmentRoot", "root", ":", "project", ".", "getPackageFragmentRoots", "(", ")", ")", "{", "final", "IPackageFragment", "fragment", "=", "root", ".", "getPackageFragment", "(", "packageName", ")", ";", "if", "(", "isFileExists", "(", "fragment", ",", "filename", ",", "JAVA_FILE_EXTENSION", ")", ")", "{", "return", "true", ";", "}", "}", "}", "catch", "(", "JavaModelException", "exception", ")", "{", "// silent error", "}", "}", "return", "false", ";", "}" ]
Replies if the given filename is a SARL script or a generated Java file. @param packageFragment the package in which the file should be search for. @param filename the filename to test. @return <code>true</code> if a file (SALR or Java) with the given name exists.
[ "Replies", "if", "the", "given", "filename", "is", "a", "SARL", "script", "or", "a", "generated", "Java", "file", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L347-L366
JM-Lab/utils-java8
src/main/java/kr/jm/utils/datastructure/JMMap.java
JMMap.newFilteredChangedKeyWithEntryMap
public static <K, V, NK> Map<NK, V> newFilteredChangedKeyWithEntryMap( Map<K, V> map, Predicate<? super Entry<K, V>> filter, Function<Entry<K, V>, NK> changingKeyFunction) { """ New filtered changed key with entry map map. @param <K> the type parameter @param <V> the type parameter @param <NK> the type parameter @param map the map @param filter the filter @param changingKeyFunction the changing key function @return the map """ return getEntryStreamWithFilter(map, filter).collect( toMap(changingKeyFunction, Entry::getValue)); }
java
public static <K, V, NK> Map<NK, V> newFilteredChangedKeyWithEntryMap( Map<K, V> map, Predicate<? super Entry<K, V>> filter, Function<Entry<K, V>, NK> changingKeyFunction) { return getEntryStreamWithFilter(map, filter).collect( toMap(changingKeyFunction, Entry::getValue)); }
[ "public", "static", "<", "K", ",", "V", ",", "NK", ">", "Map", "<", "NK", ",", "V", ">", "newFilteredChangedKeyWithEntryMap", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "Predicate", "<", "?", "super", "Entry", "<", "K", ",", "V", ">", ">", "filter", ",", "Function", "<", "Entry", "<", "K", ",", "V", ">", ",", "NK", ">", "changingKeyFunction", ")", "{", "return", "getEntryStreamWithFilter", "(", "map", ",", "filter", ")", ".", "collect", "(", "toMap", "(", "changingKeyFunction", ",", "Entry", "::", "getValue", ")", ")", ";", "}" ]
New filtered changed key with entry map map. @param <K> the type parameter @param <V> the type parameter @param <NK> the type parameter @param map the map @param filter the filter @param changingKeyFunction the changing key function @return the map
[ "New", "filtered", "changed", "key", "with", "entry", "map", "map", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/datastructure/JMMap.java#L214-L219
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newNoAvailablePortException
public static NoAvailablePortException newNoAvailablePortException(String message, Object... args) { """ Constructs and initializes a new {@link NoAvailablePortException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link NoAvailablePortException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link NoAvailablePortException} with the given {@link String message}. @see #newNoAvailablePortException(Throwable, String, Object...) @see org.cp.elements.net.NoAvailablePortException """ return newNoAvailablePortException(null, message, args); }
java
public static NoAvailablePortException newNoAvailablePortException(String message, Object... args) { return newNoAvailablePortException(null, message, args); }
[ "public", "static", "NoAvailablePortException", "newNoAvailablePortException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newNoAvailablePortException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link NoAvailablePortException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link NoAvailablePortException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link NoAvailablePortException} with the given {@link String message}. @see #newNoAvailablePortException(Throwable, String, Object...) @see org.cp.elements.net.NoAvailablePortException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "NoAvailablePortException", "}", "with", "the", "given", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", "[]", "arguments", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L555-L557
frostwire/frostwire-jlibtorrent
src/main/java/com/frostwire/jlibtorrent/TorrentInfo.java
TorrentInfo.addUrlSeed
public void addUrlSeed(String url, String externAuth, List<Pair<String, String>> extraHeaders) { """ Adds one url to the list of url seeds. Currently, the only transport protocol supported for the url is http. <p> The {@code externAuth} argument can be used for other authorization schemes than basic HTTP authorization. If set, it will override any username and password found in the URL itself. The string will be sent as the HTTP authorization header's value (without specifying "Basic"). <p> The {@code extraHeaders} argument can be used to insert custom HTTP headers in the requests to a specific web seed. @param url @param externAuth @param extraHeaders """ string_string_pair_vector v = new string_string_pair_vector(); for (Pair<String, String> p : extraHeaders) { v.push_back(p.to_string_string_pair()); } ti.add_url_seed(url, externAuth, v); }
java
public void addUrlSeed(String url, String externAuth, List<Pair<String, String>> extraHeaders) { string_string_pair_vector v = new string_string_pair_vector(); for (Pair<String, String> p : extraHeaders) { v.push_back(p.to_string_string_pair()); } ti.add_url_seed(url, externAuth, v); }
[ "public", "void", "addUrlSeed", "(", "String", "url", ",", "String", "externAuth", ",", "List", "<", "Pair", "<", "String", ",", "String", ">", ">", "extraHeaders", ")", "{", "string_string_pair_vector", "v", "=", "new", "string_string_pair_vector", "(", ")", ";", "for", "(", "Pair", "<", "String", ",", "String", ">", "p", ":", "extraHeaders", ")", "{", "v", ".", "push_back", "(", "p", ".", "to_string_string_pair", "(", ")", ")", ";", "}", "ti", ".", "add_url_seed", "(", "url", ",", "externAuth", ",", "v", ")", ";", "}" ]
Adds one url to the list of url seeds. Currently, the only transport protocol supported for the url is http. <p> The {@code externAuth} argument can be used for other authorization schemes than basic HTTP authorization. If set, it will override any username and password found in the URL itself. The string will be sent as the HTTP authorization header's value (without specifying "Basic"). <p> The {@code extraHeaders} argument can be used to insert custom HTTP headers in the requests to a specific web seed. @param url @param externAuth @param extraHeaders
[ "Adds", "one", "url", "to", "the", "list", "of", "url", "seeds", ".", "Currently", "the", "only", "transport", "protocol", "supported", "for", "the", "url", "is", "http", ".", "<p", ">", "The", "{", "@code", "externAuth", "}", "argument", "can", "be", "used", "for", "other", "authorization", "schemes", "than", "basic", "HTTP", "authorization", ".", "If", "set", "it", "will", "override", "any", "username", "and", "password", "found", "in", "the", "URL", "itself", ".", "The", "string", "will", "be", "sent", "as", "the", "HTTP", "authorization", "header", "s", "value", "(", "without", "specifying", "Basic", ")", ".", "<p", ">", "The", "{", "@code", "extraHeaders", "}", "argument", "can", "be", "used", "to", "insert", "custom", "HTTP", "headers", "in", "the", "requests", "to", "a", "specific", "web", "seed", "." ]
train
https://github.com/frostwire/frostwire-jlibtorrent/blob/a29249a940d34aba8c4677d238b472ef01833506/src/main/java/com/frostwire/jlibtorrent/TorrentInfo.java#L258-L266
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java
CPDefinitionPersistenceImpl.removeByG_NotS
@Override public void removeByG_NotS(long groupId, int status) { """ Removes all the cp definitions where groupId = &#63; and status &ne; &#63; from the database. @param groupId the group ID @param status the status """ for (CPDefinition cpDefinition : findByG_NotS(groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinition); } }
java
@Override public void removeByG_NotS(long groupId, int status) { for (CPDefinition cpDefinition : findByG_NotS(groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinition); } }
[ "@", "Override", "public", "void", "removeByG_NotS", "(", "long", "groupId", ",", "int", "status", ")", "{", "for", "(", "CPDefinition", "cpDefinition", ":", "findByG_NotS", "(", "groupId", ",", "status", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "cpDefinition", ")", ";", "}", "}" ]
Removes all the cp definitions where groupId = &#63; and status &ne; &#63; from the database. @param groupId the group ID @param status the status
[ "Removes", "all", "the", "cp", "definitions", "where", "groupId", "=", "&#63", ";", "and", "status", "&ne", ";", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L4005-L4011
alkacon/opencms-core
src-modules/org/opencms/workplace/list/A_CmsListResourceCollector.java
A_CmsListResourceCollector.getState
protected CmsListState getState(Map<String, String> params) { """ Returns the state of the parameter map.<p> @param params the parameter map @return the state of the list from the parameter map """ CmsListState state = new CmsListState(); try { state.setPage(Integer.parseInt(params.get(I_CmsListResourceCollector.PARAM_PAGE))); } catch (Throwable e) { // ignore } try { state.setOrder(CmsListOrderEnum.valueOf(params.get(I_CmsListResourceCollector.PARAM_ORDER))); } catch (Throwable e) { // ignore } try { state.setFilter(params.get(I_CmsListResourceCollector.PARAM_FILTER)); } catch (Throwable e) { // ignore } try { state.setColumn(params.get(I_CmsListResourceCollector.PARAM_SORTBY)); } catch (Throwable e) { // ignore } return state; }
java
protected CmsListState getState(Map<String, String> params) { CmsListState state = new CmsListState(); try { state.setPage(Integer.parseInt(params.get(I_CmsListResourceCollector.PARAM_PAGE))); } catch (Throwable e) { // ignore } try { state.setOrder(CmsListOrderEnum.valueOf(params.get(I_CmsListResourceCollector.PARAM_ORDER))); } catch (Throwable e) { // ignore } try { state.setFilter(params.get(I_CmsListResourceCollector.PARAM_FILTER)); } catch (Throwable e) { // ignore } try { state.setColumn(params.get(I_CmsListResourceCollector.PARAM_SORTBY)); } catch (Throwable e) { // ignore } return state; }
[ "protected", "CmsListState", "getState", "(", "Map", "<", "String", ",", "String", ">", "params", ")", "{", "CmsListState", "state", "=", "new", "CmsListState", "(", ")", ";", "try", "{", "state", ".", "setPage", "(", "Integer", ".", "parseInt", "(", "params", ".", "get", "(", "I_CmsListResourceCollector", ".", "PARAM_PAGE", ")", ")", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "// ignore", "}", "try", "{", "state", ".", "setOrder", "(", "CmsListOrderEnum", ".", "valueOf", "(", "params", ".", "get", "(", "I_CmsListResourceCollector", ".", "PARAM_ORDER", ")", ")", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "// ignore", "}", "try", "{", "state", ".", "setFilter", "(", "params", ".", "get", "(", "I_CmsListResourceCollector", ".", "PARAM_FILTER", ")", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "// ignore", "}", "try", "{", "state", ".", "setColumn", "(", "params", ".", "get", "(", "I_CmsListResourceCollector", ".", "PARAM_SORTBY", ")", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "// ignore", "}", "return", "state", ";", "}" ]
Returns the state of the parameter map.<p> @param params the parameter map @return the state of the list from the parameter map
[ "Returns", "the", "state", "of", "the", "parameter", "map", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/list/A_CmsListResourceCollector.java#L685-L709
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/parser/lexparser/AbstractTreebankParserParams.java
AbstractTreebankParserParams.parsevalObjectify
public static Collection<Constituent> parsevalObjectify(Tree t, TreeTransformer collinizer) { """ Takes a Tree and a collinizer and returns a Collection of labeled {@link Constituent}s for PARSEVAL. @param t The tree to extract constituents from @param collinizer The TreeTransformer used to normalize the tree for evaluation @return The bag of Constituents for PARSEVAL. """ return parsevalObjectify(t,collinizer,true); }
java
public static Collection<Constituent> parsevalObjectify(Tree t, TreeTransformer collinizer) { return parsevalObjectify(t,collinizer,true); }
[ "public", "static", "Collection", "<", "Constituent", ">", "parsevalObjectify", "(", "Tree", "t", ",", "TreeTransformer", "collinizer", ")", "{", "return", "parsevalObjectify", "(", "t", ",", "collinizer", ",", "true", ")", ";", "}" ]
Takes a Tree and a collinizer and returns a Collection of labeled {@link Constituent}s for PARSEVAL. @param t The tree to extract constituents from @param collinizer The TreeTransformer used to normalize the tree for evaluation @return The bag of Constituents for PARSEVAL.
[ "Takes", "a", "Tree", "and", "a", "collinizer", "and", "returns", "a", "Collection", "of", "labeled", "{" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/AbstractTreebankParserParams.java#L304-L306
sagiegurari/fax4j
src/main/java/org/fax4j/bridge/AbstractRequestParser.java
AbstractRequestParser.updateFaxJobFromInputData
public void updateFaxJobFromInputData(T inputData,FaxJob faxJob) { """ This function update the fax job from the input data.<br> This fax job will not have any file data. @param inputData The input data @param faxJob The fax job to update """ if(!this.initialized) { throw new FaxException("Fax bridge not initialized."); } //get fax job this.updateFaxJobFromInputDataImpl(inputData,faxJob); }
java
public void updateFaxJobFromInputData(T inputData,FaxJob faxJob) { if(!this.initialized) { throw new FaxException("Fax bridge not initialized."); } //get fax job this.updateFaxJobFromInputDataImpl(inputData,faxJob); }
[ "public", "void", "updateFaxJobFromInputData", "(", "T", "inputData", ",", "FaxJob", "faxJob", ")", "{", "if", "(", "!", "this", ".", "initialized", ")", "{", "throw", "new", "FaxException", "(", "\"Fax bridge not initialized.\"", ")", ";", "}", "//get fax job", "this", ".", "updateFaxJobFromInputDataImpl", "(", "inputData", ",", "faxJob", ")", ";", "}" ]
This function update the fax job from the input data.<br> This fax job will not have any file data. @param inputData The input data @param faxJob The fax job to update
[ "This", "function", "update", "the", "fax", "job", "from", "the", "input", "data", ".", "<br", ">", "This", "fax", "job", "will", "not", "have", "any", "file", "data", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/bridge/AbstractRequestParser.java#L82-L91
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/dropMenu/DropMenuRenderer.java
DropMenuRenderer.encodeEnd
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { """ This methods generates the HTML code of the current b:dropMenu. <code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code> to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called to generate the rest of the HTML code. @param context the FacesContext. @param component the current b:dropMenu. @throws IOException thrown if something goes wrong when writing the HTML code. """ if (!component.isRendered()) { return; } DropMenu dropMenu = (DropMenu) component; ResponseWriter rw = context.getResponseWriter(); rw.endElement("ul"); boolean isFlyOutMenu = isFlyOutMenu(component); String htmlTag = determineHtmlTag(component, isFlyOutMenu); rw.endElement(htmlTag); Tooltip.activateTooltips(context, dropMenu); }
java
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } DropMenu dropMenu = (DropMenu) component; ResponseWriter rw = context.getResponseWriter(); rw.endElement("ul"); boolean isFlyOutMenu = isFlyOutMenu(component); String htmlTag = determineHtmlTag(component, isFlyOutMenu); rw.endElement(htmlTag); Tooltip.activateTooltips(context, dropMenu); }
[ "@", "Override", "public", "void", "encodeEnd", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "if", "(", "!", "component", ".", "isRendered", "(", ")", ")", "{", "return", ";", "}", "DropMenu", "dropMenu", "=", "(", "DropMenu", ")", "component", ";", "ResponseWriter", "rw", "=", "context", ".", "getResponseWriter", "(", ")", ";", "rw", ".", "endElement", "(", "\"ul\"", ")", ";", "boolean", "isFlyOutMenu", "=", "isFlyOutMenu", "(", "component", ")", ";", "String", "htmlTag", "=", "determineHtmlTag", "(", "component", ",", "isFlyOutMenu", ")", ";", "rw", ".", "endElement", "(", "htmlTag", ")", ";", "Tooltip", ".", "activateTooltips", "(", "context", ",", "dropMenu", ")", ";", "}" ]
This methods generates the HTML code of the current b:dropMenu. <code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code> to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called to generate the rest of the HTML code. @param context the FacesContext. @param component the current b:dropMenu. @throws IOException thrown if something goes wrong when writing the HTML code.
[ "This", "methods", "generates", "the", "HTML", "code", "of", "the", "current", "b", ":", "dropMenu", ".", "<code", ">", "encodeBegin<", "/", "code", ">", "generates", "the", "start", "of", "the", "component", ".", "After", "the", "the", "JSF", "framework", "calls", "<code", ">", "encodeChildren", "()", "<", "/", "code", ">", "to", "generate", "the", "HTML", "code", "between", "the", "beginning", "and", "the", "end", "of", "the", "component", ".", "For", "instance", "in", "the", "case", "of", "a", "panel", "component", "the", "content", "of", "the", "panel", "is", "generated", "by", "<code", ">", "encodeChildren", "()", "<", "/", "code", ">", ".", "After", "that", "<code", ">", "encodeEnd", "()", "<", "/", "code", ">", "is", "called", "to", "generate", "the", "rest", "of", "the", "HTML", "code", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/dropMenu/DropMenuRenderer.java#L236-L250
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_output_graylog_stream_streamId_archive_archiveId_GET
public OvhArchive serviceName_output_graylog_stream_streamId_archive_archiveId_GET(String serviceName, String streamId, String archiveId) throws IOException { """ Returns details of specified archive REST: GET /dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId} @param serviceName [required] Service name @param streamId [required] Stream ID @param archiveId [required] Archive ID """ String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId}"; StringBuilder sb = path(qPath, serviceName, streamId, archiveId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhArchive.class); }
java
public OvhArchive serviceName_output_graylog_stream_streamId_archive_archiveId_GET(String serviceName, String streamId, String archiveId) throws IOException { String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId}"; StringBuilder sb = path(qPath, serviceName, streamId, archiveId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhArchive.class); }
[ "public", "OvhArchive", "serviceName_output_graylog_stream_streamId_archive_archiveId_GET", "(", "String", "serviceName", ",", "String", "streamId", ",", "String", "archiveId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "streamId", ",", "archiveId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhArchive", ".", "class", ")", ";", "}" ]
Returns details of specified archive REST: GET /dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId} @param serviceName [required] Service name @param streamId [required] Stream ID @param archiveId [required] Archive ID
[ "Returns", "details", "of", "specified", "archive" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1457-L1462
FudanNLP/fnlp
fnlp-app/src/main/java/org/fnlp/app/num/CNExpression.java
CNExpression.checkSuffix
private boolean checkSuffix(String str,Loc loc) { """ 检查一个字符串从指定位置开始的中文标示是否符号一个算术表达式的后缀询问部分 @param str 字符串 @param loc 指定位置 @return 符合则返回true 不符合返回false """ int len=str.length(); while(loc.v<len && this.strSuff.indexOf(str.charAt(loc.v))>=0) loc.v++; while(loc.v<len && this.strPunctuation.indexOf(str.charAt(loc.v))>=0) loc.v++; if(loc.v<len) return false; else return true; }
java
private boolean checkSuffix(String str,Loc loc){ int len=str.length(); while(loc.v<len && this.strSuff.indexOf(str.charAt(loc.v))>=0) loc.v++; while(loc.v<len && this.strPunctuation.indexOf(str.charAt(loc.v))>=0) loc.v++; if(loc.v<len) return false; else return true; }
[ "private", "boolean", "checkSuffix", "(", "String", "str", ",", "Loc", "loc", ")", "{", "int", "len", "=", "str", ".", "length", "(", ")", ";", "while", "(", "loc", ".", "v", "<", "len", "&&", "this", ".", "strSuff", ".", "indexOf", "(", "str", ".", "charAt", "(", "loc", ".", "v", ")", ")", ">=", "0", ")", "loc", ".", "v", "++", ";", "while", "(", "loc", ".", "v", "<", "len", "&&", "this", ".", "strPunctuation", ".", "indexOf", "(", "str", ".", "charAt", "(", "loc", ".", "v", ")", ")", ">=", "0", ")", "loc", ".", "v", "++", ";", "if", "(", "loc", ".", "v", "<", "len", ")", "return", "false", ";", "else", "return", "true", ";", "}" ]
检查一个字符串从指定位置开始的中文标示是否符号一个算术表达式的后缀询问部分 @param str 字符串 @param loc 指定位置 @return 符合则返回true 不符合返回false
[ "检查一个字符串从指定位置开始的中文标示是否符号一个算术表达式的后缀询问部分" ]
train
https://github.com/FudanNLP/fnlp/blob/ce258f3e4a5add2ba0b5e4cbac7cab2190af6659/fnlp-app/src/main/java/org/fnlp/app/num/CNExpression.java#L250-L260
apache/incubator-zipkin
zipkin/src/main/java/zipkin2/Span.java
Builder.traceId
public Builder traceId(long high, long low) { """ Encodes 64 or 128 bits from the input into a hex trace ID. @param high Upper 64bits of the trace ID. Zero means the trace ID is 64-bit. @param low Lower 64bits of the trace ID. @throws IllegalArgumentException if both values are zero """ if (high == 0L && low == 0L) throw new IllegalArgumentException("empty trace ID"); char[] result = new char[high != 0L ? 32 : 16]; int pos = 0; if (high != 0L) { writeHexLong(result, pos, high); pos += 16; } writeHexLong(result, pos, low); this.traceId = new String(result); return this; }
java
public Builder traceId(long high, long low) { if (high == 0L && low == 0L) throw new IllegalArgumentException("empty trace ID"); char[] result = new char[high != 0L ? 32 : 16]; int pos = 0; if (high != 0L) { writeHexLong(result, pos, high); pos += 16; } writeHexLong(result, pos, low); this.traceId = new String(result); return this; }
[ "public", "Builder", "traceId", "(", "long", "high", ",", "long", "low", ")", "{", "if", "(", "high", "==", "0L", "&&", "low", "==", "0L", ")", "throw", "new", "IllegalArgumentException", "(", "\"empty trace ID\"", ")", ";", "char", "[", "]", "result", "=", "new", "char", "[", "high", "!=", "0L", "?", "32", ":", "16", "]", ";", "int", "pos", "=", "0", ";", "if", "(", "high", "!=", "0L", ")", "{", "writeHexLong", "(", "result", ",", "pos", ",", "high", ")", ";", "pos", "+=", "16", ";", "}", "writeHexLong", "(", "result", ",", "pos", ",", "low", ")", ";", "this", ".", "traceId", "=", "new", "String", "(", "result", ")", ";", "return", "this", ";", "}" ]
Encodes 64 or 128 bits from the input into a hex trace ID. @param high Upper 64bits of the trace ID. Zero means the trace ID is 64-bit. @param low Lower 64bits of the trace ID. @throws IllegalArgumentException if both values are zero
[ "Encodes", "64", "or", "128", "bits", "from", "the", "input", "into", "a", "hex", "trace", "ID", "." ]
train
https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/Span.java#L416-L427
jhalterman/lyra
src/main/java/net/jodah/lyra/internal/RetryableResource.java
RetryableResource.recoverQueue
String recoverQueue(String queueName, QueueDeclaration queueDeclaration) throws Exception { """ Recovers a queue using the {@code channelSupplier}, returning the recovered queue's name. """ try { String newQueueName = ((Queue.DeclareOk) queueDeclaration.invoke(getRecoveryChannel())).getQueue(); if (queueName.equals(newQueueName)) log.info("Recovered queue {} via {}", queueName, this); else { log.info("Recovered queue {} as {} via {}", queueName, newQueueName, this); queueDeclaration.name = newQueueName; } return newQueueName; } catch (Exception e) { log.error("Failed to recover queue {} via {}", queueName, this, e); if (throwOnRecoveryFailure() || Exceptions.isCausedByConnectionClosure(e)) throw e; return queueName; } }
java
String recoverQueue(String queueName, QueueDeclaration queueDeclaration) throws Exception { try { String newQueueName = ((Queue.DeclareOk) queueDeclaration.invoke(getRecoveryChannel())).getQueue(); if (queueName.equals(newQueueName)) log.info("Recovered queue {} via {}", queueName, this); else { log.info("Recovered queue {} as {} via {}", queueName, newQueueName, this); queueDeclaration.name = newQueueName; } return newQueueName; } catch (Exception e) { log.error("Failed to recover queue {} via {}", queueName, this, e); if (throwOnRecoveryFailure() || Exceptions.isCausedByConnectionClosure(e)) throw e; return queueName; } }
[ "String", "recoverQueue", "(", "String", "queueName", ",", "QueueDeclaration", "queueDeclaration", ")", "throws", "Exception", "{", "try", "{", "String", "newQueueName", "=", "(", "(", "Queue", ".", "DeclareOk", ")", "queueDeclaration", ".", "invoke", "(", "getRecoveryChannel", "(", ")", ")", ")", ".", "getQueue", "(", ")", ";", "if", "(", "queueName", ".", "equals", "(", "newQueueName", ")", ")", "log", ".", "info", "(", "\"Recovered queue {} via {}\"", ",", "queueName", ",", "this", ")", ";", "else", "{", "log", ".", "info", "(", "\"Recovered queue {} as {} via {}\"", ",", "queueName", ",", "newQueueName", ",", "this", ")", ";", "queueDeclaration", ".", "name", "=", "newQueueName", ";", "}", "return", "newQueueName", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Failed to recover queue {} via {}\"", ",", "queueName", ",", "this", ",", "e", ")", ";", "if", "(", "throwOnRecoveryFailure", "(", ")", "||", "Exceptions", ".", "isCausedByConnectionClosure", "(", "e", ")", ")", "throw", "e", ";", "return", "queueName", ";", "}", "}" ]
Recovers a queue using the {@code channelSupplier}, returning the recovered queue's name.
[ "Recovers", "a", "queue", "using", "the", "{" ]
train
https://github.com/jhalterman/lyra/blob/ce347a69357fef1b34e92d92a4f9e68792d81255/src/main/java/net/jodah/lyra/internal/RetryableResource.java#L166-L184
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_database_POST
public OvhTask serviceName_database_POST(String serviceName, OvhDatabaseCapabilitiesTypeEnum capabilitie, String password, OvhExtraSqlQuotaEnum quota, OvhDatabaseTypeEnum type, String user, OvhVersionEnum version) throws IOException { """ Install new database REST: POST /hosting/web/{serviceName}/database @param type [required] Type you want for your database @param password [required] Database password @param user [required] Database user name. Must begin with your hosting login and must be in lower case @param quota [required] Quota assign to your database. Only for extraSql @param version [required] Version you want for your database following the type @param capabilitie [required] Type of your database @param serviceName [required] The internal name of your hosting """ String qPath = "/hosting/web/{serviceName}/database"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "capabilitie", capabilitie); addBody(o, "password", password); addBody(o, "quota", quota); addBody(o, "type", type); addBody(o, "user", user); addBody(o, "version", version); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_database_POST(String serviceName, OvhDatabaseCapabilitiesTypeEnum capabilitie, String password, OvhExtraSqlQuotaEnum quota, OvhDatabaseTypeEnum type, String user, OvhVersionEnum version) throws IOException { String qPath = "/hosting/web/{serviceName}/database"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "capabilitie", capabilitie); addBody(o, "password", password); addBody(o, "quota", quota); addBody(o, "type", type); addBody(o, "user", user); addBody(o, "version", version); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_database_POST", "(", "String", "serviceName", ",", "OvhDatabaseCapabilitiesTypeEnum", "capabilitie", ",", "String", "password", ",", "OvhExtraSqlQuotaEnum", "quota", ",", "OvhDatabaseTypeEnum", "type", ",", "String", "user", ",", "OvhVersionEnum", "version", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/database\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"capabilitie\"", ",", "capabilitie", ")", ";", "addBody", "(", "o", ",", "\"password\"", ",", "password", ")", ";", "addBody", "(", "o", ",", "\"quota\"", ",", "quota", ")", ";", "addBody", "(", "o", ",", "\"type\"", ",", "type", ")", ";", "addBody", "(", "o", ",", "\"user\"", ",", "user", ")", ";", "addBody", "(", "o", ",", "\"version\"", ",", "version", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Install new database REST: POST /hosting/web/{serviceName}/database @param type [required] Type you want for your database @param password [required] Database password @param user [required] Database user name. Must begin with your hosting login and must be in lower case @param quota [required] Quota assign to your database. Only for extraSql @param version [required] Version you want for your database following the type @param capabilitie [required] Type of your database @param serviceName [required] The internal name of your hosting
[ "Install", "new", "database" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1110-L1122
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Observable.java
Observable.fromFuture
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Observable<T> fromFuture(Future<? extends T> future) { """ Converts a {@link Future} into an ObservableSource. <p> <img width="640" height="284" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromFuture.noarg.png" alt=""> <p> You can convert any object that supports the {@link Future} interface into an ObservableSource that emits the return value of the {@link Future#get} method of that object, by passing the object into the {@code from} method. <p> <em>Important note:</em> This ObservableSource is blocking; you cannot dispose it. <p> Unlike 1.x, disposing the Observable won't cancel the future. If necessary, one can use composition to achieve the cancellation effect: {@code futureObservableSource.doOnDispose(() -> future.cancel(true));}. <dl> <dt><b>Scheduler:</b></dt> <dd>{@code fromFuture} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param future the source {@link Future} @param <T> the type of object that the {@link Future} returns, and also the type of item to be emitted by the resulting ObservableSource @return an Observable that emits the item from the source {@link Future} @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a> """ ObjectHelper.requireNonNull(future, "future is null"); return RxJavaPlugins.onAssembly(new ObservableFromFuture<T>(future, 0L, null)); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Observable<T> fromFuture(Future<? extends T> future) { ObjectHelper.requireNonNull(future, "future is null"); return RxJavaPlugins.onAssembly(new ObservableFromFuture<T>(future, 0L, null)); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "static", "<", "T", ">", "Observable", "<", "T", ">", "fromFuture", "(", "Future", "<", "?", "extends", "T", ">", "future", ")", "{", "ObjectHelper", ".", "requireNonNull", "(", "future", ",", "\"future is null\"", ")", ";", "return", "RxJavaPlugins", ".", "onAssembly", "(", "new", "ObservableFromFuture", "<", "T", ">", "(", "future", ",", "0L", ",", "null", ")", ")", ";", "}" ]
Converts a {@link Future} into an ObservableSource. <p> <img width="640" height="284" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromFuture.noarg.png" alt=""> <p> You can convert any object that supports the {@link Future} interface into an ObservableSource that emits the return value of the {@link Future#get} method of that object, by passing the object into the {@code from} method. <p> <em>Important note:</em> This ObservableSource is blocking; you cannot dispose it. <p> Unlike 1.x, disposing the Observable won't cancel the future. If necessary, one can use composition to achieve the cancellation effect: {@code futureObservableSource.doOnDispose(() -> future.cancel(true));}. <dl> <dt><b>Scheduler:</b></dt> <dd>{@code fromFuture} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param future the source {@link Future} @param <T> the type of object that the {@link Future} returns, and also the type of item to be emitted by the resulting ObservableSource @return an Observable that emits the item from the source {@link Future} @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
[ "Converts", "a", "{", "@link", "Future", "}", "into", "an", "ObservableSource", ".", "<p", ">", "<img", "width", "=", "640", "height", "=", "284", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", "/", "ReactiveX", "/", "RxJava", "/", "images", "/", "rx", "-", "operators", "/", "fromFuture", ".", "noarg", ".", "png", "alt", "=", ">", "<p", ">", "You", "can", "convert", "any", "object", "that", "supports", "the", "{", "@link", "Future", "}", "interface", "into", "an", "ObservableSource", "that", "emits", "the", "return", "value", "of", "the", "{", "@link", "Future#get", "}", "method", "of", "that", "object", "by", "passing", "the", "object", "into", "the", "{", "@code", "from", "}", "method", ".", "<p", ">", "<em", ">", "Important", "note", ":", "<", "/", "em", ">", "This", "ObservableSource", "is", "blocking", ";", "you", "cannot", "dispose", "it", ".", "<p", ">", "Unlike", "1", ".", "x", "disposing", "the", "Observable", "won", "t", "cancel", "the", "future", ".", "If", "necessary", "one", "can", "use", "composition", "to", "achieve", "the", "cancellation", "effect", ":", "{", "@code", "futureObservableSource", ".", "doOnDispose", "((", ")", "-", ">", "future", ".", "cancel", "(", "true", "))", ";", "}", ".", "<dl", ">", "<dt", ">", "<b", ">", "Scheduler", ":", "<", "/", "b", ">", "<", "/", "dt", ">", "<dd", ">", "{", "@code", "fromFuture", "}", "does", "not", "operate", "by", "default", "on", "a", "particular", "{", "@link", "Scheduler", "}", ".", "<", "/", "dd", ">", "<", "/", "dl", ">" ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Observable.java#L1810-L1815
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/render/JSEventHandlerRenderer.java
JSEventHandlerRenderer.generateJSEventHandlers
public static void generateJSEventHandlers(ResponseWriter rw, UIComponent component) throws IOException { """ Generates the standard Javascript event handlers. @param rw The response writer @param component the current component @throws IOException thrown if something goes wrong when writing the HTML code """ Map<String, Object> attributes = component.getAttributes(); String[] eventHandlers = {"onclick", "onblur", "onmouseover"}; for (String event:eventHandlers) { String handler = A.asString(attributes.get(event)); if (null != handler) { rw.writeAttribute(event, handler, event); } } }
java
public static void generateJSEventHandlers(ResponseWriter rw, UIComponent component) throws IOException { Map<String, Object> attributes = component.getAttributes(); String[] eventHandlers = {"onclick", "onblur", "onmouseover"}; for (String event:eventHandlers) { String handler = A.asString(attributes.get(event)); if (null != handler) { rw.writeAttribute(event, handler, event); } } }
[ "public", "static", "void", "generateJSEventHandlers", "(", "ResponseWriter", "rw", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "Object", ">", "attributes", "=", "component", ".", "getAttributes", "(", ")", ";", "String", "[", "]", "eventHandlers", "=", "{", "\"onclick\"", ",", "\"onblur\"", ",", "\"onmouseover\"", "}", ";", "for", "(", "String", "event", ":", "eventHandlers", ")", "{", "String", "handler", "=", "A", ".", "asString", "(", "attributes", ".", "get", "(", "event", ")", ")", ";", "if", "(", "null", "!=", "handler", ")", "{", "rw", ".", "writeAttribute", "(", "event", ",", "handler", ",", "event", ")", ";", "}", "}", "}" ]
Generates the standard Javascript event handlers. @param rw The response writer @param component the current component @throws IOException thrown if something goes wrong when writing the HTML code
[ "Generates", "the", "standard", "Javascript", "event", "handlers", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/JSEventHandlerRenderer.java#L37-L46
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ParallelRunner.java
ParallelRunner.serializeToFile
public <T extends State> void serializeToFile(final T state, final Path outputFilePath) { """ Serialize a {@link State} object into a file. <p> This method submits a task to serialize the {@link State} object and returns immediately after the task is submitted. </p> @param state the {@link State} object to be serialized @param outputFilePath the file to write the serialized {@link State} object to @param <T> the {@link State} object type """ // Use a Callable with a Void return type to allow exceptions to be thrown this.futures.add(new NamedFuture(this.executor.submit(new Callable<Void>() { @Override public Void call() throws Exception { SerializationUtils.serializeState(ParallelRunner.this.fs, outputFilePath, state); return null; } }), "Serialize state to " + outputFilePath)); }
java
public <T extends State> void serializeToFile(final T state, final Path outputFilePath) { // Use a Callable with a Void return type to allow exceptions to be thrown this.futures.add(new NamedFuture(this.executor.submit(new Callable<Void>() { @Override public Void call() throws Exception { SerializationUtils.serializeState(ParallelRunner.this.fs, outputFilePath, state); return null; } }), "Serialize state to " + outputFilePath)); }
[ "public", "<", "T", "extends", "State", ">", "void", "serializeToFile", "(", "final", "T", "state", ",", "final", "Path", "outputFilePath", ")", "{", "// Use a Callable with a Void return type to allow exceptions to be thrown", "this", ".", "futures", ".", "add", "(", "new", "NamedFuture", "(", "this", ".", "executor", ".", "submit", "(", "new", "Callable", "<", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", ")", "throws", "Exception", "{", "SerializationUtils", ".", "serializeState", "(", "ParallelRunner", ".", "this", ".", "fs", ",", "outputFilePath", ",", "state", ")", ";", "return", "null", ";", "}", "}", ")", ",", "\"Serialize state to \"", "+", "outputFilePath", ")", ")", ";", "}" ]
Serialize a {@link State} object into a file. <p> This method submits a task to serialize the {@link State} object and returns immediately after the task is submitted. </p> @param state the {@link State} object to be serialized @param outputFilePath the file to write the serialized {@link State} object to @param <T> the {@link State} object type
[ "Serialize", "a", "{", "@link", "State", "}", "object", "into", "a", "file", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ParallelRunner.java#L145-L155
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/LegacyAddress.java
LegacyAddress.fromPubKeyHash
public static LegacyAddress fromPubKeyHash(NetworkParameters params, byte[] hash160) throws AddressFormatException { """ Construct a {@link LegacyAddress} that represents the given pubkey hash. The resulting address will be a P2PKH type of address. @param params network this address is valid for @param hash160 20-byte pubkey hash @return constructed address """ return new LegacyAddress(params, false, hash160); }
java
public static LegacyAddress fromPubKeyHash(NetworkParameters params, byte[] hash160) throws AddressFormatException { return new LegacyAddress(params, false, hash160); }
[ "public", "static", "LegacyAddress", "fromPubKeyHash", "(", "NetworkParameters", "params", ",", "byte", "[", "]", "hash160", ")", "throws", "AddressFormatException", "{", "return", "new", "LegacyAddress", "(", "params", ",", "false", ",", "hash160", ")", ";", "}" ]
Construct a {@link LegacyAddress} that represents the given pubkey hash. The resulting address will be a P2PKH type of address. @param params network this address is valid for @param hash160 20-byte pubkey hash @return constructed address
[ "Construct", "a", "{", "@link", "LegacyAddress", "}", "that", "represents", "the", "given", "pubkey", "hash", ".", "The", "resulting", "address", "will", "be", "a", "P2PKH", "type", "of", "address", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/LegacyAddress.java#L84-L86
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getQualifiedClassLink
public Content getQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd) { """ Get the class link. @param context the id of the context where the link will be added @param cd the class doc to link to @return a content tree for the link """ return getLink(new LinkInfoImpl(configuration, context, cd) .label(configuration.getClassName(cd))); }
java
public Content getQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd) { return getLink(new LinkInfoImpl(configuration, context, cd) .label(configuration.getClassName(cd))); }
[ "public", "Content", "getQualifiedClassLink", "(", "LinkInfoImpl", ".", "Kind", "context", ",", "ClassDoc", "cd", ")", "{", "return", "getLink", "(", "new", "LinkInfoImpl", "(", "configuration", ",", "context", ",", "cd", ")", ".", "label", "(", "configuration", ".", "getClassName", "(", "cd", ")", ")", ")", ";", "}" ]
Get the class link. @param context the id of the context where the link will be added @param cd the class doc to link to @return a content tree for the link
[ "Get", "the", "class", "link", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1097-L1100
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java
StringIterate.reverseForEachChar
public static void reverseForEachChar(String string, CharProcedure procedure) { """ For each char in the {@code string} in reverse order, execute the {@link CharProcedure}. @since 7.0 """ for (int i = string.length() - 1; i >= 0; i--) { procedure.value(string.charAt(i)); } }
java
public static void reverseForEachChar(String string, CharProcedure procedure) { for (int i = string.length() - 1; i >= 0; i--) { procedure.value(string.charAt(i)); } }
[ "public", "static", "void", "reverseForEachChar", "(", "String", "string", ",", "CharProcedure", "procedure", ")", "{", "for", "(", "int", "i", "=", "string", ".", "length", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "procedure", ".", "value", "(", "string", ".", "charAt", "(", "i", ")", ")", ";", "}", "}" ]
For each char in the {@code string} in reverse order, execute the {@link CharProcedure}. @since 7.0
[ "For", "each", "char", "in", "the", "{", "@code", "string", "}", "in", "reverse", "order", "execute", "the", "{", "@link", "CharProcedure", "}", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L412-L418
netty/netty
resolver-dns/src/main/java/io/netty/resolver/dns/RoundRobinDnsAddressResolverGroup.java
RoundRobinDnsAddressResolverGroup.newAddressResolver
@Override protected final AddressResolver<InetSocketAddress> newAddressResolver(EventLoop eventLoop, NameResolver<InetAddress> resolver) throws Exception { """ We need to override this method, not {@link #newNameResolver(EventLoop, ChannelFactory, DnsServerAddressStreamProvider)}, because we need to eliminate possible caching of {@link io.netty.resolver.NameResolver#resolve} by {@link InflightNameResolver} created in {@link #newResolver(EventLoop, ChannelFactory, DnsServerAddressStreamProvider)}. """ return new RoundRobinInetAddressResolver(eventLoop, resolver).asAddressResolver(); }
java
@Override protected final AddressResolver<InetSocketAddress> newAddressResolver(EventLoop eventLoop, NameResolver<InetAddress> resolver) throws Exception { return new RoundRobinInetAddressResolver(eventLoop, resolver).asAddressResolver(); }
[ "@", "Override", "protected", "final", "AddressResolver", "<", "InetSocketAddress", ">", "newAddressResolver", "(", "EventLoop", "eventLoop", ",", "NameResolver", "<", "InetAddress", ">", "resolver", ")", "throws", "Exception", "{", "return", "new", "RoundRobinInetAddressResolver", "(", "eventLoop", ",", "resolver", ")", ".", "asAddressResolver", "(", ")", ";", "}" ]
We need to override this method, not {@link #newNameResolver(EventLoop, ChannelFactory, DnsServerAddressStreamProvider)}, because we need to eliminate possible caching of {@link io.netty.resolver.NameResolver#resolve} by {@link InflightNameResolver} created in {@link #newResolver(EventLoop, ChannelFactory, DnsServerAddressStreamProvider)}.
[ "We", "need", "to", "override", "this", "method", "not", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/RoundRobinDnsAddressResolverGroup.java#L62-L67
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_modem_availableWLANChannel_GET
public ArrayList<Long> serviceName_modem_availableWLANChannel_GET(String serviceName, OvhWLANFrequencyEnum frequency) throws IOException { """ List available WLAN channel for this modem REST: GET /xdsl/{serviceName}/modem/availableWLANChannel @param frequency [required] WLAN frequency you want to retrieve channels @param serviceName [required] The internal name of your XDSL offer """ String qPath = "/xdsl/{serviceName}/modem/availableWLANChannel"; StringBuilder sb = path(qPath, serviceName); query(sb, "frequency", frequency); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
java
public ArrayList<Long> serviceName_modem_availableWLANChannel_GET(String serviceName, OvhWLANFrequencyEnum frequency) throws IOException { String qPath = "/xdsl/{serviceName}/modem/availableWLANChannel"; StringBuilder sb = path(qPath, serviceName); query(sb, "frequency", frequency); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_modem_availableWLANChannel_GET", "(", "String", "serviceName", ",", "OvhWLANFrequencyEnum", "frequency", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/modem/availableWLANChannel\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"frequency\"", ",", "frequency", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t15", ")", ";", "}" ]
List available WLAN channel for this modem REST: GET /xdsl/{serviceName}/modem/availableWLANChannel @param frequency [required] WLAN frequency you want to retrieve channels @param serviceName [required] The internal name of your XDSL offer
[ "List", "available", "WLAN", "channel", "for", "this", "modem" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L760-L766
bazaarvoice/emodb
sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/AstyanaxBlockedDataReaderDAO.java
AstyanaxBlockedDataReaderDAO.rowQuery
private Iterator<Record> rowQuery(DeltaPlacement placement, List<Map.Entry<ByteBuffer, Key>> keys, ReadConsistency consistency) { """ Queries for rows given an enumerated list of Cassandra row keys. """ // Build the list of row IDs to query for. List<ByteBuffer> rowIds = Lists.transform(keys, entryKeyFunction()); // Query for Delta & Compaction info, just the first 50 columns for now. final Rows<ByteBuffer, DeltaKey> rows = execute(placement.getKeyspace() .prepareQuery(placement.getBlockedDeltaColumnFamily(), SorConsistencies.toAstyanax(consistency)) .getKeySlice(rowIds) .withColumnRange(_maxColumnsRange), "query %d keys from placement %s", rowIds.size(), placement.getName()); // Track metrics _randomReadMeter.mark(rowIds.size()); // Return an iterator that decodes the row results, avoiding pinning multiple decoded rows into memory at once. return decodeRows(keys, rows, _maxColumnsRange.getLimit(), consistency); }
java
private Iterator<Record> rowQuery(DeltaPlacement placement, List<Map.Entry<ByteBuffer, Key>> keys, ReadConsistency consistency) { // Build the list of row IDs to query for. List<ByteBuffer> rowIds = Lists.transform(keys, entryKeyFunction()); // Query for Delta & Compaction info, just the first 50 columns for now. final Rows<ByteBuffer, DeltaKey> rows = execute(placement.getKeyspace() .prepareQuery(placement.getBlockedDeltaColumnFamily(), SorConsistencies.toAstyanax(consistency)) .getKeySlice(rowIds) .withColumnRange(_maxColumnsRange), "query %d keys from placement %s", rowIds.size(), placement.getName()); // Track metrics _randomReadMeter.mark(rowIds.size()); // Return an iterator that decodes the row results, avoiding pinning multiple decoded rows into memory at once. return decodeRows(keys, rows, _maxColumnsRange.getLimit(), consistency); }
[ "private", "Iterator", "<", "Record", ">", "rowQuery", "(", "DeltaPlacement", "placement", ",", "List", "<", "Map", ".", "Entry", "<", "ByteBuffer", ",", "Key", ">", ">", "keys", ",", "ReadConsistency", "consistency", ")", "{", "// Build the list of row IDs to query for.", "List", "<", "ByteBuffer", ">", "rowIds", "=", "Lists", ".", "transform", "(", "keys", ",", "entryKeyFunction", "(", ")", ")", ";", "// Query for Delta & Compaction info, just the first 50 columns for now.", "final", "Rows", "<", "ByteBuffer", ",", "DeltaKey", ">", "rows", "=", "execute", "(", "placement", ".", "getKeyspace", "(", ")", ".", "prepareQuery", "(", "placement", ".", "getBlockedDeltaColumnFamily", "(", ")", ",", "SorConsistencies", ".", "toAstyanax", "(", "consistency", ")", ")", ".", "getKeySlice", "(", "rowIds", ")", ".", "withColumnRange", "(", "_maxColumnsRange", ")", ",", "\"query %d keys from placement %s\"", ",", "rowIds", ".", "size", "(", ")", ",", "placement", ".", "getName", "(", ")", ")", ";", "// Track metrics", "_randomReadMeter", ".", "mark", "(", "rowIds", ".", "size", "(", ")", ")", ";", "// Return an iterator that decodes the row results, avoiding pinning multiple decoded rows into memory at once.", "return", "decodeRows", "(", "keys", ",", "rows", ",", "_maxColumnsRange", ".", "getLimit", "(", ")", ",", "consistency", ")", ";", "}" ]
Queries for rows given an enumerated list of Cassandra row keys.
[ "Queries", "for", "rows", "given", "an", "enumerated", "list", "of", "Cassandra", "row", "keys", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/AstyanaxBlockedDataReaderDAO.java#L786-L804
Azure/azure-sdk-for-java
policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionsInner.java
PolicyDefinitionsInner.createOrUpdateAsync
public Observable<PolicyDefinitionInner> createOrUpdateAsync(String policyDefinitionName, PolicyDefinitionInner parameters) { """ Creates or updates a policy definition. @param policyDefinitionName The name of the policy definition to create. @param parameters The policy definition properties. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PolicyDefinitionInner object """ return createOrUpdateWithServiceResponseAsync(policyDefinitionName, parameters).map(new Func1<ServiceResponse<PolicyDefinitionInner>, PolicyDefinitionInner>() { @Override public PolicyDefinitionInner call(ServiceResponse<PolicyDefinitionInner> response) { return response.body(); } }); }
java
public Observable<PolicyDefinitionInner> createOrUpdateAsync(String policyDefinitionName, PolicyDefinitionInner parameters) { return createOrUpdateWithServiceResponseAsync(policyDefinitionName, parameters).map(new Func1<ServiceResponse<PolicyDefinitionInner>, PolicyDefinitionInner>() { @Override public PolicyDefinitionInner call(ServiceResponse<PolicyDefinitionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PolicyDefinitionInner", ">", "createOrUpdateAsync", "(", "String", "policyDefinitionName", ",", "PolicyDefinitionInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "policyDefinitionName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "PolicyDefinitionInner", ">", ",", "PolicyDefinitionInner", ">", "(", ")", "{", "@", "Override", "public", "PolicyDefinitionInner", "call", "(", "ServiceResponse", "<", "PolicyDefinitionInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a policy definition. @param policyDefinitionName The name of the policy definition to create. @param parameters The policy definition properties. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PolicyDefinitionInner object
[ "Creates", "or", "updates", "a", "policy", "definition", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionsInner.java#L153-L160
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_line_serviceName_trafficExtracts_id_GET
public OvhTrafficExtract billingAccount_line_serviceName_trafficExtracts_id_GET(String billingAccount, String serviceName, Long id) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/line/{serviceName}/trafficExtracts/{id} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param id [required] Id of the object """ String qPath = "/telephony/{billingAccount}/line/{serviceName}/trafficExtracts/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTrafficExtract.class); }
java
public OvhTrafficExtract billingAccount_line_serviceName_trafficExtracts_id_GET(String billingAccount, String serviceName, Long id) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/trafficExtracts/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTrafficExtract.class); }
[ "public", "OvhTrafficExtract", "billingAccount_line_serviceName_trafficExtracts_id_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/line/{serviceName}/trafficExtracts/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "id", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTrafficExtract", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /telephony/{billingAccount}/line/{serviceName}/trafficExtracts/{id} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param id [required] Id of the object
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L755-L760
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectOneOfImpl_CustomFieldSerializer.java
OWLObjectOneOfImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectOneOfImpl instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectOneOfImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLObjectOneOfImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectOneOfImpl_CustomFieldSerializer.java#L69-L72
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java
XMemcachedClient.deleteWithNoReply
public final void deleteWithNoReply(final String key, final int time) throws InterruptedException, MemcachedException { """ Delete key's data item from memcached.This method doesn't wait for reply @param key @param time @throws InterruptedException @throws MemcachedException """ try { this.delete0(key, time, 0, true, this.opTimeout); } catch (TimeoutException e) { throw new MemcachedException(e); } }
java
public final void deleteWithNoReply(final String key, final int time) throws InterruptedException, MemcachedException { try { this.delete0(key, time, 0, true, this.opTimeout); } catch (TimeoutException e) { throw new MemcachedException(e); } }
[ "public", "final", "void", "deleteWithNoReply", "(", "final", "String", "key", ",", "final", "int", "time", ")", "throws", "InterruptedException", ",", "MemcachedException", "{", "try", "{", "this", ".", "delete0", "(", "key", ",", "time", ",", "0", ",", "true", ",", "this", ".", "opTimeout", ")", ";", "}", "catch", "(", "TimeoutException", "e", ")", "{", "throw", "new", "MemcachedException", "(", "e", ")", ";", "}", "}" ]
Delete key's data item from memcached.This method doesn't wait for reply @param key @param time @throws InterruptedException @throws MemcachedException
[ "Delete", "key", "s", "data", "item", "from", "memcached", ".", "This", "method", "doesn", "t", "wait", "for", "reply" ]
train
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/XMemcachedClient.java#L1782-L1789
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/upsert/AbstractUpsertPlugin.java
AbstractUpsertPlugin.addSingleUpsertToSqlMap
protected void addSingleUpsertToSqlMap(Document document, IntrospectedTable introspectedTable) { """ add update xml element to mapper.xml for upsert @param document The generated xml mapper dom @param introspectedTable The metadata for database table """ XmlElement update = new XmlElement("update"); update.addAttribute(new Attribute("id", UPSERT)); update.addAttribute(new Attribute("parameterType", "map")); generateSqlMapContent(introspectedTable, update); document.getRootElement().addElement(update); }
java
protected void addSingleUpsertToSqlMap(Document document, IntrospectedTable introspectedTable) { XmlElement update = new XmlElement("update"); update.addAttribute(new Attribute("id", UPSERT)); update.addAttribute(new Attribute("parameterType", "map")); generateSqlMapContent(introspectedTable, update); document.getRootElement().addElement(update); }
[ "protected", "void", "addSingleUpsertToSqlMap", "(", "Document", "document", ",", "IntrospectedTable", "introspectedTable", ")", "{", "XmlElement", "update", "=", "new", "XmlElement", "(", "\"update\"", ")", ";", "update", ".", "addAttribute", "(", "new", "Attribute", "(", "\"id\"", ",", "UPSERT", ")", ")", ";", "update", ".", "addAttribute", "(", "new", "Attribute", "(", "\"parameterType\"", ",", "\"map\"", ")", ")", ";", "generateSqlMapContent", "(", "introspectedTable", ",", "update", ")", ";", "document", ".", "getRootElement", "(", ")", ".", "addElement", "(", "update", ")", ";", "}" ]
add update xml element to mapper.xml for upsert @param document The generated xml mapper dom @param introspectedTable The metadata for database table
[ "add", "update", "xml", "element", "to", "mapper", ".", "xml", "for", "upsert" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/upsert/AbstractUpsertPlugin.java#L91-L99
code4everything/util
src/main/java/com/zhazhapan/util/office/MsUtils.java
MsUtils.writeTo
public static void writeTo(Object object, String path) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { """ 保存Office文档 @param object {@link POIXMLDocument} 对象 @param path 输出路径 @throws IOException 异常 @throws NoSuchMethodException 异常 @throws IllegalAccessException 异常 @throws InvocationTargetException 异常 """ OutputStream os = new FileOutputStream(path); ReflectUtils.invokeMethod(object, "write", new Class<?>[]{OutputStream.class}, new Object[]{os}); os.close(); logger.info("文件已输出:" + path); }
java
public static void writeTo(Object object, String path) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { OutputStream os = new FileOutputStream(path); ReflectUtils.invokeMethod(object, "write", new Class<?>[]{OutputStream.class}, new Object[]{os}); os.close(); logger.info("文件已输出:" + path); }
[ "public", "static", "void", "writeTo", "(", "Object", "object", ",", "String", "path", ")", "throws", "IOException", ",", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "OutputStream", "os", "=", "new", "FileOutputStream", "(", "path", ")", ";", "ReflectUtils", ".", "invokeMethod", "(", "object", ",", "\"write\"", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "OutputStream", ".", "class", "}", ",", "new", "Object", "[", "]", "{", "os", "}", ")", ";", "os", ".", "close", "(", ")", ";", "logger", ".", "info", "(", "\"文件已输出:\" + path);", "", "", "", "", "}" ]
保存Office文档 @param object {@link POIXMLDocument} 对象 @param path 输出路径 @throws IOException 异常 @throws NoSuchMethodException 异常 @throws IllegalAccessException 异常 @throws InvocationTargetException 异常
[ "保存Office文档" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/office/MsUtils.java#L34-L40
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java
PredictionsImpl.predictImageUrlWithNoStoreWithServiceResponseAsync
public Observable<ServiceResponse<ImagePrediction>> predictImageUrlWithNoStoreWithServiceResponseAsync(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) { """ Predict an image url without saving the result. @param projectId The project id @param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImagePrediction object """ if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final UUID iterationId = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.iterationId() : null; final String application = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.application() : null; final String url = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.url() : null; return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, iterationId, application, url); }
java
public Observable<ServiceResponse<ImagePrediction>> predictImageUrlWithNoStoreWithServiceResponseAsync(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final UUID iterationId = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.iterationId() : null; final String application = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.application() : null; final String url = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.url() : null; return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, iterationId, application, url); }
[ "public", "Observable", "<", "ServiceResponse", "<", "ImagePrediction", ">", ">", "predictImageUrlWithNoStoreWithServiceResponseAsync", "(", "UUID", "projectId", ",", "PredictImageUrlWithNoStoreOptionalParameter", "predictImageUrlWithNoStoreOptionalParameter", ")", "{", "if", "(", "projectId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter projectId is required and cannot be null.\"", ")", ";", "}", "if", "(", "this", ".", "client", ".", "apiKey", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.apiKey() is required and cannot be null.\"", ")", ";", "}", "final", "UUID", "iterationId", "=", "predictImageUrlWithNoStoreOptionalParameter", "!=", "null", "?", "predictImageUrlWithNoStoreOptionalParameter", ".", "iterationId", "(", ")", ":", "null", ";", "final", "String", "application", "=", "predictImageUrlWithNoStoreOptionalParameter", "!=", "null", "?", "predictImageUrlWithNoStoreOptionalParameter", ".", "application", "(", ")", ":", "null", ";", "final", "String", "url", "=", "predictImageUrlWithNoStoreOptionalParameter", "!=", "null", "?", "predictImageUrlWithNoStoreOptionalParameter", ".", "url", "(", ")", ":", "null", ";", "return", "predictImageUrlWithNoStoreWithServiceResponseAsync", "(", "projectId", ",", "iterationId", ",", "application", ",", "url", ")", ";", "}" ]
Predict an image url without saving the result. @param projectId The project id @param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImagePrediction object
[ "Predict", "an", "image", "url", "without", "saving", "the", "result", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L317-L329
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java
AbstractRadial.create_FOREGROUND_Image
protected BufferedImage create_FOREGROUND_Image(final int WIDTH, final boolean WITH_CENTER_KNOB, final ForegroundType TYPE) { """ Returns the image of the selected (FG_TYPE1, FG_TYPE2, FG_TYPE3) glasseffect, the centered knob (if wanted) @param WIDTH @param WITH_CENTER_KNOB @param TYPE @return the foreground image that will be used """ return create_FOREGROUND_Image(WIDTH, WITH_CENTER_KNOB, TYPE, null); }
java
protected BufferedImage create_FOREGROUND_Image(final int WIDTH, final boolean WITH_CENTER_KNOB, final ForegroundType TYPE) { return create_FOREGROUND_Image(WIDTH, WITH_CENTER_KNOB, TYPE, null); }
[ "protected", "BufferedImage", "create_FOREGROUND_Image", "(", "final", "int", "WIDTH", ",", "final", "boolean", "WITH_CENTER_KNOB", ",", "final", "ForegroundType", "TYPE", ")", "{", "return", "create_FOREGROUND_Image", "(", "WIDTH", ",", "WITH_CENTER_KNOB", ",", "TYPE", ",", "null", ")", ";", "}" ]
Returns the image of the selected (FG_TYPE1, FG_TYPE2, FG_TYPE3) glasseffect, the centered knob (if wanted) @param WIDTH @param WITH_CENTER_KNOB @param TYPE @return the foreground image that will be used
[ "Returns", "the", "image", "of", "the", "selected", "(", "FG_TYPE1", "FG_TYPE2", "FG_TYPE3", ")", "glasseffect", "the", "centered", "knob", "(", "if", "wanted", ")" ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java#L3058-L3060
CenturyLinkCloud/mdw
mdw-workflow/src/com/centurylink/mdw/workflow/activity/timer/TimerWaitActivity.java
TimerWaitActivity.resumeWaiting
public final boolean resumeWaiting(InternalEvent event) throws ActivityException { """ This method is made final for the class, as it contains internal logic handling resumption of waiting. It re-register the event waits including waiting for task to complete. If any event has already arrived, it processes it immediately. Customization should be done with the methods {@link #processOtherMessage(String, String)}, {@link #registerWaitEvents()}, and {@link #processTimerExpiration()}. """ // check if timer is expired at this time? try { ActivityInstance ai = getEngine().getActivityInstance(getActivityInstanceId()); Date expectedEndTime = ai.getEndDate(); long currentTime = DatabaseAccess.getCurrentTime(); if (currentTime>expectedEndTime.getTime()) { int moreSeconds = processTimerExpiration(); if (moreSeconds>0) sendDelayedResumeMessage(moreSeconds); else return true; } } catch (Exception e) { throw new ActivityException(-1, e.getMessage(), e); } EventWaitInstance received = registerWaitEvents(true,true); if (received!=null) { this.setReturnCode(received.getCompletionCode()); processOtherMessage(getExternalEventInstanceDetails(received.getMessageDocumentId())); handleEventCompletionCode(); return true; } else { return false; } }
java
public final boolean resumeWaiting(InternalEvent event) throws ActivityException { // check if timer is expired at this time? try { ActivityInstance ai = getEngine().getActivityInstance(getActivityInstanceId()); Date expectedEndTime = ai.getEndDate(); long currentTime = DatabaseAccess.getCurrentTime(); if (currentTime>expectedEndTime.getTime()) { int moreSeconds = processTimerExpiration(); if (moreSeconds>0) sendDelayedResumeMessage(moreSeconds); else return true; } } catch (Exception e) { throw new ActivityException(-1, e.getMessage(), e); } EventWaitInstance received = registerWaitEvents(true,true); if (received!=null) { this.setReturnCode(received.getCompletionCode()); processOtherMessage(getExternalEventInstanceDetails(received.getMessageDocumentId())); handleEventCompletionCode(); return true; } else { return false; } }
[ "public", "final", "boolean", "resumeWaiting", "(", "InternalEvent", "event", ")", "throws", "ActivityException", "{", "// check if timer is expired at this time?", "try", "{", "ActivityInstance", "ai", "=", "getEngine", "(", ")", ".", "getActivityInstance", "(", "getActivityInstanceId", "(", ")", ")", ";", "Date", "expectedEndTime", "=", "ai", ".", "getEndDate", "(", ")", ";", "long", "currentTime", "=", "DatabaseAccess", ".", "getCurrentTime", "(", ")", ";", "if", "(", "currentTime", ">", "expectedEndTime", ".", "getTime", "(", ")", ")", "{", "int", "moreSeconds", "=", "processTimerExpiration", "(", ")", ";", "if", "(", "moreSeconds", ">", "0", ")", "sendDelayedResumeMessage", "(", "moreSeconds", ")", ";", "else", "return", "true", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ActivityException", "(", "-", "1", ",", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "EventWaitInstance", "received", "=", "registerWaitEvents", "(", "true", ",", "true", ")", ";", "if", "(", "received", "!=", "null", ")", "{", "this", ".", "setReturnCode", "(", "received", ".", "getCompletionCode", "(", ")", ")", ";", "processOtherMessage", "(", "getExternalEventInstanceDetails", "(", "received", ".", "getMessageDocumentId", "(", ")", ")", ")", ";", "handleEventCompletionCode", "(", ")", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
This method is made final for the class, as it contains internal logic handling resumption of waiting. It re-register the event waits including waiting for task to complete. If any event has already arrived, it processes it immediately. Customization should be done with the methods {@link #processOtherMessage(String, String)}, {@link #registerWaitEvents()}, and {@link #processTimerExpiration()}.
[ "This", "method", "is", "made", "final", "for", "the", "class", "as", "it", "contains", "internal", "logic", "handling", "resumption", "of", "waiting", ".", "It", "re", "-", "register", "the", "event", "waits", "including", "waiting", "for", "task", "to", "complete", ".", "If", "any", "event", "has", "already", "arrived", "it", "processes", "it", "immediately", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/src/com/centurylink/mdw/workflow/activity/timer/TimerWaitActivity.java#L221-L246
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsADESessionCache.java
CmsADESessionCache.setLastPage
public void setLastPage(CmsObject cms, CmsUUID pageId, CmsUUID detailId) { """ Stores information about the last edited container page.<p> @param cms the CMS context @param pageId the page id @param detailId the detail content id """ m_lastPage = new LastPageBean(cms.getRequestContext().getSiteRoot(), pageId, detailId); }
java
public void setLastPage(CmsObject cms, CmsUUID pageId, CmsUUID detailId) { m_lastPage = new LastPageBean(cms.getRequestContext().getSiteRoot(), pageId, detailId); }
[ "public", "void", "setLastPage", "(", "CmsObject", "cms", ",", "CmsUUID", "pageId", ",", "CmsUUID", "detailId", ")", "{", "m_lastPage", "=", "new", "LastPageBean", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getSiteRoot", "(", ")", ",", "pageId", ",", "detailId", ")", ";", "}" ]
Stores information about the last edited container page.<p> @param cms the CMS context @param pageId the page id @param detailId the detail content id
[ "Stores", "information", "about", "the", "last", "edited", "container", "page", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADESessionCache.java#L464-L468
dadoonet/elasticsearch-beyonder
src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java
IndexElasticsearchUpdater.createIndex
@Deprecated public static void createIndex(Client client, String root, String index, boolean force) throws Exception { """ Create a new index in Elasticsearch. Read also _settings.json if exists. @param client Elasticsearch client @param root dir within the classpath @param index Index name @param force Remove index if exists (Warning: remove all data) @throws Exception if the elasticsearch API call is failing """ String settings = IndexSettingsReader.readSettings(root, index); createIndexWithSettings(client, index, settings, force); }
java
@Deprecated public static void createIndex(Client client, String root, String index, boolean force) throws Exception { String settings = IndexSettingsReader.readSettings(root, index); createIndexWithSettings(client, index, settings, force); }
[ "@", "Deprecated", "public", "static", "void", "createIndex", "(", "Client", "client", ",", "String", "root", ",", "String", "index", ",", "boolean", "force", ")", "throws", "Exception", "{", "String", "settings", "=", "IndexSettingsReader", ".", "readSettings", "(", "root", ",", "index", ")", ";", "createIndexWithSettings", "(", "client", ",", "index", ",", "settings", ",", "force", ")", ";", "}" ]
Create a new index in Elasticsearch. Read also _settings.json if exists. @param client Elasticsearch client @param root dir within the classpath @param index Index name @param force Remove index if exists (Warning: remove all data) @throws Exception if the elasticsearch API call is failing
[ "Create", "a", "new", "index", "in", "Elasticsearch", ".", "Read", "also", "_settings", ".", "json", "if", "exists", "." ]
train
https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java#L49-L53
xwiki/xwiki-rendering
xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/WikiPageUtil.java
WikiPageUtil.escapeXmlString
public static String escapeXmlString(String str, boolean escapeQuots) { """ Returns the escaped string. @param str the string to escape @param escapeQuots if this flag is <code>true</code> then "'" and "\"" symbols also will be escaped @return the escaped string. """ if (str == null) { return ""; } StringBuffer buf = new StringBuffer(); char[] array = str.toCharArray(); for (int i = 0; i < array.length; i++) { if (array[i] == '>' || array[i] == '&' || array[i] == '<' || (escapeQuots && (array[i] == '\'' || array[i] == '"'))) { buf.append("&#x" + Integer.toHexString(array[i]) + ";"); } else { buf.append(array[i]); } } return buf.toString(); }
java
public static String escapeXmlString(String str, boolean escapeQuots) { if (str == null) { return ""; } StringBuffer buf = new StringBuffer(); char[] array = str.toCharArray(); for (int i = 0; i < array.length; i++) { if (array[i] == '>' || array[i] == '&' || array[i] == '<' || (escapeQuots && (array[i] == '\'' || array[i] == '"'))) { buf.append("&#x" + Integer.toHexString(array[i]) + ";"); } else { buf.append(array[i]); } } return buf.toString(); }
[ "public", "static", "String", "escapeXmlString", "(", "String", "str", ",", "boolean", "escapeQuots", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "\"\"", ";", "}", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "char", "[", "]", "array", "=", "str", ".", "toCharArray", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "if", "(", "array", "[", "i", "]", "==", "'", "'", "||", "array", "[", "i", "]", "==", "'", "'", "||", "array", "[", "i", "]", "==", "'", "'", "||", "(", "escapeQuots", "&&", "(", "array", "[", "i", "]", "==", "'", "'", "||", "array", "[", "i", "]", "==", "'", "'", ")", ")", ")", "{", "buf", ".", "append", "(", "\"&#x\"", "+", "Integer", ".", "toHexString", "(", "array", "[", "i", "]", ")", "+", "\";\"", ")", ";", "}", "else", "{", "buf", ".", "append", "(", "array", "[", "i", "]", ")", ";", "}", "}", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Returns the escaped string. @param str the string to escape @param escapeQuots if this flag is <code>true</code> then "'" and "\"" symbols also will be escaped @return the escaped string.
[ "Returns", "the", "escaped", "string", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/WikiPageUtil.java#L163-L182
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java
DynamicJasperHelper.generateJRXML
public static void generateJRXML(DynamicReport dr, LayoutManager layoutManager, Map _parameters, String xmlEncoding, OutputStream outputStream) throws JRException { """ Creates a jrxml file @param dr @param layoutManager @param _parameters @param xmlEncoding (default is UTF-8 ) @param outputStream @throws JRException """ JasperReport jr = generateJasperReport(dr, layoutManager, _parameters); if (xmlEncoding == null) xmlEncoding = DEFAULT_XML_ENCODING; JRXmlWriter.writeReport(jr, outputStream, xmlEncoding); }
java
public static void generateJRXML(DynamicReport dr, LayoutManager layoutManager, Map _parameters, String xmlEncoding, OutputStream outputStream) throws JRException { JasperReport jr = generateJasperReport(dr, layoutManager, _parameters); if (xmlEncoding == null) xmlEncoding = DEFAULT_XML_ENCODING; JRXmlWriter.writeReport(jr, outputStream, xmlEncoding); }
[ "public", "static", "void", "generateJRXML", "(", "DynamicReport", "dr", ",", "LayoutManager", "layoutManager", ",", "Map", "_parameters", ",", "String", "xmlEncoding", ",", "OutputStream", "outputStream", ")", "throws", "JRException", "{", "JasperReport", "jr", "=", "generateJasperReport", "(", "dr", ",", "layoutManager", ",", "_parameters", ")", ";", "if", "(", "xmlEncoding", "==", "null", ")", "xmlEncoding", "=", "DEFAULT_XML_ENCODING", ";", "JRXmlWriter", ".", "writeReport", "(", "jr", ",", "outputStream", ",", "xmlEncoding", ")", ";", "}" ]
Creates a jrxml file @param dr @param layoutManager @param _parameters @param xmlEncoding (default is UTF-8 ) @param outputStream @throws JRException
[ "Creates", "a", "jrxml", "file" ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/DynamicJasperHelper.java#L350-L355
indeedeng/util
util-core/src/main/java/com/indeed/util/core/reference/AtomicSharedReference.java
AtomicSharedReference.mapWithCopy
public @Nullable <Z> Z mapWithCopy(Function<T, Z> f) throws IOException { """ Call some function f on a threadsafe copy of the reference we are storing. Should be used if you expect the function to take a while to run. Saving the value of T after this call returns is COMPLETELY UNSAFE. Don't do it. @param f lambda(T x) @param <Z> Return type; &lt;? extends Object&gt; @return result of f @throws IOException if closing the local reference throws. """ final @Nullable SharedReference<T> localRef = getCopy(); try { if (localRef == null) { return f.apply(null); } else { return f.apply(localRef.get()); } } finally { if (localRef != null) localRef.close(); } }
java
public @Nullable <Z> Z mapWithCopy(Function<T, Z> f) throws IOException { final @Nullable SharedReference<T> localRef = getCopy(); try { if (localRef == null) { return f.apply(null); } else { return f.apply(localRef.get()); } } finally { if (localRef != null) localRef.close(); } }
[ "public", "@", "Nullable", "<", "Z", ">", "Z", "mapWithCopy", "(", "Function", "<", "T", ",", "Z", ">", "f", ")", "throws", "IOException", "{", "final", "@", "Nullable", "SharedReference", "<", "T", ">", "localRef", "=", "getCopy", "(", ")", ";", "try", "{", "if", "(", "localRef", "==", "null", ")", "{", "return", "f", ".", "apply", "(", "null", ")", ";", "}", "else", "{", "return", "f", ".", "apply", "(", "localRef", ".", "get", "(", ")", ")", ";", "}", "}", "finally", "{", "if", "(", "localRef", "!=", "null", ")", "localRef", ".", "close", "(", ")", ";", "}", "}" ]
Call some function f on a threadsafe copy of the reference we are storing. Should be used if you expect the function to take a while to run. Saving the value of T after this call returns is COMPLETELY UNSAFE. Don't do it. @param f lambda(T x) @param <Z> Return type; &lt;? extends Object&gt; @return result of f @throws IOException if closing the local reference throws.
[ "Call", "some", "function", "f", "on", "a", "threadsafe", "copy", "of", "the", "reference", "we", "are", "storing", ".", "Should", "be", "used", "if", "you", "expect", "the", "function", "to", "take", "a", "while", "to", "run", ".", "Saving", "the", "value", "of", "T", "after", "this", "call", "returns", "is", "COMPLETELY", "UNSAFE", ".", "Don", "t", "do", "it", "." ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/reference/AtomicSharedReference.java#L149-L160
authorjapps/zerocode
core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java
BasicHttpClient.handleHeaders
public RequestBuilder handleHeaders(Map<String, Object> headers, RequestBuilder requestBuilder) { """ The framework will fall back to this default implementation to handle the headers. If you want to override any headers, you can do that by overriding the amendRequestHeaders(headers) method. @param headers @param requestBuilder @return : An effective Apache http request builder object with processed headers. """ Map<String, Object> amendedHeaders = amendRequestHeaders(headers); processFrameworkDefault(amendedHeaders, requestBuilder); return requestBuilder; }
java
public RequestBuilder handleHeaders(Map<String, Object> headers, RequestBuilder requestBuilder) { Map<String, Object> amendedHeaders = amendRequestHeaders(headers); processFrameworkDefault(amendedHeaders, requestBuilder); return requestBuilder; }
[ "public", "RequestBuilder", "handleHeaders", "(", "Map", "<", "String", ",", "Object", ">", "headers", ",", "RequestBuilder", "requestBuilder", ")", "{", "Map", "<", "String", ",", "Object", ">", "amendedHeaders", "=", "amendRequestHeaders", "(", "headers", ")", ";", "processFrameworkDefault", "(", "amendedHeaders", ",", "requestBuilder", ")", ";", "return", "requestBuilder", ";", "}" ]
The framework will fall back to this default implementation to handle the headers. If you want to override any headers, you can do that by overriding the amendRequestHeaders(headers) method. @param headers @param requestBuilder @return : An effective Apache http request builder object with processed headers.
[ "The", "framework", "will", "fall", "back", "to", "this", "default", "implementation", "to", "handle", "the", "headers", ".", "If", "you", "want", "to", "override", "any", "headers", "you", "can", "do", "that", "by", "overriding", "the", "amendRequestHeaders", "(", "headers", ")", "method", "." ]
train
https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java#L236-L240
akquinet/maven-latex-plugin
maven-latex-plugin/src/main/java/org/m2latex/mojo/TexFileUtilsImpl.java
TexFileUtilsImpl.getTargetDirectory
File getTargetDirectory( File sourceFile, File sourceBaseDir, File targetBaseDir ) throws MojoExecutionException, MojoFailureException { """ E.g. sourceFile /tmp/adir/afile, sourceBaseDir /tmp, targetBaseDir /home returns /home/adir/ """ String filePath; String tempPath; try { filePath = sourceFile.getParentFile().getCanonicalPath(); tempPath = sourceBaseDir.getCanonicalPath(); } catch ( IOException e ) { throw new MojoExecutionException( "Error getting canonical path", e ); } if ( !filePath.startsWith( tempPath ) ) { throw new MojoFailureException( "File " + sourceFile + " is expected to be somewhere under the following directory: " + tempPath ); } File targetDir = new File( targetBaseDir, filePath.substring( tempPath.length() ) ); return targetDir; }
java
File getTargetDirectory( File sourceFile, File sourceBaseDir, File targetBaseDir ) throws MojoExecutionException, MojoFailureException { String filePath; String tempPath; try { filePath = sourceFile.getParentFile().getCanonicalPath(); tempPath = sourceBaseDir.getCanonicalPath(); } catch ( IOException e ) { throw new MojoExecutionException( "Error getting canonical path", e ); } if ( !filePath.startsWith( tempPath ) ) { throw new MojoFailureException( "File " + sourceFile + " is expected to be somewhere under the following directory: " + tempPath ); } File targetDir = new File( targetBaseDir, filePath.substring( tempPath.length() ) ); return targetDir; }
[ "File", "getTargetDirectory", "(", "File", "sourceFile", ",", "File", "sourceBaseDir", ",", "File", "targetBaseDir", ")", "throws", "MojoExecutionException", ",", "MojoFailureException", "{", "String", "filePath", ";", "String", "tempPath", ";", "try", "{", "filePath", "=", "sourceFile", ".", "getParentFile", "(", ")", ".", "getCanonicalPath", "(", ")", ";", "tempPath", "=", "sourceBaseDir", ".", "getCanonicalPath", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "MojoExecutionException", "(", "\"Error getting canonical path\"", ",", "e", ")", ";", "}", "if", "(", "!", "filePath", ".", "startsWith", "(", "tempPath", ")", ")", "{", "throw", "new", "MojoFailureException", "(", "\"File \"", "+", "sourceFile", "+", "\" is expected to be somewhere under the following directory: \"", "+", "tempPath", ")", ";", "}", "File", "targetDir", "=", "new", "File", "(", "targetBaseDir", ",", "filePath", ".", "substring", "(", "tempPath", ".", "length", "(", ")", ")", ")", ";", "return", "targetDir", ";", "}" ]
E.g. sourceFile /tmp/adir/afile, sourceBaseDir /tmp, targetBaseDir /home returns /home/adir/
[ "E", ".", "g", ".", "sourceFile", "/", "tmp", "/", "adir", "/", "afile", "sourceBaseDir", "/", "tmp", "targetBaseDir", "/", "home", "returns", "/", "home", "/", "adir", "/" ]
train
https://github.com/akquinet/maven-latex-plugin/blob/bba6241eab5b3f2aceb9c7b79a082302709383ac/maven-latex-plugin/src/main/java/org/m2latex/mojo/TexFileUtilsImpl.java#L130-L153
rzwitserloot/lombok
src/core/lombok/javac/JavacNode.java
JavacNode.addError
public void addError(String message, DiagnosticPosition pos) { """ Generates an compiler error focused on the AST node represented by this node object. """ ast.printMessage(Diagnostic.Kind.ERROR, message, null, pos, true); }
java
public void addError(String message, DiagnosticPosition pos) { ast.printMessage(Diagnostic.Kind.ERROR, message, null, pos, true); }
[ "public", "void", "addError", "(", "String", "message", ",", "DiagnosticPosition", "pos", ")", "{", "ast", ".", "printMessage", "(", "Diagnostic", ".", "Kind", ".", "ERROR", ",", "message", ",", "null", ",", "pos", ",", "true", ")", ";", "}" ]
Generates an compiler error focused on the AST node represented by this node object.
[ "Generates", "an", "compiler", "error", "focused", "on", "the", "AST", "node", "represented", "by", "this", "node", "object", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/JavacNode.java#L262-L264
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/HandlablesImpl.java
HandlablesImpl.addSuperClass
private void addSuperClass(Object object, Class<?> type) { """ Add object parent super type. @param object The current object to check. @param type The current class level to check. """ for (final Class<?> types : type.getInterfaces()) { addType(types, object); } final Class<?> parent = type.getSuperclass(); if (parent != null) { addSuperClass(object, parent); } }
java
private void addSuperClass(Object object, Class<?> type) { for (final Class<?> types : type.getInterfaces()) { addType(types, object); } final Class<?> parent = type.getSuperclass(); if (parent != null) { addSuperClass(object, parent); } }
[ "private", "void", "addSuperClass", "(", "Object", "object", ",", "Class", "<", "?", ">", "type", ")", "{", "for", "(", "final", "Class", "<", "?", ">", "types", ":", "type", ".", "getInterfaces", "(", ")", ")", "{", "addType", "(", "types", ",", "object", ")", ";", "}", "final", "Class", "<", "?", ">", "parent", "=", "type", ".", "getSuperclass", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "addSuperClass", "(", "object", ",", "parent", ")", ";", "}", "}" ]
Add object parent super type. @param object The current object to check. @param type The current class level to check.
[ "Add", "object", "parent", "super", "type", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/HandlablesImpl.java#L139-L150
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/BufferedByteInputStream.java
BufferedByteInputStream.wrapInputStream
public static DataInputStream wrapInputStream(InputStream is, int bufferSize, int readBufferSize) { """ Wrap given input stream with BufferedByteInputOutput. This is the only way to instantiate the buffered input stream. @param is underlying input stream @param bufferSize size of the in memory buffer @param readBufferSize size of the buffer used for reading from is """ // wrapping BufferedByteInputStream in BufferedInputStream decreases // pressure on BBIS internal locks, and we read from the BBIS in // bigger chunks return new DataInputStream(new BufferedInputStream( new BufferedByteInputStream(is, bufferSize, readBufferSize))); }
java
public static DataInputStream wrapInputStream(InputStream is, int bufferSize, int readBufferSize) { // wrapping BufferedByteInputStream in BufferedInputStream decreases // pressure on BBIS internal locks, and we read from the BBIS in // bigger chunks return new DataInputStream(new BufferedInputStream( new BufferedByteInputStream(is, bufferSize, readBufferSize))); }
[ "public", "static", "DataInputStream", "wrapInputStream", "(", "InputStream", "is", ",", "int", "bufferSize", ",", "int", "readBufferSize", ")", "{", "// wrapping BufferedByteInputStream in BufferedInputStream decreases", "// pressure on BBIS internal locks, and we read from the BBIS in", "// bigger chunks", "return", "new", "DataInputStream", "(", "new", "BufferedInputStream", "(", "new", "BufferedByteInputStream", "(", "is", ",", "bufferSize", ",", "readBufferSize", ")", ")", ")", ";", "}" ]
Wrap given input stream with BufferedByteInputOutput. This is the only way to instantiate the buffered input stream. @param is underlying input stream @param bufferSize size of the in memory buffer @param readBufferSize size of the buffer used for reading from is
[ "Wrap", "given", "input", "stream", "with", "BufferedByteInputOutput", ".", "This", "is", "the", "only", "way", "to", "instantiate", "the", "buffered", "input", "stream", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/BufferedByteInputStream.java#L57-L64
fcrepo4-exts/fcrepo-camel-toolbox
fcrepo-ldpath/src/main/java/org/fcrepo/camel/ldpath/ClientFactory.java
ClientFactory.createClient
public static ClientConfiguration createClient(final Endpoint endpoint, final DataProvider provider) { """ Configure a linked data client suitable for use with a Fedora Repository. @param endpoint Endpoint to enable on the client @param provider Provider to enable on the client @return a configuration for use with an LDClient """ return createClient(singletonList(endpoint), singletonList(provider)); }
java
public static ClientConfiguration createClient(final Endpoint endpoint, final DataProvider provider) { return createClient(singletonList(endpoint), singletonList(provider)); }
[ "public", "static", "ClientConfiguration", "createClient", "(", "final", "Endpoint", "endpoint", ",", "final", "DataProvider", "provider", ")", "{", "return", "createClient", "(", "singletonList", "(", "endpoint", ")", ",", "singletonList", "(", "provider", ")", ")", ";", "}" ]
Configure a linked data client suitable for use with a Fedora Repository. @param endpoint Endpoint to enable on the client @param provider Provider to enable on the client @return a configuration for use with an LDClient
[ "Configure", "a", "linked", "data", "client", "suitable", "for", "use", "with", "a", "Fedora", "Repository", "." ]
train
https://github.com/fcrepo4-exts/fcrepo-camel-toolbox/blob/9e0cf220937b2d5c050e0e071f0cdc4c7a084c0f/fcrepo-ldpath/src/main/java/org/fcrepo/camel/ldpath/ClientFactory.java#L72-L74
cdk/cdk
tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java
MolecularFormulaManipulator.getAtomContainer
public static IAtomContainer getAtomContainer(String formulaString, IChemObjectBuilder builder) { """ Converts a formula string (like "C2H4") into an atom container with atoms but no bonds. @param formulaString the formula to convert @param builder a chem object builder @return atoms wrapped in an atom container """ return MolecularFormulaManipulator.getAtomContainer(MolecularFormulaManipulator.getMolecularFormula( formulaString, builder)); }
java
public static IAtomContainer getAtomContainer(String formulaString, IChemObjectBuilder builder) { return MolecularFormulaManipulator.getAtomContainer(MolecularFormulaManipulator.getMolecularFormula( formulaString, builder)); }
[ "public", "static", "IAtomContainer", "getAtomContainer", "(", "String", "formulaString", ",", "IChemObjectBuilder", "builder", ")", "{", "return", "MolecularFormulaManipulator", ".", "getAtomContainer", "(", "MolecularFormulaManipulator", ".", "getMolecularFormula", "(", "formulaString", ",", "builder", ")", ")", ";", "}" ]
Converts a formula string (like "C2H4") into an atom container with atoms but no bonds. @param formulaString the formula to convert @param builder a chem object builder @return atoms wrapped in an atom container
[ "Converts", "a", "formula", "string", "(", "like", "C2H4", ")", "into", "an", "atom", "container", "with", "atoms", "but", "no", "bonds", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java#L1131-L1134
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.getScheduledNotificationRecipients
public void getScheduledNotificationRecipients(ScheduledNotification notification, Collection<Recipient> result) { """ Returns a list of recipients associated with a scheduled notification. @param notification A scheduled notification. @param result Recipients associated with the notification. """ List<String> lst = broker.callRPCList("RGCWXQ SCHRECIP", null, notification.getIen()); result.clear(); for (String data : lst) { result.add(new Recipient(data)); } }
java
public void getScheduledNotificationRecipients(ScheduledNotification notification, Collection<Recipient> result) { List<String> lst = broker.callRPCList("RGCWXQ SCHRECIP", null, notification.getIen()); result.clear(); for (String data : lst) { result.add(new Recipient(data)); } }
[ "public", "void", "getScheduledNotificationRecipients", "(", "ScheduledNotification", "notification", ",", "Collection", "<", "Recipient", ">", "result", ")", "{", "List", "<", "String", ">", "lst", "=", "broker", ".", "callRPCList", "(", "\"RGCWXQ SCHRECIP\"", ",", "null", ",", "notification", ".", "getIen", "(", ")", ")", ";", "result", ".", "clear", "(", ")", ";", "for", "(", "String", "data", ":", "lst", ")", "{", "result", ".", "add", "(", "new", "Recipient", "(", "data", ")", ")", ";", "}", "}" ]
Returns a list of recipients associated with a scheduled notification. @param notification A scheduled notification. @param result Recipients associated with the notification.
[ "Returns", "a", "list", "of", "recipients", "associated", "with", "a", "scheduled", "notification", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L226-L233
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/core/ECKey.java
ECKey.signatureToKey
public static ECKey signatureToKey(byte[] messageHash, String signatureBase64) throws SignatureException { """ Compute the key that signed the given signature. @param messageHash 32-byte hash of message @param signatureBase64 Base-64 encoded signature @return ECKey @throws SignatureException SignatureException """ final byte[] keyBytes = signatureToKeyBytes(messageHash, signatureBase64); return ECKey.fromPublicOnly(keyBytes); }
java
public static ECKey signatureToKey(byte[] messageHash, String signatureBase64) throws SignatureException { final byte[] keyBytes = signatureToKeyBytes(messageHash, signatureBase64); return ECKey.fromPublicOnly(keyBytes); }
[ "public", "static", "ECKey", "signatureToKey", "(", "byte", "[", "]", "messageHash", ",", "String", "signatureBase64", ")", "throws", "SignatureException", "{", "final", "byte", "[", "]", "keyBytes", "=", "signatureToKeyBytes", "(", "messageHash", ",", "signatureBase64", ")", ";", "return", "ECKey", ".", "fromPublicOnly", "(", "keyBytes", ")", ";", "}" ]
Compute the key that signed the given signature. @param messageHash 32-byte hash of message @param signatureBase64 Base-64 encoded signature @return ECKey @throws SignatureException SignatureException
[ "Compute", "the", "key", "that", "signed", "the", "given", "signature", "." ]
train
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L902-L905
temyers/cucumber-jvm-parallel-plugin
src/main/java/com/github/timm/cucumber/generate/GenerateRunnersMojo.java
GenerateRunnersMojo.execute
public void execute() throws MojoExecutionException { """ Called by Maven to run this mojo after parameters have been injected. """ if (!featuresDirectory.exists()) { throw new MojoExecutionException("Features directory does not exist"); } final Collection<File> featureFiles = listFiles(featuresDirectory, new String[] {"feature"}, true); final List<File> sortedFeatureFiles = new NameFileComparator().sort(new ArrayList<File>(featureFiles)); createOutputDirIfRequired(); File packageDirectory = packageName == null ? outputDirectory : new File(outputDirectory, packageName.replace('.','/')); if (!packageDirectory.exists()) { packageDirectory.mkdirs(); } final CucumberITGenerator fileGenerator = createFileGenerator(); fileGenerator.generateCucumberITFiles(packageDirectory, sortedFeatureFiles); getLog().info("Adding " + outputDirectory.getAbsolutePath() + " to test-compile source root"); project.addTestCompileSourceRoot(outputDirectory.getAbsolutePath()); }
java
public void execute() throws MojoExecutionException { if (!featuresDirectory.exists()) { throw new MojoExecutionException("Features directory does not exist"); } final Collection<File> featureFiles = listFiles(featuresDirectory, new String[] {"feature"}, true); final List<File> sortedFeatureFiles = new NameFileComparator().sort(new ArrayList<File>(featureFiles)); createOutputDirIfRequired(); File packageDirectory = packageName == null ? outputDirectory : new File(outputDirectory, packageName.replace('.','/')); if (!packageDirectory.exists()) { packageDirectory.mkdirs(); } final CucumberITGenerator fileGenerator = createFileGenerator(); fileGenerator.generateCucumberITFiles(packageDirectory, sortedFeatureFiles); getLog().info("Adding " + outputDirectory.getAbsolutePath() + " to test-compile source root"); project.addTestCompileSourceRoot(outputDirectory.getAbsolutePath()); }
[ "public", "void", "execute", "(", ")", "throws", "MojoExecutionException", "{", "if", "(", "!", "featuresDirectory", ".", "exists", "(", ")", ")", "{", "throw", "new", "MojoExecutionException", "(", "\"Features directory does not exist\"", ")", ";", "}", "final", "Collection", "<", "File", ">", "featureFiles", "=", "listFiles", "(", "featuresDirectory", ",", "new", "String", "[", "]", "{", "\"feature\"", "}", ",", "true", ")", ";", "final", "List", "<", "File", ">", "sortedFeatureFiles", "=", "new", "NameFileComparator", "(", ")", ".", "sort", "(", "new", "ArrayList", "<", "File", ">", "(", "featureFiles", ")", ")", ";", "createOutputDirIfRequired", "(", ")", ";", "File", "packageDirectory", "=", "packageName", "==", "null", "?", "outputDirectory", ":", "new", "File", "(", "outputDirectory", ",", "packageName", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ")", ";", "if", "(", "!", "packageDirectory", ".", "exists", "(", ")", ")", "{", "packageDirectory", ".", "mkdirs", "(", ")", ";", "}", "final", "CucumberITGenerator", "fileGenerator", "=", "createFileGenerator", "(", ")", ";", "fileGenerator", ".", "generateCucumberITFiles", "(", "packageDirectory", ",", "sortedFeatureFiles", ")", ";", "getLog", "(", ")", ".", "info", "(", "\"Adding \"", "+", "outputDirectory", ".", "getAbsolutePath", "(", ")", "+", "\" to test-compile source root\"", ")", ";", "project", ".", "addTestCompileSourceRoot", "(", "outputDirectory", ".", "getAbsolutePath", "(", ")", ")", ";", "}" ]
Called by Maven to run this mojo after parameters have been injected.
[ "Called", "by", "Maven", "to", "run", "this", "mojo", "after", "parameters", "have", "been", "injected", "." ]
train
https://github.com/temyers/cucumber-jvm-parallel-plugin/blob/931628fc1e2822be667ec216e10e706993974aa4/src/main/java/com/github/timm/cucumber/generate/GenerateRunnersMojo.java#L190-L216
OpenLiberty/open-liberty
dev/com.ibm.ws.springboot.utility/src/com/ibm/ws/springboot/utility/tasks/BaseCommandTask.java
BaseCommandTask.validateArgumentList
protected void validateArgumentList(String[] args) { """ Validates that there are no unknown arguments or values specified to the task. @param args The script arguments @throws IllegalArgumentException if an argument is defined is unknown """ checkRequiredArguments(args); // Skip the first argument as it is the task name // Arguments and values come in pairs (expect -password). // Anything outside of that pattern is invalid. // Loop through, jumping in pairs except when we encounter // -password -- that may be an interactive prompt which won't // define a value. for (int i = 1; i < args.length; i++) { String argPair = args[i]; String arg = null; String value = null; if (argPair.contains("=")) { arg = argPair.split("=")[0]; value = getValue(argPair); } else { arg = argPair; } if (!isKnownArgument(arg)) { throw new IllegalArgumentException(getMessage("invalidArg", arg)); } else { if (value == null) { throw new IllegalArgumentException(getMessage("missingValue", arg)); } } } }
java
protected void validateArgumentList(String[] args) { checkRequiredArguments(args); // Skip the first argument as it is the task name // Arguments and values come in pairs (expect -password). // Anything outside of that pattern is invalid. // Loop through, jumping in pairs except when we encounter // -password -- that may be an interactive prompt which won't // define a value. for (int i = 1; i < args.length; i++) { String argPair = args[i]; String arg = null; String value = null; if (argPair.contains("=")) { arg = argPair.split("=")[0]; value = getValue(argPair); } else { arg = argPair; } if (!isKnownArgument(arg)) { throw new IllegalArgumentException(getMessage("invalidArg", arg)); } else { if (value == null) { throw new IllegalArgumentException(getMessage("missingValue", arg)); } } } }
[ "protected", "void", "validateArgumentList", "(", "String", "[", "]", "args", ")", "{", "checkRequiredArguments", "(", "args", ")", ";", "// Skip the first argument as it is the task name", "// Arguments and values come in pairs (expect -password).", "// Anything outside of that pattern is invalid.", "// Loop through, jumping in pairs except when we encounter", "// -password -- that may be an interactive prompt which won't", "// define a value.", "for", "(", "int", "i", "=", "1", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "String", "argPair", "=", "args", "[", "i", "]", ";", "String", "arg", "=", "null", ";", "String", "value", "=", "null", ";", "if", "(", "argPair", ".", "contains", "(", "\"=\"", ")", ")", "{", "arg", "=", "argPair", ".", "split", "(", "\"=\"", ")", "[", "0", "]", ";", "value", "=", "getValue", "(", "argPair", ")", ";", "}", "else", "{", "arg", "=", "argPair", ";", "}", "if", "(", "!", "isKnownArgument", "(", "arg", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "getMessage", "(", "\"invalidArg\"", ",", "arg", ")", ")", ";", "}", "else", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "getMessage", "(", "\"missingValue\"", ",", "arg", ")", ")", ";", "}", "}", "}", "}" ]
Validates that there are no unknown arguments or values specified to the task. @param args The script arguments @throws IllegalArgumentException if an argument is defined is unknown
[ "Validates", "that", "there", "are", "no", "unknown", "arguments", "or", "values", "specified", "to", "the", "task", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.springboot.utility/src/com/ibm/ws/springboot/utility/tasks/BaseCommandTask.java#L196-L224
Kurento/kurento-module-creator
src/main/java/org/kurento/modulecreator/VersionManager.java
VersionManager.versionCompare
public static Integer versionCompare(String str1, String str2) { """ Compares two version strings. <p> Use this instead of String.compareTo() for a non-lexicographical comparison that works for version strings. e.g. "1.10".compareTo("1.6"). </p> @note It does not work if "1.10" is supposed to be equal to "1.10.0". @param str1 a string of ordinal numbers separated by decimal points. @param str2 a string of ordinal numbers separated by decimal points. @return The result is a negative integer if str1 is _numerically_ less than str2. The result is a positive integer if str1 is _numerically_ greater than str2. The result is zero if the strings are _numerically_ equal. """ String[] vals1 = str1.split("\\."); String[] vals2 = str2.split("\\."); int idx = 0; // set index to first non-equal ordinal or length of shortest version // string while (idx < vals1.length && idx < vals2.length && vals1[idx].equals(vals2[idx])) { idx++; } // compare first non-equal ordinal number if (idx < vals1.length && idx < vals2.length) { int diff = Integer.valueOf(vals1[idx]).compareTo(Integer.valueOf(vals2[idx])); return Integer.signum(diff); } else { // the strings are equal or one string is a substring of the other // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" return Integer.signum(vals1.length - vals2.length); } }
java
public static Integer versionCompare(String str1, String str2) { String[] vals1 = str1.split("\\."); String[] vals2 = str2.split("\\."); int idx = 0; // set index to first non-equal ordinal or length of shortest version // string while (idx < vals1.length && idx < vals2.length && vals1[idx].equals(vals2[idx])) { idx++; } // compare first non-equal ordinal number if (idx < vals1.length && idx < vals2.length) { int diff = Integer.valueOf(vals1[idx]).compareTo(Integer.valueOf(vals2[idx])); return Integer.signum(diff); } else { // the strings are equal or one string is a substring of the other // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" return Integer.signum(vals1.length - vals2.length); } }
[ "public", "static", "Integer", "versionCompare", "(", "String", "str1", ",", "String", "str2", ")", "{", "String", "[", "]", "vals1", "=", "str1", ".", "split", "(", "\"\\\\.\"", ")", ";", "String", "[", "]", "vals2", "=", "str2", ".", "split", "(", "\"\\\\.\"", ")", ";", "int", "idx", "=", "0", ";", "// set index to first non-equal ordinal or length of shortest version", "// string", "while", "(", "idx", "<", "vals1", ".", "length", "&&", "idx", "<", "vals2", ".", "length", "&&", "vals1", "[", "idx", "]", ".", "equals", "(", "vals2", "[", "idx", "]", ")", ")", "{", "idx", "++", ";", "}", "// compare first non-equal ordinal number", "if", "(", "idx", "<", "vals1", ".", "length", "&&", "idx", "<", "vals2", ".", "length", ")", "{", "int", "diff", "=", "Integer", ".", "valueOf", "(", "vals1", "[", "idx", "]", ")", ".", "compareTo", "(", "Integer", ".", "valueOf", "(", "vals2", "[", "idx", "]", ")", ")", ";", "return", "Integer", ".", "signum", "(", "diff", ")", ";", "}", "else", "{", "// the strings are equal or one string is a substring of the other", "// e.g. \"1.2.3\" = \"1.2.3\" or \"1.2.3\" < \"1.2.3.4\"", "return", "Integer", ".", "signum", "(", "vals1", ".", "length", "-", "vals2", ".", "length", ")", ";", "}", "}" ]
Compares two version strings. <p> Use this instead of String.compareTo() for a non-lexicographical comparison that works for version strings. e.g. "1.10".compareTo("1.6"). </p> @note It does not work if "1.10" is supposed to be equal to "1.10.0". @param str1 a string of ordinal numbers separated by decimal points. @param str2 a string of ordinal numbers separated by decimal points. @return The result is a negative integer if str1 is _numerically_ less than str2. The result is a positive integer if str1 is _numerically_ greater than str2. The result is zero if the strings are _numerically_ equal.
[ "Compares", "two", "version", "strings", "." ]
train
https://github.com/Kurento/kurento-module-creator/blob/c371516c665b902b5476433496a5aefcbca86d64/src/main/java/org/kurento/modulecreator/VersionManager.java#L268-L288
neo4j-contrib/neo4j-apoc-procedures
src/main/java/apoc/path/NodeEvaluators.java
NodeEvaluators.endAndTerminatorNodeEvaluator
public static Evaluator endAndTerminatorNodeEvaluator(List<Node> endNodes, List<Node> terminatorNodes) { """ Returns an evaluator which handles end nodes and terminator nodes Returns null if both lists are empty """ Evaluator endNodeEvaluator = null; Evaluator terminatorNodeEvaluator = null; if (!endNodes.isEmpty()) { Node[] nodes = endNodes.toArray(new Node[endNodes.size()]); endNodeEvaluator = Evaluators.includeWhereEndNodeIs(nodes); } if (!terminatorNodes.isEmpty()) { Node[] nodes = terminatorNodes.toArray(new Node[terminatorNodes.size()]); terminatorNodeEvaluator = Evaluators.pruneWhereEndNodeIs(nodes); } if (endNodeEvaluator != null || terminatorNodeEvaluator != null) { return new EndAndTerminatorNodeEvaluator(endNodeEvaluator, terminatorNodeEvaluator); } return null; }
java
public static Evaluator endAndTerminatorNodeEvaluator(List<Node> endNodes, List<Node> terminatorNodes) { Evaluator endNodeEvaluator = null; Evaluator terminatorNodeEvaluator = null; if (!endNodes.isEmpty()) { Node[] nodes = endNodes.toArray(new Node[endNodes.size()]); endNodeEvaluator = Evaluators.includeWhereEndNodeIs(nodes); } if (!terminatorNodes.isEmpty()) { Node[] nodes = terminatorNodes.toArray(new Node[terminatorNodes.size()]); terminatorNodeEvaluator = Evaluators.pruneWhereEndNodeIs(nodes); } if (endNodeEvaluator != null || terminatorNodeEvaluator != null) { return new EndAndTerminatorNodeEvaluator(endNodeEvaluator, terminatorNodeEvaluator); } return null; }
[ "public", "static", "Evaluator", "endAndTerminatorNodeEvaluator", "(", "List", "<", "Node", ">", "endNodes", ",", "List", "<", "Node", ">", "terminatorNodes", ")", "{", "Evaluator", "endNodeEvaluator", "=", "null", ";", "Evaluator", "terminatorNodeEvaluator", "=", "null", ";", "if", "(", "!", "endNodes", ".", "isEmpty", "(", ")", ")", "{", "Node", "[", "]", "nodes", "=", "endNodes", ".", "toArray", "(", "new", "Node", "[", "endNodes", ".", "size", "(", ")", "]", ")", ";", "endNodeEvaluator", "=", "Evaluators", ".", "includeWhereEndNodeIs", "(", "nodes", ")", ";", "}", "if", "(", "!", "terminatorNodes", ".", "isEmpty", "(", ")", ")", "{", "Node", "[", "]", "nodes", "=", "terminatorNodes", ".", "toArray", "(", "new", "Node", "[", "terminatorNodes", ".", "size", "(", ")", "]", ")", ";", "terminatorNodeEvaluator", "=", "Evaluators", ".", "pruneWhereEndNodeIs", "(", "nodes", ")", ";", "}", "if", "(", "endNodeEvaluator", "!=", "null", "||", "terminatorNodeEvaluator", "!=", "null", ")", "{", "return", "new", "EndAndTerminatorNodeEvaluator", "(", "endNodeEvaluator", ",", "terminatorNodeEvaluator", ")", ";", "}", "return", "null", ";", "}" ]
Returns an evaluator which handles end nodes and terminator nodes Returns null if both lists are empty
[ "Returns", "an", "evaluator", "which", "handles", "end", "nodes", "and", "terminator", "nodes", "Returns", "null", "if", "both", "lists", "are", "empty" ]
train
https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/path/NodeEvaluators.java#L24-L43
line/armeria
core/src/main/java/com/linecorp/armeria/server/file/HttpFileServiceBuilder.java
HttpFileServiceBuilder.forClassPath
public static HttpFileServiceBuilder forClassPath(ClassLoader classLoader, String rootDir) { """ Creates a new {@link HttpFileServiceBuilder} with the specified {@code rootDir} in the current class path. """ return forVfs(HttpVfs.ofClassPath(classLoader, rootDir)); }
java
public static HttpFileServiceBuilder forClassPath(ClassLoader classLoader, String rootDir) { return forVfs(HttpVfs.ofClassPath(classLoader, rootDir)); }
[ "public", "static", "HttpFileServiceBuilder", "forClassPath", "(", "ClassLoader", "classLoader", ",", "String", "rootDir", ")", "{", "return", "forVfs", "(", "HttpVfs", ".", "ofClassPath", "(", "classLoader", ",", "rootDir", ")", ")", ";", "}" ]
Creates a new {@link HttpFileServiceBuilder} with the specified {@code rootDir} in the current class path.
[ "Creates", "a", "new", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/file/HttpFileServiceBuilder.java#L69-L71
JoeKerouac/utils
src/main/java/com/joe/utils/secure/impl/SymmetryCipher.java
SymmetryCipher.buildInstance
public static CipherUtil buildInstance(Algorithms algorithms, String seed, int keySize) { """ SymmetryCipher构造器 @param algorithms 算法,当前仅支持AES和DES @param seed 随机数种子 @param keySize keySize @return SymmetryCipher """ String id = (algorithms.name() + seed + keySize).intern(); SecretKey key = KEY_CACHE.compute(id, (k, v) -> { if (v == null) { return KeyTools.buildKey(algorithms, seed, keySize); } else { return v; } }); return buildInstance(algorithms, key.getEncoded()); }
java
public static CipherUtil buildInstance(Algorithms algorithms, String seed, int keySize) { String id = (algorithms.name() + seed + keySize).intern(); SecretKey key = KEY_CACHE.compute(id, (k, v) -> { if (v == null) { return KeyTools.buildKey(algorithms, seed, keySize); } else { return v; } }); return buildInstance(algorithms, key.getEncoded()); }
[ "public", "static", "CipherUtil", "buildInstance", "(", "Algorithms", "algorithms", ",", "String", "seed", ",", "int", "keySize", ")", "{", "String", "id", "=", "(", "algorithms", ".", "name", "(", ")", "+", "seed", "+", "keySize", ")", ".", "intern", "(", ")", ";", "SecretKey", "key", "=", "KEY_CACHE", ".", "compute", "(", "id", ",", "(", "k", ",", "v", ")", "->", "{", "if", "(", "v", "==", "null", ")", "{", "return", "KeyTools", ".", "buildKey", "(", "algorithms", ",", "seed", ",", "keySize", ")", ";", "}", "else", "{", "return", "v", ";", "}", "}", ")", ";", "return", "buildInstance", "(", "algorithms", ",", "key", ".", "getEncoded", "(", ")", ")", ";", "}" ]
SymmetryCipher构造器 @param algorithms 算法,当前仅支持AES和DES @param seed 随机数种子 @param keySize keySize @return SymmetryCipher
[ "SymmetryCipher构造器" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/secure/impl/SymmetryCipher.java#L65-L75
amplexus/java-flac-encoder
src/main/java/net/sourceforge/javaflacencoder/EncodedElement.java
EncodedElement.addLong
private static void addLong(long input, int count, int startPos, byte[] dest) { """ This method adds a given number of bits of a long to a byte array. @param input long to store bits from @param count number of low-order bits to store @param startPos start bit location in array to begin writing @param dest array to store bits in. dest MUST have enough space to store the given data, or this function will fail. """ if(DEBUG_LEV > 30) System.err.println("EncodedElement::addLong : Begin"); int currentByte = startPos/8; int currentOffset = startPos%8; int bitRoom;//how many bits can be placed in current byte long upMask;//to clear upper bits(lower bits auto-cleared by L-shift int downShift;//bits to shift down, isolating top bits of input int upShift;//bits to shift up, packing byte from top. while(count > 0) { //find how many bits can be placed in current byte bitRoom = 8-currentOffset; //get those bits //i.e, take upper 'bitsNeeded' of input, put to lower part of byte. downShift = count-bitRoom; upMask = 255 >>> currentOffset; upShift = 0; if(downShift < 0) { //upMask = 255 >>> bitRoom-count; upShift = bitRoom - count; upMask = 255 >>> (currentOffset+upShift); downShift = 0; } if(DEBUG_LEV > 30) { System.err.println("count:offset:bitRoom:downShift:upShift:" + count+":"+currentOffset+":"+bitRoom+":"+downShift+":"+upShift); } long currentBits = (input >>> downShift) & (upMask); //shift bits back up to match offset currentBits = currentBits << upShift; upMask = (byte)upMask << upShift; dest[currentByte] = (byte)(dest[currentByte] & (~upMask)); //merge bytes~ dest[currentByte] = (byte)(dest[currentByte] | currentBits); //System.out.println("new currentByte: " + dest[currentByte]); count -= bitRoom; currentOffset = 0; currentByte++; } if(DEBUG_LEV > 30) System.err.println("EncodedElement::addLong : End"); }
java
private static void addLong(long input, int count, int startPos, byte[] dest) { if(DEBUG_LEV > 30) System.err.println("EncodedElement::addLong : Begin"); int currentByte = startPos/8; int currentOffset = startPos%8; int bitRoom;//how many bits can be placed in current byte long upMask;//to clear upper bits(lower bits auto-cleared by L-shift int downShift;//bits to shift down, isolating top bits of input int upShift;//bits to shift up, packing byte from top. while(count > 0) { //find how many bits can be placed in current byte bitRoom = 8-currentOffset; //get those bits //i.e, take upper 'bitsNeeded' of input, put to lower part of byte. downShift = count-bitRoom; upMask = 255 >>> currentOffset; upShift = 0; if(downShift < 0) { //upMask = 255 >>> bitRoom-count; upShift = bitRoom - count; upMask = 255 >>> (currentOffset+upShift); downShift = 0; } if(DEBUG_LEV > 30) { System.err.println("count:offset:bitRoom:downShift:upShift:" + count+":"+currentOffset+":"+bitRoom+":"+downShift+":"+upShift); } long currentBits = (input >>> downShift) & (upMask); //shift bits back up to match offset currentBits = currentBits << upShift; upMask = (byte)upMask << upShift; dest[currentByte] = (byte)(dest[currentByte] & (~upMask)); //merge bytes~ dest[currentByte] = (byte)(dest[currentByte] | currentBits); //System.out.println("new currentByte: " + dest[currentByte]); count -= bitRoom; currentOffset = 0; currentByte++; } if(DEBUG_LEV > 30) System.err.println("EncodedElement::addLong : End"); }
[ "private", "static", "void", "addLong", "(", "long", "input", ",", "int", "count", ",", "int", "startPos", ",", "byte", "[", "]", "dest", ")", "{", "if", "(", "DEBUG_LEV", ">", "30", ")", "System", ".", "err", ".", "println", "(", "\"EncodedElement::addLong : Begin\"", ")", ";", "int", "currentByte", "=", "startPos", "/", "8", ";", "int", "currentOffset", "=", "startPos", "%", "8", ";", "int", "bitRoom", ";", "//how many bits can be placed in current byte", "long", "upMask", ";", "//to clear upper bits(lower bits auto-cleared by L-shift", "int", "downShift", ";", "//bits to shift down, isolating top bits of input", "int", "upShift", ";", "//bits to shift up, packing byte from top.", "while", "(", "count", ">", "0", ")", "{", "//find how many bits can be placed in current byte", "bitRoom", "=", "8", "-", "currentOffset", ";", "//get those bits", "//i.e, take upper 'bitsNeeded' of input, put to lower part of byte.", "downShift", "=", "count", "-", "bitRoom", ";", "upMask", "=", "255", ">>>", "currentOffset", ";", "upShift", "=", "0", ";", "if", "(", "downShift", "<", "0", ")", "{", "//upMask = 255 >>> bitRoom-count;", "upShift", "=", "bitRoom", "-", "count", ";", "upMask", "=", "255", ">>>", "(", "currentOffset", "+", "upShift", ")", ";", "downShift", "=", "0", ";", "}", "if", "(", "DEBUG_LEV", ">", "30", ")", "{", "System", ".", "err", ".", "println", "(", "\"count:offset:bitRoom:downShift:upShift:\"", "+", "count", "+", "\":\"", "+", "currentOffset", "+", "\":\"", "+", "bitRoom", "+", "\":\"", "+", "downShift", "+", "\":\"", "+", "upShift", ")", ";", "}", "long", "currentBits", "=", "(", "input", ">>>", "downShift", ")", "&", "(", "upMask", ")", ";", "//shift bits back up to match offset", "currentBits", "=", "currentBits", "<<", "upShift", ";", "upMask", "=", "(", "byte", ")", "upMask", "<<", "upShift", ";", "dest", "[", "currentByte", "]", "=", "(", "byte", ")", "(", "dest", "[", "currentByte", "]", "&", "(", "~", "upMask", ")", ")", ";", "//merge bytes~", "dest", "[", "currentByte", "]", "=", "(", "byte", ")", "(", "dest", "[", "currentByte", "]", "|", "currentBits", ")", ";", "//System.out.println(\"new currentByte: \" + dest[currentByte]);", "count", "-=", "bitRoom", ";", "currentOffset", "=", "0", ";", "currentByte", "++", ";", "}", "if", "(", "DEBUG_LEV", ">", "30", ")", "System", ".", "err", ".", "println", "(", "\"EncodedElement::addLong : End\"", ")", ";", "}" ]
This method adds a given number of bits of a long to a byte array. @param input long to store bits from @param count number of low-order bits to store @param startPos start bit location in array to begin writing @param dest array to store bits in. dest MUST have enough space to store the given data, or this function will fail.
[ "This", "method", "adds", "a", "given", "number", "of", "bits", "of", "a", "long", "to", "a", "byte", "array", "." ]
train
https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/EncodedElement.java#L616-L658
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
@SuppressWarnings("unchecked") public static List<Long> getAt(long[] array, Range range) { """ Support the subscript operator with a range for a long array @param array a long array @param range a range indicating the indices for the items to retrieve @return list of the retrieved longs @since 1.0 """ return primitiveArrayGet(array, range); }
java
@SuppressWarnings("unchecked") public static List<Long> getAt(long[] array, Range range) { return primitiveArrayGet(array, range); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "Long", ">", "getAt", "(", "long", "[", "]", "array", ",", "Range", "range", ")", "{", "return", "primitiveArrayGet", "(", "array", ",", "range", ")", ";", "}" ]
Support the subscript operator with a range for a long array @param array a long array @param range a range indicating the indices for the items to retrieve @return list of the retrieved longs @since 1.0
[ "Support", "the", "subscript", "operator", "with", "a", "range", "for", "a", "long", "array" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13662-L13665
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/Directory.java
Directory.checkNotReserved
private static Name checkNotReserved(Name name, String action) { """ Checks that the given name is not "." or "..". Those names cannot be set/removed by users. """ if (isReserved(name)) { throw new IllegalArgumentException("cannot " + action + ": " + name); } return name; }
java
private static Name checkNotReserved(Name name, String action) { if (isReserved(name)) { throw new IllegalArgumentException("cannot " + action + ": " + name); } return name; }
[ "private", "static", "Name", "checkNotReserved", "(", "Name", "name", ",", "String", "action", ")", "{", "if", "(", "isReserved", "(", "name", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"cannot \"", "+", "action", "+", "\": \"", "+", "name", ")", ";", "}", "return", "name", ";", "}" ]
Checks that the given name is not "." or "..". Those names cannot be set/removed by users.
[ "Checks", "that", "the", "given", "name", "is", "not", ".", "or", "..", ".", "Those", "names", "cannot", "be", "set", "/", "removed", "by", "users", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/Directory.java#L162-L167
googlegenomics/utils-java
src/main/java/com/google/cloud/genomics/utils/GenomicsFactory.java
GenomicsFactory.fromApiKey
public <T extends AbstractGoogleJsonClient.Builder> T fromApiKey(T builder, String apiKey) { """ Prepare an AbstractGoogleJsonClient.Builder using an API key. @param builder The builder to be prepared. @param apiKey The API key of the Google Cloud Platform project. @return The passed in builder, for easy chaining. """ Preconditions.checkNotNull(builder); Preconditions.checkNotNull(apiKey); return prepareBuilder(builder, null, new CommonGoogleClientRequestInitializer(apiKey)); }
java
public <T extends AbstractGoogleJsonClient.Builder> T fromApiKey(T builder, String apiKey) { Preconditions.checkNotNull(builder); Preconditions.checkNotNull(apiKey); return prepareBuilder(builder, null, new CommonGoogleClientRequestInitializer(apiKey)); }
[ "public", "<", "T", "extends", "AbstractGoogleJsonClient", ".", "Builder", ">", "T", "fromApiKey", "(", "T", "builder", ",", "String", "apiKey", ")", "{", "Preconditions", ".", "checkNotNull", "(", "builder", ")", ";", "Preconditions", ".", "checkNotNull", "(", "apiKey", ")", ";", "return", "prepareBuilder", "(", "builder", ",", "null", ",", "new", "CommonGoogleClientRequestInitializer", "(", "apiKey", ")", ")", ";", "}" ]
Prepare an AbstractGoogleJsonClient.Builder using an API key. @param builder The builder to be prepared. @param apiKey The API key of the Google Cloud Platform project. @return The passed in builder, for easy chaining.
[ "Prepare", "an", "AbstractGoogleJsonClient", ".", "Builder", "using", "an", "API", "key", "." ]
train
https://github.com/googlegenomics/utils-java/blob/7205d5b4e4f61fc6b93acb4bdd76b93df5b5f612/src/main/java/com/google/cloud/genomics/utils/GenomicsFactory.java#L353-L357
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/translate/OperatorRewriter.java
OperatorRewriter.getRetainedWithTarget
private Expression getRetainedWithTarget(Assignment node, VariableElement var) { """ Gets the target object for a call to the RetainedWith wrapper. """ Expression lhs = node.getLeftHandSide(); if (!(lhs instanceof FieldAccess)) { return new ThisExpression(ElementUtil.getDeclaringClass(var).asType()); } // To avoid duplicating the target expression we must save the result to a local variable. FieldAccess fieldAccess = (FieldAccess) lhs; Expression target = fieldAccess.getExpression(); VariableElement targetVar = GeneratedVariableElement.newLocalVar( "__rw$" + rwCount++, target.getTypeMirror(), null); TreeUtil.asStatementList(TreeUtil.getOwningStatement(lhs)) .add(0, new VariableDeclarationStatement(targetVar, null)); fieldAccess.setExpression(new SimpleName(targetVar)); CommaExpression commaExpr = new CommaExpression( new Assignment(new SimpleName(targetVar), target)); node.replaceWith(commaExpr); commaExpr.addExpression(node); return new SimpleName(targetVar); }
java
private Expression getRetainedWithTarget(Assignment node, VariableElement var) { Expression lhs = node.getLeftHandSide(); if (!(lhs instanceof FieldAccess)) { return new ThisExpression(ElementUtil.getDeclaringClass(var).asType()); } // To avoid duplicating the target expression we must save the result to a local variable. FieldAccess fieldAccess = (FieldAccess) lhs; Expression target = fieldAccess.getExpression(); VariableElement targetVar = GeneratedVariableElement.newLocalVar( "__rw$" + rwCount++, target.getTypeMirror(), null); TreeUtil.asStatementList(TreeUtil.getOwningStatement(lhs)) .add(0, new VariableDeclarationStatement(targetVar, null)); fieldAccess.setExpression(new SimpleName(targetVar)); CommaExpression commaExpr = new CommaExpression( new Assignment(new SimpleName(targetVar), target)); node.replaceWith(commaExpr); commaExpr.addExpression(node); return new SimpleName(targetVar); }
[ "private", "Expression", "getRetainedWithTarget", "(", "Assignment", "node", ",", "VariableElement", "var", ")", "{", "Expression", "lhs", "=", "node", ".", "getLeftHandSide", "(", ")", ";", "if", "(", "!", "(", "lhs", "instanceof", "FieldAccess", ")", ")", "{", "return", "new", "ThisExpression", "(", "ElementUtil", ".", "getDeclaringClass", "(", "var", ")", ".", "asType", "(", ")", ")", ";", "}", "// To avoid duplicating the target expression we must save the result to a local variable.", "FieldAccess", "fieldAccess", "=", "(", "FieldAccess", ")", "lhs", ";", "Expression", "target", "=", "fieldAccess", ".", "getExpression", "(", ")", ";", "VariableElement", "targetVar", "=", "GeneratedVariableElement", ".", "newLocalVar", "(", "\"__rw$\"", "+", "rwCount", "++", ",", "target", ".", "getTypeMirror", "(", ")", ",", "null", ")", ";", "TreeUtil", ".", "asStatementList", "(", "TreeUtil", ".", "getOwningStatement", "(", "lhs", ")", ")", ".", "add", "(", "0", ",", "new", "VariableDeclarationStatement", "(", "targetVar", ",", "null", ")", ")", ";", "fieldAccess", ".", "setExpression", "(", "new", "SimpleName", "(", "targetVar", ")", ")", ";", "CommaExpression", "commaExpr", "=", "new", "CommaExpression", "(", "new", "Assignment", "(", "new", "SimpleName", "(", "targetVar", ")", ",", "target", ")", ")", ";", "node", ".", "replaceWith", "(", "commaExpr", ")", ";", "commaExpr", ".", "addExpression", "(", "node", ")", ";", "return", "new", "SimpleName", "(", "targetVar", ")", ";", "}" ]
Gets the target object for a call to the RetainedWith wrapper.
[ "Gets", "the", "target", "object", "for", "a", "call", "to", "the", "RetainedWith", "wrapper", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/OperatorRewriter.java#L297-L315
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/internal/EC2CredentialsUtils.java
EC2CredentialsUtils.readResource
public String readResource(URI endpoint) throws IOException { """ Connects to the given endpoint to read the resource and returns the text contents. If the connection fails, the request will not be retried. @param endpoint The service endpoint to connect to. @return The text payload returned from the Amazon EC2 endpoint service for the specified resource path. @throws IOException If any problems were encountered while connecting to the service for the requested resource path. @throws SdkClientException If the requested service is not found. """ return readResource(endpoint, CredentialsEndpointRetryPolicy.NO_RETRY, null); }
java
public String readResource(URI endpoint) throws IOException { return readResource(endpoint, CredentialsEndpointRetryPolicy.NO_RETRY, null); }
[ "public", "String", "readResource", "(", "URI", "endpoint", ")", "throws", "IOException", "{", "return", "readResource", "(", "endpoint", ",", "CredentialsEndpointRetryPolicy", ".", "NO_RETRY", ",", "null", ")", ";", "}" ]
Connects to the given endpoint to read the resource and returns the text contents. If the connection fails, the request will not be retried. @param endpoint The service endpoint to connect to. @return The text payload returned from the Amazon EC2 endpoint service for the specified resource path. @throws IOException If any problems were encountered while connecting to the service for the requested resource path. @throws SdkClientException If the requested service is not found.
[ "Connects", "to", "the", "given", "endpoint", "to", "read", "the", "resource", "and", "returns", "the", "text", "contents", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/internal/EC2CredentialsUtils.java#L81-L83
vladmihalcea/flexy-pool
flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/connection/ConnectionProxyFactory.java
ConnectionProxyFactory.newInstance
public Connection newInstance(Connection target, ConnectionPoolCallback connectionPoolCallback) { """ Creates a ConnectionProxy for the specified target and attaching the following callback. @param target connection to proxy @param connectionPoolCallback attaching connection lifecycle listener @return ConnectionProxy """ return proxyConnection(target, new ConnectionCallback(connectionPoolCallback)); }
java
public Connection newInstance(Connection target, ConnectionPoolCallback connectionPoolCallback) { return proxyConnection(target, new ConnectionCallback(connectionPoolCallback)); }
[ "public", "Connection", "newInstance", "(", "Connection", "target", ",", "ConnectionPoolCallback", "connectionPoolCallback", ")", "{", "return", "proxyConnection", "(", "target", ",", "new", "ConnectionCallback", "(", "connectionPoolCallback", ")", ")", ";", "}" ]
Creates a ConnectionProxy for the specified target and attaching the following callback. @param target connection to proxy @param connectionPoolCallback attaching connection lifecycle listener @return ConnectionProxy
[ "Creates", "a", "ConnectionProxy", "for", "the", "specified", "target", "and", "attaching", "the", "following", "callback", "." ]
train
https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/connection/ConnectionProxyFactory.java#L23-L25
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_udp_farm_farmId_GET
public OvhBackendUdp serviceName_udp_farm_farmId_GET(String serviceName, Long farmId) throws IOException { """ Get this object properties REST: GET /ipLoadbalancing/{serviceName}/udp/farm/{farmId} @param serviceName [required] The internal name of your IP load balancing @param farmId [required] Id of your farm API beta """ String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBackendUdp.class); }
java
public OvhBackendUdp serviceName_udp_farm_farmId_GET(String serviceName, Long farmId) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBackendUdp.class); }
[ "public", "OvhBackendUdp", "serviceName_udp_farm_farmId_GET", "(", "String", "serviceName", ",", "Long", "farmId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/udp/farm/{farmId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "farmId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhBackendUdp", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /ipLoadbalancing/{serviceName}/udp/farm/{farmId} @param serviceName [required] The internal name of your IP load balancing @param farmId [required] Id of your farm API beta
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L895-L900
MTDdk/jawn
jawn-core/src/main/java/net/javapla/jawn/core/reflection/DynamicClassFactory.java
DynamicClassFactory.createInstance
public final static <T> T createInstance(String className, Class<T> expectedType, boolean useCache) throws CompilationException, ClassLoadException { """ Loads and instantiates the class into the stated <code>expectedType</code>. @param className Full name of the class including package name @param expectedType The type to convert the class into @param useCache flag to specify whether to cache the class or not @return The newly instantiated class @throws CompilationException If the class could not be successfully compiled @throws ClassLoadException """ try { Object o = createInstance(getCompiledClass(className, useCache)); // a check to see if the class exists T instance = expectedType.cast(o); // a check to see if the class is actually a correct subclass return instance ; } catch (CompilationException | ClassLoadException e) { throw e; } catch (ClassCastException e) { //from cast() throw new ClassLoadException("Class: " + className + " is not the expected type, are you sure it extends " + expectedType.getName() + "?"); } catch (Exception e) { throw new ClassLoadException(e); } }
java
public final static <T> T createInstance(String className, Class<T> expectedType, boolean useCache) throws CompilationException, ClassLoadException { try { Object o = createInstance(getCompiledClass(className, useCache)); // a check to see if the class exists T instance = expectedType.cast(o); // a check to see if the class is actually a correct subclass return instance ; } catch (CompilationException | ClassLoadException e) { throw e; } catch (ClassCastException e) { //from cast() throw new ClassLoadException("Class: " + className + " is not the expected type, are you sure it extends " + expectedType.getName() + "?"); } catch (Exception e) { throw new ClassLoadException(e); } }
[ "public", "final", "static", "<", "T", ">", "T", "createInstance", "(", "String", "className", ",", "Class", "<", "T", ">", "expectedType", ",", "boolean", "useCache", ")", "throws", "CompilationException", ",", "ClassLoadException", "{", "try", "{", "Object", "o", "=", "createInstance", "(", "getCompiledClass", "(", "className", ",", "useCache", ")", ")", ";", "// a check to see if the class exists", "T", "instance", "=", "expectedType", ".", "cast", "(", "o", ")", ";", "// a check to see if the class is actually a correct subclass", "return", "instance", ";", "}", "catch", "(", "CompilationException", "|", "ClassLoadException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "//from cast()", "throw", "new", "ClassLoadException", "(", "\"Class: \"", "+", "className", "+", "\" is not the expected type, are you sure it extends \"", "+", "expectedType", ".", "getName", "(", ")", "+", "\"?\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ClassLoadException", "(", "e", ")", ";", "}", "}" ]
Loads and instantiates the class into the stated <code>expectedType</code>. @param className Full name of the class including package name @param expectedType The type to convert the class into @param useCache flag to specify whether to cache the class or not @return The newly instantiated class @throws CompilationException If the class could not be successfully compiled @throws ClassLoadException
[ "Loads", "and", "instantiates", "the", "class", "into", "the", "stated", "<code", ">", "expectedType<", "/", "code", ">", "." ]
train
https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/reflection/DynamicClassFactory.java#L40-L53
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.updateProgressNotification
protected void updateProgressNotification(@NonNull final NotificationCompat.Builder builder, final int progress) { """ This method allows you to update the notification showing the upload progress. @param builder notification builder. """ // Add Abort action to the notification if (progress != PROGRESS_ABORTED && progress != PROGRESS_COMPLETED) { final Intent abortIntent = new Intent(BROADCAST_ACTION); abortIntent.putExtra(EXTRA_ACTION, ACTION_ABORT); final PendingIntent pendingAbortIntent = PendingIntent.getBroadcast(this, 1, abortIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(R.drawable.ic_action_notify_cancel, getString(R.string.dfu_action_abort), pendingAbortIntent); } }
java
protected void updateProgressNotification(@NonNull final NotificationCompat.Builder builder, final int progress) { // Add Abort action to the notification if (progress != PROGRESS_ABORTED && progress != PROGRESS_COMPLETED) { final Intent abortIntent = new Intent(BROADCAST_ACTION); abortIntent.putExtra(EXTRA_ACTION, ACTION_ABORT); final PendingIntent pendingAbortIntent = PendingIntent.getBroadcast(this, 1, abortIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(R.drawable.ic_action_notify_cancel, getString(R.string.dfu_action_abort), pendingAbortIntent); } }
[ "protected", "void", "updateProgressNotification", "(", "@", "NonNull", "final", "NotificationCompat", ".", "Builder", "builder", ",", "final", "int", "progress", ")", "{", "// Add Abort action to the notification", "if", "(", "progress", "!=", "PROGRESS_ABORTED", "&&", "progress", "!=", "PROGRESS_COMPLETED", ")", "{", "final", "Intent", "abortIntent", "=", "new", "Intent", "(", "BROADCAST_ACTION", ")", ";", "abortIntent", ".", "putExtra", "(", "EXTRA_ACTION", ",", "ACTION_ABORT", ")", ";", "final", "PendingIntent", "pendingAbortIntent", "=", "PendingIntent", ".", "getBroadcast", "(", "this", ",", "1", ",", "abortIntent", ",", "PendingIntent", ".", "FLAG_UPDATE_CURRENT", ")", ";", "builder", ".", "addAction", "(", "R", ".", "drawable", ".", "ic_action_notify_cancel", ",", "getString", "(", "R", ".", "string", ".", "dfu_action_abort", ")", ",", "pendingAbortIntent", ")", ";", "}", "}" ]
This method allows you to update the notification showing the upload progress. @param builder notification builder.
[ "This", "method", "allows", "you", "to", "update", "the", "notification", "showing", "the", "upload", "progress", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1725-L1733
google/closure-compiler
src/com/google/javascript/jscomp/OptimizeArgumentsArray.java
OptimizeArgumentsArray.changeMethodSignature
private void changeMethodSignature(ImmutableSortedMap<Integer, String> argNames, Node paramList) { """ Inserts new formal parameters into the method's signature based on the given set of names. <p>Example: function() --> function(r0, r1, r2) @param argNames maps param index to param name, if the param with that index has a name. @param paramList node representing the function signature """ ImmutableSortedMap<Integer, String> newParams = argNames.tailMap(paramList.getChildCount()); for (String name : newParams.values()) { paramList.addChildToBack(IR.name(name).useSourceInfoIfMissingFrom(paramList)); } if (!newParams.isEmpty()) { compiler.reportChangeToEnclosingScope(paramList); } }
java
private void changeMethodSignature(ImmutableSortedMap<Integer, String> argNames, Node paramList) { ImmutableSortedMap<Integer, String> newParams = argNames.tailMap(paramList.getChildCount()); for (String name : newParams.values()) { paramList.addChildToBack(IR.name(name).useSourceInfoIfMissingFrom(paramList)); } if (!newParams.isEmpty()) { compiler.reportChangeToEnclosingScope(paramList); } }
[ "private", "void", "changeMethodSignature", "(", "ImmutableSortedMap", "<", "Integer", ",", "String", ">", "argNames", ",", "Node", "paramList", ")", "{", "ImmutableSortedMap", "<", "Integer", ",", "String", ">", "newParams", "=", "argNames", ".", "tailMap", "(", "paramList", ".", "getChildCount", "(", ")", ")", ";", "for", "(", "String", "name", ":", "newParams", ".", "values", "(", ")", ")", "{", "paramList", ".", "addChildToBack", "(", "IR", ".", "name", "(", "name", ")", ".", "useSourceInfoIfMissingFrom", "(", "paramList", ")", ")", ";", "}", "if", "(", "!", "newParams", ".", "isEmpty", "(", ")", ")", "{", "compiler", ".", "reportChangeToEnclosingScope", "(", "paramList", ")", ";", "}", "}" ]
Inserts new formal parameters into the method's signature based on the given set of names. <p>Example: function() --> function(r0, r1, r2) @param argNames maps param index to param name, if the param with that index has a name. @param paramList node representing the function signature
[ "Inserts", "new", "formal", "parameters", "into", "the", "method", "s", "signature", "based", "on", "the", "given", "set", "of", "names", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/OptimizeArgumentsArray.java#L233-L241
JDBDT/jdbdt
src/main/java/org/jdbdt/Log.java
Log.write
void write(CallInfo callInfo, DataSetAssertion assertion) { """ Log state assertion. @param callInfo Call info. @param assertion State assertion. """ Element rootNode = root(callInfo); DataSource ds = assertion.getSource(); write(rootNode, ds); Element saNode = createNode(rootNode, ASSERTION_TAG); List<MetaData.ColumnInfo> mdCols = ds.getMetaData().columns(); write(saNode, EXPECTED_TAG, mdCols, assertion.data(DataSetAssertion.IteratorType.EXPECTED_DATA)); if (! assertion.passed()) { Element errorsNode = createNode(saNode, ERRORS_TAG); write(errorsNode, EXPECTED_TAG, mdCols, assertion.data(DataSetAssertion.IteratorType.ERRORS_EXPECTED)); write(errorsNode, ACTUAL_TAG, mdCols, assertion.data(DataSetAssertion.IteratorType.ERRORS_ACTUAL)); } flush(rootNode); }
java
void write(CallInfo callInfo, DataSetAssertion assertion) { Element rootNode = root(callInfo); DataSource ds = assertion.getSource(); write(rootNode, ds); Element saNode = createNode(rootNode, ASSERTION_TAG); List<MetaData.ColumnInfo> mdCols = ds.getMetaData().columns(); write(saNode, EXPECTED_TAG, mdCols, assertion.data(DataSetAssertion.IteratorType.EXPECTED_DATA)); if (! assertion.passed()) { Element errorsNode = createNode(saNode, ERRORS_TAG); write(errorsNode, EXPECTED_TAG, mdCols, assertion.data(DataSetAssertion.IteratorType.ERRORS_EXPECTED)); write(errorsNode, ACTUAL_TAG, mdCols, assertion.data(DataSetAssertion.IteratorType.ERRORS_ACTUAL)); } flush(rootNode); }
[ "void", "write", "(", "CallInfo", "callInfo", ",", "DataSetAssertion", "assertion", ")", "{", "Element", "rootNode", "=", "root", "(", "callInfo", ")", ";", "DataSource", "ds", "=", "assertion", ".", "getSource", "(", ")", ";", "write", "(", "rootNode", ",", "ds", ")", ";", "Element", "saNode", "=", "createNode", "(", "rootNode", ",", "ASSERTION_TAG", ")", ";", "List", "<", "MetaData", ".", "ColumnInfo", ">", "mdCols", "=", "ds", ".", "getMetaData", "(", ")", ".", "columns", "(", ")", ";", "write", "(", "saNode", ",", "EXPECTED_TAG", ",", "mdCols", ",", "assertion", ".", "data", "(", "DataSetAssertion", ".", "IteratorType", ".", "EXPECTED_DATA", ")", ")", ";", "if", "(", "!", "assertion", ".", "passed", "(", ")", ")", "{", "Element", "errorsNode", "=", "createNode", "(", "saNode", ",", "ERRORS_TAG", ")", ";", "write", "(", "errorsNode", ",", "EXPECTED_TAG", ",", "mdCols", ",", "assertion", ".", "data", "(", "DataSetAssertion", ".", "IteratorType", ".", "ERRORS_EXPECTED", ")", ")", ";", "write", "(", "errorsNode", ",", "ACTUAL_TAG", ",", "mdCols", ",", "assertion", ".", "data", "(", "DataSetAssertion", ".", "IteratorType", ".", "ERRORS_ACTUAL", ")", ")", ";", "}", "flush", "(", "rootNode", ")", ";", "}" ]
Log state assertion. @param callInfo Call info. @param assertion State assertion.
[ "Log", "state", "assertion", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/Log.java#L329-L351
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/ImplementAssertionWithChaining.java
ImplementAssertionWithChaining.isCallToFail
private static boolean isCallToFail(StatementTree then, VisitorState state) { """ Checks that the statement, after unwrapping any braces, consists of a single call to a {@code fail} method. """ while (then.getKind() == BLOCK) { List<? extends StatementTree> statements = ((BlockTree) then).getStatements(); if (statements.size() != 1) { return false; } then = getOnlyElement(statements); } if (then.getKind() != EXPRESSION_STATEMENT) { return false; } ExpressionTree thenExpr = ((ExpressionStatementTree) then).getExpression(); if (thenExpr.getKind() != METHOD_INVOCATION) { return false; } MethodInvocationTree thenCall = (MethodInvocationTree) thenExpr; ExpressionTree methodSelect = thenCall.getMethodSelect(); if (methodSelect.getKind() != IDENTIFIER) { return false; // TODO(cpovirk): Handle "this.fail(...)," etc. } // TODO(cpovirk): Support *all* fail methods. return LEGACY_FAIL_METHOD.matches(methodSelect, state); }
java
private static boolean isCallToFail(StatementTree then, VisitorState state) { while (then.getKind() == BLOCK) { List<? extends StatementTree> statements = ((BlockTree) then).getStatements(); if (statements.size() != 1) { return false; } then = getOnlyElement(statements); } if (then.getKind() != EXPRESSION_STATEMENT) { return false; } ExpressionTree thenExpr = ((ExpressionStatementTree) then).getExpression(); if (thenExpr.getKind() != METHOD_INVOCATION) { return false; } MethodInvocationTree thenCall = (MethodInvocationTree) thenExpr; ExpressionTree methodSelect = thenCall.getMethodSelect(); if (methodSelect.getKind() != IDENTIFIER) { return false; // TODO(cpovirk): Handle "this.fail(...)," etc. } // TODO(cpovirk): Support *all* fail methods. return LEGACY_FAIL_METHOD.matches(methodSelect, state); }
[ "private", "static", "boolean", "isCallToFail", "(", "StatementTree", "then", ",", "VisitorState", "state", ")", "{", "while", "(", "then", ".", "getKind", "(", ")", "==", "BLOCK", ")", "{", "List", "<", "?", "extends", "StatementTree", ">", "statements", "=", "(", "(", "BlockTree", ")", "then", ")", ".", "getStatements", "(", ")", ";", "if", "(", "statements", ".", "size", "(", ")", "!=", "1", ")", "{", "return", "false", ";", "}", "then", "=", "getOnlyElement", "(", "statements", ")", ";", "}", "if", "(", "then", ".", "getKind", "(", ")", "!=", "EXPRESSION_STATEMENT", ")", "{", "return", "false", ";", "}", "ExpressionTree", "thenExpr", "=", "(", "(", "ExpressionStatementTree", ")", "then", ")", ".", "getExpression", "(", ")", ";", "if", "(", "thenExpr", ".", "getKind", "(", ")", "!=", "METHOD_INVOCATION", ")", "{", "return", "false", ";", "}", "MethodInvocationTree", "thenCall", "=", "(", "MethodInvocationTree", ")", "thenExpr", ";", "ExpressionTree", "methodSelect", "=", "thenCall", ".", "getMethodSelect", "(", ")", ";", "if", "(", "methodSelect", ".", "getKind", "(", ")", "!=", "IDENTIFIER", ")", "{", "return", "false", ";", "// TODO(cpovirk): Handle \"this.fail(...),\" etc.", "}", "// TODO(cpovirk): Support *all* fail methods.", "return", "LEGACY_FAIL_METHOD", ".", "matches", "(", "methodSelect", ",", "state", ")", ";", "}" ]
Checks that the statement, after unwrapping any braces, consists of a single call to a {@code fail} method.
[ "Checks", "that", "the", "statement", "after", "unwrapping", "any", "braces", "consists", "of", "a", "single", "call", "to", "a", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/ImplementAssertionWithChaining.java#L175-L198
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/MemoryFieldTable.java
MemoryFieldTable.setPTableRef
public void setPTableRef(PTable pTable, PhysicalDatabaseParent dbOwner) { """ Set the raw data table reference. @param pTable The raw data table. @param dbOwner If you want this method to lookup/build the remote table, pass this. """ m_pTable = pTable; if (pTable == null) if (dbOwner != null) { FieldList record = this.getRecord(); if (record != null) { PDatabase pDatabase = dbOwner.getPDatabase(record.getDatabaseName(), ThinPhysicalDatabase.MEMORY_TYPE, true); pDatabase.addPDatabaseOwner(this); if (pDatabase != null) pTable = pDatabase.getPTable(record, true); pTable.addPTableOwner(this); m_pTable = pTable; } } }
java
public void setPTableRef(PTable pTable, PhysicalDatabaseParent dbOwner) { m_pTable = pTable; if (pTable == null) if (dbOwner != null) { FieldList record = this.getRecord(); if (record != null) { PDatabase pDatabase = dbOwner.getPDatabase(record.getDatabaseName(), ThinPhysicalDatabase.MEMORY_TYPE, true); pDatabase.addPDatabaseOwner(this); if (pDatabase != null) pTable = pDatabase.getPTable(record, true); pTable.addPTableOwner(this); m_pTable = pTable; } } }
[ "public", "void", "setPTableRef", "(", "PTable", "pTable", ",", "PhysicalDatabaseParent", "dbOwner", ")", "{", "m_pTable", "=", "pTable", ";", "if", "(", "pTable", "==", "null", ")", "if", "(", "dbOwner", "!=", "null", ")", "{", "FieldList", "record", "=", "this", ".", "getRecord", "(", ")", ";", "if", "(", "record", "!=", "null", ")", "{", "PDatabase", "pDatabase", "=", "dbOwner", ".", "getPDatabase", "(", "record", ".", "getDatabaseName", "(", ")", ",", "ThinPhysicalDatabase", ".", "MEMORY_TYPE", ",", "true", ")", ";", "pDatabase", ".", "addPDatabaseOwner", "(", "this", ")", ";", "if", "(", "pDatabase", "!=", "null", ")", "pTable", "=", "pDatabase", ".", "getPTable", "(", "record", ",", "true", ")", ";", "pTable", ".", "addPTableOwner", "(", "this", ")", ";", "m_pTable", "=", "pTable", ";", "}", "}", "}" ]
Set the raw data table reference. @param pTable The raw data table. @param dbOwner If you want this method to lookup/build the remote table, pass this.
[ "Set", "the", "raw", "data", "table", "reference", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/MemoryFieldTable.java#L230-L247