repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/Json.java | Json.resource_to_string | public String resource_to_string(base_resource resrc, options option)
{
String result = "{ ";
if (option != null && option.get_action() != null)
result = result + "\"params\": {\"action\":\"" + option.get_action() + "\"},";
result = result + "\"" + resrc.get_object_type() + "\":" + this.resource_to_str... | java | public String resource_to_string(base_resource resrc, options option)
{
String result = "{ ";
if (option != null && option.get_action() != null)
result = result + "\"params\": {\"action\":\"" + option.get_action() + "\"},";
result = result + "\"" + resrc.get_object_type() + "\":" + this.resource_to_str... | [
"public",
"String",
"resource_to_string",
"(",
"base_resource",
"resrc",
",",
"options",
"option",
")",
"{",
"String",
"result",
"=",
"\"{ \"",
";",
"if",
"(",
"option",
"!=",
"null",
"&&",
"option",
".",
"get_action",
"(",
")",
"!=",
"null",
")",
"result"... | Converts NetScaler SDX resource to Json string.
@param resrc API resource.
@param option options class object.
@return returns a String | [
"Converts",
"NetScaler",
"SDX",
"resource",
"to",
"Json",
"string",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/Json.java#L64-L72 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/Json.java | Json.resource_to_string | public String resource_to_string(base_resource resources[], options option)
{
String objecttype = resources[0].get_object_type();
String request = "{";
if (option != null && option.get_action() != null)
request = request + "\"params\": {\"action\": \"" + option.get_action() + "\"},";
request = req... | java | public String resource_to_string(base_resource resources[], options option)
{
String objecttype = resources[0].get_object_type();
String request = "{";
if (option != null && option.get_action() != null)
request = request + "\"params\": {\"action\": \"" + option.get_action() + "\"},";
request = req... | [
"public",
"String",
"resource_to_string",
"(",
"base_resource",
"resources",
"[",
"]",
",",
"options",
"option",
")",
"{",
"String",
"objecttype",
"=",
"resources",
"[",
"0",
"]",
".",
"get_object_type",
"(",
")",
";",
"String",
"request",
"=",
"\"{\"",
";",... | Converts NetScaler SDX resources to Json string.
@param resources API resources.
@param option options class object.
@return returns a String | [
"Converts",
"NetScaler",
"SDX",
"resources",
"to",
"Json",
"string",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/Json.java#L80-L96 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/Json.java | Json.resource_to_string | public String resource_to_string(base_resource resources[], options option, String onerror)
{
String objecttype = resources[0].get_object_type();
String request = "{";
if ( (option != null && option.get_action() != null) || (!onerror.equals("")) )
{
request = request + "\"params\":{";
if ... | java | public String resource_to_string(base_resource resources[], options option, String onerror)
{
String objecttype = resources[0].get_object_type();
String request = "{";
if ( (option != null && option.get_action() != null) || (!onerror.equals("")) )
{
request = request + "\"params\":{";
if ... | [
"public",
"String",
"resource_to_string",
"(",
"base_resource",
"resources",
"[",
"]",
",",
"options",
"option",
",",
"String",
"onerror",
")",
"{",
"String",
"objecttype",
"=",
"resources",
"[",
"0",
"]",
".",
"get_object_type",
"(",
")",
";",
"String",
"re... | Converts MPS resources to Json string.
@param resources nitro resources.
@param option options class object.
@return returns a String | [
"Converts",
"MPS",
"resources",
"to",
"Json",
"string",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/Json.java#L135-L167 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.getClass | @NullSafe
public static Class<?> getClass(Object obj) {
return obj != null ? obj.getClass() : null;
} | java | @NullSafe
public static Class<?> getClass(Object obj) {
return obj != null ? obj.getClass() : null;
} | [
"@",
"NullSafe",
"public",
"static",
"Class",
"<",
"?",
">",
"getClass",
"(",
"Object",
"obj",
")",
"{",
"return",
"obj",
"!=",
"null",
"?",
"obj",
".",
"getClass",
"(",
")",
":",
"null",
";",
"}"
] | Get the Class type of the specified Object. Returns null if the Object reference is null.
@param obj the Object who's Class type is being determined.
@return a Class object signifying the type of the specified Object.
@see java.lang.Object#getClass() | [
"Get",
"the",
"Class",
"type",
"of",
"the",
"specified",
"Object",
".",
"Returns",
"null",
"if",
"the",
"Object",
"reference",
"is",
"null",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L94-L97 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.getClassSimpleName | @NullSafe
public static String getClassSimpleName(Object obj) {
return obj != null ? obj.getClass().getSimpleName() : null;
} | java | @NullSafe
public static String getClassSimpleName(Object obj) {
return obj != null ? obj.getClass().getSimpleName() : null;
} | [
"@",
"NullSafe",
"public",
"static",
"String",
"getClassSimpleName",
"(",
"Object",
"obj",
")",
"{",
"return",
"obj",
"!=",
"null",
"?",
"obj",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
":",
"null",
";",
"}"
] | Gets the unqualified, simple name of the Class type for the specified Object. Returns null if the Object reference
is null.
@param obj the Object who's simple class name is determined.
@return a String value indicating the simple class name of the Object.
@see java.lang.Class#getSimpleName()
@see java.lang.Object#get... | [
"Gets",
"the",
"unqualified",
"simple",
"name",
"of",
"the",
"Class",
"type",
"for",
"the",
"specified",
"Object",
".",
"Returns",
"null",
"if",
"the",
"Object",
"reference",
"is",
"null",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L122-L125 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.findConstructor | @SuppressWarnings({ "unchecked", "all" })
public static <T> Constructor<T> findConstructor(Class<T> type, Object... arguments) {
for (Constructor<?> constructor : type.getDeclaredConstructors()) {
Class<?>[] parameterTypes = constructor.getParameterTypes();
if (ArrayUtils.nullSafeLength(arguments) ... | java | @SuppressWarnings({ "unchecked", "all" })
public static <T> Constructor<T> findConstructor(Class<T> type, Object... arguments) {
for (Constructor<?> constructor : type.getDeclaredConstructors()) {
Class<?>[] parameterTypes = constructor.getParameterTypes();
if (ArrayUtils.nullSafeLength(arguments) ... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"all\"",
"}",
")",
"public",
"static",
"<",
"T",
">",
"Constructor",
"<",
"T",
">",
"findConstructor",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Object",
"...",
"arguments",
")",
"{",
"for",
"... | Attempts to find a compatible constructor on the given class type with a signature having parameter types
satisfying the specified arguments.
@param <T> the generic class type to search for the constructor.
@param type the Class type to search for the desired constructor.
@param arguments an array of Object arguments ... | [
"Attempts",
"to",
"find",
"a",
"compatible",
"constructor",
"on",
"the",
"given",
"class",
"type",
"with",
"a",
"signature",
"having",
"parameter",
"types",
"satisfying",
"the",
"specified",
"arguments",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L207-L229 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.getConstructor | public static <T> Constructor<T> getConstructor(Class<T> type, Class<?>... parameterTypes) {
try {
return type.getDeclaredConstructor(parameterTypes);
}
catch (NoSuchMethodException cause) {
throw new ConstructorNotFoundException(cause);
}
} | java | public static <T> Constructor<T> getConstructor(Class<T> type, Class<?>... parameterTypes) {
try {
return type.getDeclaredConstructor(parameterTypes);
}
catch (NoSuchMethodException cause) {
throw new ConstructorNotFoundException(cause);
}
} | [
"public",
"static",
"<",
"T",
">",
"Constructor",
"<",
"T",
">",
"getConstructor",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"try",
"{",
"return",
"type",
".",
"getDeclaredConstructor",
"(",
"p... | Gets the constructor with the specified signature from the given class type.
@param <T> the generic class type from which to get the constructor.
@param type the Class type from which to get the Constructor.
@param parameterTypes an array of class types indicating the constructor signature.
@return a Constructor from ... | [
"Gets",
"the",
"constructor",
"with",
"the",
"specified",
"signature",
"from",
"the",
"given",
"class",
"type",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L242-L250 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.resolveConstructor | public static <T> Constructor<T> resolveConstructor(Class<T> type, Class<?>[] parameterTypes, Object... arguments) {
try {
return getConstructor(type, parameterTypes);
}
catch (ConstructorNotFoundException cause) {
Constructor<T> constructor = findConstructor(type, arguments);
Assert.no... | java | public static <T> Constructor<T> resolveConstructor(Class<T> type, Class<?>[] parameterTypes, Object... arguments) {
try {
return getConstructor(type, parameterTypes);
}
catch (ConstructorNotFoundException cause) {
Constructor<T> constructor = findConstructor(type, arguments);
Assert.no... | [
"public",
"static",
"<",
"T",
">",
"Constructor",
"<",
"T",
">",
"resolveConstructor",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
",",
"Object",
"...",
"arguments",
")",
"{",
"try",
"{",
"return",
"g... | Attempts to resolve the constructor from the given class type based on the constructor's exact signature,
otherwise finds a constructor who's signature parameter types satisfy the array of Object arguments.
@param <T> the generic class type from which to resolve the constructor.
@param type the Class type from which t... | [
"Attempts",
"to",
"resolve",
"the",
"constructor",
"from",
"the",
"given",
"class",
"type",
"based",
"on",
"the",
"constructor",
"s",
"exact",
"signature",
"otherwise",
"finds",
"a",
"constructor",
"who",
"s",
"signature",
"parameter",
"types",
"satisfy",
"the",... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L267-L282 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.getField | public static Field getField(Class<?> type, String fieldName) {
try {
return type.getDeclaredField(fieldName);
}
catch (NoSuchFieldException cause) {
if (type.getSuperclass() != null) {
return getField(type.getSuperclass(), fieldName);
}
throw new FieldNotFoundException(ca... | java | public static Field getField(Class<?> type, String fieldName) {
try {
return type.getDeclaredField(fieldName);
}
catch (NoSuchFieldException cause) {
if (type.getSuperclass() != null) {
return getField(type.getSuperclass(), fieldName);
}
throw new FieldNotFoundException(ca... | [
"public",
"static",
"Field",
"getField",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"fieldName",
")",
"{",
"try",
"{",
"return",
"type",
".",
"getDeclaredField",
"(",
"fieldName",
")",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"cause",
")",
... | Gets a Field object representing the named field on the specified class. This method will recursively search
up the class hierarchy of the specified class until the Object class is reached. If the named field is found
then a Field object representing the class field is returned, otherwise a NoSuchFieldException is th... | [
"Gets",
"a",
"Field",
"object",
"representing",
"the",
"named",
"field",
"on",
"the",
"specified",
"class",
".",
"This",
"method",
"will",
"recursively",
"search",
"up",
"the",
"class",
"hierarchy",
"of",
"the",
"specified",
"class",
"until",
"the",
"Object",
... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L298-L311 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.findMethod | @SuppressWarnings("all")
public static Method findMethod(Class<?> type, String methodName, Object... arguments) {
for (Method method : type.getDeclaredMethods()) {
if (method.getName().equals(methodName)) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (ArrayUtils.nullSafeLe... | java | @SuppressWarnings("all")
public static Method findMethod(Class<?> type, String methodName, Object... arguments) {
for (Method method : type.getDeclaredMethods()) {
if (method.getName().equals(methodName)) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (ArrayUtils.nullSafeLe... | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"public",
"static",
"Method",
"findMethod",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"methodName",
",",
"Object",
"...",
"arguments",
")",
"{",
"for",
"(",
"Method",
"method",
":",
"type",
".",
"ge... | Attempts to find a method with the specified name on the given class type having a signature with parameter types
that are compatible with the given arguments. This method searches recursively up the inherited class hierarchy
for the given class type until the desired method is found or the class type hierarchy is exh... | [
"Attempts",
"to",
"find",
"a",
"method",
"with",
"the",
"specified",
"name",
"on",
"the",
"given",
"class",
"type",
"having",
"a",
"signature",
"with",
"parameter",
"types",
"that",
"are",
"compatible",
"with",
"the",
"given",
"arguments",
".",
"This",
"meth... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L330-L355 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.getMethod | public static Method getMethod(Class<?> type, String methodName, Class<?>... parameterTypes) {
try {
return type.getDeclaredMethod(methodName, parameterTypes);
}
catch (NoSuchMethodException cause) {
if (type.getSuperclass() != null) {
return getMethod(type.getSuperclass(), methodName,... | java | public static Method getMethod(Class<?> type, String methodName, Class<?>... parameterTypes) {
try {
return type.getDeclaredMethod(methodName, parameterTypes);
}
catch (NoSuchMethodException cause) {
if (type.getSuperclass() != null) {
return getMethod(type.getSuperclass(), methodName,... | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"try",
"{",
"return",
"type",
".",
"getDeclaredMethod",
"(",
"methodName",
",",
"... | Gets a Method object representing the named method on the specified class. This method will recursively search
up the class hierarchy of the specified class until the Object class is reached. If the named method is found
then a Method object representing the class method is returned, otherwise a NoSuchMethodException... | [
"Gets",
"a",
"Method",
"object",
"representing",
"the",
"named",
"method",
"on",
"the",
"specified",
"class",
".",
"This",
"method",
"will",
"recursively",
"search",
"up",
"the",
"class",
"hierarchy",
"of",
"the",
"specified",
"class",
"until",
"the",
"Object"... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L373-L386 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.resolveMethod | public static Method resolveMethod(Class<?> type, String methodName, Class<?>[] parameterTypes, Object[] arguments,
Class<?> returnType) {
try {
return getMethod(type, methodName, parameterTypes);
}
catch (MethodNotFoundException cause) {
Method method = findMethod(type, methodName, argu... | java | public static Method resolveMethod(Class<?> type, String methodName, Class<?>[] parameterTypes, Object[] arguments,
Class<?> returnType) {
try {
return getMethod(type, methodName, parameterTypes);
}
catch (MethodNotFoundException cause) {
Method method = findMethod(type, methodName, argu... | [
"public",
"static",
"Method",
"resolveMethod",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
",",
"Object",
"[",
"]",
"arguments",
",",
"Class",
"<",
"?",
">",
"returnType",
"... | Attempts to resolve the method with the specified name and signature on the given class type. The named method's
resolution is first attempted by using the specified method's name along with the array of parameter types.
If unsuccessful, the method proceeds to lookup the named method by searching all "declared" method... | [
"Attempts",
"to",
"resolve",
"the",
"method",
"with",
"the",
"specified",
"name",
"and",
"signature",
"on",
"the",
"given",
"class",
"type",
".",
"The",
"named",
"method",
"s",
"resolution",
"is",
"first",
"attempted",
"by",
"using",
"the",
"specified",
"met... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L411-L427 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.getMethodSignature | protected static String getMethodSignature(Method method) {
return getMethodSignature(method.getName(), method.getParameterTypes(), method.getReturnType());
} | java | protected static String getMethodSignature(Method method) {
return getMethodSignature(method.getName(), method.getParameterTypes(), method.getReturnType());
} | [
"protected",
"static",
"String",
"getMethodSignature",
"(",
"Method",
"method",
")",
"{",
"return",
"getMethodSignature",
"(",
"method",
".",
"getName",
"(",
")",
",",
"method",
".",
"getParameterTypes",
"(",
")",
",",
"method",
".",
"getReturnType",
"(",
")",... | Builds the signature of a method based on a java.lang.reflect.Method object.
@param method the Method object to build an method signature of.
@return the signature of the Method as a String.
@see #getMethodSignature(String, Class[], Class) | [
"Builds",
"the",
"signature",
"of",
"a",
"method",
"based",
"on",
"a",
"java",
".",
"lang",
".",
"reflect",
".",
"Method",
"object",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L436-L438 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.getMethodSignature | protected static String getMethodSignature(String methodName, Class<?>[] parameterTypes, Class<?> returnType) {
StringBuilder buffer = new StringBuilder(methodName);
buffer.append("(");
if (parameterTypes != null) {
int index = 0;
for (Class<?> parameterType : parameterTypes) {
buff... | java | protected static String getMethodSignature(String methodName, Class<?>[] parameterTypes, Class<?> returnType) {
StringBuilder buffer = new StringBuilder(methodName);
buffer.append("(");
if (parameterTypes != null) {
int index = 0;
for (Class<?> parameterType : parameterTypes) {
buff... | [
"protected",
"static",
"String",
"getMethodSignature",
"(",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
",",
"Class",
"<",
"?",
">",
"returnType",
")",
"{",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
"me... | Builds the signature of a method based on the method's name, parameter types and return type.
@param methodName a String indicating the name of the method.
@param parameterTypes an array of Class objects indicating the type of each method parameter.
@param returnType a Class object indicating the methods return type.
... | [
"Builds",
"the",
"signature",
"of",
"a",
"method",
"based",
"on",
"the",
"method",
"s",
"name",
"parameter",
"types",
"and",
"return",
"type",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L449-L469 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.getName | @NullSafe
public static String getName(Class type) {
return type != null ? type.getName() : null;
} | java | @NullSafe
public static String getName(Class type) {
return type != null ? type.getName() : null;
} | [
"@",
"NullSafe",
"public",
"static",
"String",
"getName",
"(",
"Class",
"type",
")",
"{",
"return",
"type",
"!=",
"null",
"?",
"type",
".",
"getName",
"(",
")",
":",
"null",
";",
"}"
] | Gets the fully-qualified name of the Class.
@param type the Class type to return the fully-qualified name of.
@return a String value with the fully-qualified name of the Class.
@see java.lang.Class#getName() | [
"Gets",
"the",
"fully",
"-",
"qualified",
"name",
"of",
"the",
"Class",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L478-L481 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.getSimpleName | @NullSafe
public static String getSimpleName(Class type) {
return type != null ? type.getSimpleName() : null;
} | java | @NullSafe
public static String getSimpleName(Class type) {
return type != null ? type.getSimpleName() : null;
} | [
"@",
"NullSafe",
"public",
"static",
"String",
"getSimpleName",
"(",
"Class",
"type",
")",
"{",
"return",
"type",
"!=",
"null",
"?",
"type",
".",
"getSimpleName",
"(",
")",
":",
"null",
";",
"}"
] | Gets the simple name of the Class.
@param type the Class type to return the simple name of.
@return a String value with the simple name of the Class.
@see java.lang.Class#getSimpleName() | [
"Gets",
"the",
"simple",
"name",
"of",
"the",
"Class",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L509-L512 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.instanceOf | @NullSafe
public static boolean instanceOf(Object obj, Class<?> type) {
return type != null && type.isInstance(obj);
} | java | @NullSafe
public static boolean instanceOf(Object obj, Class<?> type) {
return type != null && type.isInstance(obj);
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"instanceOf",
"(",
"Object",
"obj",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"type",
"!=",
"null",
"&&",
"type",
".",
"isInstance",
"(",
"obj",
")",
";",
"}"
] | Determines whether the given Object is an instance of the specified Class. Note, an Object cannot be an
instance of null, so this method returns false if the Class type is null or the Object is null.
@param obj the Object to test as an instance of the specified Class type.
@param type the Class type used in the insta... | [
"Determines",
"whether",
"the",
"given",
"Object",
"is",
"an",
"instance",
"of",
"the",
"specified",
"Class",
".",
"Note",
"an",
"Object",
"cannot",
"be",
"an",
"instance",
"of",
"null",
"so",
"this",
"method",
"returns",
"false",
"if",
"the",
"Class",
"ty... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L565-L568 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.isAnnotationPresent | @NullSafe
public static boolean isAnnotationPresent(Class<? extends Annotation> annotation, AnnotatedElement... members) {
return stream(ArrayUtils.nullSafeArray(members, AnnotatedElement.class))
.anyMatch(member -> member != null && member.isAnnotationPresent(annotation));
} | java | @NullSafe
public static boolean isAnnotationPresent(Class<? extends Annotation> annotation, AnnotatedElement... members) {
return stream(ArrayUtils.nullSafeArray(members, AnnotatedElement.class))
.anyMatch(member -> member != null && member.isAnnotationPresent(annotation));
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"isAnnotationPresent",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
",",
"AnnotatedElement",
"...",
"members",
")",
"{",
"return",
"stream",
"(",
"ArrayUtils",
".",
"nullSafeArray",
"(",
"mem... | Determines whether the specified Annotation meta-data is present on the given "annotated" members,
such as fields and methods.
@param annotation the Annotation used in the detection for presence on the given members.
@param members the members of a class type or object to inspect for the presence of the specified Anno... | [
"Determines",
"whether",
"the",
"specified",
"Annotation",
"meta",
"-",
"data",
"is",
"present",
"on",
"the",
"given",
"annotated",
"members",
"such",
"as",
"fields",
"and",
"methods",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L592-L596 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.isClass | @NullSafe
public static boolean isClass(Class type) {
return type != null && !(type.isAnnotation() || type.isArray() || type.isEnum() || type.isInterface()
|| type.isPrimitive());
} | java | @NullSafe
public static boolean isClass(Class type) {
return type != null && !(type.isAnnotation() || type.isArray() || type.isEnum() || type.isInterface()
|| type.isPrimitive());
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"isClass",
"(",
"Class",
"type",
")",
"{",
"return",
"type",
"!=",
"null",
"&&",
"!",
"(",
"type",
".",
"isAnnotation",
"(",
")",
"||",
"type",
".",
"isArray",
"(",
")",
"||",
"type",
".",
"isEnum",
"("... | Determines whether the specified Class object represents an actual class, and not an Annotation, Array, Enum,
Interface or Primitive type.
@param type the Class object tested as an actual class.
@return true iff the Class object is not null and represents an actual class. | [
"Determines",
"whether",
"the",
"specified",
"Class",
"object",
"represents",
"an",
"actual",
"class",
"and",
"not",
"an",
"Annotation",
"Array",
"Enum",
"Interface",
"or",
"Primitive",
"type",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L617-L621 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.loadClass | public static <T> Class<T> loadClass(String fullyQualifiedClassName) {
return loadClass(fullyQualifiedClassName, DEFAULT_INITIALIZE_LOADED_CLASS,
Thread.currentThread().getContextClassLoader());
} | java | public static <T> Class<T> loadClass(String fullyQualifiedClassName) {
return loadClass(fullyQualifiedClassName, DEFAULT_INITIALIZE_LOADED_CLASS,
Thread.currentThread().getContextClassLoader());
} | [
"public",
"static",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"loadClass",
"(",
"String",
"fullyQualifiedClassName",
")",
"{",
"return",
"loadClass",
"(",
"fullyQualifiedClassName",
",",
"DEFAULT_INITIALIZE_LOADED_CLASS",
",",
"Thread",
".",
"currentThread",
"(",
")"... | Loads the Class object for the specified, fully qualified class name using the current Thread's context ClassLoader,
following by initializing the class.
@param <T> {@link Class} type of T.
@param fullyQualifiedClassName a String value indicating the fully qualified class name of the Class to load.
@return a Class obj... | [
"Loads",
"the",
"Class",
"object",
"for",
"the",
"specified",
"fully",
"qualified",
"class",
"name",
"using",
"the",
"current",
"Thread",
"s",
"context",
"ClassLoader",
"following",
"by",
"initializing",
"the",
"class",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L740-L743 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.notInstanceOf | @NullSafe
@SuppressWarnings("all")
public static boolean notInstanceOf(Object obj, Class... types) {
boolean result = true;
for (int index = 0; result && index < ArrayUtils.nullSafeLength(types); index++) {
result &= !instanceOf(obj, types[index]);
}
return result;
} | java | @NullSafe
@SuppressWarnings("all")
public static boolean notInstanceOf(Object obj, Class... types) {
boolean result = true;
for (int index = 0; result && index < ArrayUtils.nullSafeLength(types); index++) {
result &= !instanceOf(obj, types[index]);
}
return result;
} | [
"@",
"NullSafe",
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"public",
"static",
"boolean",
"notInstanceOf",
"(",
"Object",
"obj",
",",
"Class",
"...",
"types",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",... | Determines whether the Object is an instance of any of the Class types and returns false if it is.
@param obj the Object of the instanceof comparison.
@param types an array of Class types used in the instanceof comparison.
@return a true boolean value iff the Object is not an instance of any of the Class types.
@see #... | [
"Determines",
"whether",
"the",
"Object",
"is",
"an",
"instance",
"of",
"any",
"of",
"the",
"Class",
"types",
"and",
"returns",
"false",
"if",
"it",
"is",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L813-L824 | train |
huahang/crypto-utils | crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java | Rc4Utils.encrypt | public static byte[] encrypt(byte[] data, byte[] key) {
checkNotNull(data);
checkNotNull(key);
checkArgument(key.length >= 5 && key.length <= 256);
StreamCipher rc4 = new RC4Engine();
rc4.init(true, new KeyParameter(key));
byte[] encrypted = new byte[data.length];
... | java | public static byte[] encrypt(byte[] data, byte[] key) {
checkNotNull(data);
checkNotNull(key);
checkArgument(key.length >= 5 && key.length <= 256);
StreamCipher rc4 = new RC4Engine();
rc4.init(true, new KeyParameter(key));
byte[] encrypted = new byte[data.length];
... | [
"public",
"static",
"byte",
"[",
"]",
"encrypt",
"(",
"byte",
"[",
"]",
"data",
",",
"byte",
"[",
"]",
"key",
")",
"{",
"checkNotNull",
"(",
"data",
")",
";",
"checkNotNull",
"(",
"key",
")",
";",
"checkArgument",
"(",
"key",
".",
"length",
">=",
"... | Encrypt data bytes using RC4
@param data data bytes to be encrypted
@param key rc4 key (40..2048 bits)
@return encrypted data bytes | [
"Encrypt",
"data",
"bytes",
"using",
"RC4"
] | 5f158478612698ecfd65fb0a0f9862a54ca17a8d | https://github.com/huahang/crypto-utils/blob/5f158478612698ecfd65fb0a0f9862a54ca17a8d/crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java#L46-L55 | train |
huahang/crypto-utils | crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java | Rc4Utils.encrypt | public static OutputStream encrypt(OutputStream outputStream, byte[] key) {
checkNotNull(outputStream);
checkNotNull(key);
checkArgument(key.length >= 5 && key.length <= 256);
StreamCipher rc4 = new RC4Engine();
rc4.init(true, new KeyParameter(key));
return new CipherOutp... | java | public static OutputStream encrypt(OutputStream outputStream, byte[] key) {
checkNotNull(outputStream);
checkNotNull(key);
checkArgument(key.length >= 5 && key.length <= 256);
StreamCipher rc4 = new RC4Engine();
rc4.init(true, new KeyParameter(key));
return new CipherOutp... | [
"public",
"static",
"OutputStream",
"encrypt",
"(",
"OutputStream",
"outputStream",
",",
"byte",
"[",
"]",
"key",
")",
"{",
"checkNotNull",
"(",
"outputStream",
")",
";",
"checkNotNull",
"(",
"key",
")",
";",
"checkArgument",
"(",
"key",
".",
"length",
">=",... | Encrypt output stream using RC4
@param outputStream output stream to be encrypted
@param key rc4 key (40..2048 bits)
@return encrypted output stream | [
"Encrypt",
"output",
"stream",
"using",
"RC4"
] | 5f158478612698ecfd65fb0a0f9862a54ca17a8d | https://github.com/huahang/crypto-utils/blob/5f158478612698ecfd65fb0a0f9862a54ca17a8d/crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java#L64-L71 | train |
huahang/crypto-utils | crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java | Rc4Utils.decrypt | public static byte[] decrypt(byte[] data, byte[] key) {
checkNotNull(data);
checkNotNull(key);
checkArgument(key.length >= 5 && key.length <= 256);
StreamCipher rc4 = new RC4Engine();
rc4.init(false, new KeyParameter(key));
byte[] decrypted = new byte[data.length];
... | java | public static byte[] decrypt(byte[] data, byte[] key) {
checkNotNull(data);
checkNotNull(key);
checkArgument(key.length >= 5 && key.length <= 256);
StreamCipher rc4 = new RC4Engine();
rc4.init(false, new KeyParameter(key));
byte[] decrypted = new byte[data.length];
... | [
"public",
"static",
"byte",
"[",
"]",
"decrypt",
"(",
"byte",
"[",
"]",
"data",
",",
"byte",
"[",
"]",
"key",
")",
"{",
"checkNotNull",
"(",
"data",
")",
";",
"checkNotNull",
"(",
"key",
")",
";",
"checkArgument",
"(",
"key",
".",
"length",
">=",
"... | Decrypt data bytes using RC4
@param data data bytes to be decrypted
@param key rc4 key (40..2048 bits)
@return decrypted data bytes | [
"Decrypt",
"data",
"bytes",
"using",
"RC4"
] | 5f158478612698ecfd65fb0a0f9862a54ca17a8d | https://github.com/huahang/crypto-utils/blob/5f158478612698ecfd65fb0a0f9862a54ca17a8d/crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java#L80-L89 | train |
huahang/crypto-utils | crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java | Rc4Utils.decrypt | public static InputStream decrypt(InputStream inputStream, byte[] key) {
checkNotNull(inputStream);
checkNotNull(key);
checkArgument(key.length >= 5 && key.length <= 256);
StreamCipher rc4 = new RC4Engine();
rc4.init(false, new KeyParameter(key));
return new CipherInputSt... | java | public static InputStream decrypt(InputStream inputStream, byte[] key) {
checkNotNull(inputStream);
checkNotNull(key);
checkArgument(key.length >= 5 && key.length <= 256);
StreamCipher rc4 = new RC4Engine();
rc4.init(false, new KeyParameter(key));
return new CipherInputSt... | [
"public",
"static",
"InputStream",
"decrypt",
"(",
"InputStream",
"inputStream",
",",
"byte",
"[",
"]",
"key",
")",
"{",
"checkNotNull",
"(",
"inputStream",
")",
";",
"checkNotNull",
"(",
"key",
")",
";",
"checkArgument",
"(",
"key",
".",
"length",
">=",
"... | Decrypt input stream using RC4
@param inputStream input stream to be decrypted
@param key rc4 key (40..2048 bits)
@return decrypted input stream | [
"Decrypt",
"input",
"stream",
"using",
"RC4"
] | 5f158478612698ecfd65fb0a0f9862a54ca17a8d | https://github.com/huahang/crypto-utils/blob/5f158478612698ecfd65fb0a0f9862a54ca17a8d/crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java#L99-L106 | train |
huahang/crypto-utils | crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java | Rc4Utils.createRC4DropCipher | public static StreamCipher createRC4DropCipher(byte[] key, int drop) {
checkArgument(key.length >= 5 && key.length <= 256);
checkArgument(drop > 0);
RC4Engine rc4Engine = new RC4Engine();
rc4Engine.init(true, new KeyParameter(key));
byte[] dropBytes = new byte[drop];
Arra... | java | public static StreamCipher createRC4DropCipher(byte[] key, int drop) {
checkArgument(key.length >= 5 && key.length <= 256);
checkArgument(drop > 0);
RC4Engine rc4Engine = new RC4Engine();
rc4Engine.init(true, new KeyParameter(key));
byte[] dropBytes = new byte[drop];
Arra... | [
"public",
"static",
"StreamCipher",
"createRC4DropCipher",
"(",
"byte",
"[",
"]",
"key",
",",
"int",
"drop",
")",
"{",
"checkArgument",
"(",
"key",
".",
"length",
">=",
"5",
"&&",
"key",
".",
"length",
"<=",
"256",
")",
";",
"checkArgument",
"(",
"drop",... | Creates an RC4-drop cipher
@param key rc4 key (40..2048 bits)
@param drop number of bytes to drop
@return decrypted input stream | [
"Creates",
"an",
"RC4",
"-",
"drop",
"cipher"
] | 5f158478612698ecfd65fb0a0f9862a54ca17a8d | https://github.com/huahang/crypto-utils/blob/5f158478612698ecfd65fb0a0f9862a54ca17a8d/crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java#L116-L125 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_interface.java | xen_health_interface.get | public static xen_health_interface get(nitro_service client, xen_health_interface resource) throws Exception
{
resource.validate("get");
return ((xen_health_interface[]) resource.get_resources(client))[0];
} | java | public static xen_health_interface get(nitro_service client, xen_health_interface resource) throws Exception
{
resource.validate("get");
return ((xen_health_interface[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"xen_health_interface",
"get",
"(",
"nitro_service",
"client",
",",
"xen_health_interface",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"xen_health_interface",
"[",
"]"... | Use this operation to get health and virtual function statistics for the interface. | [
"Use",
"this",
"operation",
"to",
"get",
"health",
"and",
"virtual",
"function",
"statistics",
"for",
"the",
"interface",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_interface.java#L316-L320 | train |
jdavisonc/ftp-common | src/main/java/net/seedboxer/common/ftp/FtpUploaderCommons.java | FtpUploaderCommons.listFiles | private Map<String, Long> listFiles() throws FtpException {
int attempts = 0;
Map<String, Long> files = new LinkedHashMap<String, Long>();
while (true){
try {
FTPListParseEngine engine = null;
if (type.startsWith("UNIX")) {
engine = ftpClient.initiateListParsing(FTPClientConfig.SYST_UNIX, null);
... | java | private Map<String, Long> listFiles() throws FtpException {
int attempts = 0;
Map<String, Long> files = new LinkedHashMap<String, Long>();
while (true){
try {
FTPListParseEngine engine = null;
if (type.startsWith("UNIX")) {
engine = ftpClient.initiateListParsing(FTPClientConfig.SYST_UNIX, null);
... | [
"private",
"Map",
"<",
"String",
",",
"Long",
">",
"listFiles",
"(",
")",
"throws",
"FtpException",
"{",
"int",
"attempts",
"=",
"0",
";",
"Map",
"<",
"String",
",",
"Long",
">",
"files",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"Long",
">",
... | List files inside the current folder.
@return List with files names and size
@throws IOException | [
"List",
"files",
"inside",
"the",
"current",
"folder",
"."
] | 5b4bd32dcb08c7964ddd908d4477143f3b135bff | https://github.com/jdavisonc/ftp-common/blob/5b4bd32dcb08c7964ddd908d4477143f3b135bff/src/main/java/net/seedboxer/common/ftp/FtpUploaderCommons.java#L319-L347 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/VictimsRecord.java | VictimsRecord.normalizeKey | public static String normalizeKey(Algorithms alg) {
if (alg.equals(Algorithms.SHA512)) {
return FieldName.SHA512;
}
return alg.toString().toLowerCase();
} | java | public static String normalizeKey(Algorithms alg) {
if (alg.equals(Algorithms.SHA512)) {
return FieldName.SHA512;
}
return alg.toString().toLowerCase();
} | [
"public",
"static",
"String",
"normalizeKey",
"(",
"Algorithms",
"alg",
")",
"{",
"if",
"(",
"alg",
".",
"equals",
"(",
"Algorithms",
".",
"SHA512",
")",
")",
"{",
"return",
"FieldName",
".",
"SHA512",
";",
"}",
"return",
"alg",
".",
"toString",
"(",
"... | Handles difference in the keys used for algorithms
@param alg
@return | [
"Handles",
"difference",
"in",
"the",
"keys",
"used",
"for",
"algorithms"
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/VictimsRecord.java#L272-L277 | train |
jsilland/piezo | src/main/java/io/soliton/protobuf/json/JsonRpcClientHandler.java | JsonRpcClientHandler.newProvisionalResponse | <O extends Message> JsonResponseFuture<O> newProvisionalResponse(ClientMethod<O> method) {
long requestId = RANDOM.nextLong();
JsonResponseFuture<O> outputFuture = new JsonResponseFuture<>(requestId, method);
inFlightRequests.put(requestId, outputFuture);
return outputFuture;
} | java | <O extends Message> JsonResponseFuture<O> newProvisionalResponse(ClientMethod<O> method) {
long requestId = RANDOM.nextLong();
JsonResponseFuture<O> outputFuture = new JsonResponseFuture<>(requestId, method);
inFlightRequests.put(requestId, outputFuture);
return outputFuture;
} | [
"<",
"O",
"extends",
"Message",
">",
"JsonResponseFuture",
"<",
"O",
">",
"newProvisionalResponse",
"(",
"ClientMethod",
"<",
"O",
">",
"method",
")",
"{",
"long",
"requestId",
"=",
"RANDOM",
".",
"nextLong",
"(",
")",
";",
"JsonResponseFuture",
"<",
"O",
... | Returns a new provisional response suited to receive results of a given
protobuf message type.
@param method the method invocation for which a response should be created
@param <O> the type of the message this response will handle | [
"Returns",
"a",
"new",
"provisional",
"response",
"suited",
"to",
"receive",
"results",
"of",
"a",
"given",
"protobuf",
"message",
"type",
"."
] | 9a340f1460d25e07ec475dd24128b838667c959b | https://github.com/jsilland/piezo/blob/9a340f1460d25e07ec475dd24128b838667c959b/src/main/java/io/soliton/protobuf/json/JsonRpcClientHandler.java#L121-L126 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.concat | public static String concat(String[] values, String delimiter) {
Assert.notNull(values, "The array of String values to concatenate cannot be null!");
StringBuilder buffer = new StringBuilder();
for (String value : values) {
buffer.append(buffer.length() > 0 ? delimiter : EMPTY_STRING);
buffer... | java | public static String concat(String[] values, String delimiter) {
Assert.notNull(values, "The array of String values to concatenate cannot be null!");
StringBuilder buffer = new StringBuilder();
for (String value : values) {
buffer.append(buffer.length() > 0 ? delimiter : EMPTY_STRING);
buffer... | [
"public",
"static",
"String",
"concat",
"(",
"String",
"[",
"]",
"values",
",",
"String",
"delimiter",
")",
"{",
"Assert",
".",
"notNull",
"(",
"values",
",",
"\"The array of String values to concatenate cannot be null!\"",
")",
";",
"StringBuilder",
"buffer",
"=",
... | Concatenates the array of Strings into a single String value delimited by the specified delimiter.
@param values an array of Strings to concatenate.
@param delimiter the String used as the delimiter separating the String values from the array.
@return a single String value containing all Strings from the array concate... | [
"Concatenates",
"the",
"array",
"of",
"Strings",
"into",
"a",
"single",
"String",
"value",
"delimited",
"by",
"the",
"specified",
"delimiter",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L106-L118 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.contains | @NullSafe
public static boolean contains(String text, String value) {
return text != null && value != null && text.contains(value);
} | java | @NullSafe
public static boolean contains(String text, String value) {
return text != null && value != null && text.contains(value);
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"contains",
"(",
"String",
"text",
",",
"String",
"value",
")",
"{",
"return",
"text",
"!=",
"null",
"&&",
"value",
"!=",
"null",
"&&",
"text",
".",
"contains",
"(",
"value",
")",
";",
"}"
] | Determines whether the String value contains the specified text, guarding against null values.
@param text {@link String} evaluated for value containment.
@param value {@link String} used to determine if the value is contained in the text.
@return a boolean value if the {@link String} text contains the value.
@see jav... | [
"Determines",
"whether",
"the",
"String",
"value",
"contains",
"the",
"specified",
"text",
"guarding",
"against",
"null",
"values",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L128-L131 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.containsDigits | @NullSafe
public static boolean containsDigits(String value) {
for (char chr : toCharArray(value)) {
if (Character.isDigit(chr)) {
return true;
}
}
return false;
} | java | @NullSafe
public static boolean containsDigits(String value) {
for (char chr : toCharArray(value)) {
if (Character.isDigit(chr)) {
return true;
}
}
return false;
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"containsDigits",
"(",
"String",
"value",
")",
"{",
"for",
"(",
"char",
"chr",
":",
"toCharArray",
"(",
"value",
")",
")",
"{",
"if",
"(",
"Character",
".",
"isDigit",
"(",
"chr",
")",
")",
"{",
"return",... | Determines whether the String value contains any digits, guarding against null values.
@param value the String value being evaluated for digits containment.
@return a boolean value indicating whether the String value contains any digits.
@see #toCharArray(String)
@see java.lang.Character#isDigit(char) | [
"Determines",
"whether",
"the",
"String",
"value",
"contains",
"any",
"digits",
"guarding",
"against",
"null",
"values",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L141-L151 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.containsLetters | @NullSafe
public static boolean containsLetters(String value) {
for (char chr: toCharArray(value)) {
if (Character.isLetter(chr)) {
return true;
}
}
return false;
} | java | @NullSafe
public static boolean containsLetters(String value) {
for (char chr: toCharArray(value)) {
if (Character.isLetter(chr)) {
return true;
}
}
return false;
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"containsLetters",
"(",
"String",
"value",
")",
"{",
"for",
"(",
"char",
"chr",
":",
"toCharArray",
"(",
"value",
")",
")",
"{",
"if",
"(",
"Character",
".",
"isLetter",
"(",
"chr",
")",
")",
"{",
"return... | Determines whether the String value contains any letters, guarding against null values.
@param value the String value being evaluated for letter containment.
@return a boolean value indicating whether the String value contains any letters.
@see #toCharArray(String)
@see java.lang.Character#isLetter(char) | [
"Determines",
"whether",
"the",
"String",
"value",
"contains",
"any",
"letters",
"guarding",
"against",
"null",
"values",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L161-L171 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.containsWhitespace | @NullSafe
public static boolean containsWhitespace(String value) {
for (char chr : toCharArray(value)) {
if (Character.isWhitespace(chr)) {
return true;
}
}
return false;
} | java | @NullSafe
public static boolean containsWhitespace(String value) {
for (char chr : toCharArray(value)) {
if (Character.isWhitespace(chr)) {
return true;
}
}
return false;
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"containsWhitespace",
"(",
"String",
"value",
")",
"{",
"for",
"(",
"char",
"chr",
":",
"toCharArray",
"(",
"value",
")",
")",
"{",
"if",
"(",
"Character",
".",
"isWhitespace",
"(",
"chr",
")",
")",
"{",
... | Determines whether the String value contains any whitespace, guarding against null values.
@param value the String value being evaluated for whitespace containment.
@return a boolean value indicating whether the String value contains any whitespace.
@see #toCharArray(String)
@see java.lang.Character#isWhitespace(char) | [
"Determines",
"whether",
"the",
"String",
"value",
"contains",
"any",
"whitespace",
"guarding",
"against",
"null",
"values",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L181-L191 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.defaultIfBlank | @NullSafe
public static String defaultIfBlank(String value, String... defaultValues) {
if (isBlank(value)) {
for (String defaultValue : defaultValues) {
if (hasText(defaultValue)) {
return defaultValue;
}
}
}
return value;
} | java | @NullSafe
public static String defaultIfBlank(String value, String... defaultValues) {
if (isBlank(value)) {
for (String defaultValue : defaultValues) {
if (hasText(defaultValue)) {
return defaultValue;
}
}
}
return value;
} | [
"@",
"NullSafe",
"public",
"static",
"String",
"defaultIfBlank",
"(",
"String",
"value",
",",
"String",
"...",
"defaultValues",
")",
"{",
"if",
"(",
"isBlank",
"(",
"value",
")",
")",
"{",
"for",
"(",
"String",
"defaultValue",
":",
"defaultValues",
")",
"{... | Defaults the given String to the first non-blank default value if the given String is blank, otherwise returns
the given String.
@param value the String to evaluate if blank.
@param defaultValues an array of default String values to use if the given String is blank.
@return the first non-blank default String value if ... | [
"Defaults",
"the",
"given",
"String",
"to",
"the",
"first",
"non",
"-",
"blank",
"default",
"value",
"if",
"the",
"given",
"String",
"is",
"blank",
"otherwise",
"returns",
"the",
"given",
"String",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L204-L216 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.equalsIgnoreCase | @NullSafe
public static boolean equalsIgnoreCase(String stringOne, String stringTwo) {
return stringOne != null && stringOne.equalsIgnoreCase(stringTwo);
} | java | @NullSafe
public static boolean equalsIgnoreCase(String stringOne, String stringTwo) {
return stringOne != null && stringOne.equalsIgnoreCase(stringTwo);
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"equalsIgnoreCase",
"(",
"String",
"stringOne",
",",
"String",
"stringTwo",
")",
"{",
"return",
"stringOne",
"!=",
"null",
"&&",
"stringOne",
".",
"equalsIgnoreCase",
"(",
"stringTwo",
")",
";",
"}"
] | Determines whether two String values are equal in value ignoring case and guarding against null values.
@param stringOne the first String value in the case-insensitive equality comparison.
@param stringTwo the second String value in the case-insensitive equality comparison.
@return a boolean value indicating if the tw... | [
"Determines",
"whether",
"two",
"String",
"values",
"are",
"equal",
"in",
"value",
"ignoring",
"case",
"and",
"guarding",
"against",
"null",
"values",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L226-L229 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.getDigits | public static String getDigits(String value) {
StringBuilder digits = new StringBuilder(value.length());
for (char chr : value.toCharArray()) {
if (Character.isDigit(chr)) {
digits.append(chr);
}
}
return digits.toString();
} | java | public static String getDigits(String value) {
StringBuilder digits = new StringBuilder(value.length());
for (char chr : value.toCharArray()) {
if (Character.isDigit(chr)) {
digits.append(chr);
}
}
return digits.toString();
} | [
"public",
"static",
"String",
"getDigits",
"(",
"String",
"value",
")",
"{",
"StringBuilder",
"digits",
"=",
"new",
"StringBuilder",
"(",
"value",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
"char",
"chr",
":",
"value",
".",
"toCharArray",
"(",
")",
... | Extracts numbers from the String value.
@param value the String value from which to extract numbers.
@return only numbers from the String value.
@throws NullPointerException if the String value is null.
@see java.lang.Character#isDigit(char) | [
"Extracts",
"numbers",
"from",
"the",
"String",
"value",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L239-L250 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.getLetters | public static String getLetters(String value) {
StringBuilder letters = new StringBuilder(value.length());
for (char chr : value.toCharArray()) {
if (Character.isLetter(chr)) {
letters.append(chr);
}
}
return letters.toString();
} | java | public static String getLetters(String value) {
StringBuilder letters = new StringBuilder(value.length());
for (char chr : value.toCharArray()) {
if (Character.isLetter(chr)) {
letters.append(chr);
}
}
return letters.toString();
} | [
"public",
"static",
"String",
"getLetters",
"(",
"String",
"value",
")",
"{",
"StringBuilder",
"letters",
"=",
"new",
"StringBuilder",
"(",
"value",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
"char",
"chr",
":",
"value",
".",
"toCharArray",
"(",
")",... | Extracts letters from the String value.
@param value the String value from which to extract letters.
@return only letters from the String value.
@throws NullPointerException if the String value is null.
@see java.lang.Character#isLetter(char) | [
"Extracts",
"letters",
"from",
"the",
"String",
"value",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L260-L271 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.getSpaces | public static String getSpaces(int number) {
Assert.argument(number >= 0, "The number [{0}] of desired spaces must be greater than equal to 0", number);
StringBuilder spaces = new StringBuilder(Math.max(number, 0));
while (number > 0) {
int count = Math.min(SPACES.length - 1, number);
spaces.... | java | public static String getSpaces(int number) {
Assert.argument(number >= 0, "The number [{0}] of desired spaces must be greater than equal to 0", number);
StringBuilder spaces = new StringBuilder(Math.max(number, 0));
while (number > 0) {
int count = Math.min(SPACES.length - 1, number);
spaces.... | [
"public",
"static",
"String",
"getSpaces",
"(",
"int",
"number",
")",
"{",
"Assert",
".",
"argument",
"(",
"number",
">=",
"0",
",",
"\"The number [{0}] of desired spaces must be greater than equal to 0\"",
",",
"number",
")",
";",
"StringBuilder",
"spaces",
"=",
"n... | Constructs a String with only spaces up to the specified length.
@param number an integer value indicating the number of spaces in the String.
@return a String containing the specified number of spaces. | [
"Constructs",
"a",
"String",
"with",
"only",
"spaces",
"up",
"to",
"the",
"specified",
"length",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L279-L292 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.indexOf | @NullSafe
public static int indexOf(String text, String value) {
return text != null && value != null ? text.indexOf(value) : -1;
} | java | @NullSafe
public static int indexOf(String text, String value) {
return text != null && value != null ? text.indexOf(value) : -1;
} | [
"@",
"NullSafe",
"public",
"static",
"int",
"indexOf",
"(",
"String",
"text",
",",
"String",
"value",
")",
"{",
"return",
"text",
"!=",
"null",
"&&",
"value",
"!=",
"null",
"?",
"text",
".",
"indexOf",
"(",
"value",
")",
":",
"-",
"1",
";",
"}"
] | Determines the index of the first occurrence of token in the String value. This indexOf operation is null-safe
and returns a -1 if the String value is null, or the token does not exist in the String value.
@param text the String value used to search for the token.
@param value the text to search for in the String val... | [
"Determines",
"the",
"index",
"of",
"the",
"first",
"occurrence",
"of",
"token",
"in",
"the",
"String",
"value",
".",
"This",
"indexOf",
"operation",
"is",
"null",
"-",
"safe",
"and",
"returns",
"a",
"-",
"1",
"if",
"the",
"String",
"value",
"is",
"null"... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L318-L321 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.isDigits | @NullSafe
public static boolean isDigits(String value) {
for (char chr : toCharArray(value)) {
if (!Character.isDigit(chr)) {
return false;
}
}
return hasText(value);
} | java | @NullSafe
public static boolean isDigits(String value) {
for (char chr : toCharArray(value)) {
if (!Character.isDigit(chr)) {
return false;
}
}
return hasText(value);
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"isDigits",
"(",
"String",
"value",
")",
"{",
"for",
"(",
"char",
"chr",
":",
"toCharArray",
"(",
"value",
")",
")",
"{",
"if",
"(",
"!",
"Character",
".",
"isDigit",
"(",
"chr",
")",
")",
"{",
"return"... | Determines whether the String value represents a number, i.e. consists entirely of digits.
@param value the String value for determination as a number.
@return a boolean value indicating if the String value represents a number.
@see java.lang.Character#isDigit(char)
@see #hasText(String)
@see #toCharArray(String) | [
"Determines",
"whether",
"the",
"String",
"value",
"represents",
"a",
"number",
"i",
".",
"e",
".",
"consists",
"entirely",
"of",
"digits",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L346-L356 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.isLetters | @NullSafe
public static boolean isLetters(String value) {
for (char chr : toCharArray(value)) {
if (!Character.isLetter(chr)) {
return false;
}
}
return hasText(value);
} | java | @NullSafe
public static boolean isLetters(String value) {
for (char chr : toCharArray(value)) {
if (!Character.isLetter(chr)) {
return false;
}
}
return hasText(value);
} | [
"@",
"NullSafe",
"public",
"static",
"boolean",
"isLetters",
"(",
"String",
"value",
")",
"{",
"for",
"(",
"char",
"chr",
":",
"toCharArray",
"(",
"value",
")",
")",
"{",
"if",
"(",
"!",
"Character",
".",
"isLetter",
"(",
"chr",
")",
")",
"{",
"retur... | Determines whether the String value consists entirely of letters.
@param value the String value for determination as text.
@return a boolean value indicating if the String value consists entirely of letters.
@see java.lang.Character#isLetter(char)
@see #hasText(String)
@see #toCharArray(String) | [
"Determines",
"whether",
"the",
"String",
"value",
"consists",
"entirely",
"of",
"letters",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L381-L391 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.lastIndexOf | @NullSafe
public static int lastIndexOf(String text, String value) {
return text != null && value != null ? text.lastIndexOf(value) : -1;
} | java | @NullSafe
public static int lastIndexOf(String text, String value) {
return text != null && value != null ? text.lastIndexOf(value) : -1;
} | [
"@",
"NullSafe",
"public",
"static",
"int",
"lastIndexOf",
"(",
"String",
"text",
",",
"String",
"value",
")",
"{",
"return",
"text",
"!=",
"null",
"&&",
"value",
"!=",
"null",
"?",
"text",
".",
"lastIndexOf",
"(",
"value",
")",
":",
"-",
"1",
";",
"... | Determines the index of the last occurrence of token in the String value. This lastIndexOf operation is null-safe
and returns a -1 if the String value is null, or the token does not exist in the String value.
@param text the String value used to search for the token.
@param value the text to search for in the String ... | [
"Determines",
"the",
"index",
"of",
"the",
"last",
"occurrence",
"of",
"token",
"in",
"the",
"String",
"value",
".",
"This",
"lastIndexOf",
"operation",
"is",
"null",
"-",
"safe",
"and",
"returns",
"a",
"-",
"1",
"if",
"the",
"String",
"value",
"is",
"nu... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L404-L407 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.pad | @NullSafe
public static String pad(String value, int length) {
return pad(value, SINGLE_SPACE_CHAR, length);
} | java | @NullSafe
public static String pad(String value, int length) {
return pad(value, SINGLE_SPACE_CHAR, length);
} | [
"@",
"NullSafe",
"public",
"static",
"String",
"pad",
"(",
"String",
"value",
",",
"int",
"length",
")",
"{",
"return",
"pad",
"(",
"value",
",",
"SINGLE_SPACE_CHAR",
",",
"length",
")",
";",
"}"
] | Pads the given String with the specified number of spaces to the right.
@param value the String to pad.
@param length the total length of the given String with padding.
@return the given String padded with spaces up to the specified length.
@see #pad(String, char, int) | [
"Pads",
"the",
"given",
"String",
"with",
"the",
"specified",
"number",
"of",
"spaces",
"to",
"the",
"right",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L430-L433 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.pad | @NullSafe
@SuppressWarnings("all")
public static String pad(String value, char padding, int length) {
assertThat(length).throwing(new IllegalArgumentException(String.format(
"[%d] must be greater than equal to 0", length))).isGreaterThanEqualTo(0);
if (length > 0) {
StringBuilder builder = ne... | java | @NullSafe
@SuppressWarnings("all")
public static String pad(String value, char padding, int length) {
assertThat(length).throwing(new IllegalArgumentException(String.format(
"[%d] must be greater than equal to 0", length))).isGreaterThanEqualTo(0);
if (length > 0) {
StringBuilder builder = ne... | [
"@",
"NullSafe",
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"public",
"static",
"String",
"pad",
"(",
"String",
"value",
",",
"char",
"padding",
",",
"int",
"length",
")",
"{",
"assertThat",
"(",
"length",
")",
".",
"throwing",
"(",
"new",
"IllegalArgum... | Pads the given String with the specified number of characters to the right.
@param value the String to pad.
@param padding the character used for padding.
@param length the total length of the given String with padding.
@return the given String padded with the specified character up to the specified length.
@throws Il... | [
"Pads",
"the",
"given",
"String",
"with",
"the",
"specified",
"number",
"of",
"characters",
"to",
"the",
"right",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L444-L463 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.singleSpaceObjects | public static String singleSpaceObjects(Object... values) {
List<String> valueList = new ArrayList<>(values.length);
for (Object value : values) {
valueList.add(String.valueOf(value));
}
return trim(concat(valueList.toArray(new String[valueList.size()]), SINGLE_SPACE));
} | java | public static String singleSpaceObjects(Object... values) {
List<String> valueList = new ArrayList<>(values.length);
for (Object value : values) {
valueList.add(String.valueOf(value));
}
return trim(concat(valueList.toArray(new String[valueList.size()]), SINGLE_SPACE));
} | [
"public",
"static",
"String",
"singleSpaceObjects",
"(",
"Object",
"...",
"values",
")",
"{",
"List",
"<",
"String",
">",
"valueList",
"=",
"new",
"ArrayList",
"<>",
"(",
"values",
".",
"length",
")",
";",
"for",
"(",
"Object",
"value",
":",
"values",
")... | Single spaces the elements in the Object array and converts all values into a String representation using
Object.toString to be placed in a single String.
@param values an array of Object values to be converted and combined into a String.
@return a String value containing all the Object values in String form single sp... | [
"Single",
"spaces",
"the",
"elements",
"in",
"the",
"Object",
"array",
"and",
"converts",
"all",
"values",
"into",
"a",
"String",
"representation",
"using",
"Object",
".",
"toString",
"to",
"be",
"placed",
"in",
"a",
"single",
"String",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L510-L519 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.singleSpaceString | public static String singleSpaceString(String value) {
Assert.hasText(value, "String value must contain text");
return trim(concat(value.split("\\s+"), SINGLE_SPACE));
} | java | public static String singleSpaceString(String value) {
Assert.hasText(value, "String value must contain text");
return trim(concat(value.split("\\s+"), SINGLE_SPACE));
} | [
"public",
"static",
"String",
"singleSpaceString",
"(",
"String",
"value",
")",
"{",
"Assert",
".",
"hasText",
"(",
"value",
",",
"\"String value must contain text\"",
")",
";",
"return",
"trim",
"(",
"concat",
"(",
"value",
".",
"split",
"(",
"\"\\\\s+\"",
")... | Single spaces the tokens in the specified String value. A token is defined as any non-whitespace character.
@param value the String value for which the tokens will be single spaced.
@return a modified String where the tokens in the String value have been single spaced.
@see #concat(String[], String) | [
"Single",
"spaces",
"the",
"tokens",
"in",
"the",
"specified",
"String",
"value",
".",
"A",
"token",
"is",
"defined",
"as",
"any",
"non",
"-",
"whitespace",
"character",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L528-L533 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.toLowerCase | @NullSafe
public static String toLowerCase(String value) {
return value != null ? value.toLowerCase() : null;
} | java | @NullSafe
public static String toLowerCase(String value) {
return value != null ? value.toLowerCase() : null;
} | [
"@",
"NullSafe",
"public",
"static",
"String",
"toLowerCase",
"(",
"String",
"value",
")",
"{",
"return",
"value",
"!=",
"null",
"?",
"value",
".",
"toLowerCase",
"(",
")",
":",
"null",
";",
"}"
] | Converts the String value to all lower case characters. toLowerCase is a null-safe operation.
@param value the String value who's characters are all converted to lower case.
@return the String value with all lower case characters.
@see #toUpperCase(String)
@see java.lang.String#toLowerCase() | [
"Converts",
"the",
"String",
"value",
"to",
"all",
"lower",
"case",
"characters",
".",
"toLowerCase",
"is",
"a",
"null",
"-",
"safe",
"operation",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L555-L558 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.toStringArray | @NullSafe
@SuppressWarnings("all")
public static String[] toStringArray(String delimitedValue, String delimiter) {
return ArrayUtils.transform(ObjectUtils.defaultIfNull(delimitedValue, EMPTY_STRING).split(
defaultIfBlank(delimiter, COMMA_DELIMITER)), StringUtils::trim);
} | java | @NullSafe
@SuppressWarnings("all")
public static String[] toStringArray(String delimitedValue, String delimiter) {
return ArrayUtils.transform(ObjectUtils.defaultIfNull(delimitedValue, EMPTY_STRING).split(
defaultIfBlank(delimiter, COMMA_DELIMITER)), StringUtils::trim);
} | [
"@",
"NullSafe",
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"public",
"static",
"String",
"[",
"]",
"toStringArray",
"(",
"String",
"delimitedValue",
",",
"String",
"delimiter",
")",
"{",
"return",
"ArrayUtils",
".",
"transform",
"(",
"ObjectUtils",
".",
"d... | Tokenizes the given delimited String into an array of individually trimmed Strings. If String is blank,
empty or null, then a 0 length String array is returned. If the String is not delimited with the specified
delimiter then a String array of size 1 is returned with the given String value as the only element.
@param... | [
"Tokenizes",
"the",
"given",
"delimited",
"String",
"into",
"an",
"array",
"of",
"individually",
"trimmed",
"Strings",
".",
"If",
"String",
"is",
"blank",
"empty",
"or",
"null",
"then",
"a",
"0",
"length",
"String",
"array",
"is",
"returned",
".",
"If",
"t... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L588-L593 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.toUpperCase | @NullSafe
public static String toUpperCase(String value) {
return value != null ? value.toUpperCase() : null;
} | java | @NullSafe
public static String toUpperCase(String value) {
return value != null ? value.toUpperCase() : null;
} | [
"@",
"NullSafe",
"public",
"static",
"String",
"toUpperCase",
"(",
"String",
"value",
")",
"{",
"return",
"value",
"!=",
"null",
"?",
"value",
".",
"toUpperCase",
"(",
")",
":",
"null",
";",
"}"
] | Converts the String value to all UPPER case characters. toUpperCase is a null-safe operation.
@param value the String value who's characters are all converted to UPPER case.
@return the String value with all UPPER case characters.
@see #toLowerCase(String)
@see java.lang.String#toUpperCase() | [
"Converts",
"the",
"String",
"value",
"to",
"all",
"UPPER",
"case",
"characters",
".",
"toUpperCase",
"is",
"a",
"null",
"-",
"safe",
"operation",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L603-L606 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.trim | @NullSafe
public static String trim(String value) {
return value != null ? value.trim() : null;
} | java | @NullSafe
public static String trim(String value) {
return value != null ? value.trim() : null;
} | [
"@",
"NullSafe",
"public",
"static",
"String",
"trim",
"(",
"String",
"value",
")",
"{",
"return",
"value",
"!=",
"null",
"?",
"value",
".",
"trim",
"(",
")",
":",
"null",
";",
"}"
] | Trims the specified String value, removing any whitespace from the beginning or end of a String.
@param value the String value to trim.
@return a trimmed version of the specified String value.
@see java.lang.String#trim() | [
"Trims",
"the",
"specified",
"String",
"value",
"removing",
"any",
"whitespace",
"from",
"the",
"beginning",
"or",
"end",
"of",
"a",
"String",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L615-L618 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.truncate | @NullSafe
public static String truncate(String value, int length) {
assertThat(length).throwing(new IllegalArgumentException(String.format(
"[%d] must be greater than equal to 0", length))).isGreaterThanEqualTo(0);
return (value != null ? value.substring(0, Math.min(value.length(), length)) : null);
... | java | @NullSafe
public static String truncate(String value, int length) {
assertThat(length).throwing(new IllegalArgumentException(String.format(
"[%d] must be greater than equal to 0", length))).isGreaterThanEqualTo(0);
return (value != null ? value.substring(0, Math.min(value.length(), length)) : null);
... | [
"@",
"NullSafe",
"public",
"static",
"String",
"truncate",
"(",
"String",
"value",
",",
"int",
"length",
")",
"{",
"assertThat",
"(",
"length",
")",
".",
"throwing",
"(",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"[%d] must be gre... | Truncates the given String to the desired length. If the String is blank, empty or null, then value is returned,
otherwise the String is truncated to the maximum length determined by the value's length and desired length.
@param value the String to truncate.
@param length an integer specifying the length to truncate ... | [
"Truncates",
"the",
"given",
"String",
"to",
"the",
"desired",
"length",
".",
"If",
"the",
"String",
"is",
"blank",
"empty",
"or",
"null",
"then",
"value",
"is",
"returned",
"otherwise",
"the",
"String",
"is",
"truncated",
"to",
"the",
"maximum",
"length",
... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L659-L666 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/StringUtils.java | StringUtils.wrap | public static String wrap(String line, int widthInCharacters, String indent) {
StringBuilder buffer = new StringBuilder();
int lineCount = 1;
int spaceIndex;
// if indent is null, then do not indent the wrapped lines
indent = (indent != null ? indent : EMPTY_STRING);
while (line.length() > w... | java | public static String wrap(String line, int widthInCharacters, String indent) {
StringBuilder buffer = new StringBuilder();
int lineCount = 1;
int spaceIndex;
// if indent is null, then do not indent the wrapped lines
indent = (indent != null ? indent : EMPTY_STRING);
while (line.length() > w... | [
"public",
"static",
"String",
"wrap",
"(",
"String",
"line",
",",
"int",
"widthInCharacters",
",",
"String",
"indent",
")",
"{",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"lineCount",
"=",
"1",
";",
"int",
"spaceIndex",
... | Wraps a line of text to no longer than the specified width, measured by the number of characters in each line,
indenting all subsequent lines with the indent. If the indent is null, then an empty String is used.
@param line a String containing the line of text to wrap.
@param widthInCharacters an integer value indica... | [
"Wraps",
"a",
"line",
"of",
"text",
"to",
"no",
"longer",
"than",
"the",
"specified",
"width",
"measured",
"by",
"the",
"number",
"of",
"characters",
"in",
"each",
"line",
"indenting",
"all",
"subsequent",
"lines",
"with",
"the",
"indent",
".",
"If",
"the"... | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L680-L705 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/Initializer.java | Initializer.init | public static boolean init(Object initableObj) {
if (initableObj instanceof Initable) {
((Initable) initableObj).init();
return true;
}
return false;
} | java | public static boolean init(Object initableObj) {
if (initableObj instanceof Initable) {
((Initable) initableObj).init();
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"init",
"(",
"Object",
"initableObj",
")",
"{",
"if",
"(",
"initableObj",
"instanceof",
"Initable",
")",
"{",
"(",
"(",
"Initable",
")",
"initableObj",
")",
".",
"init",
"(",
")",
";",
"return",
"true",
";",
"}",
"return",
... | Initializes an Object by calling it's init method if the Object is an instance of the Initable interface.
@param initableObj the Object to be initialized.
@return a boolean value indicating whether the Object has been initialized.
@see org.cp.elements.lang.Initable#init() | [
"Initializes",
"an",
"Object",
"by",
"calling",
"it",
"s",
"init",
"method",
"if",
"the",
"Object",
"is",
"an",
"instance",
"of",
"the",
"Initable",
"interface",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Initializer.java#L39-L47 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_fan_speed.java | xen_health_monitor_fan_speed.get_filtered | public static xen_health_monitor_fan_speed[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
xen_health_monitor_fan_speed obj = new xen_health_monitor_fan_speed();
options option = new options();
option.set_filter(filter);
xen_health_monitor_fan_speed[] response = (xen_health_... | java | public static xen_health_monitor_fan_speed[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
xen_health_monitor_fan_speed obj = new xen_health_monitor_fan_speed();
options option = new options();
option.set_filter(filter);
xen_health_monitor_fan_speed[] response = (xen_health_... | [
"public",
"static",
"xen_health_monitor_fan_speed",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"xen_health_monitor_fan_speed",
"obj",
"=",
"new",
"xen_health_monitor_fan_speed",
"("... | Use this API to fetch filtered set of xen_health_monitor_fan_speed resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"xen_health_monitor_fan_speed",
"resources",
".",
"set",
"the",
"filter",
"parameter",
"values",
"in",
"filtervalue",
"object",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_fan_speed.java#L88-L95 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_vserver_appflow_config.java | ns_vserver_appflow_config.get_filtered | public static ns_vserver_appflow_config[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
ns_vserver_appflow_config obj = new ns_vserver_appflow_config();
options option = new options();
option.set_filter(filter);
ns_vserver_appflow_config[] response = (ns_vserver_appflow_conf... | java | public static ns_vserver_appflow_config[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
ns_vserver_appflow_config obj = new ns_vserver_appflow_config();
options option = new options();
option.set_filter(filter);
ns_vserver_appflow_config[] response = (ns_vserver_appflow_conf... | [
"public",
"static",
"ns_vserver_appflow_config",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"ns_vserver_appflow_config",
"obj",
"=",
"new",
"ns_vserver_appflow_config",
"(",
")",
... | Use this API to fetch filtered set of ns_vserver_appflow_config resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"ns_vserver_appflow_config",
"resources",
".",
"set",
"the",
"filter",
"parameter",
"values",
"in",
"filtervalue",
"object",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_vserver_appflow_config.java#L385-L392 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/techsupport.java | techsupport.get_filtered | public static techsupport[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
techsupport obj = new techsupport();
options option = new options();
option.set_filter(filter);
techsupport[] response = (techsupport[]) obj.getfiltered(service, option);
return response;
} | java | public static techsupport[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
techsupport obj = new techsupport();
options option = new options();
option.set_filter(filter);
techsupport[] response = (techsupport[]) obj.getfiltered(service, option);
return response;
} | [
"public",
"static",
"techsupport",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"techsupport",
"obj",
"=",
"new",
"techsupport",
"(",
")",
";",
"options",
"option",
"=",
"... | Use this API to fetch filtered set of techsupport resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"techsupport",
"resources",
".",
"set",
"the",
"filter",
"parameter",
"values",
"in",
"filtervalue",
"object",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/techsupport.java#L244-L251 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/MathUtils.java | MathUtils.cylinderSurfaceArea | public static double cylinderSurfaceArea(final double radius, final double height) {
return ((2.0d * Math.PI * Math.pow(radius, 2)) + (2.0d * Math.PI * radius * height));
} | java | public static double cylinderSurfaceArea(final double radius, final double height) {
return ((2.0d * Math.PI * Math.pow(radius, 2)) + (2.0d * Math.PI * radius * height));
} | [
"public",
"static",
"double",
"cylinderSurfaceArea",
"(",
"final",
"double",
"radius",
",",
"final",
"double",
"height",
")",
"{",
"return",
"(",
"(",
"2.0d",
"*",
"Math",
".",
"PI",
"*",
"Math",
".",
"pow",
"(",
"radius",
",",
"2",
")",
")",
"+",
"(... | Calculates the surface area of a cylinder.
@param radius a double value indicating the radius of the cylinder.
@param height a double value indicating the height of the cylinder.
@return the surface area of a cylinder given the radius and height.
@see java.lang.Math#PI
@see java.lang.Math#pow(double, double) | [
"Calculates",
"the",
"surface",
"area",
"of",
"a",
"cylinder",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/MathUtils.java#L115-L117 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/MathUtils.java | MathUtils.factorial | public static BigInteger factorial(BigInteger value) {
Assert.notNull(value, "value must not be null");
Assert.isTrue(value.compareTo(BigInteger.ZERO) >= 0, String.format(NUMBER_LESS_THAN_ZERO_ERROR_MESSAGE, value));
if (value.compareTo(TWO) <= 0) {
return (value.equals(TWO) ? TWO : BigInteger.ONE);
... | java | public static BigInteger factorial(BigInteger value) {
Assert.notNull(value, "value must not be null");
Assert.isTrue(value.compareTo(BigInteger.ZERO) >= 0, String.format(NUMBER_LESS_THAN_ZERO_ERROR_MESSAGE, value));
if (value.compareTo(TWO) <= 0) {
return (value.equals(TWO) ? TWO : BigInteger.ONE);
... | [
"public",
"static",
"BigInteger",
"factorial",
"(",
"BigInteger",
"value",
")",
"{",
"Assert",
".",
"notNull",
"(",
"value",
",",
"\"value must not be null\"",
")",
";",
"Assert",
".",
"isTrue",
"(",
"value",
".",
"compareTo",
"(",
"BigInteger",
".",
"ZERO",
... | Calculates the factorial of the given number using an iterative algorithm and BigInteger value type
to avoid a StackOverflowException and numeric overflow, respectively.
@param value an Integer value used to compute the factorial.
@return the factorial of the given number.
@throws java.lang.IllegalArgumentException if... | [
"Calculates",
"the",
"factorial",
"of",
"the",
"given",
"number",
"using",
"an",
"iterative",
"algorithm",
"and",
"BigInteger",
"value",
"type",
"to",
"avoid",
"a",
"StackOverflowException",
"and",
"numeric",
"overflow",
"respectively",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/MathUtils.java#L178-L193 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/MathUtils.java | MathUtils.fibonacciSequence | public static int[] fibonacciSequence(final int n) {
Assert.argument(n > 0, "The number of elements from the Fibonacci Sequence to calculate must be greater than equal to 0!");
int[] fibonacciNumbers = new int[n];
for (int position = 0; position < n; position++) {
if (position == 0) {
fibona... | java | public static int[] fibonacciSequence(final int n) {
Assert.argument(n > 0, "The number of elements from the Fibonacci Sequence to calculate must be greater than equal to 0!");
int[] fibonacciNumbers = new int[n];
for (int position = 0; position < n; position++) {
if (position == 0) {
fibona... | [
"public",
"static",
"int",
"[",
"]",
"fibonacciSequence",
"(",
"final",
"int",
"n",
")",
"{",
"Assert",
".",
"argument",
"(",
"n",
">",
"0",
",",
"\"The number of elements from the Fibonacci Sequence to calculate must be greater than equal to 0!\"",
")",
";",
"int",
"... | Calculates the Fibonacci Sequence to the nth position.
@param n an integer value indicating the position of the nth element in the Fibonacci Sequence.
@return an integer array containing n elements of the Fibonacci Sequence.
@throws IllegalArgumentException if the position (n) is less than 1. | [
"Calculates",
"the",
"Fibonacci",
"Sequence",
"to",
"the",
"nth",
"position",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/MathUtils.java#L214-L232 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/MathUtils.java | MathUtils.max | @NullSafe
public static double max(final double... values) {
double maxValue = Double.NaN;
if (values != null) {
for (double value : values) {
maxValue = (Double.isNaN(maxValue) ? value : Math.max(maxValue, value));
}
}
return maxValue;
} | java | @NullSafe
public static double max(final double... values) {
double maxValue = Double.NaN;
if (values != null) {
for (double value : values) {
maxValue = (Double.isNaN(maxValue) ? value : Math.max(maxValue, value));
}
}
return maxValue;
} | [
"@",
"NullSafe",
"public",
"static",
"double",
"max",
"(",
"final",
"double",
"...",
"values",
")",
"{",
"double",
"maxValue",
"=",
"Double",
".",
"NaN",
";",
"if",
"(",
"values",
"!=",
"null",
")",
"{",
"for",
"(",
"double",
"value",
":",
"values",
... | Determines the maximum numerical value in an array of values.
@param values an array of numerical values from which to determine the maximum value.
@return the maximum numerical value in the array of numerical values. Returns Double.NaN
if the array of values is null.
@see java.lang.Double#NaN
@see java.lang.Math#max... | [
"Determines",
"the",
"maximum",
"numerical",
"value",
"in",
"an",
"array",
"of",
"values",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/MathUtils.java#L254-L265 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/MathUtils.java | MathUtils.min | @NullSafe
public static double min(final double... values) {
double minValue = Double.NaN;
if (values != null) {
for (double value : values) {
minValue = (Double.isNaN(minValue) ? value : Math.min(minValue, value));
}
}
return minValue;
} | java | @NullSafe
public static double min(final double... values) {
double minValue = Double.NaN;
if (values != null) {
for (double value : values) {
minValue = (Double.isNaN(minValue) ? value : Math.min(minValue, value));
}
}
return minValue;
} | [
"@",
"NullSafe",
"public",
"static",
"double",
"min",
"(",
"final",
"double",
"...",
"values",
")",
"{",
"double",
"minValue",
"=",
"Double",
".",
"NaN",
";",
"if",
"(",
"values",
"!=",
"null",
")",
"{",
"for",
"(",
"double",
"value",
":",
"values",
... | Determines the minimum numerical value in an array of values.
@param values an array of numerical values from which to determine the minimum value.
@return the minimum numerical value in the array of numerical values. Returns Double.NaN
if the array of values is null.
@see java.lang.Double#NaN
@see java.lang.Math#min... | [
"Determines",
"the",
"minimum",
"numerical",
"value",
"in",
"an",
"array",
"of",
"values",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/MathUtils.java#L276-L287 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/MathUtils.java | MathUtils.multiply | @NullSafe
public static int multiply(final int... numbers) {
int result = 0;
if (numbers != null) {
result = (numbers.length > 0 ? 1 : 0);
for (int number : numbers) {
result *= number;
}
}
return result;
} | java | @NullSafe
public static int multiply(final int... numbers) {
int result = 0;
if (numbers != null) {
result = (numbers.length > 0 ? 1 : 0);
for (int number : numbers) {
result *= number;
}
}
return result;
} | [
"@",
"NullSafe",
"public",
"static",
"int",
"multiply",
"(",
"final",
"int",
"...",
"numbers",
")",
"{",
"int",
"result",
"=",
"0",
";",
"if",
"(",
"numbers",
"!=",
"null",
")",
"{",
"result",
"=",
"(",
"numbers",
".",
"length",
">",
"0",
"?",
"1",... | Multiplies the array of numbers.
@param numbers the array of integer values to multiply.
@return the array of integer numbers multiplied together. | [
"Multiplies",
"the",
"array",
"of",
"numbers",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/MathUtils.java#L295-L307 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/MathUtils.java | MathUtils.rectangularPrismSurfaceArea | public static double rectangularPrismSurfaceArea(final double length, final double height, final double width) {
return ((2 * length * height) + (2 * length * width) + (2 * height * width));
} | java | public static double rectangularPrismSurfaceArea(final double length, final double height, final double width) {
return ((2 * length * height) + (2 * length * width) + (2 * height * width));
} | [
"public",
"static",
"double",
"rectangularPrismSurfaceArea",
"(",
"final",
"double",
"length",
",",
"final",
"double",
"height",
",",
"final",
"double",
"width",
")",
"{",
"return",
"(",
"(",
"2",
"*",
"length",
"*",
"height",
")",
"+",
"(",
"2",
"*",
"l... | Calculates the surface area of a rectangular prism;
@param length a double value indicating the length of the rectangular prism (x axis).
@param height a double value indicating the height of the rectangular prism (y axis).
@param width a double value indicating the width of the rectangular prism (z axis).
@return the... | [
"Calculates",
"the",
"surface",
"area",
"of",
"a",
"rectangular",
"prism",
";"
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/MathUtils.java#L364-L366 | train |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/MathUtils.java | MathUtils.sum | @NullSafe
public static int sum(final int... numbers) {
int sum = 0;
if (numbers != null) {
for (int number : numbers) {
sum += number;
}
}
return sum;
} | java | @NullSafe
public static int sum(final int... numbers) {
int sum = 0;
if (numbers != null) {
for (int number : numbers) {
sum += number;
}
}
return sum;
} | [
"@",
"NullSafe",
"public",
"static",
"int",
"sum",
"(",
"final",
"int",
"...",
"numbers",
")",
"{",
"int",
"sum",
"=",
"0",
";",
"if",
"(",
"numbers",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"number",
":",
"numbers",
")",
"{",
"sum",
"+=",
"nu... | Calculates the sum of all integer values in the array.
@param numbers an array of integer values to sum up.
@return the sum of all integer values in the array. | [
"Calculates",
"the",
"sum",
"of",
"all",
"integer",
"values",
"in",
"the",
"array",
"."
] | f2163c149fbbef05015e688132064ebcac7c49ab | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/MathUtils.java#L435-L446 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps.java | mps.get | public static mps get(nitro_service client) throws Exception
{
mps resource = new mps();
resource.validate("get");
return ((mps[]) resource.get_resources(client))[0];
} | java | public static mps get(nitro_service client) throws Exception
{
mps resource = new mps();
resource.validate("get");
return ((mps[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"mps",
"get",
"(",
"nitro_service",
"client",
")",
"throws",
"Exception",
"{",
"mps",
"resource",
"=",
"new",
"mps",
"(",
")",
";",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"mps",
"[",
"]",
")",
"... | Use this operation to get Management Service Information. | [
"Use",
"this",
"operation",
"to",
"get",
"Management",
"Service",
"Information",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps.java#L276-L281 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/util/ObjectUtils.java | ObjectUtils.copy | public static Serializable copy(Serializable obj) {
try {
ByteArrayOutputStream buf = new ByteArrayOutputStream(4096);
ObjectOutputStream out = new ObjectOutputStream(buf);
out.writeObject(obj);
out.close();
ByteArrayInputStream buf2 = new ByteArrayIn... | java | public static Serializable copy(Serializable obj) {
try {
ByteArrayOutputStream buf = new ByteArrayOutputStream(4096);
ObjectOutputStream out = new ObjectOutputStream(buf);
out.writeObject(obj);
out.close();
ByteArrayInputStream buf2 = new ByteArrayIn... | [
"public",
"static",
"Serializable",
"copy",
"(",
"Serializable",
"obj",
")",
"{",
"try",
"{",
"ByteArrayOutputStream",
"buf",
"=",
"new",
"ByteArrayOutputStream",
"(",
"4096",
")",
";",
"ObjectOutputStream",
"out",
"=",
"new",
"ObjectOutputStream",
"(",
"buf",
"... | Makes a deep-copy clone of an object.
@param obj target object, that must implements {@link java.io.Serializable}
@return deep-copy | [
"Makes",
"a",
"deep",
"-",
"copy",
"clone",
"of",
"an",
"object",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/util/ObjectUtils.java#L25-L43 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/util/ObjectUtils.java | ObjectUtils.getConstructor | public static <T> Constructor<T> getConstructor(Class<T> cls, Class... params) {
try {
return cls.getConstructor(params);
} catch (Exception e) {
throw new ClientException(e);
}
} | java | public static <T> Constructor<T> getConstructor(Class<T> cls, Class... params) {
try {
return cls.getConstructor(params);
} catch (Exception e) {
throw new ClientException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"Constructor",
"<",
"T",
">",
"getConstructor",
"(",
"Class",
"<",
"T",
">",
"cls",
",",
"Class",
"...",
"params",
")",
"{",
"try",
"{",
"return",
"cls",
".",
"getConstructor",
"(",
"params",
")",
";",
"}",
"catch",... | Finds a constructor and hides all checked exceptions.
@param cls target class
@param params zero, one or more parameter types
@param <T> target type
@return its constructor object | [
"Finds",
"a",
"constructor",
"and",
"hides",
"all",
"checked",
"exceptions",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/util/ObjectUtils.java#L52-L58 | train |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/util/ObjectUtils.java | ObjectUtils.newInstance | public static <T> T newInstance(Constructor<T> constructor, Object... args) {
try {
return constructor.newInstance(args);
} catch (Exception e) {
throw new ClientException(e);
}
} | java | public static <T> T newInstance(Constructor<T> constructor, Object... args) {
try {
return constructor.newInstance(args);
} catch (Exception e) {
throw new ClientException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Constructor",
"<",
"T",
">",
"constructor",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"return",
"constructor",
".",
"newInstance",
"(",
"args",
")",
";",
"}",
"catch",
"(",
"Excepti... | Invokes a constructor and hides all checked exceptions.
@param constructor the constructor
@param args zero, one or more arguments
@param <T> target type
@return a new object | [
"Invokes",
"a",
"constructor",
"and",
"hides",
"all",
"checked",
"exceptions",
"."
] | 49af80b768c5453266414108b0d30a0fc01b8cef | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/util/ObjectUtils.java#L67-L73 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/graph/MoreGraphs.java | MoreGraphs.topologicalSort | private static <T> @NonNull List<T> topologicalSort(final @NonNull Graph<T> graph, final @NonNull SortType<T> type) {
checkArgument(graph.isDirected(), "the graph must be directed");
checkArgument(!graph.allowsSelfLoops(), "the graph cannot allow self loops");
final Map<T, Integer> requiredCounts = new Has... | java | private static <T> @NonNull List<T> topologicalSort(final @NonNull Graph<T> graph, final @NonNull SortType<T> type) {
checkArgument(graph.isDirected(), "the graph must be directed");
checkArgument(!graph.allowsSelfLoops(), "the graph cannot allow self loops");
final Map<T, Integer> requiredCounts = new Has... | [
"private",
"static",
"<",
"T",
">",
"@",
"NonNull",
"List",
"<",
"T",
">",
"topologicalSort",
"(",
"final",
"@",
"NonNull",
"Graph",
"<",
"T",
">",
"graph",
",",
"final",
"@",
"NonNull",
"SortType",
"<",
"T",
">",
"type",
")",
"{",
"checkArgument",
"... | Actual content of the topological sort. This is a breadth-first search based approach.
@param graph the graph to be sorted
@param type the sort type
@param <T> the node type
@return the sorted list
@throws CyclePresentException if the graph has cycles
@throws IllegalArgumentException if the graph is not directed or al... | [
"Actual",
"content",
"of",
"the",
"topological",
"sort",
".",
"This",
"is",
"a",
"breadth",
"-",
"first",
"search",
"based",
"approach",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/graph/MoreGraphs.java#L101-L142 | train |
jsilland/piezo | src/main/java/io/soliton/protobuf/EnvelopeServerHandler.java | EnvelopeServerHandler.invoke | private <I extends Message, O extends Message> void invoke(
ServerMethod<I, O> method, ByteString payload, long requestId, Channel channel) {
FutureCallback<O> callback = new ServerMethodCallback<>(method, requestId, channel);
try {
I request = method.inputParser().parseFrom(payload);
Listenab... | java | private <I extends Message, O extends Message> void invoke(
ServerMethod<I, O> method, ByteString payload, long requestId, Channel channel) {
FutureCallback<O> callback = new ServerMethodCallback<>(method, requestId, channel);
try {
I request = method.inputParser().parseFrom(payload);
Listenab... | [
"private",
"<",
"I",
"extends",
"Message",
",",
"O",
"extends",
"Message",
">",
"void",
"invoke",
"(",
"ServerMethod",
"<",
"I",
",",
"O",
">",
"method",
",",
"ByteString",
"payload",
",",
"long",
"requestId",
",",
"Channel",
"channel",
")",
"{",
"Future... | Performs a single method invocation.
@param method the method to invoke
@param payload the serialized parameter received from the client
@param requestId the unique identifier of the request
@param channel the channel to use for responding to the client
@param <I> the type of the method's parameter
@param <O> the retu... | [
"Performs",
"a",
"single",
"method",
"invocation",
"."
] | 9a340f1460d25e07ec475dd24128b838667c959b | https://github.com/jsilland/piezo/blob/9a340f1460d25e07ec475dd24128b838667c959b/src/main/java/io/soliton/protobuf/EnvelopeServerHandler.java#L161-L172 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/CFProperties.java | CFProperties.getPreferenceValue | public String getPreferenceValue(String key, String defaultValue) {
if (userCFProperties.containsKey(key))
return userCFProperties.getProperty(key);
else if (userHomeCFProperties.containsKey(key))
return userHomeCFProperties.getProperty(key);
else if (systemCFProperties.containsKey(key))
return systemCFP... | java | public String getPreferenceValue(String key, String defaultValue) {
if (userCFProperties.containsKey(key))
return userCFProperties.getProperty(key);
else if (userHomeCFProperties.containsKey(key))
return userHomeCFProperties.getProperty(key);
else if (systemCFProperties.containsKey(key))
return systemCFP... | [
"public",
"String",
"getPreferenceValue",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"if",
"(",
"userCFProperties",
".",
"containsKey",
"(",
"key",
")",
")",
"return",
"userCFProperties",
".",
"getProperty",
"(",
"key",
")",
";",
"else",
... | check java preferences for the requested key - then checks the various
default properties files.
@param key
@param defaultValue
@return | [
"check",
"java",
"preferences",
"for",
"the",
"requested",
"key",
"-",
"then",
"checks",
"the",
"various",
"default",
"properties",
"files",
"."
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/CFProperties.java#L100-L111 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_temp.java | xen_health_monitor_temp.get_filtered | public static xen_health_monitor_temp[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
xen_health_monitor_temp obj = new xen_health_monitor_temp();
options option = new options();
option.set_filter(filter);
xen_health_monitor_temp[] response = (xen_health_monitor_temp[]) obj.... | java | public static xen_health_monitor_temp[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
xen_health_monitor_temp obj = new xen_health_monitor_temp();
options option = new options();
option.set_filter(filter);
xen_health_monitor_temp[] response = (xen_health_monitor_temp[]) obj.... | [
"public",
"static",
"xen_health_monitor_temp",
"[",
"]",
"get_filtered",
"(",
"nitro_service",
"service",
",",
"filtervalue",
"[",
"]",
"filter",
")",
"throws",
"Exception",
"{",
"xen_health_monitor_temp",
"obj",
"=",
"new",
"xen_health_monitor_temp",
"(",
")",
";",... | Use this API to fetch filtered set of xen_health_monitor_temp resources.
set the filter parameter values in filtervalue object. | [
"Use",
"this",
"API",
"to",
"fetch",
"filtered",
"set",
"of",
"xen_health_monitor_temp",
"resources",
".",
"set",
"the",
"filter",
"parameter",
"values",
"in",
"filtervalue",
"object",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_temp.java#L88-L95 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/Pair.java | Pair.left | public static <L, R> @NonNull Pair<L, R> left(final @Nullable L left) {
return of(left, null);
} | java | public static <L, R> @NonNull Pair<L, R> left(final @Nullable L left) {
return of(left, null);
} | [
"public",
"static",
"<",
"L",
",",
"R",
">",
"@",
"NonNull",
"Pair",
"<",
"L",
",",
"R",
">",
"left",
"(",
"final",
"@",
"Nullable",
"L",
"left",
")",
"{",
"return",
"of",
"(",
"left",
",",
"null",
")",
";",
"}"
] | Creates a new pair with a left value.
@param left the left value
@param <L> the left type
@param <R> the right type
@return the pair | [
"Creates",
"a",
"new",
"pair",
"with",
"a",
"left",
"value",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/Pair.java#L52-L54 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/Pair.java | Pair.right | public static <L, R> @NonNull Pair<L, R> right(final @Nullable R right) {
return of(null, right);
} | java | public static <L, R> @NonNull Pair<L, R> right(final @Nullable R right) {
return of(null, right);
} | [
"public",
"static",
"<",
"L",
",",
"R",
">",
"@",
"NonNull",
"Pair",
"<",
"L",
",",
"R",
">",
"right",
"(",
"final",
"@",
"Nullable",
"R",
"right",
")",
"{",
"return",
"of",
"(",
"null",
",",
"right",
")",
";",
"}"
] | Creates a new pair with a right value.
@param right the right value
@param <L> the left type
@param <R> the right type
@return the pair | [
"Creates",
"a",
"new",
"pair",
"with",
"a",
"right",
"value",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/Pair.java#L64-L66 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/Pair.java | Pair.of | public static <L, R> @NonNull Pair<L, R> of(final Map.Entry<L, R> entry) {
return of(entry.getKey(), entry.getValue());
} | java | public static <L, R> @NonNull Pair<L, R> of(final Map.Entry<L, R> entry) {
return of(entry.getKey(), entry.getValue());
} | [
"public",
"static",
"<",
"L",
",",
"R",
">",
"@",
"NonNull",
"Pair",
"<",
"L",
",",
"R",
">",
"of",
"(",
"final",
"Map",
".",
"Entry",
"<",
"L",
",",
"R",
">",
"entry",
")",
"{",
"return",
"of",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"... | Creates a new pair from a map entry.
@param entry the entry
@param <L> the left type
@param <R> the right type
@return the pair | [
"Creates",
"a",
"new",
"pair",
"from",
"a",
"map",
"entry",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/Pair.java#L76-L78 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/Pair.java | Pair.of | public static <L, R> @NonNull Pair<L, R> of(final @Nullable L left, final @Nullable R right) {
return new Pair<>(left, right);
} | java | public static <L, R> @NonNull Pair<L, R> of(final @Nullable L left, final @Nullable R right) {
return new Pair<>(left, right);
} | [
"public",
"static",
"<",
"L",
",",
"R",
">",
"@",
"NonNull",
"Pair",
"<",
"L",
",",
"R",
">",
"of",
"(",
"final",
"@",
"Nullable",
"L",
"left",
",",
"final",
"@",
"Nullable",
"R",
"right",
")",
"{",
"return",
"new",
"Pair",
"<>",
"(",
"left",
"... | Creates a new pair.
@param left the left value
@param right the right value
@param <L> the left type
@param <R> the right type
@return the pair | [
"Creates",
"a",
"new",
"pair",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/Pair.java#L89-L91 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/Pair.java | Pair.map | public <NL, NR> @NonNull Pair<NL, NR> map(final @NonNull Function<? super L, ? extends NL> left, final @NonNull Function<? super R, ? extends NR> right) {
return new Pair<>(left.apply(this.left), right.apply(this.right));
} | java | public <NL, NR> @NonNull Pair<NL, NR> map(final @NonNull Function<? super L, ? extends NL> left, final @NonNull Function<? super R, ? extends NR> right) {
return new Pair<>(left.apply(this.left), right.apply(this.right));
} | [
"public",
"<",
"NL",
",",
"NR",
">",
"@",
"NonNull",
"Pair",
"<",
"NL",
",",
"NR",
">",
"map",
"(",
"final",
"@",
"NonNull",
"Function",
"<",
"?",
"super",
"L",
",",
"?",
"extends",
"NL",
">",
"left",
",",
"final",
"@",
"NonNull",
"Function",
"<"... | Map the left and right value of this pair.
@param left the left value function
@param right the right value function
@param <NL> the left type
@param <NR> the right type
@return a new pair | [
"Map",
"the",
"left",
"and",
"right",
"value",
"of",
"this",
"pair",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/Pair.java#L125-L127 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/Pair.java | Pair.lmap | public <NL> @NonNull Pair<NL, R> lmap(final @NonNull Function<? super L, ? extends NL> function) {
return new Pair<>(function.apply(this.left), this.right);
} | java | public <NL> @NonNull Pair<NL, R> lmap(final @NonNull Function<? super L, ? extends NL> function) {
return new Pair<>(function.apply(this.left), this.right);
} | [
"public",
"<",
"NL",
">",
"@",
"NonNull",
"Pair",
"<",
"NL",
",",
"R",
">",
"lmap",
"(",
"final",
"@",
"NonNull",
"Function",
"<",
"?",
"super",
"L",
",",
"?",
"extends",
"NL",
">",
"function",
")",
"{",
"return",
"new",
"Pair",
"<>",
"(",
"funct... | Map the left value of this pair.
@param function the function
@param <NL> the left type
@return a new pair | [
"Map",
"the",
"left",
"value",
"of",
"this",
"pair",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/Pair.java#L136-L138 | train |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/Pair.java | Pair.rmap | public <NR> @NonNull Pair<L, NR> rmap(final @NonNull Function<? super R, ? extends NR> function) {
return new Pair<>(this.left, function.apply(this.right));
} | java | public <NR> @NonNull Pair<L, NR> rmap(final @NonNull Function<? super R, ? extends NR> function) {
return new Pair<>(this.left, function.apply(this.right));
} | [
"public",
"<",
"NR",
">",
"@",
"NonNull",
"Pair",
"<",
"L",
",",
"NR",
">",
"rmap",
"(",
"final",
"@",
"NonNull",
"Function",
"<",
"?",
"super",
"R",
",",
"?",
"extends",
"NR",
">",
"function",
")",
"{",
"return",
"new",
"Pair",
"<>",
"(",
"this"... | Map the right value of this pair.
@param function the function
@param <NR> the right type
@return a new pair | [
"Map",
"the",
"right",
"value",
"of",
"this",
"pair",
"."
] | 6856747d9034a2fe0c8d0a8a0150986797732b5c | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/Pair.java#L147-L149 | train |
victims/victims-lib-java | src/main/java/com/redhat/victims/database/VictimsDB.java | VictimsDB.defaultURL | public static String defaultURL(String driver) {
assert Driver.exists(driver);
String home = "";
try {
home = VictimsConfig.home().toString();
} catch (VictimsException e) {
// Ignore and use cwd
}
return Driver.url(driver, FilenameUtils.concat(hom... | java | public static String defaultURL(String driver) {
assert Driver.exists(driver);
String home = "";
try {
home = VictimsConfig.home().toString();
} catch (VictimsException e) {
// Ignore and use cwd
}
return Driver.url(driver, FilenameUtils.concat(hom... | [
"public",
"static",
"String",
"defaultURL",
"(",
"String",
"driver",
")",
"{",
"assert",
"Driver",
".",
"exists",
"(",
"driver",
")",
";",
"String",
"home",
"=",
"\"\"",
";",
"try",
"{",
"home",
"=",
"VictimsConfig",
".",
"home",
"(",
")",
".",
"toStri... | Get the default url for a preconfigured driver.
@return | [
"Get",
"the",
"default",
"url",
"for",
"a",
"preconfigured",
"driver",
"."
] | ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/database/VictimsDB.java#L53-L62 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_brvpx_image.java | xen_brvpx_image.get | public static xen_brvpx_image get(nitro_service client, xen_brvpx_image resource) throws Exception
{
resource.validate("get");
return ((xen_brvpx_image[]) resource.get_resources(client))[0];
} | java | public static xen_brvpx_image get(nitro_service client, xen_brvpx_image resource) throws Exception
{
resource.validate("get");
return ((xen_brvpx_image[]) resource.get_resources(client))[0];
} | [
"public",
"static",
"xen_brvpx_image",
"get",
"(",
"nitro_service",
"client",
",",
"xen_brvpx_image",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"get\"",
")",
";",
"return",
"(",
"(",
"xen_brvpx_image",
"[",
"]",
")",
"res... | Use this operation to get Repeater XVA file. | [
"Use",
"this",
"operation",
"to",
"get",
"Repeater",
"XVA",
"file",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_brvpx_image.java#L150-L154 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java | base_resource.get_resources | protected base_resource[] get_resources(nitro_service service, options option) throws Exception
{
if (!service.isLogin())
service.login();
String response = _get(service, option);
return get_nitro_response(service, response);
} | java | protected base_resource[] get_resources(nitro_service service, options option) throws Exception
{
if (!service.isLogin())
service.login();
String response = _get(service, option);
return get_nitro_response(service, response);
} | [
"protected",
"base_resource",
"[",
"]",
"get_resources",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
")",
"service",
".",
"login",
"(",
")",
";",
"String",... | Use this method to perform a get operation on MPS resource.
@param service nitro_service object.
@param option options class object.
@return Array of API resources of specified type.
@throws Exception API exception is thrown. | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"get",
"operation",
"on",
"MPS",
"resource",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L106-L112 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java | base_resource.perform_operation | public base_resource[] perform_operation(nitro_service service) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
return post_request(service, null);
} | java | public base_resource[] perform_operation(nitro_service service) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
return post_request(service, null);
} | [
"public",
"base_resource",
"[",
"]",
"perform_operation",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
"&&",
"!",
"get_object_type",
"(",
")",
".",
"equals",
"(",
"\"login\"",
")",
"... | Use this method to perform a any post operation ...etc
operation on MPS resource.
@param service nitro_service object.
@return status of the operation performed.
@throws Exception API exception is thrown. | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"any",
"post",
"operation",
"...",
"etc",
"operation",
"on",
"MPS",
"resource",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L164-L169 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java | base_resource.add_resource | protected base_resource[] add_resource(nitro_service service, options option) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
String request = resource_to_string(service, option);
return post_data(service, request);
} | java | protected base_resource[] add_resource(nitro_service service, options option) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
String request = resource_to_string(service, option);
return post_data(service, request);
} | [
"protected",
"base_resource",
"[",
"]",
"add_resource",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
"&&",
"!",
"get_object_type",
"(",
")",
".",
"equals",
... | Use this method to perform a add operation on MPS resource.
@param service nitro_service object.
@param option options class object.
@return status of the operation performed.
@throws Exception | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"add",
"operation",
"on",
"MPS",
"resource",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L216-L223 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java | base_resource.update_resource | protected base_resource[] update_resource(nitro_service service, options option) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
String request = resource_to_string(service, option);
return put_data(service,request);
} | java | protected base_resource[] update_resource(nitro_service service, options option) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
String request = resource_to_string(service, option);
return put_data(service,request);
} | [
"protected",
"base_resource",
"[",
"]",
"update_resource",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
"&&",
"!",
"get_object_type",
"(",
")",
".",
"equals",... | Use this method to perform a modify operation on MPS resource.
@param service nitro_service object.
@param option options class object.
@return status of the operation performed.
@throws Exception | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"modify",
"operation",
"on",
"MPS",
"resource",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L249-L255 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java | base_resource.delete_resource | protected base_resource[] delete_resource(nitro_service service) throws Exception
{
if (!service.isLogin())
service.login();
String str = nitro_util.object_to_string_withoutquotes(this);
String response = _delete(service, str);
return get_nitro_response(service, response);
} | java | protected base_resource[] delete_resource(nitro_service service) throws Exception
{
if (!service.isLogin())
service.login();
String str = nitro_util.object_to_string_withoutquotes(this);
String response = _delete(service, str);
return get_nitro_response(service, response);
} | [
"protected",
"base_resource",
"[",
"]",
"delete_resource",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
")",
"service",
".",
"login",
"(",
")",
";",
"String",
"str",
"=",
"nitro_util... | Use this method to perform a delete operation on MPS resource.
@param service nitro_service object
@return status of the operation performed.
@throws Exception API exception is thrown. | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"delete",
"operation",
"on",
"MPS",
"resource",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L269-L278 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java | base_resource._delete | private String _delete(nitro_service service, String req_args) throws Exception
{
StringBuilder responseStr = new StringBuilder();
HttpURLConnection httpURLConnection = null;
try
{
String urlstr;
String ipaddress = service.get_ipaddress();
String version = service.get_version();
String ses... | java | private String _delete(nitro_service service, String req_args) throws Exception
{
StringBuilder responseStr = new StringBuilder();
HttpURLConnection httpURLConnection = null;
try
{
String urlstr;
String ipaddress = service.get_ipaddress();
String version = service.get_version();
String ses... | [
"private",
"String",
"_delete",
"(",
"nitro_service",
"service",
",",
"String",
"req_args",
")",
"throws",
"Exception",
"{",
"StringBuilder",
"responseStr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"HttpURLConnection",
"httpURLConnection",
"=",
"null",
";",
"tr... | This method, forms the http DELETE request, applies on the MPS.
Reads the response from the MPS and converts it to base response.
@param service
@param req_args
@return
@throws Exception | [
"This",
"method",
"forms",
"the",
"http",
"DELETE",
"request",
"applies",
"on",
"the",
"MPS",
".",
"Reads",
"the",
"response",
"from",
"the",
"MPS",
"and",
"converts",
"it",
"to",
"base",
"response",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L571-L657 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java | base_resource.update_bulk_request | protected static base_resource[] update_bulk_request(nitro_service service,base_resource resources[]) throws Exception
{
if (!service.isLogin())
service.login();
String objtype = resources[0].get_object_type();
String onerror = service.get_onerror();
//String id = service.get_sessionid();
Str... | java | protected static base_resource[] update_bulk_request(nitro_service service,base_resource resources[]) throws Exception
{
if (!service.isLogin())
service.login();
String objtype = resources[0].get_object_type();
String onerror = service.get_onerror();
//String id = service.get_sessionid();
Str... | [
"protected",
"static",
"base_resource",
"[",
"]",
"update_bulk_request",
"(",
"nitro_service",
"service",
",",
"base_resource",
"resources",
"[",
"]",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
")",
"service",
".",
... | Use this method to perform a modify operation on multiple MPS resources.
@param service nitro_service object.
@return status of the operation performed.
@throws Exception | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"modify",
"operation",
"on",
"multiple",
"MPS",
"resources",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/base_resource.java#L702-L717 | train |
everit-org/osgi-richconsole | src/main/java/org/everit/osgi/dev/richconsole/internal/upgrade/UpgradeProcess.java | UpgradeProcess.uninstallBundle | public void uninstallBundle(final String symbolicName, final String version) {
Bundle bundle = bundleDeployerService.getExistingBundleBySymbolicName(symbolicName, version, null);
if (bundle != null) {
stateChanged = true;
Logger.info("Uninstalling bundle: " + bundle);
... | java | public void uninstallBundle(final String symbolicName, final String version) {
Bundle bundle = bundleDeployerService.getExistingBundleBySymbolicName(symbolicName, version, null);
if (bundle != null) {
stateChanged = true;
Logger.info("Uninstalling bundle: " + bundle);
... | [
"public",
"void",
"uninstallBundle",
"(",
"final",
"String",
"symbolicName",
",",
"final",
"String",
"version",
")",
"{",
"Bundle",
"bundle",
"=",
"bundleDeployerService",
".",
"getExistingBundleBySymbolicName",
"(",
"symbolicName",
",",
"version",
",",
"null",
")",... | Uninstalling an existing bundle
@param symbolicName
The symbolicName of the bundle
@param version
The version of the bundle, optional. In case this parameter is null, the first bundle with the given
symbolic name will be uninstalled. | [
"Uninstalling",
"an",
"existing",
"bundle"
] | 417eaf497ec5f325576c2f4c05af7bd1243e5249 | https://github.com/everit-org/osgi-richconsole/blob/417eaf497ec5f325576c2f4c05af7bd1243e5249/src/main/java/org/everit/osgi/dev/richconsole/internal/upgrade/UpgradeProcess.java#L361-L376 | train |
jsilland/piezo | src/main/java/io/soliton/protobuf/EnvelopeFuture.java | EnvelopeFuture.setResponse | public void setResponse(Envelope response) {
if (response.hasControl() && response.getControl().hasError()) {
setException(new Exception(response.getControl().getError()));
return;
}
try {
set(clientMethod.outputParser().parseFrom(response.getPayload()));
clientLogger.logSuccess(clie... | java | public void setResponse(Envelope response) {
if (response.hasControl() && response.getControl().hasError()) {
setException(new Exception(response.getControl().getError()));
return;
}
try {
set(clientMethod.outputParser().parseFrom(response.getPayload()));
clientLogger.logSuccess(clie... | [
"public",
"void",
"setResponse",
"(",
"Envelope",
"response",
")",
"{",
"if",
"(",
"response",
".",
"hasControl",
"(",
")",
"&&",
"response",
".",
"getControl",
"(",
")",
".",
"hasError",
"(",
")",
")",
"{",
"setException",
"(",
"new",
"Exception",
"(",
... | Sets the response envelope of this promise.
@param response the envelope of the response. | [
"Sets",
"the",
"response",
"envelope",
"of",
"this",
"promise",
"."
] | 9a340f1460d25e07ec475dd24128b838667c959b | https://github.com/jsilland/piezo/blob/9a340f1460d25e07ec475dd24128b838667c959b/src/main/java/io/soliton/protobuf/EnvelopeFuture.java#L54-L65 | train |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/host_interface.java | host_interface.reset | public static host_interface reset(nitro_service client, host_interface resource) throws Exception
{
return ((host_interface[]) resource.perform_operation(client, "reset"))[0];
} | java | public static host_interface reset(nitro_service client, host_interface resource) throws Exception
{
return ((host_interface[]) resource.perform_operation(client, "reset"))[0];
} | [
"public",
"static",
"host_interface",
"reset",
"(",
"nitro_service",
"client",
",",
"host_interface",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"host_interface",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"r... | Use this operation to reset interface settings. | [
"Use",
"this",
"operation",
"to",
"reset",
"interface",
"settings",
"."
] | c840919f1a8f7c0a5634c0f23d34fa14d1765ff1 | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/host_interface.java#L771-L774 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java | ChannelUtil.getTagNames | public static Collection<String> getTagNames(Channel channel) {
Collection<String> tagNames = new HashSet<String>();
for (Tag tag : channel.getTags()) {
tagNames.add(tag.getName());
}
return tagNames;
} | java | public static Collection<String> getTagNames(Channel channel) {
Collection<String> tagNames = new HashSet<String>();
for (Tag tag : channel.getTags()) {
tagNames.add(tag.getName());
}
return tagNames;
} | [
"public",
"static",
"Collection",
"<",
"String",
">",
"getTagNames",
"(",
"Channel",
"channel",
")",
"{",
"Collection",
"<",
"String",
">",
"tagNames",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Tag",
"tag",
":",
"channel",
... | Return a list of tag names associated with this channel
@param channel - channel to be processed
@return Collection of names of tags | [
"Return",
"a",
"list",
"of",
"tag",
"names",
"associated",
"with",
"this",
"channel"
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java#L38-L44 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java | ChannelUtil.getAllTagNames | public static Collection<String> getAllTagNames(Collection<Channel> channels) {
Collection<String> tagNames = new HashSet<String>();
for (Channel channel : channels) {
tagNames.addAll(getTagNames(channel));
}
return tagNames;
} | java | public static Collection<String> getAllTagNames(Collection<Channel> channels) {
Collection<String> tagNames = new HashSet<String>();
for (Channel channel : channels) {
tagNames.addAll(getTagNames(channel));
}
return tagNames;
} | [
"public",
"static",
"Collection",
"<",
"String",
">",
"getAllTagNames",
"(",
"Collection",
"<",
"Channel",
">",
"channels",
")",
"{",
"Collection",
"<",
"String",
">",
"tagNames",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Cha... | Return a union of tag names associated with channels
@param channels - list of channels
@return a set of all unique tag names associated with atleast one or more
channel in channels | [
"Return",
"a",
"union",
"of",
"tag",
"names",
"associated",
"with",
"channels"
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java#L53-L59 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java | ChannelUtil.getPropertyNames | public static Collection<String> getPropertyNames(Channel channel) {
Collection<String> propertyNames = new HashSet<String>();
for (Property property : channel.getProperties()) {
if (property.getValue() != null)
propertyNames.add(property.getName());
}
return propertyNames;
} | java | public static Collection<String> getPropertyNames(Channel channel) {
Collection<String> propertyNames = new HashSet<String>();
for (Property property : channel.getProperties()) {
if (property.getValue() != null)
propertyNames.add(property.getName());
}
return propertyNames;
} | [
"public",
"static",
"Collection",
"<",
"String",
">",
"getPropertyNames",
"(",
"Channel",
"channel",
")",
"{",
"Collection",
"<",
"String",
">",
"propertyNames",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Property",
"property",
... | Return a list of property names associated with this channel
@param channel - channel to be processed
@return Collection of names of properties | [
"Return",
"a",
"list",
"of",
"property",
"names",
"associated",
"with",
"this",
"channel"
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java#L67-L74 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java | ChannelUtil.getTag | @Deprecated
public static Tag getTag(Channel channel, String tagName) {
Collection<Tag> tag = Collections2.filter(channel.getTags(),
new TagNamePredicate(tagName));
if (tag.size() == 1)
return tag.iterator().next();
else
return null;
} | java | @Deprecated
public static Tag getTag(Channel channel, String tagName) {
Collection<Tag> tag = Collections2.filter(channel.getTags(),
new TagNamePredicate(tagName));
if (tag.size() == 1)
return tag.iterator().next();
else
return null;
} | [
"@",
"Deprecated",
"public",
"static",
"Tag",
"getTag",
"(",
"Channel",
"channel",
",",
"String",
"tagName",
")",
"{",
"Collection",
"<",
"Tag",
">",
"tag",
"=",
"Collections2",
".",
"filter",
"(",
"channel",
".",
"getTags",
"(",
")",
",",
"new",
"TagNam... | Deprecated - use channel.getTag instead
Return the Tag object with name <tt>tagName</tt> if it exists on the
channel <tt>channel</tt> else return null
@param channel - channel
@param tagName - tag name
@return Tag - tag object found on channel | [
"Deprecated",
"-",
"use",
"channel",
".",
"getTag",
"instead"
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java#L86-L94 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java | ChannelUtil.getProperty | @Deprecated
public static Property getProperty(Channel channel, String propertyName) {
Collection<Property> property = Collections2.filter(
channel.getProperties(),
new PropertyNamePredicate(propertyName));
if (property.size() == 1)
return property.iterator().next();
else
return null;
} | java | @Deprecated
public static Property getProperty(Channel channel, String propertyName) {
Collection<Property> property = Collections2.filter(
channel.getProperties(),
new PropertyNamePredicate(propertyName));
if (property.size() == 1)
return property.iterator().next();
else
return null;
} | [
"@",
"Deprecated",
"public",
"static",
"Property",
"getProperty",
"(",
"Channel",
"channel",
",",
"String",
"propertyName",
")",
"{",
"Collection",
"<",
"Property",
">",
"property",
"=",
"Collections2",
".",
"filter",
"(",
"channel",
".",
"getProperties",
"(",
... | deprecated - use the channel.getProperty instead
Return the property object with the name <tt>propertyName</tt> if it
exists on the channel <tt>channel</tt> else return null
@param channel - channel
@param propertyName - property name
@return Property - property object found on channel | [
"deprecated",
"-",
"use",
"the",
"channel",
".",
"getProperty",
"instead"
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java#L122-L131 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java | ChannelUtil.getPropertyNames | public static Collection<String> getPropertyNames(
Collection<Channel> channels) {
Collection<String> propertyNames = new HashSet<String>();
for (Channel channel : channels) {
propertyNames.addAll(getPropertyNames(channel));
}
return propertyNames;
} | java | public static Collection<String> getPropertyNames(
Collection<Channel> channels) {
Collection<String> propertyNames = new HashSet<String>();
for (Channel channel : channels) {
propertyNames.addAll(getPropertyNames(channel));
}
return propertyNames;
} | [
"public",
"static",
"Collection",
"<",
"String",
">",
"getPropertyNames",
"(",
"Collection",
"<",
"Channel",
">",
"channels",
")",
"{",
"Collection",
"<",
"String",
">",
"propertyNames",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",... | Return a union of property names associated with channels
@param channels - list of channels
@return a set of all unique property names associated with atleast one or
more channel in channels | [
"Return",
"a",
"union",
"of",
"property",
"names",
"associated",
"with",
"channels"
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java#L156-L163 | train |
ChannelFinder/javaCFClient | src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java | ChannelUtil.getChannelNames | public static Collection<String> getChannelNames(
Collection<Channel> channels) {
Collection<String> channelNames = new HashSet<String>();
for (Channel channel : channels) {
channelNames.add(channel.getName());
}
return channelNames;
} | java | public static Collection<String> getChannelNames(
Collection<Channel> channels) {
Collection<String> channelNames = new HashSet<String>();
for (Channel channel : channels) {
channelNames.add(channel.getName());
}
return channelNames;
} | [
"public",
"static",
"Collection",
"<",
"String",
">",
"getChannelNames",
"(",
"Collection",
"<",
"Channel",
">",
"channels",
")",
"{",
"Collection",
"<",
"String",
">",
"channelNames",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
... | Returns all the channel Names in the given Collection of channels
@param channels - list of channels
@return a set of all the unique names associated with the each channel in
channels | [
"Returns",
"all",
"the",
"channel",
"Names",
"in",
"the",
"given",
"Collection",
"of",
"channels"
] | 000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d | https://github.com/ChannelFinder/javaCFClient/blob/000fce53ad2b8f8c38ef24fec5b5ec65e383ac9d/src/main/java/gov/bnl/channelfinder/api/ChannelUtil.java#L184-L191 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.