repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
apache/groovy | src/main/java/org/codehaus/groovy/runtime/typehandling/NumberMath.java | NumberMath.getMath | public static NumberMath getMath(Number left, Number right) {
"""
Determine which NumberMath instance to use, given the supplied operands. This method implements
the type promotion rules discussed in the documentation. Note that by the time this method is
called, any Byte, Character or Short operands will have... | java | public static NumberMath getMath(Number left, Number right) {
// FloatingPointMath wins according to promotion Matrix
if (isFloatingPoint(left) || isFloatingPoint(right)) {
return FloatingPointMath.INSTANCE;
}
NumberMath leftMath = getMath(left);
NumberMath rightMath ... | [
"public",
"static",
"NumberMath",
"getMath",
"(",
"Number",
"left",
",",
"Number",
"right",
")",
"{",
"// FloatingPointMath wins according to promotion Matrix",
"if",
"(",
"isFloatingPoint",
"(",
"left",
")",
"||",
"isFloatingPoint",
"(",
"right",
")",
")",
"{",
"... | Determine which NumberMath instance to use, given the supplied operands. This method implements
the type promotion rules discussed in the documentation. Note that by the time this method is
called, any Byte, Character or Short operands will have been promoted to Integer. For reference,
here is the promotion matrix:
... | [
"Determine",
"which",
"NumberMath",
"instance",
"to",
"use",
"given",
"the",
"supplied",
"operands",
".",
"This",
"method",
"implements",
"the",
"type",
"promotion",
"rules",
"discussed",
"in",
"the",
"documentation",
".",
"Note",
"that",
"by",
"the",
"time",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/typehandling/NumberMath.java#L194-L216 |
networknt/light-4j | dump/src/main/java/com/networknt/dump/StatusCodeDumper.java | StatusCodeDumper.dumpResponse | @Override
public void dumpResponse(Map<String, Object> result) {
"""
impl of dumping response status code to result
@param result A map you want to put dump information to
"""
this.statusCodeResult = String.valueOf(exchange.getStatusCode());
this.putDumpInfoTo(result);
} | java | @Override
public void dumpResponse(Map<String, Object> result) {
this.statusCodeResult = String.valueOf(exchange.getStatusCode());
this.putDumpInfoTo(result);
} | [
"@",
"Override",
"public",
"void",
"dumpResponse",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"this",
".",
"statusCodeResult",
"=",
"String",
".",
"valueOf",
"(",
"exchange",
".",
"getStatusCode",
"(",
")",
")",
";",
"this",
".",
... | impl of dumping response status code to result
@param result A map you want to put dump information to | [
"impl",
"of",
"dumping",
"response",
"status",
"code",
"to",
"result"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/StatusCodeDumper.java#L38-L42 |
camunda/camunda-commons | utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java | EnsureUtil.ensureParamInstanceOf | @SuppressWarnings("unchecked")
public static <T> T ensureParamInstanceOf(String objectName, Object object, Class<T> type) {
"""
Ensure the object is of a given type and return the casted object
@param objectName the name of the parameter
@param object the parameter value
@param type the expected type
@retu... | java | @SuppressWarnings("unchecked")
public static <T> T ensureParamInstanceOf(String objectName, Object object, Class<T> type) {
if(type.isAssignableFrom(object.getClass())) {
return (T) object;
} else {
throw LOG.unsupportedParameterType(objectName, object, type);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"ensureParamInstanceOf",
"(",
"String",
"objectName",
",",
"Object",
"object",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"type",
".",
"isAssignableF... | Ensure the object is of a given type and return the casted object
@param objectName the name of the parameter
@param object the parameter value
@param type the expected type
@return the parameter casted to the requested type
@throws IllegalArgumentException in case object cannot be casted to type | [
"Ensure",
"the",
"object",
"is",
"of",
"a",
"given",
"type",
"and",
"return",
"the",
"casted",
"object"
] | train | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java#L48-L55 |
52inc/android-52Kit | library-attributr/src/main/java/com/ftinc/kit/attributr/Attributr.java | Attributr.openLicenses | public static void openLicenses(Context ctx, @XmlRes int configResId) {
"""
Open the third party licenses activity with the supplied configuration file
@param ctx the context reference to launch the activity with
@param configResId the XML configuration resource id
"""
openLicen... | java | public static void openLicenses(Context ctx, @XmlRes int configResId){
openLicenses(ctx, configResId, ctx.getString(R.string.activity_license_label));
} | [
"public",
"static",
"void",
"openLicenses",
"(",
"Context",
"ctx",
",",
"@",
"XmlRes",
"int",
"configResId",
")",
"{",
"openLicenses",
"(",
"ctx",
",",
"configResId",
",",
"ctx",
".",
"getString",
"(",
"R",
".",
"string",
".",
"activity_license_label",
")",
... | Open the third party licenses activity with the supplied configuration file
@param ctx the context reference to launch the activity with
@param configResId the XML configuration resource id | [
"Open",
"the",
"third",
"party",
"licenses",
"activity",
"with",
"the",
"supplied",
"configuration",
"file"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-attributr/src/main/java/com/ftinc/kit/attributr/Attributr.java#L56-L58 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.signParams | public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params) {
"""
对参数做签名<br>
参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串<br>
拼接后的字符串键值对之间无符号,键值对之间无符号,忽略null值
@param digestAlgorithm 摘要算法
@param params 参数
@return 签名
@since 4.0.1
"""
return signParams(digestAlgorithm, params,... | java | public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params) {
return signParams(digestAlgorithm, params, StrUtil.EMPTY, StrUtil.EMPTY, true);
} | [
"public",
"static",
"String",
"signParams",
"(",
"DigestAlgorithm",
"digestAlgorithm",
",",
"Map",
"<",
"?",
",",
"?",
">",
"params",
")",
"{",
"return",
"signParams",
"(",
"digestAlgorithm",
",",
"params",
",",
"StrUtil",
".",
"EMPTY",
",",
"StrUtil",
".",
... | 对参数做签名<br>
参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串<br>
拼接后的字符串键值对之间无符号,键值对之间无符号,忽略null值
@param digestAlgorithm 摘要算法
@param params 参数
@return 签名
@since 4.0.1 | [
"对参数做签名<br",
">",
"参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串<br",
">",
"拼接后的字符串键值对之间无符号,键值对之间无符号,忽略null值"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L904-L906 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java | AbstractAnnotationValueVisitor6.visitUnknown | @Override
public R visitUnknown(AnnotationValue av, P p) {
"""
{@inheritDoc}
@implSpec The default implementation of this method in {@code
AbstractAnnotationValueVisitor6} will always throw {@code
new UnknownAnnotationValueException(av, p)}. This behavior is not
required of a subclass.
@param av {@in... | java | @Override
public R visitUnknown(AnnotationValue av, P p) {
throw new UnknownAnnotationValueException(av, p);
} | [
"@",
"Override",
"public",
"R",
"visitUnknown",
"(",
"AnnotationValue",
"av",
",",
"P",
"p",
")",
"{",
"throw",
"new",
"UnknownAnnotationValueException",
"(",
"av",
",",
"p",
")",
";",
"}"
] | {@inheritDoc}
@implSpec The default implementation of this method in {@code
AbstractAnnotationValueVisitor6} will always throw {@code
new UnknownAnnotationValueException(av, p)}. This behavior is not
required of a subclass.
@param av {@inheritDoc}
@param p {@inheritDoc} | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java#L115-L118 |
prestodb/presto | presto-parser/src/main/java/com/facebook/presto/sql/tree/ExpressionTreeRewriter.java | ExpressionTreeRewriter.defaultRewrite | @SuppressWarnings("unchecked")
public <T extends Expression> T defaultRewrite(T node, C context) {
"""
Invoke the default rewrite logic explicitly. Specifically, it skips the invocation of the expression rewriter for the provided node.
"""
return (T) visitor.process(node, new Context<>(context, tru... | java | @SuppressWarnings("unchecked")
public <T extends Expression> T defaultRewrite(T node, C context)
{
return (T) visitor.process(node, new Context<>(context, true));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"Expression",
">",
"T",
"defaultRewrite",
"(",
"T",
"node",
",",
"C",
"context",
")",
"{",
"return",
"(",
"T",
")",
"visitor",
".",
"process",
"(",
"node",
",",
"new",
"... | Invoke the default rewrite logic explicitly. Specifically, it skips the invocation of the expression rewriter for the provided node. | [
"Invoke",
"the",
"default",
"rewrite",
"logic",
"explicitly",
".",
"Specifically",
"it",
"skips",
"the",
"invocation",
"of",
"the",
"expression",
"rewriter",
"for",
"the",
"provided",
"node",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-parser/src/main/java/com/facebook/presto/sql/tree/ExpressionTreeRewriter.java#L64-L68 |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getTimeDuration | public long getTimeDuration(String name, long defaultValue, TimeUnit unit) {
"""
Return time duration in the given time unit. Valid units are encoded in
properties as suffixes: nanoseconds (ns), microseconds (us), milliseconds
(ms), seconds (s), minutes (m), hours (h), and days (d).
@param name Property name
@... | java | public long getTimeDuration(String name, long defaultValue, TimeUnit unit) {
String vStr = get(name);
if (null == vStr) {
return defaultValue;
} else {
return getTimeDurationHelper(name, vStr, unit);
}
} | [
"public",
"long",
"getTimeDuration",
"(",
"String",
"name",
",",
"long",
"defaultValue",
",",
"TimeUnit",
"unit",
")",
"{",
"String",
"vStr",
"=",
"get",
"(",
"name",
")",
";",
"if",
"(",
"null",
"==",
"vStr",
")",
"{",
"return",
"defaultValue",
";",
"... | Return time duration in the given time unit. Valid units are encoded in
properties as suffixes: nanoseconds (ns), microseconds (us), milliseconds
(ms), seconds (s), minutes (m), hours (h), and days (d).
@param name Property name
@param defaultValue Value returned if no mapping exists.
@param unit Unit to convert the st... | [
"Return",
"time",
"duration",
"in",
"the",
"given",
"time",
"unit",
".",
"Valid",
"units",
"are",
"encoded",
"in",
"properties",
"as",
"suffixes",
":",
"nanoseconds",
"(",
"ns",
")",
"microseconds",
"(",
"us",
")",
"milliseconds",
"(",
"ms",
")",
"seconds"... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1662-L1669 |
mbenson/therian | core/src/main/java/therian/util/Types.java | Types.resolveAt | public static Type resolveAt(Object o, TypeVariable<?> var, Map<TypeVariable<?>, Type> variablesMap) {
"""
Tries to "read" a {@link TypeVariable} from an object instance, taking into account {@link BindTypeVariable} and
{@link Typed} before falling back to basic type.
@param o
@param var
@param variablesMap ... | java | public static Type resolveAt(Object o, TypeVariable<?> var, Map<TypeVariable<?>, Type> variablesMap) {
final Class<?> rt = Validate.notNull(o, "null target").getClass();
Validate.notNull(var, "no variable to read");
final GenericDeclaration genericDeclaration = var.getGenericDeclaration();
... | [
"public",
"static",
"Type",
"resolveAt",
"(",
"Object",
"o",
",",
"TypeVariable",
"<",
"?",
">",
"var",
",",
"Map",
"<",
"TypeVariable",
"<",
"?",
">",
",",
"Type",
">",
"variablesMap",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"rt",
"=",
"Validate"... | Tries to "read" a {@link TypeVariable} from an object instance, taking into account {@link BindTypeVariable} and
{@link Typed} before falling back to basic type.
@param o
@param var
@param variablesMap prepopulated map for efficiency
@return Type resolved or {@code null} | [
"Tries",
"to",
"read",
"a",
"{",
"@link",
"TypeVariable",
"}",
"from",
"an",
"object",
"instance",
"taking",
"into",
"account",
"{",
"@link",
"BindTypeVariable",
"}",
"and",
"{",
"@link",
"Typed",
"}",
"before",
"falling",
"back",
"to",
"basic",
"type",
".... | train | https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/util/Types.java#L111-L122 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getUsersBatch | public OneLoginResponse<User> getUsersBatch(int batchSize, String afterCursor)
throws OAuthSystemException, OAuthProblemException, URISyntaxException {
"""
Get a batch of Users.
@param batchSize Size of the Batch
@param afterCursor Reference to continue collecting items of next page
@return OneLoginRespo... | java | public OneLoginResponse<User> getUsersBatch(int batchSize, String afterCursor)
throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getUsersBatch(new HashMap<String, String>(), batchSize, afterCursor);
} | [
"public",
"OneLoginResponse",
"<",
"User",
">",
"getUsersBatch",
"(",
"int",
"batchSize",
",",
"String",
"afterCursor",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"return",
"getUsersBatch",
"(",
"new",
"HashMap... | Get a batch of Users.
@param batchSize Size of the Batch
@param afterCursor Reference to continue collecting items of next page
@return OneLoginResponse of User (Batch)
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are er... | [
"Get",
"a",
"batch",
"of",
"Users",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L376-L379 |
jglobus/JGlobus | gss/src/main/java/org/globus/net/BaseServer.java | BaseServer.getHost | public String getHost() {
"""
Returns hostname of this server. The format of the host conforms
to RFC 2732, i.e. for a literal IPv6 address, this method will
return the IPv6 address enclosed in square brackets ('[' and ']').
@return hostname
"""
String host = Util.getLocalHostAddress();
try {
URL u... | java | public String getHost() {
String host = Util.getLocalHostAddress();
try {
URL u = new URL("http", host, 80, "/");
return u.getHost();
} catch (MalformedURLException e) {
return host;
}
} | [
"public",
"String",
"getHost",
"(",
")",
"{",
"String",
"host",
"=",
"Util",
".",
"getLocalHostAddress",
"(",
")",
";",
"try",
"{",
"URL",
"u",
"=",
"new",
"URL",
"(",
"\"http\"",
",",
"host",
",",
"80",
",",
"\"/\"",
")",
";",
"return",
"u",
".",
... | Returns hostname of this server. The format of the host conforms
to RFC 2732, i.e. for a literal IPv6 address, this method will
return the IPv6 address enclosed in square brackets ('[' and ']').
@return hostname | [
"Returns",
"hostname",
"of",
"this",
"server",
".",
"The",
"format",
"of",
"the",
"host",
"conforms",
"to",
"RFC",
"2732",
"i",
".",
"e",
".",
"for",
"a",
"literal",
"IPv6",
"address",
"this",
"method",
"will",
"return",
"the",
"IPv6",
"address",
"enclos... | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/net/BaseServer.java#L209-L217 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/Polyline.java | Polyline.setDefaultInfoWindowLocation | protected void setDefaultInfoWindowLocation() {
"""
Internal method used to ensure that the infowindow will have a default position in all cases,
so that the user can call showInfoWindow even if no tap occured before.
Currently, set the position on the "middle" point of the polyline.
"""
int s = mOri... | java | protected void setDefaultInfoWindowLocation(){
int s = mOriginalPoints.size();
if (s > 0)
mInfoWindowLocation = mOriginalPoints.get(s/2);
else
mInfoWindowLocation = new GeoPoint(0.0, 0.0);
} | [
"protected",
"void",
"setDefaultInfoWindowLocation",
"(",
")",
"{",
"int",
"s",
"=",
"mOriginalPoints",
".",
"size",
"(",
")",
";",
"if",
"(",
"s",
">",
"0",
")",
"mInfoWindowLocation",
"=",
"mOriginalPoints",
".",
"get",
"(",
"s",
"/",
"2",
")",
";",
... | Internal method used to ensure that the infowindow will have a default position in all cases,
so that the user can call showInfoWindow even if no tap occured before.
Currently, set the position on the "middle" point of the polyline. | [
"Internal",
"method",
"used",
"to",
"ensure",
"that",
"the",
"infowindow",
"will",
"have",
"a",
"default",
"position",
"in",
"all",
"cases",
"so",
"that",
"the",
"user",
"can",
"call",
"showInfoWindow",
"even",
"if",
"no",
"tap",
"occured",
"before",
".",
... | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/Polyline.java#L245-L251 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.performTeardownExchange | private void performTeardownExchange() throws IOException {
"""
Exchanges the final messages which politely report our intention to disconnect from the dbserver.
"""
Message teardownRequest = new Message(0xfffffffeL, Message.KnownType.TEARDOWN_REQ);
sendMessage(teardownRequest);
// At t... | java | private void performTeardownExchange() throws IOException {
Message teardownRequest = new Message(0xfffffffeL, Message.KnownType.TEARDOWN_REQ);
sendMessage(teardownRequest);
// At this point, the server closes the connection from its end, so we can’t read any more.
} | [
"private",
"void",
"performTeardownExchange",
"(",
")",
"throws",
"IOException",
"{",
"Message",
"teardownRequest",
"=",
"new",
"Message",
"(",
"0xfffffffe",
"L",
",",
"Message",
".",
"KnownType",
".",
"TEARDOWN_REQ",
")",
";",
"sendMessage",
"(",
"teardownRequest... | Exchanges the final messages which politely report our intention to disconnect from the dbserver. | [
"Exchanges",
"the",
"final",
"messages",
"which",
"politely",
"report",
"our",
"intention",
"to",
"disconnect",
"from",
"the",
"dbserver",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L140-L144 |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java | DMatrixSparseCSC.growMaxColumns | public void growMaxColumns( int desiredColumns , boolean preserveValue ) {
"""
Increases the maximum number of columns in the matrix.
@param desiredColumns Desired number of columns.
@param preserveValue If the array needs to be expanded should it copy the previous values?
"""
if( col_idx.length < de... | java | public void growMaxColumns( int desiredColumns , boolean preserveValue ) {
if( col_idx.length < desiredColumns+1 ) {
int[] c = new int[ desiredColumns+1 ];
if( preserveValue )
System.arraycopy(col_idx,0,c,0,col_idx.length);
col_idx = c;
}
} | [
"public",
"void",
"growMaxColumns",
"(",
"int",
"desiredColumns",
",",
"boolean",
"preserveValue",
")",
"{",
"if",
"(",
"col_idx",
".",
"length",
"<",
"desiredColumns",
"+",
"1",
")",
"{",
"int",
"[",
"]",
"c",
"=",
"new",
"int",
"[",
"desiredColumns",
"... | Increases the maximum number of columns in the matrix.
@param desiredColumns Desired number of columns.
@param preserveValue If the array needs to be expanded should it copy the previous values? | [
"Increases",
"the",
"maximum",
"number",
"of",
"columns",
"in",
"the",
"matrix",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixSparseCSC.java#L361-L368 |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/JavaProvider.java | JavaProvider.getJavas | public List<String> getJavas(SlaveComputer computer, TaskListener listener, Connection connection) {
"""
Returns the list of possible places where java executable might exist.
@return
Can be empty but never null. Absolute path to the possible locations of Java.
"""
return getJavas(listener,connecti... | java | public List<String> getJavas(SlaveComputer computer, TaskListener listener, Connection connection) {
return getJavas(listener,connection);
} | [
"public",
"List",
"<",
"String",
">",
"getJavas",
"(",
"SlaveComputer",
"computer",
",",
"TaskListener",
"listener",
",",
"Connection",
"connection",
")",
"{",
"return",
"getJavas",
"(",
"listener",
",",
"connection",
")",
";",
"}"
] | Returns the list of possible places where java executable might exist.
@return
Can be empty but never null. Absolute path to the possible locations of Java. | [
"Returns",
"the",
"list",
"of",
"possible",
"places",
"where",
"java",
"executable",
"might",
"exist",
"."
] | train | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/JavaProvider.java#L58-L60 |
alkacon/opencms-core | src/org/opencms/workplace/tools/CmsToolManager.java | CmsToolManager.generateNavBar | public String generateNavBar(String toolPath, CmsWorkplace wp) {
"""
Returns the navigation bar html code for the given tool path.<p>
@param toolPath the path
@param wp the jsp page
@return the html code
"""
if (toolPath.equals(getBaseToolPath(wp))) {
return "<div class='pathbar'>&n... | java | public String generateNavBar(String toolPath, CmsWorkplace wp) {
if (toolPath.equals(getBaseToolPath(wp))) {
return "<div class='pathbar'> </div>\n";
}
CmsTool adminTool = resolveAdminTool(getCurrentRoot(wp).getKey(), toolPath);
String html = A_CmsHtmlIconButton.default... | [
"public",
"String",
"generateNavBar",
"(",
"String",
"toolPath",
",",
"CmsWorkplace",
"wp",
")",
"{",
"if",
"(",
"toolPath",
".",
"equals",
"(",
"getBaseToolPath",
"(",
"wp",
")",
")",
")",
"{",
"return",
"\"<div class='pathbar'> </div>\\n\"",
";",
"}",
"... | Returns the navigation bar html code for the given tool path.<p>
@param toolPath the path
@param wp the jsp page
@return the html code | [
"Returns",
"the",
"navigation",
"bar",
"html",
"code",
"for",
"the",
"given",
"tool",
"path",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/CmsToolManager.java#L218-L259 |
mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/items/AbstractItem.java | AbstractItem.createView | public View createView(Context ctx, @Nullable ViewGroup parent) {
"""
this method is called by generateView(Context ctx), generateView(Context ctx, ViewGroup parent) and getViewHolder(ViewGroup parent)
it will generate the View from the layout, overwrite this if you want to implement your view creation programati... | java | public View createView(Context ctx, @Nullable ViewGroup parent) {
return LayoutInflater.from(ctx).inflate(getLayoutRes(), parent, false);
} | [
"public",
"View",
"createView",
"(",
"Context",
"ctx",
",",
"@",
"Nullable",
"ViewGroup",
"parent",
")",
"{",
"return",
"LayoutInflater",
".",
"from",
"(",
"ctx",
")",
".",
"inflate",
"(",
"getLayoutRes",
"(",
")",
",",
"parent",
",",
"false",
")",
";",
... | this method is called by generateView(Context ctx), generateView(Context ctx, ViewGroup parent) and getViewHolder(ViewGroup parent)
it will generate the View from the layout, overwrite this if you want to implement your view creation programatically
@param ctx
@param parent
@return | [
"this",
"method",
"is",
"called",
"by",
"generateView",
"(",
"Context",
"ctx",
")",
"generateView",
"(",
"Context",
"ctx",
"ViewGroup",
"parent",
")",
"and",
"getViewHolder",
"(",
"ViewGroup",
"parent",
")",
"it",
"will",
"generate",
"the",
"View",
"from",
"... | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/items/AbstractItem.java#L246-L248 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java | BuildState.lookupModule | public Module lookupModule(String mod) {
"""
Lookup a module from a name. Create the module if it does
not exist yet.
"""
Module m = modules.get(mod);
if (m == null) {
m = new Module(mod, "???");
modules.put(mod, m);
}
return m;
} | java | public Module lookupModule(String mod) {
Module m = modules.get(mod);
if (m == null) {
m = new Module(mod, "???");
modules.put(mod, m);
}
return m;
} | [
"public",
"Module",
"lookupModule",
"(",
"String",
"mod",
")",
"{",
"Module",
"m",
"=",
"modules",
".",
"get",
"(",
"mod",
")",
";",
"if",
"(",
"m",
"==",
"null",
")",
"{",
"m",
"=",
"new",
"Module",
"(",
"mod",
",",
"\"???\"",
")",
";",
"modules... | Lookup a module from a name. Create the module if it does
not exist yet. | [
"Lookup",
"a",
"module",
"from",
"a",
"name",
".",
"Create",
"the",
"module",
"if",
"it",
"does",
"not",
"exist",
"yet",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/BuildState.java#L65-L72 |
atomix/atomix | utils/src/main/java/io/atomix/utils/config/ConfigMapper.java | ConfigMapper.loadResources | public <T> T loadResources(Class<T> type, List<String> resources) {
"""
Loads the given resources using the configuration mapper.
@param type the type to load
@param resources the resources to load
@param <T> the resulting type
@return the loaded configuration
"""
if (resources == null || ... | java | public <T> T loadResources(Class<T> type, List<String> resources) {
if (resources == null || resources.isEmpty()) {
throw new IllegalArgumentException("resources must be defined");
}
Config config = null;
for (String resource : resources) {
if (config == null) {
config = ConfigFactor... | [
"public",
"<",
"T",
">",
"T",
"loadResources",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"List",
"<",
"String",
">",
"resources",
")",
"{",
"if",
"(",
"resources",
"==",
"null",
"||",
"resources",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",... | Loads the given resources using the configuration mapper.
@param type the type to load
@param resources the resources to load
@param <T> the resulting type
@return the loaded configuration | [
"Loads",
"the",
"given",
"resources",
"using",
"the",
"configuration",
"mapper",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/utils/src/main/java/io/atomix/utils/config/ConfigMapper.java#L112-L125 |
RestComm/sip-servlets | containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/annotations/AnnotationsClassLoader.java | AnnotationsClassLoader.addRepository | synchronized void addRepository(String repository, File file) {
"""
Add a new repository to the set of places this ClassLoader can look for
classes to be loaded.
@param repository Name of a source of classes to be loaded, such as a
directory pathname, a JAR file pathname, or a ZIP file pathname
@exception ... | java | synchronized void addRepository(String repository, File file) {
// Note : There should be only one (of course), but I think we should
// keep this a bit generic
if (repository == null)
return;
if (log.isDebugEnabled())
log.debug("addRepository(" + repository + ... | [
"synchronized",
"void",
"addRepository",
"(",
"String",
"repository",
",",
"File",
"file",
")",
"{",
"// Note : There should be only one (of course), but I think we should",
"// keep this a bit generic",
"if",
"(",
"repository",
"==",
"null",
")",
"return",
";",
"if",
"("... | Add a new repository to the set of places this ClassLoader can look for
classes to be loaded.
@param repository Name of a source of classes to be loaded, such as a
directory pathname, a JAR file pathname, or a ZIP file pathname
@exception IllegalArgumentException if the specified repository is
invalid or does not exi... | [
"Add",
"a",
"new",
"repository",
"to",
"the",
"set",
"of",
"places",
"this",
"ClassLoader",
"can",
"look",
"for",
"classes",
"to",
"be",
"loaded",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/annotations/AnnotationsClassLoader.java#L582-L611 |
jblas-project/jblas | src/main/java/org/jblas/util/Permutations.java | Permutations.permutationFloatMatrixFromPivotIndices | public static FloatMatrix permutationFloatMatrixFromPivotIndices(int size, int[] ipiv) {
"""
Create a permutation matrix from a LAPACK-style 'ipiv' vector.
@param ipiv row i was interchanged with row ipiv[i]
"""
int n = ipiv.length;
//System.out.printf("size = %d n = %d\n", size, n);
int i... | java | public static FloatMatrix permutationFloatMatrixFromPivotIndices(int size, int[] ipiv) {
int n = ipiv.length;
//System.out.printf("size = %d n = %d\n", size, n);
int indices[] = new int[size];
for (int i = 0; i < size; i++)
indices[i] = i;
//for (int i = 0; i < n; i++)
// ... | [
"public",
"static",
"FloatMatrix",
"permutationFloatMatrixFromPivotIndices",
"(",
"int",
"size",
",",
"int",
"[",
"]",
"ipiv",
")",
"{",
"int",
"n",
"=",
"ipiv",
".",
"length",
";",
"//System.out.printf(\"size = %d n = %d\\n\", size, n);",
"int",
"indices",
"[",
"]"... | Create a permutation matrix from a LAPACK-style 'ipiv' vector.
@param ipiv row i was interchanged with row ipiv[i] | [
"Create",
"a",
"permutation",
"matrix",
"from",
"a",
"LAPACK",
"-",
"style",
"ipiv",
"vector",
"."
] | train | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/Permutations.java#L126-L146 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/stats/MeasureMap.java | MeasureMap.putAttachment | @Deprecated
public MeasureMap putAttachment(String key, String value) {
"""
Associate the contextual information of an {@code Exemplar} to this {@link MeasureMap}.
Contextual information is represented as {@code String} key-value pairs.
<p>If this method is called multiple times with the same key, only the l... | java | @Deprecated
public MeasureMap putAttachment(String key, String value) {
return putAttachment(key, AttachmentValueString.create(value));
} | [
"@",
"Deprecated",
"public",
"MeasureMap",
"putAttachment",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"return",
"putAttachment",
"(",
"key",
",",
"AttachmentValueString",
".",
"create",
"(",
"value",
")",
")",
";",
"}"
] | Associate the contextual information of an {@code Exemplar} to this {@link MeasureMap}.
Contextual information is represented as {@code String} key-value pairs.
<p>If this method is called multiple times with the same key, only the last value will be kept.
@param key the key of contextual information of an {@code Exe... | [
"Associate",
"the",
"contextual",
"information",
"of",
"an",
"{",
"@code",
"Exemplar",
"}",
"to",
"this",
"{",
"@link",
"MeasureMap",
"}",
".",
"Contextual",
"information",
"is",
"represented",
"as",
"{",
"@code",
"String",
"}",
"key",
"-",
"value",
"pairs",... | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/stats/MeasureMap.java#L69-L72 |
jayantk/jklol | src/com/jayantkrish/jklol/models/TableFactorBuilder.java | TableFactorBuilder.setWeightList | public void setWeightList(List<? extends Object> varValues, double weight) {
"""
Convenience wrapper for {@link #setWeight(Assignment, double)}.
{@code varValues} is the list of values to construct an assignment out of,
sorted in order of variable number.
@param varValues
@param weight
"""
Preconditi... | java | public void setWeightList(List<? extends Object> varValues, double weight) {
Preconditions.checkNotNull(varValues);
Preconditions.checkArgument(getVars().size() == varValues.size());
setWeight(vars.outcomeToAssignment(varValues), weight);
} | [
"public",
"void",
"setWeightList",
"(",
"List",
"<",
"?",
"extends",
"Object",
">",
"varValues",
",",
"double",
"weight",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"varValues",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"getVars",
"(",
... | Convenience wrapper for {@link #setWeight(Assignment, double)}.
{@code varValues} is the list of values to construct an assignment out of,
sorted in order of variable number.
@param varValues
@param weight | [
"Convenience",
"wrapper",
"for",
"{",
"@link",
"#setWeight",
"(",
"Assignment",
"double",
")",
"}",
".",
"{",
"@code",
"varValues",
"}",
"is",
"the",
"list",
"of",
"values",
"to",
"construct",
"an",
"assignment",
"out",
"of",
"sorted",
"in",
"order",
"of",... | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/TableFactorBuilder.java#L146-L150 |
jenkinsci/gmaven | gmaven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java | MojoSupport.getArtifact | protected Artifact getArtifact(final ArtifactItem item) throws MojoExecutionException {
"""
Resolves the Artifact from the remote repository if necessary. If no version is specified, it will
be retrieved from the dependency list or from the DependencyManagement section of the pom.
@param item The item to cr... | java | protected Artifact getArtifact(final ArtifactItem item) throws MojoExecutionException {
assert item != null;
Artifact artifact = createArtifact(item);
return resolveArtifact(artifact, false);
} | [
"protected",
"Artifact",
"getArtifact",
"(",
"final",
"ArtifactItem",
"item",
")",
"throws",
"MojoExecutionException",
"{",
"assert",
"item",
"!=",
"null",
";",
"Artifact",
"artifact",
"=",
"createArtifact",
"(",
"item",
")",
";",
"return",
"resolveArtifact",
"(",... | Resolves the Artifact from the remote repository if necessary. If no version is specified, it will
be retrieved from the dependency list or from the DependencyManagement section of the pom.
@param item The item to create an artifact for; must not be null
@return The artifact for the given item
@throws MojoExec... | [
"Resolves",
"the",
"Artifact",
"from",
"the",
"remote",
"repository",
"if",
"necessary",
".",
"If",
"no",
"version",
"is",
"specified",
"it",
"will",
"be",
"retrieved",
"from",
"the",
"dependency",
"list",
"or",
"from",
"the",
"DependencyManagement",
"section",
... | train | https://github.com/jenkinsci/gmaven/blob/80d5f6657e15b3e05ffbb82128ed8bb280836e10/gmaven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java#L237-L243 |
ZuInnoTe/hadoopoffice | fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/HadoopKeyStoreManager.java | HadoopKeyStoreManager.getPrivateKey | public Key getPrivateKey(String alias, String password) throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException {
"""
Reads a private key from keystore
@param alias
@param password
@return
@throws UnrecoverableKeyException
@throws KeyStoreException
@throws NoSuchAlgorithmException
... | java | public Key getPrivateKey(String alias, String password) throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException {
return this.keystore.getKey(alias, password.toCharArray());
} | [
"public",
"Key",
"getPrivateKey",
"(",
"String",
"alias",
",",
"String",
"password",
")",
"throws",
"UnrecoverableKeyException",
",",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"this",
".",
"keystore",
".",
"getKey",
"(",
"alias",
",",
"p... | Reads a private key from keystore
@param alias
@param password
@return
@throws UnrecoverableKeyException
@throws KeyStoreException
@throws NoSuchAlgorithmException | [
"Reads",
"a",
"private",
"key",
"from",
"keystore"
] | train | https://github.com/ZuInnoTe/hadoopoffice/blob/58fc9223ee290bcb14847aaaff3fadf39c465e46/fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/HadoopKeyStoreManager.java#L103-L105 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseHashMap.java | DatabaseHashMap.setMaxInactToZero | int setMaxInactToZero(String sessId, String appName) {
"""
/*
setMaxInactToZero - called to set the max inactive time to zero for remote invalidateAll.
This will result in the session being invalidated by the next run of the background
invalidator.
"""
if (com.ibm.websphere.ras.TraceComponent.isAnyT... | java | int setMaxInactToZero(String sessId, String appName) {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[SET_MAX_INACT_TO_ZERO], "for " + sessId + " and app "... | [
"int",
"setMaxInactToZero",
"(",
"String",
"sessId",
",",
"String",
"appName",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"websphere",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
... | /*
setMaxInactToZero - called to set the max inactive time to zero for remote invalidateAll.
This will result in the session being invalidated by the next run of the background
invalidator. | [
"/",
"*",
"setMaxInactToZero",
"-",
"called",
"to",
"set",
"the",
"max",
"inactive",
"time",
"to",
"zero",
"for",
"remote",
"invalidateAll",
".",
"This",
"will",
"result",
"in",
"the",
"session",
"being",
"invalidated",
"by",
"the",
"next",
"run",
"of",
"t... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseHashMap.java#L2787-L2816 |
tdunning/t-digest | core/src/main/java/com/tdunning/math/stats/AbstractTDigest.java | AbstractTDigest.weightedAverage | static double weightedAverage(double x1, double w1, double x2, double w2) {
"""
Same as {@link #weightedAverageSorted(double, double, double, double)} but flips
the order of the variables if <code>x2</code> is greater than
<code>x1</code>.
"""
if (x1 <= x2) {
return weightedAverageSorted(... | java | static double weightedAverage(double x1, double w1, double x2, double w2) {
if (x1 <= x2) {
return weightedAverageSorted(x1, w1, x2, w2);
} else {
return weightedAverageSorted(x2, w2, x1, w1);
}
} | [
"static",
"double",
"weightedAverage",
"(",
"double",
"x1",
",",
"double",
"w1",
",",
"double",
"x2",
",",
"double",
"w2",
")",
"{",
"if",
"(",
"x1",
"<=",
"x2",
")",
"{",
"return",
"weightedAverageSorted",
"(",
"x1",
",",
"w1",
",",
"x2",
",",
"w2",... | Same as {@link #weightedAverageSorted(double, double, double, double)} but flips
the order of the variables if <code>x2</code> is greater than
<code>x1</code>. | [
"Same",
"as",
"{"
] | train | https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/AbstractTDigest.java#L35-L41 |
google/jimfs | jimfs/src/main/java/com/google/common/jimfs/JimfsFileStore.java | JimfsFileStore.copyWithoutContent | File copyWithoutContent(File file, AttributeCopyOption attributeCopyOption) throws IOException {
"""
Creates a copy of the given file, copying its attributes as well according to the given {@code
attributeCopyOption}.
"""
File copy = factory.copyWithoutContent(file);
setInitialAttributes(copy);
at... | java | File copyWithoutContent(File file, AttributeCopyOption attributeCopyOption) throws IOException {
File copy = factory.copyWithoutContent(file);
setInitialAttributes(copy);
attributes.copyAttributes(file, copy, attributeCopyOption);
return copy;
} | [
"File",
"copyWithoutContent",
"(",
"File",
"file",
",",
"AttributeCopyOption",
"attributeCopyOption",
")",
"throws",
"IOException",
"{",
"File",
"copy",
"=",
"factory",
".",
"copyWithoutContent",
"(",
"file",
")",
";",
"setInitialAttributes",
"(",
"copy",
")",
";"... | Creates a copy of the given file, copying its attributes as well according to the given {@code
attributeCopyOption}. | [
"Creates",
"a",
"copy",
"of",
"the",
"given",
"file",
"copying",
"its",
"attributes",
"as",
"well",
"according",
"to",
"the",
"given",
"{"
] | train | https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/JimfsFileStore.java#L153-L158 |
liferay/com-liferay-commerce | commerce-shipping-engine-fixed-api/src/main/java/com/liferay/commerce/shipping/engine/fixed/model/CommerceShippingFixedOptionWrapper.java | CommerceShippingFixedOptionWrapper.getDescription | @Override
public String getDescription(String languageId, boolean useDefault) {
"""
Returns the localized description of this commerce shipping fixed option in the language, optionally using the default language if no localization exists for the requested language.
@param languageId the ID of the language
@pa... | java | @Override
public String getDescription(String languageId, boolean useDefault) {
return _commerceShippingFixedOption.getDescription(languageId,
useDefault);
} | [
"@",
"Override",
"public",
"String",
"getDescription",
"(",
"String",
"languageId",
",",
"boolean",
"useDefault",
")",
"{",
"return",
"_commerceShippingFixedOption",
".",
"getDescription",
"(",
"languageId",
",",
"useDefault",
")",
";",
"}"
] | Returns the localized description of this commerce shipping fixed option in the language, optionally using the default language if no localization exists for the requested language.
@param languageId the ID of the language
@param useDefault whether to use the default language if no localization exists for the requeste... | [
"Returns",
"the",
"localized",
"description",
"of",
"this",
"commerce",
"shipping",
"fixed",
"option",
"in",
"the",
"language",
"optionally",
"using",
"the",
"default",
"language",
"if",
"no",
"localization",
"exists",
"for",
"the",
"requested",
"language",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-shipping-engine-fixed-api/src/main/java/com/liferay/commerce/shipping/engine/fixed/model/CommerceShippingFixedOptionWrapper.java#L281-L285 |
gocd/gocd | server/src/main/java/com/thoughtworks/go/server/service/ScheduleService.java | ScheduleService.rerunFailedJobs | public Stage rerunFailedJobs(final Stage stage, final HttpOperationResult result) {
"""
IMPORTANT: this method is only meant for TOP level usage(never use this within a transaction). It gobbles exception.
"""
final StageIdentifier identifier = stage.getIdentifier();
JobInstances jobInstances = ... | java | public Stage rerunFailedJobs(final Stage stage, final HttpOperationResult result) {
final StageIdentifier identifier = stage.getIdentifier();
JobInstances jobInstances = stage.jobsWithResult(JobResult.Cancelled, JobResult.Failed);
List<String> jobNames = jobInstances.stream().map(JobInstance::ge... | [
"public",
"Stage",
"rerunFailedJobs",
"(",
"final",
"Stage",
"stage",
",",
"final",
"HttpOperationResult",
"result",
")",
"{",
"final",
"StageIdentifier",
"identifier",
"=",
"stage",
".",
"getIdentifier",
"(",
")",
";",
"JobInstances",
"jobInstances",
"=",
"stage"... | IMPORTANT: this method is only meant for TOP level usage(never use this within a transaction). It gobbles exception. | [
"IMPORTANT",
":",
"this",
"method",
"is",
"only",
"meant",
"for",
"TOP",
"level",
"usage",
"(",
"never",
"use",
"this",
"within",
"a",
"transaction",
")",
".",
"It",
"gobbles",
"exception",
"."
] | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/server/src/main/java/com/thoughtworks/go/server/service/ScheduleService.java#L369-L380 |
betfair/cougar | cougar-codegen-plugin/src/main/java/com/betfair/cougar/codegen/IDLReader.java | IDLReader.removeUndefinedOperations | private void removeUndefinedOperations(Node target, Node extensions) throws Exception {
"""
Cycle through the target Node and remove any operations not defined in the extensions document.
"""
final XPathFactory factory = XPathFactory.newInstance();
final NodeList nodes = (NodeList) factory.newX... | java | private void removeUndefinedOperations(Node target, Node extensions) throws Exception {
final XPathFactory factory = XPathFactory.newInstance();
final NodeList nodes = (NodeList) factory.newXPath().evaluate("//operation", target, XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i+... | [
"private",
"void",
"removeUndefinedOperations",
"(",
"Node",
"target",
",",
"Node",
"extensions",
")",
"throws",
"Exception",
"{",
"final",
"XPathFactory",
"factory",
"=",
"XPathFactory",
".",
"newInstance",
"(",
")",
";",
"final",
"NodeList",
"nodes",
"=",
"(",... | Cycle through the target Node and remove any operations not defined in the extensions document. | [
"Cycle",
"through",
"the",
"target",
"Node",
"and",
"remove",
"any",
"operations",
"not",
"defined",
"in",
"the",
"extensions",
"document",
"."
] | train | https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-codegen-plugin/src/main/java/com/betfair/cougar/codegen/IDLReader.java#L390-L405 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java | LocaleMatcher.processMapping | private void processMapping() {
"""
We preprocess the data to get just the possible matches for each desired base language.
"""
for (Entry<String, Set<String>> desiredToMatchingLanguages : matcherData.matchingLanguages().keyValuesSet()) {
String desired = desiredToMatchingLanguages.getKey()... | java | private void processMapping() {
for (Entry<String, Set<String>> desiredToMatchingLanguages : matcherData.matchingLanguages().keyValuesSet()) {
String desired = desiredToMatchingLanguages.getKey();
Set<String> supported = desiredToMatchingLanguages.getValue();
for (R3<ULocale,... | [
"private",
"void",
"processMapping",
"(",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"desiredToMatchingLanguages",
":",
"matcherData",
".",
"matchingLanguages",
"(",
")",
".",
"keyValuesSet",
"(",
")",
")",
"{",
"Str... | We preprocess the data to get just the possible matches for each desired base language. | [
"We",
"preprocess",
"the",
"data",
"to",
"get",
"just",
"the",
"possible",
"matches",
"for",
"each",
"desired",
"base",
"language",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java#L307-L325 |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/collection/ring/RingBuffer.java | RingBuffer.addConsumer | public boolean addConsumer( final C consumer,
final int timesToRetryUponTimeout ) {
"""
Add the supplied consumer, and have it start processing entries in a separate thread.
<p>
The consumer is automatically removed from the ring buffer when it returns {@code false} from its
{@li... | java | public boolean addConsumer( final C consumer,
final int timesToRetryUponTimeout ) {
if (!addEntries.get()) {
throw new IllegalStateException();
}
ConsumerRunner runner = new ConsumerRunner(consumer, timesToRetryUponTimeout);
if (gcConsumer != n... | [
"public",
"boolean",
"addConsumer",
"(",
"final",
"C",
"consumer",
",",
"final",
"int",
"timesToRetryUponTimeout",
")",
"{",
"if",
"(",
"!",
"addEntries",
".",
"get",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"Consume... | Add the supplied consumer, and have it start processing entries in a separate thread.
<p>
The consumer is automatically removed from the ring buffer when it returns {@code false} from its
{@link Consumer#consume(Object, long, long)} method.
</p>
@param consumer the component that will process the entries; may not be n... | [
"Add",
"the",
"supplied",
"consumer",
"and",
"have",
"it",
"start",
"processing",
"entries",
"in",
"a",
"separate",
"thread",
".",
"<p",
">",
"The",
"consumer",
"is",
"automatically",
"removed",
"from",
"the",
"ring",
"buffer",
"when",
"it",
"returns",
"{",
... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/collection/ring/RingBuffer.java#L236-L250 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple5.java | Tuple5.setFields | public void setFields(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4) {
"""
Sets new values to all fields of the tuple.
@param value0 The value for field 0
@param value1 The value for field 1
@param value2 The value for field 2
@param value3 The value for field 3
@param value4 The value for field 4
... | java | public void setFields(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4) {
this.f0 = value0;
this.f1 = value1;
this.f2 = value2;
this.f3 = value3;
this.f4 = value4;
} | [
"public",
"void",
"setFields",
"(",
"T0",
"value0",
",",
"T1",
"value1",
",",
"T2",
"value2",
",",
"T3",
"value3",
",",
"T4",
"value4",
")",
"{",
"this",
".",
"f0",
"=",
"value0",
";",
"this",
".",
"f1",
"=",
"value1",
";",
"this",
".",
"f2",
"="... | Sets new values to all fields of the tuple.
@param value0 The value for field 0
@param value1 The value for field 1
@param value2 The value for field 2
@param value3 The value for field 3
@param value4 The value for field 4 | [
"Sets",
"new",
"values",
"to",
"all",
"fields",
"of",
"the",
"tuple",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple5.java#L140-L146 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/UTF8ByteArrayUtils.java | UTF8ByteArrayUtils.findByte | public static int findByte(byte [] utf, int start, int end, byte b) {
"""
Find the first occurrence of the given byte b in a UTF-8 encoded string
@param utf a byte array containing a UTF-8 encoded string
@param start starting offset
@param end ending position
@param b the byte to find
@return position that fi... | java | public static int findByte(byte [] utf, int start, int end, byte b) {
for(int i=start; i<end; i++) {
if (utf[i]==b) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"findByte",
"(",
"byte",
"[",
"]",
"utf",
",",
"int",
"start",
",",
"int",
"end",
",",
"byte",
"b",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"i",
"++",
")",
"{",
"if",
"(",
"utf",
... | Find the first occurrence of the given byte b in a UTF-8 encoded string
@param utf a byte array containing a UTF-8 encoded string
@param start starting offset
@param end ending position
@param b the byte to find
@return position that first byte occures otherwise -1 | [
"Find",
"the",
"first",
"occurrence",
"of",
"the",
"given",
"byte",
"b",
"in",
"a",
"UTF",
"-",
"8",
"encoded",
"string"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/UTF8ByteArrayUtils.java#L30-L37 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/PropertiesFromJSON.java | PropertiesFromJSON.getProperties | public static Properties getProperties(JSONObject json, String rootObjectPath,
String customObjectPath) throws JSONException, InvalidJSONPathException {
"""
Uses an object path to traverse the json object and return a Properties
object
from the JSONObject (map<string, string>) object at the end of the path... | java | public static Properties getProperties(JSONObject json, String rootObjectPath,
String customObjectPath) throws JSONException, InvalidJSONPathException {
if (customObjectPath != null && !customObjectPath.equals("")) {
try {
return getPropertiesFromTraversal(json, customObjectPath);
} catch ... | [
"public",
"static",
"Properties",
"getProperties",
"(",
"JSONObject",
"json",
",",
"String",
"rootObjectPath",
",",
"String",
"customObjectPath",
")",
"throws",
"JSONException",
",",
"InvalidJSONPathException",
"{",
"if",
"(",
"customObjectPath",
"!=",
"null",
"&&",
... | Uses an object path to traverse the json object and return a Properties
object
from the JSONObject (map<string, string>) object at the end of the path. If
customObjectPath
is null or isn't a valid path for the json object then rootObjectPath is
used as the path.
@param json
@param rootObjectPath
@param customObjectPat... | [
"Uses",
"an",
"object",
"path",
"to",
"traverse",
"the",
"json",
"object",
"and",
"return",
"a",
"Properties",
"object",
"from",
"the",
"JSONObject",
"(",
"map<string",
"string",
">",
")",
"object",
"at",
"the",
"end",
"of",
"the",
"path",
".",
"If",
"cu... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/PropertiesFromJSON.java#L90-L100 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformNoOp.java | TransformNoOp.transformOut | @Override
public Integer transformOut(JdbcPreparedStatementFactory jpsf, Integer attrOut) throws CpoException {
"""
Transforms the data from the class attribute to the object required by the datasource. The type of the attrOut
parameter and the type of the return value must change to match the types being conve... | java | @Override
public Integer transformOut(JdbcPreparedStatementFactory jpsf, Integer attrOut) throws CpoException {
logger.debug("Inside TransformNoOp::transformOut(JdbcPreparedStatementFactory, " + attrOut + ");");
return attrOut;
} | [
"@",
"Override",
"public",
"Integer",
"transformOut",
"(",
"JdbcPreparedStatementFactory",
"jpsf",
",",
"Integer",
"attrOut",
")",
"throws",
"CpoException",
"{",
"logger",
".",
"debug",
"(",
"\"Inside TransformNoOp::transformOut(JdbcPreparedStatementFactory, \"",
"+",
"attr... | Transforms the data from the class attribute to the object required by the datasource. The type of the attrOut
parameter and the type of the return value must change to match the types being converted. Reflection is used to
true everything up at runtime.
e.g public Blob transformOut(JdbcPreparedStatementFactory jpsf, ... | [
"Transforms",
"the",
"data",
"from",
"the",
"class",
"attribute",
"to",
"the",
"object",
"required",
"by",
"the",
"datasource",
".",
"The",
"type",
"of",
"the",
"attrOut",
"parameter",
"and",
"the",
"type",
"of",
"the",
"return",
"value",
"must",
"change",
... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformNoOp.java#L94-L98 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.getFieldValue | public static <T> T getFieldValue(Object object, Class<?> clazz, String fieldName) {
"""
Get instance field value declared into superclass. Retrieve inherited field value from given instance throwing
exception if field is not declared into superclass.
@param object instance to retrieve field value from,
@para... | java | public static <T> T getFieldValue(Object object, Class<?> clazz, String fieldName)
{
return getFieldValue(object, clazz, fieldName, null, false);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getFieldValue",
"(",
"Object",
"object",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"fieldName",
")",
"{",
"return",
"getFieldValue",
"(",
"object",
",",
"clazz",
",",
"fieldName",
",",
"null",
",",
"f... | Get instance field value declared into superclass. Retrieve inherited field value from given instance throwing
exception if field is not declared into superclass.
@param object instance to retrieve field value from,
@param clazz instance superclass,
@param fieldName field name.
@param <T> field value type.
@return ins... | [
"Get",
"instance",
"field",
"value",
"declared",
"into",
"superclass",
".",
"Retrieve",
"inherited",
"field",
"value",
"from",
"given",
"instance",
"throwing",
"exception",
"if",
"field",
"is",
"not",
"declared",
"into",
"superclass",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L768-L771 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201811/networkservice/GetAllNetworks.java | GetAllNetworks.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
"""
Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws ... | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the NetworkService.
NetworkServiceInterface networkService =
adManagerServices.get(session, NetworkServiceInterface.class);
// Get all networks that you have access to ... | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the NetworkService.",
"NetworkServiceInterface",
"networkService",
"=",
"adManagerServices",
".",
"get",... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201811/networkservice/GetAllNetworks.java#L50-L73 |
landawn/AbacusUtil | src/com/landawn/abacus/util/DateUtil.java | DateUtil.addSeconds | public static <T extends Calendar> T addSeconds(final T calendar, final int amount) {
"""
Adds a number of seconds to a calendar returning a new object.
The original {@code Date} is unchanged.
@param calendar the calendar, not null
@param amount the amount to add, may be negative
@return the new {@code Dat... | java | public static <T extends Calendar> T addSeconds(final T calendar, final int amount) {
return roll(calendar, amount, CalendarUnit.SECOND);
} | [
"public",
"static",
"<",
"T",
"extends",
"Calendar",
">",
"T",
"addSeconds",
"(",
"final",
"T",
"calendar",
",",
"final",
"int",
"amount",
")",
"{",
"return",
"roll",
"(",
"calendar",
",",
"amount",
",",
"CalendarUnit",
".",
"SECOND",
")",
";",
"}"
] | Adds a number of seconds to a calendar returning a new object.
The original {@code Date} is unchanged.
@param calendar the calendar, not null
@param amount the amount to add, may be negative
@return the new {@code Date} with the amount added
@throws IllegalArgumentException if the calendar is null | [
"Adds",
"a",
"number",
"of",
"seconds",
"to",
"a",
"calendar",
"returning",
"a",
"new",
"object",
".",
"The",
"original",
"{",
"@code",
"Date",
"}",
"is",
"unchanged",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L1147-L1149 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsInner.java | DatabaseRecommendedActionsInner.listByDatabaseAdvisorAsync | public Observable<List<RecommendedActionInner>> listByDatabaseAdvisorAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) {
"""
Gets list of Database Recommended Actions.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain thi... | java | public Observable<List<RecommendedActionInner>> listByDatabaseAdvisorAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) {
return listByDatabaseAdvisorWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName).map(new Func1<ServiceResponse<List<Rec... | [
"public",
"Observable",
"<",
"List",
"<",
"RecommendedActionInner",
">",
">",
"listByDatabaseAdvisorAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"advisorName",
")",
"{",
"return",
"listByDatabas... | Gets list of Database Recommended Actions.
@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 databaseName The name of the database.
@param advisorName The name... | [
"Gets",
"list",
"of",
"Database",
"Recommended",
"Actions",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsInner.java#L114-L121 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java | ReferrerURLCookieHandler.createReferrerURLCookie | public Cookie createReferrerURLCookie(String cookieName, @Sensitive String url, HttpServletRequest req) {
"""
Create the referrer URL cookie.
This cookie should be session length (age == -1).
@param authResult
@param url
"""
if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl())
... | java | public Cookie createReferrerURLCookie(String cookieName, @Sensitive String url, HttpServletRequest req) {
if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl())
url = removeHostNameFromURL(url);
return createCookie(cookieName, url, req);
} | [
"public",
"Cookie",
"createReferrerURLCookie",
"(",
"String",
"cookieName",
",",
"@",
"Sensitive",
"String",
"url",
",",
"HttpServletRequest",
"req",
")",
"{",
"if",
"(",
"!",
"webAppSecConfig",
".",
"getPreserveFullyQualifiedReferrerUrl",
"(",
")",
")",
"url",
"=... | Create the referrer URL cookie.
This cookie should be session length (age == -1).
@param authResult
@param url | [
"Create",
"the",
"referrer",
"URL",
"cookie",
".",
"This",
"cookie",
"should",
"be",
"session",
"length",
"(",
"age",
"==",
"-",
"1",
")",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java#L69-L74 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java | EstimateSceneCalibrated.defineCoordinateSystem | void defineCoordinateSystem(View viewA, Motion motion) {
"""
Sets the origin and scale of the coordinate system
@param viewA The origin of the coordinate system
@param motion Motion which will define the coordinate system's scale
"""
View viewB = motion.destination(viewA);
viewA.viewToWorld.reset(); /... | java | void defineCoordinateSystem(View viewA, Motion motion) {
View viewB = motion.destination(viewA);
viewA.viewToWorld.reset(); // identity since it's the origin
viewB.viewToWorld.set(motion.motionSrcToDst(viewB));
// translation is only known up to a scale factor so pick a reasonable scale factor
double scale =... | [
"void",
"defineCoordinateSystem",
"(",
"View",
"viewA",
",",
"Motion",
"motion",
")",
"{",
"View",
"viewB",
"=",
"motion",
".",
"destination",
"(",
"viewA",
")",
";",
"viewA",
".",
"viewToWorld",
".",
"reset",
"(",
")",
";",
"// identity since it's the origin"... | Sets the origin and scale of the coordinate system
@param viewA The origin of the coordinate system
@param motion Motion which will define the coordinate system's scale | [
"Sets",
"the",
"origin",
"and",
"scale",
"of",
"the",
"coordinate",
"system"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/EstimateSceneCalibrated.java#L671-L720 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractSequence.java | AbstractSequence.addFeature | public void addFeature(int bioStart, int bioEnd, FeatureInterface<AbstractSequence<C>, C> feature) {
"""
Method to help set the proper details for a feature as it relates to a sequence
where the feature needs to have a location on the sequence
@param bioStart
@param bioEnd
@param feature
"""
SequenceLoca... | java | public void addFeature(int bioStart, int bioEnd, FeatureInterface<AbstractSequence<C>, C> feature) {
SequenceLocation<AbstractSequence<C>, C> sequenceLocation =
new SequenceLocation<AbstractSequence<C>, C>(bioStart, bioEnd, this);
feature.setLocation(sequenceLocation);
addFeature(feature);
} | [
"public",
"void",
"addFeature",
"(",
"int",
"bioStart",
",",
"int",
"bioEnd",
",",
"FeatureInterface",
"<",
"AbstractSequence",
"<",
"C",
">",
",",
"C",
">",
"feature",
")",
"{",
"SequenceLocation",
"<",
"AbstractSequence",
"<",
"C",
">",
",",
"C",
">",
... | Method to help set the proper details for a feature as it relates to a sequence
where the feature needs to have a location on the sequence
@param bioStart
@param bioEnd
@param feature | [
"Method",
"to",
"help",
"set",
"the",
"proper",
"details",
"for",
"a",
"feature",
"as",
"it",
"relates",
"to",
"a",
"sequence",
"where",
"the",
"feature",
"needs",
"to",
"have",
"a",
"location",
"on",
"the",
"sequence"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractSequence.java#L397-L402 |
KostyaSha/yet-another-docker-plugin | yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/utils/HostAndPortChecker.java | HostAndPortChecker.sleepFor | private static void sleepFor(int time, TimeUnit units) {
"""
Blocks current thread for {@code time} of {@code units}
@param time number of units
@param units to convert to millis
"""
try {
LOG.trace("Sleeping for {} {}", time, units.toString());
Thread.sleep(units.toMillis(... | java | private static void sleepFor(int time, TimeUnit units) {
try {
LOG.trace("Sleeping for {} {}", time, units.toString());
Thread.sleep(units.toMillis(time));
} catch (InterruptedException e) {
// no-op
}
} | [
"private",
"static",
"void",
"sleepFor",
"(",
"int",
"time",
",",
"TimeUnit",
"units",
")",
"{",
"try",
"{",
"LOG",
".",
"trace",
"(",
"\"Sleeping for {} {}\"",
",",
"time",
",",
"units",
".",
"toString",
"(",
")",
")",
";",
"Thread",
".",
"sleep",
"("... | Blocks current thread for {@code time} of {@code units}
@param time number of units
@param units to convert to millis | [
"Blocks",
"current",
"thread",
"for",
"{",
"@code",
"time",
"}",
"of",
"{",
"@code",
"units",
"}"
] | train | https://github.com/KostyaSha/yet-another-docker-plugin/blob/40b12e39ff94c3834cff7e028c3dd01c88e87d77/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/utils/HostAndPortChecker.java#L111-L118 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java | SARLImages.forCapacity | public ImageDescriptor forCapacity(JvmVisibility visibility, int flags) {
"""
Replies the image descriptor for the "capacities".
@param visibility the visibility of the capacity.
@param flags the mark flags. See {@link JavaElementImageDescriptor#setAdornments(int)} for
a description of the available flags.
@... | java | public ImageDescriptor forCapacity(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.CAPACITY, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | [
"public",
"ImageDescriptor",
"forCapacity",
"(",
"JvmVisibility",
"visibility",
",",
"int",
"flags",
")",
"{",
"return",
"getDecorated",
"(",
"getTypeImageDescriptor",
"(",
"SarlElementType",
".",
"CAPACITY",
",",
"false",
",",
"false",
",",
"toFlags",
"(",
"visib... | Replies the image descriptor for the "capacities".
@param visibility the visibility of the capacity.
@param flags the mark flags. See {@link JavaElementImageDescriptor#setAdornments(int)} for
a description of the available flags.
@return the image descriptor for the capacities. | [
"Replies",
"the",
"image",
"descriptor",
"for",
"the",
"capacities",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java#L151-L154 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsPopup.java | CmsPopup.adjustIndex | protected int adjustIndex(Widget child, int beforeIndex) {
"""
Adjusts beforeIndex to account for the possibility that the given widget is
already a child of this panel.
@param child the widget that might be an existing child
@param beforeIndex the index at which it will be added to this panel
@return the mo... | java | protected int adjustIndex(Widget child, int beforeIndex) {
checkIndexBoundsForInsertion(beforeIndex);
// Check to see if this widget is already a direct child.
if (child.getParent() == this) {
// If the Widget's previous position was left of the desired new position
// ... | [
"protected",
"int",
"adjustIndex",
"(",
"Widget",
"child",
",",
"int",
"beforeIndex",
")",
"{",
"checkIndexBoundsForInsertion",
"(",
"beforeIndex",
")",
";",
"// Check to see if this widget is already a direct child.",
"if",
"(",
"child",
".",
"getParent",
"(",
")",
"... | Adjusts beforeIndex to account for the possibility that the given widget is
already a child of this panel.
@param child the widget that might be an existing child
@param beforeIndex the index at which it will be added to this panel
@return the modified index | [
"Adjusts",
"beforeIndex",
"to",
"account",
"for",
"the",
"possibility",
"that",
"the",
"given",
"widget",
"is",
"already",
"a",
"child",
"of",
"this",
"panel",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsPopup.java#L1081-L1096 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/Duration.java | Duration.ofMillis | public static Duration ofMillis(long millis) {
"""
Obtains an instance of {@code Duration} from a number of milliseconds.
<p>
The seconds and nanoseconds are extracted from the specified milliseconds.
@param millis the number of milliseconds, positive or negative
@return a {@code Duration}, not null
"""... | java | public static Duration ofMillis(long millis) {
long secs = millis / 1000;
int mos = (int) (millis % 1000);
if (mos < 0) {
mos += 1000;
secs--;
}
return create(secs, mos * NANOS_PER_MILLI);
} | [
"public",
"static",
"Duration",
"ofMillis",
"(",
"long",
"millis",
")",
"{",
"long",
"secs",
"=",
"millis",
"/",
"1000",
";",
"int",
"mos",
"=",
"(",
"int",
")",
"(",
"millis",
"%",
"1000",
")",
";",
"if",
"(",
"mos",
"<",
"0",
")",
"{",
"mos",
... | Obtains an instance of {@code Duration} from a number of milliseconds.
<p>
The seconds and nanoseconds are extracted from the specified milliseconds.
@param millis the number of milliseconds, positive or negative
@return a {@code Duration}, not null | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"Duration",
"}",
"from",
"a",
"number",
"of",
"milliseconds",
".",
"<p",
">",
"The",
"seconds",
"and",
"nanoseconds",
"are",
"extracted",
"from",
"the",
"specified",
"milliseconds",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/Duration.java#L227-L235 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.writePng | public static void writePng(Image image, ImageOutputStream destImageStream) throws IORuntimeException {
"""
写出图像为PNG格式
@param image {@link Image}
@param destImageStream 写出到的目标流
@throws IORuntimeException IO异常
"""
write(image, IMAGE_TYPE_PNG, destImageStream);
} | java | public static void writePng(Image image, ImageOutputStream destImageStream) throws IORuntimeException {
write(image, IMAGE_TYPE_PNG, destImageStream);
} | [
"public",
"static",
"void",
"writePng",
"(",
"Image",
"image",
",",
"ImageOutputStream",
"destImageStream",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"image",
",",
"IMAGE_TYPE_PNG",
",",
"destImageStream",
")",
";",
"}"
] | 写出图像为PNG格式
@param image {@link Image}
@param destImageStream 写出到的目标流
@throws IORuntimeException IO异常 | [
"写出图像为PNG格式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1365-L1367 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java | WaveformPreviewComponent.drawCueList | private void drawCueList(Graphics g, Rectangle clipRect) {
"""
Draw the visible memory cue points or hot cues.
@param g the graphics object in which we are being rendered
@param clipRect the region that is being currently rendered
"""
for (CueList.Entry entry : cueList.get().entries) {
... | java | private void drawCueList(Graphics g, Rectangle clipRect) {
for (CueList.Entry entry : cueList.get().entries) {
final int x = millisecondsToX(entry.cueTime);
if ((x > clipRect.x - 4) && (x < clipRect.x + clipRect.width + 4)) {
g.setColor(WaveformDetailComponent.cueColor(en... | [
"private",
"void",
"drawCueList",
"(",
"Graphics",
"g",
",",
"Rectangle",
"clipRect",
")",
"{",
"for",
"(",
"CueList",
".",
"Entry",
"entry",
":",
"cueList",
".",
"get",
"(",
")",
".",
"entries",
")",
"{",
"final",
"int",
"x",
"=",
"millisecondsToX",
"... | Draw the visible memory cue points or hot cues.
@param g the graphics object in which we are being rendered
@param clipRect the region that is being currently rendered | [
"Draw",
"the",
"visible",
"memory",
"cue",
"points",
"or",
"hot",
"cues",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java#L809-L819 |
jenkinsci/github-plugin | src/main/java/com/coravy/hudson/plugins/github/GithubProjectProperty.java | GithubProjectProperty.displayNameFor | public static String displayNameFor(@Nonnull Job<?, ?> job) {
"""
Extracts value of display name from given job, or just returns full name if field or prop is not defined
@param job project which wants to get current context name to use in GH status API
@return display name or full job name if field is not d... | java | public static String displayNameFor(@Nonnull Job<?, ?> job) {
GithubProjectProperty ghProp = job.getProperty(GithubProjectProperty.class);
if (ghProp != null && isNotBlank(ghProp.getDisplayName())) {
return ghProp.getDisplayName();
}
return job.getFullName();
} | [
"public",
"static",
"String",
"displayNameFor",
"(",
"@",
"Nonnull",
"Job",
"<",
"?",
",",
"?",
">",
"job",
")",
"{",
"GithubProjectProperty",
"ghProp",
"=",
"job",
".",
"getProperty",
"(",
"GithubProjectProperty",
".",
"class",
")",
";",
"if",
"(",
"ghPro... | Extracts value of display name from given job, or just returns full name if field or prop is not defined
@param job project which wants to get current context name to use in GH status API
@return display name or full job name if field is not defined
@since 1.14.1 | [
"Extracts",
"value",
"of",
"display",
"name",
"from",
"given",
"job",
"or",
"just",
"returns",
"full",
"name",
"if",
"field",
"or",
"prop",
"is",
"not",
"defined"
] | train | https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/com/coravy/hudson/plugins/github/GithubProjectProperty.java#L91-L98 |
zaproxy/zaproxy | src/org/zaproxy/zap/network/ZapPutMethod.java | ZapPutMethod.readResponseHeaders | @Override
protected void readResponseHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException {
"""
/*
Implementation copied from HttpMethodBase#readResponseHeaders(HttpState, HttpConnection) but changed to use a custom
header parser (ZapHttpParser#parseHeaders(InputStream, String)).
... | java | @Override
protected void readResponseHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException {
getResponseHeaderGroup().clear();
Header[] headers = ZapHttpParser.parseHeaders(conn.getResponseInputStream(), getParams().getHttpElementCharset());
// Wire logging moved t... | [
"@",
"Override",
"protected",
"void",
"readResponseHeaders",
"(",
"HttpState",
"state",
",",
"HttpConnection",
"conn",
")",
"throws",
"IOException",
",",
"HttpException",
"{",
"getResponseHeaderGroup",
"(",
")",
".",
"clear",
"(",
")",
";",
"Header",
"[",
"]",
... | /*
Implementation copied from HttpMethodBase#readResponseHeaders(HttpState, HttpConnection) but changed to use a custom
header parser (ZapHttpParser#parseHeaders(InputStream, String)). | [
"/",
"*",
"Implementation",
"copied",
"from",
"HttpMethodBase#readResponseHeaders",
"(",
"HttpState",
"HttpConnection",
")",
"but",
"changed",
"to",
"use",
"a",
"custom",
"header",
"parser",
"(",
"ZapHttpParser#parseHeaders",
"(",
"InputStream",
"String",
"))",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/network/ZapPutMethod.java#L54-L61 |
apache/groovy | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.newInstance | public static Sql newInstance(String url, String driverClassName) throws SQLException, ClassNotFoundException {
"""
Creates a new Sql instance given a JDBC connection URL
and a driver class name.
@param url a database url of the form
<code>jdbc:<em>subprotocol</em>:<em>subname</em></code>
@param ... | java | public static Sql newInstance(String url, String driverClassName) throws SQLException, ClassNotFoundException {
loadDriver(driverClassName);
return newInstance(url);
} | [
"public",
"static",
"Sql",
"newInstance",
"(",
"String",
"url",
",",
"String",
"driverClassName",
")",
"throws",
"SQLException",
",",
"ClassNotFoundException",
"{",
"loadDriver",
"(",
"driverClassName",
")",
";",
"return",
"newInstance",
"(",
"url",
")",
";",
"}... | Creates a new Sql instance given a JDBC connection URL
and a driver class name.
@param url a database url of the form
<code>jdbc:<em>subprotocol</em>:<em>subname</em></code>
@param driverClassName the fully qualified class name of the driver class
@return a new Sql instance with a connection
@throws SQLExc... | [
"Creates",
"a",
"new",
"Sql",
"instance",
"given",
"a",
"JDBC",
"connection",
"URL",
"and",
"a",
"driver",
"class",
"name",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L470-L473 |
ZieIony/Carbon | carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java | LayerDrawable.setLayerSize | public void setLayerSize(int index, int w, int h) {
"""
Sets an explicit size for the specified layer.
<p/>
<strong>Note:</strong> Setting an explicit layer size changes the
default layer gravity behavior. See {@link #setLayerGravity(int, int)} for more information.
@param index the index of the layer to adj... | java | public void setLayerSize(int index, int w, int h) {
final ChildDrawable childDrawable = mLayerState.mChildren[index];
childDrawable.mWidth = w;
childDrawable.mHeight = h;
} | [
"public",
"void",
"setLayerSize",
"(",
"int",
"index",
",",
"int",
"w",
",",
"int",
"h",
")",
"{",
"final",
"ChildDrawable",
"childDrawable",
"=",
"mLayerState",
".",
"mChildren",
"[",
"index",
"]",
";",
"childDrawable",
".",
"mWidth",
"=",
"w",
";",
"ch... | Sets an explicit size for the specified layer.
<p/>
<strong>Note:</strong> Setting an explicit layer size changes the
default layer gravity behavior. See {@link #setLayerGravity(int, int)} for more information.
@param index the index of the layer to adjust
@param w width in pixels, or -1 to use the intrinsic width... | [
"Sets",
"an",
"explicit",
"size",
"for",
"the",
"specified",
"layer",
".",
"<p",
"/",
">",
"<strong",
">",
"Note",
":",
"<",
"/",
"strong",
">",
"Setting",
"an",
"explicit",
"layer",
"size",
"changes",
"the",
"default",
"layer",
"gravity",
"behavior",
".... | train | https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java#L578-L582 |
arquillian/arquillian-cube | core/src/main/java/org/arquillian/cube/impl/util/ConfigUtil.java | ConfigUtil.getStringProperty | public static String getStringProperty(String name, Map<String, String> map, String defaultValue) {
"""
Gets a property from system, environment or an external map.
The lookup order is system > env > map > defaultValue.
@param name
The name of the property.
@param map
The external map.
@param defaultValue
... | java | public static String getStringProperty(String name, Map<String, String> map, String defaultValue) {
if (map.containsKey(name) && Strings.isNotNullOrEmpty(map.get(name))) {
defaultValue = map.get(name);
}
return getPropertyOrEnvironmentVariable(name, defaultValue);
} | [
"public",
"static",
"String",
"getStringProperty",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"String",
">",
"map",
",",
"String",
"defaultValue",
")",
"{",
"if",
"(",
"map",
".",
"containsKey",
"(",
"name",
")",
"&&",
"Strings",
".",
"isNotN... | Gets a property from system, environment or an external map.
The lookup order is system > env > map > defaultValue.
@param name
The name of the property.
@param map
The external map.
@param defaultValue
The value that should be used if property is not found. | [
"Gets",
"a",
"property",
"from",
"system",
"environment",
"or",
"an",
"external",
"map",
".",
"The",
"lookup",
"order",
"is",
"system",
">",
"env",
">",
"map",
">",
"defaultValue",
"."
] | train | https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/core/src/main/java/org/arquillian/cube/impl/util/ConfigUtil.java#L25-L30 |
kmi/iserve | iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/util/UriUtil.java | UriUtil.getUniqueId | public static String getUniqueId(URI resourceUri, URI basePath) {
"""
Given the URI of a resource it returns the Unique ID.
In reality this obtains the first path element after the basePath.
Checks for those that are local to the server only. Developed both for hash and slash URIs.
Works in iServe on the basi... | java | public static String getUniqueId(URI resourceUri, URI basePath) {
String result = null;
URI relativeUri = basePath.relativize(resourceUri);
// If it is relative the first part of the path is the Unique ID
if (!relativeUri.isAbsolute()) {
result = relativeUri.toASCIIString();
... | [
"public",
"static",
"String",
"getUniqueId",
"(",
"URI",
"resourceUri",
",",
"URI",
"basePath",
")",
"{",
"String",
"result",
"=",
"null",
";",
"URI",
"relativeUri",
"=",
"basePath",
".",
"relativize",
"(",
"resourceUri",
")",
";",
"// If it is relative the firs... | Given the URI of a resource it returns the Unique ID.
In reality this obtains the first path element after the basePath.
Checks for those that are local to the server only. Developed both for hash and slash URIs.
Works in iServe on the basis of the following assumption behind resource URIs:
http://host:port/...some..... | [
"Given",
"the",
"URI",
"of",
"a",
"resource",
"it",
"returns",
"the",
"Unique",
"ID",
".",
"In",
"reality",
"this",
"obtains",
"the",
"first",
"path",
"element",
"after",
"the",
"basePath",
".",
"Checks",
"for",
"those",
"that",
"are",
"local",
"to",
"th... | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/util/UriUtil.java#L46-L61 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/metric/MicrometerUtil.java | MicrometerUtil.registerLater | public static <T> void registerLater(MeterRegistry registry, MeterIdPrefix idPrefix, Class<T> type,
BiFunction<MeterRegistry, MeterIdPrefix, T> factory) {
"""
Similar to {@link #register(MeterRegistry, MeterIdPrefix, Class, BiFunction)}, but used when
a registration has to... | java | public static <T> void registerLater(MeterRegistry registry, MeterIdPrefix idPrefix, Class<T> type,
BiFunction<MeterRegistry, MeterIdPrefix, T> factory) {
final RegistrationState registrationState = MicrometerUtil.registrationState.get();
if (!registrationState.... | [
"public",
"static",
"<",
"T",
">",
"void",
"registerLater",
"(",
"MeterRegistry",
"registry",
",",
"MeterIdPrefix",
"idPrefix",
",",
"Class",
"<",
"T",
">",
"type",
",",
"BiFunction",
"<",
"MeterRegistry",
",",
"MeterIdPrefix",
",",
"T",
">",
"factory",
")",... | Similar to {@link #register(MeterRegistry, MeterIdPrefix, Class, BiFunction)}, but used when
a registration has to be nested, because otherwise the registration may enter an infinite loop,
as described <a href="https://bugs.openjdk.java.net/browse/JDK-8062841">here</a>. For example:
<pre>{@code
// OK
register(registry,... | [
"Similar",
"to",
"{",
"@link",
"#register",
"(",
"MeterRegistry",
"MeterIdPrefix",
"Class",
"BiFunction",
")",
"}",
"but",
"used",
"when",
"a",
"registration",
"has",
"to",
"be",
"nested",
"because",
"otherwise",
"the",
"registration",
"may",
"enter",
"an",
"i... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/metric/MicrometerUtil.java#L145-L155 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/data/StringValueMap.java | StringValueMap.fromMaps | public static StringValueMap fromMaps(Map<?, ?>... maps) {
"""
Creates a new AnyValueMap by merging two or more maps. Maps defined later in
the list override values from previously defined maps.
@param maps an array of maps to be merged
@return a newly created AnyValueMap.
"""
StringValueMap result = ne... | java | public static StringValueMap fromMaps(Map<?, ?>... maps) {
StringValueMap result = new StringValueMap();
if (maps != null && maps.length > 0) {
for (Map<?, ?> map : maps)
result.append(map);
}
return result;
} | [
"public",
"static",
"StringValueMap",
"fromMaps",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"...",
"maps",
")",
"{",
"StringValueMap",
"result",
"=",
"new",
"StringValueMap",
"(",
")",
";",
"if",
"(",
"maps",
"!=",
"null",
"&&",
"maps",
".",
"length",
">",
... | Creates a new AnyValueMap by merging two or more maps. Maps defined later in
the list override values from previously defined maps.
@param maps an array of maps to be merged
@return a newly created AnyValueMap. | [
"Creates",
"a",
"new",
"AnyValueMap",
"by",
"merging",
"two",
"or",
"more",
"maps",
".",
"Maps",
"defined",
"later",
"in",
"the",
"list",
"override",
"values",
"from",
"previously",
"defined",
"maps",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/StringValueMap.java#L723-L730 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-rules/src/main/java/org/switchyard/component/rules/exchange/RulesExchangeHandler.java | RulesExchangeHandler.isDispose | private boolean isDispose(Exchange exchange, Message message) {
"""
/*
private boolean isContinue(Exchange exchange, Message message) {
return isBoolean(exchange, message, RulesConstants.CONTINUE_PROPERTY);
}
"""
return isBoolean(exchange, message, RulesConstants.DISPOSE_PROPERTY);
} | java | private boolean isDispose(Exchange exchange, Message message) {
return isBoolean(exchange, message, RulesConstants.DISPOSE_PROPERTY);
} | [
"private",
"boolean",
"isDispose",
"(",
"Exchange",
"exchange",
",",
"Message",
"message",
")",
"{",
"return",
"isBoolean",
"(",
"exchange",
",",
"message",
",",
"RulesConstants",
".",
"DISPOSE_PROPERTY",
")",
";",
"}"
] | /*
private boolean isContinue(Exchange exchange, Message message) {
return isBoolean(exchange, message, RulesConstants.CONTINUE_PROPERTY);
} | [
"/",
"*",
"private",
"boolean",
"isContinue",
"(",
"Exchange",
"exchange",
"Message",
"message",
")",
"{",
"return",
"isBoolean",
"(",
"exchange",
"message",
"RulesConstants",
".",
"CONTINUE_PROPERTY",
")",
";",
"}"
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-rules/src/main/java/org/switchyard/component/rules/exchange/RulesExchangeHandler.java#L287-L289 |
danielnorberg/rut | rut/src/main/java/io/norberg/rut/Encoding.java | Encoding.utf8Read3 | private static int utf8Read3(int cu1, int cu2, int cu3) {
"""
Read a 3 byte UTF8 sequence.
@return the resulting code point or {@link #INVALID} if invalid.
"""
if ((cu2 & 0xC0) != 0x80) {
return INVALID;
}
if (cu1 == 0xE0 && cu2 < 0xA0) {
// overlong
return INVALID;
}
i... | java | private static int utf8Read3(int cu1, int cu2, int cu3) {
if ((cu2 & 0xC0) != 0x80) {
return INVALID;
}
if (cu1 == 0xE0 && cu2 < 0xA0) {
// overlong
return INVALID;
}
if ((cu3 & 0xC0) != 0x80) {
return INVALID;
}
return (cu1 << 12) + (cu2 << 6) + cu3 - 0xE2080;
} | [
"private",
"static",
"int",
"utf8Read3",
"(",
"int",
"cu1",
",",
"int",
"cu2",
",",
"int",
"cu3",
")",
"{",
"if",
"(",
"(",
"cu2",
"&",
"0xC0",
")",
"!=",
"0x80",
")",
"{",
"return",
"INVALID",
";",
"}",
"if",
"(",
"cu1",
"==",
"0xE0",
"&&",
"c... | Read a 3 byte UTF8 sequence.
@return the resulting code point or {@link #INVALID} if invalid. | [
"Read",
"a",
"3",
"byte",
"UTF8",
"sequence",
"."
] | train | https://github.com/danielnorberg/rut/blob/6cd99e0d464da934d446b554ab5bbecaf294fcdc/rut/src/main/java/io/norberg/rut/Encoding.java#L224-L236 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java | AttributeDefinition.resolveValue | public ModelNode resolveValue(final ExpressionResolver resolver, final ModelNode value) throws OperationFailedException {
"""
Takes the given {@code value}, resolves it using the given {@code resolver}
and validates it using this attribute's {@link #getValidator() validator}. If the value is
undefined and a {@li... | java | public ModelNode resolveValue(final ExpressionResolver resolver, final ModelNode value) throws OperationFailedException {
final ModelNode node = value.clone();
if (!node.isDefined() && defaultValue != null && defaultValue.isDefined()) {
node.set(defaultValue);
}
ModelNode res... | [
"public",
"ModelNode",
"resolveValue",
"(",
"final",
"ExpressionResolver",
"resolver",
",",
"final",
"ModelNode",
"value",
")",
"throws",
"OperationFailedException",
"{",
"final",
"ModelNode",
"node",
"=",
"value",
".",
"clone",
"(",
")",
";",
"if",
"(",
"!",
... | Takes the given {@code value}, resolves it using the given {@code resolver}
and validates it using this attribute's {@link #getValidator() validator}. If the value is
undefined and a {@link #getDefaultValue() default value} is available, the default value is used.
@param resolver the expression resolver
@param value a... | [
"Takes",
"the",
"given",
"{",
"@code",
"value",
"}",
"resolves",
"it",
"using",
"the",
"given",
"{",
"@code",
"resolver",
"}",
"and",
"validates",
"it",
"using",
"this",
"attribute",
"s",
"{",
"@link",
"#getValidator",
"()",
"validator",
"}",
".",
"If",
... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L662-L671 |
alkacon/opencms-core | src/org/opencms/util/CmsFileUtil.java | CmsFileUtil.createFileWalkState | private static FileWalkState createFileWalkState(File file) {
"""
Helper method for creating a FileWalkState object from a File object.<p>
@param file the file
@return the file walk state
"""
File[] contents = file.listFiles();
List<File> dirs = new ArrayList<File>();
List<File> ... | java | private static FileWalkState createFileWalkState(File file) {
File[] contents = file.listFiles();
List<File> dirs = new ArrayList<File>();
List<File> files = new ArrayList<File>();
for (File subFile : contents) {
if (subFile.isDirectory()) {
dirs.add(subFile)... | [
"private",
"static",
"FileWalkState",
"createFileWalkState",
"(",
"File",
"file",
")",
"{",
"File",
"[",
"]",
"contents",
"=",
"file",
".",
"listFiles",
"(",
")",
";",
"List",
"<",
"File",
">",
"dirs",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")... | Helper method for creating a FileWalkState object from a File object.<p>
@param file the file
@return the file walk state | [
"Helper",
"method",
"for",
"creating",
"a",
"FileWalkState",
"object",
"from",
"a",
"File",
"object",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsFileUtil.java#L964-L977 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java | FileInfo.addModificationTimeToAttributes | public static void addModificationTimeToAttributes(Map<String, byte[]> attributes, Clock clock) {
"""
Add a key and value representing the current time, as determined by the passed clock, to the
passed attributes dictionary.
@param attributes The file attributes map to update
@param clock The clock to retrieve ... | java | public static void addModificationTimeToAttributes(Map<String, byte[]> attributes, Clock clock) {
attributes.put(FILE_MODIFICATION_TIMESTAMP_KEY, Longs.toByteArray(clock.currentTimeMillis()));
} | [
"public",
"static",
"void",
"addModificationTimeToAttributes",
"(",
"Map",
"<",
"String",
",",
"byte",
"[",
"]",
">",
"attributes",
",",
"Clock",
"clock",
")",
"{",
"attributes",
".",
"put",
"(",
"FILE_MODIFICATION_TIMESTAMP_KEY",
",",
"Longs",
".",
"toByteArray... | Add a key and value representing the current time, as determined by the passed clock, to the
passed attributes dictionary.
@param attributes The file attributes map to update
@param clock The clock to retrieve the current time from | [
"Add",
"a",
"key",
"and",
"value",
"representing",
"the",
"current",
"time",
"as",
"determined",
"by",
"the",
"passed",
"clock",
"to",
"the",
"passed",
"attributes",
"dictionary",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/FileInfo.java#L217-L219 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java | TimeZone.getTimeZone | private static TimeZone getTimeZone(String id, int type, boolean frozen) {
"""
Gets the <code>TimeZone</code> for the given ID and the timezone type.
@param id time zone ID
@param type time zone implementation type, TIMEZONE_JDK or TIMEZONE_ICU
@param frozen specify if the returned object can be frozen
@return... | java | private static TimeZone getTimeZone(String id, int type, boolean frozen) {
TimeZone result;
if (type == TIMEZONE_JDK) {
result = JavaTimeZone.createTimeZone(id);
if (result != null) {
return frozen ? result.freeze() : result;
}
result = get... | [
"private",
"static",
"TimeZone",
"getTimeZone",
"(",
"String",
"id",
",",
"int",
"type",
",",
"boolean",
"frozen",
")",
"{",
"TimeZone",
"result",
";",
"if",
"(",
"type",
"==",
"TIMEZONE_JDK",
")",
"{",
"result",
"=",
"JavaTimeZone",
".",
"createTimeZone",
... | Gets the <code>TimeZone</code> for the given ID and the timezone type.
@param id time zone ID
@param type time zone implementation type, TIMEZONE_JDK or TIMEZONE_ICU
@param frozen specify if the returned object can be frozen
@return the specified <code>TimeZone</code> or UNKNOWN_ZONE if the given ID
cannot be understoo... | [
"Gets",
"the",
"<code",
">",
"TimeZone<",
"/",
"code",
">",
"for",
"the",
"given",
"ID",
"and",
"the",
"timezone",
"type",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java#L683-L699 |
alipay/sofa-rpc | core/common/src/main/java/com/alipay/sofa/rpc/common/utils/FileUtils.java | FileUtils.file2String | public static String file2String(Class clazz, String relativePath, String encoding) throws IOException {
"""
读取类相对路径内容
@param clazz 文件
@param relativePath 相对路径
@param encoding 编码
@return 文件内容
@throws IOException 发送IO异常
"""
InputStream is = null;
InputStreamReader reader = null... | java | public static String file2String(Class clazz, String relativePath, String encoding) throws IOException {
InputStream is = null;
InputStreamReader reader = null;
BufferedReader bufferedReader = null;
try {
is = clazz.getResourceAsStream(relativePath);
reader = new ... | [
"public",
"static",
"String",
"file2String",
"(",
"Class",
"clazz",
",",
"String",
"relativePath",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"null",
";",
"InputStreamReader",
"reader",
"=",
"null",
";",
"BufferedRead... | 读取类相对路径内容
@param clazz 文件
@param relativePath 相对路径
@param encoding 编码
@return 文件内容
@throws IOException 发送IO异常 | [
"读取类相对路径内容"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/FileUtils.java#L141-L166 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session/src/com/ibm/ws/session/StoreCallback.java | StoreCallback.sessionMaxInactiveTimeSet | public void sessionMaxInactiveTimeSet(ISession session, int old, int newval) {
"""
Method sessionMaxInactiveTimeSet
<p>
@param session
@param old
@param newval
@see com.ibm.wsspi.session.IStoreCallback#sessionMaxInactiveTimeSet(com.ibm.wsspi.session.ISession, int, int)
"""
_sessionStateEventDisp... | java | public void sessionMaxInactiveTimeSet(ISession session, int old, int newval) {
_sessionStateEventDispatcher.sessionMaxInactiveTimeSet(session, old, newval);
} | [
"public",
"void",
"sessionMaxInactiveTimeSet",
"(",
"ISession",
"session",
",",
"int",
"old",
",",
"int",
"newval",
")",
"{",
"_sessionStateEventDispatcher",
".",
"sessionMaxInactiveTimeSet",
"(",
"session",
",",
"old",
",",
"newval",
")",
";",
"}"
] | Method sessionMaxInactiveTimeSet
<p>
@param session
@param old
@param newval
@see com.ibm.wsspi.session.IStoreCallback#sessionMaxInactiveTimeSet(com.ibm.wsspi.session.ISession, int, int) | [
"Method",
"sessionMaxInactiveTimeSet",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/StoreCallback.java#L238-L241 |
teatrove/teatrove | trove/src/main/java/org/teatrove/trove/net/HttpClient.java | HttpClient.setHeader | public HttpClient setHeader(String name, Object value) {
"""
Set a header name-value pair to the request.
@return 'this', so that addtional calls may be chained together
"""
if (mHeaders == null) {
mHeaders = new HttpHeaderMap();
}
mHeaders.put(name, value);
retur... | java | public HttpClient setHeader(String name, Object value) {
if (mHeaders == null) {
mHeaders = new HttpHeaderMap();
}
mHeaders.put(name, value);
return this;
} | [
"public",
"HttpClient",
"setHeader",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"mHeaders",
"==",
"null",
")",
"{",
"mHeaders",
"=",
"new",
"HttpHeaderMap",
"(",
")",
";",
"}",
"mHeaders",
".",
"put",
"(",
"name",
",",
"value",... | Set a header name-value pair to the request.
@return 'this', so that addtional calls may be chained together | [
"Set",
"a",
"header",
"name",
"-",
"value",
"pair",
"to",
"the",
"request",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/HttpClient.java#L116-L122 |
zk1931/jzab | src/main/java/com/github/zk1931/jzab/MessageBuilder.java | MessageBuilder.buildNewEpochMessage | public static Message buildNewEpochMessage(long epoch, int syncTimeoutMs) {
"""
Creates a NEW_EPOCH message.
@param epoch the new proposed epoch number.
@param syncTimeoutMs the timeout for synchronization.
@return the protobuf message.
"""
NewEpoch nEpoch = NewEpoch.newBuilder()
... | java | public static Message buildNewEpochMessage(long epoch, int syncTimeoutMs) {
NewEpoch nEpoch = NewEpoch.newBuilder()
.setNewEpoch(epoch)
.setSyncTimeout(syncTimeoutMs)
.build();
return Message.newBuilder().setType(MessageT... | [
"public",
"static",
"Message",
"buildNewEpochMessage",
"(",
"long",
"epoch",
",",
"int",
"syncTimeoutMs",
")",
"{",
"NewEpoch",
"nEpoch",
"=",
"NewEpoch",
".",
"newBuilder",
"(",
")",
".",
"setNewEpoch",
"(",
"epoch",
")",
".",
"setSyncTimeout",
"(",
"syncTime... | Creates a NEW_EPOCH message.
@param epoch the new proposed epoch number.
@param syncTimeoutMs the timeout for synchronization.
@return the protobuf message. | [
"Creates",
"a",
"NEW_EPOCH",
"message",
"."
] | train | https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/MessageBuilder.java#L138-L146 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractSetMandatory.java | AbstractSetMandatory.applyAction | @Override
protected void applyAction(final SubordinateTarget target, final Object value) {
"""
Apply the action against the target.
@param target the target of this action
@param value is the evaluated value
"""
// Should always be Boolean, but check anyway
if (value instanceof Boolean) {
applyMand... | java | @Override
protected void applyAction(final SubordinateTarget target, final Object value) {
// Should always be Boolean, but check anyway
if (value instanceof Boolean) {
applyMandatoryAction(target, ((Boolean) value));
}
} | [
"@",
"Override",
"protected",
"void",
"applyAction",
"(",
"final",
"SubordinateTarget",
"target",
",",
"final",
"Object",
"value",
")",
"{",
"// Should always be Boolean, but check anyway",
"if",
"(",
"value",
"instanceof",
"Boolean",
")",
"{",
"applyMandatoryAction",
... | Apply the action against the target.
@param target the target of this action
@param value is the evaluated value | [
"Apply",
"the",
"action",
"against",
"the",
"target",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractSetMandatory.java#L32-L38 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/models/HullWhiteModelWithShiftExtension.java | HullWhiteModelWithShiftExtension.getA | private double getA(double time, double maturity) {
"""
Returns A(t,T) where
\( A(t,T) = P(T)/P(t) \cdot exp(B(t,T) \cdot f(0,t) - \frac{1}{2} \phi(0,t) * B(t,T)^{2} ) \)
and
\( \phi(t,T) \) is the value calculated from integrating \( ( \sigma(s) exp(-\int_{s}^{T} a(\tau) \mathrm{d}\tau ) )^{2} \) with respect ... | java | private double getA(double time, double maturity) {
int timeIndex = getProcess().getTimeIndex(time);
double timeStep = getProcess().getTimeDiscretization().getTimeStep(timeIndex);
double dt = timeStep;
double zeroRate = -Math.log(discountCurveFromForwardCurve.getDiscountFactor(time+dt)/discountCurveFromForward... | [
"private",
"double",
"getA",
"(",
"double",
"time",
",",
"double",
"maturity",
")",
"{",
"int",
"timeIndex",
"=",
"getProcess",
"(",
")",
".",
"getTimeIndex",
"(",
"time",
")",
";",
"double",
"timeStep",
"=",
"getProcess",
"(",
")",
".",
"getTimeDiscretiza... | Returns A(t,T) where
\( A(t,T) = P(T)/P(t) \cdot exp(B(t,T) \cdot f(0,t) - \frac{1}{2} \phi(0,t) * B(t,T)^{2} ) \)
and
\( \phi(t,T) \) is the value calculated from integrating \( ( \sigma(s) exp(-\int_{s}^{T} a(\tau) \mathrm{d}\tau ) )^{2} \) with respect to s from t to T
in <code>getShortRateConditionalVariance</code>... | [
"Returns",
"A",
"(",
"t",
"T",
")",
"where",
"\\",
"(",
"A",
"(",
"t",
"T",
")",
"=",
"P",
"(",
"T",
")",
"/",
"P",
"(",
"t",
")",
"\\",
"cdot",
"exp",
"(",
"B",
"(",
"t",
"T",
")",
"\\",
"cdot",
"f",
"(",
"0",
"t",
")",
"-",
"\\",
... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/models/HullWhiteModelWithShiftExtension.java#L437-L450 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/api/loader/FileBatch.java | FileBatch.forFiles | public static FileBatch forFiles(List<File> files) throws IOException {
"""
Create a FileBatch from the specified files
@param files Files to create the FileBatch from
@return The created FileBatch
@throws IOException If an error occurs during reading of the file content
"""
List<String> origPaths... | java | public static FileBatch forFiles(List<File> files) throws IOException {
List<String> origPaths = new ArrayList<>(files.size());
List<byte[]> bytes = new ArrayList<>(files.size());
for (File f : files) {
bytes.add(FileUtils.readFileToByteArray(f));
origPaths.add(f.toURI().... | [
"public",
"static",
"FileBatch",
"forFiles",
"(",
"List",
"<",
"File",
">",
"files",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"origPaths",
"=",
"new",
"ArrayList",
"<>",
"(",
"files",
".",
"size",
"(",
")",
")",
";",
"List",
"<",
... | Create a FileBatch from the specified files
@param files Files to create the FileBatch from
@return The created FileBatch
@throws IOException If an error occurs during reading of the file content | [
"Create",
"a",
"FileBatch",
"from",
"the",
"specified",
"files"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/api/loader/FileBatch.java#L105-L113 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/Circle.java | Circle.prepare | @Override
protected boolean prepare(final Context2D context, final Attributes attr, final double alpha) {
"""
Draws this circle
@param context the {@link Context2D} used to draw this circle.
"""
final double r = attr.getRadius();
if (r > 0)
{
context.beginPath();
... | java | @Override
protected boolean prepare(final Context2D context, final Attributes attr, final double alpha)
{
final double r = attr.getRadius();
if (r > 0)
{
context.beginPath();
context.arc(0, 0, r, 0, Math.PI * 2, true);
context.closePath();
... | [
"@",
"Override",
"protected",
"boolean",
"prepare",
"(",
"final",
"Context2D",
"context",
",",
"final",
"Attributes",
"attr",
",",
"final",
"double",
"alpha",
")",
"{",
"final",
"double",
"r",
"=",
"attr",
".",
"getRadius",
"(",
")",
";",
"if",
"(",
"r",... | Draws this circle
@param context the {@link Context2D} used to draw this circle. | [
"Draws",
"this",
"circle"
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Circle.java#L64-L80 |
OpenLiberty/open-liberty | dev/com.ibm.ws.artifact.bundle/src/com/ibm/ws/artifact/bundle/internal/BundleArchive.java | BundleArchive.getBundleEntry | @FFDCIgnore(IllegalStateException.class)
public URL getBundleEntry(Bundle bundleToTest, String pathAndName) {
"""
This method will return a bundle entry URL for the supplied path, it will test for both a normal entry and a directory entry for it.
@param pathAndName The path to the entry
@return The URL for... | java | @FFDCIgnore(IllegalStateException.class)
public URL getBundleEntry(Bundle bundleToTest, String pathAndName) {
try {
URL bundleEntry = bundleToTest.getEntry(pathAndName);
/*
* Defect 54588 discovered that if a directory does not have a zip entry then calling getEntry wil... | [
"@",
"FFDCIgnore",
"(",
"IllegalStateException",
".",
"class",
")",
"public",
"URL",
"getBundleEntry",
"(",
"Bundle",
"bundleToTest",
",",
"String",
"pathAndName",
")",
"{",
"try",
"{",
"URL",
"bundleEntry",
"=",
"bundleToTest",
".",
"getEntry",
"(",
"pathAndNam... | This method will return a bundle entry URL for the supplied path, it will test for both a normal entry and a directory entry for it.
@param pathAndName The path to the entry
@return The URL for the bundle entry | [
"This",
"method",
"will",
"return",
"a",
"bundle",
"entry",
"URL",
"for",
"the",
"supplied",
"path",
"it",
"will",
"test",
"for",
"both",
"a",
"normal",
"entry",
"and",
"a",
"directory",
"entry",
"for",
"it",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.bundle/src/com/ibm/ws/artifact/bundle/internal/BundleArchive.java#L106-L123 |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java | VimGenerator2.appendCluster | protected IStyleAppendable appendCluster(IStyleAppendable it, boolean addNewLine, String element0, String... elements) {
"""
Append elements to the Vim top cluster.
@param it the receiver of the generated elements.
@param addNewLine indicates if a new line must be appended.
@param element0 the first element t... | java | protected IStyleAppendable appendCluster(IStyleAppendable it, boolean addNewLine, String element0, String... elements) {
it.append("syn cluster "); //$NON-NLS-1$
it.append(getLanguageSimpleName().toLowerCase());
it.append("Top add="); //$NON-NLS-1$
it.append(element0);
for (final String element : elements) {
... | [
"protected",
"IStyleAppendable",
"appendCluster",
"(",
"IStyleAppendable",
"it",
",",
"boolean",
"addNewLine",
",",
"String",
"element0",
",",
"String",
"...",
"elements",
")",
"{",
"it",
".",
"append",
"(",
"\"syn cluster \"",
")",
";",
"//$NON-NLS-1$",
"it",
"... | Append elements to the Vim top cluster.
@param it the receiver of the generated elements.
@param addNewLine indicates if a new line must be appended.
@param element0 the first element to add into the cluster.
@param elements the other elements to add into the cluster.
@return {@code it}. | [
"Append",
"elements",
"to",
"the",
"Vim",
"top",
"cluster",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L362-L375 |
alexa/alexa-skills-kit-sdk-for-java | ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java | ResponseBuilder.addElicitSlotDirective | public ResponseBuilder addElicitSlotDirective(String slotName, Intent updatedIntent) {
"""
Adds a Dialog {@link ElicitSlotDirective} to the response.
@param slotName name of slot to elicit
@param updatedIntent updated intent
@return response builder
"""
ElicitSlotDirective elicitSlotDirective = El... | java | public ResponseBuilder addElicitSlotDirective(String slotName, Intent updatedIntent) {
ElicitSlotDirective elicitSlotDirective = ElicitSlotDirective.builder()
.withUpdatedIntent(updatedIntent)
.withSlotToElicit(slotName)
.build();
return addDirective(elici... | [
"public",
"ResponseBuilder",
"addElicitSlotDirective",
"(",
"String",
"slotName",
",",
"Intent",
"updatedIntent",
")",
"{",
"ElicitSlotDirective",
"elicitSlotDirective",
"=",
"ElicitSlotDirective",
".",
"builder",
"(",
")",
".",
"withUpdatedIntent",
"(",
"updatedIntent",
... | Adds a Dialog {@link ElicitSlotDirective} to the response.
@param slotName name of slot to elicit
@param updatedIntent updated intent
@return response builder | [
"Adds",
"a",
"Dialog",
"{",
"@link",
"ElicitSlotDirective",
"}",
"to",
"the",
"response",
"."
] | train | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java#L287-L293 |
belaban/JGroups | src/org/jgroups/blocks/UnicastRequest.java | UnicastRequest.receiveResponse | public void receiveResponse(Object response_value, Address sender, boolean is_exception) {
"""
<b>Callback</b> (called by RequestCorrelator or Transport).
Adds a response to the response table. When all responses have been received, {@code execute()} returns.
"""
if(isDone())
return;
... | java | public void receiveResponse(Object response_value, Address sender, boolean is_exception) {
if(isDone())
return;
if(is_exception && response_value instanceof Throwable)
completeExceptionally((Throwable)response_value);
else
complete((T)response_value);
... | [
"public",
"void",
"receiveResponse",
"(",
"Object",
"response_value",
",",
"Address",
"sender",
",",
"boolean",
"is_exception",
")",
"{",
"if",
"(",
"isDone",
"(",
")",
")",
"return",
";",
"if",
"(",
"is_exception",
"&&",
"response_value",
"instanceof",
"Throw... | <b>Callback</b> (called by RequestCorrelator or Transport).
Adds a response to the response table. When all responses have been received, {@code execute()} returns. | [
"<b",
">",
"Callback<",
"/",
"b",
">",
"(",
"called",
"by",
"RequestCorrelator",
"or",
"Transport",
")",
".",
"Adds",
"a",
"response",
"to",
"the",
"response",
"table",
".",
"When",
"all",
"responses",
"have",
"been",
"received",
"{"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/UnicastRequest.java#L50-L58 |
transloadit/java-sdk | src/main/java/com/transloadit/sdk/Assembly.java | Assembly.getTusUploadInstance | protected TusUpload getTusUploadInstance(InputStream inputStream, String fieldName, String assemblyUrl) throws IOException {
"""
Returns the {@link TusUpload} instance that would be used to upload a file.
@param inputStream {@link InputStream}
@param fieldName {@link String} the field name assigned to the file... | java | protected TusUpload getTusUploadInstance(InputStream inputStream, String fieldName, String assemblyUrl) throws IOException {
TusUpload tusUpload = new TusUpload();
tusUpload.setInputStream(inputStream);
tusUpload.setFingerprint(String.format("%s-%d-%s", fieldName, inputStream.available(), assemb... | [
"protected",
"TusUpload",
"getTusUploadInstance",
"(",
"InputStream",
"inputStream",
",",
"String",
"fieldName",
",",
"String",
"assemblyUrl",
")",
"throws",
"IOException",
"{",
"TusUpload",
"tusUpload",
"=",
"new",
"TusUpload",
"(",
")",
";",
"tusUpload",
".",
"s... | Returns the {@link TusUpload} instance that would be used to upload a file.
@param inputStream {@link InputStream}
@param fieldName {@link String} the field name assigned to the file
@param assemblyUrl {@link String} the assembly url
@return {@link TusUpload}
@throws IOException when there's a failure with reading the... | [
"Returns",
"the",
"{",
"@link",
"TusUpload",
"}",
"instance",
"that",
"would",
"be",
"used",
"to",
"upload",
"a",
"file",
"."
] | train | https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Assembly.java#L273-L280 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java | GrafeasV1Beta1Client.listNotes | public final ListNotesPagedResponse listNotes(ProjectName parent, String filter) {
"""
Lists notes for the specified project.
<p>Sample code:
<pre><code>
try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String filter = "";
... | java | public final ListNotesPagedResponse listNotes(ProjectName parent, String filter) {
ListNotesRequest request =
ListNotesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setFilter(filter)
.build();
return listNotes(request);
} | [
"public",
"final",
"ListNotesPagedResponse",
"listNotes",
"(",
"ProjectName",
"parent",
",",
"String",
"filter",
")",
"{",
"ListNotesRequest",
"request",
"=",
"ListNotesRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
"==",
"null",
"?",
"n... | Lists notes for the specified project.
<p>Sample code:
<pre><code>
try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String filter = "";
for (Note element : grafeasV1Beta1Client.listNotes(parent, filter).iterateAll()) {
// doThingsWith(... | [
"Lists",
"notes",
"for",
"the",
"specified",
"project",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L1061-L1068 |
openengsb/openengsb | components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/SubStringOperation.java | SubStringOperation.checkBounds | private void checkBounds(String source, Integer from, Integer to) throws TransformationOperationException {
"""
Checks if the from and the to parameters are valid for the given source
"""
Integer length = source.length();
if (from > to) {
throw new TransformationOperationException(
... | java | private void checkBounds(String source, Integer from, Integer to) throws TransformationOperationException {
Integer length = source.length();
if (from > to) {
throw new TransformationOperationException(
"The from parameter is bigger than the to parameter");
}
... | [
"private",
"void",
"checkBounds",
"(",
"String",
"source",
",",
"Integer",
"from",
",",
"Integer",
"to",
")",
"throws",
"TransformationOperationException",
"{",
"Integer",
"length",
"=",
"source",
".",
"length",
"(",
")",
";",
"if",
"(",
"from",
">",
"to",
... | Checks if the from and the to parameters are valid for the given source | [
"Checks",
"if",
"the",
"from",
"and",
"the",
"to",
"parameters",
"are",
"valid",
"for",
"the",
"given",
"source"
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/SubStringOperation.java#L78-L92 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/Stripe.java | Stripe.createSource | public void createSource(@NonNull SourceParams sourceParams, @NonNull SourceCallback callback) {
"""
Create a {@link Source} using an {@link AsyncTask} on the default {@link Executor} with a
publishable api key that has already been set on this {@link Stripe} instance.
@param sourceParams the {@link SourcePara... | java | public void createSource(@NonNull SourceParams sourceParams, @NonNull SourceCallback callback) {
createSource(sourceParams, callback, null, null);
} | [
"public",
"void",
"createSource",
"(",
"@",
"NonNull",
"SourceParams",
"sourceParams",
",",
"@",
"NonNull",
"SourceCallback",
"callback",
")",
"{",
"createSource",
"(",
"sourceParams",
",",
"callback",
",",
"null",
",",
"null",
")",
";",
"}"
] | Create a {@link Source} using an {@link AsyncTask} on the default {@link Executor} with a
publishable api key that has already been set on this {@link Stripe} instance.
@param sourceParams the {@link SourceParams} to be used
@param callback a {@link SourceCallback} to receive a result or an error message | [
"Create",
"a",
"{",
"@link",
"Source",
"}",
"using",
"an",
"{",
"@link",
"AsyncTask",
"}",
"on",
"the",
"default",
"{",
"@link",
"Executor",
"}",
"with",
"a",
"publishable",
"api",
"key",
"that",
"has",
"already",
"been",
"set",
"on",
"this",
"{",
"@li... | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/Stripe.java#L289-L291 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java | KnowledgeExchangeHandler.getBoolean | protected Boolean getBoolean(Exchange exchange, Message message, String name) {
"""
Gets a Boolean context property.
@param exchange the exchange
@param message the message
@param name the name
@return the property
"""
Object value = getObject(exchange, message, name);
if (value instanceo... | java | protected Boolean getBoolean(Exchange exchange, Message message, String name) {
Object value = getObject(exchange, message, name);
if (value instanceof Boolean) {
return (Boolean)value;
} else if (value instanceof String) {
return Boolean.valueOf(((String)value).trim());
... | [
"protected",
"Boolean",
"getBoolean",
"(",
"Exchange",
"exchange",
",",
"Message",
"message",
",",
"String",
"name",
")",
"{",
"Object",
"value",
"=",
"getObject",
"(",
"exchange",
",",
"message",
",",
"name",
")",
";",
"if",
"(",
"value",
"instanceof",
"B... | Gets a Boolean context property.
@param exchange the exchange
@param message the message
@param name the name
@return the property | [
"Gets",
"a",
"Boolean",
"context",
"property",
"."
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java#L186-L194 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.addEntry | public static void addEntry(File zip, String path, byte[] bytes, File destZip) {
"""
Copies an existing ZIP file and appends it with one new entry.
@param zip
an existing ZIP file (only read).
@param path
new ZIP entry path.
@param bytes
new entry bytes (or <code>null</code> if directory).
@param destZip
... | java | public static void addEntry(File zip, String path, byte[] bytes, File destZip) {
addEntry(zip, new ByteSource(path, bytes), destZip);
} | [
"public",
"static",
"void",
"addEntry",
"(",
"File",
"zip",
",",
"String",
"path",
",",
"byte",
"[",
"]",
"bytes",
",",
"File",
"destZip",
")",
"{",
"addEntry",
"(",
"zip",
",",
"new",
"ByteSource",
"(",
"path",
",",
"bytes",
")",
",",
"destZip",
")"... | Copies an existing ZIP file and appends it with one new entry.
@param zip
an existing ZIP file (only read).
@param path
new ZIP entry path.
@param bytes
new entry bytes (or <code>null</code> if directory).
@param destZip
new ZIP file created. | [
"Copies",
"an",
"existing",
"ZIP",
"file",
"and",
"appends",
"it",
"with",
"one",
"new",
"entry",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2061-L2063 |
rapidpro/expressions | java/src/main/java/io/rapidpro/expressions/functions/CustomFunctions.java | CustomFunctions.regex_group | public static String regex_group(EvaluationContext ctx, Object text, Object pattern, Object groupNum) {
"""
Tries to match the text with the given pattern and returns the value of matching group
"""
String _text = Conversions.toString(text, ctx);
String _pattern = Conversions.toString(pattern, ... | java | public static String regex_group(EvaluationContext ctx, Object text, Object pattern, Object groupNum) {
String _text = Conversions.toString(text, ctx);
String _pattern = Conversions.toString(pattern, ctx);
int _groupNum = Conversions.toInteger(groupNum, ctx);
try {
// check ... | [
"public",
"static",
"String",
"regex_group",
"(",
"EvaluationContext",
"ctx",
",",
"Object",
"text",
",",
"Object",
"pattern",
",",
"Object",
"groupNum",
")",
"{",
"String",
"_text",
"=",
"Conversions",
".",
"toString",
"(",
"text",
",",
"ctx",
")",
";",
"... | Tries to match the text with the given pattern and returns the value of matching group | [
"Tries",
"to",
"match",
"the",
"text",
"with",
"the",
"given",
"pattern",
"and",
"returns",
"the",
"value",
"of",
"matching",
"group"
] | train | https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/functions/CustomFunctions.java#L180-L201 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java | JacksonUtils.readJson | public static JsonNode readJson(Reader source, ClassLoader classLoader) {
"""
Read a JSON string and parse to {@link JsonNode} instance, with a custom class loader.
@param source
@param classLoader
@return
"""
return SerializationUtils.readJson(source, classLoader);
} | java | public static JsonNode readJson(Reader source, ClassLoader classLoader) {
return SerializationUtils.readJson(source, classLoader);
} | [
"public",
"static",
"JsonNode",
"readJson",
"(",
"Reader",
"source",
",",
"ClassLoader",
"classLoader",
")",
"{",
"return",
"SerializationUtils",
".",
"readJson",
"(",
"source",
",",
"classLoader",
")",
";",
"}"
] | Read a JSON string and parse to {@link JsonNode} instance, with a custom class loader.
@param source
@param classLoader
@return | [
"Read",
"a",
"JSON",
"string",
"and",
"parse",
"to",
"{",
"@link",
"JsonNode",
"}",
"instance",
"with",
"a",
"custom",
"class",
"loader",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L180-L182 |
tvesalainen/util | util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java | SimpleWorkflow.switchTo | public M switchTo(K to, M msg) {
"""
Switch executing thread.
@param to Next executing
@param msg
@return
"""
doFork(to, msg);
return doJoin();
} | java | public M switchTo(K to, M msg)
{
doFork(to, msg);
return doJoin();
} | [
"public",
"M",
"switchTo",
"(",
"K",
"to",
",",
"M",
"msg",
")",
"{",
"doFork",
"(",
"to",
",",
"msg",
")",
";",
"return",
"doJoin",
"(",
")",
";",
"}"
] | Switch executing thread.
@param to Next executing
@param msg
@return | [
"Switch",
"executing",
"thread",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java#L254-L258 |
lucee/Lucee | core/src/main/java/lucee/runtime/crypt/BinConverter.java | BinConverter.longToIntArray | public static void longToIntArray(long lValue, int[] buffer, int nStartIndex) {
"""
converts a long to integers which are put into a given array
@param lValue the 64bit integer to convert
@param buffer the target buffer
@param nStartIndex where to place the bytes in the buffer
"""
buffer[nStartIndex] = (... | java | public static void longToIntArray(long lValue, int[] buffer, int nStartIndex) {
buffer[nStartIndex] = (int) (lValue >>> 32);
buffer[nStartIndex + 1] = (int) lValue;
} | [
"public",
"static",
"void",
"longToIntArray",
"(",
"long",
"lValue",
",",
"int",
"[",
"]",
"buffer",
",",
"int",
"nStartIndex",
")",
"{",
"buffer",
"[",
"nStartIndex",
"]",
"=",
"(",
"int",
")",
"(",
"lValue",
">>>",
"32",
")",
";",
"buffer",
"[",
"n... | converts a long to integers which are put into a given array
@param lValue the 64bit integer to convert
@param buffer the target buffer
@param nStartIndex where to place the bytes in the buffer | [
"converts",
"a",
"long",
"to",
"integers",
"which",
"are",
"put",
"into",
"a",
"given",
"array"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/BinConverter.java#L74-L77 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java | ChunkAnnotationUtils.annotateChunkText | public static void annotateChunkText(CoreMap chunk, Class tokenTextKey) {
"""
Annotates a CoreMap representing a chunk with text information
TextAnnotation - String representing tokens in this chunks (token text separated by space)
@param chunk - CoreMap to be annotated
@param tokenTextKey - Key to use to find ... | java | public static void annotateChunkText(CoreMap chunk, Class tokenTextKey)
{
List<CoreLabel> chunkTokens = chunk.get(CoreAnnotations.TokensAnnotation.class);
String text = getTokenText(chunkTokens, tokenTextKey);
chunk.set(CoreAnnotations.TextAnnotation.class, text);
} | [
"public",
"static",
"void",
"annotateChunkText",
"(",
"CoreMap",
"chunk",
",",
"Class",
"tokenTextKey",
")",
"{",
"List",
"<",
"CoreLabel",
">",
"chunkTokens",
"=",
"chunk",
".",
"get",
"(",
"CoreAnnotations",
".",
"TokensAnnotation",
".",
"class",
")",
";",
... | Annotates a CoreMap representing a chunk with text information
TextAnnotation - String representing tokens in this chunks (token text separated by space)
@param chunk - CoreMap to be annotated
@param tokenTextKey - Key to use to find the token text | [
"Annotates",
"a",
"CoreMap",
"representing",
"a",
"chunk",
"with",
"text",
"information",
"TextAnnotation",
"-",
"String",
"representing",
"tokens",
"in",
"this",
"chunks",
"(",
"token",
"text",
"separated",
"by",
"space",
")"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java#L523-L528 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.getByResourceGroupAsync | public Observable<DataLakeStoreAccountInner> getByResourceGroupAsync(String resourceGroupName, String accountName) {
"""
Gets the specified Data Lake Store account.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account.
@param accountName The name of the Data L... | java | public Observable<DataLakeStoreAccountInner> getByResourceGroupAsync(String resourceGroupName, String accountName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<DataLakeStoreAccountInner>, DataLakeStoreAccountInner>() {
@Override
... | [
"public",
"Observable",
"<",
"DataLakeStoreAccountInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
")",
"... | Gets the specified Data Lake Store account.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account.
@param accountName The name of the Data Lake Store account to retrieve.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable t... | [
"Gets",
"the",
"specified",
"Data",
"Lake",
"Store",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L1084-L1091 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java | ChannelFrameworkImpl.createChainData | protected ChainData createChainData(String name, FlowType type, ChannelData[] channels, Map<Object, Object> properties) throws IncoherentChainException {
"""
Create a new ChainData object.
@param name
@param type
@param channels
@return ChainData
@throws IncoherentChainException
"""
return new ... | java | protected ChainData createChainData(String name, FlowType type, ChannelData[] channels, Map<Object, Object> properties) throws IncoherentChainException {
return new ChainDataImpl(name, type, channels, properties);
} | [
"protected",
"ChainData",
"createChainData",
"(",
"String",
"name",
",",
"FlowType",
"type",
",",
"ChannelData",
"[",
"]",
"channels",
",",
"Map",
"<",
"Object",
",",
"Object",
">",
"properties",
")",
"throws",
"IncoherentChainException",
"{",
"return",
"new",
... | Create a new ChainData object.
@param name
@param type
@param channels
@return ChainData
@throws IncoherentChainException | [
"Create",
"a",
"new",
"ChainData",
"object",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java#L4289-L4292 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/Timing.java | Timing.tick | public static long tick(String str, PrintStream stream) {
"""
Print elapsed time and restart (static) timer.
@param str Additional prefix string to be printed
@param stream PrintStream on which to write output
@return Number of milliseconds elapsed
"""
long elapsed = tick();
stream.println(st... | java | public static long tick(String str, PrintStream stream) {
long elapsed = tick();
stream.println(str + " Time elapsed: " + (elapsed) + " ms");
return elapsed;
} | [
"public",
"static",
"long",
"tick",
"(",
"String",
"str",
",",
"PrintStream",
"stream",
")",
"{",
"long",
"elapsed",
"=",
"tick",
"(",
")",
";",
"stream",
".",
"println",
"(",
"str",
"+",
"\" Time elapsed: \"",
"+",
"(",
"elapsed",
")",
"+",
"\" ms\"",
... | Print elapsed time and restart (static) timer.
@param str Additional prefix string to be printed
@param stream PrintStream on which to write output
@return Number of milliseconds elapsed | [
"Print",
"elapsed",
"time",
"and",
"restart",
"(",
"static",
")",
"timer",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Timing.java#L314-L318 |
authlete/authlete-java-common | src/main/java/com/authlete/common/util/Utils.java | Utils.join | public static String join(String[] strings, String delimiter) {
"""
Concatenate string with the specified delimiter.
@param strings
Strings to be concatenated.
@param delimiter
A delimiter used between strings. If {@code null} or an empty
string is given, delimiters are not inserted between strings.
@r... | java | public static String join(String[] strings, String delimiter)
{
if (strings == null)
{
return null;
}
if (strings.length == 0)
{
return "";
}
boolean useDelimiter = (delimiter != null && delimiter.length() != 0);
... | [
"public",
"static",
"String",
"join",
"(",
"String",
"[",
"]",
"strings",
",",
"String",
"delimiter",
")",
"{",
"if",
"(",
"strings",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"strings",
".",
"length",
"==",
"0",
")",
"{",
"ret... | Concatenate string with the specified delimiter.
@param strings
Strings to be concatenated.
@param delimiter
A delimiter used between strings. If {@code null} or an empty
string is given, delimiters are not inserted between strings.
@return
A concatenated string. If {@code strings} is {@code null},
{@code null} is r... | [
"Concatenate",
"string",
"with",
"the",
"specified",
"delimiter",
"."
] | train | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/Utils.java#L53-L86 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/ArrayUtils.java | ArrayUtils.getLast | public static <T> T getLast(T[] array, T defaultValue) {
"""
Returns the last element (at index 0) in the {@code array}.
@param <T> {@link Class} type of elements in the array.
@param array array from which to extract the last element.
@param defaultValue default value to return if the given array is {@litera... | java | public static <T> T getLast(T[] array, T defaultValue) {
return getElementAt(array, Math.max(0, nullSafeLength(array) - 1), defaultValue);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getLast",
"(",
"T",
"[",
"]",
"array",
",",
"T",
"defaultValue",
")",
"{",
"return",
"getElementAt",
"(",
"array",
",",
"Math",
".",
"max",
"(",
"0",
",",
"nullSafeLength",
"(",
"array",
")",
"-",
"1",
")",
... | Returns the last element (at index 0) in the {@code array}.
@param <T> {@link Class} type of elements in the array.
@param array array from which to extract the last element.
@param defaultValue default value to return if the given array is {@literal null} or empty.
@return the last element in the array or return the ... | [
"Returns",
"the",
"last",
"element",
"(",
"at",
"index",
"0",
")",
"in",
"the",
"{",
"@code",
"array",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L497-L499 |
notnoop/java-apns | src/main/java/com/notnoop/apns/PayloadBuilder.java | PayloadBuilder.customField | public PayloadBuilder customField(final String key, final Object value) {
"""
Sets any application-specific custom fields. The values
are presented to the application and the iPhone doesn't
display them automatically.
This can be used to pass specific values (urls, ids, etc) to
the application in addition t... | java | public PayloadBuilder customField(final String key, final Object value) {
root.put(key, value);
return this;
} | [
"public",
"PayloadBuilder",
"customField",
"(",
"final",
"String",
"key",
",",
"final",
"Object",
"value",
")",
"{",
"root",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Sets any application-specific custom fields. The values
are presented to the application and the iPhone doesn't
display them automatically.
This can be used to pass specific values (urls, ids, etc) to
the application in addition to the notification message
itself.
@param key the custom field name
@param value the ... | [
"Sets",
"any",
"application",
"-",
"specific",
"custom",
"fields",
".",
"The",
"values",
"are",
"presented",
"to",
"the",
"application",
"and",
"the",
"iPhone",
"doesn",
"t",
"display",
"them",
"automatically",
"."
] | train | https://github.com/notnoop/java-apns/blob/180a190d4cb49458441596ca7c69d50ec7f1dba5/src/main/java/com/notnoop/apns/PayloadBuilder.java#L327-L330 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/sjavac/Source.java | Source.hasMatch | static private boolean hasMatch(String path, List<String> patterns) {
"""
Test if a path matches any of the patterns given.
The pattern foo.bar matches only foo.bar
The pattern foo.* matches foo.bar and foo.bar.zoo etc
"""
for (String p : patterns) {
// Exact match
if (p.equal... | java | static private boolean hasMatch(String path, List<String> patterns) {
for (String p : patterns) {
// Exact match
if (p.equals(path)) {
return true;
}
// Single dot the end matches this package and all its subpackages.
if (p.endsWith(".*... | [
"static",
"private",
"boolean",
"hasMatch",
"(",
"String",
"path",
",",
"List",
"<",
"String",
">",
"patterns",
")",
"{",
"for",
"(",
"String",
"p",
":",
"patterns",
")",
"{",
"// Exact match",
"if",
"(",
"p",
".",
"equals",
"(",
"path",
")",
")",
"{... | Test if a path matches any of the patterns given.
The pattern foo.bar matches only foo.bar
The pattern foo.* matches foo.bar and foo.bar.zoo etc | [
"Test",
"if",
"a",
"path",
"matches",
"any",
"of",
"the",
"patterns",
"given",
".",
"The",
"pattern",
"foo",
".",
"bar",
"matches",
"only",
"foo",
".",
"bar",
"The",
"pattern",
"foo",
".",
"*",
"matches",
"foo",
".",
"bar",
"and",
"foo",
".",
"bar",
... | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Source.java#L224-L247 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/Validate.java | Validate.validState | public static void validState(final boolean expression, final String message, final Object... values) {
"""
<p>Validate that the stateful condition is {@code true}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean
expression, such ... | java | public static void validState(final boolean expression, final String message, final Object... values) {
INSTANCE.validState(expression, message, values);
} | [
"public",
"static",
"void",
"validState",
"(",
"final",
"boolean",
"expression",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"INSTANCE",
".",
"validState",
"(",
"expression",
",",
"message",
",",
"values",
")",
";",
... | <p>Validate that the stateful condition is {@code true}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean
expression, such as validating a primitive number or using your own custom validation expression.</p>
<pre>Validate.validState(this... | [
"<p",
">",
"Validate",
"that",
"the",
"stateful",
"condition",
"is",
"{",
"@code",
"true",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"This",
"method",
"is",
"useful",
"when",
"validating",
"according",
... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L1355-L1357 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.apportalRegister | public static ApportalRegisterResult apportalRegister(String accessToken, ApportalRegister apportalRegister) {
"""
Wi-Fi设备管理-添加portal型设备
@param accessToken accessToken
@param apportalRegister apportalRegister
@return ApportalRegisterResult
"""
return apportalRegister(accessToken, JsonUtil.to... | java | public static ApportalRegisterResult apportalRegister(String accessToken, ApportalRegister apportalRegister) {
return apportalRegister(accessToken, JsonUtil.toJSONString(apportalRegister));
} | [
"public",
"static",
"ApportalRegisterResult",
"apportalRegister",
"(",
"String",
"accessToken",
",",
"ApportalRegister",
"apportalRegister",
")",
"{",
"return",
"apportalRegister",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"apportalRegister",
")",
"... | Wi-Fi设备管理-添加portal型设备
@param accessToken accessToken
@param apportalRegister apportalRegister
@return ApportalRegisterResult | [
"Wi",
"-",
"Fi设备管理",
"-",
"添加portal型设备"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L347-L349 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.addCompositeEntityChildWithServiceResponseAsync | public Observable<ServiceResponse<UUID>> addCompositeEntityChildWithServiceResponseAsync(UUID appId, String versionId, UUID cEntityId, AddCompositeEntityChildOptionalParameter addCompositeEntityChildOptionalParameter) {
"""
Creates a single child in an existing composite entity model.
@param appId The applicati... | java | public Observable<ServiceResponse<UUID>> addCompositeEntityChildWithServiceResponseAsync(UUID appId, String versionId, UUID cEntityId, AddCompositeEntityChildOptionalParameter addCompositeEntityChildOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parame... | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"UUID",
">",
">",
"addCompositeEntityChildWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"cEntityId",
",",
"AddCompositeEntityChildOptionalParameter",
"addCompositeEntityChildOptio... | Creates a single child in an existing composite entity model.
@param appId The application ID.
@param versionId The version ID.
@param cEntityId The composite entity extractor ID.
@param addCompositeEntityChildOptionalParameter the object representing the optional parameters to be set before calling this API
@throws I... | [
"Creates",
"a",
"single",
"child",
"in",
"an",
"existing",
"composite",
"entity",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6882-L6898 |
fcrepo4-labs/fcrepo4-client | fcrepo-client-impl/src/main/java/org/fcrepo/client/utils/HttpHelper.java | HttpHelper.createCopyMethod | public HttpCopy createCopyMethod(final String sourcePath, final String destinationPath) {
"""
Create COPY method
@param sourcePath Source path, relative to repository baseURL
@param destinationPath Destination path, relative to repository baseURL
@return COPY method
"""
return new HttpCopy(repositor... | java | public HttpCopy createCopyMethod(final String sourcePath, final String destinationPath) {
return new HttpCopy(repositoryURL + sourcePath, repositoryURL + destinationPath);
} | [
"public",
"HttpCopy",
"createCopyMethod",
"(",
"final",
"String",
"sourcePath",
",",
"final",
"String",
"destinationPath",
")",
"{",
"return",
"new",
"HttpCopy",
"(",
"repositoryURL",
"+",
"sourcePath",
",",
"repositoryURL",
"+",
"destinationPath",
")",
";",
"}"
] | Create COPY method
@param sourcePath Source path, relative to repository baseURL
@param destinationPath Destination path, relative to repository baseURL
@return COPY method | [
"Create",
"COPY",
"method"
] | train | https://github.com/fcrepo4-labs/fcrepo4-client/blob/21eaf27200c5b2542095f6ebb9dd8ec865b95bbd/fcrepo-client-impl/src/main/java/org/fcrepo/client/utils/HttpHelper.java#L401-L403 |
hawkular/hawkular-apm | client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java | APMSpan.processNoPrimaryReference | protected void processNoPrimaryReference(APMSpanBuilder builder, TraceRecorder recorder, ContextSampler sampler) {
"""
This method initialises the span based on there being no primary reference.
@param builder The span builder
@param recorder The trace recorder
@param sampler The sampler
"""
// N... | java | protected void processNoPrimaryReference(APMSpanBuilder builder, TraceRecorder recorder, ContextSampler sampler) {
// No primary reference found, so means that all references will be treated
// as equal, to provide a join construct within a separate fragment.
initTopLevelState(this, recorder, sa... | [
"protected",
"void",
"processNoPrimaryReference",
"(",
"APMSpanBuilder",
"builder",
",",
"TraceRecorder",
"recorder",
",",
"ContextSampler",
"sampler",
")",
"{",
"// No primary reference found, so means that all references will be treated",
"// as equal, to provide a join construct wit... | This method initialises the span based on there being no primary reference.
@param builder The span builder
@param recorder The trace recorder
@param sampler The sampler | [
"This",
"method",
"initialises",
"the",
"span",
"based",
"on",
"there",
"being",
"no",
"primary",
"reference",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java#L259-L286 |
nmdp-bioinformatics/genotype-list | gl-client/src/main/java/org/nmdp/gl/client/GlstringBuilder.java | GlstringBuilder.inPhase | public GlstringBuilder inPhase() {
"""
Return this GL String builder configured with an in phase operator ('<code>~</code>' character).
The in phase operator combines two or more allele lists into a haplotype.
<p>As an operator, calls to this method must be interspersed by calls to {@link #allele(String)}.</p>... | java | public GlstringBuilder inPhase() {
if (tree.isEmpty()) {
throw new IllegalStateException("must call allele(String) before any operator (allelicAmbiguity, inPhase, plus, genotypicAmbiguity, locus)");
}
if (tree.root.isOperator() && tree.root.right == null) {
throw new Ille... | [
"public",
"GlstringBuilder",
"inPhase",
"(",
")",
"{",
"if",
"(",
"tree",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"must call allele(String) before any operator (allelicAmbiguity, inPhase, plus, genotypicAmbiguity, locus)\"",
")",
... | Return this GL String builder configured with an in phase operator ('<code>~</code>' character).
The in phase operator combines two or more allele lists into a haplotype.
<p>As an operator, calls to this method must be interspersed by calls to {@link #allele(String)}.</p>
@return this GL String builder configured wit... | [
"Return",
"this",
"GL",
"String",
"builder",
"configured",
"with",
"an",
"in",
"phase",
"operator",
"(",
"<code",
">",
"~<",
"/",
"code",
">",
"character",
")",
".",
"The",
"in",
"phase",
"operator",
"combines",
"two",
"or",
"more",
"allele",
"lists",
"i... | train | https://github.com/nmdp-bioinformatics/genotype-list/blob/03b2579552cb9f680a62ffaaecdca9c2a5d12ee4/gl-client/src/main/java/org/nmdp/gl/client/GlstringBuilder.java#L138-L150 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.