repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/appqoe/appqoepolicy_binding.java
appqoepolicy_binding.get
public static appqoepolicy_binding get(nitro_service service, String name) throws Exception{ appqoepolicy_binding obj = new appqoepolicy_binding(); obj.set_name(name); appqoepolicy_binding response = (appqoepolicy_binding) obj.get_resource(service); return response; }
java
public static appqoepolicy_binding get(nitro_service service, String name) throws Exception{ appqoepolicy_binding obj = new appqoepolicy_binding(); obj.set_name(name); appqoepolicy_binding response = (appqoepolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "appqoepolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "appqoepolicy_binding", "obj", "=", "new", "appqoepolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")"...
Use this API to fetch appqoepolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "appqoepolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appqoe/appqoepolicy_binding.java#L103-L108
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java
ActionUtil.removeAction
public static ActionListener removeAction(BaseComponent component, String eventName) { ActionListener listener = getListener(component, eventName); if (listener != null) { listener.removeAction(); } return listener; }
java
public static ActionListener removeAction(BaseComponent component, String eventName) { ActionListener listener = getListener(component, eventName); if (listener != null) { listener.removeAction(); } return listener; }
[ "public", "static", "ActionListener", "removeAction", "(", "BaseComponent", "component", ",", "String", "eventName", ")", "{", "ActionListener", "listener", "=", "getListener", "(", "component", ",", "eventName", ")", ";", "if", "(", "listener", "!=", "null", ")...
Removes any action associated with a component. @param component Component whose action is to be removed. @param eventName The event whose associated action is being removed. @return The removed deferred event listener, or null if none found.
[ "Removes", "any", "action", "associated", "with", "a", "component", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java#L146-L154
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/RangeVariable.java
RangeVariable.findColumn
public int findColumn(String tableName, String columnName) { // The namedJoinColumnExpressions are ExpressionColumn objects // for columns named in USING conditions. Each range variable // has a possibly empty list of these. If two range variables are // operands of a join with a USING condition, both get the same list // of USING columns. In our semantics the query // select T2.C from T1 join T2 using(C); // selects T2.C. This is not standard behavior, but it seems to // be common to mysql and postgresql. The query // select C from T1 join T2 using(C); // selects the C from T1 or T2, since the using clause says // they will have the same value. In the query // select C from T1 join T2 using(C), T3; // where T3 has a column named C, there is an ambiguity, since // the first join tree (T1 join T2 using(C)) has a column named C and // T3 has another C column. In this case we need the T1.C notation. // The query // select T1.C from T1 join T2 using(C), T3; // will select the C from the first join tree, and // select T3.C from T1 join T2 using(C), T3; // will select the C from the second join tree, which is just T3. // If we don't have a table name and there are some USING columns, // then look into them. If the name is in the USING columns, it // is not in this range variable. The function getColumnExpression // will fetch this using variable in another search. if (namedJoinColumnExpressions != null && tableName == null && namedJoinColumnExpressions.containsKey(columnName)) { return -1; } if (variables != null) { return variables.getIndex(columnName); } else if (columnAliases != null) { return columnAliases.getIndex(columnName); } else { return rangeTable.findColumn(columnName); } }
java
public int findColumn(String tableName, String columnName) { // The namedJoinColumnExpressions are ExpressionColumn objects // for columns named in USING conditions. Each range variable // has a possibly empty list of these. If two range variables are // operands of a join with a USING condition, both get the same list // of USING columns. In our semantics the query // select T2.C from T1 join T2 using(C); // selects T2.C. This is not standard behavior, but it seems to // be common to mysql and postgresql. The query // select C from T1 join T2 using(C); // selects the C from T1 or T2, since the using clause says // they will have the same value. In the query // select C from T1 join T2 using(C), T3; // where T3 has a column named C, there is an ambiguity, since // the first join tree (T1 join T2 using(C)) has a column named C and // T3 has another C column. In this case we need the T1.C notation. // The query // select T1.C from T1 join T2 using(C), T3; // will select the C from the first join tree, and // select T3.C from T1 join T2 using(C), T3; // will select the C from the second join tree, which is just T3. // If we don't have a table name and there are some USING columns, // then look into them. If the name is in the USING columns, it // is not in this range variable. The function getColumnExpression // will fetch this using variable in another search. if (namedJoinColumnExpressions != null && tableName == null && namedJoinColumnExpressions.containsKey(columnName)) { return -1; } if (variables != null) { return variables.getIndex(columnName); } else if (columnAliases != null) { return columnAliases.getIndex(columnName); } else { return rangeTable.findColumn(columnName); } }
[ "public", "int", "findColumn", "(", "String", "tableName", ",", "String", "columnName", ")", "{", "// The namedJoinColumnExpressions are ExpressionColumn objects", "// for columns named in USING conditions. Each range variable", "// has a possibly empty list of these. If two range variab...
Returns the index for the column given the column's table name and column name. If the table name is null, there is no table name specified. For example, in a query "select C from T" there is no table name, so tableName would be null. In the query "select T.C from T" tableName would be the string "T". Don't return any column found in a USING join condition. @param tableName @param columnName @return the column index or -1 if the column name is in a using list.
[ "Returns", "the", "index", "for", "the", "column", "given", "the", "column", "s", "table", "name", "and", "column", "name", ".", "If", "the", "table", "name", "is", "null", "there", "is", "no", "table", "name", "specified", ".", "For", "example", "in", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/RangeVariable.java#L244-L283
JodaOrg/joda-time
src/example/org/joda/example/time/DateTimeBrowser.java
DateTimeBrowser.LPad
private String LPad(String inStr, int maxLen) { if (inStr.length() >= maxLen) return inStr.toUpperCase(); String zeroes = PADCHARS.substring(0, maxLen - inStr.length()); String retVal = zeroes + inStr; return retVal.toUpperCase(); }
java
private String LPad(String inStr, int maxLen) { if (inStr.length() >= maxLen) return inStr.toUpperCase(); String zeroes = PADCHARS.substring(0, maxLen - inStr.length()); String retVal = zeroes + inStr; return retVal.toUpperCase(); }
[ "private", "String", "LPad", "(", "String", "inStr", ",", "int", "maxLen", ")", "{", "if", "(", "inStr", ".", "length", "(", ")", ">=", "maxLen", ")", "return", "inStr", ".", "toUpperCase", "(", ")", ";", "String", "zeroes", "=", "PADCHARS", ".", "su...
/* LPad Return a String, left padded with '0's as specified by the caller.
[ "/", "*", "LPad", "Return", "a", "String", "left", "padded", "with", "0", "s", "as", "specified", "by", "the", "caller", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/example/org/joda/example/time/DateTimeBrowser.java#L380-L385
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
HttpContext.GET
public <T> Optional<T> GET(String partialUrl, GenericType<T> returnType) { URI uri = buildUri(partialUrl); return executeGetRequest(uri, returnType); }
java
public <T> Optional<T> GET(String partialUrl, GenericType<T> returnType) { URI uri = buildUri(partialUrl); return executeGetRequest(uri, returnType); }
[ "public", "<", "T", ">", "Optional", "<", "T", ">", "GET", "(", "String", "partialUrl", ",", "GenericType", "<", "T", ">", "returnType", ")", "{", "URI", "uri", "=", "buildUri", "(", "partialUrl", ")", ";", "return", "executeGetRequest", "(", "uri", ",...
Execute a GET call against the partial URL and deserialize the results. @param <T> The type parameter used for the return object @param partialUrl The partial URL to build @param returnType The expected return type @return The return type
[ "Execute", "a", "GET", "call", "against", "the", "partial", "URL", "and", "deserialize", "the", "results", "." ]
train
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L109-L113
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.copyToLocalFile
@Deprecated public void copyToLocalFile(Path src, Path dst) throws IOException { copyToLocalFile(false, false, src, dst); }
java
@Deprecated public void copyToLocalFile(Path src, Path dst) throws IOException { copyToLocalFile(false, false, src, dst); }
[ "@", "Deprecated", "public", "void", "copyToLocalFile", "(", "Path", "src", ",", "Path", "dst", ")", "throws", "IOException", "{", "copyToLocalFile", "(", "false", ",", "false", ",", "src", ",", "dst", ")", ";", "}" ]
The src file is under FS, and the dst is on the local disk. Copy it from FS control to the local dst name.
[ "The", "src", "file", "is", "under", "FS", "and", "the", "dst", "is", "on", "the", "local", "disk", ".", "Copy", "it", "from", "FS", "control", "to", "the", "local", "dst", "name", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1720-L1723
JodaOrg/joda-money
src/main/java/org/joda/money/Money.java
Money.multipliedBy
public Money multipliedBy(BigDecimal valueToMultiplyBy, RoundingMode roundingMode) { return with(money.multiplyRetainScale(valueToMultiplyBy, roundingMode)); }
java
public Money multipliedBy(BigDecimal valueToMultiplyBy, RoundingMode roundingMode) { return with(money.multiplyRetainScale(valueToMultiplyBy, roundingMode)); }
[ "public", "Money", "multipliedBy", "(", "BigDecimal", "valueToMultiplyBy", ",", "RoundingMode", "roundingMode", ")", "{", "return", "with", "(", "money", ".", "multiplyRetainScale", "(", "valueToMultiplyBy", ",", "roundingMode", ")", ")", ";", "}" ]
Returns a copy of this monetary value multiplied by the specified value. <p> This takes this amount and multiplies it by the specified value, rounding the result is rounded as specified. <p> This instance is immutable and unaffected by this method. @param valueToMultiplyBy the scalar value to multiply by, not null @param roundingMode the rounding mode to use to bring the decimal places back in line, not null @return the new multiplied instance, never null @throws ArithmeticException if the rounding fails
[ "Returns", "a", "copy", "of", "this", "monetary", "value", "multiplied", "by", "the", "specified", "value", ".", "<p", ">", "This", "takes", "this", "amount", "and", "multiplies", "it", "by", "the", "specified", "value", "rounding", "the", "result", "is", ...
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L1018-L1020
apereo/cas
support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSamlObjectBuilder.java
AbstractSamlObjectBuilder.signSamlElement
private static org.jdom.Element signSamlElement(final org.jdom.Element element, final PrivateKey privKey, final PublicKey pubKey) { try { val providerName = System.getProperty("jsr105Provider", SIGNATURE_FACTORY_PROVIDER_CLASS); val clazz = Class.forName(providerName); val sigFactory = XMLSignatureFactory .getInstance("DOM", (Provider) clazz.getDeclaredConstructor().newInstance()); val envelopedTransform = CollectionUtils.wrap(sigFactory.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null)); val ref = sigFactory.newReference(StringUtils.EMPTY, sigFactory .newDigestMethod(DigestMethod.SHA1, null), envelopedTransform, null, null); val signatureMethod = getSignatureMethodFromPublicKey(pubKey, sigFactory); val canonicalizationMethod = sigFactory .newCanonicalizationMethod( CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS, (C14NMethodParameterSpec) null); val signedInfo = sigFactory.newSignedInfo(canonicalizationMethod, signatureMethod, CollectionUtils.wrap(ref)); val keyInfoFactory = sigFactory.getKeyInfoFactory(); val keyValuePair = keyInfoFactory.newKeyValue(pubKey); val keyInfo = keyInfoFactory.newKeyInfo(CollectionUtils.wrap(keyValuePair)); val w3cElement = toDom(element); val dsc = new DOMSignContext(privKey, w3cElement); val xmlSigInsertionPoint = getXmlSignatureInsertLocation(w3cElement); dsc.setNextSibling(xmlSigInsertionPoint); val signature = sigFactory.newXMLSignature(signedInfo, keyInfo); signature.sign(dsc); return toJdom(w3cElement); } catch (final Exception e) { throw new IllegalArgumentException("Error signing SAML element: " + e.getMessage(), e); } }
java
private static org.jdom.Element signSamlElement(final org.jdom.Element element, final PrivateKey privKey, final PublicKey pubKey) { try { val providerName = System.getProperty("jsr105Provider", SIGNATURE_FACTORY_PROVIDER_CLASS); val clazz = Class.forName(providerName); val sigFactory = XMLSignatureFactory .getInstance("DOM", (Provider) clazz.getDeclaredConstructor().newInstance()); val envelopedTransform = CollectionUtils.wrap(sigFactory.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null)); val ref = sigFactory.newReference(StringUtils.EMPTY, sigFactory .newDigestMethod(DigestMethod.SHA1, null), envelopedTransform, null, null); val signatureMethod = getSignatureMethodFromPublicKey(pubKey, sigFactory); val canonicalizationMethod = sigFactory .newCanonicalizationMethod( CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS, (C14NMethodParameterSpec) null); val signedInfo = sigFactory.newSignedInfo(canonicalizationMethod, signatureMethod, CollectionUtils.wrap(ref)); val keyInfoFactory = sigFactory.getKeyInfoFactory(); val keyValuePair = keyInfoFactory.newKeyValue(pubKey); val keyInfo = keyInfoFactory.newKeyInfo(CollectionUtils.wrap(keyValuePair)); val w3cElement = toDom(element); val dsc = new DOMSignContext(privKey, w3cElement); val xmlSigInsertionPoint = getXmlSignatureInsertLocation(w3cElement); dsc.setNextSibling(xmlSigInsertionPoint); val signature = sigFactory.newXMLSignature(signedInfo, keyInfo); signature.sign(dsc); return toJdom(w3cElement); } catch (final Exception e) { throw new IllegalArgumentException("Error signing SAML element: " + e.getMessage(), e); } }
[ "private", "static", "org", ".", "jdom", ".", "Element", "signSamlElement", "(", "final", "org", ".", "jdom", ".", "Element", "element", ",", "final", "PrivateKey", "privKey", ",", "final", "PublicKey", "pubKey", ")", "{", "try", "{", "val", "providerName", ...
Sign SAML element. @param element the element @param privKey the priv key @param pubKey the pub key @return the element
[ "Sign", "SAML", "element", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSamlObjectBuilder.java#L145-L185
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java
FastDatePrinter.applyRules
private <B extends Appendable> B applyRules(final Calendar calendar, final B buf) { try { for (final Rule rule : this.rules) { rule.appendTo(buf, calendar); } } catch (final IOException e) { throw new DateException(e); } return buf; }
java
private <B extends Appendable> B applyRules(final Calendar calendar, final B buf) { try { for (final Rule rule : this.rules) { rule.appendTo(buf, calendar); } } catch (final IOException e) { throw new DateException(e); } return buf; }
[ "private", "<", "B", "extends", "Appendable", ">", "B", "applyRules", "(", "final", "Calendar", "calendar", ",", "final", "B", "buf", ")", "{", "try", "{", "for", "(", "final", "Rule", "rule", ":", "this", ".", "rules", ")", "{", "rule", ".", "append...
<p> Performs the formatting by applying the rules to the specified calendar. </p> @param calendar the calendar to format @param buf the buffer to format into @param <B> the Appendable class type, usually StringBuilder or StringBuffer. @return the specified string buffer
[ "<p", ">", "Performs", "the", "formatting", "by", "applying", "the", "rules", "to", "the", "specified", "calendar", ".", "<", "/", "p", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java#L372-L381
paoding-code/paoding-rose
paoding-rose-jade/src/main/java/net/paoding/rose/jade/statement/GenericUtils.java
GenericUtils.resolveTypeVariable
public static final Class resolveTypeVariable(Class invocationClass, Class declaringClass, String typeVarName) { TypeVariable typeVariable = null; for (TypeVariable typeParemeter : declaringClass.getTypeParameters()) { if (typeParemeter.getName().equals(typeVarName)) { typeVariable = typeParemeter; break; } } if (typeVariable == null) { throw new NullPointerException("not found TypeVariable name " + typeVarName); } return resolveTypeVariable(invocationClass, typeVariable); }
java
public static final Class resolveTypeVariable(Class invocationClass, Class declaringClass, String typeVarName) { TypeVariable typeVariable = null; for (TypeVariable typeParemeter : declaringClass.getTypeParameters()) { if (typeParemeter.getName().equals(typeVarName)) { typeVariable = typeParemeter; break; } } if (typeVariable == null) { throw new NullPointerException("not found TypeVariable name " + typeVarName); } return resolveTypeVariable(invocationClass, typeVariable); }
[ "public", "static", "final", "Class", "resolveTypeVariable", "(", "Class", "invocationClass", ",", "Class", "declaringClass", ",", "String", "typeVarName", ")", "{", "TypeVariable", "typeVariable", "=", "null", ";", "for", "(", "TypeVariable", "typeParemeter", ":", ...
求declaringClass类中声明的泛型类型变量在invocationClass中真正的值 @param invocationClass 编程时使用的类 @param declaringClass 声明类型变量typeVarName的类 @param typeVarName 泛型变量名 @return
[ "求declaringClass类中声明的泛型类型变量在invocationClass中真正的值" ]
train
https://github.com/paoding-code/paoding-rose/blob/8b512704174dd6cba95e544c7d6ab66105cb8ec4/paoding-rose-jade/src/main/java/net/paoding/rose/jade/statement/GenericUtils.java#L58-L71
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/Resource.java
Resource.withDefaultType
public static <T extends Resource> T withDefaultType( T resource, Type defaultType) { if( resource.getType() == null) { resource.setType( defaultType); } return resource; }
java
public static <T extends Resource> T withDefaultType( T resource, Type defaultType) { if( resource.getType() == null) { resource.setType( defaultType); } return resource; }
[ "public", "static", "<", "T", "extends", "Resource", ">", "T", "withDefaultType", "(", "T", "resource", ",", "Type", "defaultType", ")", "{", "if", "(", "resource", ".", "getType", "(", ")", "==", "null", ")", "{", "resource", ".", "setType", "(", "def...
Returns the given resource, assigning the default type if no type yet defined.
[ "Returns", "the", "given", "resource", "assigning", "the", "default", "type", "if", "no", "type", "yet", "defined", "." ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/Resource.java#L163-L171
cqframework/clinical_quality_language
Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java
ElmBaseVisitor.visitFunctionDef
public T visitFunctionDef(FunctionDef elm, C context) { for (OperandDef element : elm.getOperand()) { visitElement(element, context); } visitElement(elm.getExpression(), context); return null; }
java
public T visitFunctionDef(FunctionDef elm, C context) { for (OperandDef element : elm.getOperand()) { visitElement(element, context); } visitElement(elm.getExpression(), context); return null; }
[ "public", "T", "visitFunctionDef", "(", "FunctionDef", "elm", ",", "C", "context", ")", "{", "for", "(", "OperandDef", "element", ":", "elm", ".", "getOperand", "(", ")", ")", "{", "visitElement", "(", "element", ",", "context", ")", ";", "}", "visitElem...
Visit a FunctionDef. This method will be called for every node in the tree that is a FunctionDef. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result
[ "Visit", "a", "FunctionDef", ".", "This", "method", "will", "be", "called", "for", "every", "node", "in", "the", "tree", "that", "is", "a", "FunctionDef", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L329-L335
MenoData/Time4J
base/src/main/java/net/time4j/tz/model/GregorianTimezoneRule.java
GregorianTimezoneRule.ofWeekdayBeforeDate
public static GregorianTimezoneRule ofWeekdayBeforeDate( Month month, int dayOfMonth, Weekday dayOfWeek, int timeOfDay, OffsetIndicator indicator, int savings ) { return new DayOfWeekInMonthPattern(month, dayOfMonth, dayOfWeek, timeOfDay, indicator, savings, false); }
java
public static GregorianTimezoneRule ofWeekdayBeforeDate( Month month, int dayOfMonth, Weekday dayOfWeek, int timeOfDay, OffsetIndicator indicator, int savings ) { return new DayOfWeekInMonthPattern(month, dayOfMonth, dayOfWeek, timeOfDay, indicator, savings, false); }
[ "public", "static", "GregorianTimezoneRule", "ofWeekdayBeforeDate", "(", "Month", "month", ",", "int", "dayOfMonth", ",", "Weekday", "dayOfWeek", ",", "int", "timeOfDay", ",", "OffsetIndicator", "indicator", ",", "int", "savings", ")", "{", "return", "new", "DayOf...
/*[deutsch] <p>Konstruiert ein Muster f&uuml;r einen Wochentag vor einem festen Monatstag im angegebenen Monat. </p> @param month calendar month @param dayOfMonth reference day of month (1 - 31) @param dayOfWeek day of week when time switch happens @param timeOfDay clock time in seconds after midnight when time switch happens @param indicator offset indicator @param savings fixed DST-offset in seconds @return new daylight saving rule @throws IllegalArgumentException if the last argument is out of range or if the day of month is not valid in context of given month @since 5.0
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Konstruiert", "ein", "Muster", "f&uuml", ";", "r", "einen", "Wochentag", "vor", "einem", "festen", "Monatstag", "im", "angegebenen", "Monat", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/tz/model/GregorianTimezoneRule.java#L421-L432
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java
GoogleCloudStorageFileSystem.createInternal
WritableByteChannel createInternal(URI path, CreateFileOptions options) throws IOException { // Validate the given path. false == do not allow empty object name. StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, false); if (options.getExistingGenerationId() != StorageResourceId.UNKNOWN_GENERATION_ID) { resourceId = new StorageResourceId( resourceId.getBucketName(), resourceId.getObjectName(), options.getExistingGenerationId()); } WritableByteChannel channel = gcs.create(resourceId, objectOptionsFromFileOptions(options)); tryUpdateTimestampsForParentDirectories(ImmutableList.of(path), ImmutableList.<URI>of()); return channel; }
java
WritableByteChannel createInternal(URI path, CreateFileOptions options) throws IOException { // Validate the given path. false == do not allow empty object name. StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, false); if (options.getExistingGenerationId() != StorageResourceId.UNKNOWN_GENERATION_ID) { resourceId = new StorageResourceId( resourceId.getBucketName(), resourceId.getObjectName(), options.getExistingGenerationId()); } WritableByteChannel channel = gcs.create(resourceId, objectOptionsFromFileOptions(options)); tryUpdateTimestampsForParentDirectories(ImmutableList.of(path), ImmutableList.<URI>of()); return channel; }
[ "WritableByteChannel", "createInternal", "(", "URI", "path", ",", "CreateFileOptions", "options", ")", "throws", "IOException", "{", "// Validate the given path. false == do not allow empty object name.", "StorageResourceId", "resourceId", "=", "pathCodec", ".", "validatePathAndG...
Creates and opens an object for writing. If the object already exists, it is deleted. @param path Object full path of the form gs://bucket/object-path. @return A channel for writing to the given object. @throws IOException
[ "Creates", "and", "opens", "an", "object", "for", "writing", ".", "If", "the", "object", "already", "exists", "it", "is", "deleted", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java#L293-L307
sahan/RoboZombie
robozombie/src/main/java/com/lonepulse/robozombie/executor/BasicExecutionHandler.java
BasicExecutionHandler.onError
@Override public void onError(InvocationContext context, Exception error) { throw InvocationException.newInstance(context, error); }
java
@Override public void onError(InvocationContext context, Exception error) { throw InvocationException.newInstance(context, error); }
[ "@", "Override", "public", "void", "onError", "(", "InvocationContext", "context", ",", "Exception", "error", ")", "{", "throw", "InvocationException", ".", "newInstance", "(", "context", ",", "error", ")", ";", "}" ]
<p>Throws a {@link InvocationException} with the {@link InvocationContext}.</p> <p>See {@link ExecutionHandler#onError(InvocationContext, Exception)}</p> @param context the {@link InvocationContext} with information on the proxy invocation <br><br> @param error the root {@link Exception} which resulted in a request execution error <br><br> @since 1.3.0
[ "<p", ">", "Throws", "a", "{", "@link", "InvocationException", "}", "with", "the", "{", "@link", "InvocationContext", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/sahan/RoboZombie/blob/2e02f0d41647612e9d89360c5c48811ea86b33c8/robozombie/src/main/java/com/lonepulse/robozombie/executor/BasicExecutionHandler.java#L82-L86
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java
DisasterRecoveryConfigurationsInner.beginCreateOrUpdateAsync
public Observable<DisasterRecoveryConfigurationInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1<ServiceResponse<DisasterRecoveryConfigurationInner>, DisasterRecoveryConfigurationInner>() { @Override public DisasterRecoveryConfigurationInner call(ServiceResponse<DisasterRecoveryConfigurationInner> response) { return response.body(); } }); }
java
public Observable<DisasterRecoveryConfigurationInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1<ServiceResponse<DisasterRecoveryConfigurationInner>, DisasterRecoveryConfigurationInner>() { @Override public DisasterRecoveryConfigurationInner call(ServiceResponse<DisasterRecoveryConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DisasterRecoveryConfigurationInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "disasterRecoveryConfigurationName", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsyn...
Creates or updates a disaster recovery configuration. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/updated. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DisasterRecoveryConfigurationInner object
[ "Creates", "or", "updates", "a", "disaster", "recovery", "configuration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java#L474-L481
mnlipp/jgrapes
org.jgrapes.io/src/org/jgrapes/net/SslCodec.java
SslCodec.onPurge
@Handler(channels = EncryptedChannel.class) public void onPurge(Purge event, IOSubchannel encryptedChannel) { @SuppressWarnings("unchecked") final Optional<PlainChannel> plainChannel = (Optional<PlainChannel>) LinkedIOSubchannel .downstreamChannel(this, encryptedChannel); if (plainChannel.isPresent()) { plainChannel.get().purge(); } }
java
@Handler(channels = EncryptedChannel.class) public void onPurge(Purge event, IOSubchannel encryptedChannel) { @SuppressWarnings("unchecked") final Optional<PlainChannel> plainChannel = (Optional<PlainChannel>) LinkedIOSubchannel .downstreamChannel(this, encryptedChannel); if (plainChannel.isPresent()) { plainChannel.get().purge(); } }
[ "@", "Handler", "(", "channels", "=", "EncryptedChannel", ".", "class", ")", "public", "void", "onPurge", "(", "Purge", "event", ",", "IOSubchannel", "encryptedChannel", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "Optional", "<", "P...
Forwards a {@link Purge} event downstream. @param event the event @param encryptedChannel the encrypted channel
[ "Forwards", "a", "{", "@link", "Purge", "}", "event", "downstream", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/net/SslCodec.java#L233-L242
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java
UserDataHelper.reconfigureMessaging
public void reconfigureMessaging( String etcDir, Map<String,String> msgData ) throws IOException { String messagingType = msgData.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Logger.getLogger( getClass().getName()).fine( "Messaging type for reconfiguration: " + messagingType ); if( ! Utils.isEmptyOrWhitespaces( etcDir ) && ! Utils.isEmptyOrWhitespaces( messagingType )) { // Write the messaging configuration File f = new File( etcDir, "net.roboconf.messaging." + messagingType + ".cfg" ); Logger logger = Logger.getLogger( getClass().getName()); Properties props = Utils.readPropertiesFileQuietly( f, logger ); props.putAll( msgData ); props.remove( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Utils.writePropertiesFile( props, f ); // Set the messaging type f = new File( etcDir, Constants.KARAF_CFG_FILE_AGENT ); props = Utils.readPropertiesFileQuietly( f, Logger.getLogger( getClass().getName())); if( messagingType != null ) { props.put( Constants.MESSAGING_TYPE, messagingType ); Utils.writePropertiesFile( props, f ); } } }
java
public void reconfigureMessaging( String etcDir, Map<String,String> msgData ) throws IOException { String messagingType = msgData.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Logger.getLogger( getClass().getName()).fine( "Messaging type for reconfiguration: " + messagingType ); if( ! Utils.isEmptyOrWhitespaces( etcDir ) && ! Utils.isEmptyOrWhitespaces( messagingType )) { // Write the messaging configuration File f = new File( etcDir, "net.roboconf.messaging." + messagingType + ".cfg" ); Logger logger = Logger.getLogger( getClass().getName()); Properties props = Utils.readPropertiesFileQuietly( f, logger ); props.putAll( msgData ); props.remove( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Utils.writePropertiesFile( props, f ); // Set the messaging type f = new File( etcDir, Constants.KARAF_CFG_FILE_AGENT ); props = Utils.readPropertiesFileQuietly( f, Logger.getLogger( getClass().getName())); if( messagingType != null ) { props.put( Constants.MESSAGING_TYPE, messagingType ); Utils.writePropertiesFile( props, f ); } } }
[ "public", "void", "reconfigureMessaging", "(", "String", "etcDir", ",", "Map", "<", "String", ",", "String", ">", "msgData", ")", "throws", "IOException", "{", "String", "messagingType", "=", "msgData", ".", "get", "(", "MessagingConstants", ".", "MESSAGING_TYPE...
Reconfigures the messaging. @param etcDir the KARAF_ETC directory @param msgData the messaging configuration parameters
[ "Reconfigures", "the", "messaging", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java#L245-L272
atomix/atomix
cluster/src/main/java/io/atomix/cluster/messaging/impl/AbstractClientConnection.java
AbstractClientConnection.addReplyTime
private void addReplyTime(String type, long replyTime) { DescriptiveStatistics samples = replySamples.get(type); if (samples == null) { samples = replySamples.computeIfAbsent(type, t -> new SynchronizedDescriptiveStatistics(WINDOW_SIZE)); } samples.addValue(replyTime); }
java
private void addReplyTime(String type, long replyTime) { DescriptiveStatistics samples = replySamples.get(type); if (samples == null) { samples = replySamples.computeIfAbsent(type, t -> new SynchronizedDescriptiveStatistics(WINDOW_SIZE)); } samples.addValue(replyTime); }
[ "private", "void", "addReplyTime", "(", "String", "type", ",", "long", "replyTime", ")", "{", "DescriptiveStatistics", "samples", "=", "replySamples", ".", "get", "(", "type", ")", ";", "if", "(", "samples", "==", "null", ")", "{", "samples", "=", "replySa...
Adds a reply time to the history. @param type the message type @param replyTime the reply time to add to the history
[ "Adds", "a", "reply", "time", "to", "the", "history", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/cluster/src/main/java/io/atomix/cluster/messaging/impl/AbstractClientConnection.java#L83-L89
spring-projects/spring-analytics
src/main/java/org/springframework/analytics/metrics/redis/RedisAggregateCounterRepository.java
RedisAggregateCounterRepository.doIncrementHash
private void doIncrementHash(String key, String hashKey, long amount, String bookkeepingKey) { long newValue = hashOperations.increment(key, hashKey, amount); // TODO: the following test does not necessarily mean that the hash // is new, just that the key inside that hash is new. So we end up // calling add more than needed if (newValue == amount) { setOperations.add(bookkeepingKey, key); } }
java
private void doIncrementHash(String key, String hashKey, long amount, String bookkeepingKey) { long newValue = hashOperations.increment(key, hashKey, amount); // TODO: the following test does not necessarily mean that the hash // is new, just that the key inside that hash is new. So we end up // calling add more than needed if (newValue == amount) { setOperations.add(bookkeepingKey, key); } }
[ "private", "void", "doIncrementHash", "(", "String", "key", ",", "String", "hashKey", ",", "long", "amount", ",", "String", "bookkeepingKey", ")", "{", "long", "newValue", "=", "hashOperations", ".", "increment", "(", "key", ",", "hashKey", ",", "amount", ")...
Internally increments the given hash key, keeping track of created hash for a given counter, so they can be cleaned up when needed.
[ "Internally", "increments", "the", "given", "hash", "key", "keeping", "track", "of", "created", "hash", "for", "a", "given", "counter", "so", "they", "can", "be", "cleaned", "up", "when", "needed", "." ]
train
https://github.com/spring-projects/spring-analytics/blob/e3ef19d2b794d6dc10265c171bba46cd757b1abd/src/main/java/org/springframework/analytics/metrics/redis/RedisAggregateCounterRepository.java#L122-L130
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java
FixedURLGenerator.setFixedURL
protected static void setFixedURL(final SpecNode specNode, final String fixedURL, final Set<String> existingFixedUrls) { specNode.setFixedUrl(fixedURL); // Add the fixed url to the processed file names existingFixedUrls.add(fixedURL); }
java
protected static void setFixedURL(final SpecNode specNode, final String fixedURL, final Set<String> existingFixedUrls) { specNode.setFixedUrl(fixedURL); // Add the fixed url to the processed file names existingFixedUrls.add(fixedURL); }
[ "protected", "static", "void", "setFixedURL", "(", "final", "SpecNode", "specNode", ",", "final", "String", "fixedURL", ",", "final", "Set", "<", "String", ">", "existingFixedUrls", ")", "{", "specNode", ".", "setFixedUrl", "(", "fixedURL", ")", ";", "// Add t...
Sets the fixed URL property on the node. @param specNode The spec node to update. @param fixedURL The fixed url to apply to the node. @param existingFixedUrls A list of file names that already exist in the spec.
[ "Sets", "the", "fixed", "URL", "property", "on", "the", "node", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/FixedURLGenerator.java#L251-L256
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.createRandomAccessFile
public static RandomAccessFile createRandomAccessFile(File file, FileMode mode) { try { return new RandomAccessFile(file, mode.name()); } catch (FileNotFoundException e) { throw new IORuntimeException(e); } }
java
public static RandomAccessFile createRandomAccessFile(File file, FileMode mode) { try { return new RandomAccessFile(file, mode.name()); } catch (FileNotFoundException e) { throw new IORuntimeException(e); } }
[ "public", "static", "RandomAccessFile", "createRandomAccessFile", "(", "File", "file", ",", "FileMode", "mode", ")", "{", "try", "{", "return", "new", "RandomAccessFile", "(", "file", ",", "mode", ".", "name", "(", ")", ")", ";", "}", "catch", "(", "FileNo...
创建{@link RandomAccessFile} @param file 文件 @param mode 模式,见{@link FileMode} @return {@link RandomAccessFile} @since 4.5.2
[ "创建", "{", "@link", "RandomAccessFile", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3457-L3463
google/closure-compiler
src/com/google/javascript/jscomp/GoogleCodingConvention.java
GoogleCodingConvention.isExported
@Override public boolean isExported(String name, boolean local) { return super.isExported(name, local) || (!local && name.startsWith("_")); }
java
@Override public boolean isExported(String name, boolean local) { return super.isExported(name, local) || (!local && name.startsWith("_")); }
[ "@", "Override", "public", "boolean", "isExported", "(", "String", "name", ",", "boolean", "local", ")", "{", "return", "super", ".", "isExported", "(", "name", ",", "local", ")", "||", "(", "!", "local", "&&", "name", ".", "startsWith", "(", "\"_\"", ...
{@inheritDoc} <p>In Google code, any global name starting with an underscore is considered exported.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/GoogleCodingConvention.java#L147-L150
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getDocLink
public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc, String label, boolean strong, boolean isProperty) { return getDocLink(context, classDoc, doc, new StringContent(check(label)), strong, isProperty); }
java
public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc, String label, boolean strong, boolean isProperty) { return getDocLink(context, classDoc, doc, new StringContent(check(label)), strong, isProperty); }
[ "public", "Content", "getDocLink", "(", "LinkInfoImpl", ".", "Kind", "context", ",", "ClassDoc", "classDoc", ",", "MemberDoc", "doc", ",", "String", "label", ",", "boolean", "strong", ",", "boolean", "isProperty", ")", "{", "return", "getDocLink", "(", "contex...
Return the link for the given member. @param context the id of the context where the link will be printed. @param classDoc the classDoc that we should link to. This is not necessarily equal to doc.containingClass(). We may be inheriting comments. @param doc the member being linked to. @param label the label for the link. @param strong true if the link should be strong. @param isProperty true if the doc parameter is a JavaFX property. @return the link for the given member.
[ "Return", "the", "link", "for", "the", "given", "member", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1227-L1230
overturetool/overture
ide/plugins/poviewer/src/main/java/org/overture/ide/plugins/poviewer/view/PoTableView.java
PoTableView.createPartControl
@Override public void createPartControl(Composite parent) { viewer = new StyledText(parent, SWT.WRAP | SWT.V_SCROLL|SWT.READ_ONLY); viewer.setFont(font); }
java
@Override public void createPartControl(Composite parent) { viewer = new StyledText(parent, SWT.WRAP | SWT.V_SCROLL|SWT.READ_ONLY); viewer.setFont(font); }
[ "@", "Override", "public", "void", "createPartControl", "(", "Composite", "parent", ")", "{", "viewer", "=", "new", "StyledText", "(", "parent", ",", "SWT", ".", "WRAP", "|", "SWT", ".", "V_SCROLL", "|", "SWT", ".", "READ_ONLY", ")", ";", "viewer", ".", ...
This is a callback that will allow us to create the viewer and initialize it.
[ "This", "is", "a", "callback", "that", "will", "allow", "us", "to", "create", "the", "viewer", "and", "initialize", "it", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/plugins/poviewer/src/main/java/org/overture/ide/plugins/poviewer/view/PoTableView.java#L72-L78
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/gcc/cross/GppLinker.java
GppLinker.decorateLinkerOption
@Override public String decorateLinkerOption(final StringBuffer buf, final String arg) { String decoratedArg = arg; if (arg.length() > 1 && arg.charAt(0) == '-') { switch (arg.charAt(1)) { // // passed automatically by GCC // case 'g': case 'f': case 'F': /* Darwin */ case 'm': case 'O': case 'W': case 'l': case 'L': case 'u': break; default: boolean known = false; for (final String linkerOption : linkerOptions) { if (linkerOption.equals(arg)) { known = true; break; } } if (!known) { buf.setLength(0); buf.append("-Wl,"); buf.append(arg); decoratedArg = buf.toString(); } break; } } return decoratedArg; }
java
@Override public String decorateLinkerOption(final StringBuffer buf, final String arg) { String decoratedArg = arg; if (arg.length() > 1 && arg.charAt(0) == '-') { switch (arg.charAt(1)) { // // passed automatically by GCC // case 'g': case 'f': case 'F': /* Darwin */ case 'm': case 'O': case 'W': case 'l': case 'L': case 'u': break; default: boolean known = false; for (final String linkerOption : linkerOptions) { if (linkerOption.equals(arg)) { known = true; break; } } if (!known) { buf.setLength(0); buf.append("-Wl,"); buf.append(arg); decoratedArg = buf.toString(); } break; } } return decoratedArg; }
[ "@", "Override", "public", "String", "decorateLinkerOption", "(", "final", "StringBuffer", "buf", ",", "final", "String", "arg", ")", "{", "String", "decoratedArg", "=", "arg", ";", "if", "(", "arg", ".", "length", "(", ")", ">", "1", "&&", "arg", ".", ...
Allows drived linker to decorate linker option. Override by GppLinker to prepend a "-Wl," to pass option to through gcc to linker. @param buf buffer that may be used and abused in the decoration process, must not be null. @param arg linker argument
[ "Allows", "drived", "linker", "to", "decorate", "linker", "option", ".", "Override", "by", "GppLinker", "to", "prepend", "a", "-", "Wl", "to", "pass", "option", "to", "through", "gcc", "to", "linker", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/gcc/cross/GppLinker.java#L128-L165
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupBean.java
CmsSetupBean.backupConfiguration
public void backupConfiguration(String filename, String originalFilename) { // ensure backup folder exists File backupFolder = new File(m_configRfsPath + FOLDER_BACKUP); if (!backupFolder.exists()) { backupFolder.mkdirs(); } // copy file to (or from) backup folder originalFilename = FOLDER_BACKUP + originalFilename; File file = new File(m_configRfsPath + originalFilename); if (file.exists()) { copyFile(originalFilename, filename); } else { copyFile(filename, originalFilename); } }
java
public void backupConfiguration(String filename, String originalFilename) { // ensure backup folder exists File backupFolder = new File(m_configRfsPath + FOLDER_BACKUP); if (!backupFolder.exists()) { backupFolder.mkdirs(); } // copy file to (or from) backup folder originalFilename = FOLDER_BACKUP + originalFilename; File file = new File(m_configRfsPath + originalFilename); if (file.exists()) { copyFile(originalFilename, filename); } else { copyFile(filename, originalFilename); } }
[ "public", "void", "backupConfiguration", "(", "String", "filename", ",", "String", "originalFilename", ")", "{", "// ensure backup folder exists", "File", "backupFolder", "=", "new", "File", "(", "m_configRfsPath", "+", "FOLDER_BACKUP", ")", ";", "if", "(", "!", "...
Restores the opencms.xml either to or from a backup file, depending whether the setup wizard is executed the first time (the backup does not exist) or not (the backup exists). @param filename something like e.g. "opencms.xml" @param originalFilename the configurations real file name, e.g. "opencms.xml.ori"
[ "Restores", "the", "opencms", ".", "xml", "either", "to", "or", "from", "a", "backup", "file", "depending", "whether", "the", "setup", "wizard", "is", "executed", "the", "first", "time", "(", "the", "backup", "does", "not", "exist", ")", "or", "not", "("...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L324-L340
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java
ElementMatchers.hasDescriptor
public static <T extends ByteCodeElement> ElementMatcher.Junction<T> hasDescriptor(String descriptor) { return new DescriptorMatcher<T>(new StringMatcher(descriptor, StringMatcher.Mode.EQUALS_FULLY)); }
java
public static <T extends ByteCodeElement> ElementMatcher.Junction<T> hasDescriptor(String descriptor) { return new DescriptorMatcher<T>(new StringMatcher(descriptor, StringMatcher.Mode.EQUALS_FULLY)); }
[ "public", "static", "<", "T", "extends", "ByteCodeElement", ">", "ElementMatcher", ".", "Junction", "<", "T", ">", "hasDescriptor", "(", "String", "descriptor", ")", "{", "return", "new", "DescriptorMatcher", "<", "T", ">", "(", "new", "StringMatcher", "(", ...
Matches a {@link ByteCodeElement}'s descriptor against a given value. @param descriptor The expected descriptor. @param <T> The type of the matched object. @return A matcher for the given {@code descriptor}.
[ "Matches", "a", "{", "@link", "ByteCodeElement", "}", "s", "descriptor", "against", "a", "given", "value", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L767-L769
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyDecoder.java
KeyDecoder.decodeLongObjDesc
public static Long decodeLongObjDesc(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeLongDesc(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static Long decodeLongObjDesc(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeLongDesc(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "Long", "decodeLongObjDesc", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "int", "b", "=", "src", "[", "srcOffset", "]", ";", "if", "(", "b", "==", "NULL_BYTE_HIGH", ...
Decodes a signed Long object from exactly 1 or 9 bytes, as encoded for descending order. If null is returned, then 1 byte was read. @param src source of encoded bytes @param srcOffset offset into source array @return signed Long object or null
[ "Decodes", "a", "signed", "Long", "object", "from", "exactly", "1", "or", "9", "bytes", "as", "encoded", "for", "descending", "order", ".", "If", "null", "is", "returned", "then", "1", "byte", "was", "read", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L94-L106
segmentio/analytics-android
analytics/src/main/java/com/segment/analytics/Options.java
Options.setIntegration
public Options setIntegration(Analytics.BundledIntegration bundledIntegration, boolean enabled) { setIntegration(bundledIntegration.key, enabled); return this; }
java
public Options setIntegration(Analytics.BundledIntegration bundledIntegration, boolean enabled) { setIntegration(bundledIntegration.key, enabled); return this; }
[ "public", "Options", "setIntegration", "(", "Analytics", ".", "BundledIntegration", "bundledIntegration", ",", "boolean", "enabled", ")", "{", "setIntegration", "(", "bundledIntegration", ".", "key", ",", "enabled", ")", ";", "return", "this", ";", "}" ]
Sets whether an action will be sent to the target integration. Same as {@link #setIntegration(String, boolean)} but type safe for bundled integrations. @param bundledIntegration The target integration @param enabled <code>true</code> for enabled, <code>false</code> for disabled @return This options object for chaining @see #setIntegration(String, boolean)
[ "Sets", "whether", "an", "action", "will", "be", "sent", "to", "the", "target", "integration", ".", "Same", "as", "{", "@link", "#setIntegration", "(", "String", "boolean", ")", "}", "but", "type", "safe", "for", "bundled", "integrations", "." ]
train
https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Options.java#L88-L91
zaproxy/zaproxy
src/org/apache/commons/httpclient/HttpMethodBase.java
HttpMethodBase.checkExecuteConditions
private void checkExecuteConditions(HttpState state, HttpConnection conn) throws HttpException { if (state == null) { throw new IllegalArgumentException("HttpState parameter may not be null"); } if (conn == null) { throw new IllegalArgumentException("HttpConnection parameter may not be null"); } if (this.aborted) { throw new IllegalStateException("Method has been aborted"); } if (!validate()) { throw new ProtocolException("HttpMethodBase object not valid"); } }
java
private void checkExecuteConditions(HttpState state, HttpConnection conn) throws HttpException { if (state == null) { throw new IllegalArgumentException("HttpState parameter may not be null"); } if (conn == null) { throw new IllegalArgumentException("HttpConnection parameter may not be null"); } if (this.aborted) { throw new IllegalStateException("Method has been aborted"); } if (!validate()) { throw new ProtocolException("HttpMethodBase object not valid"); } }
[ "private", "void", "checkExecuteConditions", "(", "HttpState", "state", ",", "HttpConnection", "conn", ")", "throws", "HttpException", "{", "if", "(", "state", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"HttpState parameter may not be n...
Tests if the this method is ready to be executed. @param state the {@link HttpState state} information associated with this method @param conn the {@link HttpConnection connection} to be used @throws HttpException If the method is in invalid state.
[ "Tests", "if", "the", "this", "method", "is", "ready", "to", "be", "executed", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/apache/commons/httpclient/HttpMethodBase.java#L1102-L1117
rundeck/rundeck
rundeck-storage/rundeck-storage-api/src/main/java/org/rundeck/storage/api/PathUtil.java
PathUtil.appendPath
public static Path appendPath(Path prefix, String subpath) { return asPath(appendPath(prefix.getPath(), subpath)); }
java
public static Path appendPath(Path prefix, String subpath) { return asPath(appendPath(prefix.getPath(), subpath)); }
[ "public", "static", "Path", "appendPath", "(", "Path", "prefix", ",", "String", "subpath", ")", "{", "return", "asPath", "(", "appendPath", "(", "prefix", ".", "getPath", "(", ")", ",", "subpath", ")", ")", ";", "}" ]
Append one path to another @param prefix prefix @param subpath sub path @return sub path appended to the prefix
[ "Append", "one", "path", "to", "another" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-api/src/main/java/org/rundeck/storage/api/PathUtil.java#L243-L245
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/thread_pool/ThreadPoolManager.java
ThreadPoolManager.scheduleWithFixedDelay
public static ScheduledFuture scheduleWithFixedDelay(Runnable runnable, long delayInMilli) { /* 我们默认设定一个runnable生命周期与一个msgId一一对应 */ Runnable proxy = wrapRunnable(runnable, null); return newSingleThreadScheduler().scheduleWithFixedDelay(proxy, 0, delayInMilli, TimeUnit.MILLISECONDS); }
java
public static ScheduledFuture scheduleWithFixedDelay(Runnable runnable, long delayInMilli) { /* 我们默认设定一个runnable生命周期与一个msgId一一对应 */ Runnable proxy = wrapRunnable(runnable, null); return newSingleThreadScheduler().scheduleWithFixedDelay(proxy, 0, delayInMilli, TimeUnit.MILLISECONDS); }
[ "public", "static", "ScheduledFuture", "scheduleWithFixedDelay", "(", "Runnable", "runnable", ",", "long", "delayInMilli", ")", "{", "/* 我们默认设定一个runnable生命周期与一个msgId一一对应 */", "Runnable", "proxy", "=", "wrapRunnable", "(", "runnable", ",", "null", ")", ";", "return", "...
前一个任务结束,等待固定时间,下一个任务开始执行 @param runnable 你要提交的任务 @param delayInMilli 前一个任务结束后多久开始进行下一个任务,单位毫秒
[ "前一个任务结束,等待固定时间,下一个任务开始执行" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/thread_pool/ThreadPoolManager.java#L265-L269
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_externalContact_externalEmailAddress_GET
public OvhExchangeExternalContact organizationName_service_exchangeService_externalContact_externalEmailAddress_GET(String organizationName, String exchangeService, String externalEmailAddress) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}"; StringBuilder sb = path(qPath, organizationName, exchangeService, externalEmailAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangeExternalContact.class); }
java
public OvhExchangeExternalContact organizationName_service_exchangeService_externalContact_externalEmailAddress_GET(String organizationName, String exchangeService, String externalEmailAddress) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress}"; StringBuilder sb = path(qPath, organizationName, exchangeService, externalEmailAddress); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangeExternalContact.class); }
[ "public", "OvhExchangeExternalContact", "organizationName_service_exchangeService_externalContact_externalEmailAddress_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "externalEmailAddress", ")", "throws", "IOException", "{", "String", "qPa...
Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/externalContact/{externalEmailAddress} @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param externalEmailAddress [required] Contact email
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L912-L917
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/body/request/RequestMultipartBody.java
RequestMultipartBody.setBody
@Override public void setBody(FoxHttpRequestBodyContext context) throws FoxHttpRequestException { try { writer = new PrintWriter(new OutputStreamWriter(outputStream, charset), true); processFormFields(); processStream(); writer.flush(); writer.append("--" + boundary + "--").append(lineFeed); writer.close(); //Execute interceptor executeInterceptor(context); //Add Content-Length header if not exist if (context.getUrlConnection().getRequestProperty(HeaderTypes.CONTENT_LENGTH.toString()) == null) { context.getUrlConnection().setRequestProperty(HeaderTypes.CONTENT_LENGTH.toString(), Integer.toString(outputStream.size())); } context.getUrlConnection().getOutputStream().write(outputStream.toByteArray()); } catch (Exception e) { throw new FoxHttpRequestException(e); } }
java
@Override public void setBody(FoxHttpRequestBodyContext context) throws FoxHttpRequestException { try { writer = new PrintWriter(new OutputStreamWriter(outputStream, charset), true); processFormFields(); processStream(); writer.flush(); writer.append("--" + boundary + "--").append(lineFeed); writer.close(); //Execute interceptor executeInterceptor(context); //Add Content-Length header if not exist if (context.getUrlConnection().getRequestProperty(HeaderTypes.CONTENT_LENGTH.toString()) == null) { context.getUrlConnection().setRequestProperty(HeaderTypes.CONTENT_LENGTH.toString(), Integer.toString(outputStream.size())); } context.getUrlConnection().getOutputStream().write(outputStream.toByteArray()); } catch (Exception e) { throw new FoxHttpRequestException(e); } }
[ "@", "Override", "public", "void", "setBody", "(", "FoxHttpRequestBodyContext", "context", ")", "throws", "FoxHttpRequestException", "{", "try", "{", "writer", "=", "new", "PrintWriter", "(", "new", "OutputStreamWriter", "(", "outputStream", ",", "charset", ")", "...
Set the body of the request @param context context of the request @throws FoxHttpRequestException can throw different exception based on input streams and interceptors
[ "Set", "the", "body", "of", "the", "request" ]
train
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/body/request/RequestMultipartBody.java#L65-L91
apache/incubator-gobblin
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/workunit/packer/KafkaWorkUnitPacker.java
KafkaWorkUnitPacker.squeezeMultiWorkUnit
protected WorkUnit squeezeMultiWorkUnit(MultiWorkUnit multiWorkUnit) { WatermarkInterval interval = getWatermarkIntervalFromMultiWorkUnit(multiWorkUnit); List<KafkaPartition> partitions = getPartitionsFromMultiWorkUnit(multiWorkUnit); Preconditions.checkArgument(!partitions.isEmpty(), "There must be at least one partition in the multiWorkUnit"); // Squeeze all partitions from the multiWorkUnit into of one the work units, which can be any one WorkUnit workUnit = multiWorkUnit.getWorkUnits().get(0); // Update interval workUnit.removeProp(ConfigurationKeys.WORK_UNIT_LOW_WATER_MARK_KEY); workUnit.removeProp(ConfigurationKeys.WORK_UNIT_HIGH_WATER_MARK_KEY); workUnit.setWatermarkInterval(interval); // Update offset fetch epoch time and previous latest offset. These are used to compute the load factor, // gobblin consumption rate relative to the kafka production rate. The kafka rate is computed as // (current latest offset - previous latest offset)/(current epoch time - previous epoch time). int index = 0; for (WorkUnit wu : multiWorkUnit.getWorkUnits()) { workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_START_FETCH_EPOCH_TIME, index), wu.getProp(KafkaSource.PREVIOUS_START_FETCH_EPOCH_TIME)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_STOP_FETCH_EPOCH_TIME, index), wu.getProp(KafkaSource.PREVIOUS_STOP_FETCH_EPOCH_TIME)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_LOW_WATERMARK, index), wu.getProp(KafkaSource.PREVIOUS_LOW_WATERMARK)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_HIGH_WATERMARK, index), wu.getProp(KafkaSource.PREVIOUS_HIGH_WATERMARK)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_OFFSET_FETCH_EPOCH_TIME, index), wu.getProp(KafkaSource.PREVIOUS_OFFSET_FETCH_EPOCH_TIME)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.OFFSET_FETCH_EPOCH_TIME, index), wu.getProp(KafkaSource.OFFSET_FETCH_EPOCH_TIME)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_LATEST_OFFSET, index), wu.getProp(KafkaSource.PREVIOUS_LATEST_OFFSET)); index++; } workUnit.removeProp(KafkaSource.PREVIOUS_START_FETCH_EPOCH_TIME); workUnit.removeProp(KafkaSource.PREVIOUS_STOP_FETCH_EPOCH_TIME); workUnit.removeProp(KafkaSource.PREVIOUS_LOW_WATERMARK); workUnit.removeProp(KafkaSource.PREVIOUS_HIGH_WATERMARK); workUnit.removeProp(KafkaSource.PREVIOUS_OFFSET_FETCH_EPOCH_TIME); workUnit.removeProp(KafkaSource.OFFSET_FETCH_EPOCH_TIME); workUnit.removeProp(KafkaSource.PREVIOUS_LATEST_OFFSET); // Remove the original partition information workUnit.removeProp(KafkaSource.PARTITION_ID); workUnit.removeProp(KafkaSource.LEADER_ID); workUnit.removeProp(KafkaSource.LEADER_HOSTANDPORT); // Add combined partitions information populateMultiPartitionWorkUnit(partitions, workUnit); LOG.info(String.format("Created MultiWorkUnit for partitions %s", partitions)); return workUnit; }
java
protected WorkUnit squeezeMultiWorkUnit(MultiWorkUnit multiWorkUnit) { WatermarkInterval interval = getWatermarkIntervalFromMultiWorkUnit(multiWorkUnit); List<KafkaPartition> partitions = getPartitionsFromMultiWorkUnit(multiWorkUnit); Preconditions.checkArgument(!partitions.isEmpty(), "There must be at least one partition in the multiWorkUnit"); // Squeeze all partitions from the multiWorkUnit into of one the work units, which can be any one WorkUnit workUnit = multiWorkUnit.getWorkUnits().get(0); // Update interval workUnit.removeProp(ConfigurationKeys.WORK_UNIT_LOW_WATER_MARK_KEY); workUnit.removeProp(ConfigurationKeys.WORK_UNIT_HIGH_WATER_MARK_KEY); workUnit.setWatermarkInterval(interval); // Update offset fetch epoch time and previous latest offset. These are used to compute the load factor, // gobblin consumption rate relative to the kafka production rate. The kafka rate is computed as // (current latest offset - previous latest offset)/(current epoch time - previous epoch time). int index = 0; for (WorkUnit wu : multiWorkUnit.getWorkUnits()) { workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_START_FETCH_EPOCH_TIME, index), wu.getProp(KafkaSource.PREVIOUS_START_FETCH_EPOCH_TIME)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_STOP_FETCH_EPOCH_TIME, index), wu.getProp(KafkaSource.PREVIOUS_STOP_FETCH_EPOCH_TIME)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_LOW_WATERMARK, index), wu.getProp(KafkaSource.PREVIOUS_LOW_WATERMARK)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_HIGH_WATERMARK, index), wu.getProp(KafkaSource.PREVIOUS_HIGH_WATERMARK)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_OFFSET_FETCH_EPOCH_TIME, index), wu.getProp(KafkaSource.PREVIOUS_OFFSET_FETCH_EPOCH_TIME)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.OFFSET_FETCH_EPOCH_TIME, index), wu.getProp(KafkaSource.OFFSET_FETCH_EPOCH_TIME)); workUnit.setProp(KafkaUtils.getPartitionPropName(KafkaSource.PREVIOUS_LATEST_OFFSET, index), wu.getProp(KafkaSource.PREVIOUS_LATEST_OFFSET)); index++; } workUnit.removeProp(KafkaSource.PREVIOUS_START_FETCH_EPOCH_TIME); workUnit.removeProp(KafkaSource.PREVIOUS_STOP_FETCH_EPOCH_TIME); workUnit.removeProp(KafkaSource.PREVIOUS_LOW_WATERMARK); workUnit.removeProp(KafkaSource.PREVIOUS_HIGH_WATERMARK); workUnit.removeProp(KafkaSource.PREVIOUS_OFFSET_FETCH_EPOCH_TIME); workUnit.removeProp(KafkaSource.OFFSET_FETCH_EPOCH_TIME); workUnit.removeProp(KafkaSource.PREVIOUS_LATEST_OFFSET); // Remove the original partition information workUnit.removeProp(KafkaSource.PARTITION_ID); workUnit.removeProp(KafkaSource.LEADER_ID); workUnit.removeProp(KafkaSource.LEADER_HOSTANDPORT); // Add combined partitions information populateMultiPartitionWorkUnit(partitions, workUnit); LOG.info(String.format("Created MultiWorkUnit for partitions %s", partitions)); return workUnit; }
[ "protected", "WorkUnit", "squeezeMultiWorkUnit", "(", "MultiWorkUnit", "multiWorkUnit", ")", "{", "WatermarkInterval", "interval", "=", "getWatermarkIntervalFromMultiWorkUnit", "(", "multiWorkUnit", ")", ";", "List", "<", "KafkaPartition", ">", "partitions", "=", "getPart...
Combine all {@link WorkUnit}s in the {@link MultiWorkUnit} into a single {@link WorkUnit}.
[ "Combine", "all", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/workunit/packer/KafkaWorkUnitPacker.java#L202-L251
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.paintIndicator
protected void paintIndicator (Graphics2D gfx, Rectangle clip, SceneObjectIndicator tip) { if (clip.intersects(tip.getBounds())) { tip.paint(gfx); } }
java
protected void paintIndicator (Graphics2D gfx, Rectangle clip, SceneObjectIndicator tip) { if (clip.intersects(tip.getBounds())) { tip.paint(gfx); } }
[ "protected", "void", "paintIndicator", "(", "Graphics2D", "gfx", ",", "Rectangle", "clip", ",", "SceneObjectIndicator", "tip", ")", "{", "if", "(", "clip", ".", "intersects", "(", "tip", ".", "getBounds", "(", ")", ")", ")", "{", "tip", ".", "paint", "("...
Paint the specified indicator if it intersects the clipping rectangle.
[ "Paint", "the", "specified", "indicator", "if", "it", "intersects", "the", "clipping", "rectangle", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1350-L1355
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/cfg/ProcessEngineConfigurationImpl.java
ProcessEngineConfigurationImpl.checkForMariaDb
protected String checkForMariaDb(DatabaseMetaData databaseMetaData, String databaseName) { try { String databaseProductVersion = databaseMetaData.getDatabaseProductVersion(); if (databaseProductVersion != null && databaseProductVersion.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } } catch (SQLException ignore) { } try { String driverName = databaseMetaData.getDriverName(); if (driverName != null && driverName.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } } catch (SQLException ignore) { } String metaDataClassName = databaseMetaData.getClass().getName(); if (metaDataClassName != null && metaDataClassName.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } return databaseName; }
java
protected String checkForMariaDb(DatabaseMetaData databaseMetaData, String databaseName) { try { String databaseProductVersion = databaseMetaData.getDatabaseProductVersion(); if (databaseProductVersion != null && databaseProductVersion.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } } catch (SQLException ignore) { } try { String driverName = databaseMetaData.getDriverName(); if (driverName != null && driverName.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } } catch (SQLException ignore) { } String metaDataClassName = databaseMetaData.getClass().getName(); if (metaDataClassName != null && metaDataClassName.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } return databaseName; }
[ "protected", "String", "checkForMariaDb", "(", "DatabaseMetaData", "databaseMetaData", ",", "String", "databaseName", ")", "{", "try", "{", "String", "databaseProductVersion", "=", "databaseMetaData", ".", "getDatabaseProductVersion", "(", ")", ";", "if", "(", "databa...
The product name of mariadb is still 'MySQL'. This method tries if it can find some evidence for mariadb. If it is successful it will return "MariaDB", otherwise the provided database name.
[ "The", "product", "name", "of", "mariadb", "is", "still", "MySQL", ".", "This", "method", "tries", "if", "it", "can", "find", "some", "evidence", "for", "mariadb", ".", "If", "it", "is", "successful", "it", "will", "return", "MariaDB", "otherwise", "the", ...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L1353-L1376
rzwitserloot/lombok
src/core/lombok/javac/handlers/JavacHandlerUtil.java
JavacHandlerUtil.injectFieldAndMarkGenerated
public static JavacNode injectFieldAndMarkGenerated(JavacNode typeNode, JCVariableDecl field) { return injectField(typeNode, field, true); }
java
public static JavacNode injectFieldAndMarkGenerated(JavacNode typeNode, JCVariableDecl field) { return injectField(typeNode, field, true); }
[ "public", "static", "JavacNode", "injectFieldAndMarkGenerated", "(", "JavacNode", "typeNode", ",", "JCVariableDecl", "field", ")", "{", "return", "injectField", "(", "typeNode", ",", "field", ",", "true", ")", ";", "}" ]
Adds the given new field declaration to the provided type AST Node. The field carries the &#64;{@link SuppressWarnings}("all") annotation. Also takes care of updating the JavacAST.
[ "Adds", "the", "given", "new", "field", "declaration", "to", "the", "provided", "type", "AST", "Node", ".", "The", "field", "carries", "the", "&#64", ";", "{" ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1006-L1008
Netflix/Nicobar
nicobar-cassandra/src/main/java/com/netflix/nicobar/cassandra/internal/AbstractCassandraHystrixCommand.java
AbstractCassandraHystrixCommand.getColumnFamilyViaColumnName
@SuppressWarnings("rawtypes") protected ColumnFamily getColumnFamilyViaColumnName(String columnFamilyName, Object rowKey) { return getColumnFamilyViaColumnName(columnFamilyName, rowKey.getClass()); }
java
@SuppressWarnings("rawtypes") protected ColumnFamily getColumnFamilyViaColumnName(String columnFamilyName, Object rowKey) { return getColumnFamilyViaColumnName(columnFamilyName, rowKey.getClass()); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "protected", "ColumnFamily", "getColumnFamilyViaColumnName", "(", "String", "columnFamilyName", ",", "Object", "rowKey", ")", "{", "return", "getColumnFamilyViaColumnName", "(", "columnFamilyName", ",", "rowKey", ".", "...
returns a ColumnFamily given a columnFamilyName @param columnFamilyName @param rowKey @return the constructed ColumnFamily
[ "returns", "a", "ColumnFamily", "given", "a", "columnFamilyName" ]
train
https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-cassandra/src/main/java/com/netflix/nicobar/cassandra/internal/AbstractCassandraHystrixCommand.java#L41-L44
RogerParkinson/madura-workflows
madura-workflow/src/main/java/nz/co/senanque/workflow/WorkflowManagerImpl.java
WorkflowManagerImpl.endOfProcessDetected
protected TaskBase endOfProcessDetected(ProcessInstance processInstance, Audit currentAudit) { TaskBase ret = null; TaskBase currentTask = getCurrentTask(processInstance); ProcessInstanceUtils.clearQueue(processInstance, TaskStatus.DONE); currentAudit.setStatus(TaskStatus.DONE); // End of process can mean just the end of a handler process. { List<Audit> audits = findHandlerTasks(processInstance); for (Audit audit : audits) { TaskBase taskBase = getTask(audit); audit.setHandler(false); if (taskBase instanceof TaskTry) { TaskTry taskTry = (TaskTry)taskBase; if (taskTry.getTimeoutValue() > -1) { // we ended a handler that had a timeout. // That means we need to cancel the timeout. getWorkflowDAO().removeDeferredEvent(processInstance,taskTry); } TaskBase nextTask = taskTry.getNextTask(processInstance); nextTask.loadTask(processInstance); } if (taskBase instanceof TaskIf) { TaskIf taskIf = (TaskIf)taskBase; TaskBase nextTask = taskIf.getNextTask(processInstance); nextTask.loadTask(processInstance); } ret = getCurrentTask(processInstance); break; } } // If this is a subprocess then tickle the parent. tickleParentProcess(processInstance,TaskStatus.DONE); if (ret == currentTask) { processInstance.setStatus(TaskStatus.DONE); } getWorkflowDAO().mergeProcessInstance(processInstance); getWorkflowDAO().flush(); getWorkflowDAO().refreshProcessInstance(processInstance); return ret; }
java
protected TaskBase endOfProcessDetected(ProcessInstance processInstance, Audit currentAudit) { TaskBase ret = null; TaskBase currentTask = getCurrentTask(processInstance); ProcessInstanceUtils.clearQueue(processInstance, TaskStatus.DONE); currentAudit.setStatus(TaskStatus.DONE); // End of process can mean just the end of a handler process. { List<Audit> audits = findHandlerTasks(processInstance); for (Audit audit : audits) { TaskBase taskBase = getTask(audit); audit.setHandler(false); if (taskBase instanceof TaskTry) { TaskTry taskTry = (TaskTry)taskBase; if (taskTry.getTimeoutValue() > -1) { // we ended a handler that had a timeout. // That means we need to cancel the timeout. getWorkflowDAO().removeDeferredEvent(processInstance,taskTry); } TaskBase nextTask = taskTry.getNextTask(processInstance); nextTask.loadTask(processInstance); } if (taskBase instanceof TaskIf) { TaskIf taskIf = (TaskIf)taskBase; TaskBase nextTask = taskIf.getNextTask(processInstance); nextTask.loadTask(processInstance); } ret = getCurrentTask(processInstance); break; } } // If this is a subprocess then tickle the parent. tickleParentProcess(processInstance,TaskStatus.DONE); if (ret == currentTask) { processInstance.setStatus(TaskStatus.DONE); } getWorkflowDAO().mergeProcessInstance(processInstance); getWorkflowDAO().flush(); getWorkflowDAO().refreshProcessInstance(processInstance); return ret; }
[ "protected", "TaskBase", "endOfProcessDetected", "(", "ProcessInstance", "processInstance", ",", "Audit", "currentAudit", ")", "{", "TaskBase", "ret", "=", "null", ";", "TaskBase", "currentTask", "=", "getCurrentTask", "(", "processInstance", ")", ";", "ProcessInstanc...
If this is just the end of the handler then return the next task after the handler If it is the end of the whole process then return null. @param processInstance @param currentAudit @return TaskBase
[ "If", "this", "is", "just", "the", "end", "of", "the", "handler", "then", "return", "the", "next", "task", "after", "the", "handler", "If", "it", "is", "the", "end", "of", "the", "whole", "process", "then", "return", "null", "." ]
train
https://github.com/RogerParkinson/madura-workflows/blob/3d26c322fc85a006ff0d0cbebacbc453aed8e492/madura-workflow/src/main/java/nz/co/senanque/workflow/WorkflowManagerImpl.java#L396-L436
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Reductions.java
Reductions.minimum
public static <E extends Comparable<E>> E minimum(Iterator<E> iterator, E init) { return Reductions.reduce(iterator, BinaryOperator.minBy(new ComparableComparator<E>()), init); }
java
public static <E extends Comparable<E>> E minimum(Iterator<E> iterator, E init) { return Reductions.reduce(iterator, BinaryOperator.minBy(new ComparableComparator<E>()), init); }
[ "public", "static", "<", "E", "extends", "Comparable", "<", "E", ">", ">", "E", "minimum", "(", "Iterator", "<", "E", ">", "iterator", ",", "E", "init", ")", "{", "return", "Reductions", ".", "reduce", "(", "iterator", ",", "BinaryOperator", ".", "minB...
Returns the min element contained in the iterator @param <E> the iterator element type parameter @param iterator the iterator to be consumed @param init the initial value to be used @return the min element contained in the iterator
[ "Returns", "the", "min", "element", "contained", "in", "the", "iterator" ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Reductions.java#L251-L253
spring-projects/spring-shell
spring-shell-core/src/main/java/org/springframework/shell/CompletionContext.java
CompletionContext.drop
public CompletionContext drop(int nbWords) { return new CompletionContext(new ArrayList<String>(words.subList(nbWords, words.size())), wordIndex-nbWords, position); }
java
public CompletionContext drop(int nbWords) { return new CompletionContext(new ArrayList<String>(words.subList(nbWords, words.size())), wordIndex-nbWords, position); }
[ "public", "CompletionContext", "drop", "(", "int", "nbWords", ")", "{", "return", "new", "CompletionContext", "(", "new", "ArrayList", "<", "String", ">", "(", "words", ".", "subList", "(", "nbWords", ",", "words", ".", "size", "(", ")", ")", ")", ",", ...
Return a copy of this context, as if the first {@literal nbWords} were not present
[ "Return", "a", "copy", "of", "this", "context", "as", "if", "the", "first", "{" ]
train
https://github.com/spring-projects/spring-shell/blob/23d99f45eb8f487e31a1f080c837061313bbfafa/spring-shell-core/src/main/java/org/springframework/shell/CompletionContext.java#L86-L88
erlang/otp
lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java
OtpOutputStream.write_bitstr
public void write_bitstr(final byte[] bin, final int pad_bits) { if (pad_bits == 0) { write_binary(bin); return; } write1(OtpExternal.bitBinTag); write4BE(bin.length); write1(8 - pad_bits); writeN(bin); }
java
public void write_bitstr(final byte[] bin, final int pad_bits) { if (pad_bits == 0) { write_binary(bin); return; } write1(OtpExternal.bitBinTag); write4BE(bin.length); write1(8 - pad_bits); writeN(bin); }
[ "public", "void", "write_bitstr", "(", "final", "byte", "[", "]", "bin", ",", "final", "int", "pad_bits", ")", "{", "if", "(", "pad_bits", "==", "0", ")", "{", "write_binary", "(", "bin", ")", ";", "return", ";", "}", "write1", "(", "OtpExternal", "....
Write an array of bytes to the stream as an Erlang bitstr. @param bin the array of bytes to write. @param pad_bits the number of zero pad bits at the low end of the last byte
[ "Write", "an", "array", "of", "bytes", "to", "the", "stream", "as", "an", "Erlang", "bitstr", "." ]
train
https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java#L462-L471
owetterau/neo4j-websockets
client/src/main/java/de/oliverwetterau/neo4j/websockets/client/DatabaseService.java
DatabaseService.writeDataWithResult
@SuppressWarnings("unchecked") protected Result<JsonNode> writeDataWithResult(final ObjectNode message, final ObjectMapper objectMapper) { Result<JsonNode> result; byte[] binaryResultMessage = null; String textResultMessage = null; // convert json into map try { if (ThreadBinary.isBinary()) { binaryResultMessage = database.sendWriteMessageWithResult(objectMapper.writeValueAsBytes(message)); } else { textResultMessage = database.sendWriteMessageWithResult(objectMapper.writeValueAsString(message)); } } catch (Exception e) { logger.error("[writeDataWithResult] could not read from database", e); return new Result<>(new Error(Error.NO_DATABASE_REPLY, ExceptionConverter.toString(e))); } try { if (ThreadBinary.isBinary()) { result = jsonObjectMapper.getObjectMapper().readValue(binaryResultMessage, Result.class); } else { result = jsonObjectMapper.getObjectMapper().readValue(textResultMessage, Result.class); } } catch (Exception e) { if (ThreadBinary.isBinary()) { logger.error("[writeDataWithResult] could not convert message to json: '{}'", binaryResultMessage, e); } else { logger.error("[writeDataWithResult] could not convert message to json: '{}'", textResultMessage, e); } return new Result<>(new Error(Error.MESSAGE_TO_JSON_FAILURE, ExceptionConverter.toString(e))); } return result; }
java
@SuppressWarnings("unchecked") protected Result<JsonNode> writeDataWithResult(final ObjectNode message, final ObjectMapper objectMapper) { Result<JsonNode> result; byte[] binaryResultMessage = null; String textResultMessage = null; // convert json into map try { if (ThreadBinary.isBinary()) { binaryResultMessage = database.sendWriteMessageWithResult(objectMapper.writeValueAsBytes(message)); } else { textResultMessage = database.sendWriteMessageWithResult(objectMapper.writeValueAsString(message)); } } catch (Exception e) { logger.error("[writeDataWithResult] could not read from database", e); return new Result<>(new Error(Error.NO_DATABASE_REPLY, ExceptionConverter.toString(e))); } try { if (ThreadBinary.isBinary()) { result = jsonObjectMapper.getObjectMapper().readValue(binaryResultMessage, Result.class); } else { result = jsonObjectMapper.getObjectMapper().readValue(textResultMessage, Result.class); } } catch (Exception e) { if (ThreadBinary.isBinary()) { logger.error("[writeDataWithResult] could not convert message to json: '{}'", binaryResultMessage, e); } else { logger.error("[writeDataWithResult] could not convert message to json: '{}'", textResultMessage, e); } return new Result<>(new Error(Error.MESSAGE_TO_JSON_FAILURE, ExceptionConverter.toString(e))); } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "Result", "<", "JsonNode", ">", "writeDataWithResult", "(", "final", "ObjectNode", "message", ",", "final", "ObjectMapper", "objectMapper", ")", "{", "Result", "<", "JsonNode", ">", "result", ";", ...
Sends a write message to a Neo4j cluster and returns the data server's answer. @param message service name, method name, language settingsa and method parameters in one json node @param objectMapper json object mapper used for serialization @return data server's answer
[ "Sends", "a", "write", "message", "to", "a", "Neo4j", "cluster", "and", "returns", "the", "data", "server", "s", "answer", "." ]
train
https://github.com/owetterau/neo4j-websockets/blob/ca3481066819d01169873aeb145ab3bf5c736afe/client/src/main/java/de/oliverwetterau/neo4j/websockets/client/DatabaseService.java#L221-L260
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getMapProperty
public String getMapProperty(String propertyName, String def) { if (props == null) return def; return props.getProperty(propertyName, def); }
java
public String getMapProperty(String propertyName, String def) { if (props == null) return def; return props.getProperty(propertyName, def); }
[ "public", "String", "getMapProperty", "(", "String", "propertyName", ",", "String", "def", ")", "{", "if", "(", "props", "==", "null", ")", "return", "def", ";", "return", "props", ".", "getProperty", "(", "propertyName", ",", "def", ")", ";", "}" ]
Get a property given to the map. Note that this method will not perform well and should not be used as part of the default code path in the game loop. @param propertyName The name of the property of the map to retrieve @param def The default value to return @return The value assigned to the property on the map (or the default value if none is supplied)
[ "Get", "a", "property", "given", "to", "the", "map", ".", "Note", "that", "this", "method", "will", "not", "perform", "well", "and", "should", "not", "be", "used", "as", "part", "of", "the", "default", "code", "path", "in", "the", "game", "loop", "." ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L293-L297
centic9/commons-dost
src/main/java/org/dstadler/commons/http/Utils.java
Utils.getURL
public static boolean getURL(final String sUrl, final AtomicInteger gCount, long start) { int count = gCount.incrementAndGet(); if(count % 100 == 0) { long diff = (System.currentTimeMillis() - start)/1000; logger.info("Count: " + count + " IPS: " + count/diff); } final URL url; try { url = new URL(sUrl); } catch (MalformedURLException e) { logger.info("URL-Failed(" + count + "): " + e.toString()); return false; } logger.log(Level.FINE, "Testing(" + count + "): " + url); final URLConnection con; try { con = url.openConnection(); con.setConnectTimeout(10000); con.setReadTimeout(10000); if(-1 == con.getInputStream().read()) { return false; } } catch (IOException e) { // don't print out time out as it is expected here if(Utils.isIgnorableException(e)) { return false; } logger.log(Level.WARNING, "Failed (" + url + ")(" + count + ")", e); return false; } //logger.info(con); // logger.info("Date : " + new Date(con.getDate())); logger.info("Last Modified (" + url + ")(" + count + "): " + new Date(con.getLastModified())); // logger.info( "Content encoding: " + con.getContentEncoding() // ); // logger.info( "Content type : " + con.getContentType() ); // logger.info( "Content length : " + con.getContentLength() ); return true; }
java
public static boolean getURL(final String sUrl, final AtomicInteger gCount, long start) { int count = gCount.incrementAndGet(); if(count % 100 == 0) { long diff = (System.currentTimeMillis() - start)/1000; logger.info("Count: " + count + " IPS: " + count/diff); } final URL url; try { url = new URL(sUrl); } catch (MalformedURLException e) { logger.info("URL-Failed(" + count + "): " + e.toString()); return false; } logger.log(Level.FINE, "Testing(" + count + "): " + url); final URLConnection con; try { con = url.openConnection(); con.setConnectTimeout(10000); con.setReadTimeout(10000); if(-1 == con.getInputStream().read()) { return false; } } catch (IOException e) { // don't print out time out as it is expected here if(Utils.isIgnorableException(e)) { return false; } logger.log(Level.WARNING, "Failed (" + url + ")(" + count + ")", e); return false; } //logger.info(con); // logger.info("Date : " + new Date(con.getDate())); logger.info("Last Modified (" + url + ")(" + count + "): " + new Date(con.getLastModified())); // logger.info( "Content encoding: " + con.getContentEncoding() // ); // logger.info( "Content type : " + con.getContentType() ); // logger.info( "Content length : " + con.getContentLength() ); return true; }
[ "public", "static", "boolean", "getURL", "(", "final", "String", "sUrl", ",", "final", "AtomicInteger", "gCount", ",", "long", "start", ")", "{", "int", "count", "=", "gCount", ".", "incrementAndGet", "(", ")", ";", "if", "(", "count", "%", "100", "==", ...
Test URL and report if it can be read. @param sUrl The URL to test @param gCount A counter which is incremented for each call and is used for reporting rate of calls @param start Start-timestamp for reporting rate of calls. @return true if the URL is valid and can be read, false if an error occurs when reading from it.
[ "Test", "URL", "and", "report", "if", "it", "can", "be", "read", "." ]
train
https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/http/Utils.java#L159-L202
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java
AbstractCodeGen.writeDefaultConstructor
void writeDefaultConstructor(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Default constructor\n"); writeWithIndent(out, indent, " */\n"); //constructor writeWithIndent(out, indent, "public " + getClassName(def) + "()"); writeLeftCurlyBracket(out, indent); writeRightCurlyBracket(out, indent); writeEol(out); }
java
void writeDefaultConstructor(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Default constructor\n"); writeWithIndent(out, indent, " */\n"); //constructor writeWithIndent(out, indent, "public " + getClassName(def) + "()"); writeLeftCurlyBracket(out, indent); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "void", "writeDefaultConstructor", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent",...
Output Default Constructor @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "Default", "Constructor" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java#L216-L227
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imageformat/DefaultImageFormatChecker.java
DefaultImageFormatChecker.isPngHeader
private static boolean isPngHeader(final byte[] imageHeaderBytes, final int headerSize) { return headerSize >= PNG_HEADER.length && ImageFormatCheckerUtils.startsWithPattern(imageHeaderBytes, PNG_HEADER); }
java
private static boolean isPngHeader(final byte[] imageHeaderBytes, final int headerSize) { return headerSize >= PNG_HEADER.length && ImageFormatCheckerUtils.startsWithPattern(imageHeaderBytes, PNG_HEADER); }
[ "private", "static", "boolean", "isPngHeader", "(", "final", "byte", "[", "]", "imageHeaderBytes", ",", "final", "int", "headerSize", ")", "{", "return", "headerSize", ">=", "PNG_HEADER", ".", "length", "&&", "ImageFormatCheckerUtils", ".", "startsWithPattern", "(...
Checks if array consisting of first headerSize bytes of imageHeaderBytes starts with png signature. More information on PNG can be found there: <a href="http://en.wikipedia.org/wiki/Portable_Network_Graphics"> http://en.wikipedia.org/wiki/Portable_Network_Graphics</a> @param imageHeaderBytes @param headerSize @return true if imageHeaderBytes starts with PNG_HEADER
[ "Checks", "if", "array", "consisting", "of", "first", "headerSize", "bytes", "of", "imageHeaderBytes", "starts", "with", "png", "signature", ".", "More", "information", "on", "PNG", "can", "be", "found", "there", ":", "<a", "href", "=", "http", ":", "//", ...
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageformat/DefaultImageFormatChecker.java#L169-L172
Azure/azure-sdk-for-java
eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/ConnectionStringBuilder.java
ConnectionStringBuilder.setEndpoint
public ConnectionStringBuilder setEndpoint(String namespaceName, String domainName) { try { this.endpoint = new URI(String.format(Locale.US, END_POINT_FORMAT, namespaceName, domainName)); } catch (URISyntaxException exception) { throw new IllegalConnectionStringFormatException( String.format(Locale.US, "Invalid namespace name: %s", namespaceName), exception); } return this; }
java
public ConnectionStringBuilder setEndpoint(String namespaceName, String domainName) { try { this.endpoint = new URI(String.format(Locale.US, END_POINT_FORMAT, namespaceName, domainName)); } catch (URISyntaxException exception) { throw new IllegalConnectionStringFormatException( String.format(Locale.US, "Invalid namespace name: %s", namespaceName), exception); } return this; }
[ "public", "ConnectionStringBuilder", "setEndpoint", "(", "String", "namespaceName", ",", "String", "domainName", ")", "{", "try", "{", "this", ".", "endpoint", "=", "new", "URI", "(", "String", ".", "format", "(", "Locale", ".", "US", ",", "END_POINT_FORMAT", ...
Set an endpoint which can be used to connect to the EventHub instance. @param namespaceName the name of the namespace to connect to. @param domainName identifies the domain the namespace is located in. For non-public and national clouds, the domain will not be "servicebus.windows.net". Available options include: - "servicebus.usgovcloudapi.net" - "servicebus.cloudapi.de" - "servicebus.chinacloudapi.cn" @return the {@link ConnectionStringBuilder} being set.
[ "Set", "an", "endpoint", "which", "can", "be", "used", "to", "connect", "to", "the", "EventHub", "instance", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/ConnectionStringBuilder.java#L138-L147
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/DatesHelper.java
DatesHelper.addDerivedDates
public void addDerivedDates(Map<String, Object> values) { Map<String, Object> valuesToAdd = new HashMap<String, Object>(); for (Map.Entry<String, Object> entry : values.entrySet()) { String key = entry.getKey(); Object object = entry.getValue(); if (object != null) { String stringValue = object.toString(); Matcher matcher = XML_DATE.matcher(stringValue); if (matcher.matches()) { handleXmlMatch(matcher, valuesToAdd, key); } else { matcher = NL_DATE.matcher(stringValue); if (matcher.matches()) { handleNLMatch(matcher, valuesToAdd, key); } } } } values.putAll(valuesToAdd); }
java
public void addDerivedDates(Map<String, Object> values) { Map<String, Object> valuesToAdd = new HashMap<String, Object>(); for (Map.Entry<String, Object> entry : values.entrySet()) { String key = entry.getKey(); Object object = entry.getValue(); if (object != null) { String stringValue = object.toString(); Matcher matcher = XML_DATE.matcher(stringValue); if (matcher.matches()) { handleXmlMatch(matcher, valuesToAdd, key); } else { matcher = NL_DATE.matcher(stringValue); if (matcher.matches()) { handleNLMatch(matcher, valuesToAdd, key); } } } } values.putAll(valuesToAdd); }
[ "public", "void", "addDerivedDates", "(", "Map", "<", "String", ",", "Object", ">", "values", ")", "{", "Map", "<", "String", ",", "Object", ">", "valuesToAdd", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "for", "(", "Map...
Adds derived values for dates in map. @param values values as provided.
[ "Adds", "derived", "values", "for", "dates", "in", "map", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/DatesHelper.java#L22-L42
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/PathMatchers.java
PathMatchers.getPathMatcher
public static PathMatcher getPathMatcher( String syntaxAndPattern, String separators, ImmutableSet<PathNormalization> normalizations) { int syntaxSeparator = syntaxAndPattern.indexOf(':'); checkArgument( syntaxSeparator > 0, "Must be of the form 'syntax:pattern': %s", syntaxAndPattern); String syntax = Ascii.toLowerCase(syntaxAndPattern.substring(0, syntaxSeparator)); String pattern = syntaxAndPattern.substring(syntaxSeparator + 1); switch (syntax) { case "glob": pattern = GlobToRegex.toRegex(pattern, separators); // fall through case "regex": return fromRegex(pattern, normalizations); default: throw new UnsupportedOperationException("Invalid syntax: " + syntaxAndPattern); } }
java
public static PathMatcher getPathMatcher( String syntaxAndPattern, String separators, ImmutableSet<PathNormalization> normalizations) { int syntaxSeparator = syntaxAndPattern.indexOf(':'); checkArgument( syntaxSeparator > 0, "Must be of the form 'syntax:pattern': %s", syntaxAndPattern); String syntax = Ascii.toLowerCase(syntaxAndPattern.substring(0, syntaxSeparator)); String pattern = syntaxAndPattern.substring(syntaxSeparator + 1); switch (syntax) { case "glob": pattern = GlobToRegex.toRegex(pattern, separators); // fall through case "regex": return fromRegex(pattern, normalizations); default: throw new UnsupportedOperationException("Invalid syntax: " + syntaxAndPattern); } }
[ "public", "static", "PathMatcher", "getPathMatcher", "(", "String", "syntaxAndPattern", ",", "String", "separators", ",", "ImmutableSet", "<", "PathNormalization", ">", "normalizations", ")", "{", "int", "syntaxSeparator", "=", "syntaxAndPattern", ".", "indexOf", "(",...
Perhaps so, assuming Path always canonicalizes its separators
[ "Perhaps", "so", "assuming", "Path", "always", "canonicalizes", "its", "separators" ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/PathMatchers.java#L49-L67
raydac/netbeans-mmd-plugin
mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/MindMapPanel.java
MindMapPanel.getSessionObject
@Nullable public <T> T getSessionObject(@Nonnull final String key, @Nonnull final Class<T> klazz, @Nullable final T def) { this.lock(); try { T result = klazz.cast(this.sessionObjects.get(key)); return result == null ? def : result; } finally { this.unlock(); } }
java
@Nullable public <T> T getSessionObject(@Nonnull final String key, @Nonnull final Class<T> klazz, @Nullable final T def) { this.lock(); try { T result = klazz.cast(this.sessionObjects.get(key)); return result == null ? def : result; } finally { this.unlock(); } }
[ "@", "Nullable", "public", "<", "T", ">", "T", "getSessionObject", "(", "@", "Nonnull", "final", "String", "key", ",", "@", "Nonnull", "final", "Class", "<", "T", ">", "klazz", ",", "@", "Nullable", "final", "T", "def", ")", "{", "this", ".", "lock",...
Get saved session object. Object is presented and saved only for the current panel and only in memory. @param <T> type of object @param key key of object, must not be null @param klazz object type, must not be null @param def default value will be returned as result if object not presented, can be null @return null if object is not found, the found object otherwise @throws ClassCastException if object type is wrong for saved object @since 1.4.2
[ "Get", "saved", "session", "object", ".", "Object", "is", "presented", "and", "saved", "only", "for", "the", "current", "panel", "and", "only", "in", "memory", "." ]
train
https://github.com/raydac/netbeans-mmd-plugin/blob/997493d23556a25354372b6419a64a0fbd0ac6ba/mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/MindMapPanel.java#L1264-L1273
deephacks/confit
provider-cached/src/main/java/org/deephacks/confit/internal/cached/proxy/ConfigReferenceHolder.java
ConfigReferenceHolder.getObjectReference
public Object getObjectReference(String field, String schemaName) { List<String> instanceIds = references.get(field); if(instanceIds == null || instanceIds.size() == 0) { return null; } String instanceId = instanceIds.get(0); if(instanceId == null) { return null; } BeanId id = BeanId.create(instanceId, schemaName); Object instance = instances.get(id); if(instance != null) { return instance; } instance = cache.get(id); instances.put(id, instance); return instance; }
java
public Object getObjectReference(String field, String schemaName) { List<String> instanceIds = references.get(field); if(instanceIds == null || instanceIds.size() == 0) { return null; } String instanceId = instanceIds.get(0); if(instanceId == null) { return null; } BeanId id = BeanId.create(instanceId, schemaName); Object instance = instances.get(id); if(instance != null) { return instance; } instance = cache.get(id); instances.put(id, instance); return instance; }
[ "public", "Object", "getObjectReference", "(", "String", "field", ",", "String", "schemaName", ")", "{", "List", "<", "String", ">", "instanceIds", "=", "references", ".", "get", "(", "field", ")", ";", "if", "(", "instanceIds", "==", "null", "||", "instan...
' Called by a proxy to lookup single object reference. The proxy knows the schema name so the hold does not need to bother storing it.
[ "Called", "by", "a", "proxy", "to", "lookup", "single", "object", "reference", ".", "The", "proxy", "knows", "the", "schema", "name", "so", "the", "hold", "does", "not", "need", "to", "bother", "storing", "it", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/provider-cached/src/main/java/org/deephacks/confit/internal/cached/proxy/ConfigReferenceHolder.java#L67-L84
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java
DiscreteDistributions.negativeBinomialCdf
public static double negativeBinomialCdf(int n, int r, double p) { if(n<0 || r<0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } n = Math.max(n,r); double probabilitySum = 0.0; for(int i=0;i<=r;++i) { probabilitySum += negativeBinomial(n, i, p); } return probabilitySum; }
java
public static double negativeBinomialCdf(int n, int r, double p) { if(n<0 || r<0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } n = Math.max(n,r); double probabilitySum = 0.0; for(int i=0;i<=r;++i) { probabilitySum += negativeBinomial(n, i, p); } return probabilitySum; }
[ "public", "static", "double", "negativeBinomialCdf", "(", "int", "n", ",", "int", "r", ",", "double", "p", ")", "{", "if", "(", "n", "<", "0", "||", "r", "<", "0", "||", "p", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A...
Returns the cumulative probability of negativeBinomial @param n @param r @param p @return
[ "Returns", "the", "cumulative", "probability", "of", "negativeBinomial" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java#L211-L223
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/VerificationCodeImage.java
VerificationCodeImage.output
public static void output(BufferedImage image, OutputStream out) throws IOException { ImageIO.write(image, "JPEG", out); }
java
public static void output(BufferedImage image, OutputStream out) throws IOException { ImageIO.write(image, "JPEG", out); }
[ "public", "static", "void", "output", "(", "BufferedImage", "image", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "ImageIO", ".", "write", "(", "image", ",", "\"JPEG\"", ",", "out", ")", ";", "}" ]
将指定的图片输出到指定位置 @param image 指定图片 @param out 输出位置 @throws IOException
[ "将指定的图片输出到指定位置" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/VerificationCodeImage.java#L325-L328
soarcn/COCOQuery
query/src/main/java/com/cocosw/query/AbstractViewQuery.java
AbstractViewQuery.getTypeface
private static Typeface getTypeface(final String name, final Context context) { Typeface typeface = TYPEFACES.get(name); if (typeface == null) { typeface = Typeface.createFromAsset(context.getAssets(), name); TYPEFACES.put(name, typeface); } return typeface; }
java
private static Typeface getTypeface(final String name, final Context context) { Typeface typeface = TYPEFACES.get(name); if (typeface == null) { typeface = Typeface.createFromAsset(context.getAssets(), name); TYPEFACES.put(name, typeface); } return typeface; }
[ "private", "static", "Typeface", "getTypeface", "(", "final", "String", "name", ",", "final", "Context", "context", ")", "{", "Typeface", "typeface", "=", "TYPEFACES", ".", "get", "(", "name", ")", ";", "if", "(", "typeface", "==", "null", ")", "{", "typ...
Get typeface with name @param name @param context @return typeface, either cached or loaded from the assets
[ "Get", "typeface", "with", "name" ]
train
https://github.com/soarcn/COCOQuery/blob/712eac37ab65ef3dbdf55dbfae28750edfc36608/query/src/main/java/com/cocosw/query/AbstractViewQuery.java#L1084-L1091
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/AbstractArrayFieldValidator.java
AbstractArrayFieldValidator.error
public void error(final ArrayCellField<E> cellField, final String messageKey) { error(cellField, messageKey, getMessageVariables(cellField)); }
java
public void error(final ArrayCellField<E> cellField, final String messageKey) { error(cellField, messageKey, getMessageVariables(cellField)); }
[ "public", "void", "error", "(", "final", "ArrayCellField", "<", "E", ">", "cellField", ",", "final", "String", "messageKey", ")", "{", "error", "(", "cellField", ",", "messageKey", ",", "getMessageVariables", "(", "cellField", ")", ")", ";", "}" ]
メッセージキーを指定して、エラー情報を追加します。 <p>エラーメッセージ中の変数は、{@link #getMessageVariables(ArrayCellField)}の値を使用します。</p> @param cellField フィールド情報 @param messageKey メッセージキー @throws IllegalArgumentException {@literal cellField == null or messageKey == null} @throws IllegalArgumentException {@literal messageKey.length() == 0}
[ "メッセージキーを指定して、エラー情報を追加します。", "<p", ">", "エラーメッセージ中の変数は、", "{" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/AbstractArrayFieldValidator.java#L102-L104
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.3/src/com/ibm/ws/microprofile/config13/sources/OSGiConfigUtils.java
OSGiConfigUtils.getApplicationName
public static String getApplicationName(BundleContext bundleContext) { String applicationName = null; if (FrameworkState.isValid()) { ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); if (cmd == null) { //if the component metadata is null then we're probably running in the CDI startup sequence so try asking CDI for the application applicationName = getCDIAppName(bundleContext); } else { applicationName = cmd.getJ2EEName().getApplication(); } if (applicationName == null) { if (cmd == null) { throw new ConfigStartException(Tr.formatMessage(tc, "no.application.name.CWMCG0201E")); } else { throw new ConfigException(Tr.formatMessage(tc, "no.application.name.CWMCG0201E")); } } } return applicationName; }
java
public static String getApplicationName(BundleContext bundleContext) { String applicationName = null; if (FrameworkState.isValid()) { ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); if (cmd == null) { //if the component metadata is null then we're probably running in the CDI startup sequence so try asking CDI for the application applicationName = getCDIAppName(bundleContext); } else { applicationName = cmd.getJ2EEName().getApplication(); } if (applicationName == null) { if (cmd == null) { throw new ConfigStartException(Tr.formatMessage(tc, "no.application.name.CWMCG0201E")); } else { throw new ConfigException(Tr.formatMessage(tc, "no.application.name.CWMCG0201E")); } } } return applicationName; }
[ "public", "static", "String", "getApplicationName", "(", "BundleContext", "bundleContext", ")", "{", "String", "applicationName", "=", "null", ";", "if", "(", "FrameworkState", ".", "isValid", "(", ")", ")", "{", "ComponentMetaData", "cmd", "=", "ComponentMetaData...
Get the j2ee name of the application. If the ComponentMetaData is available on the thread then that can be used, otherwise fallback to asking the CDIService for the name ... the CDI context ID is the same as the j2ee name. @param bundleContext The bundle context to use when looking up the CDIService @return the application name
[ "Get", "the", "j2ee", "name", "of", "the", "application", ".", "If", "the", "ComponentMetaData", "is", "available", "on", "the", "thread", "then", "that", "can", "be", "used", "otherwise", "fallback", "to", "asking", "the", "CDIService", "for", "the", "name"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.3/src/com/ibm/ws/microprofile/config13/sources/OSGiConfigUtils.java#L64-L86
paymill/paymill-java
src/main/java/com/paymill/services/TransactionService.java
TransactionService.createWithTokenAndFee
public Transaction createWithTokenAndFee( String token, Integer amount, String currency, String description, Fee fee ) { ValidationUtils.validatesToken( token ); ValidationUtils.validatesAmount( amount ); ValidationUtils.validatesCurrency( currency ); ValidationUtils.validatesFee( fee ); ParameterMap<String, String> params = new ParameterMap<String, String>(); params.add( "token", token ); params.add( "amount", String.valueOf( amount ) ); params.add( "currency", currency ); params.add( "source", String.format( "%s-%s", PaymillContext.getProjectName(), PaymillContext.getProjectVersion() ) ); if( StringUtils.isNotBlank( description ) ) params.add( "description", description ); if( fee != null && fee.getAmount() != null ) params.add( "fee_amount", String.valueOf( fee.getAmount() ) ); if( fee != null && StringUtils.isNotBlank( fee.getPayment() ) ) params.add( "fee_payment", fee.getPayment() ); return RestfulUtils.create( TransactionService.PATH, params, Transaction.class, super.httpClient ); }
java
public Transaction createWithTokenAndFee( String token, Integer amount, String currency, String description, Fee fee ) { ValidationUtils.validatesToken( token ); ValidationUtils.validatesAmount( amount ); ValidationUtils.validatesCurrency( currency ); ValidationUtils.validatesFee( fee ); ParameterMap<String, String> params = new ParameterMap<String, String>(); params.add( "token", token ); params.add( "amount", String.valueOf( amount ) ); params.add( "currency", currency ); params.add( "source", String.format( "%s-%s", PaymillContext.getProjectName(), PaymillContext.getProjectVersion() ) ); if( StringUtils.isNotBlank( description ) ) params.add( "description", description ); if( fee != null && fee.getAmount() != null ) params.add( "fee_amount", String.valueOf( fee.getAmount() ) ); if( fee != null && StringUtils.isNotBlank( fee.getPayment() ) ) params.add( "fee_payment", fee.getPayment() ); return RestfulUtils.create( TransactionService.PATH, params, Transaction.class, super.httpClient ); }
[ "public", "Transaction", "createWithTokenAndFee", "(", "String", "token", ",", "Integer", "amount", ",", "String", "currency", ",", "String", "description", ",", "Fee", "fee", ")", "{", "ValidationUtils", ".", "validatesToken", "(", "token", ")", ";", "Validatio...
Executes a {@link Transaction} with token for the given amount in the given currency. @param token Token generated by PAYMILL Bridge, which represents a credit card or direct debit. @param amount Amount (in cents) which will be charged. @param currency ISO 4217 formatted currency code. @param description A short description for the transaction. @param fee A {@link Fee}. @return {@link Transaction} object indicating whether a the call was successful or not.
[ "Executes", "a", "{" ]
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/TransactionService.java#L161-L181
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java
StreamingLocatorsInner.listPaths
public ListPathsResponseInner listPaths(String resourceGroupName, String accountName, String streamingLocatorName) { return listPathsWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).toBlocking().single().body(); }
java
public ListPathsResponseInner listPaths(String resourceGroupName, String accountName, String streamingLocatorName) { return listPathsWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).toBlocking().single().body(); }
[ "public", "ListPathsResponseInner", "listPaths", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "streamingLocatorName", ")", "{", "return", "listPathsWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "streamingLo...
List Paths. List Paths supported by this Streaming Locator. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param streamingLocatorName The Streaming Locator name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ListPathsResponseInner object if successful.
[ "List", "Paths", ".", "List", "Paths", "supported", "by", "this", "Streaming", "Locator", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java#L771-L773
airbnb/lottie-android
lottie/src/main/java/com/airbnb/lottie/parser/GradientColorParser.java
GradientColorParser.addOpacityStopsToGradientIfNeeded
private void addOpacityStopsToGradientIfNeeded(GradientColor gradientColor, List<Float> array) { int startIndex = colorPoints * 4; if (array.size() <= startIndex) { return; } int opacityStops = (array.size() - startIndex) / 2; double[] positions = new double[opacityStops]; double[] opacities = new double[opacityStops]; for (int i = startIndex, j = 0; i < array.size(); i++) { if (i % 2 == 0) { positions[j] = array.get(i); } else { opacities[j] = array.get(i); j++; } } for (int i = 0; i < gradientColor.getSize(); i++) { int color = gradientColor.getColors()[i]; color = Color.argb( getOpacityAtPosition(gradientColor.getPositions()[i], positions, opacities), Color.red(color), Color.green(color), Color.blue(color) ); gradientColor.getColors()[i] = color; } }
java
private void addOpacityStopsToGradientIfNeeded(GradientColor gradientColor, List<Float> array) { int startIndex = colorPoints * 4; if (array.size() <= startIndex) { return; } int opacityStops = (array.size() - startIndex) / 2; double[] positions = new double[opacityStops]; double[] opacities = new double[opacityStops]; for (int i = startIndex, j = 0; i < array.size(); i++) { if (i % 2 == 0) { positions[j] = array.get(i); } else { opacities[j] = array.get(i); j++; } } for (int i = 0; i < gradientColor.getSize(); i++) { int color = gradientColor.getColors()[i]; color = Color.argb( getOpacityAtPosition(gradientColor.getPositions()[i], positions, opacities), Color.red(color), Color.green(color), Color.blue(color) ); gradientColor.getColors()[i] = color; } }
[ "private", "void", "addOpacityStopsToGradientIfNeeded", "(", "GradientColor", "gradientColor", ",", "List", "<", "Float", ">", "array", ")", "{", "int", "startIndex", "=", "colorPoints", "*", "4", ";", "if", "(", "array", ".", "size", "(", ")", "<=", "startI...
This cheats a little bit. Opacity stops can be at arbitrary intervals independent of color stops. This uses the existing color stops and modifies the opacity at each existing color stop based on what the opacity would be. This should be a good approximation is nearly all cases. However, if there are many more opacity stops than color stops, information will be lost.
[ "This", "cheats", "a", "little", "bit", ".", "Opacity", "stops", "can", "be", "at", "arbitrary", "intervals", "independent", "of", "color", "stops", ".", "This", "uses", "the", "existing", "color", "stops", "and", "modifies", "the", "opacity", "at", "each", ...
train
https://github.com/airbnb/lottie-android/blob/126dabdc9f586c87822f85fe1128cdad439d30fa/lottie/src/main/java/com/airbnb/lottie/parser/GradientColorParser.java#L102-L131
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.resolveBundle
public void resolveBundle (String path, final ResultListener<FileResourceBundle> listener) { File bfile = getResourceFile(path); if (bfile == null) { String errmsg = "ResourceManager not configured with resource directory."; listener.requestFailed(new IOException(errmsg)); return; } final FileResourceBundle bundle = new FileResourceBundle(bfile, true, _unpack); if (bundle.isUnpacked()) { if (bundle.sourceIsReady()) { listener.requestCompleted(bundle); } else { String errmsg = "Bundle initialization failed."; listener.requestFailed(new IOException(errmsg)); } return; } // start a thread to unpack our bundles ArrayList<ResourceBundle> list = Lists.newArrayList(); list.add(bundle); Unpacker unpack = new Unpacker(list, new InitObserver() { public void progress (int percent, long remaining) { if (percent == 100) { listener.requestCompleted(bundle); } } public void initializationFailed (Exception e) { listener.requestFailed(e); } }); unpack.start(); }
java
public void resolveBundle (String path, final ResultListener<FileResourceBundle> listener) { File bfile = getResourceFile(path); if (bfile == null) { String errmsg = "ResourceManager not configured with resource directory."; listener.requestFailed(new IOException(errmsg)); return; } final FileResourceBundle bundle = new FileResourceBundle(bfile, true, _unpack); if (bundle.isUnpacked()) { if (bundle.sourceIsReady()) { listener.requestCompleted(bundle); } else { String errmsg = "Bundle initialization failed."; listener.requestFailed(new IOException(errmsg)); } return; } // start a thread to unpack our bundles ArrayList<ResourceBundle> list = Lists.newArrayList(); list.add(bundle); Unpacker unpack = new Unpacker(list, new InitObserver() { public void progress (int percent, long remaining) { if (percent == 100) { listener.requestCompleted(bundle); } } public void initializationFailed (Exception e) { listener.requestFailed(e); } }); unpack.start(); }
[ "public", "void", "resolveBundle", "(", "String", "path", ",", "final", "ResultListener", "<", "FileResourceBundle", ">", "listener", ")", "{", "File", "bfile", "=", "getResourceFile", "(", "path", ")", ";", "if", "(", "bfile", "==", "null", ")", "{", "Str...
Resolve the specified bundle (the bundle file must already exist in the appropriate place on the file system) and return it on the specified result listener. Note that the result listener may be notified before this method returns on the caller's thread if the bundle is already resolved, or it may be notified on a brand new thread if the bundle requires unpacking.
[ "Resolve", "the", "specified", "bundle", "(", "the", "bundle", "file", "must", "already", "exist", "in", "the", "appropriate", "place", "on", "the", "file", "system", ")", "and", "return", "it", "on", "the", "specified", "result", "listener", ".", "Note", ...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L471-L505
windup/windup
reporting/api/src/main/java/org/jboss/windup/reporting/service/TagSetService.java
TagSetService.getOrCreate
public TagSetModel getOrCreate(GraphRewrite event, Set<String> tags) { Map<Set<String>, Vertex> cache = getCache(event); Vertex vertex = cache.get(tags); if (vertex == null) { TagSetModel model = create(); model.setTags(tags); cache.put(tags, model.getElement()); return model; } else { return frame(vertex); } }
java
public TagSetModel getOrCreate(GraphRewrite event, Set<String> tags) { Map<Set<String>, Vertex> cache = getCache(event); Vertex vertex = cache.get(tags); if (vertex == null) { TagSetModel model = create(); model.setTags(tags); cache.put(tags, model.getElement()); return model; } else { return frame(vertex); } }
[ "public", "TagSetModel", "getOrCreate", "(", "GraphRewrite", "event", ",", "Set", "<", "String", ">", "tags", ")", "{", "Map", "<", "Set", "<", "String", ">", ",", "Vertex", ">", "cache", "=", "getCache", "(", "event", ")", ";", "Vertex", "vertex", "="...
This essentially ensures that we only store a single Vertex for each unique "Set" of tags.
[ "This", "essentially", "ensures", "that", "we", "only", "store", "a", "single", "Vertex", "for", "each", "unique", "Set", "of", "tags", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/TagSetService.java#L43-L58
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/util/ExtensionUtil.java
ExtensionUtil.instantiateClass
public static Object instantiateClass(Class clazz, Class assignableFrom) { if(clazz == null) throw new IllegalArgumentException(Bundle.getErrorString("DataGridUtil_CantCreateClass")); try { Object obj = clazz.newInstance(); if(assignableFrom == null || assignableFrom.isAssignableFrom(clazz)) return obj; else throw new DataGridExtensionException(Bundle.getErrorString("DataGridUtil_InvalidParentClass", new Object[]{clazz.getName(), assignableFrom})); } catch(Exception e) { assert e instanceof DataGridExtensionException || e instanceof IllegalAccessException || e instanceof InstantiationException || e instanceof ClassNotFoundException : "Caught exception of unexpected type " + e.getClass().getName(); String msg = Bundle.getErrorString("DataGridUtil_CantInstantiateClass", new Object[]{e}); LOGGER.error(msg, e); throw new DataGridExtensionException(msg, e); } }
java
public static Object instantiateClass(Class clazz, Class assignableFrom) { if(clazz == null) throw new IllegalArgumentException(Bundle.getErrorString("DataGridUtil_CantCreateClass")); try { Object obj = clazz.newInstance(); if(assignableFrom == null || assignableFrom.isAssignableFrom(clazz)) return obj; else throw new DataGridExtensionException(Bundle.getErrorString("DataGridUtil_InvalidParentClass", new Object[]{clazz.getName(), assignableFrom})); } catch(Exception e) { assert e instanceof DataGridExtensionException || e instanceof IllegalAccessException || e instanceof InstantiationException || e instanceof ClassNotFoundException : "Caught exception of unexpected type " + e.getClass().getName(); String msg = Bundle.getErrorString("DataGridUtil_CantInstantiateClass", new Object[]{e}); LOGGER.error(msg, e); throw new DataGridExtensionException(msg, e); } }
[ "public", "static", "Object", "instantiateClass", "(", "Class", "clazz", ",", "Class", "assignableFrom", ")", "{", "if", "(", "clazz", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "Bundle", ".", "getErrorString", "(", "\"DataGridUtil_CantCre...
Utility method that helps instantiate a class used to extend the data grid. @param clazz the name of a class to instantiate @param assignableFrom the type that should be assignable from an instance of type <code>className</code> @return an instance of the given class @throws org.apache.beehive.netui.databinding.datagrid.api.exceptions.DataGridExtensionException when an error occurs creating an instance of the class
[ "Utility", "method", "that", "helps", "instantiate", "a", "class", "used", "to", "extend", "the", "data", "grid", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/util/ExtensionUtil.java#L74-L97
CubeEngine/Dirigent
src/main/java/org/cubeengine/dirigent/context/Arguments.java
Arguments.getOrElse
public String getOrElse(int i, String def) { if (i >= 0 && i < values.size()) { return values.get(i); } return def; }
java
public String getOrElse(int i, String def) { if (i >= 0 && i < values.size()) { return values.get(i); } return def; }
[ "public", "String", "getOrElse", "(", "int", "i", ",", "String", "def", ")", "{", "if", "(", "i", ">=", "0", "&&", "i", "<", "values", ".", "size", "(", ")", ")", "{", "return", "values", ".", "get", "(", "i", ")", ";", "}", "return", "def", ...
Returns the unnamed value at a position or the default if the position is not within bounds. @param i the position @param def the default value @return the value of the Argument by name
[ "Returns", "the", "unnamed", "value", "at", "a", "position", "or", "the", "default", "if", "the", "position", "is", "not", "within", "bounds", "." ]
train
https://github.com/CubeEngine/Dirigent/blob/68587a8202754a6a6b629cc15e14c516806badaa/src/main/java/org/cubeengine/dirigent/context/Arguments.java#L118-L125
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/io/DOMHandle.java
DOMHandle.evaluateXPath
public <T> T evaluateXPath(String xpathExpression, Class<T> as) throws XPathExpressionException { return evaluateXPath(xpathExpression, get(), as); }
java
public <T> T evaluateXPath(String xpathExpression, Class<T> as) throws XPathExpressionException { return evaluateXPath(xpathExpression, get(), as); }
[ "public", "<", "T", ">", "T", "evaluateXPath", "(", "String", "xpathExpression", ",", "Class", "<", "T", ">", "as", ")", "throws", "XPathExpressionException", "{", "return", "evaluateXPath", "(", "xpathExpression", ",", "get", "(", ")", ",", "as", ")", ";"...
Evaluate a string XPath expression against the retrieved document. An XPath expression can return a Node or subinterface such as Element or Text, a NodeList, or a Boolean, Number, or String value. @param xpathExpression the XPath expression as a string @param as the type expected to be matched by the xpath @param <T> the type to return @return the value produced by the XPath expression @throws XPathExpressionException if xpathExpression cannot be evaluated
[ "Evaluate", "a", "string", "XPath", "expression", "against", "the", "retrieved", "document", ".", "An", "XPath", "expression", "can", "return", "a", "Node", "or", "subinterface", "such", "as", "Element", "or", "Text", "a", "NodeList", "or", "a", "Boolean", "...
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/io/DOMHandle.java#L272-L275
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/train/TrainModule.java
TrainModule.sessionNotFound
private Result sessionNotFound(String sessionId, String targetPath) { if (sessionLoader != null && sessionLoader.apply(sessionId)) { if (targetPath != null) { return temporaryRedirect("./" + targetPath); } else { return ok(); } } else { return notFound("Unknown session ID: " + sessionId); } }
java
private Result sessionNotFound(String sessionId, String targetPath) { if (sessionLoader != null && sessionLoader.apply(sessionId)) { if (targetPath != null) { return temporaryRedirect("./" + targetPath); } else { return ok(); } } else { return notFound("Unknown session ID: " + sessionId); } }
[ "private", "Result", "sessionNotFound", "(", "String", "sessionId", ",", "String", "targetPath", ")", "{", "if", "(", "sessionLoader", "!=", "null", "&&", "sessionLoader", ".", "apply", "(", "sessionId", ")", ")", "{", "if", "(", "targetPath", "!=", "null", ...
Load StatsStorage via provider, or return "not found" @param sessionId session ID to look fo with provider @param targetPath one of overview / model / system, or null @return temporaryRedirect, ok, or notFound
[ "Load", "StatsStorage", "via", "provider", "or", "return", "not", "found" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/train/TrainModule.java#L237-L248
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java
ComponentCollision.removePoints
private void removePoints(int minX, int minY, int maxX, int maxY, Collidable collidable) { removePoint(new Point(minX, minY), collidable); if (minX != maxX && minY == maxY) { removePoint(new Point(maxX, minY), collidable); } else if (minX == maxX && minY != maxY) { removePoint(new Point(minX, maxY), collidable); } else if (minX != maxX) { removePoint(new Point(minX, maxY), collidable); removePoint(new Point(maxX, minY), collidable); removePoint(new Point(maxX, maxY), collidable); } }
java
private void removePoints(int minX, int minY, int maxX, int maxY, Collidable collidable) { removePoint(new Point(minX, minY), collidable); if (minX != maxX && minY == maxY) { removePoint(new Point(maxX, minY), collidable); } else if (minX == maxX && minY != maxY) { removePoint(new Point(minX, maxY), collidable); } else if (minX != maxX) { removePoint(new Point(minX, maxY), collidable); removePoint(new Point(maxX, minY), collidable); removePoint(new Point(maxX, maxY), collidable); } }
[ "private", "void", "removePoints", "(", "int", "minX", ",", "int", "minY", ",", "int", "maxX", ",", "int", "maxY", ",", "Collidable", "collidable", ")", "{", "removePoint", "(", "new", "Point", "(", "minX", ",", "minY", ")", ",", "collidable", ")", ";"...
Remove point and adjacent points depending of the collidable max collision size. @param minX The min horizontal location. @param minY The min vertical location. @param maxX The min horizontal location. @param maxY The min vertical location. @param collidable The collidable reference.
[ "Remove", "point", "and", "adjacent", "points", "depending", "of", "the", "collidable", "max", "collision", "size", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java#L303-L321
haraldk/TwelveMonkeys
imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/util/IIOUtil.java
IIOUtil.deregisterProvider
public static <T> void deregisterProvider(final ServiceRegistry registry, final IIOServiceProvider provider, final Class<T> category) { // http://www.ibm.com/developerworks/java/library/j-jtp04298.html registry.deregisterServiceProvider(category.cast(provider), category); }
java
public static <T> void deregisterProvider(final ServiceRegistry registry, final IIOServiceProvider provider, final Class<T> category) { // http://www.ibm.com/developerworks/java/library/j-jtp04298.html registry.deregisterServiceProvider(category.cast(provider), category); }
[ "public", "static", "<", "T", ">", "void", "deregisterProvider", "(", "final", "ServiceRegistry", "registry", ",", "final", "IIOServiceProvider", "provider", ",", "final", "Class", "<", "T", ">", "category", ")", "{", "// http://www.ibm.com/developerworks/java/library...
THIS METHOD WILL ME MOVED/RENAMED, DO NOT USE. @param registry the registry to unregister from. @param provider the provider to unregister. @param category the category to unregister from.
[ "THIS", "METHOD", "WILL", "ME", "MOVED", "/", "RENAMED", "DO", "NOT", "USE", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/util/IIOUtil.java#L166-L169
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/parser/PipelineRuleParser.java
PipelineRuleParser.parseRule
public Rule parseRule(String id, String rule, boolean silent, PipelineClassloader ruleClassLoader) throws ParseException { final ParseContext parseContext = new ParseContext(silent); final SyntaxErrorListener errorListener = new SyntaxErrorListener(parseContext); final RuleLangLexer lexer = new RuleLangLexer(new ANTLRInputStream(rule)); lexer.removeErrorListeners(); lexer.addErrorListener(errorListener); final RuleLangParser parser = new RuleLangParser(new CommonTokenStream(lexer)); parser.setErrorHandler(new DefaultErrorStrategy()); parser.removeErrorListeners(); parser.addErrorListener(errorListener); final RuleLangParser.RuleDeclarationContext ruleDeclaration = parser.ruleDeclaration(); // parsing stages: // 1. build AST nodes, checks for invalid var, function refs // 2. type annotator: infer type information from var refs, func refs // 3. checker: static type check w/ coercion nodes // 4. optimizer: TODO WALKER.walk(new RuleAstBuilder(parseContext), ruleDeclaration); WALKER.walk(new RuleTypeAnnotator(parseContext), ruleDeclaration); WALKER.walk(new RuleTypeChecker(parseContext), ruleDeclaration); if (parseContext.getErrors().isEmpty()) { Rule parsedRule = parseContext.getRules().get(0).withId(id); if (ruleClassLoader != null && ConfigurationStateUpdater.isAllowCodeGeneration()) { try { final Class<? extends GeneratedRule> generatedClass = codeGenerator.generateCompiledRule(parsedRule, ruleClassLoader); if (generatedClass != null) { parsedRule = parsedRule.toBuilder().generatedRuleClass(generatedClass).build(); } } catch (Exception e) { log.warn("Unable to compile rule {} to native code, falling back to interpreting it: {}", parsedRule.name(), e.getMessage()); } } return parsedRule; } throw new ParseException(parseContext.getErrors()); }
java
public Rule parseRule(String id, String rule, boolean silent, PipelineClassloader ruleClassLoader) throws ParseException { final ParseContext parseContext = new ParseContext(silent); final SyntaxErrorListener errorListener = new SyntaxErrorListener(parseContext); final RuleLangLexer lexer = new RuleLangLexer(new ANTLRInputStream(rule)); lexer.removeErrorListeners(); lexer.addErrorListener(errorListener); final RuleLangParser parser = new RuleLangParser(new CommonTokenStream(lexer)); parser.setErrorHandler(new DefaultErrorStrategy()); parser.removeErrorListeners(); parser.addErrorListener(errorListener); final RuleLangParser.RuleDeclarationContext ruleDeclaration = parser.ruleDeclaration(); // parsing stages: // 1. build AST nodes, checks for invalid var, function refs // 2. type annotator: infer type information from var refs, func refs // 3. checker: static type check w/ coercion nodes // 4. optimizer: TODO WALKER.walk(new RuleAstBuilder(parseContext), ruleDeclaration); WALKER.walk(new RuleTypeAnnotator(parseContext), ruleDeclaration); WALKER.walk(new RuleTypeChecker(parseContext), ruleDeclaration); if (parseContext.getErrors().isEmpty()) { Rule parsedRule = parseContext.getRules().get(0).withId(id); if (ruleClassLoader != null && ConfigurationStateUpdater.isAllowCodeGeneration()) { try { final Class<? extends GeneratedRule> generatedClass = codeGenerator.generateCompiledRule(parsedRule, ruleClassLoader); if (generatedClass != null) { parsedRule = parsedRule.toBuilder().generatedRuleClass(generatedClass).build(); } } catch (Exception e) { log.warn("Unable to compile rule {} to native code, falling back to interpreting it: {}", parsedRule.name(), e.getMessage()); } } return parsedRule; } throw new ParseException(parseContext.getErrors()); }
[ "public", "Rule", "parseRule", "(", "String", "id", ",", "String", "rule", ",", "boolean", "silent", ",", "PipelineClassloader", "ruleClassLoader", ")", "throws", "ParseException", "{", "final", "ParseContext", "parseContext", "=", "new", "ParseContext", "(", "sil...
Parses the given rule source and optionally generates a Java class for it if the classloader is not null. @param id the id of the rule, necessary to generate code @param rule rule source code @param silent don't emit status messages during parsing @param ruleClassLoader the classloader to load the generated code into (can be null) @return the parse rule @throws ParseException if a one or more parse errors occur
[ "Parses", "the", "given", "rule", "source", "and", "optionally", "generates", "a", "Java", "class", "for", "it", "if", "the", "classloader", "is", "not", "null", "." ]
train
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/parser/PipelineRuleParser.java#L147-L188
cdk/cdk
tool/charges/src/main/java/org/openscience/cdk/charges/GasteigerPEPEPartialCharges.java
GasteigerPEPEPartialCharges.setFlags
private IAtomContainer setFlags(IAtomContainer container, IAtomContainer ac, boolean b) { for (Iterator<IAtom> it = container.atoms().iterator(); it.hasNext();) { int positionA = ac.indexOf(it.next()); ac.getAtom(positionA).setFlag(CDKConstants.REACTIVE_CENTER, b); } for (Iterator<IBond> it = container.bonds().iterator(); it.hasNext();) { int positionB = ac.indexOf(it.next()); ac.getBond(positionB).setFlag(CDKConstants.REACTIVE_CENTER, b); } return ac; }
java
private IAtomContainer setFlags(IAtomContainer container, IAtomContainer ac, boolean b) { for (Iterator<IAtom> it = container.atoms().iterator(); it.hasNext();) { int positionA = ac.indexOf(it.next()); ac.getAtom(positionA).setFlag(CDKConstants.REACTIVE_CENTER, b); } for (Iterator<IBond> it = container.bonds().iterator(); it.hasNext();) { int positionB = ac.indexOf(it.next()); ac.getBond(positionB).setFlag(CDKConstants.REACTIVE_CENTER, b); } return ac; }
[ "private", "IAtomContainer", "setFlags", "(", "IAtomContainer", "container", ",", "IAtomContainer", "ac", ",", "boolean", "b", ")", "{", "for", "(", "Iterator", "<", "IAtom", ">", "it", "=", "container", ".", "atoms", "(", ")", ".", "iterator", "(", ")", ...
Set the Flags to atoms and bonds from an atomContainer. @param container Container with the flags @param ac Container to put the flags @param b True, if the the flag is true @return Container with added flags
[ "Set", "the", "Flags", "to", "atoms", "and", "bonds", "from", "an", "atomContainer", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/charges/src/main/java/org/openscience/cdk/charges/GasteigerPEPEPartialCharges.java#L475-L486
jcuda/jcurand
JCurandJava/src/main/java/jcuda/jcurand/JCurand.java
JCurand.curandGenerateNormal
public static int curandGenerateNormal(curandGenerator generator, Pointer outputPtr, long n, float mean, float stddev) { return checkResult(curandGenerateNormalNative(generator, outputPtr, n, mean, stddev)); }
java
public static int curandGenerateNormal(curandGenerator generator, Pointer outputPtr, long n, float mean, float stddev) { return checkResult(curandGenerateNormalNative(generator, outputPtr, n, mean, stddev)); }
[ "public", "static", "int", "curandGenerateNormal", "(", "curandGenerator", "generator", ",", "Pointer", "outputPtr", ",", "long", "n", ",", "float", "mean", ",", "float", "stddev", ")", "{", "return", "checkResult", "(", "curandGenerateNormalNative", "(", "generat...
<pre> Generate normally distributed floats. Use generator to generate num float results into the device memory at outputPtr. The device memory must have been previously allocated and be large enough to hold all the results. Launches are done with the stream set using ::curandSetStream(), or the null stream if no stream has been set. Results are 32-bit floating point values with mean mean and standard deviation stddev. Normally distributed results are generated from pseudorandom generators with a Box-Muller transform, and so require num to be even. Quasirandom generators use an inverse cumulative distribution function to preserve dimensionality. There may be slight numerical differences between results generated on the GPU with generators created with ::curandCreateGenerator() and results calculated on the CPU with generators created with ::curandCreateGeneratorHost(). These differences arise because of differences in results for transcendental functions. In addition, future versions of CURAND may use newer versions of the CUDA math library, so different versions of CURAND may give slightly different numerical values. @param generator - Generator to use @param outputPtr - Pointer to device memory to store CUDA-generated results, or Pointer to host memory to store CPU-generated results @param n - Number of floats to generate @param mean - Mean of normal distribution @param stddev - Standard deviation of normal distribution @return CURAND_STATUS_NOT_INITIALIZED if the generator was never created CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from a previous kernel launch CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is not a multiple of the quasirandom dimension, or is not a multiple of two for pseudorandom generators CURAND_STATUS_SUCCESS if the results were generated successfully </pre>
[ "<pre", ">", "Generate", "normally", "distributed", "floats", "." ]
train
https://github.com/jcuda/jcurand/blob/0f463d2bb72cd93b3988f7ce148cdb6069ba4fd9/JCurandJava/src/main/java/jcuda/jcurand/JCurand.java#L680-L683
alkacon/opencms-core
src/org/opencms/ui/dataview/CmsPagingControls.java
CmsPagingControls.setPage
public void setPage(int page, boolean fireChanged) { m_page = page; m_label.setValue("( " + (1 + m_page) + " / " + (m_lastPage + 1) + " )"); int start = (m_page * m_pageSize) + 1; int end = Math.min((start + m_pageSize) - 1, m_resultCount); String resultsMsg = CmsVaadinUtils.getMessageText( Messages.GUI_DATAVIEW_RESULTS_3, "" + start, "" + end, "" + m_resultCount); m_resultsLabel.setValue(start <= end ? resultsMsg : ""); if (fireChanged) { firePageChanged(page); } }
java
public void setPage(int page, boolean fireChanged) { m_page = page; m_label.setValue("( " + (1 + m_page) + " / " + (m_lastPage + 1) + " )"); int start = (m_page * m_pageSize) + 1; int end = Math.min((start + m_pageSize) - 1, m_resultCount); String resultsMsg = CmsVaadinUtils.getMessageText( Messages.GUI_DATAVIEW_RESULTS_3, "" + start, "" + end, "" + m_resultCount); m_resultsLabel.setValue(start <= end ? resultsMsg : ""); if (fireChanged) { firePageChanged(page); } }
[ "public", "void", "setPage", "(", "int", "page", ",", "boolean", "fireChanged", ")", "{", "m_page", "=", "page", ";", "m_label", ".", "setValue", "(", "\"( \"", "+", "(", "1", "+", "m_page", ")", "+", "\" / \"", "+", "(", "m_lastPage", "+", "1", ")",...
Sets the page index.<p> @param page the page index @param fireChanged true if the registered listeners should be notified
[ "Sets", "the", "page", "index", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dataview/CmsPagingControls.java#L233-L248
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/proxy/ProxyHandler.java
ProxyHandler.addRequestHeader
@Deprecated public ProxyHandler addRequestHeader(final HttpString header, final String value) { requestHeaders.put(header, ExchangeAttributes.constant(value)); return this; }
java
@Deprecated public ProxyHandler addRequestHeader(final HttpString header, final String value) { requestHeaders.put(header, ExchangeAttributes.constant(value)); return this; }
[ "@", "Deprecated", "public", "ProxyHandler", "addRequestHeader", "(", "final", "HttpString", "header", ",", "final", "String", "value", ")", "{", "requestHeaders", ".", "put", "(", "header", ",", "ExchangeAttributes", ".", "constant", "(", "value", ")", ")", "...
Adds a request header to the outgoing request. If the header resolves to null or an empty string it will not be added, however any existing header with the same name will be removed. @param header The header name @param value The header value attribute. @return this
[ "Adds", "a", "request", "header", "to", "the", "outgoing", "request", ".", "If", "the", "header", "resolves", "to", "null", "or", "an", "empty", "string", "it", "will", "not", "be", "added", "however", "any", "existing", "header", "with", "the", "same", ...
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/ProxyHandler.java#L237-L241
jayantk/jklol
src/com/jayantkrish/jklol/models/dynamic/DynamicVariableSet.java
DynamicVariableSet.fromVariables
public static DynamicVariableSet fromVariables(VariableNumMap variables) { return new DynamicVariableSet(variables, Collections.<String> emptyList(), Collections.<DynamicVariableSet> emptyList(), new int[0]); }
java
public static DynamicVariableSet fromVariables(VariableNumMap variables) { return new DynamicVariableSet(variables, Collections.<String> emptyList(), Collections.<DynamicVariableSet> emptyList(), new int[0]); }
[ "public", "static", "DynamicVariableSet", "fromVariables", "(", "VariableNumMap", "variables", ")", "{", "return", "new", "DynamicVariableSet", "(", "variables", ",", "Collections", ".", "<", "String", ">", "emptyList", "(", ")", ",", "Collections", ".", "<", "D...
Creates a {@code DynamicVariableSet} containing {@code variables} and no plates. @param variables @return
[ "Creates", "a", "{", "@code", "DynamicVariableSet", "}", "containing", "{", "@code", "variables", "}", "and", "no", "plates", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/dynamic/DynamicVariableSet.java#L63-L66
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupEnginesInner.java
BackupEnginesInner.get
public BackupEngineBaseResourceInner get(String vaultName, String resourceGroupName, String backupEngineName) { return getWithServiceResponseAsync(vaultName, resourceGroupName, backupEngineName).toBlocking().single().body(); }
java
public BackupEngineBaseResourceInner get(String vaultName, String resourceGroupName, String backupEngineName) { return getWithServiceResponseAsync(vaultName, resourceGroupName, backupEngineName).toBlocking().single().body(); }
[ "public", "BackupEngineBaseResourceInner", "get", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "backupEngineName", ")", "{", "return", "getWithServiceResponseAsync", "(", "vaultName", ",", "resourceGroupName", ",", "backupEngineName", ")"...
Returns backup management server registered to Recovery Services Vault. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param backupEngineName Name of the backup management server. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the BackupEngineBaseResourceInner object if successful.
[ "Returns", "backup", "management", "server", "registered", "to", "Recovery", "Services", "Vault", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupEnginesInner.java#L332-L334
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/socks/Proxy.java
Proxy.setDefaultProxy
public static void setDefaultProxy(InetAddress ipAddress,int port, String user){ defaultProxy = new Socks4Proxy(ipAddress,port,user); }
java
public static void setDefaultProxy(InetAddress ipAddress,int port, String user){ defaultProxy = new Socks4Proxy(ipAddress,port,user); }
[ "public", "static", "void", "setDefaultProxy", "(", "InetAddress", "ipAddress", ",", "int", "port", ",", "String", "user", ")", "{", "defaultProxy", "=", "new", "Socks4Proxy", "(", "ipAddress", ",", "port", ",", "user", ")", ";", "}" ]
Sets SOCKS4 proxy as default. @param ipAddress Host address on which SOCKS4 server is running. @param port Port on which SOCKS4 server is running. @param user Username to use for communications with proxy.
[ "Sets", "SOCKS4", "proxy", "as", "default", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/Proxy.java#L216-L219
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/ObjectGraphNode.java
ObjectGraphNode.getSize
private int getSize(final String fieldType, final Object fieldValue) { Integer fieldSize = SIMPLE_SIZES.get(fieldType); if (fieldSize != null) { if (PRIMITIVE_TYPES.contains(fieldType)) { return fieldSize; } return OBJREF_SIZE + fieldSize; } else if (fieldValue instanceof String) { return (OBJREF_SIZE + OBJECT_SHELL_SIZE) * 2 // One for the String Object itself, and one for the char[] value + INT_FIELD_SIZE * 3 // offset, count, hash + ((String) fieldValue).length() * CHAR_FIELD_SIZE; } else if (fieldValue != null) { return OBJECT_SHELL_SIZE + OBJREF_SIZE; // plus the size of any nested nodes. } else { // Null return OBJREF_SIZE; } }
java
private int getSize(final String fieldType, final Object fieldValue) { Integer fieldSize = SIMPLE_SIZES.get(fieldType); if (fieldSize != null) { if (PRIMITIVE_TYPES.contains(fieldType)) { return fieldSize; } return OBJREF_SIZE + fieldSize; } else if (fieldValue instanceof String) { return (OBJREF_SIZE + OBJECT_SHELL_SIZE) * 2 // One for the String Object itself, and one for the char[] value + INT_FIELD_SIZE * 3 // offset, count, hash + ((String) fieldValue).length() * CHAR_FIELD_SIZE; } else if (fieldValue != null) { return OBJECT_SHELL_SIZE + OBJREF_SIZE; // plus the size of any nested nodes. } else { // Null return OBJREF_SIZE; } }
[ "private", "int", "getSize", "(", "final", "String", "fieldType", ",", "final", "Object", "fieldValue", ")", "{", "Integer", "fieldSize", "=", "SIMPLE_SIZES", ".", "get", "(", "fieldType", ")", ";", "if", "(", "fieldSize", "!=", "null", ")", "{", "if", "...
Calculates the size of a field value obtained using the reflection API. @param fieldType the Field's type (class), needed to return the correct values for primitives. @param fieldValue the field's value (primitives are boxed). @return an approximation of amount of memory the field occupies, in bytes.
[ "Calculates", "the", "size", "of", "a", "field", "value", "obtained", "using", "the", "reflection", "API", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/ObjectGraphNode.java#L177-L195
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/Session.java
Session.addDeleteAction
void addDeleteAction(Table table, Row row) { // tempActionHistory.add("add delete action " + actionTimestamp); if (abortTransaction) { // throw Error.error(ErrorCode.X_40001); } database.txManager.addDeleteAction(this, table, row); }
java
void addDeleteAction(Table table, Row row) { // tempActionHistory.add("add delete action " + actionTimestamp); if (abortTransaction) { // throw Error.error(ErrorCode.X_40001); } database.txManager.addDeleteAction(this, table, row); }
[ "void", "addDeleteAction", "(", "Table", "table", ",", "Row", "row", ")", "{", "// tempActionHistory.add(\"add delete action \" + actionTimestamp);", "if", "(", "abortTransaction", ")", "{", "// throw Error.error(ErrorCode.X_40001);", "}", "database", ".", "...
Adds a delete action to the row and the transaction manager. @param table the table of the row @param row the deleted row @throws HsqlException
[ "Adds", "a", "delete", "action", "to", "the", "row", "and", "the", "transaction", "manager", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Session.java#L444-L453
apache/groovy
src/main/java/org/apache/groovy/util/SystemUtil.java
SystemUtil.getSystemPropertySafe
public static String getSystemPropertySafe(String name, String defaultValue) { try { return System.getProperty(name, defaultValue); } catch (SecurityException | NullPointerException | IllegalArgumentException ignore) { // suppress exception } return defaultValue; }
java
public static String getSystemPropertySafe(String name, String defaultValue) { try { return System.getProperty(name, defaultValue); } catch (SecurityException | NullPointerException | IllegalArgumentException ignore) { // suppress exception } return defaultValue; }
[ "public", "static", "String", "getSystemPropertySafe", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "try", "{", "return", "System", ".", "getProperty", "(", "name", ",", "defaultValue", ")", ";", "}", "catch", "(", "SecurityException", "|", ...
Retrieves a System property, or returns some default value if: <ul> <li>the property isn't found</li> <li>the property name is null or empty</li> <li>if a security manager exists and its checkPropertyAccess method doesn't allow access to the specified system property.</li> </ul> @param name the name of the system property. @param defaultValue a default value. @return value of the system property or the default value
[ "Retrieves", "a", "System", "property", "or", "returns", "some", "default", "value", "if", ":", "<ul", ">", "<li", ">", "the", "property", "isn", "t", "found<", "/", "li", ">", "<li", ">", "the", "property", "name", "is", "null", "or", "empty<", "/", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/util/SystemUtil.java#L79-L86
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java
DPathUtils.setValue
public static void setValue(JsonNode node, String dPath, Object value) { setValue(node, dPath, value, false); }
java
public static void setValue(JsonNode node, String dPath, Object value) { setValue(node, dPath, value, false); }
[ "public", "static", "void", "setValue", "(", "JsonNode", "node", ",", "String", "dPath", ",", "Object", "value", ")", "{", "setValue", "(", "node", ",", "dPath", ",", "value", ",", "false", ")", ";", "}" ]
Set a value to the target {@link JsonNode} specified by DPath expression. <p> Note: intermediated nodes will NOT be created. </p> <p> Note: if {@code value} is {@code null}: <ul> <li>If the specified item's parent is an {@link ArrayNode}, the item (specified by {@code dPath}) will be set to {@code null}.</li> <li>If the specified item's parent is an {@link ObjectNode}, the item (specified by {@code dPath}) will be removed.</li> </ul> </p> @param node @param dPath @param value @since 0.6.2
[ "Set", "a", "value", "to", "the", "target", "{", "@link", "JsonNode", "}", "specified", "by", "DPath", "expression", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java#L829-L831
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java
DataContextUtils.replaceDataReferencesInArray
public static String[] replaceDataReferencesInArray(final String[] args, final Map<String, Map<String, String>> data, Converter<String, String> converter, boolean failIfUnexpanded) { return replaceDataReferencesInArray(args, data, converter, failIfUnexpanded, false); }
java
public static String[] replaceDataReferencesInArray(final String[] args, final Map<String, Map<String, String>> data, Converter<String, String> converter, boolean failIfUnexpanded) { return replaceDataReferencesInArray(args, data, converter, failIfUnexpanded, false); }
[ "public", "static", "String", "[", "]", "replaceDataReferencesInArray", "(", "final", "String", "[", "]", "args", ",", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "data", ",", "Converter", "<", "String", ",", "Strin...
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data context @param args argument string array @param data data context @param converter converter @param failIfUnexpanded true to fail if property is not found @return string array with replaced embedded properties
[ "Replace", "the", "embedded", "properties", "of", "the", "form", "$", "{", "key", ".", "name", "}", "in", "the", "input", "Strings", "with", "the", "value", "from", "the", "data", "context" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java#L338-L340
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/checksum/ChecksumExtensions.java
ChecksumExtensions.getChecksum
public static String getChecksum(final Byte[] bytes, final Algorithm algorithm) throws NoSuchAlgorithmException { return getChecksum(bytes, algorithm.getAlgorithm()); }
java
public static String getChecksum(final Byte[] bytes, final Algorithm algorithm) throws NoSuchAlgorithmException { return getChecksum(bytes, algorithm.getAlgorithm()); }
[ "public", "static", "String", "getChecksum", "(", "final", "Byte", "[", "]", "bytes", ",", "final", "Algorithm", "algorithm", ")", "throws", "NoSuchAlgorithmException", "{", "return", "getChecksum", "(", "bytes", ",", "algorithm", ".", "getAlgorithm", "(", ")", ...
Gets the checksum from the given byte array with an instance of. @param bytes the Byte object array. @param algorithm the algorithm to get the checksum. This could be for instance "MD4", "MD5", "SHA-1", "SHA-256", "SHA-384" or "SHA-512". @return The checksum from the file as a String object. @throws NoSuchAlgorithmException Is thrown if the algorithm is not supported or does not exists. {@link java.security.MessageDigest} object.
[ "Gets", "the", "checksum", "from", "the", "given", "byte", "array", "with", "an", "instance", "of", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/checksum/ChecksumExtensions.java#L156-L160
RogerParkinson/madura-workflows
madura-workflow/src/main/java/nz/co/senanque/workflow/WorkflowManagerImpl.java
WorkflowManagerImpl.lockProcessInstance
public ProcessInstance lockProcessInstance(final ProcessInstance processInstance, final boolean techSupport, final String userName) { List<Lock> locks = ContextUtils.getLocks(processInstance,getLockFactory(),"nz.co.senanque.workflow.WorkflowClient.lock(ProcessInstance)"); LockTemplate lockTemplate = new LockTemplate(locks, new LockAction() { public void doAction() { String taskId = ProcessInstanceUtils.getTaskId(processInstance); ProcessInstance pi = getWorkflowDAO().refreshProcessInstance(processInstance); // if (log.isDebugEnabled()) { // log.debug("taskId {} ProcessInstanceUtils.getTaskId(pi) {} {}",taskId,ProcessInstanceUtils.getTaskId(pi),(!taskId.equals(ProcessInstanceUtils.getTaskId(pi)))); // log.debug("pi.getStatus() {} techSupport {} {}",pi.getStatus(),techSupport,((pi.getStatus() != TaskStatus.WAIT) && !techSupport)); // log.debug("pi.getStatus() {} userName {} pi.getLockedBy() {} {}",pi.getStatus(),userName,pi.getLockedBy(),(pi.getStatus() == TaskStatus.BUSY) && !userName.equals(pi.getLockedBy()) && !techSupport); // } if (!techSupport) { if (!(taskId.equals(ProcessInstanceUtils.getTaskId(pi)) && ((pi.getStatus() == TaskStatus.WAIT) || ((pi.getStatus() == TaskStatus.BUSY) && userName.equals(pi.getLockedBy()))))) { // // In this case we did not actually fail to get the lock but // // the process is not in the state // // it was in when we saw it in the table because another // // user (probably) has updated it. // // Therefore it is dangerous to proceed (unless we are tech support) throw new RuntimeException("ProcessInstance is already busy"); } } pi.setStatus(TaskStatus.BUSY); pi.setLockedBy(userName); TaskBase task = getCurrentTask(pi); Audit audit = createAudit(pi, task); getWorkflowDAO().mergeProcessInstance(pi); } }); boolean weAreOkay = true; try { weAreOkay = lockTemplate.doAction(); } catch (Exception e) { weAreOkay = false; } if (!weAreOkay) { return null; } return getWorkflowDAO().refreshProcessInstance(processInstance); }
java
public ProcessInstance lockProcessInstance(final ProcessInstance processInstance, final boolean techSupport, final String userName) { List<Lock> locks = ContextUtils.getLocks(processInstance,getLockFactory(),"nz.co.senanque.workflow.WorkflowClient.lock(ProcessInstance)"); LockTemplate lockTemplate = new LockTemplate(locks, new LockAction() { public void doAction() { String taskId = ProcessInstanceUtils.getTaskId(processInstance); ProcessInstance pi = getWorkflowDAO().refreshProcessInstance(processInstance); // if (log.isDebugEnabled()) { // log.debug("taskId {} ProcessInstanceUtils.getTaskId(pi) {} {}",taskId,ProcessInstanceUtils.getTaskId(pi),(!taskId.equals(ProcessInstanceUtils.getTaskId(pi)))); // log.debug("pi.getStatus() {} techSupport {} {}",pi.getStatus(),techSupport,((pi.getStatus() != TaskStatus.WAIT) && !techSupport)); // log.debug("pi.getStatus() {} userName {} pi.getLockedBy() {} {}",pi.getStatus(),userName,pi.getLockedBy(),(pi.getStatus() == TaskStatus.BUSY) && !userName.equals(pi.getLockedBy()) && !techSupport); // } if (!techSupport) { if (!(taskId.equals(ProcessInstanceUtils.getTaskId(pi)) && ((pi.getStatus() == TaskStatus.WAIT) || ((pi.getStatus() == TaskStatus.BUSY) && userName.equals(pi.getLockedBy()))))) { // // In this case we did not actually fail to get the lock but // // the process is not in the state // // it was in when we saw it in the table because another // // user (probably) has updated it. // // Therefore it is dangerous to proceed (unless we are tech support) throw new RuntimeException("ProcessInstance is already busy"); } } pi.setStatus(TaskStatus.BUSY); pi.setLockedBy(userName); TaskBase task = getCurrentTask(pi); Audit audit = createAudit(pi, task); getWorkflowDAO().mergeProcessInstance(pi); } }); boolean weAreOkay = true; try { weAreOkay = lockTemplate.doAction(); } catch (Exception e) { weAreOkay = false; } if (!weAreOkay) { return null; } return getWorkflowDAO().refreshProcessInstance(processInstance); }
[ "public", "ProcessInstance", "lockProcessInstance", "(", "final", "ProcessInstance", "processInstance", ",", "final", "boolean", "techSupport", ",", "final", "String", "userName", ")", "{", "List", "<", "Lock", ">", "locks", "=", "ContextUtils", ".", "getLocks", "...
This manages the transition of the process instance from Waiting to Busy with appropriate locking and unlocking. Once it is busy it is ours but we have to check that it was not changed since we last saw it. The situation we are protecting against is that although the process instance looked to be in wait state in the table we might have sat on that for a while and someone else may have updated it meanwhile. In that case we reject the request, unless we are TECHSUPPORT. Those guys can do anything. @param processInstance @param techSupport (boolean that indicates if we have TECHSUPPORT privs) @param userName @return updated processInstance or null if we failed to get the lock
[ "This", "manages", "the", "transition", "of", "the", "process", "instance", "from", "Waiting", "to", "Busy", "with", "appropriate", "locking", "and", "unlocking", ".", "Once", "it", "is", "busy", "it", "is", "ours", "but", "we", "have", "to", "check", "tha...
train
https://github.com/RogerParkinson/madura-workflows/blob/3d26c322fc85a006ff0d0cbebacbc453aed8e492/madura-workflow/src/main/java/nz/co/senanque/workflow/WorkflowManagerImpl.java#L309-L351
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/FrameDataflowAnalysis.java
FrameDataflowAnalysis.modifyFrame
final protected FrameType modifyFrame(FrameType orig, @CheckForNull FrameType copy) { if (copy == null) { copy = createFact(); copy.copyFrom(orig); } return copy; }
java
final protected FrameType modifyFrame(FrameType orig, @CheckForNull FrameType copy) { if (copy == null) { copy = createFact(); copy.copyFrom(orig); } return copy; }
[ "final", "protected", "FrameType", "modifyFrame", "(", "FrameType", "orig", ",", "@", "CheckForNull", "FrameType", "copy", ")", "{", "if", "(", "copy", "==", "null", ")", "{", "copy", "=", "createFact", "(", ")", ";", "copy", ".", "copyFrom", "(", "orig"...
<p>Create a modifiable copy of a frame. This is useful for meetInto(), if the frame needs to be modified in a path-sensitive fashion. A typical usage pattern is: </p> <pre> FrameType copy = null; if (someCondition()) { copy = modifyFrame(fact, copy); // modify copy } if (someOtherCondition()) { copy = modifyFrame(fact, copy); // modify copy } if (copy != null) fact = copy; mergeInto(fact, result); </pre> <p> The advantage of using modifyFrame() is that new code can be added before or after other places where the frame is modified, and the code will remain correct.</p> @param orig the original frame @param copy the modifiable copy (returned by a previous call to modifyFrame()), or null if this is the first time modifyFrame() is being called @return a modifiable copy of fact
[ "<p", ">", "Create", "a", "modifiable", "copy", "of", "a", "frame", ".", "This", "is", "useful", "for", "meetInto", "()", "if", "the", "frame", "needs", "to", "be", "modified", "in", "a", "path", "-", "sensitive", "fashion", ".", "A", "typical", "usage...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/FrameDataflowAnalysis.java#L167-L173
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java
BaseNDArrayFactory.pullRows
@Override public INDArray pullRows(INDArray source, int sourceDimension, int[] indexes, char order) { Shape.assertValidOrder(order); long vectorLength = source.shape()[sourceDimension]; INDArray ret = Nd4j.createUninitialized(new long[] {indexes.length, vectorLength}, order); for (int cnt = 0; cnt < indexes.length; cnt++) { ret.putRow(cnt, source.tensorAlongDimension((int) indexes[cnt], sourceDimension)); } return ret; }
java
@Override public INDArray pullRows(INDArray source, int sourceDimension, int[] indexes, char order) { Shape.assertValidOrder(order); long vectorLength = source.shape()[sourceDimension]; INDArray ret = Nd4j.createUninitialized(new long[] {indexes.length, vectorLength}, order); for (int cnt = 0; cnt < indexes.length; cnt++) { ret.putRow(cnt, source.tensorAlongDimension((int) indexes[cnt], sourceDimension)); } return ret; }
[ "@", "Override", "public", "INDArray", "pullRows", "(", "INDArray", "source", ",", "int", "sourceDimension", ",", "int", "[", "]", "indexes", ",", "char", "order", ")", "{", "Shape", ".", "assertValidOrder", "(", "order", ")", ";", "long", "vectorLength", ...
This method produces concatenated array, that consist from tensors, fetched from source array, against some dimension and specified indexes @param source source tensor @param sourceDimension dimension of source tensor @param indexes indexes from source array @return
[ "This", "method", "produces", "concatenated", "array", "that", "consist", "from", "tensors", "fetched", "from", "source", "array", "against", "some", "dimension", "and", "specified", "indexes" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L751-L762
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/tasks/net/ThreadBoundJschLogger.java
ThreadBoundJschLogger.setThreadLogger
private void setThreadLogger(BaseLogger logger, int loggingLevel) { baseLogger.set(logger); logLevel.set(loggingLevel); JSch.setLogger(this); }
java
private void setThreadLogger(BaseLogger logger, int loggingLevel) { baseLogger.set(logger); logLevel.set(loggingLevel); JSch.setLogger(this); }
[ "private", "void", "setThreadLogger", "(", "BaseLogger", "logger", ",", "int", "loggingLevel", ")", "{", "baseLogger", ".", "set", "(", "logger", ")", ";", "logLevel", ".", "set", "(", "loggingLevel", ")", ";", "JSch", ".", "setLogger", "(", "this", ")", ...
Set the thread-inherited logger with a loglevel on Jsch @param logger logger @param loggingLevel level
[ "Set", "the", "thread", "-", "inherited", "logger", "with", "a", "loglevel", "on", "Jsch" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/tasks/net/ThreadBoundJschLogger.java#L78-L82
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/modules/r/interpolation2d/core/TPSInterpolator.java
TPSInterpolator.fillKsubMatrix
private void fillKsubMatrix( Coordinate[] controlPoints, GeneralMatrix L ) { double alfa = 0; int controlPointsNum = controlPoints.length; for( int i = 0; i < controlPointsNum; i++ ) { for( int j = i + 1; j < controlPointsNum; j++ ) { double u = calculateFunctionU(controlPoints[i], controlPoints[j]); L.setElement(i, j, u); L.setElement(j, i, u); alfa = alfa + (u * 2); // same for upper and lower part } } alfa = alfa / (controlPointsNum * controlPointsNum); }
java
private void fillKsubMatrix( Coordinate[] controlPoints, GeneralMatrix L ) { double alfa = 0; int controlPointsNum = controlPoints.length; for( int i = 0; i < controlPointsNum; i++ ) { for( int j = i + 1; j < controlPointsNum; j++ ) { double u = calculateFunctionU(controlPoints[i], controlPoints[j]); L.setElement(i, j, u); L.setElement(j, i, u); alfa = alfa + (u * 2); // same for upper and lower part } } alfa = alfa / (controlPointsNum * controlPointsNum); }
[ "private", "void", "fillKsubMatrix", "(", "Coordinate", "[", "]", "controlPoints", ",", "GeneralMatrix", "L", ")", "{", "double", "alfa", "=", "0", ";", "int", "controlPointsNum", "=", "controlPoints", ".", "length", ";", "for", "(", "int", "i", "=", "0", ...
Fill K submatrix (<a href="http://elonen.iki.fi/code/tpsdemo/index.html"> see more here</a>) @param controlPoints @param L
[ "Fill", "K", "submatrix", "(", "<a", "href", "=", "http", ":", "//", "elonen", ".", "iki", ".", "fi", "/", "code", "/", "tpsdemo", "/", "index", ".", "html", ">", "see", "more", "here<", "/", "a", ">", ")" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/interpolation2d/core/TPSInterpolator.java#L119-L132
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_statistics_partition_partition_chart_GET
public OvhChartReturn serviceName_statistics_partition_partition_chart_GET(String serviceName, String partition, OvhRtmChartPeriodEnum period) throws IOException { String qPath = "/dedicated/server/{serviceName}/statistics/partition/{partition}/chart"; StringBuilder sb = path(qPath, serviceName, partition); query(sb, "period", period); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhChartReturn.class); }
java
public OvhChartReturn serviceName_statistics_partition_partition_chart_GET(String serviceName, String partition, OvhRtmChartPeriodEnum period) throws IOException { String qPath = "/dedicated/server/{serviceName}/statistics/partition/{partition}/chart"; StringBuilder sb = path(qPath, serviceName, partition); query(sb, "period", period); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhChartReturn.class); }
[ "public", "OvhChartReturn", "serviceName_statistics_partition_partition_chart_GET", "(", "String", "serviceName", ",", "String", "partition", ",", "OvhRtmChartPeriodEnum", "period", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/st...
Retrieve partition charts REST: GET /dedicated/server/{serviceName}/statistics/partition/{partition}/chart @param period [required] chart period @param serviceName [required] The internal name of your dedicated server @param partition [required] Partition
[ "Retrieve", "partition", "charts" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1249-L1255
trellis-ldp/trellis
components/webdav/src/main/java/org/trellisldp/webdav/impl/WebDAVUtils.java
WebDAVUtils.externalUrl
public static String externalUrl(final IRI identifier, final String baseUrl) { if (baseUrl.endsWith("/")) { return replaceOnce(identifier.getIRIString(), TRELLIS_DATA_PREFIX, baseUrl); } return replaceOnce(identifier.getIRIString(), TRELLIS_DATA_PREFIX, baseUrl + "/"); }
java
public static String externalUrl(final IRI identifier, final String baseUrl) { if (baseUrl.endsWith("/")) { return replaceOnce(identifier.getIRIString(), TRELLIS_DATA_PREFIX, baseUrl); } return replaceOnce(identifier.getIRIString(), TRELLIS_DATA_PREFIX, baseUrl + "/"); }
[ "public", "static", "String", "externalUrl", "(", "final", "IRI", "identifier", ",", "final", "String", "baseUrl", ")", "{", "if", "(", "baseUrl", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "return", "replaceOnce", "(", "identifier", ".", "getIRIString", ...
Generate an external URL for the given location and baseURL. @param identifier the resource identifier @param baseUrl the baseURL @return the external URL
[ "Generate", "an", "external", "URL", "for", "the", "given", "location", "and", "baseURL", "." ]
train
https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/components/webdav/src/main/java/org/trellisldp/webdav/impl/WebDAVUtils.java#L242-L247
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/RedisStorage.java
RedisStorage.storeJob
@Override @SuppressWarnings("unchecked") public void storeJob(JobDetail jobDetail, boolean replaceExisting, Jedis jedis) throws ObjectAlreadyExistsException { final String jobHashKey = redisSchema.jobHashKey(jobDetail.getKey()); final String jobDataMapHashKey = redisSchema.jobDataMapHashKey(jobDetail.getKey()); final String jobGroupSetKey = redisSchema.jobGroupSetKey(jobDetail.getKey()); if(!replaceExisting && jedis.exists(jobHashKey)){ throw new ObjectAlreadyExistsException(jobDetail); } Pipeline pipe = jedis.pipelined(); pipe.hmset(jobHashKey, (Map<String, String>) mapper.convertValue(jobDetail, new TypeReference<HashMap<String, String>>() {})); if(jobDetail.getJobDataMap() != null && !jobDetail.getJobDataMap().isEmpty()){ pipe.hmset(jobDataMapHashKey, getStringDataMap(jobDetail.getJobDataMap())); } pipe.sadd(redisSchema.jobsSet(), jobHashKey); pipe.sadd(redisSchema.jobGroupsSet(), jobGroupSetKey); pipe.sadd(jobGroupSetKey, jobHashKey); pipe.sync(); }
java
@Override @SuppressWarnings("unchecked") public void storeJob(JobDetail jobDetail, boolean replaceExisting, Jedis jedis) throws ObjectAlreadyExistsException { final String jobHashKey = redisSchema.jobHashKey(jobDetail.getKey()); final String jobDataMapHashKey = redisSchema.jobDataMapHashKey(jobDetail.getKey()); final String jobGroupSetKey = redisSchema.jobGroupSetKey(jobDetail.getKey()); if(!replaceExisting && jedis.exists(jobHashKey)){ throw new ObjectAlreadyExistsException(jobDetail); } Pipeline pipe = jedis.pipelined(); pipe.hmset(jobHashKey, (Map<String, String>) mapper.convertValue(jobDetail, new TypeReference<HashMap<String, String>>() {})); if(jobDetail.getJobDataMap() != null && !jobDetail.getJobDataMap().isEmpty()){ pipe.hmset(jobDataMapHashKey, getStringDataMap(jobDetail.getJobDataMap())); } pipe.sadd(redisSchema.jobsSet(), jobHashKey); pipe.sadd(redisSchema.jobGroupsSet(), jobGroupSetKey); pipe.sadd(jobGroupSetKey, jobHashKey); pipe.sync(); }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "storeJob", "(", "JobDetail", "jobDetail", ",", "boolean", "replaceExisting", ",", "Jedis", "jedis", ")", "throws", "ObjectAlreadyExistsException", "{", "final", "String", "jobHas...
Store a job in Redis @param jobDetail the {@link org.quartz.JobDetail} object to be stored @param replaceExisting if true, any existing job with the same group and name as the given job will be overwritten @param jedis a thread-safe Redis connection @throws org.quartz.ObjectAlreadyExistsException
[ "Store", "a", "job", "in", "Redis" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisStorage.java#L159-L180
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java
GreenMailUtil.sendTextEmail
public static void sendTextEmail(String to, String from, String subject, String msg, final ServerSetup setup) { sendMimeMessage(createTextEmail(to, from, subject, msg, setup)); }
java
public static void sendTextEmail(String to, String from, String subject, String msg, final ServerSetup setup) { sendMimeMessage(createTextEmail(to, from, subject, msg, setup)); }
[ "public", "static", "void", "sendTextEmail", "(", "String", "to", ",", "String", "from", ",", "String", "subject", ",", "String", "msg", ",", "final", "ServerSetup", "setup", ")", "{", "sendMimeMessage", "(", "createTextEmail", "(", "to", ",", "from", ",", ...
Sends a text message using given server setup for SMTP. @param to the to address. @param from the from address. @param subject the subject. @param msg the test message. @param setup the SMTP setup.
[ "Sends", "a", "text", "message", "using", "given", "server", "setup", "for", "SMTP", "." ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java#L262-L264
cdk/cdk
tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomTetrahedralLigandPlacer3D.java
AtomTetrahedralLigandPlacer3D.rescaleBondLength
public Point3d rescaleBondLength(IAtom atom1, IAtom atom2, Point3d point2) { Point3d point1 = atom1.getPoint3d(); Double d1 = atom1.getCovalentRadius(); Double d2 = atom2.getCovalentRadius(); // in case we have no covalent radii, set to 1.0 double distance = (d1 == null || d2 == null) ? 1.0 : d1 + d2; if (pSet != null) { distance = getDistanceValue(atom1.getAtomTypeName(), atom2.getAtomTypeName()); } Vector3d vect = new Vector3d(point2); vect.sub(point1); vect.normalize(); vect.scale(distance); Point3d newPoint = new Point3d(point1); newPoint.add(vect); return newPoint; }
java
public Point3d rescaleBondLength(IAtom atom1, IAtom atom2, Point3d point2) { Point3d point1 = atom1.getPoint3d(); Double d1 = atom1.getCovalentRadius(); Double d2 = atom2.getCovalentRadius(); // in case we have no covalent radii, set to 1.0 double distance = (d1 == null || d2 == null) ? 1.0 : d1 + d2; if (pSet != null) { distance = getDistanceValue(atom1.getAtomTypeName(), atom2.getAtomTypeName()); } Vector3d vect = new Vector3d(point2); vect.sub(point1); vect.normalize(); vect.scale(distance); Point3d newPoint = new Point3d(point1); newPoint.add(vect); return newPoint; }
[ "public", "Point3d", "rescaleBondLength", "(", "IAtom", "atom1", ",", "IAtom", "atom2", ",", "Point3d", "point2", ")", "{", "Point3d", "point1", "=", "atom1", ".", "getPoint3d", "(", ")", ";", "Double", "d1", "=", "atom1", ".", "getCovalentRadius", "(", ")...
Rescales Point2 so that length 1-2 is sum of covalent radii. If covalent radii cannot be found, use bond length of 1.0 @param atom1 stationary atom @param atom2 movable atom @param point2 coordinates for atom 2 @return new coordinates for atom 2
[ "Rescales", "Point2", "so", "that", "length", "1", "-", "2", "is", "sum", "of", "covalent", "radii", ".", "If", "covalent", "radii", "cannot", "be", "found", "use", "bond", "length", "of", "1", ".", "0" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomTetrahedralLigandPlacer3D.java#L131-L147
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/authentication/authenticationvserver_stats.java
authenticationvserver_stats.get
public static authenticationvserver_stats get(nitro_service service, String name) throws Exception{ authenticationvserver_stats obj = new authenticationvserver_stats(); obj.set_name(name); authenticationvserver_stats response = (authenticationvserver_stats) obj.stat_resource(service); return response; }
java
public static authenticationvserver_stats get(nitro_service service, String name) throws Exception{ authenticationvserver_stats obj = new authenticationvserver_stats(); obj.set_name(name); authenticationvserver_stats response = (authenticationvserver_stats) obj.stat_resource(service); return response; }
[ "public", "static", "authenticationvserver_stats", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "authenticationvserver_stats", "obj", "=", "new", "authenticationvserver_stats", "(", ")", ";", "obj", ".", "set_name", ...
Use this API to fetch statistics of authenticationvserver_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "authenticationvserver_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/authentication/authenticationvserver_stats.java#L249-L254
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/MarkdownTaglets.java
MarkdownTaglets.handleOptions
public boolean handleOptions(String[] options, DocErrorReporter errorReporter) { final String potentialMarkdownTagletOption = options[0]; if( potentialMarkdownTagletOption.startsWith(OPT_MD_TAGLET_OPTION_PREFIX) ) { storeMarkdownTagletOption(potentialMarkdownTagletOption, options[1]); return true; } return false; }
java
public boolean handleOptions(String[] options, DocErrorReporter errorReporter) { final String potentialMarkdownTagletOption = options[0]; if( potentialMarkdownTagletOption.startsWith(OPT_MD_TAGLET_OPTION_PREFIX) ) { storeMarkdownTagletOption(potentialMarkdownTagletOption, options[1]); return true; } return false; }
[ "public", "boolean", "handleOptions", "(", "String", "[", "]", "options", ",", "DocErrorReporter", "errorReporter", ")", "{", "final", "String", "potentialMarkdownTagletOption", "=", "options", "[", "0", "]", ";", "if", "(", "potentialMarkdownTagletOption", ".", "...
# Handle the (potential) markdown options. @param options the options @param errorReporter the error reporter @return {@code true} if a markdown option has been found, otherwise false @see MarkdownTaglet#OPT_MD_TAGLET_OPTION_PREFIX @see #optionLengths(String)
[ "#", "Handle", "the", "(", "potential", ")", "markdown", "options", "." ]
train
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/MarkdownTaglets.java#L121-L130
alkacon/opencms-core
src/org/opencms/search/CmsVfsIndexer.java
CmsVfsIndexer.addResourceToUpdateData
protected void addResourceToUpdateData(CmsPublishedResource pubRes, CmsSearchIndexUpdateData updateData) { if (pubRes.getState().isDeleted()) { // deleted resource just needs to be removed updateData.addResourceToDelete(pubRes); } else if (pubRes.getState().isNew() || pubRes.getState().isChanged() || pubRes.getState().isUnchanged()) { updateData.addResourceToUpdate(pubRes); } }
java
protected void addResourceToUpdateData(CmsPublishedResource pubRes, CmsSearchIndexUpdateData updateData) { if (pubRes.getState().isDeleted()) { // deleted resource just needs to be removed updateData.addResourceToDelete(pubRes); } else if (pubRes.getState().isNew() || pubRes.getState().isChanged() || pubRes.getState().isUnchanged()) { updateData.addResourceToUpdate(pubRes); } }
[ "protected", "void", "addResourceToUpdateData", "(", "CmsPublishedResource", "pubRes", ",", "CmsSearchIndexUpdateData", "updateData", ")", "{", "if", "(", "pubRes", ".", "getState", "(", ")", ".", "isDeleted", "(", ")", ")", "{", "// deleted resource just needs to be ...
Adds a given published resource to the provided search index update data.<p> This method decides if the resource has to be included in the "update" or "delete" list.<p> @param pubRes the published resource to add @param updateData the search index update data to add the resource to
[ "Adds", "a", "given", "published", "resource", "to", "the", "provided", "search", "index", "update", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsVfsIndexer.java#L288-L296
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/DistRaid.java
DistRaid.createJobConf
private static JobConf createJobConf(Configuration conf) { JobConf jobconf = new JobConf(conf, DistRaid.class); jobName = NAME + " " + dateForm.format(new Date(RaidNode.now())); jobconf.setUser(RaidNode.JOBUSER); jobconf.setJobName(jobName); jobconf.setMapSpeculativeExecution(false); RaidUtils.parseAndSetOptions(jobconf, SCHEDULER_OPTION_LABEL); jobconf.setJarByClass(DistRaid.class); jobconf.setInputFormat(DistRaidInputFormat.class); jobconf.setOutputKeyClass(Text.class); jobconf.setOutputValueClass(Text.class); jobconf.setMapperClass(DistRaidMapper.class); jobconf.setNumReduceTasks(0); return jobconf; }
java
private static JobConf createJobConf(Configuration conf) { JobConf jobconf = new JobConf(conf, DistRaid.class); jobName = NAME + " " + dateForm.format(new Date(RaidNode.now())); jobconf.setUser(RaidNode.JOBUSER); jobconf.setJobName(jobName); jobconf.setMapSpeculativeExecution(false); RaidUtils.parseAndSetOptions(jobconf, SCHEDULER_OPTION_LABEL); jobconf.setJarByClass(DistRaid.class); jobconf.setInputFormat(DistRaidInputFormat.class); jobconf.setOutputKeyClass(Text.class); jobconf.setOutputValueClass(Text.class); jobconf.setMapperClass(DistRaidMapper.class); jobconf.setNumReduceTasks(0); return jobconf; }
[ "private", "static", "JobConf", "createJobConf", "(", "Configuration", "conf", ")", "{", "JobConf", "jobconf", "=", "new", "JobConf", "(", "conf", ",", "DistRaid", ".", "class", ")", ";", "jobName", "=", "NAME", "+", "\" \"", "+", "dateForm", ".", "format"...
create new job conf based on configuration passed. @param conf @return
[ "create", "new", "job", "conf", "based", "on", "configuration", "passed", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/DistRaid.java#L376-L392
square/phrase
src/main/java/com/squareup/phrase/Phrase.java
Phrase.fromPlural
public static Phrase fromPlural(View v, @PluralsRes int patternResourceId, int quantity) { return fromPlural(v.getResources(), patternResourceId, quantity); }
java
public static Phrase fromPlural(View v, @PluralsRes int patternResourceId, int quantity) { return fromPlural(v.getResources(), patternResourceId, quantity); }
[ "public", "static", "Phrase", "fromPlural", "(", "View", "v", ",", "@", "PluralsRes", "int", "patternResourceId", ",", "int", "quantity", ")", "{", "return", "fromPlural", "(", "v", ".", "getResources", "(", ")", ",", "patternResourceId", ",", "quantity", ")...
Entry point into this API. @throws IllegalArgumentException if pattern contains any syntax errors.
[ "Entry", "point", "into", "this", "API", "." ]
train
https://github.com/square/phrase/blob/d91f18e80790832db11b811c462f8e5cd492d97e/src/main/java/com/squareup/phrase/Phrase.java#L114-L116
elki-project/elki
elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java
VectorUtil.angleSparse
public static double angleSparse(SparseNumberVector v1, SparseNumberVector v2) { // TODO: exploit precomputed length, when available? double l1 = 0., l2 = 0., cross = 0.; int i1 = v1.iter(), i2 = v2.iter(); while(v1.iterValid(i1) && v2.iterValid(i2)) { final int d1 = v1.iterDim(i1), d2 = v2.iterDim(i2); if(d1 < d2) { final double val = v1.iterDoubleValue(i1); l1 += val * val; i1 = v1.iterAdvance(i1); } else if(d2 < d1) { final double val = v2.iterDoubleValue(i2); l2 += val * val; i2 = v2.iterAdvance(i2); } else { // d1 == d2 final double val1 = v1.iterDoubleValue(i1); final double val2 = v2.iterDoubleValue(i2); l1 += val1 * val1; l2 += val2 * val2; cross += val1 * val2; i1 = v1.iterAdvance(i1); i2 = v2.iterAdvance(i2); } } while(v1.iterValid(i1)) { final double val = v1.iterDoubleValue(i1); l1 += val * val; i1 = v1.iterAdvance(i1); } while(v2.iterValid(i2)) { final double val = v2.iterDoubleValue(i2); l2 += val * val; i2 = v2.iterAdvance(i2); } final double a = (cross == 0.) ? 0. : // (l1 == 0. || l2 == 0.) ? 1. : // FastMath.sqrt((cross / l1) * (cross / l2)); return (a < 1.) ? a : 1.; }
java
public static double angleSparse(SparseNumberVector v1, SparseNumberVector v2) { // TODO: exploit precomputed length, when available? double l1 = 0., l2 = 0., cross = 0.; int i1 = v1.iter(), i2 = v2.iter(); while(v1.iterValid(i1) && v2.iterValid(i2)) { final int d1 = v1.iterDim(i1), d2 = v2.iterDim(i2); if(d1 < d2) { final double val = v1.iterDoubleValue(i1); l1 += val * val; i1 = v1.iterAdvance(i1); } else if(d2 < d1) { final double val = v2.iterDoubleValue(i2); l2 += val * val; i2 = v2.iterAdvance(i2); } else { // d1 == d2 final double val1 = v1.iterDoubleValue(i1); final double val2 = v2.iterDoubleValue(i2); l1 += val1 * val1; l2 += val2 * val2; cross += val1 * val2; i1 = v1.iterAdvance(i1); i2 = v2.iterAdvance(i2); } } while(v1.iterValid(i1)) { final double val = v1.iterDoubleValue(i1); l1 += val * val; i1 = v1.iterAdvance(i1); } while(v2.iterValid(i2)) { final double val = v2.iterDoubleValue(i2); l2 += val * val; i2 = v2.iterAdvance(i2); } final double a = (cross == 0.) ? 0. : // (l1 == 0. || l2 == 0.) ? 1. : // FastMath.sqrt((cross / l1) * (cross / l2)); return (a < 1.) ? a : 1.; }
[ "public", "static", "double", "angleSparse", "(", "SparseNumberVector", "v1", ",", "SparseNumberVector", "v2", ")", "{", "// TODO: exploit precomputed length, when available?", "double", "l1", "=", "0.", ",", "l2", "=", "0.", ",", "cross", "=", "0.", ";", "int", ...
Compute the angle for sparse vectors. @param v1 First vector @param v2 Second vector @return angle
[ "Compute", "the", "angle", "for", "sparse", "vectors", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java#L130-L170